mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-06 04:05:11 +08:00
Compare commits
371 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
520fc33394 | ||
|
|
f705a7cd26 | ||
|
|
65bfff69d0 | ||
|
|
9d8ba03f5e | ||
|
|
778b8ede58 | ||
|
|
f8a1a2ed71 | ||
|
|
b4a7c266b5 | ||
|
|
a488f79852 | ||
|
|
b290046503 | ||
|
|
e8409cee8b | ||
|
|
1d4d355b38 | ||
|
|
dfe12535a5 | ||
|
|
74946100f1 | ||
|
|
9a1717915c | ||
|
|
3691eb6e48 | ||
|
|
3bb7471fd3 | ||
|
|
74e09ddb12 | ||
|
|
6b73d056b2 | ||
|
|
3e7847551a | ||
|
|
91d92935fa | ||
|
|
eff033298a | ||
|
|
3a8f4961bc | ||
|
|
b81f94518a | ||
|
|
96f7f5457d | ||
|
|
498ec6b4f1 | ||
|
|
607e62a1ae | ||
|
|
d41a80bc2c | ||
|
|
643bec4071 | ||
|
|
a7e84230c3 | ||
|
|
c96cf7e22d | ||
|
|
46c61660cf | ||
|
|
f6fecce52b | ||
|
|
54a5947a3c | ||
|
|
521bc675a2 | ||
|
|
845cee2578 | ||
|
|
93ceb0e4ed | ||
|
|
13aab4e59c | ||
|
|
36c2f9e9f2 | ||
|
|
514da0ffa9 | ||
|
|
37b8d5da79 | ||
|
|
b5d602d953 | ||
|
|
c926fee13c | ||
|
|
a675806c91 | ||
|
|
683c4874f8 | ||
|
|
20ced857b4 | ||
|
|
c6c86f9665 | ||
|
|
1e0107944f | ||
|
|
21797f9ac8 | ||
|
|
c800b34cd4 | ||
|
|
1612e2d669 | ||
|
|
26d229c8ca | ||
|
|
9c66e86be1 | ||
|
|
7e9f87de2d | ||
|
|
67737446ac | ||
|
|
dabed4f9eb | ||
|
|
f9b6389248 | ||
|
|
9ec1e259b4 | ||
|
|
0c2d480d89 | ||
|
|
350d8ccb7b | ||
|
|
0c512d0431 | ||
|
|
3bf55c9ea4 | ||
|
|
9994c57796 | ||
|
|
3f724b6b17 | ||
|
|
255773b4de | ||
|
|
5b73a788da | ||
|
|
748b06a00e | ||
|
|
273bccdc9a | ||
|
|
f0a2362da3 | ||
|
|
be8ade23e8 | ||
|
|
6814908d80 | ||
|
|
08dbfc45d3 | ||
|
|
89f9b3df68 | ||
|
|
40c9a2fb82 | ||
|
|
a34c22fb10 | ||
|
|
e161ff0f7a | ||
|
|
fee42eab5a | ||
|
|
2d2e03f235 | ||
|
|
4c3c3529e9 | ||
|
|
7051b844ff | ||
|
|
68377435c8 | ||
|
|
652b1804a8 | ||
|
|
e7e1677786 | ||
|
|
f330aac113 | ||
|
|
dbdd330cf7 | ||
|
|
c448c7b0b1 | ||
|
|
8d7b9c2f01 | ||
|
|
b6a235445a | ||
|
|
9fcd4baa87 | ||
|
|
fb0102eb8e | ||
|
|
9c1afaa372 | ||
|
|
1d1a6badb5 | ||
|
|
2d41c9cb15 | ||
|
|
722cbe1f02 | ||
|
|
8ac2c241c4 | ||
|
|
dd11f73951 | ||
|
|
a443547d4d | ||
|
|
7a795edeb5 | ||
|
|
a8cbfb8dda | ||
|
|
5216cccef4 | ||
|
|
a87f399e68 | ||
|
|
dd310ab851 | ||
|
|
16cc0ca0fe | ||
|
|
83d26ad233 | ||
|
|
d1f9a8f2db | ||
|
|
a2e1071808 | ||
|
|
0aa8a2891c | ||
|
|
c0ceab7513 | ||
|
|
5c90e716cb | ||
|
|
0073225549 | ||
|
|
d03a64602b | ||
|
|
d67a4234cc | ||
|
|
0d37244490 | ||
|
|
6426919cb5 | ||
|
|
0a0d63663a | ||
|
|
71b06801ef | ||
|
|
cfc7b35927 | ||
|
|
76564958d1 | ||
|
|
a464c3dd66 | ||
|
|
bd969f3594 | ||
|
|
fb87d7c0b3 | ||
|
|
a69fc87940 | ||
|
|
e481e1d73e | ||
|
|
6c0eed1b2b | ||
|
|
a6c67fdf9f | ||
|
|
03f838e37e | ||
|
|
e21fa4a910 | ||
|
|
46889ed453 | ||
|
|
882fcc152c | ||
|
|
a41902bd46 | ||
|
|
a6af32dafd | ||
|
|
d6dfb83be7 | ||
|
|
597429cf41 | ||
|
|
5ea074a1fd | ||
|
|
29c9393da3 | ||
|
|
bf6829189e | ||
|
|
a62a9429c9 | ||
|
|
f2c080e736 | ||
|
|
ea55e78855 | ||
|
|
f7c536b81c | ||
|
|
6c40104c66 | ||
|
|
4d7d592918 | ||
|
|
c5e91f299b | ||
|
|
cff276db71 | ||
|
|
30d1492b93 | ||
|
|
f07eea5073 | ||
|
|
fe407fbe00 | ||
|
|
78bc177e05 | ||
|
|
8fb908e3d4 | ||
|
|
d8b261370a | ||
|
|
a2c9ac5b1f | ||
|
|
7f9025e178 | ||
|
|
8647110a10 | ||
|
|
48e44f0057 | ||
|
|
e3934af7d1 | ||
|
|
a5ee631191 | ||
|
|
ce39255ef0 | ||
|
|
5aac5d2a52 | ||
|
|
061b50404d | ||
|
|
279cec5ae9 | ||
|
|
83a5648335 | ||
|
|
a8fc9a4c5a | ||
|
|
6f6ddbce28 | ||
|
|
4cb425d2bb | ||
|
|
bf5fd40d64 | ||
|
|
6bc613bdb4 | ||
|
|
a982562658 | ||
|
|
96a9172e36 | ||
|
|
34d7664342 | ||
|
|
b0a79df86f | ||
|
|
9e107e900c | ||
|
|
8f819a2fde | ||
|
|
3251b68df5 | ||
|
|
3ac8ad9484 | ||
|
|
b9ca0d4563 | ||
|
|
dcb3da53b0 | ||
|
|
e68b19ed1a | ||
|
|
14c7a84482 | ||
|
|
c1d1aa6787 | ||
|
|
bee81e9723 | ||
|
|
1bfb6c560a | ||
|
|
24d6f1788a | ||
|
|
fb95cc9a97 | ||
|
|
b949da291e | ||
|
|
2ecbe5b67e | ||
|
|
6634e0487c | ||
|
|
7d61b5317c | ||
|
|
201258dc9e | ||
|
|
0330569537 | ||
|
|
a1ab84a2ca | ||
|
|
2d79f3ef7a | ||
|
|
99a7e9ad87 | ||
|
|
02b8037f33 | ||
|
|
fc55a685e3 | ||
|
|
b76a75d6b4 | ||
|
|
a251600c8a | ||
|
|
c551aefd77 | ||
|
|
f343f0da41 | ||
|
|
6d318a4102 | ||
|
|
a2b992d865 | ||
|
|
ddf3f2ffdb | ||
|
|
2454e87509 | ||
|
|
0dc44249a2 | ||
|
|
150cbfa4de | ||
|
|
c0b068d81b | ||
|
|
fbc312b6cf | ||
|
|
342e0d3e2e | ||
|
|
202b228691 | ||
|
|
c9c1286803 | ||
|
|
eab98b0eda | ||
|
|
35be80fc21 | ||
|
|
6041bb0a43 | ||
|
|
c7dd9d6437 | ||
|
|
d378878c91 | ||
|
|
4a2f8cafcd | ||
|
|
d254bac16b | ||
|
|
e23b632ce5 | ||
|
|
2f321b1471 | ||
|
|
0265e88d8f | ||
|
|
4114d2f24d | ||
|
|
8124035763 | ||
|
|
96127c6eb0 | ||
|
|
cf65a39b83 | ||
|
|
0341f96b70 | ||
|
|
c95d91cfe3 | ||
|
|
cbd10c6279 | ||
|
|
5df9e57743 | ||
|
|
c178022fb5 | ||
|
|
724c29d711 | ||
|
|
74a2dbeb91 | ||
|
|
5d20d24ebc | ||
|
|
0e2fc277c8 | ||
|
|
1505740b73 | ||
|
|
6bad07b39d | ||
|
|
f85437dfc5 | ||
|
|
c765261db6 | ||
|
|
73087ead2d | ||
|
|
8c88e82709 | ||
|
|
40dd6e0234 | ||
|
|
eb23b226cc | ||
|
|
676526a518 | ||
|
|
7e0bd86b65 | ||
|
|
97489635af | ||
|
|
a9ea3976a7 | ||
|
|
5501ca927a | ||
|
|
a19fb82d66 | ||
|
|
9d032e953f | ||
|
|
38587151a9 | ||
|
|
02d5bab04b | ||
|
|
d8f3e53b1f | ||
|
|
877ed8a92a | ||
|
|
487a652aa8 | ||
|
|
64c5d141af | ||
|
|
16db8a8008 | ||
|
|
b6b14da102 | ||
|
|
a575605c75 | ||
|
|
a205a3e878 | ||
|
|
26ef3e274c | ||
|
|
33be1b7591 | ||
|
|
de19d78571 | ||
|
|
287381d5ca |
39
.cirrus.yml
39
.cirrus.yml
@@ -1,22 +1,23 @@
|
||||
task:
|
||||
name: freebsd-12-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-12-3
|
||||
setup_script:
|
||||
- pkg update
|
||||
- pkg install -y git sdl2 python fontconfig
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
- ./scripts/cirrus/build_freebsd.sh full
|
||||
# Seems packages for it were removed from the mirrors
|
||||
# name: freebsd-12-amd64
|
||||
# freebsd_instance:
|
||||
# image_family: freebsd-12-4
|
||||
# setup_script:
|
||||
# - pkg update
|
||||
# - pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||
# - git submodule update --init --recursive
|
||||
# test_script:
|
||||
# - ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
# - ./scripts/cirrus/build_freebsd.sh full
|
||||
|
||||
task:
|
||||
name: freebsd-13-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-13-1
|
||||
image_family: freebsd-13-2
|
||||
setup_script:
|
||||
- pkg update
|
||||
- pkg install -y git sdl2 python fontconfig
|
||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
@@ -28,7 +29,19 @@ task:
|
||||
image_family: freebsd-14-0-snap
|
||||
setup_script:
|
||||
- pkg update
|
||||
- pkg install -y git sdl2 python fontconfig
|
||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||
- ./scripts/cirrus/build_freebsd.sh full
|
||||
|
||||
task:
|
||||
name: freebsd-15-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-15-0-snap
|
||||
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
|
||||
|
||||
4
.github/workflows/c-cpp.yml
vendored
4
.github/workflows/c-cpp.yml
vendored
@@ -45,11 +45,11 @@ jobs:
|
||||
- os: windows-latest
|
||||
targetos: win32
|
||||
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
|
||||
targetarch: i386
|
||||
env:
|
||||
SDL_VERSION: 2.28.1
|
||||
SDL_VERSION: 2.28.5
|
||||
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
||||
ANDROID_SDK_TOOLS_VER: 4333796
|
||||
steps:
|
||||
|
||||
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: d6a54bbf0c...7223589d60
2
3rdparty/vgui_support
vendored
2
3rdparty/vgui_support
vendored
Submodule 3rdparty/vgui_support updated: 521cf5cb6c...f85d64c149
24
Documentation/donate.md
Normal file
24
Documentation/donate.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Developers donation page
|
||||
|
||||
On this page you can find links where you can support each developer individually, who has provided public sponsorship information.
|
||||
|
||||
### [a1batross](https://github.com/a1batross)
|
||||
|
||||
* Initial Xash3D SDL2/Linux port author, Xash3D FWGS engine maintainer, creator of non-commercial Flying With Gauss organization.
|
||||
* Boosty page: https://boosty.to/a1ba
|
||||
|
||||
### [nekonomicon](https://github.com/nekonomicon)
|
||||
|
||||
* [hlsdk-portable](https://github.com/FWGS/hlsdk-portable), [mdldec](../utils/mdldec), [opensource-mods.md](opensource-mods.md) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=nekonomicon) (*BSD/clang port, PNG support, etc).
|
||||
* Boosty page: https://boosty.to/nekonomicon
|
||||
|
||||
### [Velaron](https://github.com/Velaron)
|
||||
* [cs16-client](https://github.com/Velaron/cs16-client) & [tf15-client](https://github.com/Velaron/tf15-client) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=Velaron) (Android port, voice chat, etc).
|
||||
* BuyMeACoffee page: https://www.buymeacoffee.com/velaron
|
||||
|
||||
### [SNMetamorph](https://github.com/SNMetamorph)
|
||||
* [PrimeXT](https://github.com/SNMetamorph/PrimeXT) & [GoldSrc Monitor](https://github.com/SNMetamorph/goldsrc-monitor) maintainer and Xash3D FWGS [contributor](https://github.com/FWGS/xash3d-fwgs/commits?author=SNMetamorph) (Windows port, voice chat, etc).
|
||||
* BTC: `16GAzK3qei5AwBW7sggXp3yNcFHBtdpxXj`
|
||||
* ETH (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||
* USDT (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||
* USDC (ERC20): `0xb580eeca9756e3881f9d6d026e28db28eb72a383`
|
||||
@@ -70,9 +70,11 @@ These strings are specific to Xash3D FWGS.
|
||||
|
||||
| Key | Type | Default value | Description |
|
||||
| ----------------------- | ---------- | ------------------------ | ----------- |
|
||||
| `animated_title` | boolean | 0 | Use animated title in main menu (WON Half-Life logo.avi imitation from Half-Life 25-th anniversary update)
|
||||
| `autosave_aged_count` | integer | 2 | Auto saves limit used in saves rotation |
|
||||
| `gamedll_linux` | string | Generated from `gamedll` | Game server DLL for 32-bit x86 Linux (see LibraryNaming.md for details) |
|
||||
| `gamedll_osx` | string | Generated from `gamedll` | Game server DLL for 32-bit x86 macOS (see LibraryNaming.md for details) |
|
||||
| `hd_background` | boolean | 0 | Use HD background for main menu (Half-Life 25-th anniversary update) |
|
||||
| `internal_vgui_support` | boolean | 0 | Only for programmers! Required to be set as 1 for PrimeXT!<br>When set to 1, the engine will not load vgui_support DLL, as VGUI support is done (or intentionally ignored) on the game side. |
|
||||
| `render_picbutton_text` | boolean | 0 | When set to 1, the UI will not use prerendered `btns_main.bmp` and dynamically render them instead |
|
||||
| `quicksave_aged_count` | integer | 2 | Quick saves limit used in saves rotation |
|
||||
@@ -88,6 +90,7 @@ The table below defines conversion rules from liblist.gam to gameinfo.txt. Some
|
||||
|
||||
| `liblist.gam` key | `gameinfo.txt` key | Note |
|
||||
| ----------------- | ------------------ | ---- |
|
||||
| `animated_title` | `animated_title` | |
|
||||
| `edicts` | `max_edicts` | |
|
||||
| `fallback_dir` | `fallback_dir` | |
|
||||
| `game` | `title` | |
|
||||
@@ -95,6 +98,7 @@ The table below defines conversion rules from liblist.gam to gameinfo.txt. Some
|
||||
| `gamedll` | `gamedll` | |
|
||||
| `gamedll_linux` | `gamedll_linux` | |
|
||||
| `gamedll_osx` | `gamedll_osx` | |
|
||||
| `hd_background` | `hd_background` | |
|
||||
| `icon` | `icon` | |
|
||||
| `mpentity` | `mp_entity` | |
|
||||
| `mpfilter` | `mp_filter` | |
|
||||
|
||||
@@ -133,22 +133,8 @@ Available in mod archive on ModDB - https://www.moddb.com/mods/overturn
|
||||
## Oz Deathmatch
|
||||
Mirrored on github - https://github.com/nekonomicon/OZDM
|
||||
|
||||
## Spirit of Half-Life
|
||||
[Logic&Trick's](https://github.com/LogicAndTrick) mirror - https://files.logic-and-trick.com/#/Half-Life/Mods/Spirit%20of%20Half-Life
|
||||
|
||||
## Threewave CTF
|
||||
*Unfinished mod by Valve Software*
|
||||
|
||||
Available in Valve's Half-Life repository with Deathmatch Classic sources - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
||||
|
||||
## Trinity Render
|
||||
Available on ModDB: https://www.moddb.com/mods/half-life-episode-two/downloads/trinity-rendering-engine-v308f
|
||||
|
||||
## Tyrian: Ground Assault
|
||||
Available on ModDB: https://www.moddb.com/mods/tyriangroundassault/downloads/tyrianga-v1-0-src
|
||||
|
||||
## Paranoia
|
||||
Available on ModDB: https://www.moddb.com/mods/paranoia/downloads/paranoia-toolkit
|
||||
Available on ModDB - https://www.moddb.com/mods/paranoia/downloads/paranoia-toolkit
|
||||
|
||||
## Paranoia 2: The Savior
|
||||
Prealpha, mirrored on github - https://github.com/a1batross/Paranoia2_ancient
|
||||
@@ -163,12 +149,37 @@ Was found on HLFX - http://hlfx.ru/forum/showthread.php?s=2c892dfc52f72be52a89c3
|
||||
## Ricochet
|
||||
Available in Valve's Half-Life repository - https://github.com/ValveSoftware/halflife/tree/master/ricochet
|
||||
|
||||
## Spirit of Half-Life
|
||||
[Logic&Trick's](https://github.com/LogicAndTrick) mirror - https://files.logic-and-trick.com/#/Half-Life/Mods/Spirit%20of%20Half-Life
|
||||
|
||||
## The Wastes
|
||||
Version 1.5: mirrored on code.idtech.space - https://code.idtech.space/vera/halflife-thewastes-sdk
|
||||
|
||||
## Threewave CTF
|
||||
*Unfinished mod by Valve Software*
|
||||
|
||||
Available in Valve's Half-Life repository with Deathmatch Classic sources - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
||||
|
||||
## Trinity Render
|
||||
Available on ModDB - https://www.moddb.com/mods/half-life-episode-two/downloads/trinity-rendering-engine-v308f
|
||||
|
||||
## Tyrian: Ground Assault
|
||||
Available on ModDB - https://www.moddb.com/mods/tyriangroundassault/downloads/tyrianga-v1-0-src
|
||||
|
||||
## Wasteland
|
||||
Mirrored on code.idtech.space - https://code.idtech.space/vera/halflife-wasteland-sdk
|
||||
|
||||
## Wizard Wars
|
||||
Download page on official site - http://www.thothie.com/ww/
|
||||
|
||||
## XashXT
|
||||
Mirrored on github - https://github.com/a1batross/XashXT_original
|
||||
|
||||
## Xen-Warrior
|
||||
*Source code is a part of Spirit of Half-Life 1.0-1.2 under XENWARRIOR macro*
|
||||
|
||||
[Logic&Trick's](https://github.com/LogicAndTrick) mirror - https://files.logic-and-trick.com/#/Half-Life/Mods/Spirit%20of%20Half-Life
|
||||
|
||||
## Zombie-X
|
||||
Available in mod archive on ModDB - https://www.moddb.com/mods/zombie-x-10-final/downloads/zombie-x-10-dle-beta6-last-version
|
||||
|
||||
@@ -190,12 +201,12 @@ malortie's recreation - https://github.com/malortie/hl-aom
|
||||
Branch **aom** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/aom
|
||||
|
||||
## Afraid of Monsters: Director's cut
|
||||
Reverse-engineered code, branch **aomdc** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/aomdc
|
||||
Reverse-engineered code: branch **aomdc** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/aomdc
|
||||
|
||||
## Azure Sheep
|
||||
malortie's recreation - https://github.com/malortie/hl-asheep
|
||||
|
||||
Reverse-engineered code, branch **asheep** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/asheep
|
||||
Reverse-engineered code: branch **asheep** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/asheep
|
||||
|
||||
## Big Lolly
|
||||
malortie's recreation - https://github.com/malortie/hl-biglolly
|
||||
@@ -217,7 +228,7 @@ Branch **caseclosed** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable
|
||||
Branch **CAd** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/CAd
|
||||
|
||||
## Counter Strike
|
||||
Reverse-engineered code of client part by a1batross - https://github.com/FWGS/cs16-client/tree/v1.32
|
||||
Reverse-engineered code of client part by a1batross - https://github.com/Velaron/cs16-client
|
||||
|
||||
Reverse-engineered code of server part by nagist - https://github.com/nagist/cs16nd
|
||||
|
||||
@@ -229,15 +240,22 @@ CSO-like Xash3D-based mod, CSMoE - https://github.com/MoeMod/CSMoE
|
||||
## Crack-Life: Campaign Mode
|
||||
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
|
||||
malortie's recreation - https://github.com/malortie/hl-eftd
|
||||
|
||||
Reverse-engineered code, branch **eftd** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/eftd
|
||||
Reverse-engineered code: branch **eftd** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/eftd
|
||||
|
||||
## Half-Life: Black Guard
|
||||
*This mod uses dlls from Cleaner's Adventures*
|
||||
|
||||
Branch **CAd** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/CAd
|
||||
|
||||
## Half-Life: Blue Shift
|
||||
Unkle Mike's recreation - https://hlfx.ru/forum/showthread.php?s=&threadid=5253
|
||||
|
||||
Reverse-engineered code, branch **bshift** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/bshift
|
||||
Reverse-engineered code: branch **bshift** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/bshift
|
||||
|
||||
## Half-Life: Induction
|
||||
Branch **induction** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/induction
|
||||
@@ -245,12 +263,12 @@ Branch **induction** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/
|
||||
## Half-Life: Opposing Force
|
||||
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/hlsdk-xash3d
|
||||
|
||||
Reverse-engineered code, clean branch **opfor** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/opfor
|
||||
Reverse-engineered code: clean branch **opfor** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/opfor
|
||||
|
||||
Spirit of Half Life: Opposing-Force Edition - https://github.com/Hammermaps-DEV/SOHL-V1.9-Opposing-Force-Edition
|
||||
|
||||
## Half-Life: Rebellion
|
||||
Reverse-engineered code, branch **rebellion** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/rebellion
|
||||
Reverse-engineered code: branch **rebellion** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/rebellion
|
||||
|
||||
## Half-Life: Urbicide
|
||||
Branch **hl_urbicide** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/hl_urbicide
|
||||
@@ -258,7 +276,7 @@ Branch **hl_urbicide** in hlsdk-portable - https://github.com/FWGS/hlsdk-portabl
|
||||
## Half-Life: Visitors
|
||||
malortie's recreation - https://github.com/malortie/hl-visitors
|
||||
|
||||
Reverse-engineered code, branch **visitors** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/visitors
|
||||
Reverse-engineered code: branch **visitors** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/visitors
|
||||
|
||||
## Half-Secret
|
||||
Branch **half-secret** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/half-secret
|
||||
@@ -271,18 +289,18 @@ Branch **noffice** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tr
|
||||
## Poke 646
|
||||
malortie's recreation - https://github.com/malortie/hl-poke646
|
||||
|
||||
Reverse-engineered code, branch **poke646** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/poke646
|
||||
Reverse-engineered code: branch **poke646** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/poke646
|
||||
|
||||
## Poke 646: Vendetta
|
||||
malortie's recreation - https://github.com/malortie/hl-poke646-vendetta
|
||||
|
||||
Reverse-engineered code, branch **poke646_vendetta** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/poke646_vendetta
|
||||
Reverse-engineered code: branch **poke646_vendetta** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/poke646_vendetta
|
||||
|
||||
## Residual Life
|
||||
Reverse-engineered code, branch **residual_point** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/residual_point
|
||||
Reverse-engineered code: branch **residual_point** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/residual_point
|
||||
|
||||
## Residual Point
|
||||
Reverse-engineered code, branch **residual_point** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/residual_point
|
||||
Reverse-engineered code: branch **residual_point** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/residual_point
|
||||
|
||||
## Sewer Beta
|
||||
Branch **sewer_beta** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/sewer_beta
|
||||
@@ -293,12 +311,12 @@ Reverse-engineered code by Velaron - https://github.com/Velaron/tf15-client
|
||||
## The Gate
|
||||
malortie's recreation - https://github.com/malortie/hl-thegate
|
||||
|
||||
Reverse-engineered code, branch **thegate** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/thegate
|
||||
Reverse-engineered code: branch **thegate** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/thegate
|
||||
|
||||
## They Hunger
|
||||
malortie's recreation - https://github.com/malortie/hl-theyhunger
|
||||
|
||||
Reverse-engineered code, branch **theyhunger** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/theyhunger
|
||||
Reverse-engineered code: branch **theyhunger** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/theyhunger
|
||||
|
||||
They Hunger: Tactical - https://www.moddb.com/mods/they-hunger-tactical/downloads/tht-source-code-documentation
|
||||
|
||||
@@ -341,16 +359,22 @@ Branch **half-screwed** in hlsdk-portable - https://github.com/FWGS/hlsdk-portab
|
||||
Port to Linux - https://github.com/fmoraw/NS
|
||||
|
||||
## Spirit of Half-Life
|
||||
Version 1.2, branch **sohl1.2** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/sohl1.2
|
||||
Version 1.2: branch **sohl1.2** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/sohl1.2
|
||||
|
||||
## Swiss Cheese Halloween 2002
|
||||
Just more playable version by malortie - https://github.com/malortie/hl-shall
|
||||
|
||||
Branch **halloween** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/halloween
|
||||
|
||||
## The Wastes
|
||||
Version 1.5: Port to Linux - https://git.mentality.rip/a1batross/halflife-thewastes-sdk
|
||||
|
||||
## Threewave CTF
|
||||
Branch **dmc** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/dmc
|
||||
|
||||
## Xen-Warrior
|
||||
Branch **sohl1.2** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/sohl1.2
|
||||
|
||||
## Zombie-X
|
||||
Branch **zombie-x** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/zombie-x
|
||||
|
||||
|
||||
42
README.md
42
README.md
@@ -1,33 +1,27 @@
|
||||
# Xash3D FWGS Engine
|
||||
# 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://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 fork of Xash3D Engine by Unkle Mike with extended features and crossplatform.
|
||||
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 is a game engine, aimed to provide compatibility with Half-Life Engine,
|
||||
as well as to give game developers well known workflow and extend it.
|
||||
Read more about Xash3D on ModDB: https://www.moddb.com/engines/xash3d-engine
|
||||
```
|
||||
Xash3D FWGS is a heavily modified fork of an original [Xash3D Engine](https://www.moddb.com/engines/xash3d-engine) by Unkle Mike.
|
||||
|
||||
## Donate
|
||||
[](Documentation/donate.md) \
|
||||
If you like Xash3D FWGS, consider supporting individual engine maintainers. By supporting us, you help to continue developing this game engine further. The sponsorship links are available in [documentation](Documentation/donate.md).
|
||||
|
||||
## Fork features
|
||||
* HLSDK 2.4 support.
|
||||
* Crossplatform: supported x86 and ARM on Windows/Linux/BSD/Android. ([see docs for more info](Documentation/ports.md))
|
||||
* Modern compilers support: say no more to MSVC6.
|
||||
* Better multiplayer support: multiple master servers, headless dedicated server.
|
||||
* Mobility API: allows better game integration on mobile devices(vibration, touch controls)
|
||||
* Different input methods: touch, gamepad and classic mouse & keyboard.
|
||||
* Steam Half-Life (HLSDK 2.4) support.
|
||||
* Crossplatform and modern compilers support: supports Windows, Linux, BSD & Android on x86 & ARM and [many more](Documentation/ports.md).
|
||||
* Better multiplayer support: multiple master servers, headless dedicated server, voice chat and IPv6 support.
|
||||
* Multiple renderers support: OpenGL, GLESv1, GLESv2 and Software.
|
||||
* Advanced virtual filesystem: `.pk3` and `.pk3dir` support, compatibility with GoldSrc FS module, fast case-insensitivity emulation for crossplatform.
|
||||
* Mobility API: better game integration on mobile devices (vibration, touch controls)
|
||||
* Different input methods: touch and gamepad in addition to mouse & keyboard.
|
||||
* TrueType font rendering, as a part of mainui_cpp.
|
||||
* Multiple renderers support: OpenGL, GLESv1, GLESv2, Software.
|
||||
* Voice support.
|
||||
* External filesystem module like in GoldSrc engine.
|
||||
* External vgui support module.
|
||||
* PNG image format support.
|
||||
* A set of small improvements, without broken compatibility.
|
||||
|
||||
## Planned fork features
|
||||
* Virtual Reality support and game API.
|
||||
* Vulkan renderer.
|
||||
* External VGUI support module.
|
||||
* PNG & KTX2 image format support.
|
||||
* [A set of small improvements](Documentation/), without broken compatibility.
|
||||
|
||||
## Installation & Running
|
||||
0) Get Xash3D FWGS binaries: you can use [testing](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous) build or you can compile engine from source code.
|
||||
|
||||
@@ -9,7 +9,20 @@ NOTE: number at end of pixelformat name it's a total bitscount e.g. PF_RGB_24 ==
|
||||
========================================================================
|
||||
*/
|
||||
#define ImageRAW( type ) (type == PF_RGBA_32 || type == PF_BGRA_32 || type == PF_RGB_24 || type == PF_BGR_24 || type == PF_LUMINANCE)
|
||||
#define ImageDXT( type ) (type == PF_DXT1 || type == PF_DXT3 || type == PF_DXT5 || type == PF_ATI2 || type == PF_BC6H_SIGNED || type == PF_BC6H_UNSIGNED || type == PF_BC7)
|
||||
#define ImageCompressed( type ) \
|
||||
( type == PF_DXT1 \
|
||||
|| type == PF_DXT3 \
|
||||
|| type == PF_DXT5 \
|
||||
|| type == PF_ATI2 \
|
||||
|| type == PF_BC4_SIGNED \
|
||||
|| type == PF_BC4_UNSIGNED \
|
||||
|| type == PF_BC5_SIGNED \
|
||||
|| type == PF_BC5_UNSIGNED \
|
||||
|| type == PF_BC6H_SIGNED \
|
||||
|| type == PF_BC6H_UNSIGNED \
|
||||
|| type == PF_BC7_UNORM \
|
||||
|| type == PF_BC7_SRGB \
|
||||
|| type == PF_KTX2_RAW )
|
||||
|
||||
typedef enum
|
||||
{
|
||||
@@ -25,9 +38,15 @@ typedef enum
|
||||
PF_DXT3, // s3tc DXT3/BC2 format
|
||||
PF_DXT5, // s3tc DXT5/BC3 format
|
||||
PF_ATI2, // latc ATI2N/BC5 format
|
||||
PF_BC4_SIGNED,
|
||||
PF_BC4_UNSIGNED,
|
||||
PF_BC5_SIGNED,
|
||||
PF_BC5_UNSIGNED,
|
||||
PF_BC6H_SIGNED, // bptc BC6H signed FP16 format
|
||||
PF_BC6H_UNSIGNED, // bptc BC6H unsigned FP16 format
|
||||
PF_BC7, // bptc BC7 format
|
||||
PF_BC7_UNORM, // bptc BC7 format
|
||||
PF_BC7_SRGB,
|
||||
PF_KTX2_RAW, // Raw KTX2 data, used for yet unsupported KTX2 subformats
|
||||
PF_TOTALCOUNT, // must be last
|
||||
} pixformat_t;
|
||||
|
||||
@@ -50,6 +69,7 @@ typedef enum
|
||||
IL_LOAD_DECAL = BIT(5), // special mode for load gradient decals
|
||||
IL_OVERVIEW = BIT(6), // overview required some unque operations
|
||||
IL_LOAD_PLAYER_DECAL = BIT(7), // special mode for player decals
|
||||
IL_KTX2_RAW = BIT(8), // renderer can consume raw KTX2 files (e.g. ref_vk)
|
||||
} ilFlags_t;
|
||||
|
||||
// goes into rgbdata_t->encode
|
||||
|
||||
@@ -717,6 +717,7 @@ enum
|
||||
kRenderFxExplode, // Scale up really big!
|
||||
kRenderFxGlowShell, // Glowing Shell
|
||||
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
||||
kRenderFxLightMultiplier,
|
||||
};
|
||||
|
||||
typedef int func_t;
|
||||
|
||||
@@ -189,4 +189,8 @@ Default build-depended cvar and constant values
|
||||
#define DEFAULT_FULLSCREEN "1" // must be a string
|
||||
#endif // DEFAULT_FULLSCREEN
|
||||
|
||||
#ifndef DEFAULT_MAX_EDICTS
|
||||
#define DEFAULT_MAX_EDICTS 1200 // was 900 before HL25
|
||||
#endif // DEFAULT_MAX_EDICTS
|
||||
|
||||
#endif // DEFAULTS_H
|
||||
|
||||
@@ -27,4 +27,19 @@ GNU General Public License for more details.
|
||||
#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_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
|
||||
#define ENGINE_FEATURES_MASK \
|
||||
( ENGINE_WRITE_LARGE_COORD \
|
||||
| ENGINE_QUAKE_COMPATIBLE \
|
||||
| ENGINE_LOAD_DELUXEDATA \
|
||||
| ENGINE_PHYSICS_PUSHER_EXT \
|
||||
| ENGINE_LARGE_LIGHTMAPS \
|
||||
| ENGINE_COMPENSATE_QUAKE_BUG \
|
||||
| ENGINE_IMPROVED_LINETRACE \
|
||||
| ENGINE_COMPUTE_STUDIO_LERP \
|
||||
| ENGINE_LINEAR_GAMMA_SPACE \
|
||||
| ENGINE_STEP_POSHISTORY_LERP )
|
||||
|
||||
#endif//FEATURES_H
|
||||
|
||||
@@ -19,6 +19,8 @@ GNU General Public License for more details.
|
||||
#define GFL_NOMODELS (1<<0)
|
||||
#define GFL_NOSKILLS (1<<1)
|
||||
#define GFL_RENDER_PICBUTTON_TEXT (1<<2)
|
||||
#define GFL_HD_BACKGROUND (1<<3)
|
||||
#define GFL_ANIMATED_TITLE (1<<4)
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
@@ -1,18 +1,35 @@
|
||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
/*
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
#if !defined( KBUTTONH )
|
||||
#define KBUTTONH
|
||||
#pragma once
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
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 state; // low bit is down state
|
||||
} 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) 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.
|
||||
*
|
||||
****/
|
||||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
#ifndef NETADR_H
|
||||
#define NETADR_H
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
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
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NA_UNUSED = 0,
|
||||
NA_LOOPBACK,
|
||||
NA_BROADCAST,
|
||||
NA_IP,
|
||||
NA_IPX,
|
||||
NA_BROADCAST_IPX,
|
||||
NA_IP6,
|
||||
NA_MULTICAST_IP6, // all nodes multicast
|
||||
} netadrtype_t;
|
||||
// net.h -- quake's interface to the networking layer
|
||||
// a1ba: copied from Quake-2/qcommon/qcommon.h and modified to support IPv6
|
||||
|
||||
// Original structure:
|
||||
// typedef struct netadr_s
|
||||
// {
|
||||
// netadrtype_t type;
|
||||
// unsigned char ip[4];
|
||||
// unsigned char ipx[10];
|
||||
// unsigned short port;
|
||||
// } netadr_t;
|
||||
#define PORT_ANY -1
|
||||
|
||||
typedef enum {NA_LOOPBACK = 1, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX, NA_IP6, NA_MULTICAST_IP6} netadrtype_t;
|
||||
|
||||
/*
|
||||
Original Quake-2 structure:
|
||||
typedef struct
|
||||
{
|
||||
netadrtype_t type;
|
||||
|
||||
byte ip[4];
|
||||
byte ipx[10];
|
||||
|
||||
unsigned short port;
|
||||
} netadr_t;
|
||||
*/
|
||||
|
||||
#pragma pack( push, 1 )
|
||||
typedef struct netadr_s
|
||||
{
|
||||
union
|
||||
{
|
||||
// IPv6 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
|
||||
{
|
||||
uint8_t ip[4];
|
||||
uint32_t ip4;
|
||||
uint8_t ip[4];
|
||||
uint32_t ip4; // for easier conversions
|
||||
};
|
||||
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
|
||||
uint8_t ipx[10];
|
||||
};
|
||||
};
|
||||
uint16_t port;
|
||||
uint16_t port;
|
||||
} netadr_t;
|
||||
#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
|
||||
|
||||
@@ -229,7 +229,7 @@ typedef struct render_api_s
|
||||
void (*R_Reserved0)( void );
|
||||
|
||||
// static allocations
|
||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ) ALLOC_CHECK( 1 );
|
||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||
|
||||
// engine utils (not related with render API but placed here)
|
||||
|
||||
@@ -57,9 +57,7 @@ typedef uint64_t longtime_t;
|
||||
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
|
||||
|
||||
#define BIT( n ) ( 1U << ( 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 BIT64( n ) ( 1ULL << ( n ))
|
||||
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
||||
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
||||
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
||||
@@ -86,16 +84,22 @@ typedef uint64_t longtime_t;
|
||||
#endif
|
||||
#define _format(x) __attribute__((format(printf, x, x+1)))
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#define NONNULL __attribute__((nonnull))
|
||||
#define ALLOC_CHECK(x) __attribute__((alloc_size(x)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define EXPORT __declspec( dllexport )
|
||||
#define GAME_EXPORT
|
||||
#define _format(x)
|
||||
#define NORETURN
|
||||
#define NONNULL
|
||||
#define ALLOC_CHECK(x)
|
||||
#else
|
||||
#define EXPORT
|
||||
#define GAME_EXPORT
|
||||
#define _format(x)
|
||||
#define NORETURN
|
||||
#define NONNULL
|
||||
#define ALLOC_CHECK(x)
|
||||
#endif
|
||||
|
||||
#if ( __GNUC__ >= 3 )
|
||||
@@ -114,10 +118,18 @@ typedef uint64_t longtime_t;
|
||||
#define likely(x) (x)
|
||||
#endif
|
||||
|
||||
#if defined( static_assert ) // C11 static_assert
|
||||
#define STATIC_ASSERT static_assert
|
||||
#if __STDC_VERSION__ >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
||||
#define STATIC_ASSERT_( ignore, x, y ) static_assert( x, y )
|
||||
#define STATIC_ASSERT static_assert
|
||||
#elif __STDC_VERSION__ >= 201112L // in C11 it's _Static_assert
|
||||
#define STATIC_ASSERT_( ignore, x, y ) _Static_assert( x, y )
|
||||
#define STATIC_ASSERT _Static_assert
|
||||
#else
|
||||
#define STATIC_ASSERT( x, y ) extern int _static_assert_##__LINE__[( x ) ? 1 : -1]
|
||||
#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]
|
||||
// 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
|
||||
|
||||
#ifdef XASH_BIG_ENDIAN
|
||||
@@ -177,6 +189,7 @@ typedef struct dll_info_s
|
||||
} dll_info_t;
|
||||
|
||||
typedef void (*setpair_t)( const char *key, const void *value, const void *buffer, void *numpairs );
|
||||
typedef void *(*pfnCreateInterface_t)( const char *, int * );
|
||||
|
||||
// config strings are a general means of communication from
|
||||
// the server to all connected clients.
|
||||
|
||||
356
engine/anorms.h
356
engine/anorms.h
@@ -1,177 +1,181 @@
|
||||
/***
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****/
|
||||
/*
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
{-0.525731, 0.000000, 0.850651},
|
||||
{-0.442863, 0.238856, 0.864188},
|
||||
{-0.295242, 0.000000, 0.955423},
|
||||
{-0.309017, 0.500000, 0.809017},
|
||||
{-0.162460, 0.262866, 0.951056},
|
||||
{0.000000, 0.000000, 1.000000},
|
||||
{0.000000, 0.850651, 0.525731},
|
||||
{-0.147621, 0.716567, 0.681718},
|
||||
{0.147621, 0.716567, 0.681718},
|
||||
{0.000000, 0.525731, 0.850651},
|
||||
{0.309017, 0.500000, 0.809017},
|
||||
{0.525731, 0.000000, 0.850651},
|
||||
{0.295242, 0.000000, 0.955423},
|
||||
{0.442863, 0.238856, 0.864188},
|
||||
{0.162460, 0.262866, 0.951056},
|
||||
{-0.681718, 0.147621, 0.716567},
|
||||
{-0.809017, 0.309017, 0.500000},
|
||||
{-0.587785, 0.425325, 0.688191},
|
||||
{-0.850651, 0.525731, 0.000000},
|
||||
{-0.864188, 0.442863, 0.238856},
|
||||
{-0.716567, 0.681718, 0.147621},
|
||||
{-0.688191, 0.587785, 0.425325},
|
||||
{-0.500000, 0.809017, 0.309017},
|
||||
{-0.238856, 0.864188, 0.442863},
|
||||
{-0.425325, 0.688191, 0.587785},
|
||||
{-0.716567, 0.681718, -0.147621},
|
||||
{-0.500000, 0.809017, -0.309017},
|
||||
{-0.525731, 0.850651, 0.000000},
|
||||
{0.000000, 0.850651, -0.525731},
|
||||
{-0.238856, 0.864188, -0.442863},
|
||||
{0.000000, 0.955423, -0.295242},
|
||||
{-0.262866, 0.951056, -0.162460},
|
||||
{0.000000, 1.000000, 0.000000},
|
||||
{0.000000, 0.955423, 0.295242},
|
||||
{-0.262866, 0.951056, 0.162460},
|
||||
{0.238856, 0.864188, 0.442863},
|
||||
{0.262866, 0.951056, 0.162460},
|
||||
{0.500000, 0.809017, 0.309017},
|
||||
{0.238856, 0.864188, -0.442863},
|
||||
{0.262866, 0.951056, -0.162460},
|
||||
{0.500000, 0.809017, -0.309017},
|
||||
{0.850651, 0.525731, 0.000000},
|
||||
{0.716567, 0.681718, 0.147621},
|
||||
{0.716567, 0.681718, -0.147621},
|
||||
{0.525731, 0.850651, 0.000000},
|
||||
{0.425325, 0.688191, 0.587785},
|
||||
{0.864188, 0.442863, 0.238856},
|
||||
{0.688191, 0.587785, 0.425325},
|
||||
{0.809017, 0.309017, 0.500000},
|
||||
{0.681718, 0.147621, 0.716567},
|
||||
{0.587785, 0.425325, 0.688191},
|
||||
{0.955423, 0.295242, 0.000000},
|
||||
{1.000000, 0.000000, 0.000000},
|
||||
{0.951056, 0.162460, 0.262866},
|
||||
{0.850651, -0.525731, 0.000000},
|
||||
{0.955423, -0.295242, 0.000000},
|
||||
{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.850651, 0.000000, 0.525731},
|
||||
{0.864188, 0.442863, -0.238856},
|
||||
{0.809017, 0.309017, -0.500000},
|
||||
{0.951056, 0.162460, -0.262866},
|
||||
{0.525731, 0.000000, -0.850651},
|
||||
{0.681718, 0.147621, -0.716567},
|
||||
{0.681718, -0.147621, -0.716567},
|
||||
{0.850651, 0.000000, -0.525731},
|
||||
{0.809017, -0.309017, -0.500000},
|
||||
{0.864188, -0.442863, -0.238856},
|
||||
{0.951056, -0.162460, -0.262866},
|
||||
{0.147621, 0.716567, -0.681718},
|
||||
{0.309017, 0.500000, -0.809017},
|
||||
{0.425325, 0.688191, -0.587785},
|
||||
{0.442863, 0.238856, -0.864188},
|
||||
{0.587785, 0.425325, -0.688191},
|
||||
{0.688191, 0.587785, -0.425325},
|
||||
{-0.147621, 0.716567, -0.681718},
|
||||
{-0.309017, 0.500000, -0.809017},
|
||||
{0.000000, 0.525731, -0.850651},
|
||||
{-0.525731, 0.000000, -0.850651},
|
||||
{-0.442863, 0.238856, -0.864188},
|
||||
{-0.295242, 0.000000, -0.955423},
|
||||
{-0.162460, 0.262866, -0.951056},
|
||||
{0.000000, 0.000000, -1.000000},
|
||||
{0.295242, 0.000000, -0.955423},
|
||||
{0.162460, 0.262866, -0.951056},
|
||||
{-0.442863, -0.238856, -0.864188},
|
||||
{-0.309017, -0.500000, -0.809017},
|
||||
{-0.162460, -0.262866, -0.951056},
|
||||
{0.000000, -0.850651, -0.525731},
|
||||
{-0.147621, -0.716567, -0.681718},
|
||||
{0.147621, -0.716567, -0.681718},
|
||||
{0.000000, -0.525731, -0.850651},
|
||||
{0.309017, -0.500000, -0.809017},
|
||||
{0.442863, -0.238856, -0.864188},
|
||||
{0.162460, -0.262866, -0.951056},
|
||||
{0.238856, -0.864188, -0.442863},
|
||||
{0.500000, -0.809017, -0.309017},
|
||||
{0.425325, -0.688191, -0.587785},
|
||||
{0.716567, -0.681718, -0.147621},
|
||||
{0.688191, -0.587785, -0.425325},
|
||||
{0.587785, -0.425325, -0.688191},
|
||||
{0.000000, -0.955423, -0.295242},
|
||||
{0.000000, -1.000000, 0.000000},
|
||||
{0.262866, -0.951056, -0.162460},
|
||||
{0.000000, -0.850651, 0.525731},
|
||||
{0.000000, -0.955423, 0.295242},
|
||||
{0.238856, -0.864188, 0.442863},
|
||||
{0.262866, -0.951056, 0.162460},
|
||||
{0.500000, -0.809017, 0.309017},
|
||||
{0.716567, -0.681718, 0.147621},
|
||||
{0.525731, -0.850651, 0.000000},
|
||||
{-0.238856, -0.864188, -0.442863},
|
||||
{-0.500000, -0.809017, -0.309017},
|
||||
{-0.262866, -0.951056, -0.162460},
|
||||
{-0.850651, -0.525731, 0.000000},
|
||||
{-0.716567, -0.681718, -0.147621},
|
||||
{-0.716567, -0.681718, 0.147621},
|
||||
{-0.525731, -0.850651, 0.000000},
|
||||
{-0.500000, -0.809017, 0.309017},
|
||||
{-0.238856, -0.864188, 0.442863},
|
||||
{-0.262866, -0.951056, 0.162460},
|
||||
{-0.864188, -0.442863, 0.238856},
|
||||
{-0.809017, -0.309017, 0.500000},
|
||||
{-0.688191, -0.587785, 0.425325},
|
||||
{-0.681718, -0.147621, 0.716567},
|
||||
{-0.442863, -0.238856, 0.864188},
|
||||
{-0.587785, -0.425325, 0.688191},
|
||||
{-0.309017, -0.500000, 0.809017},
|
||||
{-0.147621, -0.716567, 0.681718},
|
||||
{-0.425325, -0.688191, 0.587785},
|
||||
{-0.162460, -0.262866, 0.951056},
|
||||
{0.442863, -0.238856, 0.864188},
|
||||
{0.162460, -0.262866, 0.951056},
|
||||
{0.309017, -0.500000, 0.809017},
|
||||
{0.147621, -0.716567, 0.681718},
|
||||
{0.000000, -0.525731, 0.850651},
|
||||
{0.425325, -0.688191, 0.587785},
|
||||
{0.587785, -0.425325, 0.688191},
|
||||
{0.688191, -0.587785, 0.425325},
|
||||
{-0.955423, 0.295242, 0.000000},
|
||||
{-0.951056, 0.162460, 0.262866},
|
||||
{-1.000000, 0.000000, 0.000000},
|
||||
{-0.850651, 0.000000, 0.525731},
|
||||
{-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},
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
{-0.525731, 0.000000, 0.850651},
|
||||
{-0.442863, 0.238856, 0.864188},
|
||||
{-0.295242, 0.000000, 0.955423},
|
||||
{-0.309017, 0.500000, 0.809017},
|
||||
{-0.162460, 0.262866, 0.951056},
|
||||
{0.000000, 0.000000, 1.000000},
|
||||
{0.000000, 0.850651, 0.525731},
|
||||
{-0.147621, 0.716567, 0.681718},
|
||||
{0.147621, 0.716567, 0.681718},
|
||||
{0.000000, 0.525731, 0.850651},
|
||||
{0.309017, 0.500000, 0.809017},
|
||||
{0.525731, 0.000000, 0.850651},
|
||||
{0.295242, 0.000000, 0.955423},
|
||||
{0.442863, 0.238856, 0.864188},
|
||||
{0.162460, 0.262866, 0.951056},
|
||||
{-0.681718, 0.147621, 0.716567},
|
||||
{-0.809017, 0.309017, 0.500000},
|
||||
{-0.587785, 0.425325, 0.688191},
|
||||
{-0.850651, 0.525731, 0.000000},
|
||||
{-0.864188, 0.442863, 0.238856},
|
||||
{-0.716567, 0.681718, 0.147621},
|
||||
{-0.688191, 0.587785, 0.425325},
|
||||
{-0.500000, 0.809017, 0.309017},
|
||||
{-0.238856, 0.864188, 0.442863},
|
||||
{-0.425325, 0.688191, 0.587785},
|
||||
{-0.716567, 0.681718, -0.147621},
|
||||
{-0.500000, 0.809017, -0.309017},
|
||||
{-0.525731, 0.850651, 0.000000},
|
||||
{0.000000, 0.850651, -0.525731},
|
||||
{-0.238856, 0.864188, -0.442863},
|
||||
{0.000000, 0.955423, -0.295242},
|
||||
{-0.262866, 0.951056, -0.162460},
|
||||
{0.000000, 1.000000, 0.000000},
|
||||
{0.000000, 0.955423, 0.295242},
|
||||
{-0.262866, 0.951056, 0.162460},
|
||||
{0.238856, 0.864188, 0.442863},
|
||||
{0.262866, 0.951056, 0.162460},
|
||||
{0.500000, 0.809017, 0.309017},
|
||||
{0.238856, 0.864188, -0.442863},
|
||||
{0.262866, 0.951056, -0.162460},
|
||||
{0.500000, 0.809017, -0.309017},
|
||||
{0.850651, 0.525731, 0.000000},
|
||||
{0.716567, 0.681718, 0.147621},
|
||||
{0.716567, 0.681718, -0.147621},
|
||||
{0.525731, 0.850651, 0.000000},
|
||||
{0.425325, 0.688191, 0.587785},
|
||||
{0.864188, 0.442863, 0.238856},
|
||||
{0.688191, 0.587785, 0.425325},
|
||||
{0.809017, 0.309017, 0.500000},
|
||||
{0.681718, 0.147621, 0.716567},
|
||||
{0.587785, 0.425325, 0.688191},
|
||||
{0.955423, 0.295242, 0.000000},
|
||||
{1.000000, 0.000000, 0.000000},
|
||||
{0.951056, 0.162460, 0.262866},
|
||||
{0.850651, -0.525731, 0.000000},
|
||||
{0.955423, -0.295242, 0.000000},
|
||||
{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.850651, 0.000000, 0.525731},
|
||||
{0.864188, 0.442863, -0.238856},
|
||||
{0.809017, 0.309017, -0.500000},
|
||||
{0.951056, 0.162460, -0.262866},
|
||||
{0.525731, 0.000000, -0.850651},
|
||||
{0.681718, 0.147621, -0.716567},
|
||||
{0.681718, -0.147621, -0.716567},
|
||||
{0.850651, 0.000000, -0.525731},
|
||||
{0.809017, -0.309017, -0.500000},
|
||||
{0.864188, -0.442863, -0.238856},
|
||||
{0.951056, -0.162460, -0.262866},
|
||||
{0.147621, 0.716567, -0.681718},
|
||||
{0.309017, 0.500000, -0.809017},
|
||||
{0.425325, 0.688191, -0.587785},
|
||||
{0.442863, 0.238856, -0.864188},
|
||||
{0.587785, 0.425325, -0.688191},
|
||||
{0.688191, 0.587785, -0.425325},
|
||||
{-0.147621, 0.716567, -0.681718},
|
||||
{-0.309017, 0.500000, -0.809017},
|
||||
{0.000000, 0.525731, -0.850651},
|
||||
{-0.525731, 0.000000, -0.850651},
|
||||
{-0.442863, 0.238856, -0.864188},
|
||||
{-0.295242, 0.000000, -0.955423},
|
||||
{-0.162460, 0.262866, -0.951056},
|
||||
{0.000000, 0.000000, -1.000000},
|
||||
{0.295242, 0.000000, -0.955423},
|
||||
{0.162460, 0.262866, -0.951056},
|
||||
{-0.442863, -0.238856, -0.864188},
|
||||
{-0.309017, -0.500000, -0.809017},
|
||||
{-0.162460, -0.262866, -0.951056},
|
||||
{0.000000, -0.850651, -0.525731},
|
||||
{-0.147621, -0.716567, -0.681718},
|
||||
{0.147621, -0.716567, -0.681718},
|
||||
{0.000000, -0.525731, -0.850651},
|
||||
{0.309017, -0.500000, -0.809017},
|
||||
{0.442863, -0.238856, -0.864188},
|
||||
{0.162460, -0.262866, -0.951056},
|
||||
{0.238856, -0.864188, -0.442863},
|
||||
{0.500000, -0.809017, -0.309017},
|
||||
{0.425325, -0.688191, -0.587785},
|
||||
{0.716567, -0.681718, -0.147621},
|
||||
{0.688191, -0.587785, -0.425325},
|
||||
{0.587785, -0.425325, -0.688191},
|
||||
{0.000000, -0.955423, -0.295242},
|
||||
{0.000000, -1.000000, 0.000000},
|
||||
{0.262866, -0.951056, -0.162460},
|
||||
{0.000000, -0.850651, 0.525731},
|
||||
{0.000000, -0.955423, 0.295242},
|
||||
{0.238856, -0.864188, 0.442863},
|
||||
{0.262866, -0.951056, 0.162460},
|
||||
{0.500000, -0.809017, 0.309017},
|
||||
{0.716567, -0.681718, 0.147621},
|
||||
{0.525731, -0.850651, 0.000000},
|
||||
{-0.238856, -0.864188, -0.442863},
|
||||
{-0.500000, -0.809017, -0.309017},
|
||||
{-0.262866, -0.951056, -0.162460},
|
||||
{-0.850651, -0.525731, 0.000000},
|
||||
{-0.716567, -0.681718, -0.147621},
|
||||
{-0.716567, -0.681718, 0.147621},
|
||||
{-0.525731, -0.850651, 0.000000},
|
||||
{-0.500000, -0.809017, 0.309017},
|
||||
{-0.238856, -0.864188, 0.442863},
|
||||
{-0.262866, -0.951056, 0.162460},
|
||||
{-0.864188, -0.442863, 0.238856},
|
||||
{-0.809017, -0.309017, 0.500000},
|
||||
{-0.688191, -0.587785, 0.425325},
|
||||
{-0.681718, -0.147621, 0.716567},
|
||||
{-0.442863, -0.238856, 0.864188},
|
||||
{-0.587785, -0.425325, 0.688191},
|
||||
{-0.309017, -0.500000, 0.809017},
|
||||
{-0.147621, -0.716567, 0.681718},
|
||||
{-0.425325, -0.688191, 0.587785},
|
||||
{-0.162460, -0.262866, 0.951056},
|
||||
{0.442863, -0.238856, 0.864188},
|
||||
{0.162460, -0.262866, 0.951056},
|
||||
{0.309017, -0.500000, 0.809017},
|
||||
{0.147621, -0.716567, 0.681718},
|
||||
{0.000000, -0.525731, 0.850651},
|
||||
{0.425325, -0.688191, 0.587785},
|
||||
{0.587785, -0.425325, 0.688191},
|
||||
{0.688191, -0.587785, 0.425325},
|
||||
{-0.955423, 0.295242, 0.000000},
|
||||
{-0.951056, 0.162460, 0.262866},
|
||||
{-1.000000, 0.000000, 0.000000},
|
||||
{-0.850651, 0.000000, 0.525731},
|
||||
{-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},
|
||||
|
||||
@@ -85,6 +85,12 @@ void CL_PlayCDTrack_f( void )
|
||||
paused = false;
|
||||
looped = false;
|
||||
}
|
||||
else if( !Q_stricmp( command, "playfile" ))
|
||||
{
|
||||
S_StartBackgroundTrack( pszTrack, NULL, 0, true );
|
||||
paused = false;
|
||||
looped = false;
|
||||
}
|
||||
else if( !Q_stricmp( command, "loop" ))
|
||||
{
|
||||
if( Q_isdigit( pszTrack ))
|
||||
@@ -96,6 +102,12 @@ void CL_PlayCDTrack_f( void )
|
||||
paused = false;
|
||||
looped = true;
|
||||
}
|
||||
else if( !Q_stricmp( command, "loopfile" ))
|
||||
{
|
||||
S_StartBackgroundTrack( pszTrack, pszTrack, 0, true );
|
||||
paused = false;
|
||||
looped = true;
|
||||
}
|
||||
else if( !Q_stricmp( command, "pause" ))
|
||||
{
|
||||
S_StreamSetPause( true );
|
||||
|
||||
@@ -372,7 +372,7 @@ void CL_WriteDemoHeader( const char *name )
|
||||
demo.header.id = IDEMOHEADER;
|
||||
demo.header.dem_protocol = DEMO_PROTOCOL;
|
||||
demo.header.net_protocol = cls.legacymode ? PROTOCOL_LEGACY_VERSION : PROTOCOL_VERSION;
|
||||
demo.header.host_fps = bound( MIN_FPS, host_maxfps.value, MAX_FPS );
|
||||
demo.header.host_fps = host_maxfps.value ? bound( MIN_FPS, host_maxfps.value, MAX_FPS ) : MAX_FPS;
|
||||
Q_strncpy( demo.header.mapname, clgame.mapname, sizeof( demo.header.mapname ));
|
||||
Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment ));
|
||||
Q_strncpy( demo.header.gamedir, FS_Gamedir(), sizeof( demo.header.gamedir ));
|
||||
@@ -570,6 +570,9 @@ void CL_ReadDemoUserCmd( qboolean discard )
|
||||
memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||
|
||||
// a1ba: I have no proper explanation why
|
||||
cmdnumber++;
|
||||
|
||||
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
||||
pcmd->processedfuncs = false;
|
||||
pcmd->senttime = 0.0f;
|
||||
@@ -1124,7 +1127,10 @@ void CL_FinishTimeDemo( void )
|
||||
time = host.realtime - cls.td_starttime;
|
||||
if( !time ) time = 1.0;
|
||||
|
||||
Con_Printf( "%i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );
|
||||
Con_Printf( "timedemo result: %i frames %5.3f seconds %5.3f fps\n", frames, time, frames / time );
|
||||
|
||||
if( Sys_CheckParm( "-timedemo" ))
|
||||
CL_Quit_f();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -175,7 +175,7 @@ particle_t * GAME_EXPORT R_AllocParticle( void (*callback)( particle_t*, float )
|
||||
return NULL;
|
||||
|
||||
// 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 )
|
||||
{
|
||||
@@ -226,7 +226,7 @@ particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
||||
return NULL;
|
||||
|
||||
// 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 )
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ GNU General Public License for more details.
|
||||
#include "sound.h"
|
||||
#include "input.h"
|
||||
|
||||
#define STUDIO_INTERPOLATION_FIX
|
||||
// #define STUDIO_INTERPOLATION_FIX
|
||||
|
||||
/*
|
||||
==================
|
||||
@@ -54,17 +54,28 @@ Store another position into interpolation circular buffer
|
||||
*/
|
||||
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;
|
||||
ph = &ent->ph[ent->current_position];
|
||||
VectorCopy( ent->curstate.origin, ph->origin );
|
||||
VectorCopy( ent->curstate.angles, ph->angles );
|
||||
|
||||
if( ent->model && ent->model->type == mod_brush )
|
||||
ph->animtime = ent->curstate.animtime;
|
||||
else
|
||||
ph->animtime = cl.time;
|
||||
ph->animtime = ent->curstate.animtime;
|
||||
|
||||
// a1ba: for some reason, this sometimes still may happen
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -159,6 +170,13 @@ qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||
case MOVETYPE_FLY:
|
||||
case MOVETYPE_COMPOUND:
|
||||
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;
|
||||
@@ -171,7 +189,7 @@ CL_ParametricMove
|
||||
check for parametrical moved entities
|
||||
==================
|
||||
*/
|
||||
qboolean CL_ParametricMove( cl_entity_t *ent )
|
||||
static qboolean CL_ParametricMove( cl_entity_t *ent )
|
||||
{
|
||||
float frac, dt, t;
|
||||
vec3_t delta;
|
||||
@@ -349,11 +367,10 @@ CL_FindInterpolationUpdates
|
||||
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;
|
||||
uint i, i0, i1, imod;
|
||||
float at;
|
||||
|
||||
imod = ent->current_position;
|
||||
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++ )
|
||||
{
|
||||
at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||
if( at == 0.0f ) break;
|
||||
double at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||
|
||||
if( at == 0.0f )
|
||||
break;
|
||||
|
||||
if( targettime > at )
|
||||
{
|
||||
@@ -387,15 +406,14 @@ CL_PureOrigin
|
||||
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;
|
||||
float t1, t0, frac;
|
||||
double t1, t0, frac;
|
||||
position_history_t *ph0, *ph1;
|
||||
vec3_t delta;
|
||||
|
||||
// NOTE: ph0 is next, ph1 is a prev
|
||||
extrapolate = CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
||||
CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
||||
|
||||
if ( !ph0 || !ph1 )
|
||||
return;
|
||||
@@ -403,7 +421,7 @@ void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangle
|
||||
t0 = ph0->animtime;
|
||||
t1 = ph1->animtime;
|
||||
|
||||
if( t0 != 0.0f )
|
||||
if( t0 != 0.0 )
|
||||
{
|
||||
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 ))
|
||||
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 );
|
||||
|
||||
@@ -437,11 +455,11 @@ CL_InterpolateModel
|
||||
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;
|
||||
vec3_t origin, angles, delta;
|
||||
float t, t1, t2, frac;
|
||||
double t, t1, t2, frac;
|
||||
vec4_t q, q1, q2;
|
||||
|
||||
VectorCopy( e->curstate.origin, e->origin );
|
||||
@@ -489,9 +507,7 @@ int CL_InterpolateModel( cl_entity_t *e )
|
||||
return 0;
|
||||
}
|
||||
|
||||
// HACKHACK: workaround buggy position history animtime
|
||||
// going backward sometimes
|
||||
if( Q_equal( t2, t1 ) || t2 < t1 )
|
||||
if( Q_equal( t2, t1 ))
|
||||
{
|
||||
VectorCopy( ph0->origin, e->origin );
|
||||
VectorCopy( ph0->angles, e->angles );
|
||||
@@ -529,7 +545,7 @@ interpolate non-local clients
|
||||
*/
|
||||
void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
||||
{
|
||||
float targettime;
|
||||
double targettime;
|
||||
vec4_t q, q1, q2;
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
@@ -1212,17 +1228,33 @@ void CL_LinkPacketEntities( frame_t *frame )
|
||||
#else
|
||||
if( ent->lastmove >= cl.time )
|
||||
{
|
||||
float at = ent->curstate.animtime;
|
||||
|
||||
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.angles, ent->latched.prevangles );
|
||||
|
||||
// disable step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_NONE;
|
||||
if( !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
{
|
||||
// disable step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// restore step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_STEP;
|
||||
if( FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
{
|
||||
interpolate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// restore step interpolation in client.dll
|
||||
ent->curstate.movetype = MOVETYPE_STEP;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1247,11 +1279,24 @@ void CL_LinkPacketEntities( frame_t *frame )
|
||||
if ( !CL_InterpolateModel( ent ))
|
||||
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 ))
|
||||
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
|
||||
{
|
||||
// no interpolation right now
|
||||
|
||||
@@ -1109,12 +1109,12 @@ void CL_InitEdicts( int maxclients )
|
||||
clgame.remap_info = (remap_info_t **)Mem_Calloc( clgame.mempool, sizeof( remap_info_t* ) * clgame.maxRemapInfos );
|
||||
}
|
||||
|
||||
ref.dllFuncs.R_ProcessEntData( true );
|
||||
ref.dllFuncs.R_ProcessEntData( true, clgame.entities, clgame.maxEntities );
|
||||
}
|
||||
|
||||
void CL_FreeEdicts( void )
|
||||
{
|
||||
ref.dllFuncs.R_ProcessEntData( false );
|
||||
ref.dllFuncs.R_ProcessEntData( false, NULL, 0 );
|
||||
|
||||
if( clgame.entities )
|
||||
Mem_Free( clgame.entities );
|
||||
@@ -1235,11 +1235,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
model_t *mod;
|
||||
int i;
|
||||
|
||||
// use high indices for client sprites
|
||||
// for GoldSrc bug-compatibility
|
||||
const int start = type != SPR_HUDSPRITE ? MAX_CLIENT_SPRITES / 2 : 0;
|
||||
int i, start;
|
||||
|
||||
if( !COM_CheckString( filename ))
|
||||
{
|
||||
@@ -1250,7 +1246,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
||||
Q_strncpy( name, filename, sizeof( name ));
|
||||
COM_FixSlashes( name );
|
||||
|
||||
for( i = 0, mod = clgame.sprites + start; i < MAX_CLIENT_SPRITES / 2; i++, mod++ )
|
||||
for( i = 0, mod = clgame.sprites; i < MAX_CLIENT_SPRITES; i++, mod++ )
|
||||
{
|
||||
if( !Q_stricmp( mod->name, name ))
|
||||
{
|
||||
@@ -1267,8 +1263,15 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
||||
}
|
||||
|
||||
// find a free model slot spot
|
||||
for( i = 0, mod = clgame.sprites + start; i < MAX_CLIENT_SPRITES / 2; i++, mod++ )
|
||||
if( !mod->name[0] ) break; // this is a valid spot
|
||||
// use low indices only for HUD sprites
|
||||
// for GoldSrc bug compatibility
|
||||
start = type == SPR_HUDSPRITE ? 0 : MAX_CLIENT_SPRITES / 2;
|
||||
|
||||
for( i = 0, mod = &clgame.sprites[start]; i < MAX_CLIENT_SPRITES / 2; i++, mod++ )
|
||||
{
|
||||
if( !mod->name[0] )
|
||||
break; // this is a valid spot
|
||||
}
|
||||
|
||||
if( i == MAX_CLIENT_SPRITES / 2 )
|
||||
{
|
||||
@@ -1320,9 +1323,10 @@ HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags )
|
||||
=========
|
||||
pfnSPR_Load
|
||||
|
||||
function exported for support GoldSrc Monitor utility
|
||||
=========
|
||||
*/
|
||||
static HSPRITE GAME_EXPORT pfnSPR_Load( const char *szPicName )
|
||||
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
||||
{
|
||||
model_t *spr;
|
||||
|
||||
@@ -1368,9 +1372,10 @@ static const model_t *CL_GetSpritePointer( HSPRITE hSprite )
|
||||
=========
|
||||
pfnSPR_Frames
|
||||
|
||||
function exported for support GoldSrc Monitor utility
|
||||
=========
|
||||
*/
|
||||
static int GAME_EXPORT pfnSPR_Frames( HSPRITE hPic )
|
||||
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
||||
{
|
||||
int numFrames = 0;
|
||||
|
||||
@@ -3336,6 +3341,9 @@ static void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags,
|
||||
if( remote_address->type != NA_IPX && remote_address->type != NA_BROADCAST_IPX )
|
||||
return; // IPX no longer support
|
||||
|
||||
if( request == NETAPI_REQUEST_SERVERLIST )
|
||||
return; // no support for server list requests
|
||||
|
||||
// find a free request
|
||||
for( i = 0; i < MAX_REQUESTS; i++ )
|
||||
{
|
||||
@@ -3372,28 +3380,9 @@ static void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags,
|
||||
nr->resp.remote_address = *remote_address;
|
||||
nr->flags = flags;
|
||||
|
||||
if( request == NETAPI_REQUEST_SERVERLIST )
|
||||
{
|
||||
char fullquery[512];
|
||||
size_t len;
|
||||
|
||||
len = CL_BuildMasterServerScanRequest( fullquery, sizeof( fullquery ), false );
|
||||
|
||||
// make sure that port is specified
|
||||
if( !nr->resp.remote_address.port )
|
||||
nr->resp.remote_address.port = MSG_BigShort( PORT_MASTER );
|
||||
|
||||
// grab the list from the master server
|
||||
NET_SendPacket( NS_CLIENT, len, fullquery, nr->resp.remote_address );
|
||||
clgame.request_type = NET_REQUEST_CLIENT;
|
||||
clgame.master_request = nr; // holds the master request unitl the master acking
|
||||
}
|
||||
else
|
||||
{
|
||||
// local servers request
|
||||
Q_snprintf( req, sizeof( req ), "netinfo %i %i %i", PROTOCOL_VERSION, context, request );
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, "%s", req );
|
||||
}
|
||||
// local servers request
|
||||
Q_snprintf( req, sizeof( req ), "netinfo %i %i %i", PROTOCOL_VERSION, context, request );
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, "%s", req );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3421,13 +3410,6 @@ static void GAME_EXPORT NetAPI_CancelRequest( int context )
|
||||
nr->pfnFunc( &nr->resp );
|
||||
}
|
||||
|
||||
if( clgame.net_requests[i].resp.type == NETAPI_REQUEST_SERVERLIST && &clgame.net_requests[i] == clgame.master_request )
|
||||
{
|
||||
if( clgame.request_type == NET_REQUEST_CLIENT )
|
||||
clgame.request_type = NET_REQUEST_CANCEL;
|
||||
clgame.master_request = NULL;
|
||||
}
|
||||
|
||||
memset( &clgame.net_requests[i], 0, sizeof( net_request_t ));
|
||||
break;
|
||||
}
|
||||
@@ -3456,8 +3438,6 @@ void GAME_EXPORT NetAPI_CancelAllRequests( void )
|
||||
}
|
||||
|
||||
memset( clgame.net_requests, 0, sizeof( clgame.net_requests ));
|
||||
clgame.request_type = NET_REQUEST_CANCEL;
|
||||
clgame.master_request = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -414,11 +414,15 @@ static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
|
||||
out->gamemode = in->gamemode;
|
||||
|
||||
if( in->nomodels )
|
||||
out->flags |= GFL_NOMODELS;
|
||||
SetBits( out->flags, GFL_NOMODELS );
|
||||
if( in->noskills )
|
||||
out->flags |= GFL_NOSKILLS;
|
||||
SetBits( out->flags, GFL_NOSKILLS );
|
||||
if( in->render_picbutton_text )
|
||||
out->flags |= GFL_RENDER_PICBUTTON_TEXT;
|
||||
SetBits( out->flags, GFL_RENDER_PICBUTTON_TEXT );
|
||||
if( in->hd_background )
|
||||
SetBits( out->flags, GFL_HD_BACKGROUND );
|
||||
if( in->animated_title )
|
||||
SetBits( out->flags, GFL_ANIMATED_TITLE );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -982,28 +986,21 @@ pfnCheckGameDll
|
||||
*/
|
||||
int GAME_EXPORT pfnCheckGameDll( void )
|
||||
{
|
||||
string dllpath;
|
||||
void *hInst;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
// loading server library drains too many ram
|
||||
// so 512MB iPod Touch cannot even connect to
|
||||
// to servers in cstrike
|
||||
#ifdef XASH_INTERNAL_GAMELIBS
|
||||
return true;
|
||||
#endif
|
||||
#else
|
||||
string dllpath;
|
||||
|
||||
if( svgame.hInstance )
|
||||
return true;
|
||||
|
||||
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
||||
|
||||
if(( hInst = COM_LoadLibrary( dllpath, true, false )) != NULL )
|
||||
{
|
||||
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
|
||||
if( FS_FileExists( dllpath, false ))
|
||||
return true;
|
||||
}
|
||||
Con_Reportf( S_WARN "Could not load server library: %s\n", COM_GetLibraryError() );
|
||||
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -34,7 +34,7 @@ GNU General Public License for more details.
|
||||
CVAR_DEFINE_AUTO( mp_decals, "300", FCVAR_ARCHIVE, "decals limit in multiplayer" );
|
||||
CVAR_DEFINE_AUTO( dev_overview, "0", 0, "draw level in overview-mode" );
|
||||
CVAR_DEFINE_AUTO( cl_resend, "6.0", 0, "time to resend connect" );
|
||||
CVAR_DEFINE_AUTO( cl_allow_download, "1", FCVAR_ARCHIVE, "allow to downloading resources from the server" );
|
||||
CVAR_DEFINE( cl_allow_download, "cl_allowdownload", "1", FCVAR_ARCHIVE, "allow to downloading resources from the server" );
|
||||
CVAR_DEFINE_AUTO( cl_allow_upload, "1", FCVAR_ARCHIVE, "allow to uploading resources to the server" );
|
||||
CVAR_DEFINE_AUTO( cl_download_ingame, "1", FCVAR_ARCHIVE, "allow to downloading resources while client is active" );
|
||||
CVAR_DEFINE_AUTO( cl_logofile, "lambda", FCVAR_ARCHIVE, "player logo name" );
|
||||
@@ -78,6 +78,8 @@ CVAR_DEFINE_AUTO( cl_trace_events, "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable event
|
||||
static CVAR_DEFINE_AUTO( cl_nat, "0", 0, "show servers running under NAT" );
|
||||
CVAR_DEFINE_AUTO( hud_utf8, "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
|
||||
CVAR_DEFINE_AUTO( ui_renderworld, "0", FCVAR_ARCHIVE, "render world when UI is visible" );
|
||||
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
|
||||
@@ -92,7 +94,7 @@ client_t cl;
|
||||
client_static_t cls;
|
||||
clgame_static_t clgame;
|
||||
|
||||
void CL_InternetServers_f( void );
|
||||
static void CL_SendMasterServerScanRequest( void );
|
||||
|
||||
//======================================================================
|
||||
int GAME_EXPORT CL_Active( void )
|
||||
@@ -605,10 +607,10 @@ void CL_CreateCmd( void )
|
||||
// message we are constructing.
|
||||
i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK;
|
||||
pcmd = &cl.commands[i];
|
||||
pcmd->processedfuncs = false;
|
||||
|
||||
if( !cls.demoplayback )
|
||||
{
|
||||
pcmd->processedfuncs = false;
|
||||
pcmd->senttime = host.realtime;
|
||||
memset( &pcmd->cmd, 0, sizeof( pcmd->cmd ));
|
||||
pcmd->receivedtime = -1.0;
|
||||
@@ -1081,7 +1083,7 @@ void CL_CheckForResend( void )
|
||||
qboolean bandwidthTest;
|
||||
|
||||
if( cls.internetservers_wait )
|
||||
CL_InternetServers_f();
|
||||
CL_SendMasterServerScanRequest();
|
||||
|
||||
// if the local server is running and we aren't then connect
|
||||
if( cls.state == ca_disconnected && SV_Active( ))
|
||||
@@ -1574,10 +1576,10 @@ void CL_LocalServers_f( void )
|
||||
CL_BuildMasterServerScanRequest
|
||||
=================
|
||||
*/
|
||||
size_t CL_BuildMasterServerScanRequest( char *buf, size_t size, qboolean nat )
|
||||
static size_t NONNULL CL_BuildMasterServerScanRequest( char *buf, size_t size, uint32_t *key, qboolean nat, const char *filter )
|
||||
{
|
||||
size_t remaining;
|
||||
char *info;
|
||||
char *info, temp[32];
|
||||
|
||||
if( unlikely( size < sizeof( MS_SCAN_REQUEST )))
|
||||
return 0;
|
||||
@@ -1587,7 +1589,9 @@ size_t CL_BuildMasterServerScanRequest( char *buf, size_t size, qboolean nat )
|
||||
info = buf + sizeof( MS_SCAN_REQUEST ) - 1;
|
||||
remaining = size - sizeof( MS_SCAN_REQUEST );
|
||||
|
||||
info[0] = 0;
|
||||
Q_strncpy( info, filter, remaining );
|
||||
|
||||
*key = COM_RandomLong( 0, 0x7FFFFFFF );
|
||||
|
||||
#ifndef XASH_ALL_SERVERS
|
||||
Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining );
|
||||
@@ -1595,9 +1599,24 @@ size_t CL_BuildMasterServerScanRequest( char *buf, size_t size, qboolean nat )
|
||||
Info_SetValueForKey( info, "clver", XASH_VERSION, remaining ); // let master know about client version
|
||||
Info_SetValueForKey( info, "nat", nat ? "1" : "0", remaining );
|
||||
|
||||
Q_snprintf( temp, sizeof( temp ), "%x", *key );
|
||||
Info_SetValueForKey( info, "key", temp, remaining );
|
||||
|
||||
return sizeof( MS_SCAN_REQUEST ) + Q_strlen( info );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_SendMasterServerScanRequest
|
||||
=================
|
||||
*/
|
||||
static void CL_SendMasterServerScanRequest( void )
|
||||
{
|
||||
cls.internetservers_wait = NET_SendToMasters( NS_CLIENT,
|
||||
cls.internetservers_query_len, cls.internetservers_query );
|
||||
cls.internetservers_pending = true;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_InternetServers_f
|
||||
@@ -1605,26 +1624,24 @@ CL_InternetServers_f
|
||||
*/
|
||||
void CL_InternetServers_f( void )
|
||||
{
|
||||
char fullquery[512];
|
||||
size_t len;
|
||||
qboolean nat = cl_nat.value != 0.0f;
|
||||
uint32_t key;
|
||||
|
||||
len = CL_BuildMasterServerScanRequest( fullquery, sizeof( fullquery ), nat );
|
||||
if( Cmd_Argc( ) > 2 || ( Cmd_Argc( ) == 2 && !Info_IsValid( Cmd_Argv( 1 ))))
|
||||
{
|
||||
Con_Printf( S_USAGE "internetservers [filter]\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
cls.internetservers_query_len = CL_BuildMasterServerScanRequest(
|
||||
cls.internetservers_query, sizeof( cls.internetservers_query ),
|
||||
&cls.internetservers_key, nat, Cmd_Argv( 1 ));
|
||||
|
||||
Con_Printf( "Scanning for servers on the internet area...\n" );
|
||||
|
||||
NET_Config( true, true ); // allow remote
|
||||
|
||||
cls.internetservers_wait = NET_SendToMasters( NS_CLIENT, len, fullquery );
|
||||
cls.internetservers_pending = true;
|
||||
|
||||
if( !cls.internetservers_wait )
|
||||
{
|
||||
// now we clearing the vgui request
|
||||
if( clgame.master_request != NULL )
|
||||
memset( clgame.master_request, 0, sizeof( net_request_t ));
|
||||
clgame.request_type = NET_REQUEST_GAMEUI;
|
||||
}
|
||||
CL_SendMasterServerScanRequest();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2152,67 +2169,49 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
return;
|
||||
}
|
||||
|
||||
// check the extra header
|
||||
if( MSG_ReadByte( msg ) == 0x7f )
|
||||
{
|
||||
uint32_t key = MSG_ReadDword( msg );
|
||||
|
||||
if( cls.internetservers_key != key )
|
||||
{
|
||||
Con_Printf( S_WARN "unexpected server list packet from %s (invalid key)\n", NET_AdrToString( from ));
|
||||
return;
|
||||
}
|
||||
|
||||
MSG_ReadByte( msg ); // reserved byte
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Printf( S_WARN "invalid server list packet from %s (missing extra header)\n", NET_AdrToString( from ));
|
||||
return;
|
||||
}
|
||||
|
||||
// serverlist got from masterserver
|
||||
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.type = NA_IP;
|
||||
|
||||
// list is ends here
|
||||
if( !servadr.port )
|
||||
{
|
||||
if( clgame.request_type == NET_REQUEST_CLIENT && clgame.master_request != NULL )
|
||||
{
|
||||
net_request_t *nr = clgame.master_request;
|
||||
net_adrlist_t *list, **prev;
|
||||
|
||||
// setup the answer
|
||||
nr->resp.remote_address = from;
|
||||
nr->resp.error = NET_SUCCESS;
|
||||
nr->resp.ping = host.realtime - nr->timesend;
|
||||
|
||||
if( nr->timeout <= host.realtime )
|
||||
SetBits( nr->resp.error, NET_ERROR_TIMEOUT );
|
||||
|
||||
Con_Printf( "serverlist call: %s\n", NET_AdrToString( from ));
|
||||
nr->pfnFunc( &nr->resp );
|
||||
|
||||
// throw the list, now it will be stored in user area
|
||||
prev = (net_adrlist_t**)&nr->resp.response;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
list = *prev;
|
||||
if( !list ) break;
|
||||
|
||||
// throw out any variables the game created
|
||||
*prev = list->next;
|
||||
Mem_Free( list );
|
||||
}
|
||||
memset( nr, 0, sizeof( *nr )); // done
|
||||
clgame.request_type = NET_REQUEST_CANCEL;
|
||||
clgame.master_request = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if( clgame.request_type == NET_REQUEST_CLIENT && clgame.master_request != NULL )
|
||||
{
|
||||
net_request_t *nr = clgame.master_request;
|
||||
net_adrlist_t *list;
|
||||
|
||||
// adding addresses into list
|
||||
list = Z_Malloc( sizeof( *list ));
|
||||
list->remote_address = servadr;
|
||||
list->next = nr->resp.response;
|
||||
nr->resp.response = list;
|
||||
}
|
||||
else if( clgame.request_type == NET_REQUEST_GAMEUI )
|
||||
{
|
||||
NET_Config( true, false ); // allow remote
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, servadr, "info %i", PROTOCOL_VERSION );
|
||||
}
|
||||
NET_Config( true, false ); // allow remote
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, servadr, "info %i", PROTOCOL_VERSION );
|
||||
}
|
||||
|
||||
if( cls.internetservers_pending )
|
||||
@@ -2261,10 +2260,13 @@ void CL_ReadNetMessage( void )
|
||||
|
||||
while( CL_GetMessage( net_message_buffer, &curSize ))
|
||||
{
|
||||
if( cls.legacymode && *((int *)&net_message_buffer) == 0xFFFFFFFE )
|
||||
const int split_header = LittleLong( 0xFFFFFFFE );
|
||||
if( cls.legacymode && !memcmp( &split_header, net_message_buffer, sizeof( split_header )))
|
||||
{
|
||||
// Will rewrite existing packet by merged
|
||||
if( !NetSplit_GetLong( &cls.netchan.netsplit, &net_from, net_message_buffer, &curSize ) )
|
||||
continue;
|
||||
}
|
||||
|
||||
MSG_Init( &net_message, "ServerData", net_message_buffer, curSize );
|
||||
|
||||
@@ -2341,7 +2343,7 @@ void CL_ReadPackets( void )
|
||||
// decide the simulation time
|
||||
cl.oldtime = cl.time;
|
||||
|
||||
if( cls.demoplayback != DEMO_XASH3D && !cl.paused )
|
||||
if( !cl.paused )
|
||||
cl.time += host.frametime;
|
||||
|
||||
// demo time
|
||||
@@ -2928,10 +2930,8 @@ void CL_InitLocal( void )
|
||||
Cvar_RegisterVariable( &cl_showevents );
|
||||
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
||||
Cvar_RegisterVariable( &ui_renderworld );
|
||||
|
||||
// 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)" );
|
||||
Cvar_RegisterVariable( &cl_maxframetime );
|
||||
Cvar_RegisterVariable( &cl_fixmodelinterpolationartifacts );
|
||||
|
||||
// server commands
|
||||
Cmd_AddCommand ("noclip", NULL, "enable or disable no clipping mode" );
|
||||
@@ -3068,6 +3068,8 @@ void Host_ClientFrame( void )
|
||||
{
|
||||
// if client is not active, do nothing
|
||||
if( !cls.initialized ) return;
|
||||
if( cls.key_dest == key_game && cls.state == ca_active && !Con_Visible() )
|
||||
Platform_SetTimer( cl_maxframetime.value );
|
||||
|
||||
// if running the server remotely, send intentions now after
|
||||
// the incoming messages have been read
|
||||
|
||||
@@ -87,15 +87,6 @@ static int pfnDrawScaledCharacter( int x, int y, int number, int r, int g, int b
|
||||
return CL_DrawCharacter( x, y, number, color, &g_scaled_font, flags );
|
||||
}
|
||||
|
||||
static void *pfnGetNativeObject( const char *obj )
|
||||
{
|
||||
if( !obj )
|
||||
return NULL;
|
||||
|
||||
// Backend should consider that obj is case-sensitive
|
||||
return Platform_GetNativeObject( obj );
|
||||
}
|
||||
|
||||
static void pfnTouch_HideButtons( const char *name, byte state )
|
||||
{
|
||||
Touch_HideButtons( name, state, true );
|
||||
@@ -124,7 +115,7 @@ static mobile_engfuncs_t gpMobileEngfuncs =
|
||||
Touch_ResetDefaultButtons,
|
||||
pfnDrawScaledCharacter,
|
||||
Sys_Warn,
|
||||
pfnGetNativeObject,
|
||||
Sys_GetNativeObject,
|
||||
ID_SetCustomClientID,
|
||||
pfnParseFileSafe
|
||||
};
|
||||
|
||||
@@ -903,7 +903,7 @@ void CL_ParseServerData( sizebuf_t *msg, qboolean legacy )
|
||||
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), sizeof( clgame.maptitle ));
|
||||
background = MSG_ReadOneBit( msg );
|
||||
Q_strncpy( gamefolder, MSG_ReadString( msg ), sizeof( gamefolder ));
|
||||
host.features = (uint)MSG_ReadLong( msg );
|
||||
Host_ValidateEngineFeatures( MSG_ReadDword( msg ));
|
||||
|
||||
if( !legacy )
|
||||
{
|
||||
@@ -1534,7 +1534,8 @@ void CL_SendConsistencyInfo( sizebuf_t *msg )
|
||||
{
|
||||
case force_exactfile:
|
||||
MD5_HashFile( md5, filename, NULL );
|
||||
pc->value = *(int *)md5;
|
||||
memcpy( &pc->value, md5, sizeof( pc->value ));
|
||||
LittleLongSW( pc->value );
|
||||
|
||||
if( user_changed_diskfile )
|
||||
MSG_WriteUBitLong( msg, 0, 32 );
|
||||
@@ -1637,9 +1638,6 @@ void CL_RegisterResources( sizebuf_t *msg )
|
||||
|
||||
CL_ClearWorld ();
|
||||
|
||||
// update the ref state.
|
||||
R_UpdateRefState ();
|
||||
|
||||
// tell rendering system we have a new set of models.
|
||||
ref.dllFuncs.R_NewMap ();
|
||||
|
||||
|
||||
@@ -265,8 +265,18 @@ void CL_LegacyParseResourceList( sizebuf_t *msg )
|
||||
}
|
||||
|
||||
if( CL_IsPlaybackDemo() )
|
||||
{
|
||||
return;
|
||||
|
||||
if( !cl_allow_download.value )
|
||||
{
|
||||
Con_DPrintf( "Refusing new resource, cl_allow_download set to 0\n" );
|
||||
reslist.rescount = 0;
|
||||
}
|
||||
|
||||
if( cls.state == ca_active && !cl_download_ingame.value )
|
||||
{
|
||||
Con_DPrintf( "Refusing new resource, cl_download_ingame set to 0\n" );
|
||||
reslist.rescount = 0;
|
||||
}
|
||||
|
||||
HTTP_ResetProcessState();
|
||||
@@ -650,9 +660,6 @@ void CL_LegacyPrecache_f( void )
|
||||
if( clgame.entities )
|
||||
clgame.entities->model = cl.worldmodel;
|
||||
|
||||
// update the ref state.
|
||||
R_UpdateRefState ();
|
||||
|
||||
// tell rendering system we have a new set of models.
|
||||
ref.dllFuncs.R_NewMap ();
|
||||
|
||||
|
||||
@@ -824,6 +824,27 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
||||
cd = &from->client;
|
||||
|
||||
pmove->player_index = ps->number - 1;
|
||||
|
||||
// a1ba: workaround bug on old protocol where the server refuse to send
|
||||
// our local player in delta. cl.playernum, in theory, must be equal
|
||||
// to our local player index anyway
|
||||
// this might not be a real solution, since everything else will be bogus
|
||||
// but we need to properly run prediction and avoid potential memory
|
||||
// corruption
|
||||
// either debug this, or remove when old protocol will be dropped!!!
|
||||
if( pmove->player_index < 0 )
|
||||
{
|
||||
if( cls.legacymode )
|
||||
{
|
||||
pmove->player_index = bound( 0, cl.playernum, cl.maxclients - 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
// if this happens, record a demo and send it to a1ba
|
||||
Host_Error( "%s: ps->number == %d\n", __func__, ps->number );
|
||||
}
|
||||
}
|
||||
|
||||
pmove->multiplayer = (cl.maxclients > 1);
|
||||
pmove->runfuncs = runfuncs;
|
||||
pmove->time = time * 1000.0f;
|
||||
|
||||
@@ -78,7 +78,7 @@ CL_CreateRawTextureFromPixels
|
||||
Convert texture_t struct into mstudiotexture_t prototype
|
||||
====================
|
||||
*/
|
||||
byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor, int bottomcolor )
|
||||
static byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor, int bottomcolor )
|
||||
{
|
||||
static mstudiotexture_t pin;
|
||||
byte *pal;
|
||||
@@ -111,7 +111,7 @@ CL_DuplicateTexture
|
||||
Dupliacte texture with remap pixels
|
||||
====================
|
||||
*/
|
||||
void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
static void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
{
|
||||
const char *name;
|
||||
texture_t *tx = NULL;
|
||||
@@ -154,7 +154,7 @@ CL_UpdateStudioTexture
|
||||
Update texture top and bottom colors
|
||||
====================
|
||||
*/
|
||||
void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
static void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
{
|
||||
rgbdata_t *pic;
|
||||
texture_t *tx = NULL;
|
||||
@@ -215,7 +215,7 @@ CL_UpdateAliasTexture
|
||||
Update texture top and bottom colors
|
||||
====================
|
||||
*/
|
||||
void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int skinnum, int topcolor, int bottomcolor )
|
||||
static void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int skinnum, int topcolor, int bottomcolor )
|
||||
{
|
||||
char texname[MAX_QPATH];
|
||||
rgbdata_t skin, *pic;
|
||||
@@ -247,6 +247,68 @@ void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int sk
|
||||
ref.dllFuncs.GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor );
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_FreeRemapInfo
|
||||
|
||||
Release remap info per entity
|
||||
====================
|
||||
*/
|
||||
static void CL_FreeRemapInfo( remap_info_t *info )
|
||||
{
|
||||
int i;
|
||||
|
||||
Assert( info != NULL );
|
||||
|
||||
// release all colormap texture copies
|
||||
for( i = 0; i < info->numtextures; i++ )
|
||||
{
|
||||
if( info->ptexture != NULL )
|
||||
{
|
||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index );
|
||||
}
|
||||
|
||||
if( info->textures[i] != 0 )
|
||||
ref.dllFuncs.GL_FreeTexture( info->textures[i] );
|
||||
}
|
||||
|
||||
Mem_Free( info ); // release struct
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_UpdateRemapInfo
|
||||
|
||||
Update all remaps per entity
|
||||
====================
|
||||
*/
|
||||
static void CL_UpdateRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
|
||||
{
|
||||
remap_info_t *info;
|
||||
int i;
|
||||
|
||||
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number;
|
||||
info = clgame.remap_info[i];
|
||||
if( !info ) return; // no remap info
|
||||
|
||||
if( info->topcolor == topcolor && info->bottomcolor == bottomcolor )
|
||||
return; // values is valid
|
||||
|
||||
for( i = 0; i < info->numtextures; i++ )
|
||||
{
|
||||
if( info->ptexture != NULL )
|
||||
{
|
||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||
CL_UpdateStudioTexture( entity, &info->ptexture[i], topcolor, bottomcolor );
|
||||
}
|
||||
else CL_UpdateAliasTexture( entity, &info->textures[i], i, topcolor, bottomcolor );
|
||||
}
|
||||
|
||||
info->topcolor = topcolor;
|
||||
info->bottomcolor = bottomcolor;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_AllocRemapInfo
|
||||
@@ -255,7 +317,7 @@ Allocate new remap info per entity
|
||||
and make copy of remap textures
|
||||
====================
|
||||
*/
|
||||
void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor )
|
||||
static void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor )
|
||||
{
|
||||
remap_info_t *info;
|
||||
studiohdr_t *phdr;
|
||||
@@ -362,68 +424,6 @@ void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int b
|
||||
info->model = model;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_UpdateRemapInfo
|
||||
|
||||
Update all remaps per entity
|
||||
====================
|
||||
*/
|
||||
void CL_UpdateRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
|
||||
{
|
||||
remap_info_t *info;
|
||||
int i;
|
||||
|
||||
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number;
|
||||
info = clgame.remap_info[i];
|
||||
if( !info ) return; // no remap info
|
||||
|
||||
if( info->topcolor == topcolor && info->bottomcolor == bottomcolor )
|
||||
return; // values is valid
|
||||
|
||||
for( i = 0; i < info->numtextures; i++ )
|
||||
{
|
||||
if( info->ptexture != NULL )
|
||||
{
|
||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||
CL_UpdateStudioTexture( entity, &info->ptexture[i], topcolor, bottomcolor );
|
||||
}
|
||||
else CL_UpdateAliasTexture( entity, &info->textures[i], i, topcolor, bottomcolor );
|
||||
}
|
||||
|
||||
info->topcolor = topcolor;
|
||||
info->bottomcolor = bottomcolor;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_FreeRemapInfo
|
||||
|
||||
Release remap info per entity
|
||||
====================
|
||||
*/
|
||||
void CL_FreeRemapInfo( remap_info_t *info )
|
||||
{
|
||||
int i;
|
||||
|
||||
Assert( info != NULL );
|
||||
|
||||
// release all colormap texture copies
|
||||
for( i = 0; i < info->numtextures; i++ )
|
||||
{
|
||||
if( info->ptexture != NULL )
|
||||
{
|
||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index );
|
||||
}
|
||||
|
||||
if( info->textures[i] != 0 )
|
||||
ref.dllFuncs.GL_FreeTexture( info->textures[i] );
|
||||
}
|
||||
|
||||
Mem_Free( info ); // release struct
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_ClearAllRemaps
|
||||
@@ -446,3 +446,21 @@ void CL_ClearAllRemaps( void )
|
||||
}
|
||||
clgame.remap_info = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_EntitySetRemapColors
|
||||
=============
|
||||
*/
|
||||
qboolean CL_EntitySetRemapColors( cl_entity_t *e, model_t *mod, int top, int bottom )
|
||||
{
|
||||
CL_AllocRemapInfo( e, mod, top, bottom );
|
||||
|
||||
if( CL_GetRemapInfoForEntity( e ))
|
||||
{
|
||||
CL_UpdateRemapInfo( e, top, bottom );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -142,8 +142,6 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
case PARM_SKY_SPHERE:
|
||||
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
||||
case PARAM_GAMEPAUSED:
|
||||
return cl.paused;
|
||||
case PARM_CLIENT_INGAME:
|
||||
@@ -187,26 +185,30 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
||||
return CL_IsThirdPerson();
|
||||
case PARM_QUAKE_COMPATIBLE:
|
||||
return Host_IsQuakeCompatible();
|
||||
case PARM_PLAYER_INDEX:
|
||||
return cl.playernum + 1;
|
||||
case PARM_VIEWENT_INDEX:
|
||||
return cl.viewentity;
|
||||
case PARM_CONNSTATE:
|
||||
return (int)cls.state;
|
||||
case PARM_PLAYING_DEMO:
|
||||
return cls.demoplayback;
|
||||
case PARM_WATER_LEVEL:
|
||||
return cl.local.waterlevel;
|
||||
case PARM_MAX_CLIENTS:
|
||||
return cl.maxclients;
|
||||
case PARM_LOCAL_HEALTH:
|
||||
return cl.local.health;
|
||||
case PARM_LOCAL_GAME:
|
||||
return Host_IsLocalGame();
|
||||
case PARM_NUMENTITIES:
|
||||
return pfnNumberOfEntities();
|
||||
case PARM_NUMMODELS:
|
||||
return cl.nummodels;
|
||||
case PARM_GET_CLIENT_PTR:
|
||||
return (intptr_t)&cl.time; // with the offset
|
||||
case PARM_GET_HOST_PTR:
|
||||
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;
|
||||
|
||||
@@ -292,6 +292,8 @@ void SCR_MakeScreenShot( void )
|
||||
viewsize = cls.envshot_viewsize;
|
||||
else viewsize = cl_envshot_size.value;
|
||||
|
||||
V_CheckGamma();
|
||||
|
||||
switch( cls.scrshot_action )
|
||||
{
|
||||
case scrshot_normal:
|
||||
@@ -726,6 +728,7 @@ void SCR_VidInit( void )
|
||||
|
||||
// restart console size
|
||||
Con_VidInit ();
|
||||
Touch_NotifyResize();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2624,7 +2624,7 @@ CL_UpdateFlashlight
|
||||
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 vecSrc, vecEnd;
|
||||
@@ -2665,7 +2665,7 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
|
||||
// update flashlight endpos
|
||||
dl = CL_AllocDlight( ent->index );
|
||||
#if 1
|
||||
hit = CL_GetEntityByIndex( clgame.pmove->visents[trace.ent].info );
|
||||
hit = CL_GetEntityByIndex( clgame.pmove->physents[trace.ent].info );
|
||||
if( hit && hit->model && ( hit->model->type == mod_alias || hit->model->type == mod_studio ))
|
||||
VectorCopy( hit->origin, dl->origin );
|
||||
else VectorCopy( trace.endpos, dl->origin );
|
||||
@@ -2684,6 +2684,41 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
|
||||
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
|
||||
@@ -2693,50 +2728,41 @@ apply various effects to entity origin or attachment
|
||||
*/
|
||||
void CL_AddEntityEffects( cl_entity_t *ent )
|
||||
{
|
||||
// yellow flies effect 'monster stuck in the wall'
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTFIELD ) && !RP_LOCALCLIENT( ent ))
|
||||
R_EntityParticles( ent );
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||
// players have special set of effects, from CL_LinkPlayers
|
||||
if( ent->player && ent->index != cl.viewentity )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||
else
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
||||
dl->color.r = dl->color.g = dl->color.b = 250;
|
||||
if( ent->player ) dl->radius = 400; // don't flickering
|
||||
else dl->radius = COM_RandomFloat( 400, 431 );
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->origin[2] += 16.0f;
|
||||
}
|
||||
// from CL_LinkPacketEntities
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTFIELD ))
|
||||
R_EntityParticles( ent );
|
||||
|
||||
// add light effect
|
||||
if( FBitSet( ent->curstate.effects, EF_LIGHT ))
|
||||
{
|
||||
dlight_t *dl = CL_AllocDlight( ent->index );
|
||||
dl->color.r = dl->color.g = dl->color.b = 100;
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
R_RocketFlare( ent->origin );
|
||||
dl->die = cl.time + 0.001;
|
||||
dl->radius = 200;
|
||||
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
|
||||
R_EntityBrightlight( ent, ent->index, 0 );
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||
R_EntityDimlight( ent, ent->index );
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_LIGHT ))
|
||||
R_EntityLight( ent, ent->curstate.number );
|
||||
}
|
||||
|
||||
// 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 );
|
||||
vec3_t fv;
|
||||
@@ -2765,15 +2791,11 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
||||
vec3_t neworigin;
|
||||
vec3_t oldorigin;
|
||||
|
||||
if( !ent->model ) return;
|
||||
if( !ent->model || ent->player )
|
||||
return;
|
||||
|
||||
switch( ent->model->type )
|
||||
{
|
||||
case mod_alias:
|
||||
case mod_studio:
|
||||
break;
|
||||
default: return;
|
||||
}
|
||||
if( ent->model->type != mod_alias && ent->model->type != mod_studio )
|
||||
return;
|
||||
|
||||
if( cls.demoplayback == DEMO_QUAKE1 )
|
||||
{
|
||||
@@ -2793,19 +2815,15 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_GIB ))
|
||||
R_RocketTrail( oldorigin, neworigin, 2 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_ZOMGIB ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_ZOMGIB ))
|
||||
R_RocketTrail( oldorigin, neworigin, 4 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_TRACER ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_TRACER ))
|
||||
R_RocketTrail( oldorigin, neworigin, 3 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_TRACER2 ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_TRACER2 ))
|
||||
R_RocketTrail( oldorigin, neworigin, 5 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_ROCKET ))
|
||||
else 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;
|
||||
VectorCopy( ent->origin, dl->origin );
|
||||
@@ -2819,11 +2837,9 @@ void CL_AddModelEffects( cl_entity_t *ent )
|
||||
|
||||
R_RocketTrail( oldorigin, neworigin, 0 );
|
||||
}
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_GRENADE ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_GRENADE ))
|
||||
R_RocketTrail( oldorigin, neworigin, 1 );
|
||||
|
||||
if( FBitSet( ent->model->flags, STUDIO_TRACER3 ))
|
||||
else if( FBitSet( ent->model->flags, STUDIO_TRACER3 ))
|
||||
R_RocketTrail( oldorigin, neworigin, 6 );
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,6 @@ void R_DebugParticle( const vec3_t pos, byte r, byte g, byte b );
|
||||
void R_RicochetSound( const vec3_t pos );
|
||||
struct dlight_s *CL_AllocDlight( 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_AddModelEffects( cl_entity_t *ent );
|
||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||
|
||||
@@ -202,7 +202,6 @@ SCR_PlayCinematic
|
||||
*/
|
||||
qboolean SCR_PlayCinematic( const char *arg )
|
||||
{
|
||||
string path;
|
||||
const char *fullpath;
|
||||
|
||||
fullpath = FS_GetDiskPath( arg, false );
|
||||
|
||||
@@ -347,6 +347,8 @@ qboolean V_PreRender( void )
|
||||
return false;
|
||||
}
|
||||
|
||||
V_CheckGamma();
|
||||
|
||||
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
||||
|
||||
GL_UpdateSwapInterval( );
|
||||
@@ -549,5 +551,6 @@ void V_PostRender( void )
|
||||
|
||||
SCR_MakeScreenShot();
|
||||
ref.dllFuncs.R_AllowFog( true );
|
||||
Platform_SetTimer( 0.0f );
|
||||
ref.dllFuncs.R_EndFrame();
|
||||
}
|
||||
|
||||
@@ -174,6 +174,26 @@ typedef struct
|
||||
// at every server map change
|
||||
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 validsequence; // this is the sequence number of the last good
|
||||
// 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 audio_prepped; // false if on new level or new snd dll
|
||||
qboolean paused;
|
||||
|
||||
int delta_sequence; // acknowledged sequence number
|
||||
|
||||
@@ -205,11 +224,6 @@ typedef struct
|
||||
runcmd_t commands[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
|
||||
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
|
||||
|
||||
char serverinfo[MAX_SERVERINFO_STRING];
|
||||
@@ -223,7 +237,6 @@ typedef struct
|
||||
|
||||
// player final info
|
||||
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
||||
int viewentity;
|
||||
vec3_t viewangles;
|
||||
vec3_t viewheight;
|
||||
vec3_t punchangle;
|
||||
@@ -236,14 +249,9 @@ typedef struct
|
||||
float addangletotal;
|
||||
float prevaddangletotal;
|
||||
|
||||
// predicted origin and velocity
|
||||
vec3_t simorg;
|
||||
// predicted velocity
|
||||
vec3_t simvel;
|
||||
|
||||
// server state information
|
||||
int playernum;
|
||||
int maxclients;
|
||||
|
||||
entity_state_t instanced_baseline[MAX_CUSTOM_BASELINES];
|
||||
int instanced_baseline_count;
|
||||
|
||||
@@ -251,8 +259,6 @@ typedef struct
|
||||
char event_precache[MAX_EVENTS][MAX_QPATH];
|
||||
char files_precache[MAX_CUSTOM][MAX_QPATH];
|
||||
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
||||
model_t *models[MAX_MODELS+1]; // precached models (plus sentinel slot)
|
||||
int nummodels;
|
||||
int numfiles;
|
||||
|
||||
consistency_t consistency_list[MAX_MODELS];
|
||||
@@ -423,13 +429,6 @@ typedef struct
|
||||
float applied_angle;
|
||||
} screen_shake_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NET_REQUEST_CANCEL = 0, // request was cancelled for some reasons
|
||||
NET_REQUEST_GAMEUI, // called from GameUI
|
||||
NET_REQUEST_CLIENT, // called from Client
|
||||
} net_request_type_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
net_response_t resp;
|
||||
@@ -491,9 +490,7 @@ typedef struct
|
||||
client_textmessage_t *titles; // title messages, not network messages
|
||||
int numTitles;
|
||||
|
||||
net_request_type_t request_type; // filter the requests
|
||||
net_request_t net_requests[MAX_REQUESTS]; // no reason to keep more
|
||||
net_request_t *master_request; // queued master request
|
||||
|
||||
efrag_t *free_efrags; // linked efrags
|
||||
cl_entity_t viewent; // viewmodel
|
||||
@@ -627,7 +624,10 @@ typedef struct
|
||||
file_t *demofile;
|
||||
file_t *demoheader; // contain demo startup info in case we record a demo on this level
|
||||
qboolean internetservers_wait; // internetservers is waiting for dns request
|
||||
qboolean internetservers_pending; // internetservers is waiting for dns request
|
||||
qboolean internetservers_pending; // if true, clean master server pings
|
||||
uint32_t internetservers_key; // compare key to validate master server reply
|
||||
char internetservers_query[512]; // cached query
|
||||
uint32_t internetservers_query_len;
|
||||
|
||||
// legacy mode support
|
||||
qboolean legacymode; // one-way 48 protocol compatibility
|
||||
@@ -700,6 +700,7 @@ extern convar_t rate;
|
||||
extern convar_t m_ignore;
|
||||
extern convar_t r_showtree;
|
||||
extern convar_t ui_renderworld;
|
||||
extern convar_t cl_fixmodelinterpolationartifacts;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
@@ -765,7 +766,6 @@ int CL_IsDevOverviewMode( void );
|
||||
void CL_PingServers_f( void );
|
||||
void CL_SignonReply( void );
|
||||
void CL_ClearState( void );
|
||||
size_t CL_BuildMasterServerScanRequest( char *buf, size_t size, qboolean nat );
|
||||
|
||||
//
|
||||
// cl_demo.c
|
||||
@@ -1003,9 +1003,7 @@ void CL_EmitEntities( void );
|
||||
// cl_remap.c
|
||||
//
|
||||
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
|
||||
void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor );
|
||||
void CL_FreeRemapInfo( remap_info_t *info );
|
||||
void CL_UpdateRemapInfo( cl_entity_t *ent, int topcolor, int bottomcolor );
|
||||
qboolean CL_EntitySetRemapColors( cl_entity_t *e, model_t *mod, int top, int bottom );
|
||||
void CL_ClearAllRemaps( void );
|
||||
|
||||
//
|
||||
|
||||
@@ -29,7 +29,8 @@ static CVAR_DEFINE_AUTO( con_charset, "cp1251", FCVAR_ARCHIVE, "console font cha
|
||||
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_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 qboolean g_utf8 = false;
|
||||
@@ -543,8 +544,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
||||
if( font->valid )
|
||||
return; // already loaded
|
||||
|
||||
// loading conchars
|
||||
if( Sys_CheckParm( "-oldfont" ))
|
||||
if( con_oldfont.value )
|
||||
{
|
||||
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
||||
}
|
||||
@@ -841,6 +841,8 @@ void Con_Init( void )
|
||||
Cvar_RegisterVariable( &con_fontscale );
|
||||
Cvar_RegisterVariable( &con_fontnum );
|
||||
Cvar_RegisterVariable( &con_color );
|
||||
Cvar_RegisterVariable( &scr_drawversion );
|
||||
Cvar_RegisterVariable( &con_oldfont );
|
||||
|
||||
// init the console buffer
|
||||
con.bufsize = CON_TEXTSIZE;
|
||||
@@ -1983,7 +1985,7 @@ void Con_DrawConsole( void )
|
||||
|
||||
if( cls.state == ca_connecting || cls.state == ca_connected )
|
||||
{
|
||||
if( !cl_allow_levelshots.value )
|
||||
if( !cl_allow_levelshots.value && !cls.timedemo )
|
||||
{
|
||||
if(( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" )) && cls.key_dest != key_console )
|
||||
con.vislines = con.showlines = 0;
|
||||
@@ -1993,7 +1995,7 @@ void Con_DrawConsole( void )
|
||||
{
|
||||
con.showlines = 0;
|
||||
|
||||
if( host_developer.value >= DEV_EXTENDED )
|
||||
if( host_developer.value >= DEV_EXTENDED && !cls.timedemo )
|
||||
Con_DrawNotify(); // draw notify lines
|
||||
}
|
||||
}
|
||||
@@ -2025,7 +2027,7 @@ void Con_DrawConsole( void )
|
||||
{
|
||||
if( con.vislines )
|
||||
Con_DrawSolidConsole( con.vislines );
|
||||
else if( cls.state == ca_active && ( cls.key_dest == key_game || cls.key_dest == key_message ))
|
||||
else if( cls.state == ca_active && ( cls.key_dest == key_game || cls.key_dest == key_message ) && !cls.timedemo )
|
||||
Con_DrawNotify(); // draw notify lines
|
||||
}
|
||||
break;
|
||||
@@ -2047,26 +2049,30 @@ void Con_DrawVersion( void )
|
||||
byte *color = g_color_table[7];
|
||||
int stringLen, charH = 0;
|
||||
int start, height = refState.height;
|
||||
qboolean draw_version = false;
|
||||
string curbuild;
|
||||
|
||||
switch( cls.scrshot_action )
|
||||
{
|
||||
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 )
|
||||
if( !scr_drawversion.value || CL_IsDevOverviewMode() == 2 || net_graph.value )
|
||||
return;
|
||||
|
||||
if( draw_version )
|
||||
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( ));
|
||||
if( cls.key_dest == key_menu )
|
||||
{
|
||||
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 );
|
||||
start = refState.width - stringLen * 1.05f;
|
||||
@@ -2112,10 +2118,7 @@ void Con_RunConsole( void )
|
||||
con.vislines = con.showlines;
|
||||
}
|
||||
|
||||
if( FBitSet( con_charset.flags, FCVAR_CHANGED ) ||
|
||||
FBitSet( con_fontscale.flags, FCVAR_CHANGED ) ||
|
||||
FBitSet( con_fontnum.flags, FCVAR_CHANGED ) ||
|
||||
FBitSet( cl_charset.flags, FCVAR_CHANGED ))
|
||||
if( FBitSet( con_charset.flags|con_fontscale.flags|con_fontnum.flags|cl_charset.flags|con_oldfont.flags, FCVAR_CHANGED ))
|
||||
{
|
||||
// update codepage parameters
|
||||
if( !Q_stricmp( con_charset.string, "cp1251" ))
|
||||
@@ -2141,6 +2144,7 @@ void Con_RunConsole( void )
|
||||
ClearBits( con_fontnum.flags, FCVAR_CHANGED );
|
||||
ClearBits( con_fontscale.flags, FCVAR_CHANGED );
|
||||
ClearBits( cl_charset.flags, FCVAR_CHANGED );
|
||||
ClearBits( con_oldfont.flags, FCVAR_CHANGED );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2186,6 +2190,9 @@ void Con_VidInit( void )
|
||||
con.historyLoaded = true;
|
||||
}
|
||||
|
||||
if( Sys_CheckParm( "-oldfont" ))
|
||||
Cvar_DirectSet( &con_oldfont, "1" );
|
||||
|
||||
Con_LoadConchars();
|
||||
Con_CheckResize();
|
||||
#if XASH_LOW_MEMORY
|
||||
|
||||
428
engine/client/gamma.c
Normal file
428
engine/client/gamma.c
Normal file
@@ -0,0 +1,428 @@
|
||||
/*
|
||||
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 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( Host_IsLocalGame( ))
|
||||
return;
|
||||
|
||||
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 > 2.0f )
|
||||
Cvar_DirectSet( &v_brightness, "2" );
|
||||
}
|
||||
|
||||
void V_CheckGamma( void )
|
||||
{
|
||||
static qboolean dirty = false;
|
||||
qboolean notify_refdll = false;
|
||||
|
||||
// because these cvars were defined as archive
|
||||
// but wasn't doing anything useful
|
||||
// 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;
|
||||
BuildGammaTable( v_gamma.value, v_brightness.value, v_texgamma.value, v_lightgamma.value );
|
||||
|
||||
// force refdll to recalculate lightmaps
|
||||
notify_refdll = true;
|
||||
|
||||
// unfortunately, recalculating textures isn't possible yet
|
||||
ClearBits( v_texgamma.flags, FCVAR_CHANGED );
|
||||
ClearBits( v_lightgamma.flags, FCVAR_CHANGED );
|
||||
ClearBits( v_brightness.flags, FCVAR_CHANGED );
|
||||
ClearBits( v_gamma.flags, FCVAR_CHANGED );
|
||||
}
|
||||
|
||||
if( notify_refdll && ref.initialized )
|
||||
ref.dllFuncs.R_GammaChanged( false );
|
||||
}
|
||||
|
||||
void V_Init( void )
|
||||
{
|
||||
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
|
||||
@@ -132,6 +132,8 @@ static struct touch_s
|
||||
int whitetexture;
|
||||
int joytexture; // touch indicator
|
||||
qboolean configchanged;
|
||||
float actual_aspect_ratio; // maximum aspect ratio from launch, or aspect ratio when entering editor
|
||||
float config_aspect_ratio; // aspect ratio set by command from config or after entering editor
|
||||
} touch;
|
||||
|
||||
// private to the engine flags
|
||||
@@ -168,13 +170,42 @@ CVAR_DEFINE_AUTO( touch_emulate, "0", FCVAR_ARCHIVE | FCVAR_FILTERABLE, "emulate
|
||||
#define B(x) (button->x)
|
||||
#define SCR_W ((float)refState.width)
|
||||
#define SCR_H ((float)refState.height)
|
||||
#define TO_SCRN_Y(x) (refState.height * (x))
|
||||
#define TO_SCRN_Y(x) (refState.width * (x) * Touch_AspectRatio())
|
||||
#define TO_SCRN_X(x) (refState.width * (x))
|
||||
|
||||
static void IN_TouchCheckCoords( float *x1, float *y1, float *x2, float *y2 );
|
||||
static void IN_TouchEditClear( void );
|
||||
static void Touch_InitConfig( void );
|
||||
|
||||
void Touch_NotifyResize( void )
|
||||
{
|
||||
if( refState.width && refState.height && ( !touch.configchanged || !touch.actual_aspect_ratio ))
|
||||
{
|
||||
float aspect_ratio = SCR_H/SCR_W;
|
||||
if( aspect_ratio < 0.99 && aspect_ratio > touch.actual_aspect_ratio )
|
||||
touch.actual_aspect_ratio = aspect_ratio;
|
||||
}
|
||||
}
|
||||
|
||||
static inline float Touch_AspectRatio( void )
|
||||
{
|
||||
if( touch.config_aspect_ratio )
|
||||
return touch.config_aspect_ratio;
|
||||
else if( touch.actual_aspect_ratio )
|
||||
return touch.actual_aspect_ratio;
|
||||
else if( refState.width && refState.height )
|
||||
return SCR_H/SCR_W;
|
||||
else
|
||||
return 9.0f / 16.0f;
|
||||
}
|
||||
|
||||
|
||||
static void Touch_ConfigAspectRatio_f( void )
|
||||
{
|
||||
touch.config_aspect_ratio = Q_atof( Cmd_Argv( 1 ));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================
|
||||
Touch_ExportButtonToConfig
|
||||
@@ -206,7 +237,7 @@ static inline int Touch_ExportButtonToConfig( file_t *f, touch_button_t *button,
|
||||
|
||||
if( keepAspect )
|
||||
{
|
||||
float aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(SCR_H/SCR_W) );
|
||||
float aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(Touch_AspectRatio()) );
|
||||
FS_Printf( f, " %f\n", aspect );
|
||||
}
|
||||
else FS_Printf( f, "\n" );
|
||||
@@ -271,6 +302,8 @@ qboolean Touch_DumpConfig( const char *name, const char *profilename )
|
||||
FS_Printf( f, "touch_setclientonly 0\n" );
|
||||
FS_Printf( f, "\n// touch buttons\n" );
|
||||
FS_Printf( f, "touch_removeall\n" );
|
||||
FS_Printf( f, "touch_aspectratio %f\n", Touch_AspectRatio());
|
||||
|
||||
|
||||
for( button = touch.list_user.first; button; button = button->next )
|
||||
{
|
||||
@@ -376,7 +409,7 @@ static void Touch_GenerateCode_f( void )
|
||||
if( FBitSet( flags, TOUCH_FL_DEF_HIDE ))
|
||||
SetBits( flags, TOUCH_FL_HIDE );
|
||||
|
||||
aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(SCR_H/SCR_W) );
|
||||
aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(Touch_AspectRatio()) );
|
||||
if( memcmp( &c, &B(color), sizeof( rgba_t ) ) )
|
||||
{
|
||||
Con_Printf( "unsigned char color[] = { %d, %d, %d, %d };\n", B(color[0]), B(color[1]), B(color[2]), B(color[3]) );
|
||||
@@ -549,6 +582,7 @@ static void Touch_RemoveAll_f( void )
|
||||
{
|
||||
IN_TouchEditClear();
|
||||
Touch_ClearList( &touch.list_user );
|
||||
touch.config_aspect_ratio = 0.0f;
|
||||
}
|
||||
|
||||
static void Touch_SetColor( touchbuttonlist_t *list, const char *name, byte *color )
|
||||
@@ -726,6 +760,8 @@ static void Touch_SetCommand_f( void )
|
||||
Con_Printf( S_USAGE "touch_setcommand <name> <command>\n" );
|
||||
}
|
||||
|
||||
static void Touch_LoadDefaults_f( void );
|
||||
|
||||
static void Touch_ReloadConfig_f( void )
|
||||
{
|
||||
touch.state = state_none;
|
||||
@@ -735,8 +771,15 @@ static void Touch_ReloadConfig_f( void )
|
||||
touch.selection->finger = -1;
|
||||
touch.edit = touch.selection = NULL;
|
||||
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
|
||||
|
||||
Cbuf_AddTextf( "exec %s\n", touch_config_file.string );
|
||||
if( FS_FileExists( touch_config_file.string, true ) )
|
||||
{
|
||||
Cbuf_AddTextf( "exec \"%s\"\n", touch_config_file.string );
|
||||
}
|
||||
else
|
||||
{
|
||||
Touch_LoadDefaults_f();
|
||||
touch.configchanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
static touch_button_t *Touch_AddButton( touchbuttonlist_t *list,
|
||||
@@ -784,7 +827,7 @@ void Touch_AddClientButton( const char *name, const char *texture, const char *c
|
||||
IN_TouchCheckCoords( &x1, &y1, &x2, &y2 );
|
||||
if( round == round_aspect )
|
||||
{
|
||||
y2 = y1 + ( x2 - x1 ) * (SCR_W/SCR_H) * aspect;
|
||||
y2 = y1 + ( x2 - x1 ) / (Touch_AspectRatio()) * aspect;
|
||||
}
|
||||
button = Touch_AddButton( &touch.list_user, name, texture, command, x1, y1, x2, y2, color, true );
|
||||
button->flags |= flags | TOUCH_FL_CLIENT | TOUCH_FL_NOEDIT;
|
||||
@@ -809,7 +852,7 @@ static void Touch_LoadDefaults_f( void )
|
||||
if( g_DefaultButtons[i].texturefile[0] == '#' )
|
||||
y2 = y1 + ( (float)clgame.scrInfo.iCharHeight / (float)clgame.scrInfo.iHeight ) * g_DefaultButtons[i].aspect + touch.swidth*2/SCR_H;
|
||||
else
|
||||
y2 = y1 + ( x2 - x1 ) * (SCR_W/SCR_H) * g_DefaultButtons[i].aspect;
|
||||
y2 = y1 + (( x2 - x1 ) / Touch_AspectRatio()) * g_DefaultButtons[i].aspect;
|
||||
}
|
||||
|
||||
IN_TouchCheckCoords( &x1, &y1, &x2, &y2 );
|
||||
@@ -817,6 +860,7 @@ static void Touch_LoadDefaults_f( void )
|
||||
button->flags |= g_DefaultButtons[i].flags;
|
||||
button->aspect = g_DefaultButtons[i].aspect;
|
||||
}
|
||||
touch.configchanged = true;
|
||||
}
|
||||
|
||||
// Add default button from client
|
||||
@@ -909,7 +953,7 @@ static void Touch_AddButton_f( void )
|
||||
if( aspect )
|
||||
{
|
||||
if( B( texturefile )[0] != '#' )
|
||||
B( y2 ) = B( y1 ) + ( B( x2 ) - B( x1 )) * ( SCR_W / SCR_H ) * aspect;
|
||||
B( y2 ) = B( y1 ) + (( B( x2 ) - B( x1 )) / Touch_AspectRatio() ) * aspect;
|
||||
B( aspect ) = aspect;
|
||||
}
|
||||
}
|
||||
@@ -917,11 +961,39 @@ static void Touch_AddButton_f( void )
|
||||
|
||||
static void Touch_EnableEdit_f( void )
|
||||
{
|
||||
touch_button_t *button;
|
||||
float current_ratio = SCR_H/SCR_W;
|
||||
if( touch.state == state_none )
|
||||
touch.state = state_edit;
|
||||
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
|
||||
touch.move_button = NULL;
|
||||
touch.configchanged = true;
|
||||
/* try determine the best ratio
|
||||
* User enters editor. Window now have correct size. Need to fix aspect ratio in some cases */
|
||||
// Case A: no config was loaded, touch was generated with lower height, but window was resized higher, reset it to actual size
|
||||
if( touch.actual_aspect_ratio > current_ratio )
|
||||
touch.actual_aspect_ratio = current_ratio;
|
||||
if( !touch.config_aspect_ratio )
|
||||
touch.config_aspect_ratio = touch.actual_aspect_ratio;
|
||||
// Case B: config was loaded, but window may be resized later, so keep y coordinate as is
|
||||
touch.actual_aspect_ratio = current_ratio;
|
||||
// convert coordinates to actual aspect ratio after it was updated
|
||||
if( touch.config_aspect_ratio != touch.actual_aspect_ratio )
|
||||
{
|
||||
for( button = touch.list_user.first; button; button = button->next )
|
||||
{
|
||||
B(y1) /= touch.actual_aspect_ratio / touch.config_aspect_ratio;
|
||||
B(y2) /= touch.actual_aspect_ratio / touch.config_aspect_ratio;
|
||||
|
||||
// clamp positions to make buttons visible by user
|
||||
if( B(y2) > 1.0f )
|
||||
{
|
||||
B(y1) -= B(y2) - 1.0f;
|
||||
B(y2) -= B(y2) - 1.0f;
|
||||
}
|
||||
}
|
||||
touch.config_aspect_ratio = touch.actual_aspect_ratio;
|
||||
}
|
||||
}
|
||||
|
||||
static void Touch_DisableEdit_f( void )
|
||||
@@ -956,7 +1028,7 @@ static void Touch_DeleteProfile_f( void )
|
||||
|
||||
static void Touch_InitEditor( void )
|
||||
{
|
||||
float x = 0.1f * (SCR_H/SCR_W);
|
||||
float x = 0.1f * (Touch_AspectRatio());
|
||||
float y = 0.05f;
|
||||
touch_button_t *temp;
|
||||
rgba_t color;
|
||||
@@ -1051,6 +1123,7 @@ void Touch_Init( void )
|
||||
Cmd_AddRestrictedCommand( "touch_generate_code", Touch_GenerateCode_f, "create code sample for mobility API" );
|
||||
Cmd_AddCommand( "touch_fade", Touch_Fade_f, "start fade animation for selected buttons" );
|
||||
Cmd_AddRestrictedCommand( "touch_toggleselection", Touch_ToggleSelection_f, "toggle vidibility on selected button in editor" );
|
||||
Cmd_AddRestrictedCommand( "touch_aspectratio", Touch_ConfigAspectRatio_f, "set current aspect ratio" );
|
||||
|
||||
// not saved, just runtime state for scripting
|
||||
Cvar_RegisterVariable( &touch_in_menu );
|
||||
@@ -1087,7 +1160,7 @@ void Touch_Init( void )
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 10 )
|
||||
SDL_SetHint( SDL_HINT_MOUSE_TOUCH_EVENTS, "0" );
|
||||
SDL_SetHint( SDL_HINT_TOUCH_MOUSE_EVENTS, "0" );
|
||||
#else
|
||||
#elif defined(SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH)
|
||||
SDL_SetHint( SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH, "1" );
|
||||
#endif
|
||||
|
||||
@@ -1170,9 +1243,9 @@ static void Touch_DrawTexture ( float x1, float y1, float x2, float y2, int text
|
||||
}
|
||||
|
||||
#define GRID_COUNT_X ((int)touch_grid_count.value)
|
||||
#define GRID_COUNT_Y (((int)touch_grid_count.value) * SCR_H / SCR_W)
|
||||
#define GRID_COUNT_Y (((int)touch_grid_count.value) * Touch_AspectRatio())
|
||||
#define GRID_X (1.0f/GRID_COUNT_X)
|
||||
#define GRID_Y (SCR_W/SCR_H/GRID_COUNT_X)
|
||||
#define GRID_Y (1.0f/Touch_AspectRatio()/GRID_COUNT_X)
|
||||
#define GRID_ROUND_X(x) ((float)round( x * GRID_COUNT_X ) / GRID_COUNT_X)
|
||||
#define GRID_ROUND_Y(x) ((float)round( x * GRID_COUNT_Y ) / GRID_COUNT_Y)
|
||||
|
||||
@@ -1250,7 +1323,7 @@ static float Touch_DrawText( float x1, float y1, float x2, float y2, const char
|
||||
{
|
||||
while( *s && ( *s != '\n' ) && ( *s != ';' ) && ( x1 < maxx ) )
|
||||
x1 += Touch_DrawCharacter( x1, y1, *s++, size );
|
||||
y1 += cls.creditsFont.charHeight / 1024.f * size / SCR_H * SCR_W;
|
||||
y1 += cls.creditsFont.charHeight / 1024.f * size / Touch_AspectRatio();
|
||||
|
||||
if( y1 >= maxy )
|
||||
break;
|
||||
@@ -1357,11 +1430,12 @@ void Touch_Draw( void )
|
||||
if( !touch.initialized || ( !touch_enable.value && !touch.clientonly ))
|
||||
return;
|
||||
|
||||
Touch_InitConfig();
|
||||
|
||||
if( cls.key_dest != key_game && !touch_in_menu.value )
|
||||
return;
|
||||
|
||||
Touch_InitConfig();
|
||||
|
||||
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||
|
||||
if( touch.state >= state_edit && touch_grid_enable.value )
|
||||
@@ -1948,6 +2022,8 @@ static int Touch_ControlsEvent( touchEventType type, int fingerID, float x, floa
|
||||
|
||||
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy )
|
||||
{
|
||||
y *= SCR_H/SCR_W/Touch_AspectRatio();
|
||||
// Con_Printf("%f %f\n", TO_SCRN_X(x), TO_SCRN_Y(y));
|
||||
// simulate menu mouse click
|
||||
if( cls.key_dest != key_game && !touch_in_menu.value )
|
||||
{
|
||||
|
||||
@@ -192,6 +192,10 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
||||
#endif
|
||||
}
|
||||
|
||||
// don't leave the user without cursor if they enabled m_ignore
|
||||
if( m_ignore.value )
|
||||
return;
|
||||
|
||||
if( oldstate == key_game )
|
||||
{
|
||||
IN_DeactivateMouse();
|
||||
@@ -212,6 +216,9 @@ void IN_CheckMouseState( qboolean active )
|
||||
qboolean useRawInput = true; // always use SDL code
|
||||
#endif
|
||||
|
||||
if( m_ignore.value )
|
||||
return;
|
||||
|
||||
if( active && useRawInput && !host.mouse_visible && cls.state == ca_active )
|
||||
{
|
||||
if( !s_bRawInput )
|
||||
|
||||
@@ -75,6 +75,7 @@ void Touch_ResetDefaultButtons( void );
|
||||
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
||||
void Touch_KeyEvent( int key, int down );
|
||||
qboolean Touch_WantVisibleCursor( void );
|
||||
void Touch_NotifyResize( void );
|
||||
|
||||
//
|
||||
// in_joy.c
|
||||
|
||||
@@ -659,7 +659,7 @@ static void make_hull_windings( hull_t *hull, hull_model_t *model )
|
||||
Con_Reportf( "%i hull polys\n", model->num_polys );
|
||||
}
|
||||
|
||||
void Mod_InitDebugHulls( void )
|
||||
void Mod_InitDebugHulls( model_t *loadmodel )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
@@ -16,6 +16,32 @@ CVAR_DEFINE_AUTO( gl_msaa_samples, "0", FCVAR_GLCONFIG, "samples number for mult
|
||||
CVAR_DEFINE_AUTO( gl_clear, "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
|
||||
CVAR_DEFINE_AUTO( r_showtree, "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
|
||||
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" );
|
||||
|
||||
// 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 )
|
||||
{
|
||||
@@ -41,18 +67,8 @@ void GAME_EXPORT GL_FreeImage( const char *name )
|
||||
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 )
|
||||
{
|
||||
R_UpdateRefState();
|
||||
|
||||
VectorCopy( rvp->vieworigin, refState.vieworg );
|
||||
VectorCopy( rvp->viewangles, refState.viewangles );
|
||||
|
||||
@@ -64,11 +80,6 @@ static intptr_t pfnEngineGetParm( int parm, int arg )
|
||||
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 )
|
||||
{
|
||||
clgame.dllFuncs.pfnStudioEvent( event, e );
|
||||
@@ -98,26 +109,6 @@ static void *pfnMod_Extradata( int type, model_t *m )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static model_t *pfnMod_GetCurrentLoadingModel( void )
|
||||
{
|
||||
return loadmodel;
|
||||
}
|
||||
|
||||
static void pfnMod_SetCurrentLoadingModel( model_t *m )
|
||||
{
|
||||
loadmodel = m;
|
||||
}
|
||||
|
||||
static void pfnGetPredictedOrigin( vec3_t v )
|
||||
{
|
||||
VectorCopy( cl.simorg, v );
|
||||
}
|
||||
|
||||
static color24 *pfnCL_GetPaletteColor( int color ) // clgame.palette[color]
|
||||
{
|
||||
return &clgame.palette[color];
|
||||
}
|
||||
|
||||
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
||||
{
|
||||
if( width ) *width = clgame.scrInfo.iWidth;
|
||||
@@ -167,11 +158,6 @@ static int pfnGetStudioModelInterface( int version, struct r_studio_interface_s
|
||||
0;
|
||||
}
|
||||
|
||||
static poolhandle_t pfnImage_GetPool( void )
|
||||
{
|
||||
return host.imagepool;
|
||||
}
|
||||
|
||||
static const bpc_desc_t *pfnImage_GetPFDesc( int idx )
|
||||
{
|
||||
return &PFDesc[idx];
|
||||
@@ -192,25 +178,6 @@ static screenfade_t *pfnRefGetScreenFade( void )
|
||||
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 )
|
||||
{
|
||||
host.apply_opengl_config = true;
|
||||
@@ -255,16 +222,12 @@ static ref_api_t gEngfuncs =
|
||||
Con_DrawString,
|
||||
CL_DrawCenterPrint,
|
||||
|
||||
CL_GetLocalPlayer,
|
||||
CL_GetViewModel,
|
||||
CL_GetEntityByIndex,
|
||||
R_BeamGetEntity,
|
||||
CL_GetWaterEntity,
|
||||
CL_AddVisibleEntity,
|
||||
|
||||
Mod_SampleSizeForFace,
|
||||
Mod_BoxVisible,
|
||||
pfnGetWorld,
|
||||
Mod_PointInLeaf,
|
||||
Mod_CreatePolygonsForHull,
|
||||
|
||||
@@ -281,14 +244,9 @@ static ref_api_t gEngfuncs =
|
||||
|
||||
Mod_ForName,
|
||||
pfnMod_Extradata,
|
||||
CL_ModelHandle,
|
||||
pfnMod_GetCurrentLoadingModel,
|
||||
pfnMod_SetCurrentLoadingModel,
|
||||
|
||||
CL_EntitySetRemapColors,
|
||||
CL_GetRemapInfoForEntity,
|
||||
CL_AllocRemapInfo,
|
||||
CL_FreeRemapInfo,
|
||||
CL_UpdateRemapInfo,
|
||||
|
||||
CL_ExtraUpdate,
|
||||
Host_Error,
|
||||
@@ -296,9 +254,6 @@ static ref_api_t gEngfuncs =
|
||||
COM_RandomFloat,
|
||||
COM_RandomLong,
|
||||
pfnRefGetScreenFade,
|
||||
CL_TextMessageGet,
|
||||
pfnGetPredictedOrigin,
|
||||
pfnCL_GetPaletteColor,
|
||||
pfnCL_GetScreenInfo,
|
||||
pfnSetLocalLightLevel,
|
||||
Sys_CheckParm,
|
||||
@@ -332,9 +287,11 @@ static ref_api_t gEngfuncs =
|
||||
SW_LockBuffer,
|
||||
SW_UnlockBuffer,
|
||||
|
||||
BuildGammaTable,
|
||||
LightToTexGamma,
|
||||
R_DoResetGamma,
|
||||
LightToTexGammaEx,
|
||||
TextureToGamma,
|
||||
ScreenGammaTable,
|
||||
LinearGammaTable,
|
||||
|
||||
CL_GetLightStyle,
|
||||
CL_GetDynamicLight,
|
||||
@@ -348,7 +305,6 @@ static ref_api_t gEngfuncs =
|
||||
PM_CL_TraceLine,
|
||||
CL_VisTraceLine,
|
||||
CL_TraceLine,
|
||||
pfnGetMoveVars,
|
||||
|
||||
Image_AddCmdFlags,
|
||||
Image_SetForceFlags,
|
||||
@@ -360,7 +316,6 @@ static ref_api_t gEngfuncs =
|
||||
FS_CopyImage,
|
||||
FS_FreeImage,
|
||||
Image_SetMDLPointer,
|
||||
pfnImage_GetPool,
|
||||
pfnImage_GetPFDesc,
|
||||
|
||||
pfnDrawNormalTriangles,
|
||||
@@ -442,7 +397,7 @@ static qboolean R_LoadProgs( const char *name )
|
||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
||||
|
||||
if( !GetRefAPI( REF_API_VERSION, &ref.dllFuncs, &gpEngfuncs, &refState ))
|
||||
if( GetRefAPI( REF_API_VERSION, &ref.dllFuncs, &gpEngfuncs, &refState ) != REF_API_VERSION )
|
||||
{
|
||||
COM_FreeLibrary( ref.hInstance );
|
||||
Con_Reportf( "R_LoadProgs: can't init renderer API: wrong version\n" );
|
||||
@@ -531,6 +486,7 @@ static qboolean R_LoadRenderer( const char *refopt )
|
||||
return false;
|
||||
}
|
||||
|
||||
Cvar_FullSet( "r_refdll_loaded", refopt, FCVAR_READ_ONLY );
|
||||
Con_Reportf( "Renderer %s initialized\n", refdll );
|
||||
|
||||
return true;
|
||||
@@ -579,6 +535,9 @@ static void R_CollectRendererNames( void )
|
||||
#if XASH_REF_GL4ES_ENABLED
|
||||
"gl4es",
|
||||
#endif
|
||||
#if XASH_REF_GLES3COMPAT_ENABLED
|
||||
"gles3compat",
|
||||
#endif
|
||||
#if XASH_REF_SOFT_ENABLED
|
||||
"soft",
|
||||
#endif
|
||||
@@ -599,6 +558,9 @@ static void R_CollectRendererNames( void )
|
||||
#if XASH_REF_GL4ES_ENABLED
|
||||
"GL4ES",
|
||||
#endif
|
||||
#if XASH_REF_GLES3COMPAT_ENABLED
|
||||
"GLES3 (gl2_shim)"
|
||||
#endif
|
||||
#if XASH_REF_SOFT_ENABLED
|
||||
"Software",
|
||||
#endif
|
||||
@@ -622,6 +584,7 @@ qboolean R_Init( void )
|
||||
Cvar_RegisterVariable( &gl_clear );
|
||||
Cvar_RegisterVariable( &r_showtree );
|
||||
Cvar_RegisterVariable( &r_refdll );
|
||||
Cvar_RegisterVariable( &r_refdll_loaded );
|
||||
|
||||
// cvars that are expected to exist
|
||||
Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
|
||||
|
||||
@@ -52,7 +52,6 @@ extern convar_t gl_clear;
|
||||
|
||||
qboolean R_Init( void );
|
||||
void R_Shutdown( void );
|
||||
void R_UpdateRefState( void );
|
||||
|
||||
extern triangleapi_t gTriApi;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
s_dsp.c - digital signal processing algorithms for audio FX
|
||||
Copyright (C) 2009 Uncle Mike
|
||||
Copyright (C) 2016-2024 Alibek Omarov
|
||||
|
||||
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
|
||||
@@ -333,7 +334,7 @@ DLY_MovePointer
|
||||
Checks overflow and moves pointer
|
||||
============
|
||||
*/
|
||||
_inline void DLY_MovePointer( dly_t *dly )
|
||||
static void DLY_MovePointer( dly_t *dly )
|
||||
{
|
||||
if( ++dly->idelayinput >= dly->cdelaysamplesmax )
|
||||
dly->idelayinput = 0;
|
||||
@@ -806,13 +807,9 @@ DSP_Process
|
||||
(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 )
|
||||
return;
|
||||
|
||||
// don't process DSP while in menu
|
||||
if( cls.key_dest == key_menu || !sampleCount )
|
||||
if( dsp_off.value || !sampleCount )
|
||||
return;
|
||||
|
||||
// preset is already installed by CheckNewDspPresets
|
||||
@@ -833,7 +830,7 @@ DSP_ClearState
|
||||
*/
|
||||
void DSP_ClearState( void )
|
||||
{
|
||||
Cvar_SetValue( "room_type", 0.0f );
|
||||
Cvar_DirectSet( &room_type, "0" );
|
||||
SX_ReloadRoomFX();
|
||||
}
|
||||
|
||||
@@ -892,15 +889,15 @@ void CheckNewDspPresets( void )
|
||||
|
||||
cur = ptable + idsp_room;
|
||||
|
||||
Cvar_SetValue( "room_lp", cur->room_lp );
|
||||
Cvar_SetValue( "room_mod", cur->room_mod );
|
||||
Cvar_SetValue( "room_size", cur->room_size );
|
||||
Cvar_SetValue( "room_refl", cur->room_refl );
|
||||
Cvar_SetValue( "room_rvblp", cur->room_rvblp );
|
||||
Cvar_SetValue( "room_delay", cur->room_delay );
|
||||
Cvar_SetValue( "room_feedback", cur->room_feedback );
|
||||
Cvar_SetValue( "room_dlylp", cur->room_dlylp );
|
||||
Cvar_SetValue( "room_left", cur->room_left );
|
||||
Cvar_DirectSetValue( &sxmod_lowpass, cur->room_lp );
|
||||
Cvar_DirectSetValue( &sxmod_mod, cur->room_mod );
|
||||
Cvar_DirectSetValue( &sxrvb_size, cur->room_size );
|
||||
Cvar_DirectSetValue( &sxrvb_feedback, cur->room_refl );
|
||||
Cvar_DirectSetValue( &sxrvb_lp, cur->room_rvblp );
|
||||
Cvar_DirectSetValue( &sxdly_delay, cur->room_delay );
|
||||
Cvar_DirectSetValue( &sxdly_feedback, cur->room_feedback );
|
||||
Cvar_DirectSetValue( &sxdly_lp, cur->room_dlylp );
|
||||
Cvar_DirectSetValue( &sxste_delay, cur->room_left );
|
||||
}
|
||||
|
||||
room_typeprev = idsp_room;
|
||||
@@ -929,7 +926,7 @@ static void SX_Profiling_f( void )
|
||||
|
||||
if( Cmd_Argc() > 1 )
|
||||
{
|
||||
Cvar_SetValue( "room_type", Q_atof( Cmd_Argv( 1 )));
|
||||
Cvar_DirectSetValue( &room_type, Q_atof( Cmd_Argv( 1 )));
|
||||
SX_ReloadRoomFX();
|
||||
CheckNewDspPresets(); // we just need idsp_room immediately, for message below
|
||||
}
|
||||
@@ -939,7 +936,7 @@ static void SX_Profiling_f( void )
|
||||
start = Sys_DoubleTime();
|
||||
for( calls = 10000; calls; calls-- )
|
||||
{
|
||||
DSP_Process( idsp_room, testbuffer, 512 );
|
||||
DSP_Process( testbuffer, 512 );
|
||||
}
|
||||
end = Sys_DoubleTime();
|
||||
|
||||
@@ -947,7 +944,7 @@ static void SX_Profiling_f( void )
|
||||
|
||||
if( Cmd_Argc() > 1 )
|
||||
{
|
||||
Cvar_SetValue( "room_type", oldroom );
|
||||
Cvar_DirectSetValue( &room_type, oldroom );
|
||||
SX_ReloadRoomFX();
|
||||
CheckNewDspPresets();
|
||||
}
|
||||
|
||||
@@ -648,20 +648,6 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
|
||||
|
||||
// Init client entity mouth movement vars
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -999,7 +999,8 @@ void MIX_PaintChannels( int endtime )
|
||||
MIX_UpsampleAllPaintbuffers( end, count );
|
||||
|
||||
// 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)
|
||||
MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() );
|
||||
|
||||
@@ -96,6 +96,7 @@ void S_StartBackgroundTrack( const char *introTrack, const char *mainTrack, int
|
||||
|
||||
// open stream
|
||||
s_bgTrack.stream = FS_OpenStream( introTrack );
|
||||
|
||||
Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current ));
|
||||
memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
|
||||
s_bgTrack.source = cls.key_dest;
|
||||
|
||||
@@ -16,204 +16,6 @@ GNU General Public License for more details.
|
||||
#include "common.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
|
||||
// Input : samplePosition - absolute position
|
||||
@@ -279,28 +81,3 @@ int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int s
|
||||
|
||||
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 <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 char *rgpszrawsentence[CVOXFILESENTENCEMAX];
|
||||
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
|
||||
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( start )
|
||||
S_SetSampleStart( ch, data, start * 0.01f * samples );
|
||||
|
||||
if( end )
|
||||
S_SetSampleEnd( ch, data, end * 0.01f * samples );
|
||||
S_TrimStartEndTimes( ch, data, start * 0.01f * samples, end * 0.01f * samples );
|
||||
}
|
||||
|
||||
void VOX_FreeWord( channel_t *ch )
|
||||
|
||||
@@ -255,8 +255,7 @@ void S_InitSounds( void );
|
||||
void SX_Init( void );
|
||||
void SX_Free( void );
|
||||
void CheckNewDspPresets( void );
|
||||
void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount );
|
||||
float DSP_GetGain( int idsp );
|
||||
void DSP_Process( portable_samplepair_t *pbfront, int sampleCount );
|
||||
void DSP_ClearState( void );
|
||||
|
||||
qboolean S_Init( void );
|
||||
@@ -305,8 +304,6 @@ int S_ZeroCrossingAfter( 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_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
|
||||
|
||||
@@ -22,8 +22,6 @@ GNU General Public License for more details.
|
||||
|
||||
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_rotate, "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" );
|
||||
static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
||||
@@ -36,19 +34,6 @@ CVAR_DEFINE( window_ypos, "_window_ypos", "-1", FCVAR_RENDERINFO, "window positi
|
||||
|
||||
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
|
||||
@@ -224,8 +209,6 @@ void VID_Init( void )
|
||||
Cvar_RegisterVariable( &vid_scale );
|
||||
Cvar_RegisterVariable( &vid_fullscreen );
|
||||
Cvar_RegisterVariable( &vid_maximized );
|
||||
Cvar_RegisterVariable( &vid_brightness );
|
||||
Cvar_RegisterVariable( &vid_gamma );
|
||||
Cvar_RegisterVariable( &window_xpos );
|
||||
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
|
||||
Cmd_AddRestrictedCommand( "vid_setmode", VID_Mode_f, "display video mode" );
|
||||
|
||||
V_Init(); // init gamma
|
||||
R_Init(); // init renderer
|
||||
}
|
||||
|
||||
@@ -46,6 +46,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_CheckChanges( void );
|
||||
const char *VID_GetModeString( int vid_mode );
|
||||
void VID_StartupGamma( void );
|
||||
|
||||
#endif // VID_COMMON
|
||||
|
||||
@@ -17,7 +17,6 @@ GNU General Public License for more details.
|
||||
#define VOX_H
|
||||
|
||||
#define CVOXWORDMAX 64
|
||||
#define CVOXFILESENTENCEMAX 4096
|
||||
|
||||
#define SENTENCE_INDEX -99999 // unique sentence index
|
||||
|
||||
|
||||
@@ -302,8 +302,12 @@ typedef struct host_parm_s
|
||||
int argc;
|
||||
char **argv;
|
||||
|
||||
// ==== shared through RefAPI's ref_host_t
|
||||
double realtime; // host.curtime
|
||||
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
|
||||
|
||||
uint framecount; // global framecount
|
||||
@@ -344,8 +348,6 @@ typedef struct host_parm_s
|
||||
poolhandle_t imagepool; // imagelib mempool
|
||||
poolhandle_t soundpool; // soundlib mempool
|
||||
|
||||
uint features; // custom features that enables by mod-maker request
|
||||
|
||||
// for IN_MouseMove() easy access
|
||||
int window_center_x;
|
||||
int window_center_y;
|
||||
@@ -381,6 +383,7 @@ typedef void (*xcommand_t)( void );
|
||||
qboolean FS_LoadProgs( void );
|
||||
void FS_Init( void );
|
||||
void FS_Shutdown( void );
|
||||
void *FS_GetNativeObject( const char *obj );
|
||||
|
||||
//
|
||||
// cmd.c
|
||||
@@ -421,8 +424,8 @@ void Cmd_Escape( char *newCommand, const char *oldCommand, int len );
|
||||
// zone.c
|
||||
//
|
||||
void Memory_Init( void );
|
||||
void *_Mem_Realloc( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline );
|
||||
void *_Mem_Alloc( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline );
|
||||
void *_Mem_Realloc( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 3 );
|
||||
void *_Mem_Alloc( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 2 );
|
||||
poolhandle_t _Mem_AllocPool( const char *name, const char *filename, int fileline );
|
||||
void _Mem_FreePool( poolhandle_t *poolptr, const char *filename, int fileline );
|
||||
void _Mem_EmptyPool( poolhandle_t poolptr, const char *filename, int fileline );
|
||||
@@ -551,7 +554,7 @@ qboolean Host_IsLocalGame( void );
|
||||
qboolean Host_IsLocalClient( void );
|
||||
void Host_ShutdownServer( void );
|
||||
void Host_Error( const char *error, ... ) _format( 1 );
|
||||
void Host_PrintEngineFeatures( void );
|
||||
void Host_ValidateEngineFeatures( uint32_t features );
|
||||
void Host_Frame( float time );
|
||||
void Host_InitDecals( void );
|
||||
void Host_Credits( void );
|
||||
@@ -747,8 +750,6 @@ void SV_ShutdownGame( void );
|
||||
void SV_ExecLoadLevel( void );
|
||||
void SV_ExecLoadGame( void );
|
||||
void SV_ExecChangeLevel( void );
|
||||
qboolean SV_InitGameProgs( void );
|
||||
void SV_FreeGameProgs( void );
|
||||
void CL_WriteMessageHistory( void );
|
||||
void CL_SendCmd( void );
|
||||
void CL_Disconnect( void );
|
||||
@@ -794,7 +795,7 @@ void VID_Init( void );
|
||||
void UI_SetActiveMenu( qboolean fActive );
|
||||
void UI_ShowConnectionWarning( void );
|
||||
void Cmd_Null_f( void );
|
||||
void Rcon_Print( const char *pMsg );
|
||||
void Rcon_Print( host_redirect_t *rd, const char *pMsg );
|
||||
qboolean COM_ParseVector( char **pfile, float *v, size_t size );
|
||||
void COM_NormalizeAngles( vec3_t angles );
|
||||
int COM_FileSize( const char *filename );
|
||||
@@ -811,8 +812,13 @@ void S_StopBackgroundTrack( void );
|
||||
void S_StopAllSounds( qboolean ambient );
|
||||
|
||||
// gamma routines
|
||||
void BuildGammaTable( float gamma, float brightness );
|
||||
byte LightToTexGamma( byte b );
|
||||
byte TextureToGamma( byte );
|
||||
uint LightToTexGammaEx( uint );
|
||||
uint ScreenGammaTable( uint );
|
||||
uint LinearGammaTable( uint );
|
||||
void V_Init( void );
|
||||
void V_CheckGamma( void );
|
||||
|
||||
//
|
||||
// identification.c
|
||||
|
||||
@@ -1423,15 +1423,11 @@ save serverinfo variables into server.cfg (using for dedicated server too)
|
||||
*/
|
||||
void GAME_EXPORT Host_WriteServerConfig( const char *name )
|
||||
{
|
||||
qboolean already_loaded;
|
||||
file_t *f;
|
||||
string newconfigfile;
|
||||
|
||||
Q_snprintf( newconfigfile, MAX_STRING, "%s.new", name );
|
||||
|
||||
// TODO: remove this mechanism, make it safer for now
|
||||
already_loaded = SV_InitGameProgs(); // collect user variables
|
||||
|
||||
// FIXME: move this out until menu parser is done
|
||||
CSCR_LoadDefaultCVars( "settings.scr" );
|
||||
|
||||
@@ -1448,10 +1444,6 @@ void GAME_EXPORT Host_WriteServerConfig( const char *name )
|
||||
Host_FinalizeConfig( f, name );
|
||||
}
|
||||
else Con_DPrintf( S_ERROR "Couldn't write %s.\n", name );
|
||||
|
||||
// don't unload library that wasn't loaded by us
|
||||
if( !already_loaded )
|
||||
SV_FreeGameProgs(); // release progs with all variables
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -320,7 +320,9 @@ void Sys_RestoreCrashHandler( void )
|
||||
|
||||
#elif XASH_FREEBSD || XASH_NETBSD || XASH_OPENBSD || XASH_ANDROID || XASH_LINUX
|
||||
// Posix signal handler
|
||||
#ifndef XASH_OPENBSD
|
||||
#include <ucontext.h>
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <sys/mman.h>
|
||||
#include "library.h"
|
||||
@@ -488,7 +490,7 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
||||
#ifdef XASH_SDL
|
||||
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||
#endif
|
||||
MSGBOX( message );
|
||||
Platform_MessageBox( "Xash Error", message, false );
|
||||
|
||||
// log saved, now we can try to save configs and close log correctly, it may crash
|
||||
if( host.type == HOST_NORMAL )
|
||||
|
||||
@@ -563,6 +563,27 @@ void Cvar_RegisterVariable( convar_t *var )
|
||||
#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
|
||||
@@ -632,22 +653,9 @@ static convar_t *Cvar_Set2( const char *var_name, const char *value )
|
||||
force = true;
|
||||
|
||||
if( !force )
|
||||
{
|
||||
if( FBitSet( var->flags, FCVAR_READ_ONLY ))
|
||||
{
|
||||
Con_Printf( "%s is read-only.\n", var->name );
|
||||
{
|
||||
if( !Cvar_CanSet( 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 );
|
||||
@@ -694,21 +702,8 @@ void Cvar_DirectSet( convar_t *var, const char *value )
|
||||
return; // how this possible?
|
||||
}
|
||||
|
||||
if( FBitSet( var->flags, FCVAR_READ_ONLY ))
|
||||
{
|
||||
Con_Printf( "%s is read-only.\n", var->name );
|
||||
if( !Cvar_CanSet( var ))
|
||||
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
|
||||
if( !value )
|
||||
@@ -741,6 +736,24 @@ void Cvar_DirectSet( convar_t *var, const char *value )
|
||||
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
|
||||
@@ -1136,8 +1149,6 @@ As Cvar_Set, but also flags it as glconfig
|
||||
*/
|
||||
void Cvar_SetGL_f( void )
|
||||
{
|
||||
convar_t *var;
|
||||
|
||||
if( Cmd_Argc() != 3 )
|
||||
{
|
||||
Con_Printf( S_USAGE "setgl <variable> <value>\n" );
|
||||
|
||||
@@ -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_FullSet( const char *var_name, const char *value, int flags );
|
||||
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_SetValue( const char *var_name, float value );
|
||||
const char *Cvar_BuildAutoDescription( const char *szName, int flags );
|
||||
|
||||
@@ -247,4 +247,14 @@ void CL_HudMessage( const char *pMessage )
|
||||
|
||||
}
|
||||
|
||||
byte TextureToGamma( byte b )
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
byte LightToTexGamma( byte b )
|
||||
{
|
||||
return b;
|
||||
}
|
||||
|
||||
#endif // XASH_DEDICATED
|
||||
|
||||
@@ -23,8 +23,17 @@ GNU General Public License for more details.
|
||||
fs_api_t g_fsapi;
|
||||
fs_globals_t *FI;
|
||||
|
||||
static pfnCreateInterface_t fs_pfnCreateInterface;
|
||||
static HINSTANCE fs_hInstance;
|
||||
|
||||
void *FS_GetNativeObject( const char *obj )
|
||||
{
|
||||
if( fs_pfnCreateInterface )
|
||||
return fs_pfnCreateInterface( obj, NULL );
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void FS_Rescan_f( void )
|
||||
{
|
||||
FS_Rescan();
|
||||
@@ -53,7 +62,7 @@ static fs_interface_t fs_memfuncs =
|
||||
_Mem_Realloc,
|
||||
_Mem_Free,
|
||||
|
||||
Platform_GetNativeObject,
|
||||
Sys_GetNativeObject,
|
||||
};
|
||||
|
||||
static void FS_UnloadProgs( void )
|
||||
@@ -98,6 +107,13 @@ qboolean FS_LoadProgs( void )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !( fs_pfnCreateInterface = (pfnCreateInterface_t)COM_GetProcAddress( fs_hInstance, "CreateInterface" )))
|
||||
{
|
||||
FS_UnloadProgs();
|
||||
Host_Error( "FS_LoadProgs: can't find CreateInterface entry point in %s\n", name );
|
||||
return false;
|
||||
}
|
||||
|
||||
Con_DPrintf( "FS_LoadProgs: filesystem_stdio successfully loaded\n" );
|
||||
|
||||
return true;
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
@@ -33,6 +33,7 @@ GNU General Public License for more details.
|
||||
#include "common.h"
|
||||
#include "base_cmd.h"
|
||||
#include "client.h"
|
||||
#include "server.h"
|
||||
#include "netchan.h"
|
||||
#include "protocol.h"
|
||||
#include "mod_local.h"
|
||||
@@ -51,7 +52,7 @@ struct tests_stats_s tests_stats;
|
||||
#endif
|
||||
|
||||
CVAR_DEFINE( host_developer, "developer", "0", FCVAR_FILTERABLE, "engine is in development-mode" );
|
||||
CVAR_DEFINE_AUTO( sys_timescale, "1.0", FCVAR_CHEAT|FCVAR_FILTERABLE, "scale frame time" );
|
||||
CVAR_DEFINE_AUTO( sys_timescale, "1.0", FCVAR_FILTERABLE, "scale frame time" );
|
||||
CVAR_DEFINE_AUTO( sys_ticrate, "100", 0, "framerate in dedicated mode" );
|
||||
|
||||
static CVAR_DEFINE_AUTO( host_serverstate, "0", FCVAR_READ_ONLY, "displays current server state" );
|
||||
@@ -61,6 +62,7 @@ CVAR_DEFINE_AUTO( host_limitlocal, "0", 0, "apply cl_cmdrate and rate to loopbac
|
||||
CVAR_DEFINE( host_maxfps, "fps_max", "72", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "host fps upper limit" );
|
||||
static CVAR_DEFINE_AUTO( host_framerate, "0", FCVAR_FILTERABLE, "locks frame timing to this value in seconds" );
|
||||
static CVAR_DEFINE( host_sleeptime, "sleeptime", "1", FCVAR_ARCHIVE|FCVAR_FILTERABLE, "milliseconds to sleep for each frame. higher values reduce fps accuracy" );
|
||||
static CVAR_DEFINE_AUTO( host_sleeptime_debug, "0", 0, "print sleeps between frames" );
|
||||
CVAR_DEFINE( con_gamemaps, "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" );
|
||||
|
||||
void Sys_PrintUsage( void )
|
||||
@@ -127,6 +129,7 @@ void Sys_PrintUsage( void )
|
||||
O("-noenginejoy ", "disable engine builtin joystick support")
|
||||
O("-noenginemouse ", "disable engine builtin mouse support")
|
||||
O("-nosound ", "disable sound output")
|
||||
O("-timedemo ", "run timedemo and exit")
|
||||
#endif
|
||||
|
||||
"\nPlatform-specific options:\n"
|
||||
@@ -137,7 +140,7 @@ void Sys_PrintUsage( void )
|
||||
O("-sdl_joy_old_api ","use SDL legacy joystick API")
|
||||
O("-sdl_renderer <n>","use alternative SDL_Renderer for software")
|
||||
#endif // XASH_SDL
|
||||
#if XASH_ANDROID
|
||||
#if XASH_ANDROID && !XASH_SDL
|
||||
O("-nativeegl ","use native egl implementation. Use if screen does not update or black")
|
||||
#endif // XASH_ANDROID
|
||||
#if XASH_DOS
|
||||
@@ -187,22 +190,66 @@ void Host_ShutdownServer( void )
|
||||
Host_PrintEngineFeatures
|
||||
================
|
||||
*/
|
||||
void Host_PrintEngineFeatures( void )
|
||||
static void Host_PrintEngineFeatures( int features )
|
||||
{
|
||||
if( FBitSet( host.features, ENGINE_WRITE_LARGE_COORD ))
|
||||
Con_Reportf( "^3EXT:^7 big world support enabled\n" );
|
||||
struct
|
||||
{
|
||||
uint32_t mask;
|
||||
const char *msg;
|
||||
} features_str[] =
|
||||
{
|
||||
{ ENGINE_WRITE_LARGE_COORD, "Big World Support" },
|
||||
{ ENGINE_QUAKE_COMPATIBLE, "Quake Compatibility" },
|
||||
{ ENGINE_LOAD_DELUXEDATA, "Deluxemap Support" },
|
||||
{ ENGINE_PHYSICS_PUSHER_EXT, "Improved MOVETYPE_PUSH" },
|
||||
{ ENGINE_LARGE_LIGHTMAPS, "Large Lightmaps" },
|
||||
{ ENGINE_COMPENSATE_QUAKE_BUG, "Stupid Quake Bug Compensation" },
|
||||
{ ENGINE_IMPROVED_LINETRACE, "Improved Trace Line" },
|
||||
{ ENGINE_COMPUTE_STUDIO_LERP, "Studio MOVETYPE_STEP Lerping" },
|
||||
{ ENGINE_LINEAR_GAMMA_SPACE, "Linear Gamma Space" },
|
||||
{ ENGINE_STEP_POSHISTORY_LERP, "MOVETYPE_STEP Position History Based Lerping" },
|
||||
};
|
||||
int i;
|
||||
|
||||
if( FBitSet( host.features, ENGINE_LOAD_DELUXEDATA ))
|
||||
Con_Reportf( "^3EXT:^7 deluxemap support enabled\n" );
|
||||
for( i = 0; i < ARRAYSIZE( features_str ); i++ )
|
||||
{
|
||||
if( FBitSet( features, features_str[i].mask ))
|
||||
Con_Reportf( "^3EXT:^7 %s is enabled\n", features_str[i].msg );
|
||||
}
|
||||
}
|
||||
|
||||
if( FBitSet( host.features, ENGINE_PHYSICS_PUSHER_EXT ))
|
||||
Con_Reportf( "^3EXT:^7 Improved MOVETYPE_PUSH is used\n" );
|
||||
/*
|
||||
==============
|
||||
Host_ValidateEngineFeatures
|
||||
|
||||
if( FBitSet( host.features, ENGINE_LARGE_LIGHTMAPS ))
|
||||
Con_Reportf( "^3EXT:^7 Large lightmaps enabled\n" );
|
||||
validate features bits and set host.features
|
||||
==============
|
||||
*/
|
||||
void Host_ValidateEngineFeatures( uint32_t features )
|
||||
{
|
||||
uint32_t mask = ENGINE_FEATURES_MASK;
|
||||
|
||||
if( FBitSet( host.features, ENGINE_COMPENSATE_QUAKE_BUG ))
|
||||
Con_Reportf( "^3EXT:^7 Compensate quake bug enabled\n" );
|
||||
#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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -616,6 +663,84 @@ double Host_CalcFPS( void )
|
||||
return fps;
|
||||
}
|
||||
|
||||
static qboolean Host_Autosleep( double dt, double scale )
|
||||
{
|
||||
double targetframetime, fps;
|
||||
int sleep;
|
||||
|
||||
fps = Host_CalcFPS();
|
||||
|
||||
if( fps <= 0 )
|
||||
return true;
|
||||
|
||||
// limit fps to withing tolerable range
|
||||
fps = bound( MIN_FPS, fps, MAX_FPS );
|
||||
|
||||
if( Host_IsDedicated( ))
|
||||
targetframetime = ( 1.0 / ( fps + 1.0 ));
|
||||
else targetframetime = ( 1.0 / fps );
|
||||
|
||||
sleep = Host_CalcSleep();
|
||||
if( sleep == 0 ) // no sleeps between frames, much simpler code
|
||||
{
|
||||
if( dt < targetframetime * scale )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
static double timewindow; // allocate a time window for sleeps
|
||||
static int counter; // for debug
|
||||
static double realsleeptime;
|
||||
const double sleeptime = sleep * 0.001;
|
||||
|
||||
if( dt < targetframetime * scale )
|
||||
{
|
||||
// if we have allocated time window, try to sleep
|
||||
if( timewindow > realsleeptime )
|
||||
{
|
||||
// Sys_Sleep isn't guaranteed to sleep an exact amount of milliseconds
|
||||
// so we measure the real sleep time and use it to decrease the window
|
||||
double t1 = Sys_DoubleTime(), t2;
|
||||
Sys_Sleep( sleep ); // in msec!
|
||||
t2 = Sys_DoubleTime();
|
||||
realsleeptime = t2 - t1;
|
||||
|
||||
timewindow -= realsleeptime;
|
||||
|
||||
if( host_sleeptime_debug.value )
|
||||
{
|
||||
counter++;
|
||||
|
||||
Con_NPrintf( counter, "%d: %.4f %.4f", counter, timewindow, realsleeptime );
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// if we exhausted this time window, allocate a new one after new frame
|
||||
if( timewindow <= realsleeptime )
|
||||
{
|
||||
double targetsleeptime = targetframetime - host.pureframetime * 2;
|
||||
|
||||
if( targetsleeptime > 0 )
|
||||
timewindow = targetsleeptime;
|
||||
else timewindow = 0;
|
||||
|
||||
realsleeptime = sleeptime; // reset in case CPU was too busy
|
||||
|
||||
if( host_sleeptime_debug.value )
|
||||
{
|
||||
counter = 0;
|
||||
|
||||
Con_NPrintf( 0, "tgt = %.4f, pft = %.4f, wnd = %.4f", targetframetime, host.pureframetime, timewindow );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
Host_FilterTime
|
||||
@@ -626,55 +751,15 @@ Returns false if the time is too short to run a frame
|
||||
qboolean Host_FilterTime( float time )
|
||||
{
|
||||
static double oldtime;
|
||||
double fps, scale = sys_timescale.value;
|
||||
double dt;
|
||||
double scale = sys_timescale.value;
|
||||
|
||||
host.realtime += time * scale;
|
||||
fps = Host_CalcFPS();
|
||||
dt = host.realtime - oldtime;
|
||||
|
||||
// clamp the fps in multiplayer games
|
||||
if( fps != 0.0 )
|
||||
{
|
||||
static int sleeps;
|
||||
double targetframetime;
|
||||
int sleeptime = Host_CalcSleep();
|
||||
|
||||
// limit fps to withing tolerable range
|
||||
fps = bound( MIN_FPS, fps, MAX_FPS );
|
||||
|
||||
if( Host_IsDedicated( ))
|
||||
targetframetime = ( 1.0 / ( fps + 1.0 ));
|
||||
else targetframetime = ( 1.0 / fps );
|
||||
|
||||
if(( host.realtime - oldtime ) < targetframetime * scale )
|
||||
{
|
||||
if( sleeptime > 0 && sleeps > 0 )
|
||||
{
|
||||
Sys_Sleep( sleeptime );
|
||||
sleeps--;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if( sleeptime > 0 && sleeps <= 0 )
|
||||
{
|
||||
if( host.status == HOST_FRAME )
|
||||
{
|
||||
// give few sleeps this frame with small margin
|
||||
double targetsleeptime = targetframetime - host.pureframetime * 2;
|
||||
|
||||
// don't sleep if we can't keep up with the framerate
|
||||
if( targetsleeptime > 0 )
|
||||
sleeps = targetsleeptime / ( sleeptime * 0.001 );
|
||||
else sleeps = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// always sleep at least once in minimized/nofocus state
|
||||
sleeps = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( !Host_Autosleep( dt, scale ))
|
||||
return false;
|
||||
|
||||
host.frametime = host.realtime - oldtime;
|
||||
host.realframetime = bound( MIN_FRAMETIME, host.frametime, MAX_FRAMETIME );
|
||||
@@ -754,7 +839,7 @@ void GAME_EXPORT Host_Error( const char *error, ... )
|
||||
Key_SetKeyDest( key_console );
|
||||
Con_Printf( "Host_Error: %s", hosterror1 );
|
||||
}
|
||||
else MSGBOX2( hosterror1 );
|
||||
else Platform_MessageBox( "Host Error", hosterror1, true );
|
||||
}
|
||||
|
||||
// host is shutting down. don't invoke infinite loop
|
||||
@@ -869,7 +954,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
int developer = DEFAULT_DEV;
|
||||
const char *baseDir;
|
||||
char ticrate[16];
|
||||
int len;
|
||||
int len, i;
|
||||
|
||||
// some commands may turn engine into infinite loop,
|
||||
// e.g. xash.exe +game xash -game xash
|
||||
@@ -944,7 +1029,7 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
progname++;
|
||||
|
||||
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() )
|
||||
{
|
||||
@@ -1016,21 +1101,31 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
else
|
||||
{
|
||||
#if TARGET_OS_IOS
|
||||
const char *IOS_GetDocsDir();
|
||||
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof(host.rootdir) );
|
||||
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof( host.rootdir ));
|
||||
#elif XASH_ANDROID && XASH_SDL
|
||||
Q_strncpy( host.rootdir, SDL_AndroidGetExternalStoragePath(), sizeof( host.rootdir ));
|
||||
#elif XASH_PSVITA
|
||||
if ( !PSVita_GetBasePath( host.rootdir, sizeof( host.rootdir ) ) )
|
||||
if ( !PSVita_GetBasePath( host.rootdir, sizeof( host.rootdir )))
|
||||
{
|
||||
Sys_Error( "couldn't find xash3d data directory" );
|
||||
host.rootdir[0] = 0;
|
||||
}
|
||||
#elif (XASH_SDL == 2) && !XASH_NSWITCH // GetBasePath not impl'd in switch-sdl2
|
||||
char *szBasePath;
|
||||
|
||||
if( !( szBasePath = SDL_GetBasePath() ) )
|
||||
char *szBasePath = SDL_GetBasePath();
|
||||
if( szBasePath )
|
||||
{
|
||||
Q_strncpy( host.rootdir, szBasePath, sizeof( host.rootdir ));
|
||||
SDL_free( szBasePath );
|
||||
}
|
||||
else
|
||||
{
|
||||
#if XASH_POSIX || XASH_WIN32
|
||||
if( !getcwd( host.rootdir, sizeof( host.rootdir )))
|
||||
Sys_Error( "couldn't determine current directory: %s, getcwd: %s", SDL_GetError(), strerror( errno ));
|
||||
#else
|
||||
Sys_Error( "couldn't determine current directory: %s", SDL_GetError() );
|
||||
Q_strncpy( host.rootdir, szBasePath, sizeof( host.rootdir ));
|
||||
SDL_free( szBasePath );
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
if( !getcwd( host.rootdir, sizeof( host.rootdir )))
|
||||
{
|
||||
@@ -1106,12 +1201,25 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
FS_LoadGameInfo( NULL );
|
||||
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 ));
|
||||
|
||||
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 ();
|
||||
Host_InitDecals (); // reload decals
|
||||
|
||||
@@ -1149,6 +1257,7 @@ Host_Main
|
||||
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func )
|
||||
{
|
||||
static double oldtime, newtime;
|
||||
string demoname;
|
||||
|
||||
host.starttime = Sys_DoubleTime();
|
||||
|
||||
@@ -1168,6 +1277,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
||||
Cvar_RegisterVariable( &host_maxfps );
|
||||
Cvar_RegisterVariable( &host_framerate );
|
||||
Cvar_RegisterVariable( &host_sleeptime );
|
||||
Cvar_RegisterVariable( &host_sleeptime_debug );
|
||||
Cvar_RegisterVariable( &host_gameloaded );
|
||||
Cvar_RegisterVariable( &host_clientloaded );
|
||||
Cvar_RegisterVariable( &host_limitlocal );
|
||||
@@ -1245,6 +1355,9 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
||||
Cbuf_ExecStuffCmds(); // execute stuffcmds (commandline)
|
||||
SCR_CheckStartupVids(); // must be last
|
||||
|
||||
if( Sys_GetParmFromCmdLine( "-timedemo", demoname ))
|
||||
Cbuf_AddTextf( "timedemo %s\n", demoname );
|
||||
|
||||
oldtime = Sys_DoubleTime() - 0.1;
|
||||
|
||||
if( Host_IsDedicated( ))
|
||||
@@ -1281,6 +1394,8 @@ Host_Shutdown
|
||||
*/
|
||||
void EXPORT Host_Shutdown( void )
|
||||
{
|
||||
qboolean error = host.status == HOST_ERR_FATAL;
|
||||
|
||||
if( host.shutdown_issued ) return;
|
||||
host.shutdown_issued = true;
|
||||
|
||||
@@ -1288,11 +1403,12 @@ void EXPORT Host_Shutdown( void )
|
||||
if( !host.change_game ) Q_strncpy( host.finalmsg, "Server shutdown", sizeof( host.finalmsg ));
|
||||
|
||||
#if !XASH_DEDICATED
|
||||
if( host.type == HOST_NORMAL )
|
||||
if( host.type == HOST_NORMAL && !error )
|
||||
Host_WriteConfig();
|
||||
#endif
|
||||
|
||||
SV_Shutdown( "Server shutdown\n" );
|
||||
SV_UnloadProgs();
|
||||
SV_ShutdownFilter();
|
||||
CL_Shutdown();
|
||||
|
||||
|
||||
@@ -57,6 +57,8 @@ void COM_NewGame( char const *pMapName )
|
||||
GameState->landmarkName[0] = 0;
|
||||
GameState->loadGame = false;
|
||||
GameState->newGame = true;
|
||||
|
||||
SV_ShutdownGame(); // exit from current game
|
||||
}
|
||||
|
||||
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->loadGame = false;
|
||||
GameState->newGame = false;
|
||||
|
||||
SV_ShutdownGame(); // exit from current game
|
||||
}
|
||||
|
||||
void COM_LoadGame( char const *pMapName )
|
||||
|
||||
@@ -142,6 +142,7 @@ void Image_CopyPalette32bit( void );
|
||||
void Image_SetPixelFormat( void );
|
||||
void Image_GetPaletteQ1( void );
|
||||
void Image_GetPaletteHL( void );
|
||||
size_t Image_ComputeSize( int type, int width, int height, int depth );
|
||||
|
||||
//
|
||||
// formats load
|
||||
@@ -156,6 +157,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
qboolean Image_LoadFNT( const char *name, const byte *buffer, fs_offset_t filesize );
|
||||
qboolean Image_LoadLMP( const char *name, const byte *buffer, fs_offset_t filesize );
|
||||
qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesize );
|
||||
qboolean Image_LoadKTX2( const char *name, const byte *buffer, fs_offset_t filesize );
|
||||
|
||||
//
|
||||
// formats save
|
||||
|
||||
@@ -104,6 +104,13 @@ void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
||||
{
|
||||
switch( headerExt->dxgiFormat )
|
||||
{
|
||||
case DXGI_FORMAT_BC4_TYPELESS:
|
||||
case DXGI_FORMAT_BC4_UNORM:
|
||||
image.type = PF_BC4_UNSIGNED;
|
||||
break;
|
||||
case DXGI_FORMAT_BC4_SNORM:
|
||||
image.type = PF_BC4_SIGNED;
|
||||
break;
|
||||
case DXGI_FORMAT_BC6H_SF16:
|
||||
image.type = PF_BC6H_SIGNED;
|
||||
break;
|
||||
@@ -112,9 +119,20 @@ void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
||||
image.type = PF_BC6H_UNSIGNED;
|
||||
break;
|
||||
case DXGI_FORMAT_BC7_UNORM:
|
||||
case DXGI_FORMAT_BC7_UNORM_SRGB:
|
||||
case DXGI_FORMAT_BC7_TYPELESS:
|
||||
image.type = PF_BC7;
|
||||
image.type = PF_BC7_UNORM;
|
||||
break;
|
||||
case DXGI_FORMAT_BC7_UNORM_SRGB:
|
||||
image.type = PF_BC7_SRGB;
|
||||
break;
|
||||
case DXGI_FORMAT_BC5_TYPELESS:
|
||||
image.type = PF_ATI2;
|
||||
break;
|
||||
case DXGI_FORMAT_BC5_UNORM:
|
||||
image.type = PF_BC5_UNSIGNED;
|
||||
break;
|
||||
case DXGI_FORMAT_BC5_SNORM:
|
||||
image.type = PF_BC5_SIGNED;
|
||||
break;
|
||||
default:
|
||||
image.type = PF_UNKNOWN;
|
||||
@@ -122,7 +140,7 @@ void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
switch( hdr->dsPixelFormat.dwFourCC )
|
||||
{
|
||||
case TYPE_DXT1:
|
||||
@@ -143,6 +161,15 @@ void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
||||
case TYPE_ATI2:
|
||||
image.type = PF_ATI2;
|
||||
break;
|
||||
case TYPE_BC5S:
|
||||
image.type = PF_BC5_SIGNED;
|
||||
break;
|
||||
case TYPE_BC4S:
|
||||
image.type = PF_BC4_SIGNED;
|
||||
break;
|
||||
case TYPE_BC4U:
|
||||
image.type = PF_BC4_UNSIGNED;
|
||||
break;
|
||||
default:
|
||||
image.type = PF_UNKNOWN; // assume error
|
||||
break;
|
||||
@@ -188,27 +215,6 @@ void Image_DXTGetPixelFormat( dds_t *hdr, dds_header_dxt10_t *headerExt )
|
||||
image.num_mips = hdr->dwMipMapCount; // get actual mip count
|
||||
}
|
||||
|
||||
size_t Image_DXTGetLinearSize( int type, int width, int height, int depth )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case PF_DXT1: return ((( width + 3 ) / 4 ) * (( height + 3 ) / 4 ) * depth * 8 );
|
||||
case PF_DXT3:
|
||||
case PF_DXT5:
|
||||
case PF_BC6H_SIGNED:
|
||||
case PF_BC6H_UNSIGNED:
|
||||
case PF_BC7:
|
||||
case PF_ATI2: return ((( width + 3 ) / 4 ) * (( height + 3 ) / 4 ) * depth * 16 );
|
||||
case PF_LUMINANCE: return (width * height * depth);
|
||||
case PF_BGR_24:
|
||||
case PF_RGB_24: return (width * height * depth * 3);
|
||||
case PF_BGRA_32:
|
||||
case PF_RGBA_32: return (width * height * depth * 4);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t Image_DXTCalcMipmapSize( dds_t *hdr )
|
||||
{
|
||||
size_t buffsize = 0;
|
||||
@@ -219,7 +225,7 @@ size_t Image_DXTCalcMipmapSize( dds_t *hdr )
|
||||
{
|
||||
width = Q_max( 1, ( hdr->dwWidth >> i ));
|
||||
height = Q_max( 1, ( hdr->dwHeight >> i ));
|
||||
buffsize += Image_DXTGetLinearSize( image.type, width, height, image.depth );
|
||||
buffsize += Image_ComputeSize( image.type, width, height, image.depth );
|
||||
}
|
||||
|
||||
return buffsize;
|
||||
@@ -255,7 +261,7 @@ uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
|
||||
|
||||
if( filesize != buffsize ) // main check
|
||||
{
|
||||
Con_DPrintf( S_WARN "Image_LoadDDS: (%s) probably corrupted (%i should be %lu)\n", name, buffsize, filesize );
|
||||
Con_DPrintf( S_WARN "Image_LoadDDS: (%s) probably corrupted (%zu should be %lu)\n", name, buffsize, filesize );
|
||||
if( buffsize > filesize )
|
||||
return false;
|
||||
}
|
||||
@@ -268,7 +274,7 @@ void Image_DXTAdjustVolume( dds_t *hdr )
|
||||
if( hdr->dwDepth <= 1 )
|
||||
return;
|
||||
|
||||
hdr->dwLinearSize = Image_DXTGetLinearSize( image.type, hdr->dwWidth, hdr->dwHeight, hdr->dwDepth );
|
||||
hdr->dwLinearSize = Image_ComputeSize( image.type, hdr->dwWidth, hdr->dwHeight, hdr->dwDepth );
|
||||
hdr->dwFlags |= DDS_LINEARSIZE;
|
||||
}
|
||||
|
||||
@@ -323,7 +329,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
Image_DXTGetPixelFormat( &header, &header2 ); // and image type too :)
|
||||
Image_DXTAdjustVolume( &header );
|
||||
|
||||
if( !Image_CheckFlag( IL_DDS_HARDWARE ) && ImageDXT( image.type ))
|
||||
if( !Image_CheckFlag( IL_DDS_HARDWARE ) && ImageCompressed( image.type ))
|
||||
return false; // silently rejected
|
||||
|
||||
if( image.type == PF_UNKNOWN )
|
||||
@@ -356,8 +362,10 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesi
|
||||
SetBits( image.flags, IMAGE_HAS_ALPHA );
|
||||
else if( image.type == PF_DXT5 && Image_CheckDXT5Alpha( &header, fin ))
|
||||
SetBits( image.flags, IMAGE_HAS_ALPHA );
|
||||
else if ( image.type == PF_BC7 )
|
||||
SetBits(image.flags, IMAGE_HAS_ALPHA);
|
||||
else if( image.type == PF_BC5_SIGNED || image.type == PF_BC5_UNSIGNED )
|
||||
SetBits( image.flags, IMAGE_HAS_ALPHA );
|
||||
else if( image.type == PF_BC7_UNORM || image.type == PF_BC7_SRGB )
|
||||
SetBits( image.flags, IMAGE_HAS_ALPHA );
|
||||
if( !FBitSet( header.dsPixelFormat.dwFlags, DDS_LUMINANCE ))
|
||||
SetBits( image.flags, IMAGE_HAS_COLOR );
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,9 @@ GNU General Public License for more details.
|
||||
#define TYPE_DX10 (('0'<<24)+('1'<<16)+('X'<<8)+'D') // little-endian "DX10"
|
||||
#define TYPE_ATI1 (('1'<<24)+('I'<<16)+('T'<<8)+'A') // little-endian "ATI1"
|
||||
#define TYPE_ATI2 (('2'<<24)+('I'<<16)+('T'<<8)+'A') // little-endian "ATI2"
|
||||
#define TYPE_BC5S (('S'<<24)+('5'<<16)+('C'<<8)+'B') // little-endian "BC5S"
|
||||
#define TYPE_BC4S (('S'<<24)+('4'<<16)+('C'<<8)+'B') // little-endian "BC4S"
|
||||
#define TYPE_BC4U (('U'<<24)+('4'<<16)+('C'<<8)+'B') // little-endian "BC4U"
|
||||
#define TYPE_RXGB (('B'<<24)+('G'<<16)+('X'<<8)+'R') // little-endian "RXGB" doom3 normalmaps
|
||||
#define TYPE_$ (('\0'<<24)+('\0'<<16)+('\0'<<8)+'$') // little-endian "$"
|
||||
#define TYPE_o (('\0'<<24)+('\0'<<16)+('\0'<<8)+'o') // little-endian "o"
|
||||
@@ -202,7 +205,7 @@ typedef enum
|
||||
DXGI_FORMAT_FORCE_UINT = 0xffffffff
|
||||
} dxgi_format_t;
|
||||
|
||||
typedef enum
|
||||
typedef enum
|
||||
{
|
||||
D3D10_RESOURCE_DIMENSION_UNKNOWN = 0,
|
||||
D3D10_RESOURCE_DIMENSION_BUFFER = 1,
|
||||
|
||||
210
engine/common/imagelib/img_ktx2.c
Normal file
210
engine/common/imagelib/img_ktx2.c
Normal file
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
img_ktx2.c - ktx2 format load
|
||||
Copyright (C) 2023 Provod
|
||||
|
||||
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 "imagelib.h"
|
||||
#include "xash3d_mathlib.h"
|
||||
#include "img_ktx2.h"
|
||||
|
||||
static void Image_KTX2Format( uint32_t ktx2_format )
|
||||
{
|
||||
switch( ktx2_format )
|
||||
{
|
||||
case KTX2_FORMAT_BC4_UNORM_BLOCK:
|
||||
image.type = PF_BC4_UNSIGNED;
|
||||
// 1 component for ref_gl
|
||||
break;
|
||||
case KTX2_FORMAT_BC4_SNORM_BLOCK:
|
||||
image.type = PF_BC4_SIGNED;
|
||||
// 1 component for ref_gl
|
||||
break;
|
||||
case KTX2_FORMAT_BC5_UNORM_BLOCK:
|
||||
image.type = PF_BC5_UNSIGNED;
|
||||
// 2 components for ref_gl
|
||||
SetBits( image.flags, IMAGE_HAS_ALPHA );
|
||||
break;
|
||||
case KTX2_FORMAT_BC5_SNORM_BLOCK:
|
||||
image.type = PF_BC5_SIGNED;
|
||||
// 2 components for ref_gl
|
||||
SetBits( image.flags, IMAGE_HAS_ALPHA );
|
||||
break;
|
||||
case KTX2_FORMAT_BC6H_UFLOAT_BLOCK:
|
||||
image.type = PF_BC6H_UNSIGNED;
|
||||
// 3 components for ref_gl
|
||||
SetBits( image.flags, IMAGE_HAS_COLOR );
|
||||
break;
|
||||
case KTX2_FORMAT_BC6H_SFLOAT_BLOCK:
|
||||
image.type = PF_BC6H_SIGNED;
|
||||
// 3 components for ref_gl
|
||||
SetBits( image.flags, IMAGE_HAS_COLOR );
|
||||
break;
|
||||
case KTX2_FORMAT_BC7_UNORM_BLOCK:
|
||||
image.type = PF_BC7_UNORM;
|
||||
// 4 components for ref_gl
|
||||
SetBits( image.flags, IMAGE_HAS_COLOR | IMAGE_HAS_ALPHA );
|
||||
break;
|
||||
case KTX2_FORMAT_BC7_SRGB_BLOCK:
|
||||
image.type = PF_BC7_SRGB;
|
||||
// 4 components for ref_gl
|
||||
SetBits( image.flags, IMAGE_HAS_COLOR | IMAGE_HAS_ALPHA );
|
||||
break;
|
||||
default:
|
||||
image.type = PF_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer, fs_offset_t filesize )
|
||||
{
|
||||
ktx2_index_t index;
|
||||
size_t total_size = 0;
|
||||
size_t max_offset = 0;
|
||||
const byte *const levels_begin = buffer + KTX2_LEVELS_OFFSET;
|
||||
|
||||
// Sets image.type and image.flags
|
||||
Image_KTX2Format( header->vkFormat );
|
||||
|
||||
if( image.type == PF_UNKNOWN )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: unsupported KTX2 format %d\n", __FUNCTION__, header->vkFormat );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !Image_CheckFlag( IL_DDS_HARDWARE ) && ImageCompressed( image.type ))
|
||||
{
|
||||
Con_DPrintf( S_WARN "%s: has compressed format, but support is not advertized\n", __FUNCTION__ );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( header->levelCount == 0 )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: file has no mip levels\n", __FUNCTION__ );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( header->pixelDepth > 1 )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: unsupported KTX2 pixelDepth %d\n", __FUNCTION__, header->pixelDepth );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( header->faceCount > 1 )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: unsupported KTX2 faceCount %d\n", __FUNCTION__, header->faceCount );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( header->layerCount > 1 )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: unsupported KTX2 layerCount %d\n", __FUNCTION__, header->layerCount );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( header->supercompressionScheme != 0 )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: unsupported KTX2 supercompressionScheme %d\n", __FUNCTION__, header->supercompressionScheme );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( header->levelCount * sizeof( ktx2_level_t ) + KTX2_LEVELS_OFFSET > filesize )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: file abruptly ends\n", __FUNCTION__ );
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy( &index, buffer + KTX2_IDENTIFIER_SIZE + sizeof( ktx2_header_t ), sizeof( index ));
|
||||
|
||||
for( int mip = 0; mip < header->levelCount; ++mip )
|
||||
{
|
||||
const uint32_t width = Q_max( 1, ( header->pixelWidth >> mip ));
|
||||
const uint32_t height = Q_max( 1, ( header->pixelHeight >> mip ));
|
||||
const uint32_t mip_size = Image_ComputeSize( image.type, width, height, image.depth );
|
||||
|
||||
ktx2_level_t level;
|
||||
memcpy( &level, levels_begin + mip * sizeof( level ), sizeof( level ));
|
||||
|
||||
if( mip_size != level.byteLength )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: mip=%d size mismatch read=%d, but computed=%d\n",
|
||||
__FUNCTION__, mip, (int)level.byteLength, mip_size );
|
||||
return false;
|
||||
}
|
||||
|
||||
total_size += level.byteLength;
|
||||
max_offset = Q_max( max_offset, level.byteLength + level.byteOffset );
|
||||
}
|
||||
|
||||
if( max_offset > filesize )
|
||||
return false;
|
||||
|
||||
image.size = total_size;
|
||||
image.num_mips = header->levelCount;
|
||||
|
||||
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
||||
memcpy( image.rgba, buffer, image.size );
|
||||
|
||||
for( int mip = 0, cursor = 0; mip < header->levelCount; ++mip )
|
||||
{
|
||||
ktx2_level_t level;
|
||||
memcpy( &level, levels_begin + mip * sizeof( level ), sizeof( level ));
|
||||
memcpy( image.rgba + cursor, buffer + level.byteOffset, level.byteLength );
|
||||
cursor += level.byteLength;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean Image_LoadKTX2( const char *name, const byte *buffer, fs_offset_t filesize )
|
||||
{
|
||||
ktx2_header_t header;
|
||||
|
||||
if( filesize < KTX2_MINIMAL_HEADER_SIZE )
|
||||
return false;
|
||||
|
||||
if( memcmp( buffer, KTX2_IDENTIFIER, KTX2_IDENTIFIER_SIZE ) != 0 )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "%s: (%s) has invalid identifier\n", __FUNCTION__, name );
|
||||
return false;
|
||||
}
|
||||
|
||||
memcpy( &header, buffer + KTX2_IDENTIFIER_SIZE, sizeof( header ));
|
||||
|
||||
image.width = header.pixelWidth;
|
||||
image.height = header.pixelHeight;
|
||||
image.depth = Q_max( 1, header.pixelDepth );
|
||||
image.num_mips = 1;
|
||||
|
||||
ClearBits( image.flags, IMAGE_HAS_COLOR | IMAGE_HAS_ALPHA | IMAGE_HAS_LUMA );
|
||||
|
||||
if( !Image_KTX2Parse( &header, buffer, filesize ))
|
||||
{
|
||||
if( !Image_CheckFlag( IL_KTX2_RAW ))
|
||||
return false;
|
||||
|
||||
// If KTX2 to imagelib conversion failed, try passing the file as raw data.
|
||||
// This is useful for ref_vk which can directly support hundreds of formats which we don't convert to pixformat_t here
|
||||
|
||||
Con_DPrintf( S_WARN "%s: (%s) could not be converted to supported imagelib format, passing as raw KTX2 data\n", __FUNCTION__, name );
|
||||
// This is a catch-all for ref_vk, which can do this format directly and natively
|
||||
image.type = PF_KTX2_RAW;
|
||||
|
||||
image.size = filesize;
|
||||
//image.encode = TODO custom encode type?
|
||||
|
||||
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
||||
memcpy( image.rgba, buffer, image.size );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
79
engine/common/imagelib/img_ktx2.h
Normal file
79
engine/common/imagelib/img_ktx2.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
img_ktx2.h - ktx2 format reference
|
||||
Copyright (C) 2023 Provod
|
||||
|
||||
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.
|
||||
*/
|
||||
#ifndef IMG_KTX2_H
|
||||
#define IMG_KTX2_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define KTX2_IDENTIFIER_SIZE 12
|
||||
#define KTX2_IDENTIFIER "\xABKTX 20\xBB\r\n\x1A\n"
|
||||
|
||||
/*
|
||||
static const char k_ktx2_identifier[KTX2_IDENTIFIER_SIZE] =
|
||||
{
|
||||
'\xAB', 'K', 'T', 'X', ' ', '2', '0', '\xBB', '\r', '\n', '\x1A', '\n'
|
||||
};
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t vkFormat;
|
||||
uint32_t typeSize;
|
||||
uint32_t pixelWidth;
|
||||
uint32_t pixelHeight;
|
||||
uint32_t pixelDepth;
|
||||
uint32_t layerCount;
|
||||
uint32_t faceCount;
|
||||
uint32_t levelCount;
|
||||
uint32_t supercompressionScheme;
|
||||
} ktx2_header_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t dfdByteOffset;
|
||||
uint32_t dfdByteLength;
|
||||
uint32_t kvdByteOffset;
|
||||
uint32_t kvdByteLength;
|
||||
uint64_t sgdByteOffset;
|
||||
uint64_t sgdByteLength;
|
||||
} ktx2_index_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint64_t byteOffset;
|
||||
uint64_t byteLength;
|
||||
uint64_t uncompressedByteLength;
|
||||
} ktx2_level_t;
|
||||
|
||||
#define KTX2_LEVELS_OFFSET ( KTX2_IDENTIFIER_SIZE + sizeof( ktx2_header_t ) + sizeof( ktx2_index_t ))
|
||||
|
||||
#define KTX2_MINIMAL_HEADER_SIZE ( KTX2_LEVELS_OFFSET + sizeof( ktx2_level_t ))
|
||||
|
||||
// These have the same values as enum VkFormat in vulkan_core.h
|
||||
// There are hundreds of formats which can be contained in KTX2.
|
||||
// Below are listed the ones which are supported here. This list can be extended.
|
||||
typedef enum
|
||||
{
|
||||
KTX2_FORMAT_BC4_UNORM_BLOCK = 139,
|
||||
KTX2_FORMAT_BC4_SNORM_BLOCK = 140,
|
||||
KTX2_FORMAT_BC5_UNORM_BLOCK = 141,
|
||||
KTX2_FORMAT_BC5_SNORM_BLOCK = 142,
|
||||
KTX2_FORMAT_BC6H_UFLOAT_BLOCK = 143,
|
||||
KTX2_FORMAT_BC6H_SFLOAT_BLOCK = 144,
|
||||
KTX2_FORMAT_BC7_UNORM_BLOCK = 145,
|
||||
KTX2_FORMAT_BC7_SRGB_BLOCK = 146,
|
||||
} ktx2_format_t;
|
||||
|
||||
#endif // IMG_KTX2_H
|
||||
@@ -105,6 +105,7 @@ static const loadpixformat_t load_game[] =
|
||||
{ "%s%s.%s", "lmp", Image_LoadLMP, IL_HINT_NO }, // hl menu images (cached.wad etc)
|
||||
{ "%s%s.%s", "fnt", Image_LoadFNT, IL_HINT_HL }, // hl console font (fonts.wad etc)
|
||||
{ "%s%s.%s", "pal", Image_LoadPAL, IL_HINT_NO }, // install studio\sprite palette
|
||||
{ "%s%s.%s", "ktx2", Image_LoadKTX2, IL_HINT_NO }, // ktx2 for world and studio models
|
||||
{ NULL, NULL, NULL, IL_HINT_NO }
|
||||
};
|
||||
|
||||
@@ -283,6 +284,7 @@ int Image_ComparePalette( const byte *pal )
|
||||
void Image_SetPalette( const byte *pal, uint *d_table )
|
||||
{
|
||||
byte rgba[4];
|
||||
uint uirgba; // TODO: palette looks byte-swapped on big-endian
|
||||
int i;
|
||||
|
||||
// setup palette
|
||||
@@ -291,11 +293,12 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
||||
case LUMP_NORMAL:
|
||||
for( i = 0; i < 256; i++ )
|
||||
{
|
||||
rgba[0] = pal[i*3+0];
|
||||
rgba[1] = pal[i*3+1];
|
||||
rgba[2] = pal[i*3+2];
|
||||
rgba[0] = TextureToGamma( pal[i*3+0] );
|
||||
rgba[1] = TextureToGamma( pal[i*3+1] );
|
||||
rgba[2] = TextureToGamma( pal[i*3+2] );
|
||||
rgba[3] = 0xFF;
|
||||
d_table[i] = *(uint *)rgba;
|
||||
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||
d_table[i] = uirgba;
|
||||
}
|
||||
break;
|
||||
case LUMP_GRADIENT:
|
||||
@@ -305,7 +308,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
||||
rgba[1] = pal[766];
|
||||
rgba[2] = pal[767];
|
||||
rgba[3] = i;
|
||||
d_table[i] = *(uint *)rgba;
|
||||
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||
d_table[i] = uirgba;
|
||||
}
|
||||
break;
|
||||
case LUMP_MASKED:
|
||||
@@ -315,7 +319,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
||||
rgba[1] = pal[i*3+1];
|
||||
rgba[2] = pal[i*3+2];
|
||||
rgba[3] = 0xFF;
|
||||
d_table[i] = *(uint *)rgba;
|
||||
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||
d_table[i] = uirgba;
|
||||
}
|
||||
d_table[255] = 0;
|
||||
break;
|
||||
@@ -326,7 +331,8 @@ void Image_SetPalette( const byte *pal, uint *d_table )
|
||||
rgba[1] = pal[i*4+1];
|
||||
rgba[2] = pal[i*4+2];
|
||||
rgba[3] = pal[i*4+3];
|
||||
d_table[i] = *(uint *)rgba;
|
||||
memcpy( &uirgba, rgba, sizeof( uirgba ));
|
||||
d_table[i] = uirgba;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1446,3 +1452,36 @@ qboolean Image_Process(rgbdata_t **pix, int width, int height, uint flags, float
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// This codebase has too many copies of this function:
|
||||
// - ref_gl has one
|
||||
// - ref_vk has one
|
||||
// - ref_soft has one
|
||||
// - many more places probably have one too
|
||||
// TODO figure out how to make it available for ref_*
|
||||
size_t Image_ComputeSize( int type, int width, int height, int depth )
|
||||
{
|
||||
switch( type )
|
||||
{
|
||||
case PF_DXT1:
|
||||
case PF_BC4_SIGNED:
|
||||
case PF_BC4_UNSIGNED:
|
||||
return ((( width + 3 ) / 4 ) * (( height + 3 ) / 4 ) * depth * 8 );
|
||||
case PF_DXT3:
|
||||
case PF_DXT5:
|
||||
case PF_ATI2:
|
||||
case PF_BC5_UNSIGNED:
|
||||
case PF_BC5_SIGNED:
|
||||
case PF_BC6H_SIGNED:
|
||||
case PF_BC6H_UNSIGNED:
|
||||
case PF_BC7_UNORM:
|
||||
case PF_BC7_SRGB: return ((( width + 3 ) / 4 ) * (( height + 3 ) / 4 ) * depth * 16 );
|
||||
case PF_LUMINANCE: return ( width * height * depth );
|
||||
case PF_BGR_24:
|
||||
case PF_RGB_24: return ( width * height * depth * 3 );
|
||||
case PF_BGRA_32:
|
||||
case PF_RGBA_32: return ( width * height * depth * 4 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -13,32 +13,25 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifdef SINGLE_BINARY
|
||||
|
||||
#include "build.h"
|
||||
#include "common.h"
|
||||
#ifdef XASH_SDLMAIN
|
||||
#include "SDL.h"
|
||||
#if XASH_ENABLE_MAIN
|
||||
#if XASH_SDLMAIN
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#if XASH_EMSCRIPTEN
|
||||
#include <emscripten.h>
|
||||
#elif XASH_WIN32
|
||||
extern "C"
|
||||
{
|
||||
// Enable NVIDIA High Performance Graphics while using Integrated Graphics.
|
||||
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||
|
||||
// Enable AMD High Performance Graphics while using Integrated Graphics.
|
||||
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
|
||||
}
|
||||
#endif
|
||||
#include "build.h"
|
||||
#include "common.h"
|
||||
|
||||
#define E_GAME "XASH3D_GAME" // default env dir to start from
|
||||
#ifndef XASH_GAMEDIR
|
||||
#define XASH_GAMEDIR "valve"
|
||||
#endif
|
||||
|
||||
#if XASH_WIN32
|
||||
#error "Single-binary or dedicated builds aren't supported for Windows!"
|
||||
#endif
|
||||
|
||||
static char szGameDir[128]; // safe place to keep gamedir
|
||||
static int szArgc;
|
||||
static char **szArgv;
|
||||
@@ -47,48 +40,42 @@ static void Sys_ChangeGame( const char *progname )
|
||||
{
|
||||
// a1ba: may never be called within engine
|
||||
// if platform supports execv() function
|
||||
Q_strncpy( szGameDir, progname, sizeof( szGameDir ) - 1 );
|
||||
Q_strncpy( szGameDir, progname, sizeof( szGameDir ));
|
||||
Host_Shutdown( );
|
||||
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 );
|
||||
|
||||
if( !game )
|
||||
game = XASH_GAMEDIR;
|
||||
|
||||
Q_strncpy( szGameDir, game, sizeof( szGameDir ));
|
||||
|
||||
#if XASH_EMSCRIPTEN
|
||||
#ifdef EMSCRIPTEN_LIB_FS
|
||||
// For some unknown reason emscripten refusing to load libraries later
|
||||
COM_LoadLibrary("menu", 0 );
|
||||
COM_LoadLibrary("server", 0 );
|
||||
COM_LoadLibrary("client", 0 );
|
||||
COM_LoadLibrary( "menu", 0 );
|
||||
COM_LoadLibrary( "server", 0 );
|
||||
COM_LoadLibrary( "client", 0 );
|
||||
#endif
|
||||
#if XASH_DEDICATED
|
||||
// NodeJS support for debug
|
||||
EM_ASM(try{
|
||||
FS.mkdir('/xash');
|
||||
FS.mount(NODEFS, { root: '.'}, '/xash' );
|
||||
FS.chdir('/xash');
|
||||
}catch(e){};);
|
||||
EM_ASM(try {
|
||||
FS.mkdir( '/xash' );
|
||||
FS.mount( NODEFS, { root: '.'}, '/xash' );
|
||||
FS.chdir( '/xash' );
|
||||
} catch( e ) { };);
|
||||
#endif
|
||||
#elif XASH_IOS
|
||||
{
|
||||
void IOS_LaunchDialog( void );
|
||||
IOS_LaunchDialog();
|
||||
}
|
||||
IOS_LaunchDialog();
|
||||
#endif
|
||||
|
||||
ret = Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
||||
|
||||
return ret;
|
||||
return Host_Main( szArgc, szArgv, game, 0, Sys_ChangeGame );
|
||||
}
|
||||
|
||||
#if !XASH_WIN32
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
#if XASH_PSVITA
|
||||
@@ -100,36 +87,4 @@ int main( int argc, char **argv )
|
||||
#endif // XASH_PSVITA
|
||||
return Sys_Start();
|
||||
}
|
||||
#else
|
||||
int __stdcall WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int nShow)
|
||||
{
|
||||
LPWSTR* lpArgv;
|
||||
int ret, i;
|
||||
|
||||
lpArgv = CommandLineToArgvW( GetCommandLineW(), &szArgc );
|
||||
szArgv = ( char** )malloc( (szArgc + 1) * sizeof( char* ));
|
||||
|
||||
for( i = 0; i < szArgc; ++i )
|
||||
{
|
||||
size_t size = wcslen(lpArgv[i]) + 1;
|
||||
|
||||
// just in case, allocate some more memory
|
||||
szArgv[i] = ( char * )malloc( size * sizeof( wchar_t ));
|
||||
wcstombs( szArgv[i], lpArgv[i], size );
|
||||
}
|
||||
szArgv[szArgc] = 0;
|
||||
|
||||
LocalFree( lpArgv );
|
||||
|
||||
ret = Sys_Start();
|
||||
|
||||
for( ; i < szArgc; ++i )
|
||||
free( szArgv[i] );
|
||||
free( szArgv );
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif // XASH_WIN32
|
||||
|
||||
|
||||
#endif
|
||||
#endif // XASH_ENABLE_MAIN
|
||||
|
||||
@@ -50,7 +50,7 @@ static net_gai_state_t NET_GetMasterHostByName( master_t *m )
|
||||
if( res == NET_EAI_OK )
|
||||
return res;
|
||||
|
||||
m->adr.type = NA_UNUSED;
|
||||
m->adr.type = 0;
|
||||
if( res == NET_EAI_NONAME )
|
||||
Con_Reportf( "Can't resolve adr: %s\n", m->address );
|
||||
|
||||
@@ -266,7 +266,7 @@ static void NET_AddMaster( const char *addr, qboolean save )
|
||||
master->sent = false;
|
||||
master->save = save;
|
||||
master->next = NULL;
|
||||
master->adr.type = NA_UNUSED;
|
||||
master->adr.type = 0;
|
||||
|
||||
// link in
|
||||
if( last )
|
||||
@@ -322,7 +322,7 @@ static void NET_ListMasters_f( void )
|
||||
for( i = 1, list = ml.list; list; i++, list = list->next )
|
||||
{
|
||||
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 ));
|
||||
else Msg( "\n" );
|
||||
}
|
||||
@@ -419,5 +419,6 @@ void NET_InitMasters( void )
|
||||
|
||||
// keep main master always there
|
||||
NET_AddMaster( MASTERSERVER_ADR, false );
|
||||
NET_AddMaster( MASTERSERVER_ADR_TEST, false );
|
||||
NET_LoadMasters( );
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -113,12 +113,13 @@ typedef struct world_static_s
|
||||
// tree visualization stuff
|
||||
int recursion_level;
|
||||
int max_recursion;
|
||||
|
||||
uint32_t version; // BSP version
|
||||
} world_static_t;
|
||||
|
||||
#ifndef REF_DLL
|
||||
extern world_static_t world;
|
||||
extern poolhandle_t com_studiocache;
|
||||
extern model_t *loadmodel;
|
||||
extern convar_t mod_studiocache;
|
||||
extern convar_t r_wadtextures;
|
||||
extern convar_t r_showhull;
|
||||
@@ -156,7 +157,7 @@ int Mod_CheckLump( const char *filename, const int lump, int *lumpsize );
|
||||
int Mod_ReadLump( const char *filename, const int lump, void **lumpdata, int *lumpsize );
|
||||
int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lumpsize );
|
||||
mleaf_t *Mod_PointInLeaf( const vec3_t p, mnode_t *node );
|
||||
int Mod_SampleSizeForFace( msurface_t *surf );
|
||||
int Mod_SampleSizeForFace( const msurface_t *surf );
|
||||
byte *Mod_GetPVSForPoint( const vec3_t p );
|
||||
void Mod_UnloadBrushModel( model_t *mod );
|
||||
void Mod_PrintWorldStats_f( void );
|
||||
@@ -164,7 +165,7 @@ void Mod_PrintWorldStats_f( void );
|
||||
//
|
||||
// mod_dbghulls.c
|
||||
//
|
||||
void Mod_InitDebugHulls( void );
|
||||
void Mod_InitDebugHulls( model_t *mod );
|
||||
void Mod_CreatePolygonsForHull( int hullnum );
|
||||
void Mod_ReleaseHullPolygons( void );
|
||||
|
||||
|
||||
@@ -851,11 +851,11 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
||||
char poolname[MAX_VA_STRING];
|
||||
studiohdr_t *phdr;
|
||||
|
||||
Q_snprintf( poolname, sizeof( poolname ), "^2%s^7", loadmodel->name );
|
||||
Q_snprintf( poolname, sizeof( poolname ), "^2%s^7", mod->name );
|
||||
|
||||
if( loaded ) *loaded = false;
|
||||
loadmodel->mempool = Mem_AllocPool( poolname );
|
||||
loadmodel->type = mod_studio;
|
||||
mod->mempool = Mem_AllocPool( poolname );
|
||||
mod->type = mod_studio;
|
||||
|
||||
phdr = R_StudioLoadHeader( mod, buffer );
|
||||
if( !phdr ) return; // bad model
|
||||
@@ -886,9 +886,9 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
||||
// give space for textures and skinrefs
|
||||
size1 = thdr->numtextures * sizeof( mstudiotexture_t );
|
||||
size2 = thdr->numskinfamilies * thdr->numskinref * sizeof( short );
|
||||
mod->cache.data = Mem_Calloc( loadmodel->mempool, phdr->length + size1 + size2 );
|
||||
memcpy( loadmodel->cache.data, buffer, phdr->length ); // copy main mdl buffer
|
||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
||||
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length + size1 + size2 );
|
||||
memcpy( mod->cache.data, buffer, phdr->length ); // copy main mdl buffer
|
||||
phdr = (studiohdr_t *)mod->cache.data; // get the new pointer on studiohdr
|
||||
phdr->numskinfamilies = thdr->numskinfamilies;
|
||||
phdr->numtextures = thdr->numtextures;
|
||||
phdr->numskinref = thdr->numskinref;
|
||||
@@ -905,52 +905,52 @@ void Mod_LoadStudioModel( model_t *mod, const void *buffer, qboolean *loaded )
|
||||
else
|
||||
{
|
||||
// NOTE: don't modify source buffer because it's used for CRC computing
|
||||
loadmodel->cache.data = Mem_Calloc( loadmodel->mempool, phdr->length );
|
||||
memcpy( loadmodel->cache.data, buffer, phdr->length );
|
||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
||||
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length );
|
||||
memcpy( mod->cache.data, buffer, phdr->length );
|
||||
phdr = (studiohdr_t *)mod->cache.data; // get the new pointer on studiohdr
|
||||
#if !XASH_DEDICATED
|
||||
ref.dllFuncs.Mod_StudioLoadTextures( mod, phdr );
|
||||
#endif
|
||||
|
||||
// NOTE: we wan't keep raw textures in memory. just cutoff model pointer above texture base
|
||||
loadmodel->cache.data = Mem_Realloc( loadmodel->mempool, loadmodel->cache.data, phdr->texturedataindex );
|
||||
phdr = (studiohdr_t *)loadmodel->cache.data; // get the new pointer on studiohdr
|
||||
mod->cache.data = Mem_Realloc( mod->mempool, mod->cache.data, phdr->texturedataindex );
|
||||
phdr = (studiohdr_t *)mod->cache.data; // get the new pointer on studiohdr
|
||||
phdr->length = phdr->texturedataindex; // update model size
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just copy model into memory
|
||||
loadmodel->cache.data = Mem_Calloc( loadmodel->mempool, phdr->length );
|
||||
memcpy( loadmodel->cache.data, buffer, phdr->length );
|
||||
mod->cache.data = Mem_Calloc( mod->mempool, phdr->length );
|
||||
memcpy( mod->cache.data, buffer, phdr->length );
|
||||
|
||||
phdr = loadmodel->cache.data;
|
||||
phdr = mod->cache.data;
|
||||
}
|
||||
|
||||
// setup bounding box
|
||||
if( !VectorCompare( vec3_origin, phdr->bbmin ))
|
||||
{
|
||||
// clipping bounding box
|
||||
VectorCopy( phdr->bbmin, loadmodel->mins );
|
||||
VectorCopy( phdr->bbmax, loadmodel->maxs );
|
||||
VectorCopy( phdr->bbmin, mod->mins );
|
||||
VectorCopy( phdr->bbmax, mod->maxs );
|
||||
}
|
||||
else if( !VectorCompare( vec3_origin, phdr->min ))
|
||||
{
|
||||
// movement bounding box
|
||||
VectorCopy( phdr->min, loadmodel->mins );
|
||||
VectorCopy( phdr->max, loadmodel->maxs );
|
||||
VectorCopy( phdr->min, mod->mins );
|
||||
VectorCopy( phdr->max, mod->maxs );
|
||||
}
|
||||
else
|
||||
{
|
||||
// well compute bounds from vertices and round to nearest even values
|
||||
Mod_StudioComputeBounds( phdr, loadmodel->mins, loadmodel->maxs, true );
|
||||
RoundUpHullSize( loadmodel->mins );
|
||||
RoundUpHullSize( loadmodel->maxs );
|
||||
Mod_StudioComputeBounds( phdr, mod->mins, mod->maxs, true );
|
||||
RoundUpHullSize( mod->mins );
|
||||
RoundUpHullSize( mod->maxs );
|
||||
}
|
||||
|
||||
loadmodel->numframes = Mod_StudioBodyVariations( loadmodel );
|
||||
loadmodel->radius = RadiusFromBounds( loadmodel->mins, loadmodel->maxs );
|
||||
loadmodel->flags = phdr->flags; // copy header flags
|
||||
mod->numframes = Mod_StudioBodyVariations( mod );
|
||||
mod->radius = RadiusFromBounds( mod->mins, mod->maxs );
|
||||
mod->flags = phdr->flags; // copy header flags
|
||||
|
||||
if( loaded ) *loaded = true;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ poolhandle_t com_studiocache; // cache for submodels
|
||||
CVAR_DEFINE( mod_studiocache, "r_studiocache", "1", FCVAR_ARCHIVE, "enables studio cache for speedup tracing hitboxes" );
|
||||
CVAR_DEFINE_AUTO( r_wadtextures, "0", 0, "completely ignore textures in the bsp-file if enabled" );
|
||||
CVAR_DEFINE_AUTO( r_showhull, "0", 0, "draw collision hulls 1-3" );
|
||||
model_t *loadmodel;
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
@@ -112,6 +111,7 @@ void Mod_FreeModel( model_t *mod )
|
||||
|
||||
if( mod->type == mod_brush && FBitSet( mod->flags, MODEL_WORLD ) )
|
||||
{
|
||||
world.version = 0;
|
||||
world.shadowdata = NULL;
|
||||
world.deluxedata = NULL;
|
||||
}
|
||||
@@ -287,7 +287,6 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
|
||||
Con_Reportf( "loading %s\n", mod->name );
|
||||
mod->needload = NL_PRESENT;
|
||||
mod->type = mod_bad;
|
||||
loadmodel = mod;
|
||||
|
||||
// call the apropriate loader
|
||||
switch( *(uint *)buf )
|
||||
|
||||
@@ -1087,7 +1087,6 @@ int Delta_TestBaseline( entity_state_t *from, entity_state_t *to, qboolean playe
|
||||
delta_info_t *dt = NULL;
|
||||
delta_t *pField;
|
||||
int i, countBits;
|
||||
int numChanges = 0;
|
||||
|
||||
countBits = MAX_ENTITY_BITS + 2;
|
||||
|
||||
@@ -1121,7 +1120,7 @@ int Delta_TestBaseline( entity_state_t *from, entity_state_t *to, qboolean playe
|
||||
|
||||
if( !Delta_CompareField( pField, from, to, timebase ))
|
||||
{
|
||||
// strings are handled difference
|
||||
// strings are handled differently
|
||||
if( FBitSet( pField->flags, DT_STRING ))
|
||||
countBits += Q_strlen((char *)((byte *)to + pField->offset )) * 8;
|
||||
else countBits += pField->bits;
|
||||
|
||||
@@ -32,7 +32,6 @@ static const struct in6_addr in6addr_any;
|
||||
|
||||
#define NET_USE_FRAGMENTS
|
||||
|
||||
#define PORT_ANY -1
|
||||
#define MAX_LOOPBACK 4
|
||||
#define MASK_LOOPBACK (MAX_LOOPBACK - 1)
|
||||
|
||||
@@ -132,7 +131,7 @@ static CVAR_DEFINE_AUTO( net6_address, "0", FCVAR_PRIVILEGED|FCVAR_READ_ONLY, "c
|
||||
NET_ErrorString
|
||||
====================
|
||||
*/
|
||||
char *NET_ErrorString( void )
|
||||
static char *NET_ErrorString( void )
|
||||
{
|
||||
#if XASH_WIN32
|
||||
int err = WSANOTINITIALISED;
|
||||
@@ -226,34 +225,17 @@ _inline qboolean NET_IsSocketValid( int socket )
|
||||
|
||||
void NET_NetadrToIP6Bytes( uint8_t *ip6, const netadr_t *adr )
|
||||
{
|
||||
#if XASH_LITTLE_ENDIAN
|
||||
memcpy( ip6, adr->ip6, sizeof( adr->ip6 ));
|
||||
#elif XASH_BIG_ENDIAN
|
||||
memcpy( ip6, adr->ip6_0, sizeof( adr->ip6_0 ));
|
||||
memcpy( ip6 + sizeof( adr->ip6_0 ), adr->ip6_2, sizeof( adr->ip6_2 ));
|
||||
#endif
|
||||
}
|
||||
|
||||
void NET_IP6BytesToNetadr( netadr_t *adr, const uint8_t *ip6 )
|
||||
{
|
||||
#if XASH_LITTLE_ENDIAN
|
||||
memcpy( adr->ip6, ip6, sizeof( adr->ip6 ));
|
||||
#elif XASH_BIG_ENDIAN
|
||||
memcpy( adr->ip6_0, ip6, sizeof( adr->ip6_0 ));
|
||||
memcpy( adr->ip6_2, ip6 + sizeof( adr->ip6_0 ), sizeof( adr->ip6_2 ));
|
||||
#endif
|
||||
}
|
||||
|
||||
_inline int NET_NetadrIP6Compare( const netadr_t *a, const netadr_t *b )
|
||||
static int NET_NetadrIP6Compare( const netadr_t *a, const netadr_t *b )
|
||||
{
|
||||
#if XASH_LITTLE_ENDIAN
|
||||
return memcmp( a->ip6, b->ip6, sizeof( a->ip6 ));
|
||||
#elif XASH_BIG_ENDIAN
|
||||
int ret = memcmp( a->ip6_0, b->ip6_0, sizeof( a->ip6_0 ));
|
||||
if( !ret )
|
||||
return memcmp( a->ip6_2, b->ip6_2, sizeof( a->ip6_2 ));
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -274,8 +256,8 @@ static void NET_NetadrToSockadr( netadr_t *a, struct sockaddr_storage *s )
|
||||
else if( a->type == NA_IP )
|
||||
{
|
||||
((struct sockaddr_in *)s)->sin_family = AF_INET;
|
||||
((struct sockaddr_in *)s)->sin_addr.s_addr = *(uint32_t *)&a->ip;
|
||||
((struct sockaddr_in *)s)->sin_port = a->port;
|
||||
((struct sockaddr_in *)s)->sin_addr.s_addr = a->ip4;
|
||||
}
|
||||
else if( a->type6 == NA_IP6 )
|
||||
{
|
||||
@@ -314,7 +296,7 @@ static void NET_SockadrToNetadr( const struct sockaddr_storage *s, netadr_t *a )
|
||||
if( s->ss_family == AF_INET )
|
||||
{
|
||||
a->type = NA_IP;
|
||||
*(int *)&a->ip = ((struct sockaddr_in *)s)->sin_addr.s_addr;
|
||||
a->ip4 = ((struct sockaddr_in *)s)->sin_addr.s_addr;
|
||||
a->port = ((struct sockaddr_in *)s)->sin_port;
|
||||
}
|
||||
else if( s->ss_family == AF_INET6 )
|
||||
@@ -444,6 +426,7 @@ static void NET_InitializeCriticalSections( void )
|
||||
void NET_ResolveThread( void )
|
||||
{
|
||||
struct sockaddr_storage addr;
|
||||
qboolean res;
|
||||
|
||||
RESOLVE_DBG( "[resolve thread] starting resolve for " );
|
||||
RESOLVE_DBG( nsthread.hostname );
|
||||
@@ -453,13 +436,14 @@ void NET_ResolveThread( void )
|
||||
RESOLVE_DBG( " with gethostbyname\n" );
|
||||
#endif
|
||||
|
||||
if( NET_GetHostByName( nsthread.hostname, nsthread.family, &addr ))
|
||||
if(( res = NET_GetHostByName( nsthread.hostname, nsthread.family, &addr )))
|
||||
RESOLVE_DBG( "[resolve thread] success\n" );
|
||||
else
|
||||
RESOLVE_DBG( "[resolve thread] failed\n" );
|
||||
mutex_lock( &nsthread.mutexres );
|
||||
nsthread.addr = addr;
|
||||
nsthread.busy = false;
|
||||
nsthread.result = res ? NET_EAI_OK : NET_EAI_NONAME;
|
||||
RESOLVE_DBG( "[resolve thread] returning result\n" );
|
||||
mutex_unlock( &nsthread.mutexres );
|
||||
RESOLVE_DBG( "[resolve thread] exiting thread\n" );
|
||||
@@ -544,6 +528,7 @@ static net_gai_state_t NET_StringToSockaddr( const char *s, struct sockaddr_stor
|
||||
memset( &nsthread.addr, 0, sizeof( nsthread.addr ));
|
||||
|
||||
detach_thread( nsthread.thread );
|
||||
asyncfailed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2197,6 +2182,8 @@ HTTP downloader
|
||||
=================================================
|
||||
*/
|
||||
|
||||
#define MAX_HTTP_BUFFER_SIZE (BIT( 13 ))
|
||||
|
||||
typedef struct httpserver_s
|
||||
{
|
||||
char host[256];
|
||||
@@ -2237,7 +2224,7 @@ typedef struct httpfile_s
|
||||
qboolean process;
|
||||
|
||||
// query or response
|
||||
char buf[BUFSIZ+1];
|
||||
char buf[MAX_HTTP_BUFFER_SIZE+1];
|
||||
int header_size, query_length, bytes_sent;
|
||||
} httpfile_t;
|
||||
|
||||
@@ -2382,18 +2369,18 @@ process incoming data
|
||||
*/
|
||||
static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
||||
{
|
||||
char buf[BUFSIZ+1];
|
||||
char buf[sizeof( curfile->buf )];
|
||||
char *begin = 0;
|
||||
int res;
|
||||
|
||||
if( curfile->header_size >= BUFSIZ )
|
||||
if( curfile->header_size >= sizeof( buf ))
|
||||
{
|
||||
Con_Reportf( S_ERROR "Header to big\n");
|
||||
Con_Reportf( S_ERROR "Header too big, the size is %s\n", curfile->header_size );
|
||||
HTTP_FreeFile( curfile, true );
|
||||
return false;
|
||||
}
|
||||
|
||||
while( ( res = recv( curfile->socket, buf, BUFSIZ - curfile->header_size, 0 )) > 0) // if we got there, we are receiving data
|
||||
while( ( res = recv( curfile->socket, buf, sizeof( buf ) - curfile->header_size, 0 )) > 0) // if we got there, we are receiving data
|
||||
{
|
||||
curfile->blocktime = 0;
|
||||
|
||||
@@ -2406,7 +2393,7 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
||||
if( begin ) // Got full header
|
||||
{
|
||||
int cutheadersize = begin - curfile->buf + 4; // after that begin of data
|
||||
char *length;
|
||||
char *content_length_line;
|
||||
|
||||
Con_Reportf( "HTTP: Got response!\n" );
|
||||
|
||||
@@ -2425,10 +2412,13 @@ static qboolean HTTP_ProcessStream( httpfile_t *curfile )
|
||||
}
|
||||
|
||||
// print size
|
||||
length = Q_stristr( curfile->buf, "Content-Length: " );
|
||||
if( length )
|
||||
content_length_line = Q_stristr( curfile->buf, "Content-Length: " );
|
||||
if( content_length_line )
|
||||
{
|
||||
int size = Q_atoi( length += 16 );
|
||||
int size;
|
||||
|
||||
content_length_line += sizeof( "Content-Length: " ) - 1;
|
||||
size = Q_atoi( content_length_line );
|
||||
|
||||
Con_Reportf( "HTTP: File size is %d\n", size );
|
||||
|
||||
@@ -2870,6 +2860,10 @@ static void HTTP_AddCustomServer_f( void )
|
||||
{
|
||||
HTTP_AddCustomServer( Cmd_Argv( 1 ));
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Printf( S_USAGE "http_addcustomserver <url>\n" );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -70,6 +70,7 @@ GNU General Public License for more details.
|
||||
#define NET_MAX_MESSAGE PAD_NUMBER(( NET_MAX_PAYLOAD + HEADER_BYTES ), 16 )
|
||||
|
||||
#define MASTERSERVER_ADR "mentality.rip:27010"
|
||||
#define MASTERSERVER_ADR_TEST "mentality.rip:27011"
|
||||
#define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0"
|
||||
|
||||
#define PORT_MASTER 27010
|
||||
|
||||
@@ -305,6 +305,14 @@ extern const char *clc_strings[clc_lastmsg+1];
|
||||
#define MAX_LEGACY_EDICTS (1 << MAX_LEGACY_ENTITY_BITS) // 4096 edicts
|
||||
#define MIN_LEGACY_EDICTS 30
|
||||
|
||||
// legacy engine features that can be implemented through currently supported features
|
||||
#define ENGINE_LEGACY_FEATURES_MASK \
|
||||
( ENGINE_WRITE_LARGE_COORD \
|
||||
| ENGINE_LOAD_DELUXEDATA \
|
||||
| ENGINE_LARGE_LIGHTMAPS \
|
||||
| ENGINE_COMPENSATE_QUAKE_BUG \
|
||||
| ENGINE_COMPUTE_STUDIO_LERP )
|
||||
|
||||
// Master Server protocol
|
||||
#define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0" // TODO: implement IP filter
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ stream_t *FS_OpenStream( const char *filename )
|
||||
string path, loadname;
|
||||
qboolean anyformat = true;
|
||||
const streamfmt_t *format;
|
||||
stream_t *stream;
|
||||
stream_t *stream = NULL;
|
||||
|
||||
Sound_Reset(); // clear old streaminfo
|
||||
Q_strncpy( loadname, filename, sizeof( loadname ));
|
||||
@@ -188,9 +188,18 @@ stream_t *FS_OpenStream( const char *filename )
|
||||
}
|
||||
}
|
||||
|
||||
Con_Reportf( "FS_OpenStream: couldn't open \"%s\"\n", loadname );
|
||||
// compatibility with original Xash3D, try media/ folder
|
||||
if( Q_strncmp( filename, "media/", sizeof( "media/" ) - 1 ))
|
||||
{
|
||||
Q_snprintf( loadname, sizeof( loadname ), "media/%s", filename );
|
||||
stream = FS_OpenStream( loadname );
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Reportf( "%s: couldn't open \"%s\" or \"%s\"\n", __func__, filename + 6, filename );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return stream;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -149,7 +149,7 @@ void Sys_InitLog( void )
|
||||
s_ld.logfileno = fileno( s_ld.logfile );
|
||||
|
||||
fprintf( s_ld.logfile, "=================================================================================\n" );
|
||||
fprintf( s_ld.logfile, "\t%s (build %i) started at %s\n", s_ld.title, Q_buildnum(), Q_timestamp( TIME_FULL ) );
|
||||
fprintf( s_ld.logfile, "\t%s (build %i commit %s (%s-%s)) started at %s\n", s_ld.title, Q_buildnum(), Q_buildcommit(), Q_buildos(), Q_buildarch(), Q_timestamp( TIME_FULL ) );
|
||||
fprintf( s_ld.logfile, "=================================================================================\n" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ void Sys_Warn( const char *format, ... )
|
||||
Msg( "Sys_Warn: %s\n", text );
|
||||
|
||||
if( !Host_IsDedicated() ) // dedicated server should not hang on messagebox
|
||||
MSGBOX(text);
|
||||
Platform_MessageBox( "Xash Warning", text, false );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -446,8 +446,8 @@ void Sys_Error( const char *error, ... )
|
||||
#if XASH_WIN32
|
||||
Wcon_ShowConsole( false );
|
||||
#endif
|
||||
MSGBOX( text );
|
||||
Sys_Print( text );
|
||||
Platform_MessageBox( "Xash Error", text, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -562,7 +562,7 @@ void Sys_Print( const char *pMsg )
|
||||
|
||||
Sys_PrintLog( pMsg );
|
||||
|
||||
Rcon_Print( pMsg );
|
||||
Rcon_Print( &host.rd, pMsg );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -649,3 +649,31 @@ qboolean Sys_NewInstance( const char *gamedir )
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
Sys_GetNativeObject
|
||||
|
||||
Get platform-specific native object
|
||||
==================
|
||||
*/
|
||||
void *Sys_GetNativeObject( const char *obj )
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
if( !COM_CheckString( obj ))
|
||||
return NULL;
|
||||
|
||||
ptr = FS_GetNativeObject( obj );
|
||||
|
||||
if( ptr )
|
||||
return ptr;
|
||||
|
||||
// Backend should consider that obj is case-sensitive
|
||||
#if XASH_ANDROID
|
||||
ptr = Android_GetNativeObject( obj );
|
||||
#endif // XASH_ANDROID
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,6 @@ extern "C" {
|
||||
#include "crtlib.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
#define MSGBOX( x ) Platform_MessageBox( "Xash Error", (x), false )
|
||||
#define MSGBOX2( x ) Platform_MessageBox( "Host Error", (x), true )
|
||||
#define MSGBOX3( x ) Platform_MessageBox( "Host Recursive Error", (x), true )
|
||||
#define ASSERT( exp ) if(!( exp )) Sys_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
|
||||
|
||||
/*
|
||||
@@ -70,6 +67,7 @@ void Sys_InitLog( void );
|
||||
void Sys_CloseLog( void );
|
||||
void Sys_Quit( void ) NORETURN;
|
||||
qboolean Sys_NewInstance( const char *gamedir );
|
||||
void *Sys_GetNativeObject( const char *obj );
|
||||
|
||||
//
|
||||
// sys_con.c
|
||||
|
||||
@@ -38,6 +38,7 @@ void Test_RunCvar( void );
|
||||
void Test_RunCon( void );
|
||||
void Test_RunVOX( void );
|
||||
void Test_RunIPFilter( void );
|
||||
void Test_RunGamma( void );
|
||||
|
||||
#define TEST_LIST_0 \
|
||||
Test_RunLibCommon(); \
|
||||
@@ -47,7 +48,8 @@ void Test_RunIPFilter( void );
|
||||
Test_RunIPFilter();
|
||||
|
||||
#define TEST_LIST_0_CLIENT \
|
||||
Test_RunCon();
|
||||
Test_RunCon(); \
|
||||
Test_RunGamma();
|
||||
|
||||
#define TEST_LIST_1 \
|
||||
Test_RunImagelib();
|
||||
|
||||
@@ -632,12 +632,14 @@ int WAI_PREFIX(getExecutablePath)(char* out, int capacity, int* dirname_length)
|
||||
else
|
||||
{
|
||||
const char* PATH = getenv("PATH");
|
||||
const char* begin;
|
||||
size_t argv0_length;
|
||||
if (!PATH)
|
||||
break;
|
||||
|
||||
size_t argv0_length = strlen(argv[0]);
|
||||
argv0_length = strlen(argv[0]);
|
||||
|
||||
const char* begin = PATH;
|
||||
begin = PATH;
|
||||
while (1)
|
||||
{
|
||||
const char* separator = strchr(begin, ':');
|
||||
|
||||
@@ -143,7 +143,7 @@ typedef struct ui_enginefuncs_s
|
||||
void *(*pfnKeyGetState)( const char *name ); // for mlook, klook etc
|
||||
|
||||
// engine memory manager
|
||||
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
||||
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ) ALLOC_CHECK( 1 );
|
||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||
|
||||
// collect info from engine
|
||||
|
||||
@@ -86,7 +86,7 @@ typedef struct server_physics_api_s
|
||||
const byte *(*pfnGetTextureData)( unsigned int texnum );
|
||||
|
||||
// static allocations
|
||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
|
||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ) ALLOC_CHECK( 1 );
|
||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline );
|
||||
|
||||
// trace & contents
|
||||
|
||||
@@ -32,10 +32,9 @@ struct jnimethods_s
|
||||
JNIEnv *env;
|
||||
jobject activity;
|
||||
jclass actcls;
|
||||
jmethodID getID;
|
||||
jmethodID saveID;
|
||||
jmethodID loadID;
|
||||
jmethodID getKeyboardHeight;
|
||||
jmethodID loadAndroidID;
|
||||
jmethodID getAndroidID;
|
||||
jmethodID saveAndroidID;
|
||||
} jni;
|
||||
|
||||
void Android_Init( void )
|
||||
@@ -43,10 +42,9 @@ void Android_Init( void )
|
||||
jni.env = (JNIEnv *)SDL_AndroidGetJNIEnv();
|
||||
jni.activity = (jobject)SDL_AndroidGetActivity();
|
||||
jni.actcls = (*jni.env)->GetObjectClass( jni.env, jni.activity );
|
||||
jni.loadID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "loadAndroidID", "()Ljava/lang/String;" );
|
||||
jni.getID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "getAndroidID", "()Ljava/lang/String;" );
|
||||
jni.saveID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "saveAndroidID", "(Ljava/lang/String;)V" );
|
||||
jni.getKeyboardHeight = (*jni.env)->GetMethodID( jni.env, jni.actcls, "getKeyboardHeight", "()I" );
|
||||
jni.loadAndroidID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "loadAndroidID", "()Ljava/lang/String;" );
|
||||
jni.getAndroidID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "getAndroidID", "()Ljava/lang/String;" );
|
||||
jni.saveAndroidID = (*jni.env)->GetMethodID( jni.env, jni.actcls, "saveAndroidID", "(Ljava/lang/String;)V" );
|
||||
|
||||
SDL_SetHint( SDL_HINT_ORIENTATIONS, "LandscapeLeft LandscapeRight" );
|
||||
SDL_SetHint( SDL_HINT_JOYSTICK_HIDAPI_STEAM, "1" );
|
||||
@@ -95,7 +93,7 @@ const char *Android_GetAndroidID( void )
|
||||
|
||||
if( COM_CheckString( id ) ) return id;
|
||||
|
||||
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.getID );
|
||||
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.getAndroidID );
|
||||
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
||||
Q_strncpy( id, resultCStr, sizeof( id ) );
|
||||
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr );
|
||||
@@ -114,7 +112,7 @@ const char *Android_LoadID( void )
|
||||
jstring resultJNIStr;
|
||||
const char *resultCStr;
|
||||
|
||||
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.loadID );
|
||||
resultJNIStr = (*jni.env)->CallObjectMethod( jni.env, jni.activity, jni.loadAndroidID );
|
||||
resultCStr = (*jni.env)->GetStringUTFChars( jni.env, resultJNIStr, NULL );
|
||||
Q_strncpy( id, resultCStr, sizeof( id ) );
|
||||
(*jni.env)->ReleaseStringUTFChars( jni.env, resultJNIStr, resultCStr );
|
||||
@@ -129,7 +127,7 @@ Android_SaveID
|
||||
*/
|
||||
void Android_SaveID( const char *id )
|
||||
{
|
||||
(*jni.env)->CallVoidMethod( jni.env, jni.activity, jni.saveID, (*jni.env)->NewStringUTF( jni.env, id ) );
|
||||
(*jni.env)->CallVoidMethod( jni.env, jni.activity, jni.saveAndroidID, (*jni.env)->NewStringUTF( jni.env, id ) );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -144,14 +142,4 @@ void Platform_ShellExecute( const char *path, const char *parms )
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
Android_GetKeyboardHeight
|
||||
========================
|
||||
*/
|
||||
int Android_GetKeyboardHeight( void )
|
||||
{
|
||||
return (*jni.env)->CallIntMethod( jni.env, jni.activity, jni.getKeyboardHeight );
|
||||
}
|
||||
|
||||
#endif // XASH_DEDICATED
|
||||
|
||||
@@ -48,8 +48,6 @@ qboolean R_Init_Video( const int type )
|
||||
{
|
||||
qboolean retval;
|
||||
|
||||
VID_StartupGamma();
|
||||
|
||||
if( type != REF_SOFTWARE )
|
||||
return false; /// glide???
|
||||
|
||||
|
||||
@@ -13,11 +13,33 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <dlfcn.h>
|
||||
#include <signal.h>
|
||||
#include <ucontext.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include "platform/platform.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined(__GLIBC__) && (__GLIBC__ <= 2) && (__GLIBC_MINOR__ <= 30)
|
||||
// Library support was added in glibc 2.30.
|
||||
// Earlier glibc versions did not provide a wrapper for this system call,
|
||||
// necessitating the use of syscall(2).
|
||||
#include <sys/syscall.h>
|
||||
|
||||
static pid_t gettid( void )
|
||||
{
|
||||
return syscall( SYS_gettid );
|
||||
}
|
||||
#endif
|
||||
|
||||
static void *g_hsystemd;
|
||||
static int (*g_pfn_sd_notify)( int unset_environment, const char *state );
|
||||
@@ -103,3 +125,44 @@ void Linux_Shutdown( void )
|
||||
g_hsystemd = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void Linux_TimerHandler( int sig, siginfo_t *si, void *uc )
|
||||
{
|
||||
timer_t *tidp = si->si_value.sival_ptr;
|
||||
int overrun = timer_getoverrun( *tidp );
|
||||
Con_Printf( "Frame too long (overrun %d)!\n", overrun );
|
||||
}
|
||||
|
||||
#define DEBUG_TIMER_SIGNAL SIGRTMIN
|
||||
|
||||
void Linux_SetTimer( float tm )
|
||||
{
|
||||
static timer_t timerid;
|
||||
|
||||
if( !timerid && tm )
|
||||
{
|
||||
struct sigevent sev = { 0 };
|
||||
struct sigaction sa = { 0 };
|
||||
|
||||
sa.sa_flags = SA_SIGINFO;
|
||||
sa.sa_sigaction = Linux_TimerHandler;
|
||||
sigaction( DEBUG_TIMER_SIGNAL, &sa, NULL );
|
||||
// this path availiable in POSIX, but may signal wrong thread...
|
||||
// sev.sigev_notify = SIGEV_SIGNAL;
|
||||
sev.sigev_notify = SIGEV_THREAD_ID;
|
||||
sev._sigev_un._tid = gettid();
|
||||
sev.sigev_signo = DEBUG_TIMER_SIGNAL;
|
||||
sev.sigev_value.sival_ptr = &timerid;
|
||||
timer_create( CLOCK_REALTIME, &sev, &timerid );
|
||||
}
|
||||
|
||||
if( timerid )
|
||||
{
|
||||
struct itimerspec its = {0};
|
||||
its.it_value.tv_sec = tm;
|
||||
its.it_value.tv_nsec = 1000000000ULL * fmod( tm, 1.0f );
|
||||
its.it_interval.tv_sec = 0;
|
||||
its.it_interval.tv_nsec = 0;
|
||||
timer_settime( timerid, 0, &its, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,6 @@ qboolean R_Init_Video( const int type )
|
||||
string fbdev = DEFAULT_FBDEV;
|
||||
fb.fd = -1;
|
||||
|
||||
VID_StartupGamma();
|
||||
|
||||
if( type != REF_SOFTWARE )
|
||||
return false;
|
||||
|
||||
|
||||
@@ -37,6 +37,12 @@ void Platform_MessageBox( const char *title, const char *message, qboolean paren
|
||||
qboolean Sys_DebuggerPresent( void ); // optional, see Sys_DebugBreak
|
||||
void Platform_SetStatus( const char *status );
|
||||
|
||||
// legacy iOS port functions
|
||||
#if TARGET_OS_IOS
|
||||
const char *IOS_GetDocsDir( void );
|
||||
void IOS_LaunchDialog( void );
|
||||
#endif // TARGET_OS_IOS
|
||||
|
||||
#if XASH_WIN32 || XASH_LINUX
|
||||
#define XASH_PLATFORM_HAVE_STATUS 1
|
||||
#else
|
||||
@@ -58,7 +64,6 @@ const char *Android_LoadID( void );
|
||||
void Android_SaveID( const char *id );
|
||||
void Android_Init( void );
|
||||
void *Android_GetNativeObject( const char *name );
|
||||
int Android_GetKeyboardHeight( void );
|
||||
#endif
|
||||
|
||||
#if XASH_WIN32
|
||||
@@ -87,6 +92,7 @@ void DOS_Shutdown( void );
|
||||
#if XASH_LINUX
|
||||
void Linux_Init( void );
|
||||
void Linux_Shutdown( void );
|
||||
void Linux_SetTimer( float time );
|
||||
#endif
|
||||
|
||||
static inline void Platform_Init( void )
|
||||
@@ -134,17 +140,6 @@ static inline void Platform_Shutdown( void )
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void *Platform_GetNativeObject( const char *name )
|
||||
{
|
||||
void *ptr = NULL;
|
||||
|
||||
#if XASH_ANDROID
|
||||
ptr = Android_GetNativeObject( name );
|
||||
#endif
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
@@ -153,7 +148,6 @@ static inline void *Platform_GetNativeObject( const char *name )
|
||||
==============================================================================
|
||||
*/
|
||||
void Platform_Vibrate( float life, char flags );
|
||||
void*Platform_GetNativeObject( const char *name );
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
@@ -189,6 +183,13 @@ void Platform_SetClipboardText( const char *buffer );
|
||||
#define SDL_VERSION_ATLEAST( x, y, z ) 0
|
||||
#endif
|
||||
|
||||
static void Platform_SetTimer( float time )
|
||||
{
|
||||
#if XASH_LINUX
|
||||
Linux_SetTimer( time );
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ static qboolean SDLash_IsInstanceIDAGameController( SDL_JoystickID joyId )
|
||||
return true;
|
||||
return false;
|
||||
#else
|
||||
if( SDL_GameControllerFromInstanceID( joyId ) )
|
||||
if( SDL_GameControllerFromInstanceID( joyId ) != NULL )
|
||||
return true;
|
||||
return false;
|
||||
#endif
|
||||
@@ -148,7 +148,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
||||
#else
|
||||
int keynum = key.keysym.sym;
|
||||
#endif
|
||||
qboolean numLock = SDL_GetModState() & KMOD_NUM;
|
||||
qboolean numLock = FBitSet( SDL_GetModState(), KMOD_NUM );
|
||||
|
||||
#if XASH_ANDROID
|
||||
if( keynum == SDL_SCANCODE_VOLUMEUP || keynum == SDL_SCANCODE_VOLUMEDOWN )
|
||||
@@ -159,7 +159,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
||||
|
||||
if( SDL_IsTextInputActive() && down && cls.key_dest != key_game )
|
||||
{
|
||||
if( SDL_GetModState() & KMOD_CTRL )
|
||||
if( FBitSet( SDL_GetModState(), KMOD_CTRL ))
|
||||
{
|
||||
if( keynum >= SDL_SCANCODE_A && keynum <= SDL_SCANCODE_Z )
|
||||
{
|
||||
@@ -176,7 +176,7 @@ static void SDLash_KeyEvent( SDL_KeyboardEvent key )
|
||||
|
||||
if( isprint( keynum ) )
|
||||
{
|
||||
if( SDL_GetModState() & KMOD_SHIFT )
|
||||
if( FBitSet( SDL_GetModState(), KMOD_SHIFT ))
|
||||
{
|
||||
keynum = Key_ToUpper( keynum );
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ void *SW_LockBuffer( void )
|
||||
void *pixels;
|
||||
int stride;
|
||||
|
||||
if( SDL_LockTexture(sw.tex, NULL, &pixels, &stride ) )
|
||||
Sys_Error("%s", SDL_GetError());
|
||||
if( SDL_LockTexture(sw.tex, NULL, &pixels, &stride ) < 0 )
|
||||
Sys_Error( "%s: %s", __func__, SDL_GetError( ));
|
||||
return pixels;
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ static void R_InitVideoModes( void )
|
||||
int j;
|
||||
SDL_DisplayMode mode;
|
||||
|
||||
if( SDL_GetDisplayMode( displayIndex, i, &mode ) )
|
||||
if( SDL_GetDisplayMode( displayIndex, i, &mode ) < 0 )
|
||||
{
|
||||
Msg( "SDL_GetDisplayMode: %s\n", SDL_GetError() );
|
||||
continue;
|
||||
@@ -419,12 +419,16 @@ static qboolean WIN_SetWindowIcon( HICON ico )
|
||||
{
|
||||
SDL_SysWMinfo wminfo;
|
||||
|
||||
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ))
|
||||
SDL_VERSION( &wminfo.version );
|
||||
|
||||
if( SDL_GetWindowWMInfo( host.hWnd, &wminfo ) == SDL_TRUE )
|
||||
{
|
||||
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_SMALL, (LONG_PTR)ico );
|
||||
SendMessage( wminfo.info.win.window, WM_SETICON, ICON_BIG, (LONG_PTR)ico );
|
||||
return true;
|
||||
}
|
||||
|
||||
Con_Reportf( S_ERROR "%s: %s", __func__, SDL_GetError( ));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -438,6 +442,25 @@ GL_GetProcAddress
|
||||
void *GL_GetProcAddress( const char *name )
|
||||
{
|
||||
void *func = SDL_GL_GetProcAddress( name );
|
||||
#if !SDL_VERSION_ATLEAST( 2, 0, 6 ) && XASH_POSIX
|
||||
if( !func && Sys_CheckParm( "-egl" ))
|
||||
{
|
||||
/*
|
||||
* SDL2 has broken SDL_GL_GetProcAddress until this commit if using egl:
|
||||
* https://github.com/libsdl-org/SDL/commit/466ba57d42d244e80357e9ad3011c50af30ed225
|
||||
* so call eglGetProcAddress directly
|
||||
* */
|
||||
static void *(*peglGetProcAddress)( const char * );
|
||||
if( !peglGetProcAddress )
|
||||
{
|
||||
void *lib = dlopen( "libEGL.so", RTLD_NOW );
|
||||
if( lib )
|
||||
*(void**)&peglGetProcAddress = dlsym( lib, "eglGetProcAddress" );
|
||||
}
|
||||
if( peglGetProcAddress )
|
||||
func = peglGetProcAddress( name );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if XASH_PSVITA
|
||||
// try to find in main module
|
||||
@@ -473,8 +496,8 @@ void GL_UpdateSwapInterval( void )
|
||||
{
|
||||
ClearBits( gl_vsync.flags, FCVAR_CHANGED );
|
||||
|
||||
if( SDL_GL_SetSwapInterval( gl_vsync.value ) )
|
||||
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ) );
|
||||
if( SDL_GL_SetSwapInterval( gl_vsync.value ) < 0 )
|
||||
Con_Reportf( S_ERROR "SDL_GL_SetSwapInterval: %s\n", SDL_GetError( ));
|
||||
}
|
||||
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
}
|
||||
@@ -523,7 +546,7 @@ GL_UpdateContext
|
||||
static qboolean GL_UpdateContext( void )
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ))
|
||||
if( SDL_GL_MakeCurrent( host.hWnd, glw_state.context ) < 0 )
|
||||
{
|
||||
Con_Reportf( S_ERROR "GL_UpdateContext: %s\n", SDL_GetError());
|
||||
return GL_DeleteContext();
|
||||
@@ -580,7 +603,7 @@ static qboolean VID_SetScreenResolution( int width, int height, window_mode_t wi
|
||||
want.w = width;
|
||||
want.h = height;
|
||||
|
||||
if( SDL_GetClosestDisplayMode( 0, &want, &got ) < 0 )
|
||||
if( SDL_GetClosestDisplayMode( 0, &want, &got ) == NULL )
|
||||
{
|
||||
Con_Printf( S_ERROR "%s: SDL_GetClosestDisplayMode: %s", __func__, SDL_GetError( ));
|
||||
return false;
|
||||
@@ -626,14 +649,14 @@ void VID_RestoreScreenResolution( void )
|
||||
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
}
|
||||
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
static void VID_SetWindowIcon( SDL_Window *hWnd )
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
rgbdata_t *icon = NULL;
|
||||
char iconpath[MAX_STRING];
|
||||
#if XASH_WIN32 // ICO support only for Win32
|
||||
const char *localIcoPath;
|
||||
|
||||
#if XASH_WIN32 // ICO support only for Win32
|
||||
if(( localIcoPath = FS_GetDiskPath( GI->iconpath, true )))
|
||||
{
|
||||
HICON ico = (HICON)LoadImage( NULL, localIcoPath, IMAGE_ICON, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE );
|
||||
@@ -666,8 +689,8 @@ static void VID_SetWindowIcon( SDL_Window *hWnd )
|
||||
#if XASH_WIN32 // ICO support only for Win32
|
||||
WIN_SetWindowIcon( LoadIcon( host.hInst, MAKEINTRESOURCE( 101 )));
|
||||
#endif
|
||||
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
}
|
||||
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
|
||||
static qboolean VID_CreateWindowWithSafeGL( const char *wndname, int xpos, int ypos, int w, int h, uint32_t flags )
|
||||
{
|
||||
@@ -785,6 +808,7 @@ qboolean VID_CreateWindow( int width, int height, window_mode_t window_mode )
|
||||
else VID_RestoreScreenResolution();
|
||||
#endif
|
||||
|
||||
VID_SetWindowIcon( host.hWnd );
|
||||
SDL_ShowWindow( host.hWnd );
|
||||
|
||||
if( glw_state.software )
|
||||
@@ -812,15 +836,17 @@ qboolean VID_CreateWindow( int width, int height, window_mode_t window_mode )
|
||||
{
|
||||
if( !glw_state.initialized )
|
||||
{
|
||||
if( !GL_CreateContext( ))
|
||||
return false;
|
||||
|
||||
VID_StartupGamma();
|
||||
while( !GL_CreateContext( ))
|
||||
{
|
||||
glw_state.safe++;
|
||||
if(glw_state.safe > SAFE_DONTCARE)
|
||||
return false;
|
||||
GL_SetupAttributes(); // re-choose attributes
|
||||
}
|
||||
}
|
||||
|
||||
if( !GL_UpdateContext( ))
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#else // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
@@ -991,8 +1017,12 @@ qboolean R_Init_Video( const int type )
|
||||
refState.desktopBitsPixel = 16;
|
||||
#endif
|
||||
|
||||
#ifdef SDL_HINT_QTWAYLAND_WINDOW_FLAGS
|
||||
SDL_SetHint( SDL_HINT_QTWAYLAND_WINDOW_FLAGS, "OverridesSystemGestures" );
|
||||
#endif
|
||||
#ifdef SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION
|
||||
SDL_SetHint( SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION, "landscape" );
|
||||
#endif
|
||||
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 ) && !XASH_WIN32
|
||||
SDL_SetHint( "SDL_VIDEO_X11_XRANDR", "1" );
|
||||
@@ -1018,7 +1048,7 @@ qboolean R_Init_Video( const int type )
|
||||
// refdll can request some attributes
|
||||
GL_SetupAttributes( );
|
||||
|
||||
if( SDL_GL_LoadLibrary( EGL_LIB ) )
|
||||
if( SDL_GL_LoadLibrary( EGL_LIB ) < 0 )
|
||||
{
|
||||
Con_Reportf( S_ERROR "Couldn't initialize OpenGL: %s\n", SDL_GetError());
|
||||
return false;
|
||||
@@ -1057,7 +1087,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
SDL_DisplayMode displayMode;
|
||||
|
||||
SDL_GetCurrentDisplayMode( 0, &displayMode );
|
||||
if( SDL_GetCurrentDisplayMode( 0, &displayMode ) < 0 )
|
||||
{
|
||||
Con_Printf( S_ERROR "SDL_GetCurrentDisplayMode: %s", SDL_GetError( ));
|
||||
return rserr_invalid_mode;
|
||||
}
|
||||
|
||||
// check our desktop attributes
|
||||
refState.desktopBitsPixel = SDL_BITSPERPIXEL( displayMode.format );
|
||||
@@ -1086,8 +1120,11 @@ rserr_t R_ChangeDisplaySettings( int width, int height, window_mode_t window_mod
|
||||
VID_RestoreScreenResolution();
|
||||
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
if( SDL_SetWindowFullscreen( host.hWnd, 0 ))
|
||||
if( SDL_SetWindowFullscreen( host.hWnd, 0 ) < 0 )
|
||||
{
|
||||
Con_Printf( S_ERROR "SDL_SetWindowFullscreen: %s", SDL_GetError( ));
|
||||
return rserr_invalid_fullscreen;
|
||||
}
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 5 )
|
||||
SDL_SetWindowResizable( host.hWnd, SDL_TRUE );
|
||||
#endif
|
||||
|
||||
@@ -28,13 +28,22 @@ GNU General Public License for more details.
|
||||
#include "r_efx.h"
|
||||
#include "com_image.h"
|
||||
#include "filesystem.h"
|
||||
#include "common/protocol.h"
|
||||
|
||||
// RefAPI changelog:
|
||||
// 1. Initial release
|
||||
// 2. FS functions are removed, instead we have full fs_api_t
|
||||
// 3. SlerpBones, CalcBonePosition/Quaternion calls were moved to libpublic/mathlib
|
||||
// 4. R_StudioEstimateFrame now has time argument
|
||||
#define REF_API_VERSION 4
|
||||
// 5. Removed GetSomethingByIndex calls, renderers are supposed to cache pointer values
|
||||
// Removed previously unused calls
|
||||
// Simplified remapping calls
|
||||
// GetRefAPI is now expected to return REF_API_VERSION
|
||||
// 6. Removed timing from ref_globals_t.
|
||||
// Renderers are supposed to migrate to ref_client_t/ref_host_t using PARM_GET_CLIENT_PTR and PARM_GET_HOST_PTR
|
||||
// Removed functions to get internal engine structions. Use PARM_GET_*_PTR instead.
|
||||
// 7. Gamma fixes.
|
||||
#define REF_API_VERSION 7
|
||||
|
||||
|
||||
#define TF_SKY (TF_SKYSIDE|TF_NOMIPMAP)
|
||||
@@ -90,11 +99,6 @@ typedef struct ref_globals_s
|
||||
{
|
||||
qboolean developer;
|
||||
|
||||
float time; // cl.time
|
||||
float oldtime; // cl.oldtime
|
||||
double realtime; // host.realtime
|
||||
double frametime; // host.frametime
|
||||
|
||||
// viewport width and height
|
||||
int width;
|
||||
int height;
|
||||
@@ -116,6 +120,26 @@ typedef struct ref_globals_s
|
||||
int desktopBitsPixel;
|
||||
} ref_globals_t;
|
||||
|
||||
typedef struct ref_client_s
|
||||
{
|
||||
double time;
|
||||
double oldtime;
|
||||
int viewentity;
|
||||
int playernum;
|
||||
int maxclients;
|
||||
int nummodels;
|
||||
model_t *models[MAX_MODELS+1];
|
||||
qboolean paused;
|
||||
vec3_t simorg;
|
||||
} ref_client_t;
|
||||
|
||||
typedef struct ref_host_s
|
||||
{
|
||||
double realtime;
|
||||
double frametime;
|
||||
int features;
|
||||
} ref_host_t;
|
||||
|
||||
enum
|
||||
{
|
||||
GL_KEEP_UNIT = -1,
|
||||
@@ -247,16 +271,18 @@ typedef enum
|
||||
PARM_DEV_OVERVIEW = -1,
|
||||
PARM_THIRDPERSON = -2,
|
||||
PARM_QUAKE_COMPATIBLE = -3,
|
||||
PARM_PLAYER_INDEX = -4, // cl.playernum + 1
|
||||
PARM_VIEWENT_INDEX = -5, // cl.viewentity
|
||||
PARM_GET_CLIENT_PTR = -4, // ref_client_t
|
||||
PARM_GET_HOST_PTR = -5, // ref_host_t
|
||||
PARM_CONNSTATE = -6, // cls.state
|
||||
PARM_PLAYING_DEMO = -7, // cls.demoplayback
|
||||
PARM_WATER_LEVEL = -8, // cl.local.water_level
|
||||
PARM_MAX_CLIENTS = -9, // cl.maxclients
|
||||
PARM_GET_WORLD_PTR = -9, // world
|
||||
PARM_LOCAL_HEALTH = -10, // cl.local.health
|
||||
PARM_LOCAL_GAME = -11,
|
||||
PARM_NUMENTITIES = -12, // local game only
|
||||
PARM_NUMMODELS = -13, // cl.nummodels
|
||||
PARM_GET_MOVEVARS_PTR = -13, // clgame.movevars
|
||||
PARM_GET_PALETTE_PTR = -14, // clgame.palette
|
||||
PARM_GET_VIEWENT_PTR = -15, // clgame.viewent
|
||||
} ref_parm_e;
|
||||
|
||||
typedef struct ref_api_s
|
||||
@@ -299,17 +325,13 @@ typedef struct ref_api_s
|
||||
void (*CL_DrawCenterPrint)( void );
|
||||
|
||||
// entity management
|
||||
struct cl_entity_s *(*GetLocalPlayer)( void );
|
||||
struct cl_entity_s *(*GetViewModel)( void );
|
||||
struct cl_entity_s *(*GetEntityByIndex)( int idx );
|
||||
struct cl_entity_s *(*R_BeamGetEntity)( int index );
|
||||
struct cl_entity_s *(*CL_GetWaterEntity)( const vec3_t p );
|
||||
qboolean (*CL_AddVisibleEntity)( cl_entity_t *ent, int entityType );
|
||||
|
||||
// brushes
|
||||
int (*Mod_SampleSizeForFace)( struct msurface_s *surf );
|
||||
int (*Mod_SampleSizeForFace)( const struct msurface_s *surf );
|
||||
qboolean (*Mod_BoxVisible)( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
||||
struct world_static_s *(*GetWorld)( void ); // returns &world
|
||||
mleaf_t *(*Mod_PointInLeaf)( const vec3_t p, mnode_t *node );
|
||||
void (*Mod_CreatePolygonsForHull)( int hullnum );
|
||||
|
||||
@@ -329,15 +351,10 @@ typedef struct ref_api_s
|
||||
// model management
|
||||
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
|
||||
void *(*Mod_Extradata)( int type, model_t *model );
|
||||
struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle
|
||||
struct model_s *(*Mod_GetCurrentLoadingModel)( void ); // loadmodel
|
||||
void (*Mod_SetCurrentLoadingModel)( struct model_s* ); // loadmodel
|
||||
|
||||
// remap
|
||||
qboolean (*CL_EntitySetRemapColors)( cl_entity_t *e, model_t *mod, int top, int bottom );
|
||||
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
|
||||
void (*CL_AllocRemapInfo)( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor );
|
||||
void (*CL_FreeRemapInfo)( struct remap_info_s *info );
|
||||
void (*CL_UpdateRemapInfo)( cl_entity_t *entity, int topcolor, int bottomcolor );
|
||||
|
||||
// utils
|
||||
void (*CL_ExtraUpdate)( void );
|
||||
@@ -346,9 +363,6 @@ typedef struct ref_api_s
|
||||
float (*COM_RandomFloat)( float rmin, float rmax );
|
||||
int (*COM_RandomLong)( int rmin, int rmax );
|
||||
struct screenfade_s *(*GetScreenFade)( void );
|
||||
struct client_textmessage_s *(*pfnTextMessageGet)( const char *pName );
|
||||
void (*GetPredictedOrigin)( vec3_t v );
|
||||
color24 *(*CL_GetPaletteColor)(int color); // clgame.palette[color]
|
||||
void (*CL_GetScreenInfo)( int *width, int *height ); // clgame.scrInfo, ptrs may be NULL
|
||||
void (*SetLocalLightLevel)( int level ); // cl.local.light_level
|
||||
int (*Sys_CheckParm)( const char *flag );
|
||||
@@ -364,8 +378,8 @@ typedef struct ref_api_s
|
||||
// memory
|
||||
poolhandle_t (*_Mem_AllocPool)( const char *name, const char *filename, int fileline );
|
||||
void (*_Mem_FreePool)( poolhandle_t *poolptr, const char *filename, int fileline );
|
||||
void *(*_Mem_Alloc)( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline );
|
||||
void *(*_Mem_Realloc)( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline );
|
||||
void *(*_Mem_Alloc)( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 2 );
|
||||
void *(*_Mem_Realloc)( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline ) ALLOC_CHECK( 3 );
|
||||
void (*_Mem_Free)( void *data, const char *filename, int fileline );
|
||||
|
||||
// library management
|
||||
@@ -391,9 +405,11 @@ typedef struct ref_api_s
|
||||
void (*SW_UnlockBuffer)( void );
|
||||
|
||||
// gamma
|
||||
void (*BuildGammaTable)( float lightgamma, float brightness );
|
||||
byte (*LightToTexGamma)( byte color ); // software gamma support
|
||||
qboolean (*R_DoResetGamma)( void );
|
||||
byte (*LightToTexGamma)( byte ); // software gamma support
|
||||
uint (*LightToTexGammaEx)( uint ); // software gamma support
|
||||
byte (*TextureToGamma)( byte );
|
||||
uint (*ScreenGammaTable)( uint );
|
||||
uint (*LinearGammaTable)( uint );
|
||||
|
||||
// renderapi
|
||||
lightstyle_t* (*GetLightStyle)( int number );
|
||||
@@ -409,7 +425,6 @@ typedef struct ref_api_s
|
||||
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||
struct pmtrace_s *(*EV_VisTraceLine )( float *start, float *end, int flags );
|
||||
struct pmtrace_s (*CL_TraceLine)( vec3_t start, vec3_t end, int flags );
|
||||
struct movevars_s *(*pfnGetMoveVars)( void );
|
||||
|
||||
// imagelib
|
||||
void (*Image_AddCmdFlags)( uint flags ); // used to check if hardware dxt is supported
|
||||
@@ -422,7 +437,6 @@ typedef struct ref_api_s
|
||||
rgbdata_t *(*FS_CopyImage)( rgbdata_t *in );
|
||||
void (*FS_FreeImage)( rgbdata_t *pack );
|
||||
void (*Image_SetMDLPointer)( byte *p );
|
||||
poolhandle_t (*Image_GetPool)( void );
|
||||
const struct bpc_desc_s *(*Image_GetPFDesc)( int idx );
|
||||
|
||||
// client exports
|
||||
@@ -451,6 +465,8 @@ typedef struct ref_interface_s
|
||||
void (*GL_InitExtensions)( void );
|
||||
void (*GL_ClearExtensions)( void );
|
||||
|
||||
// scene rendering
|
||||
void (*R_GammaChanged)( qboolean do_reset_gamma );
|
||||
void (*R_BeginFrame)( qboolean clearScene );
|
||||
void (*R_RenderScene)( void );
|
||||
void (*R_EndFrame)( void );
|
||||
@@ -465,7 +481,8 @@ typedef struct ref_interface_s
|
||||
|
||||
qboolean (*R_AddEntity)( struct cl_entity_s *clent, int type );
|
||||
void (*CL_AddCustomBeam)( cl_entity_t *pEnvBeam );
|
||||
void (*R_ProcessEntData)( qboolean allocate );
|
||||
void (*R_ProcessEntData)( qboolean allocate, cl_entity_t *entities, unsigned int max_entities );
|
||||
void (*R_Flush)( unsigned int flush_flags );
|
||||
|
||||
// debug
|
||||
void (*R_ShowTextures)( void );
|
||||
@@ -506,7 +523,7 @@ typedef struct ref_interface_s
|
||||
|
||||
// bmodel
|
||||
void (*R_InitSkyClouds)( struct mip_s *mt, struct texture_s *tx, qboolean custom_palette );
|
||||
void (*GL_SubdivideSurface)( msurface_t *fa );
|
||||
void (*GL_SubdivideSurface)( model_t *mod, msurface_t *fa );
|
||||
void (*CL_RunLightStyles)( void );
|
||||
|
||||
// sprites
|
||||
@@ -638,6 +655,8 @@ typedef int (*REFAPI)( int version, ref_interface_t *pFunctionTable, ref_api_t*
|
||||
#define ENGINE_SHARED_CVAR_LIST( f ) \
|
||||
ENGINE_SHARED_CVAR_NAME( f, vid_gamma, gamma ) \
|
||||
ENGINE_SHARED_CVAR_NAME( f, vid_brightness, brightness ) \
|
||||
ENGINE_SHARED_CVAR_NAME( f, v_lightgamma, lightgamma ) \
|
||||
ENGINE_SHARED_CVAR_NAME( f, v_direct, direct ) \
|
||||
ENGINE_SHARED_CVAR( f, r_showtextures ) \
|
||||
ENGINE_SHARED_CVAR( f, r_speeds ) \
|
||||
ENGINE_SHARED_CVAR( f, r_fullbright ) \
|
||||
@@ -659,7 +678,6 @@ typedef int (*REFAPI)( int version, ref_interface_t *pFunctionTable, ref_api_t*
|
||||
ENGINE_SHARED_CVAR( f, r_sprite_lighting ) \
|
||||
ENGINE_SHARED_CVAR( f, r_drawviewmodel ) \
|
||||
ENGINE_SHARED_CVAR( f, r_glowshellfreq ) \
|
||||
ENGINE_SHARED_CVAR( f, r_lighting_modulate ) \
|
||||
|
||||
#define DECLARE_ENGINE_SHARED_CVAR_LIST() \
|
||||
ENGINE_SHARED_CVAR_LIST( DECLARE_ENGINE_SHARED_CVAR )
|
||||
|
||||
@@ -360,7 +360,6 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
qboolean initialized; // sv_init has completed
|
||||
qboolean game_library_loaded; // is game library loaded in SV_InitGame
|
||||
double timestart; // just for profiling
|
||||
|
||||
int maxclients; // server max clients
|
||||
@@ -473,6 +472,8 @@ extern convar_t sv_userinfo_penalty_multiplier;
|
||||
extern convar_t sv_userinfo_penalty_attempts;
|
||||
extern convar_t sv_fullupdate_penalty_time;
|
||||
extern convar_t sv_log_outofband;
|
||||
extern convar_t sv_allow_autoaim;
|
||||
extern convar_t sv_aim;
|
||||
|
||||
//===========================================================
|
||||
//
|
||||
@@ -563,7 +564,7 @@ qboolean SV_IsPlayerIndex( int idx );
|
||||
int SV_CalcPing( sv_client_t *cl );
|
||||
void SV_InitClientMove( void );
|
||||
void SV_UpdateServerInfo( void );
|
||||
void SV_EndRedirect( void );
|
||||
void SV_EndRedirect( host_redirect_t *rd );
|
||||
void SV_RejectConnection( netadr_t from, const char *fmt, ... ) _format( 2 );
|
||||
void SV_GetPlayerCount( int *clients, int *bots );
|
||||
|
||||
|
||||
@@ -639,7 +639,7 @@ void SV_DropClient( sv_client_t *cl, qboolean crash )
|
||||
cl->frames = NULL;
|
||||
|
||||
if( NET_CompareBaseAdr( cl->netchan.remote_address, host.rd.address ))
|
||||
SV_EndRedirect();
|
||||
SV_EndRedirect( &host.rd );
|
||||
|
||||
// throw away any residual garbage in the channel.
|
||||
Netchan_Clear( &cl->netchan );
|
||||
@@ -676,22 +676,19 @@ SVC COMMAND REDIRECT
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
void SV_BeginRedirect( netadr_t adr, rdtype_t target, char *buffer, size_t buffersize, void (*flush))
|
||||
static void SV_BeginRedirect( host_redirect_t *rd, netadr_t adr, rdtype_t target, char *buffer, size_t buffersize, void (*flush))
|
||||
{
|
||||
if( !target || !buffer || !buffersize || !flush )
|
||||
return;
|
||||
|
||||
host.rd.target = target;
|
||||
host.rd.buffer = buffer;
|
||||
host.rd.buffersize = buffersize;
|
||||
host.rd.flush = flush;
|
||||
host.rd.address = adr;
|
||||
host.rd.buffer[0] = 0;
|
||||
if( host.rd.lines == 0 )
|
||||
host.rd.lines = -1;
|
||||
rd->target = target;
|
||||
rd->buffer = buffer;
|
||||
rd->buffersize = buffersize;
|
||||
rd->flush = flush;
|
||||
rd->address = adr;
|
||||
rd->buffer[0] = 0;
|
||||
if( rd->lines == 0 )
|
||||
rd->lines = -1;
|
||||
}
|
||||
|
||||
void SV_FlushRedirect( netadr_t adr, int dest, char *buf )
|
||||
static void SV_FlushRedirect( netadr_t adr, int dest, char *buf )
|
||||
{
|
||||
if( sv.current_client && FBitSet( sv.current_client->flags, FCL_FAKECLIENT ))
|
||||
return;
|
||||
@@ -712,18 +709,18 @@ void SV_FlushRedirect( netadr_t adr, int dest, char *buf )
|
||||
}
|
||||
}
|
||||
|
||||
void SV_EndRedirect( void )
|
||||
void SV_EndRedirect( host_redirect_t *rd )
|
||||
{
|
||||
if( host.rd.lines > 0 )
|
||||
if( rd->lines > 0 )
|
||||
return;
|
||||
|
||||
if( host.rd.flush )
|
||||
host.rd.flush( host.rd.address, host.rd.target, host.rd.buffer );
|
||||
if( rd->flush )
|
||||
rd->flush( rd->address, rd->target, rd->buffer );
|
||||
|
||||
host.rd.target = 0;
|
||||
host.rd.buffer = NULL;
|
||||
host.rd.buffersize = 0;
|
||||
host.rd.flush = NULL;
|
||||
rd->target = RD_NONE;
|
||||
rd->buffer = NULL;
|
||||
rd->buffersize = 0;
|
||||
rd->flush = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -733,24 +730,26 @@ Rcon_Print
|
||||
Print message to rcon buffer and send to rcon redirect target
|
||||
================
|
||||
*/
|
||||
void Rcon_Print( const char *pMsg )
|
||||
void Rcon_Print( host_redirect_t *rd, const char *pMsg )
|
||||
{
|
||||
if( host.rd.target && host.rd.lines && host.rd.flush && host.rd.buffer )
|
||||
size_t len;
|
||||
|
||||
if( !rd->target || !rd->lines || !rd->flush || !rd->buffer )
|
||||
return;
|
||||
|
||||
len = Q_strncat( rd->buffer, pMsg, rd->buffersize );
|
||||
|
||||
if( len && rd->buffer[len - 1] == '\n' )
|
||||
{
|
||||
size_t len = Q_strncat( host.rd.buffer, pMsg, host.rd.buffersize );
|
||||
rd->flush( rd->address, rd->target, rd->buffer );
|
||||
|
||||
if( len && host.rd.buffer[len-1] == '\n' )
|
||||
{
|
||||
host.rd.flush( host.rd.address, host.rd.target, host.rd.buffer );
|
||||
if( rd->lines > 0 )
|
||||
rd->lines--;
|
||||
|
||||
if( host.rd.lines > 0 )
|
||||
host.rd.lines--;
|
||||
rd->buffer[0] = 0;
|
||||
|
||||
host.rd.buffer[0] = 0;
|
||||
|
||||
if( !host.rd.lines )
|
||||
Msg( "End of redirection!\n" );
|
||||
}
|
||||
if( !rd->lines )
|
||||
Msg( "End of redirection!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1090,7 +1089,7 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
||||
|
||||
if( Rcon_Validate( ))
|
||||
{
|
||||
SV_BeginRedirect( from, RD_PACKET, outputbuf, sizeof( outputbuf ) - 16, SV_FlushRedirect );
|
||||
SV_BeginRedirect( &host.rd, from, RD_PACKET, outputbuf, sizeof( outputbuf ) - 16, SV_FlushRedirect );
|
||||
|
||||
remaining[0] = 0;
|
||||
for( i = 2; i < Cmd_Argc(); i++ )
|
||||
@@ -1101,7 +1100,7 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
||||
}
|
||||
Cmd_ExecuteString( remaining );
|
||||
|
||||
SV_EndRedirect();
|
||||
SV_EndRedirect( &host.rd );
|
||||
}
|
||||
else Con_Printf( S_ERROR "Bad rcon_password.\n" );
|
||||
}
|
||||
@@ -1772,6 +1771,9 @@ static qboolean SV_ShouldUpdateUserinfo( sv_client_t *cl )
|
||||
if( FBitSet( cl->flags, FCL_FAKECLIENT ))
|
||||
return allow;
|
||||
|
||||
if( Host_IsLocalGame( ))
|
||||
return allow;
|
||||
|
||||
// start from 1 second
|
||||
if( !cl->userinfo_penalty )
|
||||
cl->userinfo_penalty = sv_userinfo_penalty_time.value;
|
||||
|
||||
@@ -121,8 +121,10 @@ void SV_ParseConsistencyResponse( sv_client_t *cl, sizebuf_t *msg )
|
||||
{
|
||||
value = MSG_ReadUBitLong( msg, 32 );
|
||||
|
||||
LittleLongSW( value );
|
||||
|
||||
// will be compare only first 4 bytes
|
||||
if( value != *(int *)r->rgucMD5_hash )
|
||||
if( memcmp( &value, r->rgucMD5_hash, 4 ))
|
||||
badresindex = idx + 1;
|
||||
}
|
||||
else
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user