mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-06 04:05:11 +08:00
Compare commits
919 Commits
continuous
...
continuous
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98acbbad01 | ||
|
|
eb72b6baee | ||
|
|
422addcbb6 | ||
|
|
4a58be2aa0 | ||
|
|
562b54839c | ||
|
|
639eaa9416 | ||
|
|
6c6cb65b30 | ||
|
|
8ea8437e19 | ||
|
|
2656eb1aeb | ||
|
|
fa1e92b127 | ||
|
|
cff8ee13e6 | ||
|
|
3956e3863e | ||
|
|
9600218757 | ||
|
|
2db7cb0d64 | ||
|
|
267a70d621 | ||
|
|
667bedab82 | ||
|
|
49990a0859 | ||
|
|
f7c4cd9398 | ||
|
|
cd4f4d5ad4 | ||
|
|
fe429fe213 | ||
|
|
0a24ca3fe2 | ||
|
|
8c93a0d247 | ||
|
|
5c75dda864 | ||
|
|
55bdded6a4 | ||
|
|
25b2c0f7e3 | ||
|
|
ed522852cf | ||
|
|
224e42d345 | ||
|
|
128a1f59a9 | ||
|
|
40ffde0439 | ||
|
|
ec5578a437 | ||
|
|
1cf40a2d17 | ||
|
|
958ea0ac1d | ||
|
|
a9fdae28b2 | ||
|
|
3d9eb869b0 | ||
|
|
8162c6d42f | ||
|
|
48a9f17222 | ||
|
|
e381d04094 | ||
|
|
0e79326571 | ||
|
|
f7eb8cd913 | ||
|
|
a15c1f99b2 | ||
|
|
ba2191172d | ||
|
|
6ab2c9dbbf | ||
|
|
7da460d4b1 | ||
|
|
ffe7b1f4a1 | ||
|
|
6a1f502d25 | ||
|
|
434359ea01 | ||
|
|
ae2ad6ddf2 | ||
|
|
ec11683dc5 | ||
|
|
47318b0c14 | ||
|
|
60d6214ad7 | ||
|
|
a3e26a21a7 | ||
|
|
d0f3a6f74b | ||
|
|
fee236a050 | ||
|
|
e3e4bcc015 | ||
|
|
2d546ccbf7 | ||
|
|
b41804bb5b | ||
|
|
47a04df189 | ||
|
|
2efedaf46c | ||
|
|
49e43c830b | ||
|
|
763e101208 | ||
|
|
e39a62b1fd | ||
|
|
da76abda75 | ||
|
|
829d7d0a7e | ||
|
|
9f6372b305 | ||
|
|
12edd782c6 | ||
|
|
0b59fa9416 | ||
|
|
cc0f12ed26 | ||
|
|
f42553d0e1 | ||
|
|
e7564420c9 | ||
|
|
e81a0ded11 | ||
|
|
a32c702dbd | ||
|
|
23a5ed71de | ||
|
|
245dc97cfb | ||
|
|
ece204c30f | ||
|
|
1bd59096fd | ||
|
|
0b02c2c6a7 | ||
|
|
6a61a499e9 | ||
|
|
6b1c283082 | ||
|
|
5402a9611e | ||
|
|
43e06ccd45 | ||
|
|
f52c825bf5 | ||
|
|
bf8b709372 | ||
|
|
fdf82e5270 | ||
|
|
0224a1b66b | ||
|
|
505ad6d69b | ||
|
|
5bcd573821 | ||
|
|
c5a291d9c7 | ||
|
|
232a8c1148 | ||
|
|
663f6eaf5c | ||
|
|
9d3210259c | ||
|
|
4ec6c2f7cf | ||
|
|
8452bec877 | ||
|
|
0d4296e0e1 | ||
|
|
2b85da3bc9 | ||
|
|
17f194b9a3 | ||
|
|
ff47fbaedc | ||
|
|
87c88f7463 | ||
|
|
60fd5f7ab8 | ||
|
|
5ceab059dc | ||
|
|
67c898f9ad | ||
|
|
d903187eea | ||
|
|
653f0841e4 | ||
|
|
10bfadb556 | ||
|
|
0b2cc066dd | ||
|
|
60ab13d216 | ||
|
|
f90c658567 | ||
|
|
0c54895877 | ||
|
|
4eb54328f8 | ||
|
|
b1189db9c5 | ||
|
|
869578f1ba | ||
|
|
3320f776ce | ||
|
|
1d64635783 | ||
|
|
bbb076c0d4 | ||
|
|
fe2a4d0428 | ||
|
|
6bdc1941e6 | ||
|
|
9188905145 | ||
|
|
3f2fbb10d8 | ||
|
|
9c97235fe8 | ||
|
|
70a13b47db | ||
|
|
18afaf0eaf | ||
|
|
8b8c3d8116 | ||
|
|
514fc9fe43 | ||
|
|
5d8923d69c | ||
|
|
5db880af57 | ||
|
|
c05db9ce58 | ||
|
|
04079abe00 | ||
|
|
8054b69f73 | ||
|
|
b5ee777466 | ||
|
|
96f3061709 | ||
|
|
420c5a4ff3 | ||
|
|
e8f6476e8c | ||
|
|
65ec35b732 | ||
|
|
8d731b5d15 | ||
|
|
38c0dc4551 | ||
|
|
4d8cb0469f | ||
|
|
62cb8f5ba6 | ||
|
|
97c75d96d5 | ||
|
|
f5ae806b31 | ||
|
|
482dc3a5a5 | ||
|
|
a8539ac004 | ||
|
|
9970c56218 | ||
|
|
480218412a | ||
|
|
6ae09d2866 | ||
|
|
609680b328 | ||
|
|
ccbe370c8e | ||
|
|
9706e47643 | ||
|
|
d98361f782 | ||
|
|
ba7c789ec9 | ||
|
|
d128997d40 | ||
|
|
61342547ce | ||
|
|
c1a5f173b8 | ||
|
|
f5c5b7b2c8 | ||
|
|
057b47555d | ||
|
|
43299f6747 | ||
|
|
03bf6cb719 | ||
|
|
3a1bb12830 | ||
|
|
5efa68757e | ||
|
|
afaf5bf3ea | ||
|
|
50c805826f | ||
|
|
35ae9f4a64 | ||
|
|
d7d96c02a2 | ||
|
|
dd03723144 | ||
|
|
26f07196ea | ||
|
|
8c291fdfe3 | ||
|
|
d1e118f07c | ||
|
|
6c531c14e6 | ||
|
|
433213c915 | ||
|
|
ab0c0b18c2 | ||
|
|
29fd5f9fbe | ||
|
|
882d8afc93 | ||
|
|
e11635d15c | ||
|
|
5d79d93aac | ||
|
|
7ccf651fd0 | ||
|
|
67af41cce8 | ||
|
|
e2c96e62e1 | ||
|
|
2ecae442fc | ||
|
|
a1060b0eb5 | ||
|
|
ddd8de888f | ||
|
|
a758dffbc1 | ||
|
|
87775faeca | ||
|
|
ef0fc46ed8 | ||
|
|
138b4fa247 | ||
|
|
47d1f3459c | ||
|
|
4712aae834 | ||
|
|
2900ee1cde | ||
|
|
c6c4178dd2 | ||
|
|
a3ce0e6b1b | ||
|
|
0b1ad3b7f0 | ||
|
|
37fb46f092 | ||
|
|
bc8bf9a9fb | ||
|
|
9e28c98911 | ||
|
|
0a1269d52d | ||
|
|
2e5bc31c9e | ||
|
|
1b335fd945 | ||
|
|
0c8b2d007a | ||
|
|
9ee1b32e2d | ||
|
|
953ad98a16 | ||
|
|
1357057bd8 | ||
|
|
35c9323de6 | ||
|
|
13a0afef06 | ||
|
|
c7ad8e4bf6 | ||
|
|
f1754bdd5f | ||
|
|
c462a1c500 | ||
|
|
0bba184994 | ||
|
|
178602ea1f | ||
|
|
2eb8f88a20 | ||
|
|
96d11df06c | ||
|
|
950d210ec5 | ||
|
|
55c1bddac5 | ||
|
|
ac50c762d7 | ||
|
|
5c2ab150b3 | ||
|
|
0870536405 | ||
|
|
b47ede477a | ||
|
|
eef5cc17b3 | ||
|
|
ad2191333d | ||
|
|
a85cac497d | ||
|
|
e0c69d7df5 | ||
|
|
ff3d91ceb4 | ||
|
|
5777431577 | ||
|
|
cd86f80203 | ||
|
|
8c885d3f37 | ||
|
|
dddb46a6d0 | ||
|
|
6b0f378c5b | ||
|
|
9dd7f37d42 | ||
|
|
9f10fb6472 | ||
|
|
64dbccb9bd | ||
|
|
9a432a5a13 | ||
|
|
842e494fa6 | ||
|
|
7fc9ee154a | ||
|
|
5f84010c2a | ||
|
|
3dcd6cb80b | ||
|
|
79e94bf766 | ||
|
|
3de370f3d5 | ||
|
|
c84d2f4624 | ||
|
|
380a9f7a6f | ||
|
|
a6c7b67d0d | ||
|
|
c13c1f2577 | ||
|
|
151405618f | ||
|
|
70e11cc309 | ||
|
|
7619824d80 | ||
|
|
f3d181b5ee | ||
|
|
55055a70f0 | ||
|
|
22d3ba674e | ||
|
|
ac487a2133 | ||
|
|
4da3a14adc | ||
|
|
69ec810ed0 | ||
|
|
2df01316ce | ||
|
|
3a67aefee2 | ||
|
|
d114dffcb4 | ||
|
|
7bb5d9a67a | ||
|
|
a6b1e57ae1 | ||
|
|
c70c13eb5c | ||
|
|
d905ea354e | ||
|
|
99cec81894 | ||
|
|
5d5bccf1bb | ||
|
|
6fcf0a77af | ||
|
|
e7477c0abf | ||
|
|
85540855c3 | ||
|
|
2dc220b42f | ||
|
|
2d6cadbf1b | ||
|
|
340871e03a | ||
|
|
e222a74960 | ||
|
|
ab499d5095 | ||
|
|
a5f7027229 | ||
|
|
bf5cf897e2 | ||
|
|
d33c1af549 | ||
|
|
677464d04d | ||
|
|
d2d6ed8bd4 | ||
|
|
bd2a44dbdd | ||
|
|
e9ee4beb9f | ||
|
|
3b3f057f6f | ||
|
|
a9dec51e59 | ||
|
|
257312ad7c | ||
|
|
6ee8a2dfa7 | ||
|
|
75c5e9cfa7 | ||
|
|
1a94f2b585 | ||
|
|
f0b4c42c68 | ||
|
|
9be061735f | ||
|
|
6bfa525080 | ||
|
|
8fcaf18897 | ||
|
|
f558cde266 | ||
|
|
b508a33f5d | ||
|
|
b4db99006b | ||
|
|
8994f079a5 | ||
|
|
b2d184cfa5 | ||
|
|
92dc92379f | ||
|
|
2a6862ceb9 | ||
|
|
4c569e1d5f | ||
|
|
4420ffd49e | ||
|
|
fb7f57cf6a | ||
|
|
8be3bdac5d | ||
|
|
2785376bd3 | ||
|
|
d6e77e531d | ||
|
|
e686b1410d | ||
|
|
2c23a1e0a0 | ||
|
|
47eb9e8c8f | ||
|
|
712b354421 | ||
|
|
18ef4922de | ||
|
|
274f9d5846 | ||
|
|
f6fa085fe4 | ||
|
|
9ab0f04ba5 | ||
|
|
fb7854f1ef | ||
|
|
1086c31503 | ||
|
|
3a47248a09 | ||
|
|
71a333261b | ||
|
|
5ea2e295c1 | ||
|
|
1fc7547a53 | ||
|
|
a7d63649f8 | ||
|
|
2f26fcdc2a | ||
|
|
107d4cdd61 | ||
|
|
52f9aad4d0 | ||
|
|
7bb5175084 | ||
|
|
dd570b616b | ||
|
|
943a30af04 | ||
|
|
eabed60e56 | ||
|
|
f793413a79 | ||
|
|
f4a3b8571d | ||
|
|
da6586b847 | ||
|
|
4a5f34089d | ||
|
|
90da9659d1 | ||
|
|
2e30acf611 | ||
|
|
5554d13f7f | ||
|
|
a5ef33b302 | ||
|
|
9a2588f7eb | ||
|
|
cac5852e68 | ||
|
|
d52d50e283 | ||
|
|
6911da8581 | ||
|
|
e70f9a67b8 | ||
|
|
173aa7333a | ||
|
|
2396b2d4db | ||
|
|
6120c0daec | ||
|
|
790f9bde54 | ||
|
|
7a469fb481 | ||
|
|
d4a2011a59 | ||
|
|
9165832caf | ||
|
|
d274a5c13c | ||
|
|
e6bd15c68b | ||
|
|
38bef99f98 | ||
|
|
95ff9e7165 | ||
|
|
2fddbdddee | ||
|
|
465e812ed9 | ||
|
|
3b1fb79a85 | ||
|
|
0f8f35b415 | ||
|
|
a133b1c2a9 | ||
|
|
fa74acb5f0 | ||
|
|
836b4c358f | ||
|
|
982e32d108 | ||
|
|
024a335505 | ||
|
|
963cbf61e4 | ||
|
|
6d98d2c7c3 | ||
|
|
64726f13e1 | ||
|
|
85dfaaa2c2 | ||
|
|
42a915b04a | ||
|
|
42a8aa6c66 | ||
|
|
56464d3291 | ||
|
|
aed96ee753 | ||
|
|
a937320c65 | ||
|
|
a81a0cb059 | ||
|
|
5af9511505 | ||
|
|
14ae9b312d | ||
|
|
2d3e5c2e0b | ||
|
|
17950fec3e | ||
|
|
2009140da8 | ||
|
|
2a394eee62 | ||
|
|
09a7585643 | ||
|
|
a09084ceba | ||
|
|
147e5dceff | ||
|
|
3510afd30b | ||
|
|
d3586c2143 | ||
|
|
56ba2325c1 | ||
|
|
b77a4ed3a1 | ||
|
|
9b86c3127a | ||
|
|
0da7ffe45f | ||
|
|
30b78d9559 | ||
|
|
c16abc0b85 | ||
|
|
708c691cdb | ||
|
|
31c20ac4d8 | ||
|
|
1458014a29 | ||
|
|
1c84a5c8ad | ||
|
|
6728b843f7 | ||
|
|
1b55104d51 | ||
|
|
76978bfd47 | ||
|
|
6ff3231dab | ||
|
|
64716e6b42 | ||
|
|
a1191eb4ab | ||
|
|
166bed732e | ||
|
|
02cb12e4b4 | ||
|
|
159467ad44 | ||
|
|
2a006086c5 | ||
|
|
e0dc1eec93 | ||
|
|
ab130ee92c | ||
|
|
dabbe09918 | ||
|
|
296a7ac11d | ||
|
|
6bbf08893e | ||
|
|
f8b958738a | ||
|
|
1b4427f13f | ||
|
|
e55577fd26 | ||
|
|
c42960ec2a | ||
|
|
c033d4b65c | ||
|
|
dc6f03b4e4 | ||
|
|
b6967a432a | ||
|
|
7d0467863c | ||
|
|
a0b72d3995 | ||
|
|
5fe4b867f3 | ||
|
|
40af058406 | ||
|
|
b4376a6a8c | ||
|
|
457422c679 | ||
|
|
080eba948f | ||
|
|
eff86defd9 | ||
|
|
fcb463d400 | ||
|
|
efee8149e2 | ||
|
|
bc32f37fce | ||
|
|
58bfa247a4 | ||
|
|
59b9b31604 | ||
|
|
844af709c0 | ||
|
|
bb6e2d6885 | ||
|
|
6243dc7913 | ||
|
|
45c4362ae6 | ||
|
|
a0230b7e00 | ||
|
|
768755c31a | ||
|
|
3088c7f198 | ||
|
|
c8469071bf | ||
|
|
115fc301b5 | ||
|
|
bc449b8e95 | ||
|
|
74bbc0fe7e | ||
|
|
c73fa3d7a6 | ||
|
|
5694610478 | ||
|
|
ec107dfba5 | ||
|
|
64aa476330 | ||
|
|
42f6719e8d | ||
|
|
244b9dc02b | ||
|
|
fe3644a417 | ||
|
|
e18b61e041 | ||
|
|
d054782693 | ||
|
|
d56e53a347 | ||
|
|
3503c721ac | ||
|
|
0fab5f07d0 | ||
|
|
b0d12f8bf9 | ||
|
|
9fe58aaabc | ||
|
|
03c8ea14cc | ||
|
|
260edc2a08 | ||
|
|
b41591a527 | ||
|
|
4e9481451b | ||
|
|
95b48da37d | ||
|
|
1b36785177 | ||
|
|
8bc76e3d58 | ||
|
|
1a5e2b907d | ||
|
|
3717e5c2e0 | ||
|
|
33a1416199 | ||
|
|
ff4221fbe7 | ||
|
|
486bca82e8 | ||
|
|
611d07fc16 | ||
|
|
f7e12586cf | ||
|
|
f62aa051c8 | ||
|
|
2b6b898102 | ||
|
|
1dd0444531 | ||
|
|
ba9eb01c1f | ||
|
|
73a8144e75 | ||
|
|
6aef422de6 | ||
|
|
5f4b8b60cb | ||
|
|
3256236ba2 | ||
|
|
b102727320 | ||
|
|
3434005e66 | ||
|
|
b3026a7991 | ||
|
|
0a051832a8 | ||
|
|
2dbafbda02 | ||
|
|
240b6fb6f2 | ||
|
|
4163d3655a | ||
|
|
2c7bf49fc9 | ||
|
|
739592e50d | ||
|
|
393e31e509 | ||
|
|
a1dceacc8f | ||
|
|
cf26c87872 | ||
|
|
21195b3491 | ||
|
|
3f66f6a6a5 | ||
|
|
daae4f2f80 | ||
|
|
4e2708c1ac | ||
|
|
d57d8e0d5d | ||
|
|
9577a6af21 | ||
|
|
107a6aed01 | ||
|
|
2c2045d413 | ||
|
|
30fe471d2b | ||
|
|
5ab6979633 | ||
|
|
ec5e9cb6e3 | ||
|
|
f4b4546197 | ||
|
|
f047749e61 | ||
|
|
87840ce91d | ||
|
|
bf31e9f634 | ||
|
|
f86d84daed | ||
|
|
41ed920d35 | ||
|
|
df23ddb545 | ||
|
|
767556ccad | ||
|
|
f9dab2ad19 | ||
|
|
66cb3a6120 | ||
|
|
7672a370da | ||
|
|
870e47ed03 | ||
|
|
32d4bdb80f | ||
|
|
929dfd2c71 | ||
|
|
f437af6451 | ||
|
|
413a0fb2e5 | ||
|
|
793adadb06 | ||
|
|
999b43b89f | ||
|
|
bd60c88c7d | ||
|
|
23b9a2eddf | ||
|
|
0b57d97c8c | ||
|
|
6255293dd4 | ||
|
|
04136d95a3 | ||
|
|
40aa29e42a | ||
|
|
a709f30da9 | ||
|
|
0796c14e79 | ||
|
|
a9c0a4be23 | ||
|
|
3e1209d3a4 | ||
|
|
caf14c1b7c | ||
|
|
27f7d2c8d2 | ||
|
|
8ee430eda2 | ||
|
|
484e4cb225 | ||
|
|
b080ad9954 | ||
|
|
f6625d9188 | ||
|
|
1eb2816bc4 | ||
|
|
077be5aaf3 | ||
|
|
d59875f114 | ||
|
|
e89191ed39 | ||
|
|
ea21438637 | ||
|
|
0d2e8333e8 | ||
|
|
338399e622 | ||
|
|
27cab8aad5 | ||
|
|
1545a49b4c | ||
|
|
3ca15250e8 | ||
|
|
6cbac51731 | ||
|
|
e310c666b1 | ||
|
|
677b0170aa | ||
|
|
9150b770e4 | ||
|
|
2ad6511c31 | ||
|
|
0848f28d83 | ||
|
|
5d9bc950ce | ||
|
|
714da79395 | ||
|
|
823fe9ebbd | ||
|
|
4bf72b5383 | ||
|
|
51945f002b | ||
|
|
bcca9387de | ||
|
|
b8417fa46d | ||
|
|
85b0699288 | ||
|
|
6c03fb0226 | ||
|
|
a084dea07c | ||
|
|
2e0fc3e4c1 | ||
|
|
24f4d410ce | ||
|
|
052e0445ab | ||
|
|
758c908d5a | ||
|
|
3917c2589d | ||
|
|
f4a77308ec | ||
|
|
103b9724f9 | ||
|
|
75a315ecf0 | ||
|
|
63b3b9ef6d | ||
|
|
a6c2cfe89b | ||
|
|
5120657386 | ||
|
|
e754de46d1 | ||
|
|
5d718aa0d6 | ||
|
|
55fcbc8880 | ||
|
|
e19aa001b2 | ||
|
|
b447ea9c18 | ||
|
|
13274655d4 | ||
|
|
3723ac60ef | ||
|
|
da578f47f1 | ||
|
|
433e7de686 | ||
|
|
e18e9ae2ea | ||
|
|
27d5123a61 | ||
|
|
89b9f9ffe2 | ||
|
|
a17b8aaa13 | ||
|
|
e210969612 | ||
|
|
1208356b92 | ||
|
|
d7cd74fe2f | ||
|
|
31b63e9939 | ||
|
|
b99c2c2df1 | ||
|
|
94d3eff9ce | ||
|
|
b78e9961c6 | ||
|
|
b0704ca5d6 | ||
|
|
31c0934108 | ||
|
|
37083c8aef | ||
|
|
af23b0c67b | ||
|
|
a9e83fb9cf | ||
|
|
51126e1691 | ||
|
|
dd410a2de5 | ||
|
|
7ccb0b5c02 | ||
|
|
7f3e62e456 | ||
|
|
fcfc29d7ea | ||
|
|
2f3429a144 | ||
|
|
20782693f4 | ||
|
|
0cfb354374 | ||
|
|
9be5b7c6c9 | ||
|
|
e7653d2ea6 | ||
|
|
1494887e29 | ||
|
|
42dab2b1a5 | ||
|
|
36a0c1fb17 | ||
|
|
60c6767337 | ||
|
|
75451cc7fa | ||
|
|
db10035d9d | ||
|
|
de21d845ec | ||
|
|
320f8466e6 | ||
|
|
f3208e95b2 | ||
|
|
ea34bc8652 | ||
|
|
3daf014af8 | ||
|
|
ca9d3d262a | ||
|
|
a08f5e439d | ||
|
|
8f6771dff4 | ||
|
|
cd47c6b5b3 | ||
|
|
1f4f3d7fda | ||
|
|
e81b5144b3 | ||
|
|
9ec1caed53 | ||
|
|
ca3b4a9d7f | ||
|
|
87ac217887 | ||
|
|
213650db8f | ||
|
|
ac46164a6e | ||
|
|
6d12d84e94 | ||
|
|
2a18cde60c | ||
|
|
35783bcec2 | ||
|
|
1677835b45 | ||
|
|
2f2780cb1b | ||
|
|
95b134b5a6 | ||
|
|
f60e856f35 | ||
|
|
2ec0d25d85 | ||
|
|
fcd0982524 | ||
|
|
6881ee742d | ||
|
|
f070bbef3c | ||
|
|
dd8c66d90e | ||
|
|
f995d055b5 | ||
|
|
fed65dd497 | ||
|
|
c896425ad9 | ||
|
|
4107bd4e0f | ||
|
|
156b2b2b10 | ||
|
|
13a063bf7d | ||
|
|
ef786b7d79 | ||
|
|
5c0c1b1226 | ||
|
|
d041b2aa27 | ||
|
|
f6d489e038 | ||
|
|
d34fedea69 | ||
|
|
80b3f90091 | ||
|
|
2a4fafc3f9 | ||
|
|
9b3ccf5f04 | ||
|
|
f59ac2360a | ||
|
|
ff21fb42e6 | ||
|
|
288cac69de | ||
|
|
2640b6d869 | ||
|
|
d8910b0e38 | ||
|
|
049bed555e | ||
|
|
fe5944720b | ||
|
|
665c46b281 | ||
|
|
975ab6785e | ||
|
|
6fa4dbfba2 | ||
|
|
0506a1dfce | ||
|
|
908a9930e6 | ||
|
|
7d7e72196b | ||
|
|
7cc67157e5 | ||
|
|
b7ff9c7a24 | ||
|
|
aab1fa1ba2 | ||
|
|
effeba2f44 | ||
|
|
e039ef35c0 | ||
|
|
599a1f026e | ||
|
|
39cba17f01 | ||
|
|
17e106f96d | ||
|
|
081cf9132b | ||
|
|
6a7e027248 | ||
|
|
27100e7751 | ||
|
|
75d9ed341a | ||
|
|
1a0867523d | ||
|
|
7584bbe47e | ||
|
|
505b6cc264 | ||
|
|
24f23908be | ||
|
|
43bd73f37b | ||
|
|
bb2753cbfc | ||
|
|
5568eccc8a | ||
|
|
c3b2cc4423 | ||
|
|
d84130219f | ||
|
|
d97d4d6c42 | ||
|
|
15798aaf52 | ||
|
|
e53892e827 | ||
|
|
cb12af69ed | ||
|
|
e82050a4bc | ||
|
|
e4edd2da45 | ||
|
|
4f80922358 | ||
|
|
ae7ed03376 | ||
|
|
c082e46662 | ||
|
|
b0bbcab6b4 | ||
|
|
0fc83080ec | ||
|
|
73883b504f | ||
|
|
8efc9d74e8 | ||
|
|
373321ff00 | ||
|
|
a508467aac | ||
|
|
abbe993e80 | ||
|
|
c644e4d569 | ||
|
|
c200e008f1 | ||
|
|
e95a2da6d0 | ||
|
|
8afca1a79c | ||
|
|
827c9ca857 | ||
|
|
2416635ba3 | ||
|
|
39eec89580 | ||
|
|
98d88266a6 | ||
|
|
0f3359fc05 | ||
|
|
6c77608c34 | ||
|
|
abdff6eff6 | ||
|
|
95a75465c9 | ||
|
|
119926805f | ||
|
|
f749b5cb4b | ||
|
|
c29ad6b598 | ||
|
|
4c5dfb963e | ||
|
|
e11f9e05d4 | ||
|
|
5c8b5b3511 | ||
|
|
2ea7162287 | ||
|
|
e62ab51842 | ||
|
|
f1bc9b87b1 | ||
|
|
a9bddaac64 | ||
|
|
6cef6f6a75 | ||
|
|
25ea6ed500 | ||
|
|
3d5173f257 | ||
|
|
05ff0d6020 | ||
|
|
3cea12627e | ||
|
|
b59b7c1a8d | ||
|
|
dd2c369df3 | ||
|
|
8b79e49a0f | ||
|
|
4ea6eba8f2 | ||
|
|
f649076bc3 | ||
|
|
8ecffa4663 | ||
|
|
e90b83849a | ||
|
|
d517b9717a | ||
|
|
2c0d6e06be | ||
|
|
dec71850a1 | ||
|
|
b1860972c6 | ||
|
|
1f4c9b67da | ||
|
|
c2da125358 | ||
|
|
31fa990d44 | ||
|
|
d3e60c7d84 | ||
|
|
e2424b4303 | ||
|
|
240563cd1b | ||
|
|
d708cd58fb | ||
|
|
491b503f96 | ||
|
|
636a2228f6 | ||
|
|
bb03e2597c | ||
|
|
21c828ee40 | ||
|
|
132c9de142 | ||
|
|
9d9507d77f | ||
|
|
7daa6c3451 | ||
|
|
c8e1ffe0dd | ||
|
|
b5f02324a6 | ||
|
|
47f5dfdcfd | ||
|
|
33da68b013 | ||
|
|
618ec83c9d | ||
|
|
85de61ebc8 | ||
|
|
2feaae59f7 | ||
|
|
2550d7fbd3 | ||
|
|
565f717804 | ||
|
|
b56c83a2f9 | ||
|
|
bf17996f72 | ||
|
|
a3acb1c85b | ||
|
|
d4d63301e0 | ||
|
|
e9af0c9810 | ||
|
|
131ad9c790 | ||
|
|
bfcaba54dc | ||
|
|
f67736180b | ||
|
|
725b7ea7f9 | ||
|
|
600d574376 | ||
|
|
04f42df7d5 | ||
|
|
ab15662d78 | ||
|
|
072b0cef27 | ||
|
|
e274c62cfc | ||
|
|
a28d45fdb2 | ||
|
|
6ca5f7c6fb | ||
|
|
af316bff14 | ||
|
|
c8945caefc | ||
|
|
8c61a2f021 | ||
|
|
0b24810927 | ||
|
|
b3d8fb03bf | ||
|
|
02c5890c2f | ||
|
|
0579e40857 | ||
|
|
c77f290bc6 | ||
|
|
7bf9407177 | ||
|
|
b41fe076ae | ||
|
|
a7c422fde6 | ||
|
|
568a394a40 | ||
|
|
2b6a550405 | ||
|
|
7200f0da7e | ||
|
|
d3c3c26618 | ||
|
|
7152393089 | ||
|
|
661e60720d | ||
|
|
bf959da7ff | ||
|
|
75d476f9df | ||
|
|
b077822f4d | ||
|
|
6d3f188675 | ||
|
|
0231f5e8ac | ||
|
|
901b35d4b1 | ||
|
|
eaafd0ff13 | ||
|
|
963d9b8f2a | ||
|
|
5696c9c96a | ||
|
|
862b9e68be | ||
|
|
2f2890cd11 | ||
|
|
482aa840e7 | ||
|
|
4599983c8e | ||
|
|
11172838f2 | ||
|
|
47bc50b8c6 | ||
|
|
7c82766a5c | ||
|
|
5d6cf62405 | ||
|
|
edc08e39ef | ||
|
|
a9846e765d | ||
|
|
aa54309d5c | ||
|
|
443317bedf | ||
|
|
ffd320507f | ||
|
|
60df08c11c | ||
|
|
7d464df107 | ||
|
|
296f89acf9 | ||
|
|
5f31417bae | ||
|
|
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 |
28
.builds/alpine.yml
Normal file
28
.builds/alpine.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
image: alpine/latest
|
||||||
|
packages:
|
||||||
|
- build-base
|
||||||
|
- sdl2-dev
|
||||||
|
- freetype-dev
|
||||||
|
- fontconfig-dev
|
||||||
|
- opus-dev
|
||||||
|
- bzip2-dev
|
||||||
|
sources:
|
||||||
|
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||||
|
tasks:
|
||||||
|
- client: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
||||||
|
- server: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||||
|
- run-tests: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
export SDL_VIDEODRIVER=wayland
|
||||||
|
./xash3d -runtests
|
||||||
|
./xash -runtests
|
||||||
|
rm -rf valve/gameinfo.txt test_*
|
||||||
|
- package: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
tar -cjvf xash3d-fwgs-alpine-amd64.tar.bz2 *
|
||||||
|
artifacts:
|
||||||
|
- xash3d-fwgs/bin/xash3d-fwgs-alpine-amd64.tar.bz2
|
||||||
31
.builds/debian-arm64.yml
Normal file
31
.builds/debian-arm64.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
image: debian/sid
|
||||||
|
arch: amd64
|
||||||
|
packages:
|
||||||
|
- build-essential
|
||||||
|
- python-is-python3
|
||||||
|
- libsdl2-dev
|
||||||
|
- libfreetype-dev
|
||||||
|
- libfontconfig-dev
|
||||||
|
- libopus-dev
|
||||||
|
- libbz2-dev
|
||||||
|
sources:
|
||||||
|
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||||
|
tasks:
|
||||||
|
- client: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
||||||
|
- server: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||||
|
- run-tests: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
export SDL_VIDEODRIVER=wayland
|
||||||
|
./xash3d -runtests
|
||||||
|
./xash -runtests
|
||||||
|
rm -rf valve/gameinfo.txt test_*
|
||||||
|
- package: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
tar -cjvf xash3d-fwgs-debian-arm64.tar.bz2 *
|
||||||
|
artifacts:
|
||||||
|
- xash3d-fwgs/bin/xash3d-fwgs-debian-arm64.tar.bz2
|
||||||
|
|
||||||
30
.builds/debian.yml
Normal file
30
.builds/debian.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
image: debian/sid
|
||||||
|
packages:
|
||||||
|
- build-essential
|
||||||
|
- python-is-python3
|
||||||
|
- libsdl2-dev
|
||||||
|
- libfreetype-dev
|
||||||
|
- libfontconfig-dev
|
||||||
|
- libopus-dev
|
||||||
|
- libbz2-dev
|
||||||
|
sources:
|
||||||
|
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||||
|
tasks:
|
||||||
|
- client: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
./waf configure -8 --enable-tests --enable-engine-tests build install --destdir=bin
|
||||||
|
- server: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||||
|
- run-tests: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
export SDL_VIDEODRIVER=wayland
|
||||||
|
./xash3d -runtests
|
||||||
|
./xash -runtests
|
||||||
|
rm -rf valve/gameinfo.txt test_*
|
||||||
|
- package: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
tar -cjvf xash3d-fwgs-debian-amd64.tar.bz2 *
|
||||||
|
artifacts:
|
||||||
|
- xash3d-fwgs/bin/xash3d-fwgs-debian-amd64.tar.bz2
|
||||||
|
|
||||||
30
.builds/freebsd.yml
Normal file
30
.builds/freebsd.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
image: freebsd/latest
|
||||||
|
packages:
|
||||||
|
- lang/python
|
||||||
|
- devel/pkgconf
|
||||||
|
- devel/sdl20
|
||||||
|
- print/freetype2
|
||||||
|
- x11-fonts/fontconfig
|
||||||
|
- audio/opus
|
||||||
|
- archivers/bzip2
|
||||||
|
sources:
|
||||||
|
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||||
|
tasks:
|
||||||
|
- client: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
./waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
||||||
|
- server: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
./waf configure --reconfigure --dedicated build install --destdir=bin
|
||||||
|
- run-tests: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
export SDL_VIDEODRIVER=wayland
|
||||||
|
./xash3d -runtests
|
||||||
|
./xash -runtests
|
||||||
|
rm -rf valve/gameinfo.txt test_*
|
||||||
|
- package: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
tar -cjvf xash3d-fwgs-freebsd-amd64.tar.bz2 *
|
||||||
|
artifacts:
|
||||||
|
- xash3d-fwgs/bin/xash3d-fwgs-freebsd-amd64.tar.bz2
|
||||||
|
|
||||||
30
.builds/netbsd.yml
Normal file
30
.builds/netbsd.yml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
image: netbsd/latest
|
||||||
|
packages:
|
||||||
|
- python311
|
||||||
|
- SDL2
|
||||||
|
- freetype2
|
||||||
|
- fontconfig
|
||||||
|
- libopus
|
||||||
|
- pkgconf
|
||||||
|
- bzip2
|
||||||
|
sources:
|
||||||
|
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||||
|
tasks:
|
||||||
|
- client: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
python3.11 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
||||||
|
- server: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
python3.11 waf configure --reconfigure --dedicated build install --destdir=bin
|
||||||
|
- run-tests: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
export SDL_VIDEODRIVER=wayland
|
||||||
|
./xash3d -runtests
|
||||||
|
./xash -runtests
|
||||||
|
rm -rf valve/gameinfo.txt test_*
|
||||||
|
- package: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
tar -cjvf xash3d-fwgs-netbsd-amd64.tar.bz2 *
|
||||||
|
artifacts:
|
||||||
|
- xash3d-fwgs/bin/xash3d-fwgs-netbsd-amd64.tar.bz2
|
||||||
|
|
||||||
27
.builds/openbsd.yml
Normal file
27
.builds/openbsd.yml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
image: openbsd/latest
|
||||||
|
packages:
|
||||||
|
- python3
|
||||||
|
- sdl2
|
||||||
|
- opus
|
||||||
|
- bzip2
|
||||||
|
sources:
|
||||||
|
- https://git.sr.ht/~a1batross/xash3d-fwgs
|
||||||
|
tasks:
|
||||||
|
- client: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
python3 waf configure --enable-tests --enable-engine-tests build install --destdir=bin
|
||||||
|
- server: |
|
||||||
|
cd xash3d-fwgs
|
||||||
|
python3 waf configure --reconfigure --dedicated build install --destdir=bin
|
||||||
|
- run-tests: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
export SDL_VIDEODRIVER=wayland
|
||||||
|
./xash3d -runtests
|
||||||
|
./xash -runtests
|
||||||
|
rm -rf valve/gameinfo.txt test_*
|
||||||
|
- package: |
|
||||||
|
cd xash3d-fwgs/bin
|
||||||
|
tar -cjvf xash3d-fwgs-openbsd-amd64.tar.bz2 *
|
||||||
|
artifacts:
|
||||||
|
- xash3d-fwgs/bin/xash3d-fwgs-openbsd-amd64.tar.bz2
|
||||||
|
|
||||||
26
.cirrus.yml
26
.cirrus.yml
@@ -1,31 +1,7 @@
|
|||||||
task:
|
|
||||||
name: freebsd-12-amd64
|
|
||||||
freebsd_instance:
|
|
||||||
image_family: freebsd-12-4
|
|
||||||
setup_script:
|
|
||||||
- pkg update
|
|
||||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
|
||||||
- git submodule update --init --recursive
|
|
||||||
test_script:
|
|
||||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
|
||||||
- ./scripts/cirrus/build_freebsd.sh full
|
|
||||||
|
|
||||||
task:
|
|
||||||
name: freebsd-13-amd64
|
|
||||||
freebsd_instance:
|
|
||||||
image_family: freebsd-13-2
|
|
||||||
setup_script:
|
|
||||||
- pkg update
|
|
||||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
|
||||||
- git submodule update --init --recursive
|
|
||||||
test_script:
|
|
||||||
- ./scripts/cirrus/build_freebsd.sh dedicated
|
|
||||||
- ./scripts/cirrus/build_freebsd.sh full
|
|
||||||
|
|
||||||
task:
|
task:
|
||||||
name: freebsd-14-amd64
|
name: freebsd-14-amd64
|
||||||
freebsd_instance:
|
freebsd_instance:
|
||||||
image_family: freebsd-14-0-snap
|
image_family: freebsd-14-0
|
||||||
setup_script:
|
setup_script:
|
||||||
- pkg update
|
- pkg update
|
||||||
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
- pkg install -y pkgconf git sdl2 python fontconfig opus
|
||||||
|
|||||||
360
.editorconfig
360
.editorconfig
@@ -1,9 +1,365 @@
|
|||||||
# EditorConfig is awesome: https://EditorConfig.org
|
# this file is just a suggestion, you might follow it, you might not
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset = latin1
|
charset = utf-8
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
ij_formatter_off_tag = @formatter:off
|
||||||
|
ij_formatter_on_tag = @formatter:on
|
||||||
|
|
||||||
|
[*.{c++,cc,cpp,cppm,cxx,h,h++,hh,hpp,hxx,inl,ipp,ixx,tlh,tli}]
|
||||||
|
|
||||||
|
# Visual C++ Formatting settings
|
||||||
|
cpp_indent_braces = false
|
||||||
|
cpp_indent_multi_line_relative_to = innermost_parenthesis
|
||||||
|
cpp_indent_within_parentheses = indent
|
||||||
|
cpp_indent_preserve_within_parentheses = true
|
||||||
|
cpp_indent_case_contents = true
|
||||||
|
cpp_indent_case_labels = false
|
||||||
|
cpp_indent_case_contents_when_block = false
|
||||||
|
cpp_indent_lambda_braces_when_parameter = true
|
||||||
|
cpp_indent_goto_labels = one_left
|
||||||
|
cpp_indent_preprocessor = leftmost_column
|
||||||
|
cpp_indent_access_specifiers = false
|
||||||
|
cpp_indent_namespace_contents = true
|
||||||
|
cpp_indent_preserve_comments = false
|
||||||
|
cpp_new_line_before_open_brace_namespace = new_line
|
||||||
|
cpp_new_line_before_open_brace_type = new_line
|
||||||
|
cpp_new_line_before_open_brace_function = new_line
|
||||||
|
cpp_new_line_before_open_brace_block = new_line
|
||||||
|
cpp_new_line_before_open_brace_lambda = new_line
|
||||||
|
cpp_new_line_scope_braces_on_separate_lines = true
|
||||||
|
cpp_new_line_close_brace_same_line_empty_type = false
|
||||||
|
cpp_new_line_close_brace_same_line_empty_function = false
|
||||||
|
cpp_new_line_before_catch = true
|
||||||
|
cpp_new_line_before_else = true
|
||||||
|
cpp_new_line_before_while_in_do_while = false
|
||||||
|
cpp_space_before_function_open_parenthesis = remove
|
||||||
|
cpp_space_within_parameter_list_parentheses = true
|
||||||
|
cpp_space_between_empty_parameter_list_parentheses = true
|
||||||
|
cpp_space_after_keywords_in_control_flow_statements = false
|
||||||
|
cpp_space_within_control_flow_statement_parentheses = true
|
||||||
|
cpp_space_before_lambda_open_parenthesis = false
|
||||||
|
cpp_space_within_cast_parentheses = false
|
||||||
|
cpp_space_after_cast_close_parenthesis = false
|
||||||
|
cpp_space_within_expression_parentheses = true
|
||||||
|
cpp_space_before_block_open_brace = true
|
||||||
|
cpp_space_between_empty_braces = true
|
||||||
|
cpp_space_before_initializer_list_open_brace = false
|
||||||
|
cpp_space_within_initializer_list_braces = true
|
||||||
|
cpp_space_preserve_in_initializer_list = true
|
||||||
|
cpp_space_before_open_square_bracket = false
|
||||||
|
cpp_space_within_square_brackets = false
|
||||||
|
cpp_space_before_empty_square_brackets = false
|
||||||
|
cpp_space_between_empty_square_brackets = false
|
||||||
|
cpp_space_group_square_brackets = true
|
||||||
|
cpp_space_within_lambda_brackets = false
|
||||||
|
cpp_space_between_empty_lambda_brackets = false
|
||||||
|
cpp_space_before_comma = false
|
||||||
|
cpp_space_after_comma = true
|
||||||
|
cpp_space_remove_around_member_operators = true
|
||||||
|
cpp_space_before_inheritance_colon = true
|
||||||
|
cpp_space_before_constructor_colon = true
|
||||||
|
cpp_space_remove_before_semicolon = true
|
||||||
|
cpp_space_after_semicolon = true
|
||||||
|
cpp_space_remove_around_unary_operator = true
|
||||||
|
cpp_space_around_binary_operator = insert
|
||||||
|
cpp_space_around_assignment_operator = insert
|
||||||
|
cpp_space_pointer_reference_alignment = right
|
||||||
|
cpp_space_around_ternary_operator = insert
|
||||||
|
cpp_use_unreal_engine_macro_formatting = true
|
||||||
|
cpp_wrap_preserve_blocks = one_liners
|
||||||
|
|
||||||
|
# IDEA settings
|
||||||
|
ij_c_add_brief_tag = false
|
||||||
|
ij_c_add_getter_prefix = true
|
||||||
|
ij_c_add_setter_prefix = true
|
||||||
|
ij_c_align_dictionary_pair_values = false
|
||||||
|
ij_c_align_group_field_declarations = false
|
||||||
|
ij_c_align_init_list_in_columns = true
|
||||||
|
ij_c_align_multiline_array_initializer_expression = false
|
||||||
|
ij_c_align_multiline_assignment = false
|
||||||
|
ij_c_align_multiline_binary_operation = false
|
||||||
|
ij_c_align_multiline_chained_methods = false
|
||||||
|
ij_c_align_multiline_for = true
|
||||||
|
ij_c_align_multiline_ternary_operation = false
|
||||||
|
ij_c_array_initializer_comma_on_next_line = false
|
||||||
|
ij_c_array_initializer_new_line_after_left_brace = false
|
||||||
|
ij_c_array_initializer_right_brace_on_new_line = false
|
||||||
|
ij_c_array_initializer_wrap = off
|
||||||
|
ij_c_assignment_wrap = off
|
||||||
|
ij_c_binary_operation_sign_on_next_line = false
|
||||||
|
ij_c_binary_operation_wrap = off
|
||||||
|
ij_c_blank_lines_after_class_header = 0
|
||||||
|
ij_c_blank_lines_after_imports = 1
|
||||||
|
ij_c_blank_lines_around_class = 1
|
||||||
|
ij_c_blank_lines_around_field = 0
|
||||||
|
ij_c_blank_lines_around_field_in_interface = 0
|
||||||
|
ij_c_blank_lines_around_method = 1
|
||||||
|
ij_c_blank_lines_around_method_in_interface = 1
|
||||||
|
ij_c_blank_lines_around_namespace = 0
|
||||||
|
ij_c_blank_lines_around_properties_in_declaration = 0
|
||||||
|
ij_c_blank_lines_around_properties_in_interface = 0
|
||||||
|
ij_c_blank_lines_before_imports = 1
|
||||||
|
ij_c_blank_lines_before_method_body = 0
|
||||||
|
ij_c_block_brace_placement = next_line
|
||||||
|
ij_c_block_brace_style = next_line
|
||||||
|
ij_c_block_comment_at_first_column = true
|
||||||
|
ij_c_catch_on_new_line = false
|
||||||
|
ij_c_class_brace_style = next_line
|
||||||
|
ij_c_class_constructor_init_list_align_multiline = true
|
||||||
|
ij_c_class_constructor_init_list_comma_on_next_line = false
|
||||||
|
ij_c_class_constructor_init_list_new_line_after_colon = never
|
||||||
|
ij_c_class_constructor_init_list_new_line_before_colon = if_long
|
||||||
|
ij_c_class_constructor_init_list_wrap = normal
|
||||||
|
ij_c_copy_is_deep = false
|
||||||
|
ij_c_create_interface_for_categories = true
|
||||||
|
ij_c_declare_generated_methods = true
|
||||||
|
ij_c_description_include_member_names = true
|
||||||
|
ij_c_discharged_short_ternary_operator = false
|
||||||
|
ij_c_do_not_add_breaks = false
|
||||||
|
ij_c_do_while_brace_force = never
|
||||||
|
ij_c_else_on_new_line = false
|
||||||
|
ij_c_enum_constants_comma_on_next_line = false
|
||||||
|
ij_c_enum_constants_wrap = off
|
||||||
|
ij_c_for_brace_force = never
|
||||||
|
ij_c_for_statement_new_line_after_left_paren = false
|
||||||
|
ij_c_for_statement_right_paren_on_new_line = false
|
||||||
|
ij_c_for_statement_wrap = off
|
||||||
|
ij_c_function_brace_placement = next_line
|
||||||
|
ij_c_function_call_arguments_align_multiline = true
|
||||||
|
ij_c_function_call_arguments_align_multiline_pars = false
|
||||||
|
ij_c_function_call_arguments_comma_on_next_line = false
|
||||||
|
ij_c_function_call_arguments_new_line_after_lpar = false
|
||||||
|
ij_c_function_call_arguments_new_line_before_rpar = false
|
||||||
|
ij_c_function_call_arguments_wrap = normal
|
||||||
|
ij_c_function_non_top_after_return_type_wrap = normal
|
||||||
|
ij_c_function_parameters_align_multiline = true
|
||||||
|
ij_c_function_parameters_align_multiline_pars = false
|
||||||
|
ij_c_function_parameters_comma_on_next_line = false
|
||||||
|
ij_c_function_parameters_new_line_after_lpar = false
|
||||||
|
ij_c_function_parameters_new_line_before_rpar = false
|
||||||
|
ij_c_function_parameters_wrap = normal
|
||||||
|
ij_c_function_top_after_return_type_wrap = normal
|
||||||
|
ij_c_generate_additional_eq_operators = true
|
||||||
|
ij_c_generate_additional_rel_operators = true
|
||||||
|
ij_c_generate_class_constructor = true
|
||||||
|
ij_c_generate_comparison_operators_use_std_tie = false
|
||||||
|
ij_c_generate_instance_variables_for_properties = ask
|
||||||
|
ij_c_generate_operators_as_members = true
|
||||||
|
ij_c_header_guard_style_pattern = ${PROJECT_NAME}_${FILE_NAME}_${EXT}
|
||||||
|
ij_c_if_brace_force = never
|
||||||
|
ij_c_in_line_short_ternary_operator = true
|
||||||
|
ij_c_indent_block_comment = true
|
||||||
|
ij_c_indent_c_struct_members = 4
|
||||||
|
ij_c_indent_case_from_switch = true
|
||||||
|
ij_c_indent_class_members = 4
|
||||||
|
ij_c_indent_directive_as_code = false
|
||||||
|
ij_c_indent_implementation_members = 0
|
||||||
|
ij_c_indent_inside_code_block = 4
|
||||||
|
ij_c_indent_interface_members = 0
|
||||||
|
ij_c_indent_interface_members_except_ivars_block = false
|
||||||
|
ij_c_indent_namespace_members = 4
|
||||||
|
ij_c_indent_preprocessor_directive = 0
|
||||||
|
ij_c_indent_visibility_keywords = 0
|
||||||
|
ij_c_insert_override = true
|
||||||
|
ij_c_insert_virtual_with_override = false
|
||||||
|
ij_c_introduce_auto_consts = false
|
||||||
|
ij_c_introduce_auto_vars = false
|
||||||
|
ij_c_introduce_const_params = false
|
||||||
|
ij_c_introduce_const_vars = false
|
||||||
|
ij_c_introduce_constexpr_consts = false
|
||||||
|
ij_c_introduce_generate_property = false
|
||||||
|
ij_c_introduce_generate_synthesize = true
|
||||||
|
ij_c_introduce_globals_to_header = true
|
||||||
|
ij_c_introduce_prop_to_private_category = false
|
||||||
|
ij_c_introduce_static_consts = true
|
||||||
|
ij_c_introduce_use_ns_types = false
|
||||||
|
ij_c_ivars_prefix = _
|
||||||
|
ij_c_ivars_suffix =
|
||||||
|
ij_c_keep_blank_lines_before_end = 2
|
||||||
|
ij_c_keep_blank_lines_before_right_brace = 2
|
||||||
|
ij_c_keep_blank_lines_in_code = 2
|
||||||
|
ij_c_keep_blank_lines_in_declarations = 2
|
||||||
|
ij_c_keep_case_expressions_in_one_line = false
|
||||||
|
ij_c_keep_control_statement_in_one_line = false
|
||||||
|
ij_c_keep_directive_at_first_column = true
|
||||||
|
ij_c_keep_first_column_comment = false
|
||||||
|
ij_c_keep_line_breaks = true
|
||||||
|
ij_c_keep_nested_namespaces_in_one_line = false
|
||||||
|
ij_c_keep_simple_blocks_in_one_line = false
|
||||||
|
ij_c_keep_simple_methods_in_one_line = false
|
||||||
|
ij_c_keep_structures_in_one_line = false
|
||||||
|
ij_c_lambda_capture_list_align_multiline = false
|
||||||
|
ij_c_lambda_capture_list_align_multiline_bracket = false
|
||||||
|
ij_c_lambda_capture_list_comma_on_next_line = false
|
||||||
|
ij_c_lambda_capture_list_new_line_after_lbracket = false
|
||||||
|
ij_c_lambda_capture_list_new_line_before_rbracket = false
|
||||||
|
ij_c_lambda_capture_list_wrap = off
|
||||||
|
ij_c_line_comment_add_space = false
|
||||||
|
ij_c_line_comment_at_first_column = true
|
||||||
|
ij_c_method_brace_placement = end_of_line
|
||||||
|
ij_c_method_call_arguments_align_by_colons = true
|
||||||
|
ij_c_method_call_arguments_align_multiline = false
|
||||||
|
ij_c_method_call_arguments_special_dictionary_pairs_treatment = true
|
||||||
|
ij_c_method_call_arguments_wrap = off
|
||||||
|
ij_c_method_call_chain_wrap = off
|
||||||
|
ij_c_method_parameters_align_by_colons = true
|
||||||
|
ij_c_method_parameters_align_multiline = false
|
||||||
|
ij_c_method_parameters_wrap = off
|
||||||
|
ij_c_namespace_brace_placement = next_line
|
||||||
|
ij_c_parentheses_expression_new_line_after_left_paren = false
|
||||||
|
ij_c_parentheses_expression_right_paren_on_new_line = false
|
||||||
|
ij_c_place_assignment_sign_on_next_line = false
|
||||||
|
ij_c_property_nonatomic = true
|
||||||
|
ij_c_put_ivars_to_implementation = true
|
||||||
|
ij_c_refactor_compatibility_aliases_and_classes = true
|
||||||
|
ij_c_refactor_properties_and_ivars = true
|
||||||
|
ij_c_release_style = ivar
|
||||||
|
ij_c_retain_object_parameters_in_constructor = true
|
||||||
|
ij_c_semicolon_after_method_signature = false
|
||||||
|
ij_c_shift_operation_align_multiline = true
|
||||||
|
ij_c_shift_operation_wrap = normal
|
||||||
|
ij_c_show_non_virtual_functions = false
|
||||||
|
ij_c_space_after_colon = true
|
||||||
|
ij_c_space_after_colon_in_foreach = true
|
||||||
|
ij_c_space_after_colon_in_selector = false
|
||||||
|
ij_c_space_after_comma = true
|
||||||
|
ij_c_space_after_cup_in_blocks = false
|
||||||
|
ij_c_space_after_dictionary_literal_colon = true
|
||||||
|
ij_c_space_after_for_semicolon = true
|
||||||
|
ij_c_space_after_init_list_colon = true
|
||||||
|
ij_c_space_after_method_parameter_type_parentheses = false
|
||||||
|
ij_c_space_after_method_return_type_parentheses = false
|
||||||
|
ij_c_space_after_pointer_in_declaration = false
|
||||||
|
ij_c_space_after_quest = true
|
||||||
|
ij_c_space_after_reference_in_declaration = false
|
||||||
|
ij_c_space_after_reference_in_rvalue = false
|
||||||
|
ij_c_space_after_structures_rbrace = true
|
||||||
|
ij_c_space_after_superclass_colon = true
|
||||||
|
ij_c_space_after_type_cast = false
|
||||||
|
ij_c_space_after_visibility_sign_in_method_declaration = true
|
||||||
|
ij_c_space_before_autorelease_pool_lbrace = true
|
||||||
|
ij_c_space_before_catch_keyword = true
|
||||||
|
ij_c_space_before_catch_left_brace = true
|
||||||
|
ij_c_space_before_catch_parentheses = false
|
||||||
|
ij_c_space_before_category_parentheses = true
|
||||||
|
ij_c_space_before_chained_send_message = true
|
||||||
|
ij_c_space_before_class_left_brace = true
|
||||||
|
ij_c_space_before_colon = true
|
||||||
|
ij_c_space_before_colon_in_foreach = true
|
||||||
|
ij_c_space_before_comma = false
|
||||||
|
ij_c_space_before_dictionary_literal_colon = true
|
||||||
|
ij_c_space_before_do_left_brace = true
|
||||||
|
ij_c_space_before_else_keyword = true
|
||||||
|
ij_c_space_before_else_left_brace = true
|
||||||
|
ij_c_space_before_export_lbrace = true
|
||||||
|
ij_c_space_before_for_left_brace = true
|
||||||
|
ij_c_space_before_for_parentheses = false
|
||||||
|
ij_c_space_before_for_semicolon = false
|
||||||
|
ij_c_space_before_if_left_brace = true
|
||||||
|
ij_c_space_before_if_parentheses = false
|
||||||
|
ij_c_space_before_init_list = false
|
||||||
|
ij_c_space_before_init_list_colon = true
|
||||||
|
ij_c_space_before_method_call_parentheses = false
|
||||||
|
ij_c_space_before_method_left_brace = true
|
||||||
|
ij_c_space_before_method_parentheses = false
|
||||||
|
ij_c_space_before_namespace_lbrace = true
|
||||||
|
ij_c_space_before_pointer_in_declaration = true
|
||||||
|
ij_c_space_before_property_attributes_parentheses = false
|
||||||
|
ij_c_space_before_protocols_brackets = true
|
||||||
|
ij_c_space_before_quest = true
|
||||||
|
ij_c_space_before_reference_in_declaration = true
|
||||||
|
ij_c_space_before_superclass_colon = true
|
||||||
|
ij_c_space_before_switch_left_brace = true
|
||||||
|
ij_c_space_before_switch_parentheses = false
|
||||||
|
ij_c_space_before_template_call_lt = false
|
||||||
|
ij_c_space_before_template_declaration_lt = true
|
||||||
|
ij_c_space_before_try_left_brace = true
|
||||||
|
ij_c_space_before_while_keyword = true
|
||||||
|
ij_c_space_before_while_left_brace = true
|
||||||
|
ij_c_space_before_while_parentheses = false
|
||||||
|
ij_c_space_between_adjacent_brackets = false
|
||||||
|
ij_c_space_between_operator_and_punctuator = false
|
||||||
|
ij_c_space_within_empty_array_initializer_braces = true
|
||||||
|
ij_c_spaces_around_additive_operators = true
|
||||||
|
ij_c_spaces_around_assignment_operators = true
|
||||||
|
ij_c_spaces_around_bitwise_operators = true
|
||||||
|
ij_c_spaces_around_equality_operators = true
|
||||||
|
ij_c_spaces_around_lambda_arrow = true
|
||||||
|
ij_c_spaces_around_logical_operators = true
|
||||||
|
ij_c_spaces_around_multiplicative_operators = true
|
||||||
|
ij_c_spaces_around_pm_operators = false
|
||||||
|
ij_c_spaces_around_relational_operators = true
|
||||||
|
ij_c_spaces_around_shift_operators = true
|
||||||
|
ij_c_spaces_around_unary_operator = false
|
||||||
|
ij_c_spaces_within_array_initializer_braces = true
|
||||||
|
ij_c_spaces_within_braces = false
|
||||||
|
ij_c_spaces_within_brackets = false
|
||||||
|
ij_c_spaces_within_cast_parentheses = false
|
||||||
|
ij_c_spaces_within_catch_parentheses = true
|
||||||
|
ij_c_spaces_within_category_parentheses = false
|
||||||
|
ij_c_spaces_within_empty_braces = false
|
||||||
|
ij_c_spaces_within_empty_function_call_parentheses = true
|
||||||
|
ij_c_spaces_within_empty_function_declaration_parentheses = true
|
||||||
|
ij_c_spaces_within_empty_lambda_capture_list_bracket = false
|
||||||
|
ij_c_spaces_within_empty_template_call_ltgt = false
|
||||||
|
ij_c_spaces_within_empty_template_declaration_ltgt = false
|
||||||
|
ij_c_spaces_within_for_parentheses = true
|
||||||
|
ij_c_spaces_within_function_call_parentheses = true
|
||||||
|
ij_c_spaces_within_function_declaration_parentheses = true
|
||||||
|
ij_c_spaces_within_if_parentheses = true
|
||||||
|
ij_c_spaces_within_lambda_capture_list_bracket = false
|
||||||
|
ij_c_spaces_within_method_parameter_type_parentheses = false
|
||||||
|
ij_c_spaces_within_method_return_type_parentheses = false
|
||||||
|
ij_c_spaces_within_parentheses = true
|
||||||
|
ij_c_spaces_within_property_attributes_parentheses = false
|
||||||
|
ij_c_spaces_within_protocols_brackets = false
|
||||||
|
ij_c_spaces_within_send_message_brackets = false
|
||||||
|
ij_c_spaces_within_structured_binding_list_bracket = false
|
||||||
|
ij_c_spaces_within_switch_parentheses = true
|
||||||
|
ij_c_spaces_within_template_call_ltgt = false
|
||||||
|
ij_c_spaces_within_template_declaration_ltgt = false
|
||||||
|
ij_c_spaces_within_template_double_gt = false
|
||||||
|
ij_c_spaces_within_while_parentheses = true
|
||||||
|
ij_c_special_else_if_treatment = true
|
||||||
|
ij_c_structured_binding_list_align_multiline = false
|
||||||
|
ij_c_structured_binding_list_align_multiline_bracket = false
|
||||||
|
ij_c_structured_binding_list_comma_on_next_line = false
|
||||||
|
ij_c_structured_binding_list_new_line_after_lbracket = false
|
||||||
|
ij_c_structured_binding_list_new_line_before_rbracket = false
|
||||||
|
ij_c_structured_binding_list_wrap = off
|
||||||
|
ij_c_superclass_list_after_colon = never
|
||||||
|
ij_c_superclass_list_align_multiline = true
|
||||||
|
ij_c_superclass_list_before_colon = if_long
|
||||||
|
ij_c_superclass_list_comma_on_next_line = false
|
||||||
|
ij_c_superclass_list_wrap = on_every_item
|
||||||
|
ij_c_tag_prefix_of_block_comment = at
|
||||||
|
ij_c_tag_prefix_of_line_comment = back_slash
|
||||||
|
ij_c_template_call_arguments_align_multiline = false
|
||||||
|
ij_c_template_call_arguments_align_multiline_pars = false
|
||||||
|
ij_c_template_call_arguments_comma_on_next_line = false
|
||||||
|
ij_c_template_call_arguments_new_line_after_lt = false
|
||||||
|
ij_c_template_call_arguments_new_line_before_gt = false
|
||||||
|
ij_c_template_call_arguments_wrap = off
|
||||||
|
ij_c_template_declaration_function_body_indent = false
|
||||||
|
ij_c_template_declaration_function_wrap = split_into_lines
|
||||||
|
ij_c_template_declaration_struct_body_indent = false
|
||||||
|
ij_c_template_declaration_struct_wrap = split_into_lines
|
||||||
|
ij_c_template_parameters_align_multiline = false
|
||||||
|
ij_c_template_parameters_align_multiline_pars = false
|
||||||
|
ij_c_template_parameters_comma_on_next_line = false
|
||||||
|
ij_c_template_parameters_new_line_after_lt = false
|
||||||
|
ij_c_template_parameters_new_line_before_gt = false
|
||||||
|
ij_c_template_parameters_wrap = off
|
||||||
|
ij_c_ternary_operation_signs_on_next_line = false
|
||||||
|
ij_c_ternary_operation_wrap = off
|
||||||
|
ij_c_type_qualifiers_placement = before
|
||||||
|
ij_c_use_modern_casts = true
|
||||||
|
ij_c_use_setters_in_constructor = true
|
||||||
|
ij_c_while_brace_force = never
|
||||||
|
ij_c_while_on_new_line = false
|
||||||
|
ij_c_wrap_property_declaration = off
|
||||||
|
|||||||
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
custom: https://github.com/FWGS/xash3d-fwgs/blob/master/Documentation/donate.md
|
||||||
88
.github/workflows/c-cpp.yml
vendored
88
.github/workflows/c-cpp.yml
vendored
@@ -24,14 +24,9 @@ jobs:
|
|||||||
# - os: ubuntu-aarch64-20.04
|
# - os: ubuntu-aarch64-20.04
|
||||||
# targetos: linux
|
# targetos: linux
|
||||||
# targetarch: aarch64
|
# targetarch: aarch64
|
||||||
|
- os: ubuntu-20.04
|
||||||
# - os: ubuntu-20.04
|
targetos: android
|
||||||
# targetos: android
|
targetarch: multiarch
|
||||||
# targetarch: 32
|
|
||||||
# - os: ubuntu-20.04
|
|
||||||
# targetos: android
|
|
||||||
# targetarch: 64
|
|
||||||
|
|
||||||
# - os: ubuntu-20.04
|
# - os: ubuntu-20.04
|
||||||
# targetos: motomagx
|
# targetos: motomagx
|
||||||
# targetarch: armv6
|
# targetarch: armv6
|
||||||
@@ -45,84 +40,85 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
targetos: win32
|
targetos: win32
|
||||||
targetarch: amd64
|
targetarch: amd64
|
||||||
- os: windows-latest
|
- os: windows-2019 # always use the oldest possible for 32-bit because of older compilers, and better support of certain legacy OSes
|
||||||
targetos: win32
|
targetos: win32
|
||||||
targetarch: i386
|
targetarch: i386
|
||||||
|
- os: macos-14 # in GitHub documentation, it's an ARM64 machine
|
||||||
|
targetos: apple
|
||||||
|
targetarch: arm64
|
||||||
|
- os: macos-12 # in GitHub documentation, it's an x86 machine
|
||||||
|
targetos: apple
|
||||||
|
targetarch: amd64
|
||||||
env:
|
env:
|
||||||
SDL_VERSION: 2.28.1
|
SDL_VERSION: 2.30.3
|
||||||
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
||||||
ANDROID_SDK_TOOLS_VER: 4333796
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bash scripts/gha/deps_${{ matrix.targetos }}.sh
|
run: bash scripts/gha/deps_${{ matrix.targetos }}.sh
|
||||||
- name: Build engine
|
- name: Build engine
|
||||||
|
env:
|
||||||
|
FWGS_PFX_PASSWORD: ${{ secrets.FWGS_PFX_PASSWORD }}
|
||||||
run: bash scripts/gha/build_${{ matrix.targetos }}.sh
|
run: bash scripts/gha/build_${{ matrix.targetos }}.sh
|
||||||
- name: Upload engine (artifacts)
|
- name: Upload engine (artifacts)
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: artifact-${{ matrix.targetos }}-${{ matrix.targetarch }}
|
name: artifact-${{ matrix.targetos }}-${{ matrix.targetarch }}
|
||||||
path: artifacts/*
|
path: artifacts/*
|
||||||
flatpak:
|
flatpak:
|
||||||
name: "Flatpak"
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- app: su.xash.Engine.Compat.i386
|
- app: su.xash.Engine.Compat.i386
|
||||||
container:
|
container:
|
||||||
image: bilelmoussaoui/flatpak-github-actions:freedesktop-22.08
|
image: bilelmoussaoui/flatpak-github-actions:freedesktop-23.08
|
||||||
options: --privileged
|
options: --privileged
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Build flatpak (Compat.i386)
|
- name: Build flatpak (Compat.i386)
|
||||||
uses: FWGS/flatpak-github-actions/flatpak-builder@v6.1
|
uses: FWGS/flatpak-github-actions/flatpak-builder@v6.3
|
||||||
with:
|
with:
|
||||||
bundle: ${{ matrix.app }}.flatpak
|
bundle: ${{ matrix.app }}.flatpak
|
||||||
manifest-path: scripts/flatpak/${{ matrix.app }}.yml
|
manifest-path: scripts/flatpak/${{ matrix.app }}.yml
|
||||||
- name: Upload engine (artifacts)
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: artifact-${{ matrix.targetos }}-${{ matrix.targetarch }}
|
|
||||||
path: artifacts/*
|
|
||||||
release:
|
release:
|
||||||
name: "Upload releases"
|
name: "Upload releases"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build, flatpak]
|
needs: [build, flatpak]
|
||||||
if: ${{ github.event_name == 'push' }}
|
if: ${{ github.event_name == 'push' }}
|
||||||
steps:
|
steps:
|
||||||
- name: Remove old release
|
- name: Remove old release, fetch artifacts, repackage binaries and upload new release
|
||||||
uses: FWGS/delete-tag-and-release@v0.2.1-dev
|
env:
|
||||||
with:
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
tag_name: ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }}
|
RELEASE_TAG: ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }}
|
||||||
delete_release: true
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Fetch artifacts
|
|
||||||
uses: actions/download-artifact@v3.0.1
|
|
||||||
with:
|
|
||||||
path: artifacts/
|
|
||||||
- name: Repackage binaries and allow GitHub to process removed release for few seconds
|
|
||||||
run: |
|
run: |
|
||||||
cd artifacts/
|
gh release delete "$RELEASE_TAG" \
|
||||||
for i in artifact-* su.xash.Engine.*; do
|
--yes \
|
||||||
|
--cleanup-tag \
|
||||||
|
--repo "$GITHUB_REPOSITORY" || true
|
||||||
|
sleep 20s
|
||||||
|
gh run download "$GITHUB_RUN_ID" \
|
||||||
|
--dir artifacts/ \
|
||||||
|
--repo "$GITHUB_REPOSITORY"
|
||||||
|
pushd artifacts/
|
||||||
|
echo "Found artifacts:"
|
||||||
|
ls
|
||||||
|
for i in $(find -mindepth 1 -maxdepth 1 -type d); do
|
||||||
mv "$i"/* .
|
mv "$i"/* .
|
||||||
rm -rf "$i"
|
rm -rf "$i"
|
||||||
done
|
done
|
||||||
ls -R .
|
echo "Repackaged artifacts:"
|
||||||
cd ../
|
ls -R
|
||||||
|
popd
|
||||||
sleep 20s
|
sleep 20s
|
||||||
- name: Upload new release
|
gh release create "$RELEASE_TAG" artifacts/* \
|
||||||
uses: FWGS/action-gh-release@v0.1.15
|
--title "Xash3D FWGS Continuous ${{ github.ref_name }} Build" \
|
||||||
with:
|
--target $GITHUB_SHA \
|
||||||
name: Xash3D FWGS Continuous ${{ github.ref_name }} Build
|
--repo "$GITHUB_REPOSITORY" \
|
||||||
tag_name: ${{ github.ref_name == 'master' && 'continuous' || format('continuous-{0}', github.ref_name) }}
|
--prerelease
|
||||||
prerelease: true
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
files: artifacts/*
|
|
||||||
draft: false
|
|
||||||
|
|||||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -54,6 +54,11 @@ CMakeFiles
|
|||||||
Makefile
|
Makefile
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
install_manifest.txt
|
install_manifest.txt
|
||||||
|
CMakeLists.txt*
|
||||||
|
CMakeScripts
|
||||||
|
Testing
|
||||||
|
compile_commands.json
|
||||||
|
_deps
|
||||||
# makedepend
|
# makedepend
|
||||||
Makefile.dep
|
Makefile.dep
|
||||||
*.bak
|
*.bak
|
||||||
@@ -337,3 +342,6 @@ enc_temp_folder/
|
|||||||
|
|
||||||
# KDevelop4
|
# KDevelop4
|
||||||
*.kdev4
|
*.kdev4
|
||||||
|
|
||||||
|
# ccls langauge server
|
||||||
|
.ccls-*
|
||||||
|
|||||||
6
.gitmodules
vendored
6
.gitmodules
vendored
@@ -19,3 +19,9 @@
|
|||||||
[submodule "3rdparty/xash-extras"]
|
[submodule "3rdparty/xash-extras"]
|
||||||
path = 3rdparty/extras/xash-extras
|
path = 3rdparty/extras/xash-extras
|
||||||
url = https://github.com/FWGS/xash-extras
|
url = https://github.com/FWGS/xash-extras
|
||||||
|
[submodule "3rdparty/bzip2/bzip2"]
|
||||||
|
path = 3rdparty/bzip2/bzip2
|
||||||
|
url = https://gitlab.com/bzip2/bzip2
|
||||||
|
[submodule "3rdparty/MultiEmulator"]
|
||||||
|
path = 3rdparty/MultiEmulator
|
||||||
|
url = https://github.com/FWGS/MultiEmulator
|
||||||
|
|||||||
1
3rdparty/MultiEmulator
vendored
Submodule
1
3rdparty/MultiEmulator
vendored
Submodule
Submodule 3rdparty/MultiEmulator added at 2f3c3a40cd
1
3rdparty/bzip2/bz_version.h
vendored
Normal file
1
3rdparty/bzip2/bz_version.h
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#define BZ_VERSION "1.1.0-fwgs"
|
||||||
1
3rdparty/bzip2/bzip2
vendored
Submodule
1
3rdparty/bzip2/bzip2
vendored
Submodule
Submodule 3rdparty/bzip2/bzip2 added at 66c46b8c94
34
3rdparty/bzip2/wscript
vendored
Normal file
34
3rdparty/bzip2/wscript
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#! /usr/bin/env python
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
def options(opt):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def configure(conf):
|
||||||
|
conf.define('_GNU_SOURCE', 1)
|
||||||
|
conf.define('BZ_NO_STDIO', 1)
|
||||||
|
|
||||||
|
if conf.env.DEST_OS == 'win32':
|
||||||
|
conf.define('BZ_LCCWIN32', 1)
|
||||||
|
else:
|
||||||
|
conf.define('BZ_UNIX', 1)
|
||||||
|
|
||||||
|
def build(bld):
|
||||||
|
# doesn't work with CMake generator
|
||||||
|
# bld(
|
||||||
|
# features = 'subst',
|
||||||
|
# source = 'bzip2/bz_version.h.in',
|
||||||
|
# target = 'bz_version.h',
|
||||||
|
# BZ_VERSION='1.1.0-fwgs'
|
||||||
|
# )
|
||||||
|
|
||||||
|
bz_sources = ['bzip2/blocksort.c', 'bzip2/huffman.c', 'bzip2/crctable.c', 'bzip2/randtable.c', 'bzip2/compress.c', 'bzip2/decompress.c', 'bzip2/bzlib.c']
|
||||||
|
|
||||||
|
bld.stlib(
|
||||||
|
source = bz_sources,
|
||||||
|
target = 'bzip2',
|
||||||
|
# use = 'bz_version.h',
|
||||||
|
includes = ['.', 'bzip2/'],
|
||||||
|
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||||
|
export_includes = ['bzip2/']
|
||||||
|
)
|
||||||
2
3rdparty/extras/xash-extras
vendored
2
3rdparty/extras/xash-extras
vendored
Submodule 3rdparty/extras/xash-extras updated: 853f633be1...9050d05a7b
2
3rdparty/gl-wes-v2
vendored
2
3rdparty/gl-wes-v2
vendored
Submodule 3rdparty/gl-wes-v2 updated: 7ba4631bf5...d4ed038d13
2
3rdparty/gl4es/gl4es
vendored
2
3rdparty/gl4es/gl4es
vendored
Submodule 3rdparty/gl4es/gl4es updated: 5226f5f937...e39434a2b1
3
3rdparty/gl4es/wscript
vendored
3
3rdparty/gl4es/wscript
vendored
@@ -16,9 +16,8 @@ def build(bld):
|
|||||||
|
|
||||||
bld.stlib(source = gl4es_srcdir.ant_glob(['gl/*.c', 'gl/*/*.c', 'glx/hardext.c']),
|
bld.stlib(source = gl4es_srcdir.ant_glob(['gl/*.c', 'gl/*/*.c', 'glx/hardext.c']),
|
||||||
target = 'gl4es',
|
target = 'gl4es',
|
||||||
features = 'c',
|
|
||||||
includes = ['gl4es/src', 'gl4es/src/gl', 'gl4es/src/glx', 'gl4es/include'],
|
includes = ['gl4es/src', 'gl4es/src/gl', 'gl4es/src/glx', 'gl4es/include'],
|
||||||
defines = ['NOX11', 'NO_GBM', 'NO_INIT_CONSTRUCTOR', 'DEFAULT_ES=2', 'NOEGL', 'EXTERNAL_GETPROCADDRESS=GL4ES_GetProcAddress', 'NO_LOADER', 'STATICLIB'],
|
defines = ['NOX11', 'NO_GBM', 'NO_INIT_CONSTRUCTOR', 'DEFAULT_ES=2', 'NOEGL', 'NO_LOADER', 'STATICLIB'],
|
||||||
cflags = ['-w', '-fvisibility=hidden', '-std=gnu99'],
|
cflags = ['-w', '-fvisibility=hidden', '-std=gnu99'],
|
||||||
subsystem = bld.env.MSVC_SUBSYSTEM,
|
subsystem = bld.env.MSVC_SUBSYSTEM,
|
||||||
export_includes = '.')
|
export_includes = '.')
|
||||||
|
|||||||
2
3rdparty/mainui
vendored
2
3rdparty/mainui
vendored
Submodule 3rdparty/mainui updated: b4bb815420...0bb921ea8d
2
3rdparty/nanogl
vendored
2
3rdparty/nanogl
vendored
Submodule 3rdparty/nanogl updated: 6b6a947ee0...6c0f341b7b
2
3rdparty/opus/opus
vendored
2
3rdparty/opus/opus
vendored
Submodule 3rdparty/opus/opus updated: 8cf872a186...82ac57d9f1
2
3rdparty/opus/wscript
vendored
2
3rdparty/opus/wscript
vendored
@@ -27,7 +27,7 @@ def build(bld):
|
|||||||
'opus/celt/opus_custom_demo.c'
|
'opus/celt/opus_custom_demo.c'
|
||||||
])
|
])
|
||||||
includes = ['opus/include/', 'opus/celt/', 'opus/silk/', 'opus/silk/float/']
|
includes = ['opus/include/', 'opus/celt/', 'opus/silk/', 'opus/silk/float/']
|
||||||
defines = ['USE_ALLOCA', 'OPUS_BUILD', 'FLOAT_APPROX', 'PACKAGE_VERSION="1.3.1"', 'CUSTOM_MODES']
|
defines = ['USE_ALLOCA', 'OPUS_BUILD', 'FLOAT_APPROX', 'PACKAGE_VERSION="1.4.0"', 'CUSTOM_MODES']
|
||||||
|
|
||||||
bld.stlib(
|
bld.stlib(
|
||||||
source = sources,
|
source = sources,
|
||||||
|
|||||||
2
3rdparty/vgui_support
vendored
2
3rdparty/vgui_support
vendored
Submodule 3rdparty/vgui_support updated: f85d64c149...e0ab95229d
@@ -1,17 +1,17 @@
|
|||||||
# Bug-compatibility in Xash3D FWGS
|
# Bug-compatibility in Xash3D FWGS
|
||||||
|
|
||||||
Xash3D FWGS has special mode for games that rely on original engine bugs.
|
Xash3D FWGS has special mode for games that rely on original engine bugs. In this mode, we emulate the behaviour of selected functions that may help running mods relying on engine bugs, but enabling them by default may break majority of other games.
|
||||||
|
|
||||||
In this mode, we emulate the behaviour of selected functions that may help running mods relying on engine bugs, but enabling them by default may break majority of other games.
|
|
||||||
|
|
||||||
At this time, we only have implemented GoldSrc bug-compatibility. It can be enabled with `-bugcomp` command line switch.
|
At this time, we only have implemented GoldSrc bug-compatibility. It can be enabled with `-bugcomp` command line switch.
|
||||||
|
|
||||||
|
When `-bugcomp` is specified without argument, it enables everything. This behavior might be changed or removed in future versions.
|
||||||
|
|
||||||
|
When `-bugcomp` is specified with argument, it interpreted as flags separated with `+`. This way it's possible to combine multiple levels of bug-compatibility.
|
||||||
|
|
||||||
## GoldSrc bug-compatibility
|
## GoldSrc bug-compatibility
|
||||||
|
|
||||||
### Emulated bugs
|
| Flag | Description | Games that require this flag |
|
||||||
|
| ------- | ----------- | ---------------------------- |
|
||||||
* `pfnPEntityOfEntIndex` in GoldSrc returns NULL for last player due to incorrect player index comparison
|
| `peoei` | Reverts `pfnPEntityOfEntIndex` behavior to GoldSrc, where it returns NULL for last player due to incorrect player index comparison | * Counter-Strike: Condition Zero - Deleted Scenes |
|
||||||
|
| `gsmrf` | Rewrites message at the moment when Game DLL attempts to write an internal engine message, usually specific to GoldSrc protocol. Right now only supports `svc_spawnstaticsound`, more messages added by request. | * MetaMod/AMXModX based mods |
|
||||||
### Games and mods that require this
|
| `sp_attn_none` | Makes sounds with attenuation zero spatialized, i.e. have a stereo effect. | Possibly, every game that was made for GoldSrc. |
|
||||||
|
|
||||||
* Counter-Strike: Condition Zero - Deleted Scenes
|
|
||||||
|
|||||||
21
Documentation/environment-variables.md
Normal file
21
Documentation/environment-variables.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
## Environment variables
|
||||||
|
|
||||||
|
#### Xash3D FWGS
|
||||||
|
|
||||||
|
The engine respects these environment variables:
|
||||||
|
|
||||||
|
| Variable | Type | Description |
|
||||||
|
| --------------------- | ---------- | ----------- |
|
||||||
|
| `XASH3D_GAME` | _string_ | Overrides default game directory. Ignored if `-game` command line argument is set |
|
||||||
|
| `XASH3D_BASEDIR` | _string_ | Sets path to base (root) directory, instead of current working directory |
|
||||||
|
| `XASH3D_RODIR` | _string_ | Sets path to read-only base (root) directory. Ignored if `-rodir` command line argument is set |
|
||||||
|
| `XASH3D_EXTRAS_PAK1` | _string_ | Archive file from specified path will be added to virtual filesystem search path in the lowest possible priority |
|
||||||
|
| `XASH3D_EXTRAS_PAK2` | _string_ | Similar to `XASH3D_EXTRAS_PAK1` but next to it in priority list |
|
||||||
|
|
||||||
|
Environment variables NOT listed in the table above are used internally, and aren't considered as stable interface.
|
||||||
|
|
||||||
|
#### mdldec
|
||||||
|
|
||||||
|
| Variable | Type | Description |
|
||||||
|
| --------------------- | ---------- | ----------- |
|
||||||
|
| `MDLDEC_ACT_PATH` | _string_ | If set, will read activities list from this path |
|
||||||
25
Documentation/extensions/native-object.md
Normal file
25
Documentation/extensions/native-object.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# GetNativeObject API
|
||||||
|
|
||||||
|
To be able to use platform-specific features or get optional engine interfaces, we've added a simple call to MobilityAPI on client DLL and PhysicsAPI for server DLL and extended MenuAPI for menu DLL.
|
||||||
|
|
||||||
|
It's defined like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
void *pfnGetNativeObject( const char *name );
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Cross-platform objects
|
||||||
|
|
||||||
|
Only these objects are guaranteed to be available on all targets.
|
||||||
|
|
||||||
|
| Object name | Interface |
|
||||||
|
|-------------|-----------|
|
||||||
|
| `VFileSystem009` | Provides C++ interface to filesystem, binary-compatible with Valve's VFileSystem009. |
|
||||||
|
| `XashFileSystemXXX` | Provides C interface to filesystem. This interface is unstable and not recommended for generic use, outside of engine internals. For more info about current version look into `filesystem.h`. |
|
||||||
|
|
||||||
|
#### Android-specific objects
|
||||||
|
|
||||||
|
| Object name | Interface |
|
||||||
|
|-------------|-----------|
|
||||||
|
| `JNIEnv` | Allows interfacing with Java Native Interface. |
|
||||||
|
| `ActivityClass` | Returns JNI object for engine Android activity class. |
|
||||||
65
Documentation/extensions/sounds.lst.md
Normal file
65
Documentation/extensions/sounds.lst.md
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# sounds.lst.md
|
||||||
|
|
||||||
|
Using sounds.lst located in scripts folder, modder can override some of the hardcoded sounds in temp entities and server physics.
|
||||||
|
|
||||||
|
File format:
|
||||||
|
```
|
||||||
|
<group name>
|
||||||
|
{
|
||||||
|
<path1>
|
||||||
|
<path2>
|
||||||
|
<path3>
|
||||||
|
}
|
||||||
|
|
||||||
|
<group2 name> <path with %d> <min number> <max number>
|
||||||
|
```
|
||||||
|
|
||||||
|
* Sounds can use any supported sound format (WAV or MP3).
|
||||||
|
* The path must be relative to the sounds/ folder in the game or base directory root, addon folder, or archive root.
|
||||||
|
* Groups can be empty or omitted from the file to load no sound.
|
||||||
|
* Groups can either list a set of files or specify a format string and a range.
|
||||||
|
* Anything after // will be considered a comment and ignored.
|
||||||
|
* Behavior is undefined if the group was listed multiple times.
|
||||||
|
|
||||||
|
Currently supported groups are:
|
||||||
|
|Group name|Usage|
|
||||||
|
|----------|-----|
|
||||||
|
|`BouncePlayerShell`|Used for BOUNCE_SHELL tempentity hitsound|
|
||||||
|
|`BounceWeaponShell`|Used for BOUCNE_SHOTSHELL tempentity hitsound|
|
||||||
|
|`BounceConcrete`|Used for BOUNCE_CONCRETE tempentity hitsound|
|
||||||
|
|`BounceGlass`|Used for BOUCNE_GLASS|
|
||||||
|
|`BounceMetal`|Used for BOUNCE_METAL|
|
||||||
|
|`BounceFlesh`|Used for BOUNCE_FLESH|
|
||||||
|
|`BounceWood`|Used for BOUNCE_WOOD|
|
||||||
|
|`Ricochet`|Used for BOUNCE_SHRAP and ricochet tempentities|
|
||||||
|
|`Explode`|Used for tempentity explosions|
|
||||||
|
|`EntityWaterEnter`|Used for entity entering water|
|
||||||
|
|`EntityWaterExit`|Used for entity exiting water|
|
||||||
|
|`PlayerWaterEnter`|Used for player entering water|
|
||||||
|
|`PlayerWaterExit`|Used for player exiting water|
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
This example is based on defaults sounds used in Half-Life:
|
||||||
|
|
||||||
|
```
|
||||||
|
BouncePlayerShell "player/pl_shell%d.wav" 1 3
|
||||||
|
BounceWeaponShell "weapons/sshell%d.wav" 1 3
|
||||||
|
BounceConcrete "debris/concrete%d.wav" 1 3
|
||||||
|
BounceGlass "debris/glass%d.wav" 1 4
|
||||||
|
BounceMetal "debris/metal%d.wav" 1 6
|
||||||
|
BounceFlesh "debris/flesh%d.wav" 1 7
|
||||||
|
BounceWood "debris/wood%d.wav" 1 4
|
||||||
|
Ricochet "weapons/ric%d.wav" 1 5
|
||||||
|
Explode "weapons/explode%d.wav" 3 5
|
||||||
|
EntityWaterEnter "player/pl_wade%d.wav" 1 4
|
||||||
|
EntityWaterExit "player/pl_wade%d.wav" 1 4
|
||||||
|
PlayerWaterEnter
|
||||||
|
{
|
||||||
|
"player/pl_wade1.wav"
|
||||||
|
}
|
||||||
|
PlayerWaterExit
|
||||||
|
{
|
||||||
|
"player/pl_wade2.wav"
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -78,6 +78,7 @@ These strings are specific to Xash3D FWGS.
|
|||||||
| `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. |
|
| `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 |
|
| `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 |
|
| `quicksave_aged_count` | integer | 2 | Quick saves limit used in saves rotation |
|
||||||
|
| `demomap` | string | Empty string | The name of the demo chapter map (Half-Life Uplink) |
|
||||||
|
|
||||||
## Note on GoldSrc liblist.gam support
|
## Note on GoldSrc liblist.gam support
|
||||||
|
|
||||||
|
|||||||
14
Documentation/goldsrc-protocol-support.md
Normal file
14
Documentation/goldsrc-protocol-support.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# Support for GoldSrc network protocol
|
||||||
|
This feature is still work-in-progress, but for now it's available for all users, and we appreciate any bug-reports and contributions around it.
|
||||||
|
|
||||||
|
For connecting to GoldSrc-based servers, use this command:
|
||||||
|
```
|
||||||
|
connect ip:port gs
|
||||||
|
```
|
||||||
|
|
||||||
|
But keep in mind, there are requirement for server to be able to accept connections from Xash3D-based clients: it should accept HLTV connections.
|
||||||
|
Without this requirement, you will just get "Steam validation rejected" error on connecting.
|
||||||
|
|
||||||
|
That is because proper authorization with Steam API is not implemented in engine yet (but we have plans on it).
|
||||||
|
|
||||||
|
In case of ReHLDS with Reunion plugin, by default it rejects HLTV clients. But connections from HLTV can be easily enabled in `reunion.cfg` file.
|
||||||
40
Documentation/hd-textures.md
Normal file
40
Documentation/hd-textures.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
### HD (external) textures support
|
||||||
|
|
||||||
|
Xash3D supports loading texture replacements in TGA format for almost all types of models in the game, except alias models at this time.
|
||||||
|
|
||||||
|
Textures are expected to be located at:
|
||||||
|
* `modfolder/materials/<mapname>` - for a specific map
|
||||||
|
* `modfolder/materials/common` - common for all maps
|
||||||
|
* `modfolder/materials/decals` - for decals
|
||||||
|
* `modfolder/materials/models/<model>` - for models (texture name must match the internal texture name in the model)
|
||||||
|
|
||||||
|
Support for high-resolution textures is enabled setting `host_allow_materials` cvar to `1` or in the menu, in "Video options" section.
|
||||||
|
|
||||||
|
#### Xash3D FWGS additions
|
||||||
|
|
||||||
|
In addition to paths above, Xash3D FWGS checks following paths:
|
||||||
|
|
||||||
|
* `modfolder/materials/sprites/<sprite>` - for sprites, except HUD sprites
|
||||||
|
|
||||||
|
Also, to check which texture replacements are loaded successfully, failed or weren't found, a mod developer can set `host_allow_materials` cvar value to `2`. The engine will spew log at any developer level in the following format:
|
||||||
|
|
||||||
|
```
|
||||||
|
Looking for <replacement> replacement... <status code> (<path relative to mod directory>)
|
||||||
|
```
|
||||||
|
|
||||||
|
Status codes:
|
||||||
|
* `OK` - texture replacement file was found and loaded into GPU memory successfully
|
||||||
|
* `FAIL` - texture file was found but hasn't been parsed or loaded successfully. Refer to engine log for more details.
|
||||||
|
* `MISS` - texture file wasn't found
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
Looking for maps/bounce.bsp:!waterblue tex replacement...OK (materials/common/!waterblue.tga)
|
||||||
|
Looking for maps/bounce.bsp:!waterblue_luma tex replacement...MISS (not found)
|
||||||
|
Looking for {shot2 decal replacement...MISS (materials/decals/{shot2.tga)
|
||||||
|
Looking for {shot4 decal replacement...MISS (materials/decals/{shot4.tga)
|
||||||
|
Looking for {shot3 decal replacement...MISS (materials/decals/{shot3.tga)
|
||||||
|
Looking for models/gman tex replacement...FAIL (materials/models/gman/GMan_Case1.tga)
|
||||||
|
Looking for models/gman tex replacement...FAIL (materials/models/gman/inside_1.tga)
|
||||||
|
```
|
||||||
|
|
||||||
15
Documentation/musl.md
Normal file
15
Documentation/musl.md
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Xash3D FWGS on `musl`
|
||||||
|
|
||||||
|
Xash3D FWGS works on `musl` out of the box. However, the engine doesn't try to differentiate glibc and musl anymore. If you see error similar to:
|
||||||
|
|
||||||
|
```
|
||||||
|
Host_InitError: can't initialize cl_dlls/client.so: Error relocating valve/cl_dlls/client.so: __sprintf_chk: symbol not found
|
||||||
|
```
|
||||||
|
|
||||||
|
... or you know that the game you're running is linked against glibc, you can try using `libgcompat`, like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ LD_PRELOAD=/lib/libgcompat.so.0 ./xash3d ...
|
||||||
|
```
|
||||||
|
|
||||||
|
It will automatically add the missing symbols that glibc binaries usually need. In the future we might automatically link engine against `libgcompat` for better compatibility with prebuilt or closed-source games, if there will be any use for this.
|
||||||
@@ -240,6 +240,8 @@ CSO-like Xash3D-based mod, CSMoE - https://github.com/MoeMod/CSMoE
|
|||||||
## Crack-Life: Campaign Mode
|
## Crack-Life: Campaign Mode
|
||||||
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/crack_life
|
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/crack_life
|
||||||
|
|
||||||
|
Reverse-engineered code: branch **clcampaign** in hlsdk-portable - https://github.com/FWGS/hlsdk-portable/tree/clcampaign
|
||||||
|
|
||||||
## Escape from the Darkness
|
## Escape from the Darkness
|
||||||
malortie's recreation - https://github.com/malortie/hl-eftd
|
malortie's recreation - https://github.com/malortie/hl-eftd
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,22 @@
|
|||||||
- [List of XashXT-based mods](#list-of-xashxt-based-mods)
|
- [List of XashXT-based mods](#list-of-xashxt-based-mods)
|
||||||
- [List of maps for They Hunger](#list-of-maps-for-they-hunger)
|
- [List of maps for They Hunger](#list-of-maps-for-they-hunger)
|
||||||
- [List of games and mods with custom gamedll](#list-of-games-and-mods-with-custom-gamedll)
|
- [List of games and mods with custom gamedll](#list-of-games-and-mods-with-custom-gamedll)
|
||||||
- [List of mods for Counter Strike(Android only)](#list-of-mods-for-counter-strike)
|
- [List of mods for Counter Strike](#list-of-mods-for-counter-strike)
|
||||||
|
- [List of supported mods from mobile_hacks branch of HLSDK Portable by FWGS](#list-of-supported-mods-from-mobile_hacks-branch-of-hlsdk-portable-by-fwgs)
|
||||||
|
|
||||||
|
# List of supported mods from mobile_hacks branch of HLSDK Portable by FWGS
|
||||||
|
1. [Afraid of Monsters](https://www.moddb.com/mods/afraid-of-monsters/downloads/afraid-of-monsters-v1)
|
||||||
|
2. [Big Lolly](https://www.moddb.com/mods/big-lolly)
|
||||||
|
3. [Half-Life: Blue Shift](https://store.steampowered.com/app/130/HalfLife_Blue_Shift/)
|
||||||
|
4. [Half-Secret](https://www.moddb.com/mods/half-secret)
|
||||||
|
5. [Case Closed](https://www.moddb.com/mods/caseclosed)
|
||||||
|
6. [Bloody Pizza - Vendetta](https://www.moddb.com/games/half-life/addons/bloody-pizza-vendetta)
|
||||||
|
7. [Borderlands](https://www.moddb.com/games/half-life/addons/borderlands-v04)
|
||||||
|
8. [Half-Life: Induction](https://www.moddb.com/mods/half-life-induction/downloads/half-life-induction-12)
|
||||||
|
9. [Redemption/Absolute Redemption](https://www.moddb.com/mods/absolute-redemption)
|
||||||
|
10. [Sewer beta](https://www.moddb.com/games/half-life/addons/sewer-beta)
|
||||||
|
11. [Times of Troubles](https://www.moddb.com/mods/times-of-troubles)
|
||||||
|
12. [Half-Life: Urbicide](https://www.moddb.com/mods/half-life-urbicide)
|
||||||
|
|
||||||
# List of Half-Life-based mods
|
# List of Half-Life-based mods
|
||||||
Originally this list was written by *Qwertyus*(*Qortez*)
|
Originally this list was written by *Qwertyus*(*Qortez*)
|
||||||
@@ -176,7 +191,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
|||||||
143. [Operation: Nova](http://www.moddb.com/mods/half-life-operation-nova) (there is an inner bug with an M60 machinegun on a map with Osprey: it can be activated and used if you are staying in front of it, not behind it)
|
143. [Operation: Nova](http://www.moddb.com/mods/half-life-operation-nova) (there is an inner bug with an M60 machinegun on a map with Osprey: it can be activated and used if you are staying in front of it, not behind it)
|
||||||
144. [Optimum Fear](https://www.fileplanet.com/7472/0/fileinfo/Optimum-Fear)
|
144. [Optimum Fear](https://www.fileplanet.com/7472/0/fileinfo/Optimum-Fear)
|
||||||
145. [Outrun](http://www.moddb.com/mods/outrun)
|
145. [Outrun](http://www.moddb.com/mods/outrun)
|
||||||
146. [Outwards (Day One)](https://drive.google.com/file/d/1mjQ8wUazYbwTq9Ocg0Vs0raq4avbTRne/view?usp=sharing)
|
146. [Outwards (Day One)](https://web.archive.org/web/20161026104825/http://visgi.info/maps/)
|
||||||
147. [Overhaul Pack](http://www.moddb.com/mods/half-life-overhaul-pack) (Just HD pack for Half-Life)
|
147. [Overhaul Pack](http://www.moddb.com/mods/half-life-overhaul-pack) (Just HD pack for Half-Life)
|
||||||
148. [P.I.Z.D.E.C.](https://www.runthinkshootlive.com/posts/pizdec/)
|
148. [P.I.Z.D.E.C.](https://www.runthinkshootlive.com/posts/pizdec/)
|
||||||
149. [pagoda](http://www.moddb.com/mods/pagoda1)
|
149. [pagoda](http://www.moddb.com/mods/pagoda1)
|
||||||
@@ -282,7 +297,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
|||||||
6. [Catacombs: Part 1](https://www.runthinkshootlive.com/posts/catacombs/)
|
6. [Catacombs: Part 1](https://www.runthinkshootlive.com/posts/catacombs/)
|
||||||
7. [Cro-man's Office Mappack](http://twhl.info/vault.php?map=5547)
|
7. [Cro-man's Office Mappack](http://twhl.info/vault.php?map=5547)
|
||||||
8. [Half-Life Episode Two Demo Alpha v1.0](http://hl.loess.ru/?mod=451)
|
8. [Half-Life Episode Two Demo Alpha v1.0](http://hl.loess.ru/?mod=451)
|
||||||
9. [Hazardous-Course (first version of Hazardous-Course 2)](https://drive.google.com/file/d/16djJZSpNWKyScSxSyMqX-u_S-2i400rl/view?usp=sharing)
|
9. [Hazardous-Course (first version of Hazardous-Course 2)](https://web.archive.org/web/20110512012317/http://www.richmans-maps.ch.vu/)
|
||||||
10. [High Tech v0.2](http://hl.loess.ru/?mod=499)
|
10. [High Tech v0.2](http://hl.loess.ru/?mod=499)
|
||||||
11. [HL Shadows, Part 1](https://www.fileplanet.com/7466/0/fileinfo/'HL-Shadows',-Part-1)
|
11. [HL Shadows, Part 1](https://www.fileplanet.com/7466/0/fileinfo/'HL-Shadows',-Part-1)
|
||||||
12. [HLNewEnd](http://twhl.info/vault.php?map=2275)
|
12. [HLNewEnd](http://twhl.info/vault.php?map=2275)
|
||||||
@@ -305,11 +320,11 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
|||||||
29. [Shortcut v1.0 Beta](https://www.runthinkshootlive.com/posts/shortcut/)
|
29. [Shortcut v1.0 Beta](https://www.runthinkshootlive.com/posts/shortcut/)
|
||||||
30. [Stoka](https://www.ceskemody.cz/mapy.php?lng=1&clanek=222&razeni_hra=1&pn=stoka)
|
30. [Stoka](https://www.ceskemody.cz/mapy.php?lng=1&clanek=222&razeni_hra=1&pn=stoka)
|
||||||
31. [Striker's Compo 26](http://twhl.info/vault.php?map=5190) (buggy)
|
31. [Striker's Compo 26](http://twhl.info/vault.php?map=5190) (buggy)
|
||||||
32. [Technology Test 2](https://drive.google.com/file/d/1LfldzsMIN5j07bgtNkfY5v0Xl0S9de_G/view?usp=sharing)
|
32. [Technology Test 2](https://web.archive.org/web/20110512012317/http://www.richmans-maps.ch.vu/)
|
||||||
33. [The Gate Playable Demo](https://www.fileplanet.com/116347/110000/fileinfo/The-Gate-Playable-Demo)
|
33. [The Gate Playable Demo](https://www.fileplanet.com/116347/110000/fileinfo/The-Gate-Playable-Demo)
|
||||||
34. [They are Back](https://www.runthinkshootlive.com/posts/they-are-back/)
|
34. [They are Back](https://www.runthinkshootlive.com/posts/they-are-back/)
|
||||||
35. [Tiefseelabor( Deep Sea Laboratory )](https://www.runthinkshootlive.com/posts/deep-sea-laboratory/)
|
35. [Tiefseelabor( Deep Sea Laboratory )](https://www.runthinkshootlive.com/posts/deep-sea-laboratory/)
|
||||||
36. [Time-Shift](https://drive.google.com/file/d/1pK1s-2SIlSMQHVRPMLdC_94wTa__8_DX/view?usp=sharing)
|
36. [Time-Shift](https://web.archive.org/web/20110512012317/http://www.richmans-maps.ch.vu/)
|
||||||
37. [Train Single Beta](https://cs-mapping.com.ua/forum/showthread.php?t=36394) (Remove **gfx.wad** from **TrainSingle** folder)
|
37. [Train Single Beta](https://cs-mapping.com.ua/forum/showthread.php?t=36394) (Remove **gfx.wad** from **TrainSingle** folder)
|
||||||
38. [WAR: The Killer Beta 0.1](http://www.moddb.com/mods/war)
|
38. [WAR: The Killer Beta 0.1](http://www.moddb.com/mods/war)
|
||||||
39. [White Force Beta( Residual Point prototype )](http://www.moddb.com/mods/hl-residual-point/downloads/white-force-beta-2002)
|
39. [White Force Beta( Residual Point prototype )](http://www.moddb.com/mods/hl-residual-point/downloads/white-force-beta-2002)
|
||||||
@@ -379,7 +394,7 @@ Mods:
|
|||||||
5. [Half-Life Baby v1.4](http://www.moddb.com/games/half-life/addons/half-life-baby) (it's an unfinished but playable mod; after installing of the mod open **liblist.gam** or **gameinfo.txt** file in the mod's folder and correct the line **gamedll "..\hlbaby\dlls\hl.dll"** for **gamedll "dlls\hl.dll"**, otherwise you'll not be able to start a game)
|
5. [Half-Life Baby v1.4](http://www.moddb.com/games/half-life/addons/half-life-baby) (it's an unfinished but playable mod; after installing of the mod open **liblist.gam** or **gameinfo.txt** file in the mod's folder and correct the line **gamedll "..\hlbaby\dlls\hl.dll"** for **gamedll "dlls\hl.dll"**, otherwise you'll not be able to start a game)
|
||||||
6. [Half-Secret](http://www.moddb.com/mods/half-secret) (this mod has custom **weapon_snark** code)
|
6. [Half-Secret](http://www.moddb.com/mods/half-secret) (this mod has custom **weapon_snark** code)
|
||||||
7. [Induction](http://www.moddb.com/mods/half-life-induction) (this mod has new item - **item_flashlight**)
|
7. [Induction](http://www.moddb.com/mods/half-life-induction) (this mod has new item - **item_flashlight**)
|
||||||
8. [Lost in Black Mesa(first version without HLFX)](https://drive.google.com/file/d/1bEnm_AxJs-ly8hTEZIQBw_v2BsXdSiGa/view?usp=sharing)
|
8. [Lost in Black Mesa(first version without HLFX)](https://web.archive.org/web/20160407041812/http://half-life.ru/forum/showthread.php?threadid=13959) (download links dead!)
|
||||||
9. [Soldier](http://www.moddb.com/mods/half-life-soldier)
|
9. [Soldier](http://www.moddb.com/mods/half-life-soldier)
|
||||||
10. [Solo Operations](http://www.moddb.com/mods/solo-operations)
|
10. [Solo Operations](http://www.moddb.com/mods/solo-operations)
|
||||||
11. [The Blood v1.1](http://hl.loess.ru/?mods=&search=The+Blood) (there are some inner bugs in the mod, but they don't interfere with a game progress)
|
11. [The Blood v1.1](http://hl.loess.ru/?mods=&search=The+Blood) (there are some inner bugs in the mod, but they don't interfere with a game progress)
|
||||||
@@ -440,7 +455,7 @@ Mods:
|
|||||||
51. [Data-base](https://www.runthinkshootlive.com/posts/database/)
|
51. [Data-base](https://www.runthinkshootlive.com/posts/database/)
|
||||||
52. [de_dust2_azabetfeN](https://cs-mapping.com.ua/forum/showthread.php?t=36394) (remove **cl_dlls** & **dlls** folders from inside of mod's directory before you start the game)
|
52. [de_dust2_azabetfeN](https://cs-mapping.com.ua/forum/showthread.php?t=36394) (remove **cl_dlls** & **dlls** folders from inside of mod's directory before you start the game)
|
||||||
53. [De-railed](http://twhl.info/competitions.php?results=7)
|
53. [De-railed](http://twhl.info/competitions.php?results=7)
|
||||||
54. [Dead Shift Beta](http://www.moddb.com/mods/dead-shift) - [Demo 1](https://www.gamewatcher.com/mods/half-life-mod/dead-shift-1-0-beta) & [Demo 2](https://drive.google.com/file/d/1uHvr8xONogTTNOy-8X6G4ehFV6Eawvbq/view?usp=sharing)
|
54. [Dead Shift Beta](http://www.moddb.com/mods/dead-shift) - [Demo 1](https://www.gamewatcher.com/mods/half-life-mod/dead-shift-1-0-beta) & [Demo 2](https://web.archive.org/web/20151030005310/http://www.gamefront.com/files/13532512)
|
||||||
55. [Deep](http://twhl.info/vault.php?map=1669)
|
55. [Deep](http://twhl.info/vault.php?map=1669)
|
||||||
56. [Desert Attack](http://fyzzer.narod.ru/index.html)
|
56. [Desert Attack](http://fyzzer.narod.ru/index.html)
|
||||||
57. [Desert Combat Demo](https://www.fileplanet.com/190487/190000/fileinfo/Half-Life---Desert-Combat-Mod) (despite a big file size there's only one small unfinished map)
|
57. [Desert Combat Demo](https://www.fileplanet.com/190487/190000/fileinfo/Half-Life---Desert-Combat-Mod) (despite a big file size there's only one small unfinished map)
|
||||||
@@ -498,8 +513,8 @@ Mods:
|
|||||||
109. [Hospital](https://gamebanana.com/maps/167446) (you need to edit **liblist.gam** file in the mod's folder - delete *gamedll & type* strings from it before you start to play)
|
109. [Hospital](https://gamebanana.com/maps/167446) (you need to edit **liblist.gam** file in the mod's folder - delete *gamedll & type* strings from it before you start to play)
|
||||||
110. [Hostage](https://www.runthinkshootlive.com/posts/hostage-2/)
|
110. [Hostage](https://www.runthinkshootlive.com/posts/hostage-2/)
|
||||||
111. [House](http://www.artpeter.net/Data/HalfLife/Hl.php)
|
111. [House](http://www.artpeter.net/Data/HalfLife/Hl.php)
|
||||||
112. [Impulse 101 Fun - The Train](https://drive.google.com/file/d/1jAuMCCmREH0mfAEAscqaG8FQGa2uNknb/view?usp=sharing) (map from *TWHL* by *Archie* aka *The Hunter*)
|
112. [Impulse 101 Fun - The Train](http://web.archive.org/web/20070305075816/http://www.twhl.co.za/mapvault/2817.zip) (map from *TWHL* by *Archie* aka *The Hunter*)
|
||||||
113. [In America](https://drive.google.com/file/d/1gOC8zfnUvBxRy8Rr8juNiUNbLYjoZpnn/view?usp=sharing)
|
113. [In America](https://web.archive.org/web/20170221213409/http://www.lambda-force.org/load/half_life/karty/half_life_in_america/18-1-0-476)
|
||||||
114. [In the Kitchen](http://twhl.info/vault.php?map=4314)
|
114. [In the Kitchen](http://twhl.info/vault.php?map=4314)
|
||||||
115. [Infiltration](https://www.fileplanet.com/7467/0/fileinfo/Infiltration)
|
115. [Infiltration](https://www.fileplanet.com/7467/0/fileinfo/Infiltration)
|
||||||
116. [Interactivity & Lots of Entities](http://twhl.info/vault.php?map=5744) (link dead!)
|
116. [Interactivity & Lots of Entities](http://twhl.info/vault.php?map=5744) (link dead!)
|
||||||
|
|||||||
72
README.md
72
README.md
@@ -1,8 +1,8 @@
|
|||||||
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
# Xash3D FWGS Engine <img align="right" width="128" height="128" src="https://github.com/FWGS/xash3d-fwgs/raw/master/game_launch/icon-xash-material.png" alt="Xash3D FWGS icon" />
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
[](https://builds.sr.ht/~a1batross/xash3d-fwgs?) [](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://fwgsdiscord.mentality.rip/) \
|
||||||
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||||
|
|
||||||
Xash3D FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
Xash3D (pronounced `[ksɑʂ]`) FWGS is a game engine, aimed to provide compatibility with Half-Life Engine and extend it, as well as to give game developers well known workflow.
|
||||||
|
|
||||||
Xash3D FWGS is a heavily modified fork of an original [Xash3D Engine](https://www.moddb.com/engines/xash3d-engine) by Unkle Mike.
|
Xash3D FWGS is a heavily modified fork of an original [Xash3D Engine](https://www.moddb.com/engines/xash3d-engine) by Unkle Mike.
|
||||||
|
|
||||||
@@ -11,12 +11,12 @@ Xash3D FWGS is a heavily modified fork of an original [Xash3D Engine](https://ww
|
|||||||
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).
|
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
|
## Fork features
|
||||||
* Steam Half-Life (HLSDK 2.4) support.
|
* Steam Half-Life (HLSDK 2.5) support.
|
||||||
* Crossplatform and modern compilers support: supports Windows, Linux, BSD & Android on x86 & ARM and [many more](Documentation/ports.md).
|
* 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.
|
* Better multiplayer: multiple master servers, headless dedicated server, voice chat, [GoldSrc protocol support](Documentation/goldsrc-protocol-support.md) and IPv6 support.
|
||||||
* Multiple renderers support: OpenGL, GLESv1, GLESv2 and Software.
|
* 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.
|
* 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)
|
* Mobility API: better game integration on mobile devices (vibration, touch controls).
|
||||||
* Different input methods: touch and gamepad in addition to mouse & keyboard.
|
* Different input methods: touch and gamepad in addition to mouse & keyboard.
|
||||||
* TrueType font rendering, as a part of mainui_cpp.
|
* TrueType font rendering, as a part of mainui_cpp.
|
||||||
* External VGUI support module.
|
* External VGUI support module.
|
||||||
@@ -28,29 +28,28 @@ If you like Xash3D FWGS, consider supporting individual engine maintainers. By s
|
|||||||
1) Copy engine binaries to some directory.
|
1) Copy engine binaries to some directory.
|
||||||
2) Copy `valve` directory from [Half-Life](https://store.steampowered.com/app/70/HalfLife/) to directory with engine binaries.
|
2) Copy `valve` directory from [Half-Life](https://store.steampowered.com/app/70/HalfLife/) to directory with engine binaries.
|
||||||
If your CPU is NOT x86 compatible or you're running 64-bit version of the engine, you may want to compile [Half-Life SDK](https://github.com/FWGS/hlsdk-portable).
|
If your CPU is NOT x86 compatible or you're running 64-bit version of the engine, you may want to compile [Half-Life SDK](https://github.com/FWGS/hlsdk-portable).
|
||||||
This repository contains our fork of HLSDK and restored source code for some of the mods. Not all of them, of course.
|
This repository contains our fork of HLSDK and restored source code for Half-Life expansions and some mods.
|
||||||
You still needed to copy `valve` directory as all game resources located there.
|
You still needed to copy `valve` directory as all game resources located there.
|
||||||
3) Run the main executable (`xash3d.exe` or AppImage).
|
3) Run the main executable (`xash3d.exe` or AppImage).
|
||||||
|
|
||||||
For additional info, run Xash3D with `-help` command line key.
|
For additional info, run Xash3D with `-help` command line key.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
* Before sending an issue, check if someone already reported your issue. Make sure you're following "How To Ask Questions The Smart Way" guide by Eric Steven Raymond. Read more: http://www.catb.org/~esr/faqs/smart-questions.html
|
* Before sending an issue, check if someone already reported your issue. Make sure you're following "How To Ask Questions The Smart Way" guide by Eric Steven Raymond. Read more: http://www.catb.org/~esr/faqs/smart-questions.html.
|
||||||
* Issues are accepted in both English and Russian
|
* Issues are accepted in both English and Russian.
|
||||||
* Before sending a PR, check if you followed our contribution guide in CONTRIBUTING.md file.
|
* Before sending a PR, check if you followed our contribution guide in CONTRIBUTING.md file.
|
||||||
|
|
||||||
## Build instructions
|
## Build instructions
|
||||||
We are using Waf build system. If you have some Waf-related questions, I recommend you to read https://waf.io/book/
|
We are using Waf build system. If you have some Waf-related questions, I recommend you to read [Waf Book](https://waf.io/book/).
|
||||||
|
|
||||||
NOTE: NEVER USE GitHub's ZIP ARCHIVES. GitHub doesn't include external dependencies we're using!
|
NOTE: NEVER USE GitHub's ZIP ARCHIVES. GitHub doesn't include external dependencies we're using!
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
If your CPU is x86 compatible and you're on Windows or Linux, we are building 32-bit code by default. This was done to maintain compatibility with Steam releases of Half-Life and based on it's engine games.
|
||||||
If your CPU is x86 compatible, we are building 32-bit code by default. This was done to maintain compatibility with Steam releases of Half-Life and based on it's engine games.
|
|
||||||
Even if Xash3D FWGS does support targetting 64-bit, you can't load games without recompiling them from source code!
|
Even if Xash3D FWGS does support targetting 64-bit, you can't load games without recompiling them from source code!
|
||||||
|
|
||||||
If your CPU is NOT x86 compatible or you decided build 64-bit version of engine, you may want to compile [Half-Life SDK](https://github.com/FWGS/hlsdk-portable).
|
If your CPU is NOT x86 compatible or you decided build 64-bit version of engine, you may want to compile [Half-Life SDK](https://github.com/FWGS/hlsdk-portable).
|
||||||
This repository contains our fork of HLSDK and restored source code for some of the mods. Not all of them, of course.
|
This repository contains our fork of HLSDK and restored source code for Half-Life expansions and some mods.
|
||||||
|
|
||||||
#### Windows (Visual Studio)
|
#### Windows (Visual Studio)
|
||||||
* Install Visual Studio.
|
* Install Visual Studio.
|
||||||
@@ -62,31 +61,40 @@ This repository contains our fork of HLSDK and restored source code for some of
|
|||||||
|
|
||||||
#### GNU/Linux
|
#### GNU/Linux
|
||||||
##### Debian/Ubuntu
|
##### Debian/Ubuntu
|
||||||
* Enable i386 on your system, if you're compiling 32-bit engine on amd64. If not, skip this
|
* Only for 32-bit engine on 64-bit x86 operating system:
|
||||||
|
* Enable i386 on your system: `$ sudo dpkg --add-architecture i386`.
|
||||||
|
* Install `aptitude` ([why?](https://github.com/FWGS/xash3d-fwgs/issues/1828#issuecomment-2415131759)): `$ sudo apt update && sudo apt upgrade && sudo apt install aptitude`
|
||||||
|
* Install development tools: `$ sudo aptitude --without-recommends install git build-essential gcc-multilib g++-multilib libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype-dev:i386 libopus-dev:i386 libbz2-dev:i386`.
|
||||||
|
* Set PKG_CONFIG_PATH environment variable to point at 32-bit libraries: `$ export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig`.
|
||||||
|
|
||||||
`$ sudo dpkg --add-architecture i386`
|
* For 64-bit engine on 64-bit x86 and other non-x86 systems:
|
||||||
* Install development tools
|
* Install development tools: `$ sudo apt install git build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev libopus-dev libbz2-dev`.
|
||||||
* For 32-bit engine on amd64: \
|
|
||||||
`$ sudo apt install build-essential gcc-multilib g++-multilib python libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype6-dev:i386`
|
* Clone this repostory: `$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
|
||||||
* For everything else: \
|
|
||||||
`$ sudo apt install build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev`
|
##### RedHat/Fedora
|
||||||
* Clone this repostory:
|
* Only for 32-bit engine on 64-bit x86 operating system:
|
||||||
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`
|
* Install development tools: `$ sudo dnf install git gcc gcc-c++ glibc-devel.i686 SDL2-devel.i686 opus-devel.i686 fontconfig-devel.i686 freetype-devel.i686 bzip2-devel.i686`.
|
||||||
|
* Set PKG_CONFIG_PATH environment variable to point at 32-bit libraries: `$ export PKG_CONFIG_PATH=/usr/lib/pkgconfig`.
|
||||||
|
|
||||||
|
* For 64-bit engine on 64-bit x86 and other non-x86 systems:
|
||||||
|
* Install development tools: `$ sudo dnf install git gcc gcc-c++ SDL2-devel opus-devel fontconfig-devel freetype-devel bzip2-devel`.
|
||||||
|
|
||||||
|
* Clone this repostory: `$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
#### Windows (Visual Studio)
|
#### Windows (Visual Studio)
|
||||||
0) Open command line
|
0) Open command line.
|
||||||
1) Navigate to `xash3d-fwgs` directory.
|
1) Navigate to `xash3d-fwgs` directory.
|
||||||
2) Carefully examine which build options are available: `waf --help`
|
2) (optional) Examine which build options are available: `waf --help`.
|
||||||
3) Configure build: `waf configure -T release --sdl2=c:/path/to/SDL2`
|
3) Configure build: `waf configure --sdl2=c:/path/to/SDL2`.
|
||||||
4) Compile: `waf build`
|
4) Compile: `waf build`.
|
||||||
5) Install: `waf install --destdir=c:/path/to/any/output/directory`
|
5) Install: `waf install --destdir=c:/path/to/any/output/directory`.
|
||||||
|
|
||||||
#### Linux
|
#### Linux
|
||||||
If compiling 32-bit on amd64, you may need to supply `export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig` prior to running configure.
|
If compiling 32-bit on amd64, make sure `PKG_CONFIG_PATH` from the previous step is set correctly, prior to running configure.
|
||||||
|
|
||||||
0) Examine which build options are available: `./waf --help`
|
0) (optional) Examine which build options are available: `./waf --help`.
|
||||||
1) Configure build: `./waf configure -T release`
|
1) Configure build: `./waf configure` (you need to pass `-8` to compile 64-bit engine on 64-bit x86 processor).
|
||||||
(You need to pass `-8` to compile 64-bit engine on 64-bit x86 processor)
|
2) Compile: `./waf build`.
|
||||||
2) Compile: `./waf build`
|
3) Install: `./waf install --destdir=/path/to/any/output/directory`.
|
||||||
3) Install(optional): `./waf install --destdir=/path/to/any/output/directory`
|
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
boneinfo.h - structure that send delta-compressed bones across network
|
|
||||||
Copyright (C) 2018 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BONEINFO_H
|
|
||||||
#define BONEINFO_H
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
vec3_t angles;
|
|
||||||
vec3_t origin;
|
|
||||||
} boneinfo_t;
|
|
||||||
|
|
||||||
#endif//BONEINFO_H
|
|
||||||
@@ -127,14 +127,23 @@ typedef struct
|
|||||||
int flags; // sky or slime, no lightmap or 256 subdivision
|
int flags; // sky or slime, no lightmap or 256 subdivision
|
||||||
} mtexinfo_t;
|
} mtexinfo_t;
|
||||||
|
|
||||||
typedef struct glpoly_s
|
// a1ba: changed size to avoid undefined behavior. Check your allocations if you take this header!
|
||||||
|
// For example:
|
||||||
|
// before: malloc( sizeof( glpoly_t ) + ( numverts - 4 ) * VERTEXSIZE * sizeof( float ))
|
||||||
|
// after (C): malloc( sizeof( glpoly_t ) + numverts * VERTEXSIZE * sizeof( float ))
|
||||||
|
// after (C++): malloc( sizeof( glpoly_t ) + ( numverts - 1 ) * VERTEXSIZE * sizeof( float ))
|
||||||
|
typedef struct glpoly2_s
|
||||||
{
|
{
|
||||||
struct glpoly_s *next;
|
struct glpoly2_s *next;
|
||||||
struct glpoly_s *chain;
|
struct glpoly2_s *chain;
|
||||||
int numverts;
|
int numverts;
|
||||||
int flags; // for SURF_UNDERWATER
|
int flags; // for SURF_UNDERWATER
|
||||||
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
#ifdef __cplusplus
|
||||||
} glpoly_t;
|
float verts[1][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
||||||
|
#else
|
||||||
|
float verts[][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
|
||||||
|
#endif
|
||||||
|
} glpoly2_t;
|
||||||
|
|
||||||
typedef struct mnode_s
|
typedef struct mnode_s
|
||||||
{
|
{
|
||||||
@@ -173,7 +182,7 @@ struct decal_s
|
|||||||
short entityIndex; // Entity this is attached to
|
short entityIndex; // Entity this is attached to
|
||||||
// Xash3D specific
|
// Xash3D specific
|
||||||
vec3_t position; // location of the decal center in world space.
|
vec3_t position; // location of the decal center in world space.
|
||||||
glpoly_t *polys; // precomputed decal vertices
|
glpoly2_t *polys; // precomputed decal vertices
|
||||||
intptr_t reserved[4]; // just for future expansions or mod-makers
|
intptr_t reserved[4]; // just for future expansions or mod-makers
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -246,7 +255,7 @@ struct msurface_s
|
|||||||
|
|
||||||
int light_s, light_t; // gl lightmap coordinates
|
int light_s, light_t; // gl lightmap coordinates
|
||||||
|
|
||||||
glpoly_t *polys; // multiple if warped
|
glpoly2_t *polys; // multiple if warped
|
||||||
struct msurface_s *texturechain;
|
struct msurface_s *texturechain;
|
||||||
|
|
||||||
mtexinfo_t *texinfo;
|
mtexinfo_t *texinfo;
|
||||||
@@ -488,7 +497,8 @@ typedef struct
|
|||||||
int flags;
|
int flags;
|
||||||
float size;
|
float size;
|
||||||
|
|
||||||
int reserved[8]; // VBO offsets
|
const trivertex_t **pposeverts; // only valid during loading, used to build GL mesh
|
||||||
|
intptr_t reserved[7]; // VBO offsets
|
||||||
|
|
||||||
int numposes;
|
int numposes;
|
||||||
int poseverts;
|
int poseverts;
|
||||||
@@ -531,8 +541,10 @@ typedef struct
|
|||||||
#define MAX_MOVIES 8
|
#define MAX_MOVIES 8
|
||||||
#define MAX_CDTRACKS 32
|
#define MAX_CDTRACKS 32
|
||||||
#define MAX_CLIENT_SPRITES 512 // SpriteTextures (0-256 hud, 256-512 client)
|
#define MAX_CLIENT_SPRITES 512 // SpriteTextures (0-256 hud, 256-512 client)
|
||||||
#define MAX_EFRAGS 8192 // Arcane Dimensions required
|
|
||||||
#define MAX_REQUESTS 64
|
#define MAX_REQUESTS 64
|
||||||
|
|
||||||
|
STATIC_CHECK_SIZEOF( mextrasurf_t, 324, 496 );
|
||||||
|
STATIC_CHECK_SIZEOF( decal_t, 60, 88 );
|
||||||
|
STATIC_CHECK_SIZEOF( mfaceinfo_t, 176, 304 );
|
||||||
|
|
||||||
#endif//COM_MODEL_H
|
#endif//COM_MODEL_H
|
||||||
|
|||||||
@@ -717,6 +717,7 @@ enum
|
|||||||
kRenderFxExplode, // Scale up really big!
|
kRenderFxExplode, // Scale up really big!
|
||||||
kRenderFxGlowShell, // Glowing Shell
|
kRenderFxGlowShell, // Glowing Shell
|
||||||
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
|
||||||
|
kRenderFxLightMultiplier,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int func_t;
|
typedef int func_t;
|
||||||
|
|||||||
151
common/cvardef.h
151
common/cvardef.h
@@ -1,49 +1,122 @@
|
|||||||
/***
|
/*
|
||||||
*
|
cvardef.h - quake cvar definition
|
||||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
*
|
Copyright (C) 2024 Alibek Omarov
|
||||||
* This product contains software technology licensed from Id
|
|
||||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use, distribution, and modification of this source code and/or resulting
|
|
||||||
* object code is restricted to non-commercial enhancements to products from
|
|
||||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
|
||||||
* without written permission from Valve LLC.
|
|
||||||
*
|
|
||||||
****/
|
|
||||||
#ifndef CVARDEF_H
|
|
||||||
#define CVARDEF_H
|
|
||||||
|
|
||||||
#define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc
|
This program is free software; you can redistribute it and/or
|
||||||
#define FCVAR_USERINFO (1<<1) // changes the client's info string
|
modify it under the terms of the GNU General Public License
|
||||||
#define FCVAR_SERVER (1<<2) // notifies players when changed
|
as published by the Free Software Foundation; either version 2
|
||||||
#define FCVAR_EXTDLL (1<<3) // defined by external DLL
|
of the License, or (at your option) any later version.
|
||||||
#define FCVAR_CLIENTDLL (1<<4) // defined by the client dll
|
|
||||||
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
|
|
||||||
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
|
|
||||||
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
|
|
||||||
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
|
|
||||||
#define FCVAR_NOEXTRAWHITEPACE (1<<9) // strip trailing/leading white space from this cvar
|
|
||||||
#define FCVAR_PRIVILEGED (1<<10) // only available in privileged mode
|
|
||||||
#define FCVAR_FILTERABLE (1<<11) // filtered in unprivileged mode if cl_filterstuffcmd is 1
|
|
||||||
|
|
||||||
// Xash3D extensions
|
This program is distributed in the hope that it will be useful,
|
||||||
#define FCVAR_GLCONFIG (1<<12) // write it into <renderer>.cfg(see RefAPI)
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
#define FCVAR_CHANGED (1<<13) // set each time the cvar is changed
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
#define FCVAR_GAMEUIDLL (1<<14) // defined by the menu DLL
|
|
||||||
#define FCVAR_CHEAT (1<<15) // can not be changed if cheats are disabled
|
|
||||||
|
|
||||||
// a1ba: let's reuse higher bits for flags extensions from now on
|
See the GNU General Public License for more details.
|
||||||
#define FCVAR_LATCH (1<<30) // notify client what this cvar will be applied only after server restart (but don't does more nothing)
|
|
||||||
|
|
||||||
typedef struct cvar_s
|
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 CVAR
|
||||||
|
#define CVAR
|
||||||
|
|
||||||
|
#include STDINT_H
|
||||||
|
#include "xash3d_types.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
cvar_t variables are used to hold scalar or string variables that can be changed
|
||||||
|
or displayed at the console or prog code as well as accessed directly
|
||||||
|
in C code.
|
||||||
|
|
||||||
|
The user can access cvars from the console in three ways:
|
||||||
|
r_draworder prints the current value
|
||||||
|
r_draworder 0 sets the current value to 0
|
||||||
|
set r_draworder 0 as above, but creates the cvar if not present
|
||||||
|
|
||||||
|
Cvars are restricted from having the same names as commands to keep this
|
||||||
|
interface from being ambiguous.
|
||||||
|
|
||||||
|
The are also occasionally used to communicated information between different
|
||||||
|
modules of the program.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum
|
||||||
{
|
{
|
||||||
|
// GoldSrc compatibility flags
|
||||||
|
FCVAR_ARCHIVE = 1 << 0, // set to cause it to be saved to vars.rc
|
||||||
|
FCVAR_USERINFO = 1 << 1, // added to userinfo when changed
|
||||||
|
FCVAR_SERVER = 1 << 2, // added to serverinfo when changed, will notify clients by default
|
||||||
|
FCVAR_EXTDLL = 1 << 3, // defined by server.dll
|
||||||
|
FCVAR_CLIENTDLL = 1 << 4, // defined by client.dll
|
||||||
|
FCVAR_PROTECTED = 1 << 5, // private server cvar
|
||||||
|
FCVAR_SPONLY = 1 << 6, // can be set only in singleplayer
|
||||||
|
FCVAR_PRINTABLEONLY = 1 << 7, // only allows printable characters
|
||||||
|
FCVAR_UNLOGGED = 1 << 8, // disables notifying client about server cvar change
|
||||||
|
FCVAR_NOEXTRAWHITESPACE = 1 << 9, // removes space characters from the beginning and the end of the string
|
||||||
|
FCVAR_PRIVILEGED = 1 << 10, // only available in privileged mode
|
||||||
|
FCVAR_FILTERABLE = 1 << 11, // treated as privileged if cl_filterstuffcmd is 1, otherwise ignored
|
||||||
|
|
||||||
|
// Xash3D public flags
|
||||||
|
// FCVAR_LATCH = 1 << 11, // deprecated Xash3D flag, conflicts with FCVAR_FILTERABLE. Use another FCVAR_LATCH!
|
||||||
|
FCVAR_GLCONFIG = 1 << 12, // set to cause it to be saved to <renderer>.cfg (see RefAPI)
|
||||||
|
FCVAR_CHANGED = 1 << 13, // set each time the cvar changed
|
||||||
|
FCVAR_GAMEUIDLL = 1 << 14, // defined by menu.dll
|
||||||
|
FCVAR_CHEAT = 1 << 15, // cannot be changed if sv_cheats is 0
|
||||||
|
|
||||||
|
#if REF_DLL || ENGINE_DLL // Xash3D internal flags, MUST NOT be used outside of engine
|
||||||
|
FCVAR_RENDERINFO = 1 << 16, // set to cause it to be saved to video.cfg
|
||||||
|
FCVAR_READ_ONLY = 1 << 17, // display only, cannot be set by user at all
|
||||||
|
FCVAR_EXTENDED = 1 << 18, // extended cvar structure
|
||||||
|
FCVAR_ALLOCATED = 1 << 19, // allocated by the engine, must be freed with Mem_Free
|
||||||
|
FCVAR_VIDRESTART = 1 << 20, // triggers video subsystem to recreate/modify window parameters
|
||||||
|
FCVAR_TEMPORARY = 1 << 21, // only used to temporarly hold some value, can be unlinked
|
||||||
|
FCVAR_MOVEVARS = 1 << 22, // access to movevars_t structure, synchornized between client and server
|
||||||
|
FCVAR_USER_CREATED = 1 << 23, // created by a set command
|
||||||
|
|
||||||
|
FCVAR_REFDLL = 1 << 29, // (Xash3D FWGS internal flag) defined by the renderer DLL
|
||||||
|
#endif // REF_DLL || ENGINE_DLL
|
||||||
|
|
||||||
|
FCVAR_LATCH = 1 << 30, // (Xash3D FWGS public flag, was FCVAR_FILTERABLE in Xash3D) save changes until server restart
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cvar_s {
|
||||||
char *name;
|
char *name;
|
||||||
char *string;
|
char *string;
|
||||||
int flags;
|
uint32_t flags;
|
||||||
float value;
|
float value;
|
||||||
struct cvar_s *next;
|
struct cvar_s *next;
|
||||||
} cvar_t;
|
};
|
||||||
|
typedef struct cvar_s cvar_t;
|
||||||
|
|
||||||
#endif//CVARDEF_H
|
STATIC_CHECK_SIZEOF( struct cvar_s, 20, 32 );
|
||||||
|
|
||||||
|
#if REF_DLL || ENGINE_DLL // Xash3D internal cvar format, MUST NOT be used outside of engine
|
||||||
|
struct convar_s {
|
||||||
|
char *name;
|
||||||
|
char *string;
|
||||||
|
uint32_t flags;
|
||||||
|
float value;
|
||||||
|
struct convar_s *next;
|
||||||
|
char *desc;
|
||||||
|
char *def_string;
|
||||||
|
};
|
||||||
|
typedef struct convar_s convar_t;
|
||||||
|
|
||||||
|
#if XASH_64BIT
|
||||||
|
#define CVAR_SENTINEL (uintptr_t)0xDEADBEEFDEADBEEF
|
||||||
|
#else
|
||||||
|
#define CVAR_SENTINEL (uintptr_t)0xDEADBEEF
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CVAR_CHECK_SENTINEL( cv ) ((uintptr_t)(cv)->next == CVAR_SENTINEL)
|
||||||
|
|
||||||
|
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) \
|
||||||
|
convar_t cv = { (char*)cvname, (char*)cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, (char*)cvdesc, NULL }
|
||||||
|
|
||||||
|
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) CVAR_DEFINE( cv, #cv, cvstr, cvflags, cvdesc )
|
||||||
|
#endif // REF_DLL || ENGINE_DLL
|
||||||
|
|
||||||
|
#endif // CVAR
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
features.h - engine features that can be enabled by mod-maker request
|
enginefeatures.h - engine features that can be enabled by mod-maker request
|
||||||
Copyright (C) 2012 Uncle Mike
|
Copyright (C) 2012 Uncle Mike
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@@ -27,6 +27,9 @@ GNU General Public License for more details.
|
|||||||
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
||||||
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer
|
#define ENGINE_LINEAR_GAMMA_SPACE (1<<8) // disable influence of gamma/brightness cvars to textures/lightmaps, for mods with custom renderer
|
||||||
|
|
||||||
|
#define ENGINE_DISABLE_HDTEXTURES (1U<<30) // disable support of HD-textures in case custom renderer have separate way to load them
|
||||||
|
#define ENGINE_STEP_POSHISTORY_LERP (1U<<31) // enable MOVETYPE_STEP interpolation based on position history. Incompatible with ENGINE_COMPUTE_STUDIO_LERP!
|
||||||
|
|
||||||
// adjust the mask when features will be added or removed
|
// adjust the mask when features will be added or removed
|
||||||
#define ENGINE_FEATURES_MASK \
|
#define ENGINE_FEATURES_MASK \
|
||||||
( ENGINE_WRITE_LARGE_COORD \
|
( ENGINE_WRITE_LARGE_COORD \
|
||||||
@@ -37,6 +40,7 @@ GNU General Public License for more details.
|
|||||||
| ENGINE_COMPENSATE_QUAKE_BUG \
|
| ENGINE_COMPENSATE_QUAKE_BUG \
|
||||||
| ENGINE_IMPROVED_LINETRACE \
|
| ENGINE_IMPROVED_LINETRACE \
|
||||||
| ENGINE_COMPUTE_STUDIO_LERP \
|
| ENGINE_COMPUTE_STUDIO_LERP \
|
||||||
| ENGINE_LINEAR_GAMMA_SPACE )
|
| ENGINE_LINEAR_GAMMA_SPACE \
|
||||||
|
| ENGINE_STEP_POSHISTORY_LERP )
|
||||||
|
|
||||||
#endif//FEATURES_H
|
#endif//FEATURES_H
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ GAMEINFO stuff
|
|||||||
internal shared gameinfo structure (readonly for engine parts)
|
internal shared gameinfo structure (readonly for engine parts)
|
||||||
========================================================================
|
========================================================================
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct GAMEINFO_s
|
||||||
{
|
{
|
||||||
// filesystem info
|
// filesystem info
|
||||||
char gamefolder[64]; // used for change game '-game x'
|
char gamefolder[64]; // used for change game '-game x'
|
||||||
@@ -50,4 +50,48 @@ typedef struct
|
|||||||
int gamemode;
|
int gamemode;
|
||||||
} GAMEINFO;
|
} GAMEINFO;
|
||||||
|
|
||||||
|
/*
|
||||||
|
========================================================================
|
||||||
|
|
||||||
|
Extended GameInfo struct introduced in Xash3D FWGS
|
||||||
|
|
||||||
|
GAMEINFO can't be reliably extended, as nor engine, nor menu can't be
|
||||||
|
sure about struct size. By adding struct versioning, we can check the
|
||||||
|
presense for extra fields.
|
||||||
|
========================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define GAMEINFO_VERSION 2
|
||||||
|
|
||||||
|
typedef enum gametype_e
|
||||||
|
{
|
||||||
|
GAME_NORMAL,
|
||||||
|
GAME_SINGLEPLAYER_ONLY,
|
||||||
|
GAME_MULTIPLAYER_ONLY,
|
||||||
|
} gametype_t;
|
||||||
|
|
||||||
|
typedef struct gameinfo2_s
|
||||||
|
{
|
||||||
|
int gi_version; // should be set to desired struct version, e.g. GAMEINFO_VERSION
|
||||||
|
|
||||||
|
// filesystem info
|
||||||
|
char gamefolder[64]; // used for change game
|
||||||
|
char startmap[64]; // map to start singleplayer game from
|
||||||
|
char trainmap[64]; // map to start hazardous course from (if specified)
|
||||||
|
char demomap[64]; // map to start demo chapter from (if specified)
|
||||||
|
char title[64]; // game title
|
||||||
|
char iconpath[64]; // path to game icon
|
||||||
|
char version[16]; // game version (optional)
|
||||||
|
uint32_t flags; // gameinfo flags, extended to fit more flags
|
||||||
|
|
||||||
|
// mod info
|
||||||
|
char game_url[256]; // link to a developer's site
|
||||||
|
char update_url[256]; // link to updates page
|
||||||
|
char type[64]; // single, toolkit, multiplayer, etc
|
||||||
|
char date[64]; // release date
|
||||||
|
uint64_t size; // size in bytes
|
||||||
|
|
||||||
|
gametype_t gamemode;
|
||||||
|
} gameinfo2_t;
|
||||||
|
|
||||||
#endif//GAMEINFO_H
|
#endif//GAMEINFO_H
|
||||||
|
|||||||
@@ -1,18 +1,35 @@
|
|||||||
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
/*
|
||||||
//
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
// Purpose:
|
|
||||||
//
|
|
||||||
// $NoKeywords: $
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
#if !defined( KBUTTONH )
|
This program is free software; you can redistribute it and/or
|
||||||
#define KBUTTONH
|
modify it under the terms of the GNU General Public License
|
||||||
#pragma once
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
typedef struct kbutton_s
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
#ifndef KBUTTON_H
|
||||||
|
#define KBUTTON_H
|
||||||
|
|
||||||
|
// a1ba: copied from WinQuake/client.h
|
||||||
|
//
|
||||||
|
// cl_input
|
||||||
|
//
|
||||||
|
typedef struct
|
||||||
{
|
{
|
||||||
int down[2]; // key nums holding it down
|
int down[2]; // key nums holding it down
|
||||||
int state; // low bit is down state
|
int state; // low bit is down state
|
||||||
} kbutton_t;
|
} kbutton_t;
|
||||||
|
|
||||||
#endif // !KBUTTONH
|
STATIC_CHECK_SIZEOF( kbutton_t, 12, 12 );
|
||||||
|
|
||||||
|
#endif // KBUTTON_H
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
// Set this flag for things like broadcast requests, etc. where the engine should not
|
// Set this flag for things like broadcast requests, etc. where the engine should not
|
||||||
// kill the request hook after receiving the first response
|
// kill the request hook after receiving the first response
|
||||||
#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
|
#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
|
||||||
|
#define FNETAPI_LEGACY_PROTOCOL ( 1<<1 ) // xash3d-fwgs extension
|
||||||
|
|
||||||
struct net_response_s;
|
struct net_response_s;
|
||||||
typedef void (*net_api_response_func_t) ( struct net_response_s *response );
|
typedef void (*net_api_response_func_t) ( struct net_response_s *response );
|
||||||
@@ -35,6 +36,7 @@ typedef void (*net_api_response_func_t) ( struct net_response_s *response );
|
|||||||
#define NET_ERROR_TIMEOUT ( 1<<0 )
|
#define NET_ERROR_TIMEOUT ( 1<<0 )
|
||||||
#define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 )
|
#define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 )
|
||||||
#define NET_ERROR_UNDEFINED ( 1<<2 )
|
#define NET_ERROR_UNDEFINED ( 1<<2 )
|
||||||
|
#define NET_ERROR_FORBIDDEN ( 1<<3 ) // xash3d-fwgs extension
|
||||||
|
|
||||||
typedef struct net_adrlist_s
|
typedef struct net_adrlist_s
|
||||||
{
|
{
|
||||||
|
|||||||
100
common/netadr.h
100
common/netadr.h
@@ -1,76 +1,74 @@
|
|||||||
/***
|
/*
|
||||||
*
|
Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
|
||||||
*
|
|
||||||
* This product contains software technology licensed from Id
|
|
||||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use, distribution, and modification of this source code and/or resulting
|
|
||||||
* object code is restricted to non-commercial enhancements to products from
|
|
||||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
|
||||||
* without written permission from Valve LLC.
|
|
||||||
*
|
|
||||||
****/
|
|
||||||
|
|
||||||
#ifndef NETADR_H
|
This program is free software; you can redistribute it and/or
|
||||||
#define NETADR_H
|
modify it under the terms of the GNU General Public License
|
||||||
|
as published by the Free Software Foundation; either version 2
|
||||||
|
of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef NET_ADR_H
|
||||||
|
#define NET_ADR_H
|
||||||
|
|
||||||
#include "build.h"
|
|
||||||
#include STDINT_H
|
#include STDINT_H
|
||||||
|
|
||||||
typedef enum
|
// net.h -- quake's interface to the networking layer
|
||||||
{
|
// a1ba: copied from Quake-2/qcommon/qcommon.h and modified to support IPv6
|
||||||
NA_UNUSED = 0,
|
|
||||||
NA_LOOPBACK,
|
|
||||||
NA_BROADCAST,
|
|
||||||
NA_IP,
|
|
||||||
NA_IPX,
|
|
||||||
NA_BROADCAST_IPX,
|
|
||||||
NA_IP6,
|
|
||||||
NA_MULTICAST_IP6, // all nodes multicast
|
|
||||||
} netadrtype_t;
|
|
||||||
|
|
||||||
// Original structure:
|
#define PORT_ANY -1
|
||||||
// typedef struct netadr_s
|
|
||||||
// {
|
typedef enum {NA_LOOPBACK = 1, NA_BROADCAST, NA_IP, NA_IPX, NA_BROADCAST_IPX, NA_IP6, NA_MULTICAST_IP6} netadrtype_t;
|
||||||
// netadrtype_t type;
|
|
||||||
// unsigned char ip[4];
|
/*
|
||||||
// unsigned char ipx[10];
|
Original Quake-2 structure:
|
||||||
// unsigned short port;
|
typedef struct
|
||||||
// } netadr_t;
|
{
|
||||||
|
netadrtype_t type;
|
||||||
|
|
||||||
|
byte ip[4];
|
||||||
|
byte ipx[10];
|
||||||
|
|
||||||
|
unsigned short port;
|
||||||
|
} netadr_t;
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma pack( push, 1 )
|
#pragma pack( push, 1 )
|
||||||
typedef struct netadr_s
|
typedef struct netadr_s
|
||||||
{
|
{
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
// IPv6 struct
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32_t type;
|
uint16_t type6;
|
||||||
|
uint8_t ip6[16];
|
||||||
|
};
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32_t type; // must be netadrtype_t but will break with short enums
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
uint8_t ip[4];
|
uint8_t ip[4];
|
||||||
uint32_t ip4;
|
uint32_t ip4; // for easier conversions
|
||||||
};
|
};
|
||||||
uint8_t ipx[10];
|
uint8_t ipx[10];
|
||||||
};
|
};
|
||||||
struct
|
|
||||||
{
|
|
||||||
#if XASH_LITTLE_ENDIAN
|
|
||||||
uint16_t type6;
|
|
||||||
uint8_t ip6[16];
|
|
||||||
#elif XASH_BIG_ENDIAN
|
|
||||||
uint8_t ip6_0[2];
|
|
||||||
uint16_t type6;
|
|
||||||
uint8_t ip6_2[14];
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
} netadr_t;
|
} netadr_t;
|
||||||
#pragma pack( pop )
|
#pragma pack( pop )
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( netadr_t ) == 20, "invalid netadr_t size" );
|
STATIC_CHECK_SIZEOF( netadr_t, 20, 20 );
|
||||||
|
|
||||||
#endif//NETADR_H
|
#endif // NET_ADR_H
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ GNU General Public License for more details.
|
|||||||
#define __cdecl
|
#define __cdecl
|
||||||
#define __stdcall
|
#define __stdcall
|
||||||
#define _inline static inline
|
#define _inline static inline
|
||||||
#define FORCEINLINE inline __attribute__((always_inline))
|
|
||||||
|
|
||||||
#if XASH_POSIX
|
#if XASH_POSIX
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -63,13 +62,6 @@ GNU General Public License for more details.
|
|||||||
int x, y;
|
int x, y;
|
||||||
} POINT;
|
} POINT;
|
||||||
#else // WIN32
|
#else // WIN32
|
||||||
#ifdef __MINGW32__
|
|
||||||
#define _inline static inline
|
|
||||||
#define FORCEINLINE inline __attribute__((always_inline))
|
|
||||||
#else
|
|
||||||
#define FORCEINLINE __forceinline
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define open _open
|
#define open _open
|
||||||
#define read _read
|
#define read _read
|
||||||
#define alloca _alloca
|
#define alloca _alloca
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ color24 gTracerColors[] =
|
|||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define TRACER_COLORINDEX_DEFAULT 4
|
||||||
|
|
||||||
// Temporary entity array
|
// Temporary entity array
|
||||||
#define TENTPRIORITY_LOW 0
|
#define TENTPRIORITY_LOW 0
|
||||||
#define TENTPRIORITY_HIGH 1
|
#define TENTPRIORITY_HIGH 1
|
||||||
|
|||||||
@@ -107,7 +107,8 @@ typedef enum
|
|||||||
TF_ARB_FLOAT = (1<<26), // float textures
|
TF_ARB_FLOAT = (1<<26), // float textures
|
||||||
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
||||||
TF_ARB_16BIT = (1<<28), // keep image as 16-bit (not 24)
|
TF_ARB_16BIT = (1<<28), // keep image as 16-bit (not 24)
|
||||||
TF_MULTISAMPLE = (1<<29) // multisampling texture
|
TF_MULTISAMPLE = (1<<29), // multisampling texture
|
||||||
|
TF_ALLOW_NEAREST = (1<<30), // allows toggling nearest filtering for TF_NOMIPMAP textures
|
||||||
} texFlags_t;
|
} texFlags_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
|||||||
@@ -28,11 +28,7 @@ typedef byte rgb_t[3]; // unsigned byte colorpack
|
|||||||
typedef vec_t matrix3x4[3][4];
|
typedef vec_t matrix3x4[3][4];
|
||||||
typedef vec_t matrix4x4[4][4];
|
typedef vec_t matrix4x4[4][4];
|
||||||
|
|
||||||
#if XASH_64BIT
|
|
||||||
typedef uint32_t poolhandle_t;
|
typedef uint32_t poolhandle_t;
|
||||||
#else
|
|
||||||
typedef void* poolhandle_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#undef true
|
#undef true
|
||||||
#undef false
|
#undef false
|
||||||
@@ -58,9 +54,6 @@ typedef uint64_t longtime_t;
|
|||||||
|
|
||||||
#define BIT( n ) ( 1U << ( n ))
|
#define BIT( n ) ( 1U << ( n ))
|
||||||
#define BIT64( n ) ( 1ULL << ( n ))
|
#define BIT64( n ) ( 1ULL << ( n ))
|
||||||
#define GAMMA ( 2.2f ) // Valve Software gamma
|
|
||||||
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
|
|
||||||
#define TEXGAMMA ( 0.9f ) // compensate dim textures
|
|
||||||
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
||||||
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
||||||
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
||||||
@@ -78,58 +71,94 @@ typedef uint64_t longtime_t;
|
|||||||
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
|
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
|
||||||
|
|
||||||
#if defined( __GNUC__ )
|
#if defined( __GNUC__ )
|
||||||
#ifdef __i386__
|
#if defined( __i386__ )
|
||||||
#define EXPORT __attribute__(( visibility( "default" ), force_align_arg_pointer ))
|
#define EXPORT __attribute__(( visibility( "default" ), force_align_arg_pointer ))
|
||||||
#define GAME_EXPORT __attribute(( force_align_arg_pointer ))
|
#define GAME_EXPORT __attribute(( force_align_arg_pointer ))
|
||||||
#else
|
#else
|
||||||
#define EXPORT __attribute__(( visibility ( "default" )))
|
#define EXPORT __attribute__(( visibility ( "default" )))
|
||||||
#define GAME_EXPORT
|
#define GAME_EXPORT
|
||||||
#endif
|
#endif
|
||||||
#define _format(x) __attribute__((format(printf, x, x+1)))
|
|
||||||
|
#define MALLOC __attribute__(( malloc ))
|
||||||
|
|
||||||
|
// added in GCC 11
|
||||||
|
#if __GNUC__ >= 11
|
||||||
|
// might want to set noclone due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116893
|
||||||
|
// but it's easier to not force mismatched-dealloc to error yet
|
||||||
|
#define MALLOC_LIKE( x, y ) __attribute__(( malloc( x, y )))
|
||||||
|
#else
|
||||||
|
#define MALLOC_LIKE( x, y ) MALLOC
|
||||||
|
#endif
|
||||||
#define NORETURN __attribute__(( noreturn ))
|
#define NORETURN __attribute__(( noreturn ))
|
||||||
#define NONNULL __attribute__(( nonnull ))
|
#define NONNULL __attribute__(( nonnull ))
|
||||||
|
#define _format( x ) __attribute__(( format( printf, x, x + 1 )))
|
||||||
#define ALLOC_CHECK( x ) __attribute__(( alloc_size( x )))
|
#define ALLOC_CHECK( x ) __attribute__(( alloc_size( x )))
|
||||||
#elif defined(_MSC_VER)
|
#define NO_ASAN __attribute__(( no_sanitize( "address" )))
|
||||||
|
#define WARN_UNUSED_RESULT __attribute__(( warn_unused_result ))
|
||||||
|
#define RENAME_SYMBOL( x ) asm( x )
|
||||||
|
#else
|
||||||
|
#if defined( _MSC_VER )
|
||||||
#define EXPORT __declspec( dllexport )
|
#define EXPORT __declspec( dllexport )
|
||||||
#define GAME_EXPORT
|
#define NO_ASAN __declspec( no_sanitize_address )
|
||||||
#define _format(x)
|
|
||||||
#define NORETURN
|
|
||||||
#define NONNULL
|
|
||||||
#define ALLOC_CHECK(x)
|
|
||||||
#else
|
#else
|
||||||
#define EXPORT
|
#define EXPORT
|
||||||
|
#define NO_ASAN
|
||||||
|
#endif
|
||||||
#define GAME_EXPORT
|
#define GAME_EXPORT
|
||||||
#define _format(x)
|
|
||||||
#define NORETURN
|
#define NORETURN
|
||||||
#define NONNULL
|
#define NONNULL
|
||||||
|
#define _format( x )
|
||||||
#define ALLOC_CHECK( x )
|
#define ALLOC_CHECK( x )
|
||||||
|
#define RENAME_SYMBOL( x )
|
||||||
|
#define MALLOC
|
||||||
|
#define MALLOC_LIKE( x, y )
|
||||||
|
#define WARN_UNUSED_RESULT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ( __GNUC__ >= 3 )
|
#if __GNUC__ >= 3
|
||||||
#define unlikely( x ) __builtin_expect( x, 0 )
|
#define unlikely( x ) __builtin_expect( x, 0 )
|
||||||
#define likely( x ) __builtin_expect( x, 1 )
|
#define likely( x ) __builtin_expect( x, 1 )
|
||||||
#elif defined( __has_builtin )
|
#elif defined( __has_builtin )
|
||||||
#if __has_builtin( __builtin_expect )
|
#if __has_builtin( __builtin_expect ) // this must be after defined() check
|
||||||
#define unlikely( x ) __builtin_expect( x, 0 )
|
#define unlikely( x ) __builtin_expect( x, 0 )
|
||||||
#define likely( x ) __builtin_expect( x, 1 )
|
#define likely( x ) __builtin_expect( x, 1 )
|
||||||
#else
|
|
||||||
#define unlikely(x) (x)
|
|
||||||
#define likely(x) (x)
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#endif
|
||||||
|
|
||||||
|
#if !defined( unlikely ) || !defined( likely )
|
||||||
#define unlikely( x ) ( x )
|
#define unlikely( x ) ( x )
|
||||||
#define likely( x ) ( x )
|
#define likely( x ) ( x )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __STDC_VERSION >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
#if __STDC_VERSION__ >= 202311L || __cplusplus >= 201103L // C23 or C++ static_assert is a keyword
|
||||||
#define STATIC_ASSERT_ static_assert
|
#define STATIC_ASSERT_( ignore, x, y ) static_assert( x, y )
|
||||||
#define STATIC_ASSERT static_assert
|
#define STATIC_ASSERT static_assert
|
||||||
#elif __STDC_VERSION >= 201112L // in C11 it's _Static_assert
|
#elif __STDC_VERSION__ >= 201112L // in C11 it's _Static_assert
|
||||||
#define STATIC_ASSERT_ _Static_assert
|
#define STATIC_ASSERT_( ignore, x, y ) _Static_assert( x, y )
|
||||||
#define STATIC_ASSERT _Static_assert
|
#define STATIC_ASSERT _Static_assert
|
||||||
#else
|
#else
|
||||||
#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]
|
#define STATIC_ASSERT_( id, x, y ) extern int id[( x ) ? 1 : -1]
|
||||||
#define STATIC_ASSERT( x, y ) STATIC_ASSERT_( static_assert_##__LINE__, x, y )
|
// need these to correctly expand the line macro
|
||||||
|
#define STATIC_ASSERT_3( line, x, y ) STATIC_ASSERT_( static_assert_ ## line, x, y )
|
||||||
|
#define STATIC_ASSERT_2( line, x, y ) STATIC_ASSERT_3( line, x, y )
|
||||||
|
#define STATIC_ASSERT( x, y ) STATIC_ASSERT_2( __LINE__, x, y )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// at least, statically check size of some public structures
|
||||||
|
#if XASH_64BIT
|
||||||
|
#define STATIC_CHECK_SIZEOF( type, size32, size64 ) \
|
||||||
|
STATIC_ASSERT( sizeof( type ) == size64, #type " unexpected size" )
|
||||||
|
#else
|
||||||
|
#define STATIC_CHECK_SIZEOF( type, size32, size64 ) \
|
||||||
|
STATIC_ASSERT( sizeof( type ) == size32, #type " unexpected size" )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined( __cplusplus ) && __STDC_VERSION__ >= 199101L // not C++ and C99 or newer
|
||||||
|
#define XASH_RESTRICT restrict
|
||||||
|
#elif _MSC_VER || __GNUC__ || __clang__ // compiler-specific extensions
|
||||||
|
#define XASH_RESTRICT __restrict
|
||||||
|
#else
|
||||||
|
#define XASH_RESTRICT // nothing
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XASH_BIG_ENDIAN
|
#ifdef XASH_BIG_ENDIAN
|
||||||
@@ -164,6 +193,7 @@ _inline float LittleFloat( float f )
|
|||||||
|
|
||||||
typedef unsigned int dword;
|
typedef unsigned int dword;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
|
typedef unsigned long ulong;
|
||||||
typedef char string[MAX_STRING];
|
typedef char string[MAX_STRING];
|
||||||
typedef struct file_s file_t; // normal file
|
typedef struct file_s file_t; // normal file
|
||||||
typedef struct stream_s stream_t; // sound stream for background music playing
|
typedef struct stream_s stream_t; // sound stream for background music playing
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ typedef struct
|
|||||||
float size;
|
float size;
|
||||||
} daliashdr_t;
|
} daliashdr_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( daliashdr_t ) == 84, "invalid daliashdr_t size" );
|
STATIC_CHECK_SIZEOF( daliashdr_t, 84, 84 );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -83,7 +83,7 @@ typedef struct
|
|||||||
int32_t t;
|
int32_t t;
|
||||||
} stvert_t;
|
} stvert_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( stvert_t ) == 12, "invalid stvert_t size" );
|
STATIC_CHECK_SIZEOF( stvert_t, 12, 12 );
|
||||||
|
|
||||||
typedef struct dtriangle_s
|
typedef struct dtriangle_s
|
||||||
{
|
{
|
||||||
@@ -91,7 +91,7 @@ typedef struct dtriangle_s
|
|||||||
int32_t vertindex[3];
|
int32_t vertindex[3];
|
||||||
} dtriangle_t;
|
} dtriangle_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( dtriangle_t ) == 16, "invalid dtriangle_t size" );
|
STATIC_CHECK_SIZEOF( dtriangle_t, 16, 16 );
|
||||||
|
|
||||||
#define DT_FACES_FRONT 0x0010
|
#define DT_FACES_FRONT 0x0010
|
||||||
#define ALIAS_ONSEAM 0x0020
|
#define ALIAS_ONSEAM 0x0020
|
||||||
@@ -103,7 +103,7 @@ typedef struct
|
|||||||
char name[16]; // frame name from grabbing
|
char name[16]; // frame name from grabbing
|
||||||
} daliasframe_t;
|
} daliasframe_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( daliasframe_t ) == 24, "invalid daliasframe_t size" );
|
STATIC_CHECK_SIZEOF( daliasframe_t, 24, 24 );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -112,41 +112,41 @@ typedef struct
|
|||||||
trivertex_t bboxmax; // lightnormal isn't used
|
trivertex_t bboxmax; // lightnormal isn't used
|
||||||
} daliasgroup_t;
|
} daliasgroup_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( daliasgroup_t ) == 12, "invalid daliasgrou_t size" );
|
STATIC_CHECK_SIZEOF( daliasgroup_t, 12, 12 );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int32_t numskins;
|
int32_t numskins;
|
||||||
} daliasskingroup_t;
|
} daliasskingroup_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( daliasskingroup_t ) == 4, "invalid daliasskingroup_t size" );
|
STATIC_CHECK_SIZEOF( daliasskingroup_t, 4, 4 );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
float interval;
|
float interval;
|
||||||
} daliasinterval_t;
|
} daliasinterval_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( daliasinterval_t ) == 4, "invalid daliasinterval_t size" );
|
STATIC_CHECK_SIZEOF( daliasinterval_t, 4, 4 );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
float interval;
|
float interval;
|
||||||
} daliasskininterval_t;
|
} daliasskininterval_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( daliasskininterval_t ) == 4, "invalid daliasskininterval_t size" );
|
STATIC_CHECK_SIZEOF( daliasskininterval_t, 4, 4 );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t type; // was aliasframetype_t
|
uint32_t type; // was aliasframetype_t
|
||||||
} daliasframetype_t;
|
} daliasframetype_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( daliasframetype_t ) == 4, "invalid daliasframetype_t size" );
|
STATIC_CHECK_SIZEOF( daliasframetype_t, 4, 4 );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t type; // was aliasskintype_t
|
uint32_t type; // was aliasskintype_t
|
||||||
} daliasskintype_t;
|
} daliasskintype_t;
|
||||||
|
|
||||||
STATIC_ASSERT( sizeof( daliasskintype_t ) == 4, "invalid daliasskintype_t size" );
|
STATIC_CHECK_SIZEOF( daliasskintype_t, 4, 4 );
|
||||||
|
|
||||||
#endif//ALIAS_H
|
#endif//ALIAS_H
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
/***
|
/*
|
||||||
*
|
Copyright (C) 1996-1997 Id Software, Inc.
|
||||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
|
|
||||||
*
|
|
||||||
* This product contains software technology licensed from Id
|
|
||||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
|
||||||
* All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Use, distribution, and modification of this source code and/or resulting
|
|
||||||
* object code is restricted to non-commercial enhancements to products from
|
|
||||||
* Valve LLC. All other use, distribution, or modification is prohibited
|
|
||||||
* without written permission from Valve LLC.
|
|
||||||
*
|
|
||||||
****/
|
|
||||||
|
|
||||||
|
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.525731, 0.000000, 0.850651},
|
||||||
{-0.442863, 0.238856, 0.864188},
|
{-0.442863, 0.238856, 0.864188},
|
||||||
{-0.295242, 0.000000, 0.955423},
|
{-0.295242, 0.000000, 0.955423},
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ void CL_PlayCDTrack_f( void )
|
|||||||
if( paused ) Con_Printf( "Paused %s track %u\n", looped ? "looping" : "playing", track );
|
if( paused ) Con_Printf( "Paused %s track %u\n", looped ? "looping" : "playing", track );
|
||||||
else Con_Printf( "Currently %s track %u\n", looped ? "looping" : "playing", track );
|
else Con_Printf( "Currently %s track %u\n", looped ? "looping" : "playing", track );
|
||||||
}
|
}
|
||||||
Con_Printf( "Volume is %f\n", Cvar_VariableValue( "MP3Volume" ));
|
Con_Printf( "Volume is %f\n", s_musicvolume.value );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else Con_Printf( "%s: unknown command %s\n", Cmd_Argv( 0 ), command );
|
else Con_Printf( "%s: unknown command %s\n", Cmd_Argv( 0 ), command );
|
||||||
@@ -157,32 +157,12 @@ void CL_PlayCDTrack_f( void )
|
|||||||
CL_ScreenshotGetName
|
CL_ScreenshotGetName
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_ScreenshotGetName( int lastnum, char *filename, size_t size )
|
static qboolean CL_ScreenshotGetName( const char *fmt, int lastnum, char *filename, size_t size )
|
||||||
{
|
{
|
||||||
if( lastnum < 0 || lastnum > 9999 )
|
if( lastnum < 0 || lastnum > 9999 )
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "unable to write screenshot\n" );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return Q_snprintf( filename, size, "scrshots/%s_shot%04d.png", clgame.mapname, lastnum ) > 0;
|
return Q_snprintf( filename, size, fmt, clgame.mapname, lastnum ) > 0;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
CL_SnapshotGetName
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
static qboolean CL_SnapshotGetName( int lastnum, char *filename, size_t size )
|
|
||||||
{
|
|
||||||
if( lastnum < 0 || lastnum > 9999 )
|
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "unable to write snapshot\n" );
|
|
||||||
FS_AllowDirectPaths( false );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Q_snprintf( filename, size, "../%s_%04d.png", clgame.mapname, lastnum ) > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -192,127 +172,6 @@ static qboolean CL_SnapshotGetName( int lastnum, char *filename, size_t size )
|
|||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
==================
|
|
||||||
CL_ScreenShot_f
|
|
||||||
|
|
||||||
normal screenshot
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void CL_ScreenShot_f( void )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
string checkname;
|
|
||||||
|
|
||||||
if( CL_IsDevOverviewMode() == 1 )
|
|
||||||
{
|
|
||||||
// special case for write overview image and script file
|
|
||||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
|
||||||
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// scan for a free filename
|
|
||||||
for( i = 0; i < 9999; i++ )
|
|
||||||
{
|
|
||||||
if( !CL_ScreenshotGetName( i, checkname, sizeof( checkname )))
|
|
||||||
return; // no namespace
|
|
||||||
|
|
||||||
if( !FS_FileExists( checkname, true ))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
|
||||||
cls.scrshot_action = scrshot_normal; // build new frame for screenshot
|
|
||||||
}
|
|
||||||
|
|
||||||
cls.envshot_vieworg = NULL; // no custom view
|
|
||||||
cls.envshot_viewsize = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
CL_SnapShot_f
|
|
||||||
|
|
||||||
save screenshots into root dir
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void CL_SnapShot_f( void )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
string checkname;
|
|
||||||
|
|
||||||
if( CL_IsDevOverviewMode() == 1 )
|
|
||||||
{
|
|
||||||
// special case for write overview image and script file
|
|
||||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
|
||||||
cls.scrshot_action = scrshot_mapshot; // build new frame for mapshot
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FS_AllowDirectPaths( true );
|
|
||||||
|
|
||||||
// scan for a free filename
|
|
||||||
for( i = 0; i < 9999; i++ )
|
|
||||||
{
|
|
||||||
if( !CL_SnapshotGetName( i, checkname, sizeof( checkname )))
|
|
||||||
return; // no namespace
|
|
||||||
|
|
||||||
if( !FS_FileExists( checkname, true ))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
FS_AllowDirectPaths( false );
|
|
||||||
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
|
||||||
cls.scrshot_action = scrshot_snapshot; // build new frame for screenshot
|
|
||||||
}
|
|
||||||
|
|
||||||
cls.envshot_vieworg = NULL; // no custom view
|
|
||||||
cls.envshot_viewsize = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
CL_EnvShot_f
|
|
||||||
|
|
||||||
cubemap view
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void CL_EnvShot_f( void )
|
|
||||||
{
|
|
||||||
if( Cmd_Argc() < 2 )
|
|
||||||
{
|
|
||||||
Con_Printf( S_USAGE "envshot <shotname>\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "gfx/env/%s", Cmd_Argv( 1 ));
|
|
||||||
cls.scrshot_action = scrshot_envshot; // build new frame for envshot
|
|
||||||
cls.envshot_vieworg = NULL; // no custom view
|
|
||||||
cls.envshot_viewsize = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
CL_SkyShot_f
|
|
||||||
|
|
||||||
skybox view
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void CL_SkyShot_f( void )
|
|
||||||
{
|
|
||||||
if( Cmd_Argc() < 2 )
|
|
||||||
{
|
|
||||||
Con_Printf( S_USAGE "skyshot <shotname>\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ),"gfx/env/%s", Cmd_Argv( 1 ));
|
|
||||||
cls.scrshot_action = scrshot_skyshot; // build new frame for skyshot
|
|
||||||
cls.envshot_vieworg = NULL; // no custom view
|
|
||||||
cls.envshot_viewsize = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
CL_LevelShot_f
|
CL_LevelShot_f
|
||||||
@@ -355,23 +214,107 @@ void CL_LevelShot_f( void )
|
|||||||
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
else cls.scrshot_action = scrshot_inactive; // disable - not needs
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static scrshot_t CL_GetScreenshotTypeFromString( const char *string )
|
||||||
==================
|
{
|
||||||
CL_SaveShot_f
|
if( !Q_stricmp( string, "snapshot" ))
|
||||||
|
return scrshot_snapshot;
|
||||||
|
|
||||||
mini-pic in loadgame menu
|
if( !Q_stricmp( string, "screenshot" ))
|
||||||
==================
|
return scrshot_normal;
|
||||||
*/
|
|
||||||
void CL_SaveShot_f( void )
|
if( !Q_stricmp( string, "saveshot" ))
|
||||||
|
return scrshot_savegame;
|
||||||
|
|
||||||
|
if( !Q_stricmp( string, "envshot" ))
|
||||||
|
return scrshot_envshot;
|
||||||
|
|
||||||
|
if( !Q_stricmp( string, "skyshot" ))
|
||||||
|
return scrshot_skyshot;
|
||||||
|
|
||||||
|
return scrshot_inactive;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CL_GenericShot_f( void )
|
||||||
|
{
|
||||||
|
const char *argv0 = Cmd_Argv( 0 );
|
||||||
|
scrshot_t type;
|
||||||
|
|
||||||
|
type = CL_GetScreenshotTypeFromString( argv0 );
|
||||||
|
|
||||||
|
if( type == scrshot_normal || type == scrshot_snapshot )
|
||||||
|
{
|
||||||
|
if( CL_IsDevOverviewMode() == 1 )
|
||||||
|
type = scrshot_mapshot;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() < 2 )
|
if( Cmd_Argc() < 2 )
|
||||||
{
|
{
|
||||||
Con_Printf( S_USAGE "saveshot <savename>\n" );
|
Con_Printf( S_USAGE "%s <shotname>\n", argv0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
case scrshot_envshot:
|
||||||
|
case scrshot_skyshot:
|
||||||
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "gfx/env/%s", Cmd_Argv( 1 ));
|
||||||
|
break;
|
||||||
|
case scrshot_savegame:
|
||||||
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 ));
|
||||||
|
break;
|
||||||
|
case scrshot_mapshot:
|
||||||
|
Q_snprintf( cls.shotname, sizeof( cls.shotname ), "overviews/%s.bmp", clgame.mapname );
|
||||||
|
break;
|
||||||
|
case scrshot_normal:
|
||||||
|
case scrshot_snapshot:
|
||||||
|
{
|
||||||
|
const char *fmt;
|
||||||
|
string checkname;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// allow overriding screenshot by users request
|
||||||
|
if( Cmd_Argc() > 1 )
|
||||||
|
{
|
||||||
|
Q_strncpy( cls.shotname, Cmd_Argv( 1 ), sizeof( cls.shotname ));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( type == scrshot_snapshot )
|
||||||
|
{
|
||||||
|
fmt = "../%s_%04d.png";
|
||||||
|
FS_AllowDirectPaths( true );
|
||||||
|
}
|
||||||
|
else fmt = "scrshots/%s_shot%04d.png";
|
||||||
|
|
||||||
|
for( i = 0; i < 9999; i++ )
|
||||||
|
{
|
||||||
|
if( !CL_ScreenshotGetName( fmt, i, checkname, sizeof( checkname )))
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "unable to write %s\n", argv0 );
|
||||||
|
FS_AllowDirectPaths( false );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_snprintf( cls.shotname, sizeof( cls.shotname ), DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 ));
|
if( !FS_FileExists( checkname, true ))
|
||||||
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
FS_AllowDirectPaths( false );
|
||||||
|
|
||||||
|
Q_strncpy( cls.shotname, checkname, sizeof( cls.shotname ));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case scrshot_inactive:
|
||||||
|
case scrshot_plaque:
|
||||||
|
default:
|
||||||
|
return; // shouldn't happen
|
||||||
|
}
|
||||||
|
|
||||||
|
cls.scrshot_action = type; // build new frame for saveshot
|
||||||
|
cls.envshot_vieworg = NULL;
|
||||||
|
cls.envshot_viewsize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -413,7 +356,7 @@ void CL_SetSky_f( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref.dllFuncs.R_SetupSky( Cmd_Argv( 1 ));
|
R_SetupSky( Cmd_Argv( 1 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
|
|||||||
|
|
||||||
if( !cl_allow_download.value )
|
if( !cl_allow_download.value )
|
||||||
{
|
{
|
||||||
Con_Reportf( "Download refused, cl_allow_download is 0\n" );
|
Con_Reportf( "Download refused, cl_allowdownload is 0\n" );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,16 +70,17 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cl.downloadUrl[0] )
|
|
||||||
{
|
|
||||||
HTTP_AddDownload( filepath, pResource->nDownloadSize, true );
|
|
||||||
host.downloadcount++;
|
host.downloadcount++;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if( cl.http_download )
|
||||||
|
{
|
||||||
|
HTTP_AddDownload( filepath, pResource->nDownloadSize, true, pResource );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
MSG_BeginClientCmd( msg, clc_stringcmd );
|
MSG_BeginClientCmd( msg, clc_stringcmd );
|
||||||
MSG_WriteStringf( msg, "dlfile %s", filepath );
|
MSG_WriteStringf( msg, "dlfile %s", filepath );
|
||||||
host.downloadcount++;
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -104,7 +105,7 @@ void CL_AddToResourceList( resource_t *pResource, resource_t *pList )
|
|||||||
void CL_RemoveFromResourceList( resource_t *pResource )
|
void CL_RemoveFromResourceList( resource_t *pResource )
|
||||||
{
|
{
|
||||||
if( pResource->pPrev == NULL || pResource->pNext == NULL )
|
if( pResource->pPrev == NULL || pResource->pNext == NULL )
|
||||||
Host_Error( "mislinked resource in CL_RemoveFromResourceList\n" );
|
Host_Error( "mislinked resource in %s\n", __func__ );
|
||||||
|
|
||||||
if( pResource->pNext == pResource || pResource->pPrev == pResource )
|
if( pResource->pNext == pResource || pResource->pPrev == pResource )
|
||||||
Host_Error( "attempt to free last entry in list.\n" );
|
Host_Error( "attempt to free last entry in list.\n" );
|
||||||
@@ -119,7 +120,7 @@ void CL_MoveToOnHandList( resource_t *pResource )
|
|||||||
{
|
{
|
||||||
if( !pResource )
|
if( !pResource )
|
||||||
{
|
{
|
||||||
Con_Reportf( "Null resource passed to CL_MoveToOnHandList\n" );
|
Con_Reportf( "Null resource passed to %s\n", __func__ );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +128,7 @@ void CL_MoveToOnHandList( resource_t *pResource )
|
|||||||
CL_AddToResourceList( pResource, &cl.resourcesonhand );
|
CL_AddToResourceList( pResource, &cl.resourcesonhand );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_ClearResourceList( resource_t *pList )
|
static void CL_ClearResourceList( resource_t *pList )
|
||||||
{
|
{
|
||||||
resource_t *p, *n;
|
resource_t *p, *n;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,29 @@ const char *CL_MsgInfo( int cmd )
|
|||||||
if( cmd >= 0 && cmd <= svc_lastmsg )
|
if( cmd >= 0 && cmd <= svc_lastmsg )
|
||||||
{
|
{
|
||||||
// get engine message name
|
// get engine message name
|
||||||
Q_strncpy( sz, svc_strings[cmd], sizeof( sz ));
|
const char *svc_string = NULL;
|
||||||
|
|
||||||
|
switch( cls.legacymode )
|
||||||
|
{
|
||||||
|
case PROTO_CURRENT:
|
||||||
|
svc_string = svc_strings[cmd];
|
||||||
|
break;
|
||||||
|
case PROTO_LEGACY:
|
||||||
|
svc_string = svc_legacy_strings[cmd];
|
||||||
|
break;
|
||||||
|
case PROTO_QUAKE:
|
||||||
|
svc_string = svc_quake_strings[cmd];
|
||||||
|
break;
|
||||||
|
case PROTO_GOLDSRC:
|
||||||
|
svc_string = svc_goldsrc_strings[cmd];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fall back to current protocol strings
|
||||||
|
if( !svc_string )
|
||||||
|
svc_string = svc_strings[cmd];
|
||||||
|
|
||||||
|
Q_strncpy( sz, svc_string, sizeof( sz ));
|
||||||
}
|
}
|
||||||
else if( cmd > svc_lastmsg && cmd <= ( svc_lastmsg + MAX_USER_MESSAGES ))
|
else if( cmd > svc_lastmsg && cmd <= ( svc_lastmsg + MAX_USER_MESSAGES ))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ GNU General Public License for more details.
|
|||||||
#define IDEMOHEADER (('M'<<24)+('E'<<16)+('D'<<8)+'I') // little-endian "IDEM"
|
#define IDEMOHEADER (('M'<<24)+('E'<<16)+('D'<<8)+'I') // little-endian "IDEM"
|
||||||
#define DEMO_PROTOCOL 3
|
#define DEMO_PROTOCOL 3
|
||||||
|
|
||||||
|
#define PROTOCOL_GOLDSRC_VERSION_DEMO (PROTOCOL_GOLDSRC_VERSION | (BIT( 7 ))) // should be 48, only to differentiate it from PROTOCOL_LEGACY_VERSION
|
||||||
|
|
||||||
const char *demo_cmd[dem_lastcmd+1] =
|
const char *demo_cmd[dem_lastcmd+1] =
|
||||||
{
|
{
|
||||||
"dem_unknown",
|
"dem_unknown",
|
||||||
@@ -79,7 +81,7 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
demoentry_t *entries; // track entry info
|
demoentry_t *entries; // track entry info
|
||||||
int numentries; // number of tracks
|
int32_t numentries; // number of tracks
|
||||||
} demodirectory_t;
|
} demodirectory_t;
|
||||||
|
|
||||||
// add angles
|
// add angles
|
||||||
@@ -107,6 +109,42 @@ struct
|
|||||||
int angle_position;
|
int angle_position;
|
||||||
} demo;
|
} demo;
|
||||||
|
|
||||||
|
static qboolean CL_NextDemo( void );
|
||||||
|
|
||||||
|
static int CL_GetDemoNetProtocol( connprotocol_t proto )
|
||||||
|
{
|
||||||
|
switch( proto )
|
||||||
|
{
|
||||||
|
case PROTO_CURRENT:
|
||||||
|
return PROTOCOL_VERSION;
|
||||||
|
case PROTO_LEGACY:
|
||||||
|
return PROTOCOL_LEGACY_VERSION;
|
||||||
|
case PROTO_QUAKE:
|
||||||
|
return PROTOCOL_VERSION_QUAKE;
|
||||||
|
case PROTO_GOLDSRC:
|
||||||
|
return PROTOCOL_GOLDSRC_VERSION_DEMO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PROTOCOL_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
|
static connprotocol_t CL_GetProtocolFromDemo( int net_protocol )
|
||||||
|
{
|
||||||
|
switch( net_protocol )
|
||||||
|
{
|
||||||
|
case PROTOCOL_VERSION:
|
||||||
|
return PROTO_CURRENT;
|
||||||
|
case PROTOCOL_LEGACY_VERSION:
|
||||||
|
return PROTO_LEGACY;
|
||||||
|
case PROTOCOL_VERSION_QUAKE:
|
||||||
|
return PROTO_QUAKE;
|
||||||
|
case PROTOCOL_GOLDSRC_VERSION_DEMO:
|
||||||
|
return PROTO_GOLDSRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PROTO_CURRENT;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
CL_StartupDemoHeader
|
CL_StartupDemoHeader
|
||||||
@@ -117,12 +155,8 @@ we record a demo on this level
|
|||||||
*/
|
*/
|
||||||
void CL_StartupDemoHeader( void )
|
void CL_StartupDemoHeader( void )
|
||||||
{
|
{
|
||||||
if( cls.demoheader )
|
CL_CloseDemoHeader();
|
||||||
{
|
|
||||||
FS_Close( cls.demoheader );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: this is replacing tmpfile()
|
|
||||||
cls.demoheader = FS_Open( "demoheader.tmp", "w+b", true );
|
cls.demoheader = FS_Open( "demoheader.tmp", "w+b", true );
|
||||||
|
|
||||||
if( !cls.demoheader )
|
if( !cls.demoheader )
|
||||||
@@ -156,7 +190,7 @@ CL_GetDemoRecordClock
|
|||||||
write time while demo is recording
|
write time while demo is recording
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
float CL_GetDemoRecordClock( void )
|
static float CL_GetDemoRecordClock( void )
|
||||||
{
|
{
|
||||||
return cl.mtime[0];
|
return cl.mtime[0];
|
||||||
}
|
}
|
||||||
@@ -168,7 +202,7 @@ CL_GetDemoPlaybackClock
|
|||||||
overwrite host.realtime
|
overwrite host.realtime
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
float CL_GetDemoPlaybackClock( void )
|
static float CL_GetDemoPlaybackClock( void )
|
||||||
{
|
{
|
||||||
return host.realtime + host.frametime;
|
return host.realtime + host.frametime;
|
||||||
}
|
}
|
||||||
@@ -194,7 +228,7 @@ CL_WriteDemoCmdHeader
|
|||||||
Writes the demo command header and time-delta
|
Writes the demo command header and time-delta
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_WriteDemoCmdHeader( byte cmd, file_t *file )
|
static void CL_WriteDemoCmdHeader( byte cmd, file_t *file )
|
||||||
{
|
{
|
||||||
float dt;
|
float dt;
|
||||||
|
|
||||||
@@ -251,7 +285,7 @@ void CL_WriteDemoUserCmd( int cmdnumber )
|
|||||||
|
|
||||||
// write usercmd_t
|
// write usercmd_t
|
||||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||||
CL_WriteUsercmd( &buf, -1, cmdnumber ); // always no delta
|
CL_WriteUsercmd( PROTO_CURRENT, &buf, -1, cmdnumber ); // always no delta, always in current protocol
|
||||||
|
|
||||||
bytes = MSG_GetNumBytesWritten( &buf );
|
bytes = MSG_GetNumBytesWritten( &buf );
|
||||||
|
|
||||||
@@ -267,7 +301,7 @@ Save state of cls.netchan sequences
|
|||||||
so that we can play the demo correctly.
|
so that we can play the demo correctly.
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_WriteDemoSequence( file_t *file )
|
static void CL_WriteDemoSequence( file_t *file )
|
||||||
{
|
{
|
||||||
Assert( file != NULL );
|
Assert( file != NULL );
|
||||||
|
|
||||||
@@ -295,10 +329,6 @@ void CL_WriteDemoMessage( qboolean startup, int start, sizebuf_t *msg )
|
|||||||
|
|
||||||
if( !file ) return;
|
if( !file ) return;
|
||||||
|
|
||||||
// past the start but not recording a demo.
|
|
||||||
if( !startup && !cls.demorecording )
|
|
||||||
return;
|
|
||||||
|
|
||||||
swlen = MSG_GetNumBytesWritten( msg ) - start;
|
swlen = MSG_GetNumBytesWritten( msg ) - start;
|
||||||
if( swlen <= 0 ) return;
|
if( swlen <= 0 ) return;
|
||||||
|
|
||||||
@@ -348,7 +378,7 @@ CL_WriteDemoHeader
|
|||||||
Write demo header
|
Write demo header
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_WriteDemoHeader( const char *name )
|
static void CL_WriteDemoHeader( const char *name )
|
||||||
{
|
{
|
||||||
int copysize;
|
int copysize;
|
||||||
int savepos;
|
int savepos;
|
||||||
@@ -371,7 +401,7 @@ void CL_WriteDemoHeader( const char *name )
|
|||||||
|
|
||||||
demo.header.id = IDEMOHEADER;
|
demo.header.id = IDEMOHEADER;
|
||||||
demo.header.dem_protocol = DEMO_PROTOCOL;
|
demo.header.dem_protocol = DEMO_PROTOCOL;
|
||||||
demo.header.net_protocol = cls.legacymode ? PROTOCOL_LEGACY_VERSION : PROTOCOL_VERSION;
|
demo.header.net_protocol = CL_GetDemoNetProtocol( cls.legacymode );
|
||||||
demo.header.host_fps = host_maxfps.value ? bound( MIN_FPS, host_maxfps.value, MAX_FPS ) : 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.mapname, clgame.mapname, sizeof( demo.header.mapname ));
|
||||||
Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment ));
|
Q_strncpy( demo.header.comment, clgame.maptitle, sizeof( demo.header.comment ));
|
||||||
@@ -391,6 +421,7 @@ void CL_WriteDemoHeader( const char *name )
|
|||||||
|
|
||||||
// finish off the startup info.
|
// finish off the startup info.
|
||||||
CL_WriteDemoCmdHeader( dem_stop, cls.demoheader );
|
CL_WriteDemoCmdHeader( dem_stop, cls.demoheader );
|
||||||
|
FS_Flush( cls.demoheader );
|
||||||
|
|
||||||
// now copy the stuff we cached from the server.
|
// now copy the stuff we cached from the server.
|
||||||
copysize = savepos = FS_Tell( cls.demoheader );
|
copysize = savepos = FS_Tell( cls.demoheader );
|
||||||
@@ -436,7 +467,7 @@ CL_StopRecord
|
|||||||
finish recording demo
|
finish recording demo
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_StopRecord( void )
|
static void CL_StopRecord( void )
|
||||||
{
|
{
|
||||||
int i, curpos;
|
int i, curpos;
|
||||||
float stoptime;
|
float stoptime;
|
||||||
@@ -518,7 +549,7 @@ CL_ReadDemoCmdHeader
|
|||||||
read the demo command
|
read the demo command
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
static qboolean CL_ReadDemoCmdHeader( byte *cmd, float *dt )
|
||||||
{
|
{
|
||||||
// read the command
|
// read the command
|
||||||
// HACKHACK: skip NOPs
|
// HACKHACK: skip NOPs
|
||||||
@@ -548,7 +579,7 @@ read the demo usercmd for predicting
|
|||||||
and smooth movement during playback the demo
|
and smooth movement during playback the demo
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ReadDemoUserCmd( qboolean discard )
|
static void CL_ReadDemoUserCmd( qboolean discard )
|
||||||
{
|
{
|
||||||
byte data[1024];
|
byte data[1024];
|
||||||
int cmdnumber;
|
int cmdnumber;
|
||||||
@@ -570,6 +601,9 @@ void CL_ReadDemoUserCmd( qboolean discard )
|
|||||||
memset( &nullcmd, 0, sizeof( nullcmd ));
|
memset( &nullcmd, 0, sizeof( nullcmd ));
|
||||||
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
MSG_Init( &buf, "UserCmd", data, sizeof( data ));
|
||||||
|
|
||||||
|
// a1ba: I have no proper explanation why
|
||||||
|
cmdnumber++;
|
||||||
|
|
||||||
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
pcmd = &cl.commands[cmdnumber & CL_UPDATE_MASK];
|
||||||
pcmd->processedfuncs = false;
|
pcmd->processedfuncs = false;
|
||||||
pcmd->senttime = 0.0f;
|
pcmd->senttime = 0.0f;
|
||||||
@@ -610,7 +644,7 @@ CL_ReadDemoSequence
|
|||||||
read netchan sequences
|
read netchan sequences
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ReadDemoSequence( qboolean discard )
|
static void CL_ReadDemoSequence( qboolean discard )
|
||||||
{
|
{
|
||||||
int incoming_sequence;
|
int incoming_sequence;
|
||||||
int incoming_acknowledged;
|
int incoming_acknowledged;
|
||||||
@@ -644,7 +678,7 @@ void CL_ReadDemoSequence( qboolean discard )
|
|||||||
CL_DemoStartPlayback
|
CL_DemoStartPlayback
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_DemoStartPlayback( int mode )
|
static void CL_DemoStartPlayback( int mode )
|
||||||
{
|
{
|
||||||
if( cls.changedemo )
|
if( cls.changedemo )
|
||||||
{
|
{
|
||||||
@@ -674,7 +708,7 @@ void CL_DemoStartPlayback( int mode )
|
|||||||
|
|
||||||
demo.starttime = CL_GetDemoPlaybackClock(); // for determining whether to read another message
|
demo.starttime = CL_GetDemoPlaybackClock(); // for determining whether to read another message
|
||||||
|
|
||||||
Netchan_Setup( NS_CLIENT, &cls.netchan, net_from, Cvar_VariableInteger( "net_qport" ), NULL, CL_GetFragmentSize );
|
CL_SetupNetchanForProtocol( cls.legacymode );
|
||||||
|
|
||||||
memset( demo.cmds, 0, sizeof( demo.cmds ));
|
memset( demo.cmds, 0, sizeof( demo.cmds ));
|
||||||
demo.angle_position = 1;
|
demo.angle_position = 1;
|
||||||
@@ -689,7 +723,7 @@ void CL_DemoStartPlayback( int mode )
|
|||||||
CL_DemoAborted
|
CL_DemoAborted
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_DemoAborted( void )
|
static void CL_DemoAborted( void )
|
||||||
{
|
{
|
||||||
if( cls.demofile )
|
if( cls.demofile )
|
||||||
FS_Close( cls.demofile );
|
FS_Close( cls.demofile );
|
||||||
@@ -729,7 +763,7 @@ returns true on success, false on failure
|
|||||||
g-cont. probably captain obvious mode is ON
|
g-cont. probably captain obvious mode is ON
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean CL_DemoMoveToNextSection( void )
|
static qboolean CL_DemoMoveToNextSection( void )
|
||||||
{
|
{
|
||||||
if( ++demo.entryIndex >= demo.directory.numentries )
|
if( ++demo.entryIndex >= demo.directory.numentries )
|
||||||
{
|
{
|
||||||
@@ -751,7 +785,7 @@ qboolean CL_DemoMoveToNextSection( void )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
static qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
|
||||||
{
|
{
|
||||||
int msglen = 0;
|
int msglen = 0;
|
||||||
|
|
||||||
@@ -802,7 +836,7 @@ CL_DemoReadMessageQuake
|
|||||||
reads demo data and write it to client
|
reads demo data and write it to client
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
|
static qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
|
||||||
{
|
{
|
||||||
vec3_t viewangles;
|
vec3_t viewangles;
|
||||||
int msglen = 0;
|
int msglen = 0;
|
||||||
@@ -1017,7 +1051,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
|
|||||||
return CL_ReadRawNetworkData( buffer, length );
|
return CL_ReadRawNetworkData( buffer, length );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev, demoangle_t **next )
|
static void CL_DemoFindInterpolatedViewAngles( float t, float *frac, demoangle_t **prev, demoangle_t **next )
|
||||||
{
|
{
|
||||||
int i, i0, i1, imod;
|
int i, i0, i1, imod;
|
||||||
float at;
|
float at;
|
||||||
@@ -1112,8 +1146,9 @@ CL_FinishTimeDemo
|
|||||||
show stats
|
show stats
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_FinishTimeDemo( void )
|
static void CL_FinishTimeDemo( void )
|
||||||
{
|
{
|
||||||
|
qboolean temp = host.allow_console;
|
||||||
int frames;
|
int frames;
|
||||||
double time;
|
double time;
|
||||||
|
|
||||||
@@ -1124,7 +1159,9 @@ void CL_FinishTimeDemo( void )
|
|||||||
time = host.realtime - cls.td_starttime;
|
time = host.realtime - cls.td_starttime;
|
||||||
if( !time ) time = 1.0;
|
if( !time ) time = 1.0;
|
||||||
|
|
||||||
|
host.allow_console = true;
|
||||||
Con_Printf( "timedemo result: %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 );
|
||||||
|
host.allow_console = temp;
|
||||||
|
|
||||||
if( Sys_CheckParm( "-timedemo" ))
|
if( Sys_CheckParm( "-timedemo" ))
|
||||||
CL_Quit_f();
|
CL_Quit_f();
|
||||||
@@ -1261,7 +1298,7 @@ CL_NextDemo
|
|||||||
Called when a demo finishes
|
Called when a demo finishes
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_NextDemo( void )
|
static qboolean CL_NextDemo( void )
|
||||||
{
|
{
|
||||||
char str[MAX_QPATH];
|
char str[MAX_QPATH];
|
||||||
|
|
||||||
@@ -1413,6 +1450,51 @@ void CL_Record_f( void )
|
|||||||
CL_WriteDemoHeader( demopath );
|
CL_WriteDemoHeader( demopath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static qboolean CL_ParseDemoHeader( const char *callee, const char *filename, file_t *f, demoheader_t *hdr, int32_t *numentries )
|
||||||
|
{
|
||||||
|
if( FS_Read( f, hdr, sizeof( *hdr )) != sizeof( *hdr ) || hdr->id != IDEMOHEADER )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "%s: %s is not in supported format or not a demo file\n", callee, filename );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// force null terminate strings
|
||||||
|
hdr->mapname[sizeof( hdr->mapname ) - 1] = 0;
|
||||||
|
hdr->comment[sizeof( hdr->comment ) - 1] = 0;
|
||||||
|
hdr->gamedir[sizeof( hdr->gamedir ) - 1] = 0;
|
||||||
|
|
||||||
|
if( hdr->dem_protocol != DEMO_PROTOCOL )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "%s: demo protocol outdated (%i should be %i)\n",
|
||||||
|
callee, hdr->net_protocol, DEMO_PROTOCOL );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( hdr->net_protocol != PROTOCOL_VERSION && hdr->net_protocol != PROTOCOL_LEGACY_VERSION && hdr->net_protocol != PROTOCOL_GOLDSRC_VERSION_DEMO )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "%s: net protocol outdated (%i should be %i or %i)\n",
|
||||||
|
callee, hdr->net_protocol, PROTOCOL_VERSION, PROTOCOL_LEGACY_VERSION );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( FS_Seek( f, hdr->directory_offset, SEEK_SET ) < 0
|
||||||
|
|| FS_Read( f, numentries, sizeof( *numentries )) != sizeof( *numentries ))
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "%s: can't find directory offset in %s, demo file corrupted\n",
|
||||||
|
callee, filename );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(( *numentries < 1 ) || ( *numentries > 1024 ))
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "%s: demo have bogus # of directory entries: %i\n",
|
||||||
|
callee, *numentries );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
CL_PlayDemo_f
|
CL_PlayDemo_f
|
||||||
@@ -1433,9 +1515,7 @@ void CL_PlayDemo_f( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( cls.demoplayback )
|
if( cls.demoplayback )
|
||||||
{
|
|
||||||
CL_StopPlayback();
|
CL_StopPlayback();
|
||||||
}
|
|
||||||
|
|
||||||
if( cls.demorecording )
|
if( cls.demorecording )
|
||||||
{
|
{
|
||||||
@@ -1485,51 +1565,32 @@ void CL_PlayDemo_f( void )
|
|||||||
|
|
||||||
if( neg ) cls.forcetrack = -cls.forcetrack;
|
if( neg ) cls.forcetrack = -cls.forcetrack;
|
||||||
CL_DemoStartPlayback( DEMO_QUAKE1 );
|
CL_DemoStartPlayback( DEMO_QUAKE1 );
|
||||||
|
cls.legacymode = PROTO_QUAKE;
|
||||||
return; // quake demo is started
|
return; // quake demo is started
|
||||||
}
|
}
|
||||||
|
|
||||||
// read in the demo header
|
// read in the demo header
|
||||||
FS_Read( cls.demofile, &demo.header, sizeof( demoheader_t ));
|
if( !CL_ParseDemoHeader( Cmd_Argv( 0 ), filename, cls.demofile, &demo.header, &demo.directory.numentries ))
|
||||||
|
|
||||||
if( demo.header.id != IDEMOHEADER )
|
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "%s is not a demo file\n", demoname );
|
|
||||||
CL_DemoAborted();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( demo.header.dem_protocol != DEMO_PROTOCOL )
|
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "playdemo: demo protocol outdated (%i should be %i)\n", demo.header.dem_protocol, DEMO_PROTOCOL );
|
|
||||||
CL_DemoAborted();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( demo.header.net_protocol != PROTOCOL_VERSION &&
|
|
||||||
demo.header.net_protocol != PROTOCOL_LEGACY_VERSION )
|
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "playdemo: net protocol outdated (%i should be %i)\n", demo.header.net_protocol, PROTOCOL_VERSION );
|
|
||||||
CL_DemoAborted();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// now read in the directory structure.
|
|
||||||
FS_Seek( cls.demofile, demo.header.directory_offset, SEEK_SET );
|
|
||||||
FS_Read( cls.demofile, &demo.directory.numentries, sizeof( int ));
|
|
||||||
|
|
||||||
if( demo.directory.numentries < 1 || demo.directory.numentries > 1024 )
|
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "demo had bogus # of directory entries: %i\n", demo.directory.numentries );
|
|
||||||
CL_DemoAborted();
|
CL_DemoAborted();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate demo entries
|
// allocate demo entries
|
||||||
demo.directory.entries = Mem_Malloc( cls.mempool, sizeof( demoentry_t ) * demo.directory.numentries );
|
demo.directory.entries = Mem_Malloc( cls.mempool, sizeof( *demo.directory.entries ) * demo.directory.numentries );
|
||||||
|
|
||||||
for( i = 0; i < demo.directory.numentries; i++ )
|
for( i = 0; i < demo.directory.numentries; i++ )
|
||||||
{
|
{
|
||||||
FS_Read( cls.demofile, &demo.directory.entries[i], sizeof( demoentry_t ));
|
demoentry_t *entry = &demo.directory.entries[i];
|
||||||
|
|
||||||
|
if( FS_Read( cls.demofile, entry, sizeof( *entry )) != sizeof( *entry ))
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "%s: demo entry %i of %s corrupted", Cmd_Argv( 0 ), i, filename );
|
||||||
|
CL_DemoAborted();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry->description[sizeof( entry->description ) - 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
demo.entryIndex = 0;
|
demo.entryIndex = 0;
|
||||||
@@ -1539,9 +1600,11 @@ void CL_PlayDemo_f( void )
|
|||||||
|
|
||||||
CL_DemoStartPlayback( DEMO_XASH3D );
|
CL_DemoStartPlayback( DEMO_XASH3D );
|
||||||
|
|
||||||
|
// must be after DemoStartPlayback, as CL_Disconnect_f resets the protocol
|
||||||
|
cls.legacymode = CL_GetProtocolFromDemo( demo.header.net_protocol );
|
||||||
|
|
||||||
// g-cont. is this need?
|
// g-cont. is this need?
|
||||||
Q_strncpy( cls.servername, demoname, sizeof( cls.servername ));
|
Q_strncpy( cls.servername, demoname, sizeof( cls.servername ));
|
||||||
cls.legacymode = demo.header.net_protocol == PROTOCOL_LEGACY_VERSION;
|
|
||||||
|
|
||||||
// begin a playback demo
|
// begin a playback demo
|
||||||
}
|
}
|
||||||
@@ -1583,7 +1646,7 @@ void CL_StartDemos_f( void )
|
|||||||
c = Cmd_Argc() - 1;
|
c = Cmd_Argc() - 1;
|
||||||
if( c > MAX_DEMOS )
|
if( c > MAX_DEMOS )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_WARN "Host_StartDemos: max %i demos in demoloop\n", MAX_DEMOS );
|
Con_DPrintf( S_WARN "%s: max %i demos in demoloop\n", __func__, MAX_DEMOS );
|
||||||
c = MAX_DEMOS;
|
c = MAX_DEMOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1641,3 +1704,78 @@ void CL_Stop_f( void )
|
|||||||
S_StopBackgroundTrack();
|
S_StopBackgroundTrack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CL_ListDemo_f( void )
|
||||||
|
{
|
||||||
|
demoheader_t hdr;
|
||||||
|
int32_t num_entries;
|
||||||
|
file_t *f;
|
||||||
|
char filename[MAX_QPATH];
|
||||||
|
char demoname[MAX_QPATH];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( Cmd_Argc() < 2 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "%s <demoname>\n", Cmd_Argv( 0 ));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strncpy( demoname, Cmd_Argv( 1 ), sizeof( demoname ));
|
||||||
|
COM_StripExtension( demoname );
|
||||||
|
Q_snprintf( filename, sizeof( filename ), "%s.dem", demoname );
|
||||||
|
|
||||||
|
f = FS_Open( filename, "rb", true );
|
||||||
|
if( !f )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "couldn't open %s\n", filename );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !CL_ParseDemoHeader( Cmd_Argv( 0 ), filename, f, &hdr, &num_entries ))
|
||||||
|
{
|
||||||
|
FS_Close( f );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Con_Printf( "Demo contents for %s:\n"
|
||||||
|
"\tProtocol: %i net/%i demo\n"
|
||||||
|
"\tFPS: %g\n"
|
||||||
|
"\tMap: %s\n"
|
||||||
|
"\tComment: %s\n"
|
||||||
|
"\tGame: %s\n",
|
||||||
|
filename, hdr.net_protocol, hdr.dem_protocol, hdr.host_fps, hdr.mapname,
|
||||||
|
hdr.comment, hdr.gamedir );
|
||||||
|
|
||||||
|
for( i = 0; i < num_entries; i++ )
|
||||||
|
{
|
||||||
|
demoentry_t entry;
|
||||||
|
|
||||||
|
Con_Printf( "Demo entry #%i:\n", i );
|
||||||
|
|
||||||
|
if( FS_Read( f, &entry, sizeof( entry )) != sizeof( entry ))
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "can't read demo entry\n" );
|
||||||
|
FS_Close( f );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.description[sizeof( entry.description ) - 1] = 0;
|
||||||
|
|
||||||
|
if( entry.entrytype == DEMO_STARTUP )
|
||||||
|
{
|
||||||
|
// startup entries don't have anything useful
|
||||||
|
Con_Printf( "\tEntry type: " S_YELLOW "startup" S_DEFAULT "\n" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Con_Printf( "\tEntry type: " S_GREEN "normal" S_DEFAULT " (%i)\n"
|
||||||
|
"\tEntry playback time/frames: %.2f seconds/%i frames\n"
|
||||||
|
"\tEntry flags: 0x%x\n"
|
||||||
|
"\tEntry description: %s\n",
|
||||||
|
entry.entrytype, entry.playback_time, entry.playback_frames,
|
||||||
|
entry.flags, entry.description );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FS_Close( f );
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,10 +28,51 @@ GNU General Public License for more details.
|
|||||||
===============================================================================
|
===============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define NUM_EFRAGS_ALLOC 64 // alloc 64 efrags (1-2kb each alloc)
|
||||||
|
|
||||||
static efrag_t **lastlink;
|
static efrag_t **lastlink;
|
||||||
static mnode_t *r_pefragtopnode;
|
static mnode_t *r_pefragtopnode;
|
||||||
static vec3_t r_emins, r_emaxs;
|
static vec3_t r_emins, r_emaxs;
|
||||||
static cl_entity_t *r_addent;
|
static cl_entity_t *r_addent;
|
||||||
|
static int cl_efrags_num;
|
||||||
|
static efrag_t *cl_efrags;
|
||||||
|
|
||||||
|
static efrag_t *CL_AllocEfrags( int num )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
efrag_t *efrags;
|
||||||
|
|
||||||
|
if( !cl.worldmodel )
|
||||||
|
{
|
||||||
|
Host_Error( "%s: called with NULL world\n", __func__ );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( num == 0 )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// set world to be the owner, so it will get automatically cleaned up
|
||||||
|
efrags = Mem_Calloc( cl.worldmodel->mempool, sizeof( *efrags ) * num );
|
||||||
|
|
||||||
|
// initialize linked list
|
||||||
|
for( i = 0; i < num - 1; i++ )
|
||||||
|
efrags[i].entnext = &efrags[i + 1];
|
||||||
|
|
||||||
|
cl_efrags_num += num;
|
||||||
|
|
||||||
|
return efrags;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
CL_ClearEfrags
|
||||||
|
==============
|
||||||
|
*/
|
||||||
|
void CL_ClearEfrags( void )
|
||||||
|
{
|
||||||
|
cl_efrags_num = 0;
|
||||||
|
cl_efrags = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===================
|
===================
|
||||||
@@ -56,14 +97,11 @@ static void R_SplitEntityOnNode( mnode_t *node )
|
|||||||
leaf = (mleaf_t *)node;
|
leaf = (mleaf_t *)node;
|
||||||
|
|
||||||
// grab an efrag off the free list
|
// grab an efrag off the free list
|
||||||
ef = clgame.free_efrags;
|
ef = cl_efrags;
|
||||||
if( !ef )
|
if( !ef )
|
||||||
{
|
ef = CL_AllocEfrags( NUM_EFRAGS_ALLOC );
|
||||||
Con_Printf( S_ERROR "too many efrags!\n" );
|
|
||||||
return; // no free fragments...
|
|
||||||
}
|
|
||||||
|
|
||||||
clgame.free_efrags = ef->entnext;
|
cl_efrags = ef->entnext;
|
||||||
ef->entity = r_addent;
|
ef->entity = r_addent;
|
||||||
|
|
||||||
// add the entity link
|
// add the entity link
|
||||||
@@ -133,21 +171,19 @@ R_StoreEfrags
|
|||||||
*/
|
*/
|
||||||
void R_StoreEfrags( efrag_t **ppefrag, int framecount )
|
void R_StoreEfrags( efrag_t **ppefrag, int framecount )
|
||||||
{
|
{
|
||||||
|
efrag_t *pefrag;
|
||||||
cl_entity_t *pent;
|
cl_entity_t *pent;
|
||||||
model_t *clmodel;
|
model_t *clmodel;
|
||||||
efrag_t *pefrag;
|
|
||||||
|
|
||||||
while(( pefrag = *ppefrag ) != NULL )
|
while(( pefrag = *ppefrag ) != NULL )
|
||||||
{
|
{
|
||||||
pent = pefrag->entity;
|
pent = pefrag->entity;
|
||||||
clmodel = pent->model;
|
clmodel = pent->model;
|
||||||
|
|
||||||
switch( clmodel->type )
|
// how this could happen?
|
||||||
{
|
if( unlikely( clmodel->type < mod_brush || clmodel->type > mod_studio ))
|
||||||
case mod_alias:
|
continue;
|
||||||
case mod_brush:
|
|
||||||
case mod_studio:
|
|
||||||
case mod_sprite:
|
|
||||||
if( pent->visframe != framecount )
|
if( pent->visframe != framecount )
|
||||||
{
|
{
|
||||||
if( CL_AddVisibleEntity( pent, ET_FRAGMENTED ))
|
if( CL_AddVisibleEntity( pent, ET_FRAGMENTED ))
|
||||||
@@ -159,9 +195,5 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount )
|
|||||||
}
|
}
|
||||||
|
|
||||||
ppefrag = &pefrag->leafnext;
|
ppefrag = &pefrag->leafnext;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,13 +25,16 @@ static CVAR_DEFINE_AUTO( tracerspeed, "6000", 0, "tracer speed" );
|
|||||||
static CVAR_DEFINE_AUTO( tracerlength, "0.8", 0, "tracer length factor" );
|
static CVAR_DEFINE_AUTO( tracerlength, "0.8", 0, "tracer length factor" );
|
||||||
static CVAR_DEFINE_AUTO( traceroffset, "30", 0, "tracer starting offset" );
|
static CVAR_DEFINE_AUTO( traceroffset, "30", 0, "tracer starting offset" );
|
||||||
|
|
||||||
particle_t *cl_active_particles;
|
static particle_t *cl_active_particles;
|
||||||
particle_t *cl_active_tracers;
|
static particle_t *cl_active_tracers;
|
||||||
particle_t *cl_free_particles;
|
static particle_t *cl_free_particles;
|
||||||
particle_t *cl_particles = NULL; // particle pool
|
static particle_t *cl_particles = NULL; // particle pool
|
||||||
static vec3_t cl_avelocities[NUMVERTEXNORMALS];
|
static vec3_t cl_avelocities[NUMVERTEXNORMALS];
|
||||||
static float cl_lasttimewarn = 0.0f;
|
static float cl_lasttimewarn = 0.0f;
|
||||||
|
|
||||||
|
// expand debugging BBOX particle hulls by this many units.
|
||||||
|
#define BOX_GAP 0.0f
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
R_LookupColor
|
R_LookupColor
|
||||||
@@ -175,7 +178,7 @@ particle_t * GAME_EXPORT R_AllocParticle( void (*callback)( particle_t*, float )
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// never alloc particles when we not in game
|
// never alloc particles when we not in game
|
||||||
// if( tr.frametime == 0.0 ) return NULL;
|
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||||
|
|
||||||
if( !cl_free_particles )
|
if( !cl_free_particles )
|
||||||
{
|
{
|
||||||
@@ -218,7 +221,7 @@ R_AllocTracer
|
|||||||
can return NULL if particles is out
|
can return NULL if particles is out
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
static particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
|
|
||||||
@@ -226,7 +229,7 @@ particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// never alloc particles when we not in game
|
// never alloc particles when we not in game
|
||||||
//if( tr.frametime == 0.0 ) return NULL;
|
if( cl_clientframetime() == 0.0 ) return NULL;
|
||||||
|
|
||||||
if( !cl_free_particles )
|
if( !cl_free_particles )
|
||||||
{
|
{
|
||||||
@@ -250,7 +253,7 @@ particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
|
|||||||
VectorCopy( vel, p->vel );
|
VectorCopy( vel, p->vel );
|
||||||
p->die = cl.time + life;
|
p->die = cl.time + life;
|
||||||
p->ramp = tracerlength.value;
|
p->ramp = tracerlength.value;
|
||||||
p->color = 4; // select custom color
|
p->color = TRACER_COLORINDEX_DEFAULT; // select custom color
|
||||||
p->packedColor = 255; // alpha
|
p->packedColor = 255; // alpha
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
@@ -262,9 +265,9 @@ VIEWBEAMS MANAGEMENT
|
|||||||
|
|
||||||
==============================================================
|
==============================================================
|
||||||
*/
|
*/
|
||||||
BEAM *cl_active_beams;
|
static BEAM *cl_active_beams;
|
||||||
BEAM *cl_free_beams;
|
static BEAM *cl_free_beams;
|
||||||
BEAM *cl_viewbeams = NULL; // beams pool
|
static BEAM *cl_viewbeams = NULL; // beams pool
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -300,7 +303,7 @@ R_BeamAlloc
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
BEAM *R_BeamAlloc( void )
|
static BEAM *R_BeamAlloc( void )
|
||||||
{
|
{
|
||||||
BEAM *pBeam;
|
BEAM *pBeam;
|
||||||
|
|
||||||
@@ -323,7 +326,7 @@ R_BeamFree
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_BeamFree( BEAM *pBeam )
|
static void R_BeamFree( BEAM *pBeam )
|
||||||
{
|
{
|
||||||
// free particles that have died off.
|
// free particles that have died off.
|
||||||
R_FreeDeadParticles( &pBeam->particles );
|
R_FreeDeadParticles( &pBeam->particles );
|
||||||
@@ -605,7 +608,7 @@ CL_BeamAttemptToDie
|
|||||||
Check for expired beams
|
Check for expired beams
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
static qboolean CL_BeamAttemptToDie( BEAM *pBeam )
|
||||||
{
|
{
|
||||||
Assert( pBeam != NULL );
|
Assert( pBeam != NULL );
|
||||||
|
|
||||||
@@ -636,12 +639,24 @@ and all particle trails (if this is a beamfollow)
|
|||||||
*/
|
*/
|
||||||
void GAME_EXPORT R_BeamKill( int deadEntity )
|
void GAME_EXPORT R_BeamKill( int deadEntity )
|
||||||
{
|
{
|
||||||
cl_entity_t *pDeadEntity;
|
BEAM *beam;
|
||||||
|
|
||||||
pDeadEntity = R_BeamGetEntity( deadEntity );
|
for( beam = cl_active_beams; beam; beam = beam->next )
|
||||||
if( !pDeadEntity ) return;
|
{
|
||||||
|
if( FBitSet( beam->flags, FBEAM_STARTENTITY ) && beam->startEntity == deadEntity )
|
||||||
|
{
|
||||||
|
if( beam->type != TE_BEAMFOLLOW )
|
||||||
|
beam->die = cl.time;
|
||||||
|
|
||||||
CL_KillDeadBeams( pDeadEntity );
|
ClearBits( beam->flags, FBEAM_STARTENTITY );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( FBitSet( beam->flags, FBEAM_ENDENTITY ) && beam->endEntity == deadEntity )
|
||||||
|
{
|
||||||
|
beam->die = cl.time;
|
||||||
|
ClearBits( beam->flags, FBEAM_ENDENTITY );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1094,9 +1109,7 @@ void GAME_EXPORT R_ParticleExplosion2( const vec3_t org, int colorStart, int col
|
|||||||
int colorMod = 0, packedColor;
|
int colorMod = 0, packedColor;
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
|
|
||||||
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
packedColor = Host_IsQuakeCompatible( ) ? 255 : 0; // use old code for blob particles
|
||||||
packedColor = 255; // use old code for blob particles
|
|
||||||
else packedColor = 0;
|
|
||||||
|
|
||||||
for( i = 0; i < 512; i++ )
|
for( i = 0; i < 512; i++ )
|
||||||
{
|
{
|
||||||
@@ -1129,9 +1142,7 @@ void GAME_EXPORT R_BlobExplosion( const vec3_t org )
|
|||||||
particle_t *p;
|
particle_t *p;
|
||||||
int i, j, packedColor;
|
int i, j, packedColor;
|
||||||
|
|
||||||
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
packedColor = Host_IsQuakeCompatible( ) ? 255 : 0; // use old code for blob particles
|
||||||
packedColor = 255; // use old code for blob particles
|
|
||||||
else packedColor = 0;
|
|
||||||
|
|
||||||
for( i = 0; i < 1024; i++ )
|
for( i = 0; i < 1024; i++ )
|
||||||
{
|
{
|
||||||
@@ -1593,6 +1604,73 @@ void GAME_EXPORT R_RocketTrail( vec3_t start, vec3_t end, int type )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
PM_ParticleLine
|
||||||
|
|
||||||
|
draw line from particles
|
||||||
|
================
|
||||||
|
*/
|
||||||
|
static void PM_ParticleLine( const vec3_t start, const vec3_t end, int pcolor, float life, float zvel )
|
||||||
|
{
|
||||||
|
float len, curdist;
|
||||||
|
vec3_t diff, pos;
|
||||||
|
|
||||||
|
// determine distance
|
||||||
|
VectorSubtract( end, start, diff );
|
||||||
|
len = VectorNormalizeLength( diff );
|
||||||
|
curdist = 0;
|
||||||
|
|
||||||
|
while( curdist <= len )
|
||||||
|
{
|
||||||
|
VectorMA( start, curdist, diff, pos );
|
||||||
|
CL_Particle( pos, pcolor, life, 0, zvel );
|
||||||
|
curdist += 2.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
PM_DrawRectangle
|
||||||
|
|
||||||
|
================
|
||||||
|
*/
|
||||||
|
static void PM_DrawRectangle( const vec3_t tl, const vec3_t bl, const vec3_t tr, const vec3_t br, int pcolor, float life )
|
||||||
|
{
|
||||||
|
PM_ParticleLine( tl, bl, pcolor, life, 0 );
|
||||||
|
PM_ParticleLine( bl, br, pcolor, life, 0 );
|
||||||
|
PM_ParticleLine( br, tr, pcolor, life, 0 );
|
||||||
|
PM_ParticleLine( tr, tl, pcolor, life, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
PM_DrawBBox
|
||||||
|
|
||||||
|
================
|
||||||
|
*/
|
||||||
|
static void PM_DrawBBox( const vec3_t mins, const vec3_t maxs, const vec3_t origin, int pcolor, float life )
|
||||||
|
{
|
||||||
|
vec3_t p[8], tmp;
|
||||||
|
float gap = BOX_GAP;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < 8; i++ )
|
||||||
|
{
|
||||||
|
tmp[0] = (i & 1) ? mins[0] - gap : maxs[0] + gap;
|
||||||
|
tmp[1] = (i & 2) ? mins[1] - gap : maxs[1] + gap ;
|
||||||
|
tmp[2] = (i & 4) ? mins[2] - gap : maxs[2] + gap ;
|
||||||
|
|
||||||
|
VectorAdd( tmp, origin, tmp );
|
||||||
|
VectorCopy( tmp, p[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < 6; i++ )
|
||||||
|
{
|
||||||
|
PM_DrawRectangle( p[boxpnt[i][1]], p[boxpnt[i][0]], p[boxpnt[i][2]], p[boxpnt[i][3]], pcolor, life );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
R_ParticleLine
|
R_ParticleLine
|
||||||
@@ -1756,25 +1834,6 @@ void GAME_EXPORT R_StreakSplash( const vec3_t pos, const vec3_t dir, int color,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
===============
|
|
||||||
R_DebugParticle
|
|
||||||
|
|
||||||
just for debug purposes
|
|
||||||
===============
|
|
||||||
*/
|
|
||||||
void R_DebugParticle( const vec3_t pos, byte r, byte g, byte b )
|
|
||||||
{
|
|
||||||
particle_t *p;
|
|
||||||
|
|
||||||
p = R_AllocParticle( NULL );
|
|
||||||
if( !p ) return;
|
|
||||||
|
|
||||||
VectorCopy( pos, p->org );
|
|
||||||
p->color = R_LookupColor( r, g, b );
|
|
||||||
p->die = cl.time + 0.01f;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
CL_Particle
|
CL_Particle
|
||||||
@@ -2040,7 +2099,7 @@ void CL_ReadPointFile_f( void )
|
|||||||
else Con_Printf( "map %s has no leaks!\n", clgame.mapname );
|
else Con_Printf( "map %s has no leaks!\n", clgame.mapname );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_FreeDeadBeams( void )
|
static void CL_FreeDeadBeams( void )
|
||||||
{
|
{
|
||||||
BEAM *pBeam, *pNext, *pPrev = NULL;
|
BEAM *pBeam, *pNext, *pPrev = NULL;
|
||||||
// draw temporary entity beams
|
// draw temporary entity beams
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ CL_CalcPlayerVelocity
|
|||||||
compute velocity for a given client
|
compute velocity for a given client
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
|
static void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
|
||||||
{
|
{
|
||||||
clientdata_t *pcd;
|
clientdata_t *pcd;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
@@ -78,7 +78,7 @@ CL_DescribeEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_DescribeEvent( event_info_t *ei, int slot )
|
static void CL_DescribeEvent( event_info_t *ei, int slot )
|
||||||
{
|
{
|
||||||
int idx = (slot & 63) * 2;
|
int idx = (slot & 63) * 2;
|
||||||
con_nprint_t info;
|
con_nprint_t info;
|
||||||
@@ -192,7 +192,7 @@ void CL_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func )
|
|||||||
ev = clgame.events[lastnum];
|
ev = clgame.events[lastnum];
|
||||||
|
|
||||||
// NOTE: ev->index will be set later
|
// NOTE: ev->index will be set later
|
||||||
Q_strncpy( ev->name, szEvName, MAX_QPATH );
|
Q_strncpy( ev->name, szEvName, sizeof( ev->name ));
|
||||||
ev->func = func;
|
ev->func = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ CL_FireEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
qboolean CL_FireEvent( event_info_t *ei, int slot )
|
static qboolean CL_FireEvent( event_info_t *ei, int slot )
|
||||||
{
|
{
|
||||||
cl_user_event_t *ev;
|
cl_user_event_t *ev;
|
||||||
const char *name;
|
const char *name;
|
||||||
@@ -219,7 +219,7 @@ qboolean CL_FireEvent( event_info_t *ei, int slot )
|
|||||||
if( !ev )
|
if( !ev )
|
||||||
{
|
{
|
||||||
idx = bound( 1, ei->index, ( MAX_EVENTS - 1 ));
|
idx = bound( 1, ei->index, ( MAX_EVENTS - 1 ));
|
||||||
Con_Reportf( S_ERROR "CL_FireEvent: %s not precached\n", cl.event_precache[idx] );
|
Con_Reportf( S_ERROR "%s: %s not precached\n", __func__, cl.event_precache[idx] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ qboolean CL_FireEvent( event_info_t *ei, int slot )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Reportf( S_ERROR "CL_FireEvent: %s not hooked\n", name );
|
Con_Reportf( S_ERROR "%s: %s not hooked\n", __func__, name );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -292,7 +292,7 @@ CL_FindEvent
|
|||||||
find first empty event
|
find first empty event
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
event_info_t *CL_FindEmptyEvent( void )
|
static event_info_t *CL_FindEmptyEvent( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
event_state_t *es;
|
event_state_t *es;
|
||||||
@@ -320,7 +320,7 @@ CL_FindEvent
|
|||||||
replace only unreliable events
|
replace only unreliable events
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
event_info_t *CL_FindUnreliableEvent( void )
|
static event_info_t *CL_FindUnreliableEvent( void )
|
||||||
{
|
{
|
||||||
event_state_t *es;
|
event_state_t *es;
|
||||||
event_info_t *ei;
|
event_info_t *ei;
|
||||||
@@ -350,7 +350,7 @@ CL_QueueEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args )
|
static void CL_QueueEvent( int flags, int index, float delay, event_args_t *args )
|
||||||
{
|
{
|
||||||
event_info_t *ei;
|
event_info_t *ei;
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ CL_ParseReliableEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_ParseReliableEvent( sizebuf_t *msg )
|
void CL_ParseReliableEvent( sizebuf_t *msg, connprotocol_t proto )
|
||||||
{
|
{
|
||||||
int event_index;
|
int event_index;
|
||||||
event_args_t nullargs, args;
|
event_args_t nullargs, args;
|
||||||
@@ -390,11 +390,19 @@ void CL_ParseReliableEvent( sizebuf_t *msg )
|
|||||||
|
|
||||||
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||||
|
|
||||||
|
// reliable events not use delta-compression just null-compression
|
||||||
|
if( proto == PROTO_GOLDSRC )
|
||||||
|
{
|
||||||
|
Delta_ReadGSFields( msg, DT_EVENT_T, &nullargs, &args, 0.0f );
|
||||||
|
if( MSG_ReadOneBit( msg ))
|
||||||
|
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if( MSG_ReadOneBit( msg ))
|
if( MSG_ReadOneBit( msg ))
|
||||||
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
||||||
|
|
||||||
// reliable events not use delta-compression just null-compression
|
|
||||||
MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
||||||
|
}
|
||||||
|
|
||||||
if( args.entindex > 0 && args.entindex <= cl.maxclients )
|
if( args.entindex > 0 && args.entindex <= cl.maxclients )
|
||||||
args.angles[PITCH] *= -3.0f;
|
args.angles[PITCH] *= -3.0f;
|
||||||
@@ -409,33 +417,42 @@ CL_ParseEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_ParseEvent( sizebuf_t *msg )
|
void CL_ParseEvent( sizebuf_t *msg, connprotocol_t proto )
|
||||||
{
|
{
|
||||||
int event_index;
|
int event_index;
|
||||||
int i, num_events;
|
int i, num_events;
|
||||||
int packet_index;
|
int packet_index;
|
||||||
event_args_t nullargs, args;
|
const event_args_t nullargs = { 0 };
|
||||||
|
event_args_t args = { 0 };
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
float delay;
|
float delay;
|
||||||
|
int entity_bits;
|
||||||
memset( &nullargs, 0, sizeof( nullargs ));
|
|
||||||
memset( &args, 0, sizeof( args ));
|
|
||||||
|
|
||||||
num_events = MSG_ReadUBitLong( msg, 5 );
|
num_events = MSG_ReadUBitLong( msg, 5 );
|
||||||
|
|
||||||
|
if( proto == PROTO_GOLDSRC )
|
||||||
|
entity_bits = MAX_GOLDSRC_ENTITY_BITS;
|
||||||
|
else if( proto == PROTO_LEGACY )
|
||||||
|
entity_bits = MAX_LEGACY_ENTITY_BITS;
|
||||||
|
else entity_bits = MAX_ENTITY_BITS;
|
||||||
|
|
||||||
// parse events queue
|
// parse events queue
|
||||||
for( i = 0 ; i < num_events; i++ )
|
for( i = 0 ; i < num_events; i++ )
|
||||||
{
|
{
|
||||||
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||||
|
|
||||||
if( MSG_ReadOneBit( msg ))
|
if( MSG_ReadOneBit( msg ))
|
||||||
packet_index = MSG_ReadUBitLong( msg, cls.legacymode ? MAX_LEGACY_ENTITY_BITS : MAX_ENTITY_BITS );
|
{
|
||||||
else packet_index = -1;
|
packet_index = MSG_ReadUBitLong( msg, entity_bits );
|
||||||
|
|
||||||
if( MSG_ReadOneBit( msg ))
|
if( MSG_ReadOneBit( msg ))
|
||||||
{
|
{
|
||||||
MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
if( proto == PROTO_GOLDSRC )
|
||||||
|
Delta_ReadGSFields( msg, DT_EVENT_T, &nullargs, &args, 0.0f );
|
||||||
|
else MSG_ReadDeltaEvent( msg, &nullargs, &args );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else packet_index = -1;
|
||||||
|
|
||||||
if( MSG_ReadOneBit( msg ))
|
if( MSG_ReadOneBit( msg ))
|
||||||
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
delay = (float)MSG_ReadWord( msg ) * (1.0f / 100.0f);
|
||||||
@@ -497,14 +514,14 @@ void GAME_EXPORT CL_PlaybackEvent( int flags, const edict_t *pInvoker, word even
|
|||||||
// first check event for out of bounds
|
// first check event for out of bounds
|
||||||
if( eventindex < 1 || eventindex >= MAX_EVENTS )
|
if( eventindex < 1 || eventindex >= MAX_EVENTS )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "CL_PlaybackEvent: invalid eventindex %i\n", eventindex );
|
Con_DPrintf( S_ERROR "%s: invalid eventindex %i\n", __func__, eventindex );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check event for precached
|
// check event for precached
|
||||||
if( !CL_EventIndex( cl.event_precache[eventindex] ))
|
if( !CL_EventIndex( cl.event_precache[eventindex] ))
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "CL_PlaybackEvent: event %i was not precached\n", eventindex );
|
Con_DPrintf( S_ERROR "%s: event %i was not precached\n", __func__, eventindex );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,10 +46,35 @@ static int CL_LoadFontTexture( const char *fontname, uint texFlags, int *width )
|
|||||||
return tex;
|
return tex;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
static int CL_FontRenderMode( convar_t *fontrender )
|
||||||
|
{
|
||||||
|
switch((int)fontrender->value )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return kRenderTransAdd;
|
||||||
|
case 1:
|
||||||
|
return kRenderTransAlpha;
|
||||||
|
case 2:
|
||||||
|
return kRenderTransTexture;
|
||||||
|
default:
|
||||||
|
Cvar_DirectSet( fontrender, fontrender->def_string );
|
||||||
|
}
|
||||||
|
|
||||||
|
return kRenderTransTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CL_SetFontRendermode( cl_font_t *font )
|
||||||
|
{
|
||||||
|
ref.dllFuncs.GL_SetRenderMode( CL_FontRenderMode( font->rendermode ));
|
||||||
|
}
|
||||||
|
|
||||||
|
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
||||||
{
|
{
|
||||||
int font_width, i;
|
int font_width, i;
|
||||||
|
|
||||||
|
if( !rendermode )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( font->valid )
|
if( font->valid )
|
||||||
return true; // already loaded
|
return true; // already loaded
|
||||||
|
|
||||||
@@ -60,7 +85,6 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
|||||||
font->type = FONT_FIXED;
|
font->type = FONT_FIXED;
|
||||||
font->valid = true;
|
font->valid = true;
|
||||||
font->scale = scale;
|
font->scale = scale;
|
||||||
font->nearest = FBitSet( texFlags, TF_NEAREST );
|
|
||||||
font->rendermode = rendermode;
|
font->rendermode = rendermode;
|
||||||
font->charHeight = Q_rint( font_width / 16 * scale );
|
font->charHeight = Q_rint( font_width / 16 * scale );
|
||||||
|
|
||||||
@@ -77,13 +101,16 @@ qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float sc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags )
|
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags )
|
||||||
{
|
{
|
||||||
fs_offset_t length;
|
fs_offset_t length;
|
||||||
qfont_t src;
|
qfont_t src;
|
||||||
byte *pfile;
|
byte *pfile;
|
||||||
int font_width, i;
|
int font_width, i;
|
||||||
|
|
||||||
|
if( !rendermode )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( font->valid )
|
if( font->valid )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -106,8 +133,7 @@ qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float
|
|||||||
|
|
||||||
font->type = FONT_VARIABLE;
|
font->type = FONT_VARIABLE;
|
||||||
font->valid = true;
|
font->valid = true;
|
||||||
font->scale = scale;
|
font->scale = scale ? scale : 1.0f;
|
||||||
font->nearest = FBitSet( texFlags, TF_NEAREST );
|
|
||||||
font->rendermode = rendermode;
|
font->rendermode = rendermode;
|
||||||
font->charHeight = Q_rint( src.rowheight * scale );
|
font->charHeight = Q_rint( src.rowheight * scale );
|
||||||
|
|
||||||
@@ -179,7 +205,8 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
|
|||||||
return font->charWidths[number];
|
return font->charWidths[number];
|
||||||
|
|
||||||
rc = &font->fontRc[number];
|
rc = &font->fontRc[number];
|
||||||
if( font->nearest || font->scale <= 1.0f )
|
|
||||||
|
if( font->scale <= 1.f || !REF_GET_PARM( PARM_TEX_FILTERING, font->hFontTexture ))
|
||||||
half = 0;
|
half = 0;
|
||||||
|
|
||||||
s1 = ((float)rc->left + half ) / texw;
|
s1 = ((float)rc->left + half ) / texw;
|
||||||
@@ -193,7 +220,7 @@ int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *fon
|
|||||||
SPR_AdjustSize( &x, &y, &w, &h );
|
SPR_AdjustSize( &x, &y, &w, &h );
|
||||||
|
|
||||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
CL_SetFontRendermode( font );
|
||||||
|
|
||||||
// don't apply color to fixed fonts it's already colored
|
// don't apply color to fixed fonts it's already colored
|
||||||
if( font->type != FONT_FIXED || REF_GET_PARM( PARM_TEX_GLFORMAT, font->hFontTexture ) == 0x8045 ) // GL_LUMINANCE8_ALPHA8
|
if( font->type != FONT_FIXED || REF_GET_PARM( PARM_TEX_GLFORMAT, font->hFontTexture ) == 0x8045 ) // GL_LUMINANCE8_ALPHA8
|
||||||
@@ -216,7 +243,7 @@ int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *fon
|
|||||||
Con_UtfProcessChar( 0 ); // clear utf state
|
Con_UtfProcessChar( 0 ); // clear utf state
|
||||||
|
|
||||||
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
if( !FBitSet( flags, FONT_DRAW_NORENDERMODE ))
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
CL_SetFontRendermode( font );
|
||||||
|
|
||||||
Vector4Copy( color, current_color );
|
Vector4Copy( color, current_color );
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ GNU General Public License for more details.
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#define STUDIO_INTERPOLATION_FIX
|
// #define STUDIO_INTERPOLATION_FIX
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
@@ -52,19 +52,30 @@ CL_UpdatePositions
|
|||||||
Store another position into interpolation circular buffer
|
Store another position into interpolation circular buffer
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_UpdatePositions( cl_entity_t *ent )
|
static void CL_UpdatePositions( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
position_history_t *ph;
|
position_history_t *ph, *prev;
|
||||||
|
|
||||||
|
prev = &ent->ph[ent->current_position];
|
||||||
|
|
||||||
ent->current_position = (ent->current_position + 1) & HISTORY_MASK;
|
ent->current_position = (ent->current_position + 1) & HISTORY_MASK;
|
||||||
ph = &ent->ph[ent->current_position];
|
ph = &ent->ph[ent->current_position];
|
||||||
VectorCopy( ent->curstate.origin, ph->origin );
|
VectorCopy( ent->curstate.origin, ph->origin );
|
||||||
VectorCopy( ent->curstate.angles, ph->angles );
|
VectorCopy( ent->curstate.angles, ph->angles );
|
||||||
|
|
||||||
if( ent->model && ent->model->type == mod_brush )
|
|
||||||
ph->animtime = ent->curstate.animtime;
|
ph->animtime = ent->curstate.animtime;
|
||||||
else
|
|
||||||
ph->animtime = cl.time;
|
// 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -74,7 +85,7 @@ CL_ResetPositions
|
|||||||
Interpolation init or reset after teleporting
|
Interpolation init or reset after teleporting
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ResetPositions( cl_entity_t *ent )
|
static void CL_ResetPositions( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
position_history_t store;
|
position_history_t store;
|
||||||
|
|
||||||
@@ -84,8 +95,7 @@ void CL_ResetPositions( cl_entity_t *ent )
|
|||||||
ent->current_position = 1;
|
ent->current_position = 1;
|
||||||
|
|
||||||
memset( ent->ph, 0, sizeof( position_history_t ) * HISTORY_MAX );
|
memset( ent->ph, 0, sizeof( position_history_t ) * HISTORY_MAX );
|
||||||
memcpy( &ent->ph[1], &store, sizeof( position_history_t ));
|
ent->ph[1] = ent->ph[0] = store;
|
||||||
memcpy( &ent->ph[0], &store, sizeof( position_history_t ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -96,7 +106,7 @@ check for instant movement in case
|
|||||||
we don't want interpolate this
|
we don't want interpolate this
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_EntityTeleported( cl_entity_t *ent )
|
static qboolean CL_EntityTeleported( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float len, maxlen;
|
float len, maxlen;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
@@ -117,7 +127,7 @@ CL_CompareTimestamps
|
|||||||
round-off floating errors
|
round-off floating errors
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_CompareTimestamps( float t1, float t2 )
|
static qboolean CL_CompareTimestamps( float t1, float t2 )
|
||||||
{
|
{
|
||||||
int iTime1 = t1 * 1000;
|
int iTime1 = t1 * 1000;
|
||||||
int iTime2 = t2 * 1000;
|
int iTime2 = t2 * 1000;
|
||||||
@@ -132,7 +142,7 @@ CL_EntityIgnoreLerp
|
|||||||
some ents will be ignore lerping
|
some ents will be ignore lerping
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
static qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
if( cl_nointerp.value > 0.f )
|
if( cl_nointerp.value > 0.f )
|
||||||
return true;
|
return true;
|
||||||
@@ -149,7 +159,7 @@ CL_EntityCustomLerp
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
static qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
switch( e->curstate.movetype )
|
switch( e->curstate.movetype )
|
||||||
{
|
{
|
||||||
@@ -159,6 +169,13 @@ qboolean CL_EntityCustomLerp( cl_entity_t *e )
|
|||||||
case MOVETYPE_FLY:
|
case MOVETYPE_FLY:
|
||||||
case MOVETYPE_COMPOUND:
|
case MOVETYPE_COMPOUND:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||||
|
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||||
|
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||||
|
case MOVETYPE_TOSS:
|
||||||
|
if( cls.legacymode == PROTO_LEGACY && e->model && e->model->type == mod_studio )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -171,7 +188,7 @@ CL_ParametricMove
|
|||||||
check for parametrical moved entities
|
check for parametrical moved entities
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_ParametricMove( cl_entity_t *ent )
|
static qboolean CL_ParametricMove( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float frac, dt, t;
|
float frac, dt, t;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
@@ -208,7 +225,7 @@ CL_UpdateLatchedVars
|
|||||||
|
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_UpdateLatchedVars( cl_entity_t *ent )
|
static void CL_UpdateLatchedVars( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
if( !ent->model || ( ent->model->type != mod_alias && ent->model->type != mod_studio ))
|
if( !ent->model || ( ent->model->type != mod_alias && ent->model->type != mod_studio ))
|
||||||
return; // below fields used only for alias and studio interpolation
|
return; // below fields used only for alias and studio interpolation
|
||||||
@@ -303,7 +320,7 @@ CL_ProcessEntityUpdate
|
|||||||
apply changes since new frame received
|
apply changes since new frame received
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
static void CL_ProcessEntityUpdate( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
qboolean parametric;
|
qboolean parametric;
|
||||||
|
|
||||||
@@ -349,11 +366,10 @@ CL_FindInterpolationUpdates
|
|||||||
find two timestamps
|
find two timestamps
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, position_history_t **ph0, position_history_t **ph1 )
|
static qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, double targettime, position_history_t **ph0, position_history_t **ph1 )
|
||||||
{
|
{
|
||||||
qboolean extrapolate = true;
|
qboolean extrapolate = true;
|
||||||
uint i, i0, i1, imod;
|
uint i, i0, i1, imod;
|
||||||
float at;
|
|
||||||
|
|
||||||
imod = ent->current_position;
|
imod = ent->current_position;
|
||||||
i0 = (imod - 0) & HISTORY_MASK; // curpos (lerp end)
|
i0 = (imod - 0) & HISTORY_MASK; // curpos (lerp end)
|
||||||
@@ -361,8 +377,10 @@ qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, positi
|
|||||||
|
|
||||||
for( i = 1; i < HISTORY_MAX - 1; i++ )
|
for( i = 1; i < HISTORY_MAX - 1; i++ )
|
||||||
{
|
{
|
||||||
at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
double at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||||
if( at == 0.0f ) break;
|
|
||||||
|
if( at == 0.0f )
|
||||||
|
break;
|
||||||
|
|
||||||
if( targettime > at )
|
if( targettime > at )
|
||||||
{
|
{
|
||||||
@@ -387,15 +405,14 @@ CL_PureOrigin
|
|||||||
non-local players interpolation
|
non-local players interpolation
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangles )
|
static void CL_PureOrigin( cl_entity_t *ent, double t, vec3_t outorigin, vec3_t outangles )
|
||||||
{
|
{
|
||||||
qboolean extrapolate;
|
double t1, t0, frac;
|
||||||
float t1, t0, frac;
|
|
||||||
position_history_t *ph0, *ph1;
|
position_history_t *ph0, *ph1;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
|
|
||||||
// NOTE: ph0 is next, ph1 is a prev
|
// NOTE: ph0 is next, ph1 is a prev
|
||||||
extrapolate = CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
CL_FindInterpolationUpdates( ent, t, &ph0, &ph1 );
|
||||||
|
|
||||||
if ( !ph0 || !ph1 )
|
if ( !ph0 || !ph1 )
|
||||||
return;
|
return;
|
||||||
@@ -403,7 +420,7 @@ void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangle
|
|||||||
t0 = ph0->animtime;
|
t0 = ph0->animtime;
|
||||||
t1 = ph1->animtime;
|
t1 = ph1->animtime;
|
||||||
|
|
||||||
if( t0 != 0.0f )
|
if( t0 != 0.0 )
|
||||||
{
|
{
|
||||||
vec4_t q, q1, q2;
|
vec4_t q, q1, q2;
|
||||||
|
|
||||||
@@ -411,9 +428,9 @@ void CL_PureOrigin( cl_entity_t *ent, float t, vec3_t outorigin, vec3_t outangle
|
|||||||
|
|
||||||
if( !Q_equal( t0, t1 ))
|
if( !Q_equal( t0, t1 ))
|
||||||
frac = ( t - t1 ) / ( t0 - t1 );
|
frac = ( t - t1 ) / ( t0 - t1 );
|
||||||
else frac = 1.0f;
|
else frac = 1.0;
|
||||||
|
|
||||||
frac = bound( 0.0f, frac, 1.2f );
|
frac = bound( 0.0, frac, 1.2 );
|
||||||
|
|
||||||
VectorMA( ph1->origin, frac, delta, outorigin );
|
VectorMA( ph1->origin, frac, delta, outorigin );
|
||||||
|
|
||||||
@@ -437,11 +454,11 @@ CL_InterpolateModel
|
|||||||
non-players interpolation
|
non-players interpolation
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
int CL_InterpolateModel( cl_entity_t *e )
|
static int CL_InterpolateModel( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
position_history_t *ph0 = NULL, *ph1 = NULL;
|
position_history_t *ph0 = NULL, *ph1 = NULL;
|
||||||
vec3_t origin, angles, delta;
|
vec3_t origin, angles, delta;
|
||||||
float t, t1, t2, frac;
|
double t, t1, t2, frac;
|
||||||
vec4_t q, q1, q2;
|
vec4_t q, q1, q2;
|
||||||
|
|
||||||
VectorCopy( e->curstate.origin, e->origin );
|
VectorCopy( e->curstate.origin, e->origin );
|
||||||
@@ -489,9 +506,7 @@ int CL_InterpolateModel( cl_entity_t *e )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACKHACK: workaround buggy position history animtime
|
if( Q_equal( t2, t1 ))
|
||||||
// going backward sometimes
|
|
||||||
if( Q_equal( t2, t1 ) || t2 < t1 )
|
|
||||||
{
|
{
|
||||||
VectorCopy( ph0->origin, e->origin );
|
VectorCopy( ph0->origin, e->origin );
|
||||||
VectorCopy( ph0->angles, e->angles );
|
VectorCopy( ph0->angles, e->angles );
|
||||||
@@ -529,7 +544,7 @@ interpolate non-local clients
|
|||||||
*/
|
*/
|
||||||
void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float targettime;
|
double targettime;
|
||||||
vec4_t q, q1, q2;
|
vec4_t q, q1, q2;
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
vec3_t angles;
|
vec3_t angles;
|
||||||
@@ -569,7 +584,7 @@ CL_ProcessPlayerState
|
|||||||
process player states after the new packet has received
|
process player states after the new packet has received
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ProcessPlayerState( int playerindex, entity_state_t *state )
|
static void CL_ProcessPlayerState( int playerindex, entity_state_t *state )
|
||||||
{
|
{
|
||||||
entity_state_t *ps;
|
entity_state_t *ps;
|
||||||
|
|
||||||
@@ -589,7 +604,7 @@ reset latched state if this frame entity was teleported
|
|||||||
or just EF_NOINTERP was set
|
or just EF_NOINTERP was set
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_ResetLatchedState( int pnum, frame_t *frame, cl_entity_t *ent )
|
static void CL_ResetLatchedState( int pnum, frame_t *frame, cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
if( CHECKVISBIT( frame->flags, pnum ))
|
if( CHECKVISBIT( frame->flags, pnum ))
|
||||||
{
|
{
|
||||||
@@ -654,9 +669,9 @@ FRAME PARSING
|
|||||||
|
|
||||||
=========================================================================
|
=========================================================================
|
||||||
*/
|
*/
|
||||||
static qboolean CL_ParseEntityNumFromPacket( sizebuf_t *msg, int *newnum )
|
static qboolean CL_ParseEntityNumFromPacket( sizebuf_t *msg, int *newnum, connprotocol_t proto )
|
||||||
{
|
{
|
||||||
if( cls.legacymode )
|
if( proto == PROTO_LEGACY )
|
||||||
{
|
{
|
||||||
*newnum = MSG_ReadWord( msg );
|
*newnum = MSG_ReadWord( msg );
|
||||||
if( *newnum == 0 )
|
if( *newnum == 0 )
|
||||||
@@ -679,7 +694,7 @@ CL_FlushEntityPacket
|
|||||||
Read and ignore whole entity packet.
|
Read and ignore whole entity packet.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_FlushEntityPacket( sizebuf_t *msg )
|
static void CL_FlushEntityPacket( sizebuf_t *msg, connprotocol_t proto )
|
||||||
{
|
{
|
||||||
int newnum;
|
int newnum;
|
||||||
entity_state_t from, to;
|
entity_state_t from, to;
|
||||||
@@ -692,16 +707,57 @@ void CL_FlushEntityPacket( sizebuf_t *msg )
|
|||||||
// read it all, but ignore it
|
// read it all, but ignore it
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
if( !CL_ParseEntityNumFromPacket( msg, &newnum ))
|
if( !CL_ParseEntityNumFromPacket( msg, &newnum, proto ))
|
||||||
break; // done
|
break; // done
|
||||||
|
|
||||||
if( MSG_CheckOverflow( msg ))
|
if( MSG_CheckOverflow( msg ))
|
||||||
Host_Error( "CL_FlushEntityPacket: overflow\n" );
|
Host_Error( "%s: overflow\n", __func__ );
|
||||||
|
|
||||||
MSG_ReadDeltaEntity( msg, &from, &to, newnum, CL_IsPlayerIndex( newnum ) ? DELTA_PLAYER : DELTA_ENTITY, cl.mtime[0] );
|
MSG_ReadDeltaEntity( msg, &from, &to, newnum, CL_IsPlayerIndex( newnum ) ? DELTA_PLAYER : DELTA_ENTITY, cl.mtime[0] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qboolean CL_ValidateDeltaPacket( uint oldpacket, frame_t *oldframe )
|
||||||
|
{
|
||||||
|
int subtracted = ( cls.netchan.incoming_sequence - oldpacket ) & 0xFF;
|
||||||
|
|
||||||
|
if( subtracted == 0 )
|
||||||
|
{
|
||||||
|
Con_NPrintf( 2, "^3Warning:^1 update too old\n^7\n" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( subtracted >= CL_UPDATE_MASK )
|
||||||
|
{
|
||||||
|
// we can't use this, it is too old
|
||||||
|
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(( cls.next_client_entities - oldframe->first_entity ) > ( cls.num_client_entities - NUM_PACKET_ENTITIES ))
|
||||||
|
{
|
||||||
|
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CL_UpdateOldEntNum( int oldindex, frame_t *oldframe, entity_state_t **oldent )
|
||||||
|
{
|
||||||
|
if( !oldframe )
|
||||||
|
{
|
||||||
|
*oldent = NULL;
|
||||||
|
return MAX_ENTNUMBER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( oldindex >= oldframe->num_entities )
|
||||||
|
return MAX_ENTNUMBER;
|
||||||
|
|
||||||
|
*oldent = &cls.packet_entities[(oldframe->first_entity + oldindex) % cls.num_client_entities];
|
||||||
|
return (*oldent)->number;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
CL_DeltaEntity
|
CL_DeltaEntity
|
||||||
@@ -709,7 +765,7 @@ CL_DeltaEntity
|
|||||||
processing delta update
|
processing delta update
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean has_update )
|
static void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean has_update )
|
||||||
{
|
{
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
@@ -724,7 +780,7 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
|
|||||||
|
|
||||||
if(( newnum < 0 ) || ( newnum >= clgame.maxEntities ))
|
if(( newnum < 0 ) || ( newnum >= clgame.maxEntities ))
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "CL_DeltaEntity: invalid newnum: %d\n", newnum );
|
Con_DPrintf( S_ERROR "%s: invalid newnum: %d\n", __func__, newnum );
|
||||||
if( has_update )
|
if( has_update )
|
||||||
MSG_ReadDeltaEntity( msg, old, state, newnum, delta_type, cl.mtime[0] );
|
MSG_ReadDeltaEntity( msg, old, state, newnum, delta_type, cl.mtime[0] );
|
||||||
return;
|
return;
|
||||||
@@ -736,7 +792,7 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
|
|||||||
|
|
||||||
if( has_update )
|
if( has_update )
|
||||||
alive = MSG_ReadDeltaEntity( msg, old, state, newnum, delta_type, cl.mtime[0] );
|
alive = MSG_ReadDeltaEntity( msg, old, state, newnum, delta_type, cl.mtime[0] );
|
||||||
else memcpy( state, old, sizeof( entity_state_t ));
|
else *state = *old;
|
||||||
|
|
||||||
if( !alive )
|
if( !alive )
|
||||||
{
|
{
|
||||||
@@ -772,7 +828,7 @@ An svc_packetentities has just been parsed, deal with the
|
|||||||
rest of the data stream.
|
rest of the data stream.
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto )
|
||||||
{
|
{
|
||||||
frame_t *newframe, *oldframe;
|
frame_t *newframe, *oldframe;
|
||||||
int oldindex, newnum, oldnum;
|
int oldindex, newnum, oldnum;
|
||||||
@@ -788,7 +844,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||||||
CL_WriteDemoJumpTime();
|
CL_WriteDemoJumpTime();
|
||||||
|
|
||||||
// sentinel count. save it for debug checking
|
// sentinel count. save it for debug checking
|
||||||
if( cls.legacymode )
|
if( proto == PROTO_LEGACY )
|
||||||
count = MSG_ReadWord( msg );
|
count = MSG_ReadWord( msg );
|
||||||
else count = MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1;
|
else count = MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1;
|
||||||
|
|
||||||
@@ -802,32 +858,12 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||||||
|
|
||||||
if( delta )
|
if( delta )
|
||||||
{
|
{
|
||||||
int subtracted;
|
uint oldpacket = MSG_ReadByte( msg );
|
||||||
|
|
||||||
oldpacket = MSG_ReadByte( msg );
|
|
||||||
subtracted = ( cls.netchan.incoming_sequence - oldpacket ) & 0xFF;
|
|
||||||
|
|
||||||
if( subtracted == 0 )
|
|
||||||
{
|
|
||||||
Con_NPrintf( 2, "^3Warning:^1 update too old\n^7\n" );
|
|
||||||
CL_FlushEntityPacket( msg );
|
|
||||||
return playerbytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( subtracted >= CL_UPDATE_MASK )
|
|
||||||
{
|
|
||||||
// we can't use this, it is too old
|
|
||||||
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
|
||||||
CL_FlushEntityPacket( msg );
|
|
||||||
return playerbytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
oldframe = &cl.frames[oldpacket & CL_UPDATE_MASK];
|
oldframe = &cl.frames[oldpacket & CL_UPDATE_MASK];
|
||||||
|
|
||||||
if(( cls.next_client_entities - oldframe->first_entity ) > ( cls.num_client_entities - NUM_PACKET_ENTITIES ))
|
if( !CL_ValidateDeltaPacket( oldpacket, oldframe ))
|
||||||
{
|
{
|
||||||
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
|
CL_FlushEntityPacket( msg, proto );
|
||||||
CL_FlushEntityPacket( msg );
|
|
||||||
return playerbytes;
|
return playerbytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -845,31 +881,15 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||||||
|
|
||||||
oldent = NULL;
|
oldent = NULL;
|
||||||
oldindex = 0;
|
oldindex = 0;
|
||||||
|
oldnum = CL_UpdateOldEntNum( oldindex, oldframe, &oldent );
|
||||||
if( !oldframe )
|
|
||||||
{
|
|
||||||
oldnum = MAX_ENTNUMBER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( oldindex >= oldframe->num_entities )
|
|
||||||
{
|
|
||||||
oldnum = MAX_ENTNUMBER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
|
|
||||||
oldnum = oldent->number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
if( !CL_ParseEntityNumFromPacket( msg, &newnum ))
|
if( !CL_ParseEntityNumFromPacket( msg, &newnum, proto ))
|
||||||
break; // done
|
break; // done
|
||||||
|
|
||||||
if( MSG_CheckOverflow( msg ))
|
if( MSG_CheckOverflow( msg ))
|
||||||
Host_Error( "CL_ParsePacketEntities: overflow\n" );
|
Host_Error( "%s: overflow\n", __func__ );
|
||||||
|
|
||||||
player = CL_IsPlayerIndex( newnum );
|
player = CL_IsPlayerIndex( newnum );
|
||||||
|
|
||||||
@@ -877,17 +897,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||||||
{
|
{
|
||||||
// one or more entities from the old packet are unchanged
|
// one or more entities from the old packet are unchanged
|
||||||
CL_DeltaEntity( msg, newframe, oldnum, oldent, false );
|
CL_DeltaEntity( msg, newframe, oldnum, oldent, false );
|
||||||
oldindex++;
|
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||||
|
|
||||||
if( oldindex >= oldframe->num_entities )
|
|
||||||
{
|
|
||||||
oldnum = MAX_ENTNUMBER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
|
|
||||||
oldnum = oldent->number;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( oldnum == newnum )
|
if( oldnum == newnum )
|
||||||
@@ -896,17 +906,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||||||
bufStart = MSG_GetNumBytesRead( msg );
|
bufStart = MSG_GetNumBytesRead( msg );
|
||||||
CL_DeltaEntity( msg, newframe, newnum, oldent, true );
|
CL_DeltaEntity( msg, newframe, newnum, oldent, true );
|
||||||
if( player ) playerbytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
if( player ) playerbytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
oldindex++;
|
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||||
|
|
||||||
if( oldindex >= oldframe->num_entities )
|
|
||||||
{
|
|
||||||
oldnum = MAX_ENTNUMBER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
|
|
||||||
oldnum = oldent->number;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -925,21 +925,11 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||||||
{
|
{
|
||||||
// one or more entities from the old packet are unchanged
|
// one or more entities from the old packet are unchanged
|
||||||
CL_DeltaEntity( msg, newframe, oldnum, oldent, false );
|
CL_DeltaEntity( msg, newframe, oldnum, oldent, false );
|
||||||
oldindex++;
|
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||||
|
|
||||||
if( oldindex >= oldframe->num_entities )
|
|
||||||
{
|
|
||||||
oldnum = MAX_ENTNUMBER;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
oldent = &cls.packet_entities[(oldframe->first_entity+oldindex) % cls.num_client_entities];
|
|
||||||
oldnum = oldent->number;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( newframe->num_entities != count && newframe->num_entities != 0 )
|
if( newframe->num_entities != count && newframe->num_entities != 0 )
|
||||||
Con_Reportf( S_WARN "CL_Parse%sPacketEntities: (%i should be %i)\n", delta ? "Delta" : "", newframe->num_entities, count );
|
Con_Reportf( S_WARN "%s%s: (%i should be %i)\n", __func__, delta ? "Delta" : "", newframe->num_entities, count );
|
||||||
|
|
||||||
if( !newframe->valid )
|
if( !newframe->valid )
|
||||||
return playerbytes; // frame is not valid but message was parsed
|
return playerbytes; // frame is not valid but message was parsed
|
||||||
@@ -957,7 +947,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
|||||||
cls.signon = SIGNONS;
|
cls.signon = SIGNONS;
|
||||||
|
|
||||||
// Clear loading plaque.
|
// Clear loading plaque.
|
||||||
CL_SignonReply ();
|
CL_SignonReply( proto );
|
||||||
}
|
}
|
||||||
|
|
||||||
return playerbytes;
|
return playerbytes;
|
||||||
@@ -1041,7 +1031,7 @@ CL_LinkCustomEntity
|
|||||||
Add server beam to draw list
|
Add server beam to draw list
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_LinkCustomEntity( cl_entity_t *ent, entity_state_t *state )
|
static void CL_LinkCustomEntity( cl_entity_t *ent, entity_state_t *state )
|
||||||
{
|
{
|
||||||
ent->curstate.movetype = state->modelindex; // !!!
|
ent->curstate.movetype = state->modelindex; // !!!
|
||||||
|
|
||||||
@@ -1064,7 +1054,7 @@ Create visible entities in the correct position
|
|||||||
for all current players
|
for all current players
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_LinkPlayers( frame_t *frame )
|
static void CL_LinkPlayers( frame_t *frame )
|
||||||
{
|
{
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
@@ -1147,7 +1137,7 @@ CL_LinkPacketEntities
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void CL_LinkPacketEntities( frame_t *frame )
|
static void CL_LinkPacketEntities( frame_t *frame )
|
||||||
{
|
{
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
@@ -1171,7 +1161,7 @@ void CL_LinkPacketEntities( frame_t *frame )
|
|||||||
|
|
||||||
if( !ent )
|
if( !ent )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "CL_LinkPacketEntity: bad entity %i\n", state->number );
|
Con_Reportf( S_ERROR "%s: bad entity %i\n", __func__, state->number );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1212,18 +1202,34 @@ void CL_LinkPacketEntities( frame_t *frame )
|
|||||||
#else
|
#else
|
||||||
if( ent->lastmove >= cl.time )
|
if( ent->lastmove >= cl.time )
|
||||||
{
|
{
|
||||||
|
float at = ent->curstate.animtime;
|
||||||
|
|
||||||
CL_ResetLatchedVars( ent, true );
|
CL_ResetLatchedVars( ent, true );
|
||||||
|
|
||||||
|
if( cl_fixmodelinterpolationartifacts.value )
|
||||||
|
ent->latched.prevanimtime = ent->curstate.animtime = at;
|
||||||
|
|
||||||
VectorCopy( ent->curstate.origin, ent->latched.prevorigin );
|
VectorCopy( ent->curstate.origin, ent->latched.prevorigin );
|
||||||
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
|
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
|
||||||
|
|
||||||
|
if( !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||||
|
{
|
||||||
// disable step interpolation in client.dll
|
// disable step interpolation in client.dll
|
||||||
ent->curstate.movetype = MOVETYPE_NONE;
|
ent->curstate.movetype = MOVETYPE_NONE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||||
|
{
|
||||||
|
interpolate = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// restore step interpolation in client.dll
|
// restore step interpolation in client.dll
|
||||||
ent->curstate.movetype = MOVETYPE_STEP;
|
ent->curstate.movetype = MOVETYPE_STEP;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1247,11 +1253,24 @@ void CL_LinkPacketEntities( frame_t *frame )
|
|||||||
if ( !CL_InterpolateModel( ent ))
|
if ( !CL_InterpolateModel( ent ))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
// a1ba: in GoldSrc this is done for cstrike and czero
|
||||||
|
// but let modders use this as an engine feature
|
||||||
|
else if( FBitSet( host.features, ENGINE_STEP_POSHISTORY_LERP ) &&
|
||||||
|
ent->curstate.movetype == MOVETYPE_STEP && !NET_IsLocalAddress( cls.netchan.remote_address ))
|
||||||
{
|
{
|
||||||
if( !CL_InterpolateModel( ent ))
|
if( !CL_InterpolateModel( ent ))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
// ABSOLUTELY STUPID HACK TO ALLOW MONSTERS
|
||||||
|
// INTERPOLATION IN GRAVGUNMOD COOP
|
||||||
|
// MUST BE REMOVED ONCE WE REMOVE 48 PROTO SUPPORT
|
||||||
|
else if( cls.legacymode == PROTO_LEGACY && ent->model->type == mod_studio && ent->curstate.movetype == MOVETYPE_TOSS )
|
||||||
|
{
|
||||||
|
if( !CL_InterpolateModel( ent ))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// no interpolation right now
|
// no interpolation right now
|
||||||
@@ -1447,9 +1466,3 @@ qboolean CL_GetMovieSpatialization( rawchan_t *ch )
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_ExtraUpdate( void )
|
|
||||||
{
|
|
||||||
clgame.dllFuncs.IN_Accumulate();
|
|
||||||
S_ExtraUpdate();
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -34,10 +34,10 @@ GNU General Public License for more details.
|
|||||||
#define MAX_TEXTCHANNELS 8 // must be power of two (GoldSrc uses 4 channels)
|
#define MAX_TEXTCHANNELS 8 // must be power of two (GoldSrc uses 4 channels)
|
||||||
#define TEXT_MSGNAME "TextMessage%i"
|
#define TEXT_MSGNAME "TextMessage%i"
|
||||||
|
|
||||||
char cl_textbuffer[MAX_TEXTCHANNELS][2048];
|
static char cl_textbuffer[MAX_TEXTCHANNELS][2048];
|
||||||
client_textmessage_t cl_textmessage[MAX_TEXTCHANNELS];
|
static client_textmessage_t cl_textmessage[MAX_TEXTCHANNELS];
|
||||||
|
|
||||||
static dllfunc_t cdll_exports[] =
|
static const dllfunc_t cdll_exports[] =
|
||||||
{
|
{
|
||||||
{ "Initialize", (void **)&clgame.dllFuncs.pfnInitialize },
|
{ "Initialize", (void **)&clgame.dllFuncs.pfnInitialize },
|
||||||
{ "HUD_VidInit", (void **)&clgame.dllFuncs.pfnVidInit },
|
{ "HUD_VidInit", (void **)&clgame.dllFuncs.pfnVidInit },
|
||||||
@@ -80,7 +80,7 @@ static dllfunc_t cdll_exports[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
// optional exports
|
// optional exports
|
||||||
static dllfunc_t cdll_new_exports[] = // allowed only in SDK 2.3 and higher
|
static const dllfunc_t cdll_new_exports[] = // allowed only in SDK 2.3 and higher
|
||||||
{
|
{
|
||||||
{ "HUD_GetStudioModelInterface", (void **)&clgame.dllFuncs.pfnGetStudioModelInterface },
|
{ "HUD_GetStudioModelInterface", (void **)&clgame.dllFuncs.pfnGetStudioModelInterface },
|
||||||
{ "HUD_DirectorMessage", (void **)&clgame.dllFuncs.pfnDirectorMessage },
|
{ "HUD_DirectorMessage", (void **)&clgame.dllFuncs.pfnDirectorMessage },
|
||||||
@@ -140,11 +140,7 @@ returns true if thirdperson is enabled
|
|||||||
*/
|
*/
|
||||||
qboolean CL_IsThirdPerson( void )
|
qboolean CL_IsThirdPerson( void )
|
||||||
{
|
{
|
||||||
cl.local.thirdperson = clgame.dllFuncs.CL_IsThirdPerson();
|
return clgame.dllFuncs.CL_IsThirdPerson() ? true : false;
|
||||||
|
|
||||||
if( cl.local.thirdperson )
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -231,7 +227,7 @@ static void CL_InitCDAudio( const char *filename )
|
|||||||
|
|
||||||
if( ++c > MAX_CDTRACKS - 1 )
|
if( ++c > MAX_CDTRACKS - 1 )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_WARN "CD_Init: too many tracks %i in %s\n", MAX_CDTRACKS, filename );
|
Con_Reportf( S_WARN "%s: too many tracks %i in %s\n", __func__, MAX_CDTRACKS, filename );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,18 +248,18 @@ static int CL_AdjustXPos( float x, int width, int totalWidth )
|
|||||||
|
|
||||||
if( x == -1 )
|
if( x == -1 )
|
||||||
{
|
{
|
||||||
xPos = ( refState.width - width ) * 0.5f;
|
xPos = ( clgame.scrInfo.iWidth - width ) * 0.5f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( x < 0 )
|
if ( x < 0 )
|
||||||
xPos = (1.0f + x) * refState.width - totalWidth; // Alight right
|
xPos = (1.0f + x) * clgame.scrInfo.iWidth - totalWidth; // Alight right
|
||||||
else // align left
|
else // align left
|
||||||
xPos = x * refState.width;
|
xPos = x * clgame.scrInfo.iWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xPos + width > refState.width )
|
if( xPos + width > clgame.scrInfo.iWidth )
|
||||||
xPos = refState.width - width;
|
xPos = clgame.scrInfo.iWidth - width;
|
||||||
else if( xPos < 0 )
|
else if( xPos < 0 )
|
||||||
xPos = 0;
|
xPos = 0;
|
||||||
|
|
||||||
@@ -283,19 +279,19 @@ static int CL_AdjustYPos( float y, int height )
|
|||||||
|
|
||||||
if( y == -1 ) // centered?
|
if( y == -1 ) // centered?
|
||||||
{
|
{
|
||||||
yPos = ( refState.height - height ) * 0.5f;
|
yPos = ( clgame.scrInfo.iHeight - height ) * 0.5f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Alight bottom?
|
// Alight bottom?
|
||||||
if( y < 0 )
|
if( y < 0 )
|
||||||
yPos = (1.0f + y) * refState.height - height; // Alight bottom
|
yPos = (1.0f + y) * clgame.scrInfo.iHeight - height; // Alight bottom
|
||||||
else // align top
|
else // align top
|
||||||
yPos = y * refState.height;
|
yPos = y * clgame.scrInfo.iHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( yPos + height > refState.height )
|
if( yPos + height > clgame.scrInfo.iHeight )
|
||||||
yPos = refState.height - height;
|
yPos = clgame.scrInfo.iHeight - height;
|
||||||
else if( yPos < 0 )
|
else if( yPos < 0 )
|
||||||
yPos = 0;
|
yPos = 0;
|
||||||
|
|
||||||
@@ -357,7 +353,9 @@ void SPR_AdjustSize( float *x, float *y, float *w, float *h )
|
|||||||
*h *= yscale;
|
*h *= yscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float *s2, float *t2 )
|
static void SPR_AdjustTexCoords( int texnum, float width, float height, float *s1, float *t1, float *s2, float *t2 )
|
||||||
|
{
|
||||||
|
if( REF_GET_PARM( PARM_TEX_FILTERING, texnum ))
|
||||||
{
|
{
|
||||||
if( refState.width != clgame.scrInfo.iWidth )
|
if( refState.width != clgame.scrInfo.iWidth )
|
||||||
{
|
{
|
||||||
@@ -372,6 +370,7 @@ void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float
|
|||||||
*t1 += 0.5f;
|
*t1 += 0.5f;
|
||||||
*t2 -= 0.5f;
|
*t2 -= 0.5f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*s1 /= width;
|
*s1 /= width;
|
||||||
*t1 /= height;
|
*t1 /= height;
|
||||||
@@ -402,6 +401,8 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
|||||||
height = h;
|
height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
|
||||||
|
|
||||||
if( prc )
|
if( prc )
|
||||||
{
|
{
|
||||||
wrect_t rc = *prc;
|
wrect_t rc = *prc;
|
||||||
@@ -418,7 +419,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
|||||||
t2 = rc.bottom;
|
t2 = rc.bottom;
|
||||||
|
|
||||||
// calc user-defined rectangle
|
// calc user-defined rectangle
|
||||||
SPR_AdjustTexCoords( width, height, &s1, &t1, &s2, &t2 );
|
SPR_AdjustTexCoords( texnum, width, height, &s1, &t1, &s2, &t2 );
|
||||||
width = rc.right - rc.left;
|
width = rc.right - rc.left;
|
||||||
height = rc.bottom - rc.top;
|
height = rc.bottom - rc.top;
|
||||||
}
|
}
|
||||||
@@ -434,7 +435,6 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
|
|||||||
|
|
||||||
// scale for screen sizes
|
// scale for screen sizes
|
||||||
SPR_AdjustSize( &x, &y, &width, &height );
|
SPR_AdjustSize( &x, &y, &width, &height );
|
||||||
texnum = ref.dllFuncs.R_GetSpriteTexture( clgame.ds.pSprite, frame );
|
|
||||||
ref.dllFuncs.Color4ub( clgame.ds.spriteColor[0], clgame.ds.spriteColor[1], clgame.ds.spriteColor[2], clgame.ds.spriteColor[3] );
|
ref.dllFuncs.Color4ub( clgame.ds.spriteColor[0], clgame.ds.spriteColor[1], clgame.ds.spriteColor[2], clgame.ds.spriteColor[3] );
|
||||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, texnum );
|
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, texnum );
|
||||||
}
|
}
|
||||||
@@ -470,8 +470,7 @@ void CL_DrawCenterPrint( void )
|
|||||||
pText = clgame.centerPrint.message;
|
pText = clgame.centerPrint.message;
|
||||||
|
|
||||||
CL_DrawCharacterLen( font, 0, NULL, &charHeight );
|
CL_DrawCharacterLen( font, 0, NULL, &charHeight );
|
||||||
|
CL_SetFontRendermode( font );
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
|
||||||
for( i = 0; i < clgame.centerPrint.lines; i++ )
|
for( i = 0; i < clgame.centerPrint.lines; i++ )
|
||||||
{
|
{
|
||||||
lineLength = 0;
|
lineLength = 0;
|
||||||
@@ -547,7 +546,7 @@ fill screen with specfied color
|
|||||||
can be modulated
|
can be modulated
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_DrawScreenFade( void )
|
static void CL_DrawScreenFade( void )
|
||||||
{
|
{
|
||||||
screenfade_t *sf = &clgame.fade;
|
screenfade_t *sf = &clgame.fade;
|
||||||
int alpha;
|
int alpha;
|
||||||
@@ -557,7 +556,19 @@ void CL_DrawScreenFade( void )
|
|||||||
if( !alpha )
|
if( !alpha )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( FBitSet( sf->fadeFlags, FFADE_MODULATE ))
|
if( !FBitSet( sf->fadeFlags, FFADE_MODULATE ))
|
||||||
|
{
|
||||||
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
|
ref.dllFuncs.Color4ub( sf->fader, sf->fadeg, sf->fadeb, alpha );
|
||||||
|
}
|
||||||
|
else if( Host_IsQuakeCompatible( ))
|
||||||
|
{
|
||||||
|
// Quake Wrapper and Quake Remake use FFADE_MODULATE for item pickups
|
||||||
|
// so hack the check here
|
||||||
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||||
|
ref.dllFuncs.Color4ub( sf->fader, sf->fadeg, sf->fadeb, alpha );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderScreenFadeModulate );
|
ref.dllFuncs.GL_SetRenderMode( kRenderScreenFadeModulate );
|
||||||
|
|
||||||
@@ -567,11 +578,6 @@ void CL_DrawScreenFade( void )
|
|||||||
(uint16_t)( sf->fadeb * alpha + ( 255 - alpha ) * 255 ) >> 8,
|
(uint16_t)( sf->fadeb * alpha + ( 255 - alpha ) * 255 ) >> 8,
|
||||||
255 );
|
255 );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
|
||||||
ref.dllFuncs.Color4ub( sf->fader, sf->fadeg, sf->fadeb, alpha );
|
|
||||||
}
|
|
||||||
|
|
||||||
ref.dllFuncs.R_DrawStretchPic( 0, 0, refState.width, refState.height, 0, 0, 1, 1,
|
ref.dllFuncs.R_DrawStretchPic( 0, 0, refState.width, refState.height, 0, 0, 1, 1,
|
||||||
R_GetBuiltinTexture( REF_WHITE_TEXTURE ));
|
R_GetBuiltinTexture( REF_WHITE_TEXTURE ));
|
||||||
@@ -763,7 +769,7 @@ CL_SoundFromIndex
|
|||||||
return soundname from index
|
return soundname from index
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
const char *CL_SoundFromIndex( int index )
|
static const char *CL_SoundFromIndex( int index )
|
||||||
{
|
{
|
||||||
sfx_t *sfx = NULL;
|
sfx_t *sfx = NULL;
|
||||||
int hSound;
|
int hSound;
|
||||||
@@ -774,14 +780,14 @@ const char *CL_SoundFromIndex( int index )
|
|||||||
|
|
||||||
if( !hSound )
|
if( !hSound )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "CL_SoundFromIndex: invalid sound index %i\n", index );
|
Con_DPrintf( S_ERROR "%s: invalid sound index %i\n", __func__, index );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sfx = S_GetSfxByHandle( hSound );
|
sfx = S_GetSfxByHandle( hSound );
|
||||||
if( !sfx )
|
if( !sfx )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "CL_SoundFromIndex: bad sfx for index %i\n", index );
|
Con_DPrintf( S_ERROR "%s: bad sfx for index %i\n", __func__, index );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -909,7 +915,7 @@ CL_DrawCrosshair
|
|||||||
Render crosshair
|
Render crosshair
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_DrawCrosshair( void )
|
static void CL_DrawCrosshair( void )
|
||||||
{
|
{
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
float xscale, yscale;
|
float xscale, yscale;
|
||||||
@@ -1009,6 +1015,7 @@ void CL_DrawHUD( int state )
|
|||||||
CL_DrawCrosshair ();
|
CL_DrawCrosshair ();
|
||||||
CL_DrawCenterPrint ();
|
CL_DrawCenterPrint ();
|
||||||
clgame.dllFuncs.pfnRedraw( cl.time, cl.intermission );
|
clgame.dllFuncs.pfnRedraw( cl.time, cl.intermission );
|
||||||
|
if( showpause.value )
|
||||||
CL_DrawLoadingOrPaused( cls.pauseIcon );
|
CL_DrawLoadingOrPaused( cls.pauseIcon );
|
||||||
break;
|
break;
|
||||||
case CL_LOADING:
|
case CL_LOADING:
|
||||||
@@ -1038,10 +1045,10 @@ void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize )
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( !pszName || !*pszName )
|
if( !pszName || !*pszName )
|
||||||
Host_Error( "CL_LinkUserMessage: bad message name\n" );
|
Host_Error( "%s: bad message name\n", __func__ );
|
||||||
|
|
||||||
if( svc_num <= svc_lastmsg )
|
if( svc_num <= svc_lastmsg )
|
||||||
Host_Error( "CL_LinkUserMessage: tried to hook a system message \"%s\"\n", svc_strings[svc_num] );
|
Host_Error( "%s: tried to hook a system message \"%s\"\n", __func__, svc_strings[svc_num] );
|
||||||
|
|
||||||
// see if already hooked
|
// see if already hooked
|
||||||
for( i = 0; i < MAX_USER_MESSAGES && clgame.msg[i].name[0]; i++ )
|
for( i = 0; i < MAX_USER_MESSAGES && clgame.msg[i].name[0]; i++ )
|
||||||
@@ -1058,7 +1065,7 @@ void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize )
|
|||||||
|
|
||||||
if( i == MAX_USER_MESSAGES )
|
if( i == MAX_USER_MESSAGES )
|
||||||
{
|
{
|
||||||
Host_Error( "CL_LinkUserMessage: MAX_USER_MESSAGES hit!\n" );
|
Host_Error( "%s: MAX_USER_MESSAGES hit!\n", __func__ );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1179,7 +1186,7 @@ static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite,
|
|||||||
if( type == SPR_CLIENT || type == SPR_HUDSPRITE )
|
if( type == SPR_CLIENT || type == SPR_HUDSPRITE )
|
||||||
SetBits( m_pSprite->flags, MODEL_CLIENT );
|
SetBits( m_pSprite->flags, MODEL_CLIENT );
|
||||||
|
|
||||||
m_pSprite->numtexinfo = texFlags; // store texFlags into numtexinfo
|
m_pSprite->numtexinfo = texFlags; // store texFlags for renderer into numtexinfo
|
||||||
|
|
||||||
if( !FS_FileExists( szSpriteName, false ) )
|
if( !FS_FileExists( szSpriteName, false ) )
|
||||||
{
|
{
|
||||||
@@ -1206,7 +1213,7 @@ static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite,
|
|||||||
ref.dllFuncs.Mod_LoadMapSprite( m_pSprite, buf, size, &loaded );
|
ref.dllFuncs.Mod_LoadMapSprite( m_pSprite, buf, size, &loaded );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Mod_LoadSpriteModel( m_pSprite, buf, &loaded, texFlags );
|
Mod_LoadSpriteModel( m_pSprite, buf, &loaded );
|
||||||
ref.dllFuncs.Mod_ProcessRenderData( m_pSprite, true, buf );
|
ref.dllFuncs.Mod_ProcessRenderData( m_pSprite, true, buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1239,7 +1246,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
|
|||||||
|
|
||||||
if( !COM_CheckString( filename ))
|
if( !COM_CheckString( filename ))
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "CL_LoadSpriteModel: bad name!\n" );
|
Con_Reportf( S_ERROR "%s: bad name!\n", __func__ );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1326,6 +1333,7 @@ pfnSPR_Load
|
|||||||
function exported for support GoldSrc Monitor utility
|
function exported for support GoldSrc Monitor utility
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
|
HSPRITE EXPORT pfnSPR_Load( const char *szPicName );
|
||||||
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
||||||
{
|
{
|
||||||
model_t *spr;
|
model_t *spr;
|
||||||
@@ -1375,6 +1383,7 @@ pfnSPR_Frames
|
|||||||
function exported for support GoldSrc Monitor utility
|
function exported for support GoldSrc Monitor utility
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
|
int EXPORT pfnSPR_Frames( HSPRITE hPic );
|
||||||
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
||||||
{
|
{
|
||||||
int numFrames = 0;
|
int numFrames = 0;
|
||||||
@@ -1443,7 +1452,7 @@ pfnSPR_Draw
|
|||||||
*/
|
*/
|
||||||
static void GAME_EXPORT pfnSPR_Draw( int frame, int x, int y, const wrect_t *prc )
|
static void GAME_EXPORT pfnSPR_Draw( int frame, int x, int y, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
||||||
SPR_DrawGeneric( frame, x, y, -1, -1, prc );
|
SPR_DrawGeneric( frame, x, y, -1, -1, prc );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1498,12 +1507,12 @@ static void GAME_EXPORT pfnSPR_DrawAdditive( int frame, int x, int y, const wrec
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
=========
|
=========
|
||||||
pfnSPR_GetList
|
SPR_GetList
|
||||||
|
|
||||||
for parsing half-life scripts - hud.txt etc
|
for parsing half-life scripts - hud.txt etc
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount )
|
static client_sprite_t *SPR_GetList( char *psz, int *piCount )
|
||||||
{
|
{
|
||||||
cached_spritelist_t *pEntry = &clgame.sprlist[0];
|
cached_spritelist_t *pEntry = &clgame.sprlist[0];
|
||||||
int slot, index, numSprites = 0;
|
int slot, index, numSprites = 0;
|
||||||
@@ -1529,7 +1538,7 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount )
|
|||||||
|
|
||||||
if( slot == MAX_CLIENT_SPRITES )
|
if( slot == MAX_CLIENT_SPRITES )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "SPR_GetList: overflow cache!\n" );
|
Con_Printf( S_ERROR "%s: overflow cache!\n", __func__ );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1593,7 +1602,7 @@ CL_FillRGBA
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT CL_FillRGBA( int x, int y, int w, int h, int r, int g, int b, int a )
|
static void GAME_EXPORT CL_FillRGBA( int x, int y, int w, int h, int r, int g, int b, int a )
|
||||||
{
|
{
|
||||||
float _x = x, _y = y, _w = w, _h = h;
|
float _x = x, _y = y, _w = w, _h = h;
|
||||||
|
|
||||||
@@ -1635,6 +1644,7 @@ get actual screen info
|
|||||||
*/
|
*/
|
||||||
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
||||||
{
|
{
|
||||||
|
qboolean apply_scale_factor = false;
|
||||||
float scale_factor = hud_scale.value;
|
float scale_factor = hud_scale.value;
|
||||||
|
|
||||||
if( FBitSet( hud_fontscale.flags, FCVAR_CHANGED ))
|
if( FBitSet( hud_fontscale.flags, FCVAR_CHANGED ))
|
||||||
@@ -1650,16 +1660,23 @@ int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
|||||||
clgame.scrInfo.iFlags = SCRINFO_SCREENFLASH;
|
clgame.scrInfo.iFlags = SCRINFO_SCREENFLASH;
|
||||||
|
|
||||||
if( scale_factor && scale_factor != 1.0f )
|
if( scale_factor && scale_factor != 1.0f )
|
||||||
|
{
|
||||||
|
float scaled_width = (float)refState.width / scale_factor;
|
||||||
|
if( scaled_width >= hud_scale_minimal_width.value )
|
||||||
|
apply_scale_factor = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( apply_scale_factor )
|
||||||
{
|
{
|
||||||
clgame.scrInfo.iWidth = (float)refState.width / scale_factor;
|
clgame.scrInfo.iWidth = (float)refState.width / scale_factor;
|
||||||
clgame.scrInfo.iHeight = (float)refState.height / scale_factor;
|
clgame.scrInfo.iHeight = (float)refState.height / scale_factor;
|
||||||
clgame.scrInfo.iFlags |= SCRINFO_STRETCHED;
|
SetBits( clgame.scrInfo.iFlags, SCRINFO_STRETCHED );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clgame.scrInfo.iWidth = refState.width;
|
clgame.scrInfo.iWidth = refState.width;
|
||||||
clgame.scrInfo.iHeight = refState.height;
|
clgame.scrInfo.iHeight = refState.height;
|
||||||
clgame.scrInfo.iFlags &= ~SCRINFO_STRETCHED;
|
ClearBits( clgame.scrInfo.iFlags, SCRINFO_STRETCHED );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !pscrinfo ) return 0;
|
if( !pscrinfo ) return 0;
|
||||||
@@ -1700,7 +1717,8 @@ pfnCvar_RegisterVariable
|
|||||||
static cvar_t *GAME_EXPORT pfnCvar_RegisterClientVariable( const char *szName, const char *szValue, int flags )
|
static cvar_t *GAME_EXPORT pfnCvar_RegisterClientVariable( const char *szName, const char *szValue, int flags )
|
||||||
{
|
{
|
||||||
// a1ba: try to mitigate outdated client.dll vulnerabilities
|
// a1ba: try to mitigate outdated client.dll vulnerabilities
|
||||||
if( !Q_stricmp( szName, "motdfile" ))
|
if( !Q_stricmp( szName, "motdfile" )
|
||||||
|
|| !Q_stricmp( szName, "sensitivity" ))
|
||||||
flags |= FCVAR_PRIVILEGED;
|
flags |= FCVAR_PRIVILEGED;
|
||||||
|
|
||||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_CLIENTDLL ));
|
return (cvar_t *)Cvar_Get( szName, szValue, flags|FCVAR_CLIENTDLL, Cvar_BuildAutoDescription( szName, flags|FCVAR_CLIENTDLL ));
|
||||||
@@ -1729,7 +1747,7 @@ static int GAME_EXPORT pfnHookUserMsg( const char *pszName, pfnUserMsgHook pfn )
|
|||||||
|
|
||||||
if( i == MAX_USER_MESSAGES )
|
if( i == MAX_USER_MESSAGES )
|
||||||
{
|
{
|
||||||
Host_Error( "HookUserMsg: MAX_USER_MESSAGES hit!\n" );
|
Host_Error( "%s: MAX_USER_MESSAGES hit!\n", __func__ );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2121,7 +2139,7 @@ pfnGetViewModel
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
cl_entity_t* GAME_EXPORT CL_GetViewModel( void )
|
static cl_entity_t* GAME_EXPORT CL_GetViewModel( void )
|
||||||
{
|
{
|
||||||
return &clgame.viewent;
|
return &clgame.viewent;
|
||||||
}
|
}
|
||||||
@@ -2279,7 +2297,7 @@ static void GAME_EXPORT pfnHookEvent( const char *filename, pfnEventHook pfn )
|
|||||||
|
|
||||||
if( !Q_stricmp( name, ev->name ) && ev->func != NULL )
|
if( !Q_stricmp( name, ev->name ) && ev->func != NULL )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_WARN "CL_HookEvent: %s already hooked!\n", name );
|
Con_Reportf( S_WARN "%s: %s already hooked!\n", __func__, name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2362,7 +2380,7 @@ static int GAME_EXPORT CL_FindModelIndex( const char *m )
|
|||||||
if( lasttimewarn < host.realtime )
|
if( lasttimewarn < host.realtime )
|
||||||
{
|
{
|
||||||
// tell user about problem (but don't spam console)
|
// tell user about problem (but don't spam console)
|
||||||
Con_Printf( S_ERROR "Could not find index for model %s: not precached\n", filepath );
|
Con_DPrintf( S_ERROR "Could not find index for model %s: not precached\n", filepath );
|
||||||
lasttimewarn = host.realtime + 1.0f;
|
lasttimewarn = host.realtime + 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2414,8 +2432,8 @@ static void GAME_EXPORT pfnLocalPlayerBounds( int hull, float *mins, float *maxs
|
|||||||
{
|
{
|
||||||
if( hull >= 0 && hull < 4 )
|
if( hull >= 0 && hull < 4 )
|
||||||
{
|
{
|
||||||
if( mins ) VectorCopy( clgame.pmove->player_mins[hull], mins );
|
if( mins ) VectorCopy( host.player_mins[hull], mins );
|
||||||
if( maxs ) VectorCopy( clgame.pmove->player_maxs[hull], maxs );
|
if( maxs ) VectorCopy( host.player_maxs[hull], maxs );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2470,6 +2488,51 @@ static physent_t *pfnGetVisent( int idx )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int GAME_EXPORT CL_TestLine( const vec3_t start, const vec3_t end, int flags )
|
||||||
|
{
|
||||||
|
return PM_TestLineExt( clgame.pmove, clgame.pmove->physents, clgame.pmove->numphysent, start, end, flags );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
CL_PushTraceBounds
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void GAME_EXPORT CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs )
|
||||||
|
{
|
||||||
|
if( !host.trace_bounds_pushed )
|
||||||
|
{
|
||||||
|
memcpy( host.player_mins_backup, host.player_mins, sizeof( host.player_mins_backup ));
|
||||||
|
memcpy( host.player_maxs_backup, host.player_maxs, sizeof( host.player_maxs_backup ));
|
||||||
|
|
||||||
|
host.trace_bounds_pushed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
hullnum = bound( 0, hullnum, 3 );
|
||||||
|
VectorCopy( mins, host.player_mins[hullnum] );
|
||||||
|
VectorCopy( maxs, host.player_maxs[hullnum] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
CL_PopTraceBounds
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void GAME_EXPORT CL_PopTraceBounds( void )
|
||||||
|
{
|
||||||
|
if( !host.trace_bounds_pushed )
|
||||||
|
{
|
||||||
|
Con_Reportf( S_ERROR "%s called without push!\n", __func__ );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
host.trace_bounds_pushed = false;
|
||||||
|
memcpy( host.player_mins, host.player_mins_backup, sizeof( host.player_mins ));
|
||||||
|
memcpy( host.player_maxs, host.player_maxs_backup, sizeof( host.player_maxs ));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnSetTraceHull
|
pfnSetTraceHull
|
||||||
@@ -2665,6 +2728,48 @@ static model_t *pfnLoadMapSprite( const char *filename )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
COM_AddAppDirectoryToSearchPath
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
static void GAME_EXPORT COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName )
|
||||||
|
{
|
||||||
|
FS_AddGameHierarchy( pszBaseDir, FS_NOWRITE_PATH );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
===========
|
||||||
|
COM_ExpandFilename
|
||||||
|
|
||||||
|
Finds the file in the search path, copies over the name with the full path name.
|
||||||
|
This doesn't search in the pak file.
|
||||||
|
===========
|
||||||
|
*/
|
||||||
|
static int GAME_EXPORT COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize )
|
||||||
|
{
|
||||||
|
char result[MAX_SYSPATH];
|
||||||
|
|
||||||
|
if( !COM_CheckString( fileName ) || !nameOutBuffer || nameOutBufferSize <= 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// filename examples:
|
||||||
|
// media\sierra.avi - D:\Xash3D\valve\media\sierra.avi
|
||||||
|
// models\barney.mdl - D:\Xash3D\bshift\models\barney.mdl
|
||||||
|
if( g_fsapi.GetFullDiskPath( result, sizeof( result ), fileName, false ))
|
||||||
|
{
|
||||||
|
// check for enough room
|
||||||
|
if( Q_strlen( result ) > nameOutBufferSize )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
Q_strncpy( nameOutBuffer, result, nameOutBufferSize );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
PlayerInfo_ValueForKey
|
PlayerInfo_ValueForKey
|
||||||
@@ -2702,10 +2807,10 @@ static void GAME_EXPORT PlayerInfo_SetValueForKey( const char *key, const char *
|
|||||||
{
|
{
|
||||||
Cvar_DirectSet( var, value );
|
Cvar_DirectSet( var, value );
|
||||||
}
|
}
|
||||||
else if( Info_SetValueForStarKey( cls.userinfo, key, value, MAX_INFO_STRING ))
|
else if( Info_SetValueForStarKey( cls.userinfo, key, value, sizeof( cls.userinfo )))
|
||||||
{
|
{
|
||||||
// time to update server copy of userinfo
|
// time to update server copy of userinfo
|
||||||
CL_ServerCommand( true, "setinfo \"%s\" \"%s\"\n", key, value );
|
CL_UpdateInfo( key, value );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3197,7 +3302,7 @@ Heavy legacy of Quake...
|
|||||||
*/
|
*/
|
||||||
void TriColor4fRendermode( float r, float g, float b, float a, int rendermode )
|
void TriColor4fRendermode( float r, float g, float b, float a, int rendermode )
|
||||||
{
|
{
|
||||||
if( clgame.ds.renderMode == kRenderTransAlpha )
|
if( rendermode == kRenderTransAlpha )
|
||||||
{
|
{
|
||||||
clgame.ds.triRGBA[3] = a / 255.0f;
|
clgame.ds.triRGBA[3] = a / 255.0f;
|
||||||
ref.dllFuncs.Color4f( r, g, b, a );
|
ref.dllFuncs.Color4f( r, g, b, a );
|
||||||
@@ -3329,16 +3434,15 @@ NetAPI_SendRequest
|
|||||||
static void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags, double timeout, netadr_t *remote_address, net_api_response_func_t response )
|
static void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags, double timeout, netadr_t *remote_address, net_api_response_func_t response )
|
||||||
{
|
{
|
||||||
net_request_t *nr = NULL;
|
net_request_t *nr = NULL;
|
||||||
string req;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( !response )
|
if( !response )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "Net_SendRequest: no callbcak specified for request with context %i!\n", context );
|
Con_DPrintf( S_ERROR "%s: no callbcak specified for request with context %i!\n", __func__, context );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( remote_address->type != NA_IPX && remote_address->type != NA_BROADCAST_IPX )
|
if( remote_address->type == NA_IPX || remote_address->type == NA_BROADCAST_IPX )
|
||||||
return; // IPX no longer support
|
return; // IPX no longer support
|
||||||
|
|
||||||
if( request == NETAPI_REQUEST_SERVERLIST )
|
if( request == NETAPI_REQUEST_SERVERLIST )
|
||||||
@@ -3381,8 +3485,7 @@ static void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags,
|
|||||||
nr->flags = flags;
|
nr->flags = flags;
|
||||||
|
|
||||||
// local servers request
|
// local servers request
|
||||||
Q_snprintf( req, sizeof( req ), "netinfo %i %i %i", PROTOCOL_VERSION, context, request );
|
Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, A2A_NETINFO" %i %i %i", FBitSet( flags, FNETAPI_LEGACY_PROTOCOL ) ? PROTOCOL_LEGACY_VERSION : PROTOCOL_VERSION, context, request );
|
||||||
Netchan_OutOfBandPrint( NS_CLIENT, nr->resp.remote_address, "%s", req );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3686,7 +3789,7 @@ static demo_api_t gDemoApi =
|
|||||||
Demo_WriteBuffer,
|
Demo_WriteBuffer,
|
||||||
};
|
};
|
||||||
|
|
||||||
static net_api_t gNetApi =
|
net_api_t gNetApi =
|
||||||
{
|
{
|
||||||
NetAPI_InitNetworking,
|
NetAPI_InitNetworking,
|
||||||
NetAPI_Status,
|
NetAPI_Status,
|
||||||
@@ -3722,7 +3825,7 @@ static cl_enginefunc_t gEngfuncs =
|
|||||||
pfnSPR_DrawAdditive,
|
pfnSPR_DrawAdditive,
|
||||||
SPR_EnableScissor,
|
SPR_EnableScissor,
|
||||||
SPR_DisableScissor,
|
SPR_DisableScissor,
|
||||||
pfnSPR_GetList,
|
SPR_GetList,
|
||||||
CL_FillRGBA,
|
CL_FillRGBA,
|
||||||
CL_GetScreenInfo,
|
CL_GetScreenInfo,
|
||||||
pfnSetCrosshair,
|
pfnSetCrosshair,
|
||||||
@@ -3944,14 +4047,14 @@ qboolean CL_LoadProgs( const char *name )
|
|||||||
// trying to get single export
|
// trying to get single export
|
||||||
if(( GetClientAPI = (void *)COM_GetProcAddress( clgame.hInstance, "GetClientAPI" )) != NULL )
|
if(( GetClientAPI = (void *)COM_GetProcAddress( clgame.hInstance, "GetClientAPI" )) != NULL )
|
||||||
{
|
{
|
||||||
Con_Reportf( "CL_LoadProgs: found single callback export\n" );
|
Con_Reportf( "%s: found single callback export\n", __func__ );
|
||||||
|
|
||||||
// trying to fill interface now
|
// trying to fill interface now
|
||||||
GetClientAPI( &clgame.dllFuncs );
|
GetClientAPI( &clgame.dllFuncs );
|
||||||
}
|
}
|
||||||
else if(( GetClientAPI = (void *)COM_GetProcAddress( clgame.hInstance, "F" )) != NULL )
|
else if(( GetClientAPI = (void *)COM_GetProcAddress( clgame.hInstance, "F" )) != NULL )
|
||||||
{
|
{
|
||||||
Con_Reportf( "CL_LoadProgs: found single callback export (secured client dlls)\n" );
|
Con_Reportf( "%s: found single callback export (secured client dlls)\n", __func__ );
|
||||||
|
|
||||||
// trying to fill interface now
|
// trying to fill interface now
|
||||||
CL_GetSecuredClientAPI( GetClientAPI );
|
CL_GetSecuredClientAPI( GetClientAPI );
|
||||||
@@ -3979,7 +4082,7 @@ qboolean CL_LoadProgs( const char *name )
|
|||||||
// functions are cleared before all the extensions are evaluated
|
// functions are cleared before all the extensions are evaluated
|
||||||
if(( *func->func = (void *)COM_GetProcAddress( clgame.hInstance, func->name )) == NULL )
|
if(( *func->func = (void *)COM_GetProcAddress( clgame.hInstance, func->name )) == NULL )
|
||||||
{
|
{
|
||||||
Con_Reportf( "CL_LoadProgs: failed to get address of %s proc\n", func->name );
|
Con_Reportf( "%s: failed to get address of %s proc\n", __func__, func->name );
|
||||||
|
|
||||||
if( critical_exports )
|
if( critical_exports )
|
||||||
{
|
{
|
||||||
@@ -4006,13 +4109,13 @@ qboolean CL_LoadProgs( const char *name )
|
|||||||
// functions are cleared before all the extensions are evaluated
|
// functions are cleared before all the extensions are evaluated
|
||||||
// NOTE: new exports can be missed without stop the engine
|
// NOTE: new exports can be missed without stop the engine
|
||||||
if(( *func->func = (void *)COM_GetProcAddress( clgame.hInstance, func->name )) == NULL )
|
if(( *func->func = (void *)COM_GetProcAddress( clgame.hInstance, func->name )) == NULL )
|
||||||
Con_Reportf( "CL_LoadProgs: failed to get address of %s proc\n", func->name );
|
Con_Reportf( "%s: failed to get address of %s proc\n", __func__, func->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !clgame.dllFuncs.pfnInitialize( &gEngfuncs, CLDLL_INTERFACE_VERSION ))
|
if( !clgame.dllFuncs.pfnInitialize( &gEngfuncs, CLDLL_INTERFACE_VERSION ))
|
||||||
{
|
{
|
||||||
COM_FreeLibrary( clgame.hInstance );
|
COM_FreeLibrary( clgame.hInstance );
|
||||||
Con_Reportf( "CL_LoadProgs: can't init client API\n" );
|
Con_Reportf( "%s: can't init client API\n", __func__ );
|
||||||
clgame.hInstance = NULL;
|
clgame.hInstance = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -4029,10 +4132,10 @@ qboolean CL_LoadProgs( const char *name )
|
|||||||
CL_InitTempEnts ();
|
CL_InitTempEnts ();
|
||||||
|
|
||||||
if( !R_InitRenderAPI()) // Xash3D extension
|
if( !R_InitRenderAPI()) // Xash3D extension
|
||||||
Con_Reportf( S_WARN "CL_LoadProgs: couldn't get render API\n" );
|
Con_Reportf( S_WARN "%s: couldn't get render API\n", __func__ );
|
||||||
|
|
||||||
if( !Mobile_Init() ) // Xash3D FWGS extension: mobile interface
|
if( !Mobile_Init() ) // Xash3D FWGS extension: mobile interface
|
||||||
Con_Reportf( S_WARN "CL_LoadProgs: couldn't get mobility API\n" );
|
Con_Reportf( S_WARN "%s: couldn't get mobility API\n", __func__ );
|
||||||
|
|
||||||
CL_InitEdicts( cl.maxclients ); // initailize local player and world
|
CL_InitEdicts( cl.maxclients ); // initailize local player and world
|
||||||
CL_InitClientMove(); // initialize pm_shared
|
CL_InitClientMove(); // initialize pm_shared
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ static void UI_UpdateUserinfo( void );
|
|||||||
|
|
||||||
gameui_static_t gameui;
|
gameui_static_t gameui;
|
||||||
|
|
||||||
|
static void UI_ToggleAllowConsole_f( void )
|
||||||
|
{
|
||||||
|
host.allow_console = host.allow_console_init = true;
|
||||||
|
|
||||||
|
if( gameui.globals )
|
||||||
|
gameui.globals->developer = true;
|
||||||
|
}
|
||||||
|
|
||||||
void UI_UpdateMenu( float realtime )
|
void UI_UpdateMenu( float realtime )
|
||||||
{
|
{
|
||||||
if( !gameui.hInstance ) return;
|
if( !gameui.hInstance ) return;
|
||||||
@@ -216,12 +224,14 @@ UI_ShowConnectionWarning
|
|||||||
show message box
|
show message box
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void UI_ShowMessageBox( const char *text )
|
qboolean UI_ShowMessageBox( const char *text )
|
||||||
{
|
{
|
||||||
if( gameui.dllFuncs2.pfnShowMessageBox )
|
if( gameui.dllFuncs2.pfnShowMessageBox )
|
||||||
{
|
{
|
||||||
gameui.dllFuncs2.pfnShowMessageBox( text );
|
gameui.dllFuncs2.pfnShowMessageBox( text );
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UI_ConnectionProgress_Disconnect( void )
|
void UI_ConnectionProgress_Disconnect( void )
|
||||||
@@ -397,17 +407,21 @@ void Host_Credits( void )
|
|||||||
gameui.dllFuncs.pfnFinalCredits();
|
gameui.dllFuncs.pfnFinalCredits();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
|
static void UI_ConvertGameInfo( gameinfo2_t *out, const gameinfo_t *in )
|
||||||
{
|
{
|
||||||
|
out->gi_version = GAMEINFO_VERSION;
|
||||||
|
|
||||||
Q_strncpy( out->gamefolder, in->gamefolder, sizeof( out->gamefolder ));
|
Q_strncpy( out->gamefolder, in->gamefolder, sizeof( out->gamefolder ));
|
||||||
Q_strncpy( out->startmap, in->startmap, sizeof( out->startmap ));
|
Q_strncpy( out->startmap, in->startmap, sizeof( out->startmap ));
|
||||||
Q_strncpy( out->trainmap, in->trainmap, sizeof( out->trainmap ));
|
Q_strncpy( out->trainmap, in->trainmap, sizeof( out->trainmap ));
|
||||||
|
Q_strncpy( out->demomap, in->demomap, sizeof( out->demomap ));
|
||||||
Q_strncpy( out->title, in->title, sizeof( out->title ));
|
Q_strncpy( out->title, in->title, sizeof( out->title ));
|
||||||
Q_snprintf( out->version, sizeof( out->version ), "%g", in->version );
|
Q_snprintf( out->version, sizeof( out->version ), "%g", in->version );
|
||||||
|
Q_strncpy( out->iconpath, in->iconpath, sizeof( out->iconpath ));
|
||||||
|
|
||||||
Q_strncpy( out->game_url, in->game_url, sizeof( out->game_url ));
|
Q_strncpy( out->game_url, in->game_url, sizeof( out->game_url ));
|
||||||
Q_strncpy( out->update_url, in->update_url, sizeof( out->update_url ));
|
Q_strncpy( out->update_url, in->update_url, sizeof( out->update_url ));
|
||||||
Q_strncpy( out->size, Q_pretifymem( in->size, 0 ), sizeof( out->size ));
|
out->size = in->size;
|
||||||
Q_strncpy( out->type, in->type, sizeof( out->type ));
|
Q_strncpy( out->type, in->type, sizeof( out->type ));
|
||||||
Q_strncpy( out->date, in->date, sizeof( out->date ));
|
Q_strncpy( out->date, in->date, sizeof( out->date ));
|
||||||
|
|
||||||
@@ -425,6 +439,31 @@ static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
|
|||||||
SetBits( out->flags, GFL_ANIMATED_TITLE );
|
SetBits( out->flags, GFL_ANIMATED_TITLE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void UI_ToOldGameInfo( GAMEINFO *out, const gameinfo2_t *in )
|
||||||
|
{
|
||||||
|
Q_strncpy( out->gamefolder, in->gamefolder, sizeof( out->gamefolder ));
|
||||||
|
Q_strncpy( out->startmap, in->startmap, sizeof( out->startmap ));
|
||||||
|
Q_strncpy( out->trainmap, in->trainmap, sizeof( out->trainmap ));
|
||||||
|
Q_strncpy( out->title, in->title, sizeof( out->title ));
|
||||||
|
Q_strncpy( out->version, in->version, sizeof( out->version ));
|
||||||
|
out->flags = in->flags & 0xFFFF;
|
||||||
|
Q_strncpy( out->game_url, in->game_url, sizeof( out->game_url ));
|
||||||
|
Q_strncpy( out->update_url, in->update_url, sizeof( out->update_url ));
|
||||||
|
Q_strncpy( out->size, Q_memprint( in->size ), sizeof( out->size ));
|
||||||
|
Q_strncpy( out->type, in->type, sizeof( out->type ));
|
||||||
|
Q_strncpy( out->date, in->date, sizeof( out->date ));
|
||||||
|
out->gamemode = in->gamemode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void UI_GetModsInfo( void )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
gameui.modsInfo = Mem_Calloc( gameui.mempool, sizeof( *gameui.modsInfo ) * FI->numgames );
|
||||||
|
for( i = 0; i < FI->numgames; i++ )
|
||||||
|
UI_ConvertGameInfo( &gameui.modsInfo[i], FI->games[i] );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
PIC_DrawGeneric
|
PIC_DrawGeneric
|
||||||
@@ -492,7 +531,7 @@ static HIMAGE GAME_EXPORT pfnPIC_Load( const char *szPicName, const byte *image_
|
|||||||
|
|
||||||
if( !COM_CheckString( szPicName ))
|
if( !COM_CheckString( szPicName ))
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "CL_LoadImage: refusing to load image with empty name\n" );
|
Con_Reportf( S_ERROR "%s: refusing to load image with empty name\n", __func__ );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,7 +581,7 @@ pfnPIC_Set
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
static void GAME_EXPORT pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||||
{
|
{
|
||||||
gameui.ds.gl_texturenum = hPic;
|
gameui.ds.gl_texturenum = hPic;
|
||||||
r = bound( 0, r, 255 );
|
r = bound( 0, r, 255 );
|
||||||
@@ -558,7 +597,7 @@ pfnPIC_Draw
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
static void GAME_EXPORT pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
PIC_DrawGeneric( x, y, width, height, prc );
|
||||||
@@ -570,7 +609,7 @@ pfnPIC_DrawTrans
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
static void GAME_EXPORT pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
PIC_DrawGeneric( x, y, width, height, prc );
|
||||||
@@ -582,7 +621,7 @@ pfnPIC_DrawHoles
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
static void GAME_EXPORT pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
PIC_DrawGeneric( x, y, width, height, prc );
|
||||||
@@ -594,7 +633,7 @@ pfnPIC_DrawAdditive
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
static void GAME_EXPORT pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||||
PIC_DrawGeneric( x, y, width, height, prc );
|
PIC_DrawGeneric( x, y, width, height, prc );
|
||||||
@@ -922,11 +961,12 @@ pfnGetGameInfo
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int GAME_EXPORT pfnGetGameInfo( GAMEINFO *pgameinfo )
|
static int GAME_EXPORT pfnGetOldGameInfo( GAMEINFO *pgameinfo )
|
||||||
{
|
{
|
||||||
if( !pgameinfo ) return 0;
|
if( !pgameinfo )
|
||||||
|
return 0;
|
||||||
|
|
||||||
*pgameinfo = gameui.gameInfo;
|
UI_ToOldGameInfo( pgameinfo, &gameui.gameInfo );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -938,8 +978,26 @@ pfnGetGamesList
|
|||||||
*/
|
*/
|
||||||
static GAMEINFO ** GAME_EXPORT pfnGetGamesList( int *numGames )
|
static GAMEINFO ** GAME_EXPORT pfnGetGamesList( int *numGames )
|
||||||
{
|
{
|
||||||
if( numGames ) *numGames = FI->numgames;
|
if( numGames )
|
||||||
return gameui.modsInfo;
|
*numGames = FI->numgames;
|
||||||
|
|
||||||
|
if( !gameui.oldModsInfo )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( !gameui.modsInfo )
|
||||||
|
UI_GetModsInfo();
|
||||||
|
|
||||||
|
// first allocate array of pointers
|
||||||
|
gameui.oldModsInfo = Mem_Calloc( gameui.mempool, sizeof( *gameui.oldModsInfo ) * FI->numgames );
|
||||||
|
for( i = 0; i < FI->numgames; i++ )
|
||||||
|
{
|
||||||
|
gameui.oldModsInfo[i] = Mem_Calloc( gameui.mempool, sizeof( *gameui.oldModsInfo[i] ));
|
||||||
|
UI_ToOldGameInfo( gameui.oldModsInfo[i], &gameui.modsInfo[i] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return gameui.oldModsInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -984,7 +1042,7 @@ pfnCheckGameDll
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
int GAME_EXPORT pfnCheckGameDll( void )
|
static int GAME_EXPORT pfnCheckGameDll( void )
|
||||||
{
|
{
|
||||||
#ifdef XASH_INTERNAL_GAMELIBS
|
#ifdef XASH_INTERNAL_GAMELIBS
|
||||||
return true;
|
return true;
|
||||||
@@ -1011,7 +1069,7 @@ pfnChangeInstance
|
|||||||
*/
|
*/
|
||||||
static void GAME_EXPORT pfnChangeInstance( const char *newInstance, const char *szFinalMessage )
|
static void GAME_EXPORT pfnChangeInstance( const char *newInstance, const char *szFinalMessage )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "ChangeInstance menu call is deprecated!\n" );
|
Con_Reportf( S_ERROR "%s menu call is deprecated!\n", __func__ );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1092,8 +1150,27 @@ static int pfnDelete( const char *path )
|
|||||||
return FS_Delete( path );
|
return FS_Delete( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT pfnCon_DefaultColor( int r, int g, int b )
|
||||||
|
{
|
||||||
|
Con_DefaultColor( r, g, b, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT pfnSetCursor( void *hCursor )
|
||||||
|
{
|
||||||
|
uintptr_t cursor;
|
||||||
|
|
||||||
|
if( !gameui.use_extended_api )
|
||||||
|
return; // ignore original Xash menus
|
||||||
|
|
||||||
|
cursor = (uintptr_t)hCursor;
|
||||||
|
if( cursor < dc_user || cursor > dc_last )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Platform_SetCursorType( cursor );
|
||||||
|
}
|
||||||
|
|
||||||
// engine callbacks
|
// engine callbacks
|
||||||
static ui_enginefuncs_t gEngfuncs =
|
static const ui_enginefuncs_t gEngfuncs =
|
||||||
{
|
{
|
||||||
pfnPIC_Load,
|
pfnPIC_Load,
|
||||||
GL_FreeImage,
|
GL_FreeImage,
|
||||||
@@ -1131,7 +1208,7 @@ static ui_enginefuncs_t gEngfuncs =
|
|||||||
UI_DrawConsoleString,
|
UI_DrawConsoleString,
|
||||||
UI_DrawSetTextColor,
|
UI_DrawSetTextColor,
|
||||||
Con_DrawStringLen,
|
Con_DrawStringLen,
|
||||||
Con_DefaultColor,
|
pfnCon_DefaultColor,
|
||||||
pfnGetPlayerModel,
|
pfnGetPlayerModel,
|
||||||
pfnSetPlayerModel,
|
pfnSetPlayerModel,
|
||||||
pfnClearScene,
|
pfnClearScene,
|
||||||
@@ -1157,7 +1234,7 @@ static ui_enginefuncs_t gEngfuncs =
|
|||||||
pfnKeyGetState,
|
pfnKeyGetState,
|
||||||
pfnMemAlloc,
|
pfnMemAlloc,
|
||||||
pfnMemFree,
|
pfnMemFree,
|
||||||
pfnGetGameInfo,
|
pfnGetOldGameInfo,
|
||||||
pfnGetGamesList,
|
pfnGetGamesList,
|
||||||
pfnGetFilesList,
|
pfnGetFilesList,
|
||||||
SV_GetSaveComment,
|
SV_GetSaveComment,
|
||||||
@@ -1171,7 +1248,7 @@ static ui_enginefuncs_t gEngfuncs =
|
|||||||
pfnHostEndGame,
|
pfnHostEndGame,
|
||||||
COM_RandomFloat,
|
COM_RandomFloat,
|
||||||
COM_RandomLong,
|
COM_RandomLong,
|
||||||
IN_SetCursor,
|
pfnSetCursor,
|
||||||
pfnIsMapValid,
|
pfnIsMapValid,
|
||||||
GL_ProcessTexture,
|
GL_ProcessTexture,
|
||||||
COM_CompareFileTime,
|
COM_CompareFileTime,
|
||||||
@@ -1204,6 +1281,38 @@ static char *pfnParseFileSafe( char *data, char *buf, const int size, unsigned i
|
|||||||
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gameinfo2_t *pfnGetGameInfo( int gi_version )
|
||||||
|
{
|
||||||
|
if( gi_version != gameui.gameInfo.gi_version )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &gameui.gameInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gameinfo2_t *pfnGetModInfo( int gi_version, int i )
|
||||||
|
{
|
||||||
|
if( i < 0 || i >= FI->numgames )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if( !gameui.modsInfo )
|
||||||
|
UI_GetModsInfo();
|
||||||
|
|
||||||
|
if( gi_version != gameui.modsInfo[i].gi_version )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &gameui.modsInfo[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
static int pfnIsCvarReadOnly( const char *name )
|
||||||
|
{
|
||||||
|
convar_t *cv = Cvar_FindVar( name );
|
||||||
|
|
||||||
|
if( !cv )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return FBitSet( cv->flags, FCVAR_READ_ONLY ) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
static ui_extendedfuncs_t gExtendedfuncs =
|
static ui_extendedfuncs_t gExtendedfuncs =
|
||||||
{
|
{
|
||||||
pfnEnableTextInput,
|
pfnEnableTextInput,
|
||||||
@@ -1215,6 +1324,11 @@ static ui_extendedfuncs_t gExtendedfuncs =
|
|||||||
pfnParseFileSafe,
|
pfnParseFileSafe,
|
||||||
NET_AdrToString,
|
NET_AdrToString,
|
||||||
NET_CompareAdrSort,
|
NET_CompareAdrSort,
|
||||||
|
Sys_GetNativeObject,
|
||||||
|
&gNetApi,
|
||||||
|
pfnGetGameInfo,
|
||||||
|
pfnGetModInfo,
|
||||||
|
pfnIsCvarReadOnly,
|
||||||
};
|
};
|
||||||
|
|
||||||
void UI_UnloadProgs( void )
|
void UI_UnloadProgs( void )
|
||||||
@@ -1224,6 +1338,7 @@ void UI_UnloadProgs( void )
|
|||||||
// deinitialize game
|
// deinitialize game
|
||||||
gameui.dllFuncs.pfnShutdown();
|
gameui.dllFuncs.pfnShutdown();
|
||||||
|
|
||||||
|
Cmd_RemoveCommand( "ui_allowconsole" );
|
||||||
Cvar_FullSet( "host_gameuiloaded", "0", FCVAR_READ_ONLY );
|
Cvar_FullSet( "host_gameuiloaded", "0", FCVAR_READ_ONLY );
|
||||||
|
|
||||||
Cvar_Unlink( FCVAR_GAMEUIDLL );
|
Cvar_Unlink( FCVAR_GAMEUIDLL );
|
||||||
@@ -1274,71 +1389,65 @@ qboolean UI_LoadProgs( void )
|
|||||||
if(( GetMenuAPI = (MENUAPI)COM_GetProcAddress( gameui.hInstance, "GetMenuAPI" )) == NULL )
|
if(( GetMenuAPI = (MENUAPI)COM_GetProcAddress( gameui.hInstance, "GetMenuAPI" )) == NULL )
|
||||||
{
|
{
|
||||||
COM_FreeLibrary( gameui.hInstance );
|
COM_FreeLibrary( gameui.hInstance );
|
||||||
Con_Reportf( "UI_LoadProgs: can't init menu API\n" );
|
Con_Reportf( "%s: can't init menu API\n", __func__ );
|
||||||
gameui.hInstance = NULL;
|
gameui.hInstance = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gameui.use_text_api = false;
|
gameui.use_extended_api = false;
|
||||||
|
|
||||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||||
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
gpEngfuncs = gEngfuncs;
|
||||||
|
|
||||||
gameui.mempool = Mem_AllocPool( "Menu Pool" );
|
gameui.mempool = Mem_AllocPool( "Menu Pool" );
|
||||||
|
|
||||||
if( !GetMenuAPI( &gameui.dllFuncs, &gpEngfuncs, gameui.globals ))
|
if( !GetMenuAPI( &gameui.dllFuncs, &gpEngfuncs, gameui.globals ))
|
||||||
{
|
{
|
||||||
COM_FreeLibrary( gameui.hInstance );
|
COM_FreeLibrary( gameui.hInstance );
|
||||||
Con_Reportf( "UI_LoadProgs: can't init menu API\n" );
|
Con_Reportf( "%s: can't init menu API\n", __func__ );
|
||||||
Mem_FreePool( &gameui.mempool );
|
Mem_FreePool( &gameui.mempool );
|
||||||
gameui.hInstance = NULL;
|
gameui.hInstance = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||||
memcpy( &gpExtendedfuncs, &gExtendedfuncs, sizeof( gExtendedfuncs ));
|
gpExtendedfuncs = gExtendedfuncs;
|
||||||
memset( &gameui.dllFuncs2, 0, sizeof( gameui.dllFuncs2 ));
|
memset( &gameui.dllFuncs2, 0, sizeof( gameui.dllFuncs2 ));
|
||||||
|
|
||||||
// try to initialize new extended API
|
// try to initialize new extended API
|
||||||
if( ( GetExtAPI = (UIEXTENEDEDAPI)COM_GetProcAddress( gameui.hInstance, "GetExtAPI" ) ) )
|
if( ( GetExtAPI = (UIEXTENEDEDAPI)COM_GetProcAddress( gameui.hInstance, "GetExtAPI" ) ) )
|
||||||
{
|
{
|
||||||
Con_Reportf( "UI_LoadProgs: extended Menu API found\n" );
|
Con_Reportf( "%s: extended Menu API found\n", __func__ );
|
||||||
if( GetExtAPI( MENU_EXTENDED_API_VERSION, &gameui.dllFuncs2, &gpExtendedfuncs ) )
|
if( GetExtAPI( MENU_EXTENDED_API_VERSION, &gameui.dllFuncs2, &gpExtendedfuncs ) )
|
||||||
{
|
{
|
||||||
Con_Reportf( "UI_LoadProgs: extended Menu API initialized\n" );
|
Con_Reportf( "%s: extended Menu API initialized\n", __func__ );
|
||||||
gameui.use_text_api = true;
|
gameui.use_extended_api = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // otherwise, fallback to old and deprecated extensions
|
else // otherwise, fallback to old and deprecated extensions
|
||||||
{
|
{
|
||||||
if( ( GiveTextApi = (UITEXTAPI)COM_GetProcAddress( gameui.hInstance, "GiveTextAPI" ) ) )
|
if( ( GiveTextApi = (UITEXTAPI)COM_GetProcAddress( gameui.hInstance, "GiveTextAPI" ) ) )
|
||||||
{
|
{
|
||||||
Con_Reportf( "UI_LoadProgs: extended text API found\n" );
|
Con_Reportf( "%s: extended text API found\n", __func__ );
|
||||||
Con_Reportf( S_WARN "Text API is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
|
Con_Reportf( S_WARN "Text API is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
|
||||||
if( GiveTextApi( &gpExtendedfuncs ) ) // they are binary compatible, so we can just pass extended funcs API to menu
|
if( GiveTextApi( &gpExtendedfuncs ) ) // they are binary compatible, so we can just pass extended funcs API to menu
|
||||||
{
|
{
|
||||||
Con_Reportf( "UI_LoadProgs: extended text API initialized\n" );
|
Con_Reportf( "%s: extended text API initialized\n", __func__ );
|
||||||
gameui.use_text_api = true;
|
gameui.use_extended_api = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gameui.dllFuncs2.pfnAddTouchButtonToList = (ADDTOUCHBUTTONTOLIST)COM_GetProcAddress( gameui.hInstance, "AddTouchButtonToList" );
|
gameui.dllFuncs2.pfnAddTouchButtonToList = (ADDTOUCHBUTTONTOLIST)COM_GetProcAddress( gameui.hInstance, "AddTouchButtonToList" );
|
||||||
if( gameui.dllFuncs2.pfnAddTouchButtonToList )
|
if( gameui.dllFuncs2.pfnAddTouchButtonToList )
|
||||||
{
|
{
|
||||||
Con_Reportf( "UI_LoadProgs: AddTouchButtonToList call found\n" );
|
Con_Reportf( "%s: AddTouchButtonToList call found\n", __func__ );
|
||||||
Con_Reportf( S_WARN "AddTouchButtonToList is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
|
Con_Reportf( S_WARN "AddTouchButtonToList is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cvar_FullSet( "host_gameuiloaded", "1", FCVAR_READ_ONLY );
|
Cvar_FullSet( "host_gameuiloaded", "1", FCVAR_READ_ONLY );
|
||||||
|
Cmd_AddRestrictedCommand( "ui_allowconsole", UI_ToggleAllowConsole_f, "unlocks developer console" );
|
||||||
// setup gameinfo
|
|
||||||
for( i = 0; i < FI->numgames; i++ )
|
|
||||||
{
|
|
||||||
gameui.modsInfo[i] = Mem_Calloc( gameui.mempool, sizeof( GAMEINFO ));
|
|
||||||
UI_ConvertGameInfo( gameui.modsInfo[i], FI->games[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
UI_ConvertGameInfo( &gameui.gameInfo, FI->GameInfo ); // current gameinfo
|
UI_ConvertGameInfo( &gameui.gameInfo, FI->GameInfo ); // current gameinfo
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -20,8 +20,6 @@ GNU General Public License for more details.
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
static mobile_engfuncs_t *gMobileEngfuncs;
|
|
||||||
|
|
||||||
static CVAR_DEFINE_AUTO( vibration_length, "1.0", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "vibration length" );
|
static CVAR_DEFINE_AUTO( vibration_length, "1.0", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "vibration length" );
|
||||||
static CVAR_DEFINE_AUTO( vibration_enable, "1", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "enable vibration" );
|
static CVAR_DEFINE_AUTO( vibration_enable, "1", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "enable vibration" );
|
||||||
|
|
||||||
@@ -30,17 +28,9 @@ static float g_font_scale;
|
|||||||
|
|
||||||
static void pfnVibrate( float life, char flags )
|
static void pfnVibrate( float life, char flags )
|
||||||
{
|
{
|
||||||
if( !vibration_enable.value )
|
if( !vibration_enable.value || life < 0.0f )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( life < 0.0f )
|
|
||||||
{
|
|
||||||
Con_Reportf( S_WARN "Negative vibrate time: %f\n", life );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Con_Reportf( "Vibrate: %f %d\n", life, flags );
|
|
||||||
|
|
||||||
// here goes platform-specific backends
|
// here goes platform-specific backends
|
||||||
Platform_Vibrate( life * vibration_length.value, flags );
|
Platform_Vibrate( life * vibration_length.value, flags );
|
||||||
}
|
}
|
||||||
@@ -102,7 +92,7 @@ static char *pfnParseFileSafe( char *data, char *buf, const int size, unsigned i
|
|||||||
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
return COM_ParseFileSafe( data, buf, size, flags, len, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static mobile_engfuncs_t gpMobileEngfuncs =
|
static const mobile_engfuncs_t gMobileEngfuncs =
|
||||||
{
|
{
|
||||||
MOBILITY_API_VERSION,
|
MOBILITY_API_VERSION,
|
||||||
pfnVibrate,
|
pfnVibrate,
|
||||||
@@ -122,21 +112,38 @@ static mobile_engfuncs_t gpMobileEngfuncs =
|
|||||||
|
|
||||||
qboolean Mobile_Init( void )
|
qboolean Mobile_Init( void )
|
||||||
{
|
{
|
||||||
qboolean success = false;
|
|
||||||
pfnMobilityInterface ExportToClient;
|
pfnMobilityInterface ExportToClient;
|
||||||
|
|
||||||
// find a mobility interface
|
Cmd_AddCommand( "vibrate", Vibrate_f, "Vibrate for specified time");
|
||||||
ExportToClient = COM_GetProcAddress( clgame.hInstance, MOBILITY_CLIENT_EXPORT );
|
|
||||||
gMobileEngfuncs = &gpMobileEngfuncs;
|
|
||||||
|
|
||||||
if( ExportToClient && !ExportToClient( gMobileEngfuncs ) )
|
|
||||||
success = true;
|
|
||||||
|
|
||||||
Cmd_AddCommand( "vibrate", (xcommand_t)Vibrate_f, "Vibrate for specified time");
|
|
||||||
Cvar_RegisterVariable( &vibration_length );
|
Cvar_RegisterVariable( &vibration_length );
|
||||||
Cvar_RegisterVariable( &vibration_enable );
|
Cvar_RegisterVariable( &vibration_enable );
|
||||||
|
|
||||||
return success;
|
// find mobility interface
|
||||||
|
if(( ExportToClient = COM_GetProcAddress( clgame.hInstance, MOBILITY_CLIENT_EXPORT )))
|
||||||
|
{
|
||||||
|
static mobile_engfuncs_t mobile_engfuncs; // keep a copy, don't let user change engine pointers
|
||||||
|
|
||||||
|
mobile_engfuncs = gMobileEngfuncs;
|
||||||
|
|
||||||
|
if( !ExportToClient( &mobile_engfuncs ))
|
||||||
|
{
|
||||||
|
Con_Reportf( "%s: ^2initailized extended MobilityAPI ^7ver. %i\n", __func__, MOBILITY_API_VERSION );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure that mobile functions are cleared
|
||||||
|
#if 1
|
||||||
|
// some SDKs define export as returning void, breaking the contract
|
||||||
|
// ignore result for now...
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
memset( &mobile_engfuncs, 0, sizeof( mobile_engfuncs ));
|
||||||
|
|
||||||
|
return false; // just tell user about problems
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return true; // mobile interface is missed
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mobile_Shutdown( void )
|
void Mobile_Shutdown( void )
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ static byte netcolors[NETGRAPH_NET_COLORS+NETGRAPH_LERP_HEIGHT][4] =
|
|||||||
// other will be generated through NetGraph_InitColors()
|
// other will be generated through NetGraph_InitColors()
|
||||||
};
|
};
|
||||||
|
|
||||||
static byte sendcolor[4] = { 88, 29, 130, 255 };
|
static const byte sendcolor[4] = { 88, 29, 130, 255 };
|
||||||
static byte holdcolor[4] = { 255, 0, 0, 200 };
|
static const byte holdcolor[4] = { 255, 0, 0, 200 };
|
||||||
static byte extrap_base_color[4] = { 255, 255, 255, 255 };
|
static const byte extrap_base_color[4] = { 255, 255, 255, 255 };
|
||||||
static netbandwidthgraph_t netstat_graph[NET_TIMINGS];
|
static netbandwidthgraph_t netstat_graph[NET_TIMINGS];
|
||||||
static float packet_loss;
|
static float packet_loss;
|
||||||
static float packet_choke;
|
static float packet_choke;
|
||||||
@@ -79,7 +79,7 @@ NetGraph_DrawRect
|
|||||||
NetGraph_FillRGBA shortcut
|
NetGraph_FillRGBA shortcut
|
||||||
==========
|
==========
|
||||||
*/
|
*/
|
||||||
static void NetGraph_DrawRect( wrect_t *rect, byte colors[4] )
|
static void NetGraph_DrawRect( const wrect_t *rect, const byte colors[4] )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.Color4ub( colors[0], colors[1], colors[2], colors[3] ); // color for this quad
|
ref.dllFuncs.Color4ub( colors[0], colors[1], colors[2], colors[3] ); // color for this quad
|
||||||
|
|
||||||
@@ -387,7 +387,7 @@ static void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int coun
|
|||||||
// move rolling average
|
// move rolling average
|
||||||
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
||||||
|
|
||||||
ref.dllFuncs.GL_SetRenderMode( font->rendermode );
|
CL_SetFontRendermode( font );
|
||||||
|
|
||||||
if( framerate > 0.0f )
|
if( framerate > 0.0f )
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@ CL_ParseStaticEntity
|
|||||||
static client entity
|
static client entity
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
static void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
entity_state_t state;
|
entity_state_t state;
|
||||||
@@ -98,7 +98,7 @@ void CL_LegacyParseStaticEntity( sizebuf_t *msg )
|
|||||||
R_AddEfrags( ent ); // add link
|
R_AddEfrags( ent ); // add link
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_LegacyParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
|
static void CL_LegacyParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
|
||||||
{
|
{
|
||||||
vec3_t pos;
|
vec3_t pos;
|
||||||
int chan, sound;
|
int chan, sound;
|
||||||
@@ -137,12 +137,7 @@ void CL_LegacyParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
|
|||||||
if( FBitSet( flags, SND_SENTENCE ))
|
if( FBitSet( flags, SND_SENTENCE ))
|
||||||
{
|
{
|
||||||
char sentenceName[32];
|
char sentenceName[32];
|
||||||
|
|
||||||
//if( FBitSet( flags, SND_SEQUENCE ))
|
|
||||||
//Q_snprintf( sentenceName, sizeof( sentenceName ), "!#%i", sound + MAX_SOUNDS );
|
|
||||||
//else
|
|
||||||
Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound );
|
Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound );
|
||||||
|
|
||||||
handle = S_RegisterSound( sentenceName );
|
handle = S_RegisterSound( sentenceName );
|
||||||
}
|
}
|
||||||
else handle = cl.sound_index[sound]; // see precached sound
|
else handle = cl.sound_index[sound]; // see precached sound
|
||||||
@@ -167,14 +162,14 @@ CL_PrecacheSound
|
|||||||
prceache sound from server
|
prceache sound from server
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
static void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int soundIndex;
|
int soundIndex;
|
||||||
|
|
||||||
soundIndex = MSG_ReadUBitLong( msg, MAX_SOUND_BITS );
|
soundIndex = MSG_ReadUBitLong( msg, MAX_SOUND_BITS );
|
||||||
|
|
||||||
if( soundIndex < 0 || soundIndex >= MAX_SOUNDS )
|
if( soundIndex < 0 || soundIndex >= MAX_SOUNDS )
|
||||||
Host_Error( "CL_PrecacheSound: bad soundindex %i\n", soundIndex );
|
Host_Error( "%s: bad soundindex %i\n", __func__, soundIndex );
|
||||||
|
|
||||||
Q_strncpy( cl.sound_precache[soundIndex], MSG_ReadString( msg ), sizeof( cl.sound_precache[0] ));
|
Q_strncpy( cl.sound_precache[soundIndex], MSG_ReadString( msg ), sizeof( cl.sound_precache[0] ));
|
||||||
|
|
||||||
@@ -184,7 +179,7 @@ void CL_LegacyPrecacheSound( sizebuf_t *msg )
|
|||||||
cl.sound_index[soundIndex] = S_RegisterSound( cl.sound_precache[soundIndex] );
|
cl.sound_index[soundIndex] = S_RegisterSound( cl.sound_precache[soundIndex] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
static void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int modelIndex;
|
int modelIndex;
|
||||||
string model;
|
string model;
|
||||||
@@ -192,9 +187,9 @@ void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
|||||||
modelIndex = MSG_ReadUBitLong( msg, MAX_LEGACY_MODEL_BITS );
|
modelIndex = MSG_ReadUBitLong( msg, MAX_LEGACY_MODEL_BITS );
|
||||||
|
|
||||||
if( modelIndex < 0 || modelIndex >= MAX_MODELS )
|
if( modelIndex < 0 || modelIndex >= MAX_MODELS )
|
||||||
Host_Error( "CL_PrecacheModel: bad modelindex %i\n", modelIndex );
|
Host_Error( "%s: bad modelindex %i\n", __func__, modelIndex );
|
||||||
|
|
||||||
Q_strncpy( model, MSG_ReadString( msg ), MAX_STRING );
|
Q_strncpy( model, MSG_ReadString( msg ), sizeof( model ));
|
||||||
//Q_strncpy( cl.model_precache[modelIndex], BF_ReadString( msg ), sizeof( cl.model_precache[0] ));
|
//Q_strncpy( cl.model_precache[modelIndex], BF_ReadString( msg ), sizeof( cl.model_precache[0] ));
|
||||||
|
|
||||||
// when we loading map all resources is precached sequentially
|
// when we loading map all resources is precached sequentially
|
||||||
@@ -214,14 +209,14 @@ void CL_LegacyPrecacheModel( sizebuf_t *msg )
|
|||||||
cl.nummodels = Q_max( cl.nummodels, modelIndex );
|
cl.nummodels = Q_max( cl.nummodels, modelIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_LegacyPrecacheEvent( sizebuf_t *msg )
|
static void CL_LegacyPrecacheEvent( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int eventIndex;
|
int eventIndex;
|
||||||
|
|
||||||
eventIndex = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
eventIndex = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||||
|
|
||||||
if( eventIndex < 0 || eventIndex >= MAX_EVENTS )
|
if( eventIndex < 0 || eventIndex >= MAX_EVENTS )
|
||||||
Host_Error( "CL_PrecacheEvent: bad eventindex %i\n", eventIndex );
|
Host_Error( "%s: bad eventindex %i\n", __func__, eventIndex );
|
||||||
|
|
||||||
Q_strncpy( cl.event_precache[eventIndex], MSG_ReadString( msg ), sizeof( cl.event_precache[0] ));
|
Q_strncpy( cl.event_precache[eventIndex], MSG_ReadString( msg ), sizeof( cl.event_precache[0] ));
|
||||||
|
|
||||||
@@ -242,7 +237,7 @@ CL_ParseResourceList
|
|||||||
|
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_LegacyParseResourceList( sizebuf_t *msg )
|
static void CL_LegacyParseResourceList( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static struct
|
static struct
|
||||||
@@ -261,15 +256,15 @@ void CL_LegacyParseResourceList( sizebuf_t *msg )
|
|||||||
for( i = 0; i < reslist.rescount; i++ )
|
for( i = 0; i < reslist.rescount; i++ )
|
||||||
{
|
{
|
||||||
reslist.restype[i] = MSG_ReadWord( msg );
|
reslist.restype[i] = MSG_ReadWord( msg );
|
||||||
Q_strncpy( reslist.resnames[i], MSG_ReadString( msg ), MAX_QPATH );
|
Q_strncpy( reslist.resnames[i], MSG_ReadString( msg ), sizeof( reslist.resnames[i] ));
|
||||||
}
|
}
|
||||||
|
|
||||||
if( CL_IsPlaybackDemo() )
|
if( cls.demoplayback )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !cl_allow_download.value )
|
if( !cl_allow_download.value )
|
||||||
{
|
{
|
||||||
Con_DPrintf( "Refusing new resource, cl_allow_download set to 0\n" );
|
Con_DPrintf( "Refusing new resource, cl_allowdownload set to 0\n" );
|
||||||
reslist.rescount = 0;
|
reslist.rescount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,7 +295,7 @@ void CL_LegacyParseResourceList( sizebuf_t *msg )
|
|||||||
continue; // already exists
|
continue; // already exists
|
||||||
|
|
||||||
host.downloadcount++;
|
host.downloadcount++;
|
||||||
HTTP_AddDownload( path, -1, true );
|
HTTP_AddDownload( path, -1, true, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !host.downloadcount )
|
if( !host.downloadcount )
|
||||||
@@ -317,36 +312,19 @@ CL_ParseLegacyServerMessage
|
|||||||
dispatch messages
|
dispatch messages
|
||||||
=====================
|
=====================
|
||||||
*/
|
*/
|
||||||
void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
void CL_ParseLegacyServerMessage( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
size_t bufStart, playerbytes;
|
size_t bufStart, playerbytes;
|
||||||
int cmd, param1, param2;
|
int cmd;
|
||||||
int old_background;
|
int old_background;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
cls.starting_count = MSG_GetNumBytesRead( msg ); // updates each frame
|
|
||||||
CL_Parse_Debug( true ); // begin parsing
|
|
||||||
|
|
||||||
if( normal_message )
|
|
||||||
{
|
|
||||||
// assume no entity/player update this packet
|
|
||||||
if( cls.state == ca_active )
|
|
||||||
{
|
|
||||||
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].valid = false;
|
|
||||||
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CL_ResetFrame( &cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse the message
|
// parse the message
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
if( MSG_CheckOverflow( msg ))
|
if( MSG_CheckOverflow( msg ))
|
||||||
{
|
{
|
||||||
Host_Error( "CL_ParseServerMessage: overflow!\n" );
|
Host_Error( "%s: overflow!\n", __func__ );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,6 +340,9 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
// record command for debugging spew on parse problem
|
// record command for debugging spew on parse problem
|
||||||
CL_Parse_RecordCommand( cmd, bufStart );
|
CL_Parse_RecordCommand( cmd, bufStart );
|
||||||
|
|
||||||
|
if( CL_ParseCommonDLLMessage( msg, PROTO_LEGACY, cmd, bufStart ))
|
||||||
|
continue;
|
||||||
|
|
||||||
// other commands
|
// other commands
|
||||||
switch( cmd )
|
switch( cmd )
|
||||||
{
|
{
|
||||||
@@ -376,7 +357,7 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
Host_AbortCurrentFrame ();
|
Host_AbortCurrentFrame ();
|
||||||
break;
|
break;
|
||||||
case svc_legacy_event:
|
case svc_legacy_event:
|
||||||
CL_ParseEvent( msg );
|
CL_ParseEvent( msg, PROTO_LEGACY );
|
||||||
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
break;
|
break;
|
||||||
case svc_legacy_changing:
|
case svc_legacy_changing:
|
||||||
@@ -385,7 +366,9 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
{
|
{
|
||||||
int maxclients = cl.maxclients;
|
int maxclients = cl.maxclients;
|
||||||
|
|
||||||
cls.changelevel = true;
|
// we can only changelevel in singleplayer
|
||||||
|
// and singleplayer always runs in current protocol
|
||||||
|
// cls.changelevel = true;
|
||||||
S_StopAllSounds( true );
|
S_StopAllSounds( true );
|
||||||
|
|
||||||
Con_Printf( "Server changing, reconnecting\n" );
|
Con_Printf( "Server changing, reconnecting\n" );
|
||||||
@@ -436,20 +419,24 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case svc_time:
|
case svc_time:
|
||||||
CL_ParseServerTime( msg );
|
CL_ParseServerTime( msg, PROTO_LEGACY );
|
||||||
break;
|
break;
|
||||||
case svc_print:
|
case svc_print:
|
||||||
Con_Printf( "%s", MSG_ReadString( msg ));
|
Con_Printf( "%s", MSG_ReadString( msg ));
|
||||||
break;
|
break;
|
||||||
case svc_stufftext:
|
case svc_stufftext:
|
||||||
s = MSG_ReadString( msg );
|
s = MSG_ReadString( msg );
|
||||||
|
if( cl_trace_stufftext.value )
|
||||||
|
{
|
||||||
|
size_t len = Q_strlen( s );
|
||||||
|
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HACKS_RELATED_HLMODS
|
#ifdef HACKS_RELATED_HLMODS
|
||||||
// disable Cry Of Fear antisave protection
|
// disable Cry Of Fear antisave protection
|
||||||
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||||
break; // too early
|
break; // too early
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Con_Reportf( "Stufftext: %s", s );
|
|
||||||
Cbuf_AddFilteredText( s );
|
Cbuf_AddFilteredText( s );
|
||||||
break;
|
break;
|
||||||
case svc_setangle:
|
case svc_setangle:
|
||||||
@@ -457,19 +444,19 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
break;
|
break;
|
||||||
case svc_serverdata:
|
case svc_serverdata:
|
||||||
Cbuf_Execute(); // make sure any stuffed commands are done
|
Cbuf_Execute(); // make sure any stuffed commands are done
|
||||||
CL_ParseServerData( msg, true );
|
CL_ParseServerData( msg, PROTO_LEGACY );
|
||||||
break;
|
break;
|
||||||
case svc_lightstyle:
|
case svc_lightstyle:
|
||||||
CL_ParseLightStyle( msg );
|
CL_ParseLightStyle( msg, PROTO_LEGACY );
|
||||||
break;
|
break;
|
||||||
case svc_updateuserinfo:
|
case svc_updateuserinfo:
|
||||||
CL_UpdateUserinfo( msg, true );
|
CL_UpdateUserinfo( msg, PROTO_LEGACY );
|
||||||
break;
|
break;
|
||||||
case svc_deltatable:
|
case svc_deltatable:
|
||||||
Delta_ParseTableField( msg );
|
Delta_ParseTableField( msg );
|
||||||
break;
|
break;
|
||||||
case svc_clientdata:
|
case svc_clientdata:
|
||||||
CL_ParseClientData( msg );
|
CL_ParseClientData( msg, PROTO_LEGACY );
|
||||||
cl.frames[cl.parsecountmod].graphdata.client += MSG_GetNumBytesRead( msg ) - bufStart;
|
cl.frames[cl.parsecountmod].graphdata.client += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
break;
|
break;
|
||||||
case svc_resource:
|
case svc_resource:
|
||||||
@@ -479,82 +466,58 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
CL_UpdateUserPings( msg );
|
CL_UpdateUserPings( msg );
|
||||||
break;
|
break;
|
||||||
case svc_particle:
|
case svc_particle:
|
||||||
CL_ParseParticles( msg );
|
CL_ParseParticles( msg, PROTO_LEGACY );
|
||||||
break;
|
break;
|
||||||
case svc_restoresound:
|
case svc_restoresound:
|
||||||
CL_ParseRestoreSoundPacket( msg );
|
Con_Printf( S_ERROR "%s: svc_restoresound: implement me!\n", __func__ );
|
||||||
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
|
|
||||||
break;
|
break;
|
||||||
case svc_spawnstatic:
|
case svc_spawnstatic:
|
||||||
CL_LegacyParseStaticEntity( msg );
|
CL_LegacyParseStaticEntity( msg );
|
||||||
break;
|
break;
|
||||||
case svc_event_reliable:
|
case svc_event_reliable:
|
||||||
CL_ParseReliableEvent( msg );
|
CL_ParseReliableEvent( msg, PROTO_LEGACY );
|
||||||
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
break;
|
break;
|
||||||
case svc_spawnbaseline:
|
case svc_spawnbaseline:
|
||||||
CL_ParseBaseline( msg, true );
|
CL_ParseBaseline( msg, PROTO_LEGACY );
|
||||||
break;
|
|
||||||
case svc_temp_entity:
|
|
||||||
CL_ParseTempEntity( msg );
|
|
||||||
cl.frames[cl.parsecountmod].graphdata.tentities += MSG_GetNumBytesRead( msg ) - bufStart;
|
|
||||||
break;
|
break;
|
||||||
case svc_setpause:
|
case svc_setpause:
|
||||||
cl.paused = ( MSG_ReadOneBit( msg ) != 0 );
|
cl.paused = ( MSG_ReadOneBit( msg ) != 0 );
|
||||||
break;
|
break;
|
||||||
case svc_signonnum:
|
case svc_signonnum:
|
||||||
CL_ParseSignon( msg );
|
CL_ParseSignon( msg, PROTO_LEGACY );
|
||||||
break;
|
break;
|
||||||
case svc_centerprint:
|
case svc_centerprint:
|
||||||
CL_CenterPrint( MSG_ReadString( msg ), 0.25f );
|
CL_CenterPrint( MSG_ReadString( msg ), 0.25f );
|
||||||
break;
|
break;
|
||||||
case svc_intermission:
|
|
||||||
cl.intermission = 1;
|
|
||||||
break;
|
|
||||||
case svc_legacy_modelindex:
|
case svc_legacy_modelindex:
|
||||||
CL_LegacyPrecacheModel( msg );
|
CL_LegacyPrecacheModel( msg );
|
||||||
break;
|
break;
|
||||||
case svc_legacy_soundindex:
|
case svc_legacy_soundindex:
|
||||||
CL_LegacyPrecacheSound( msg );
|
CL_LegacyPrecacheSound( msg );
|
||||||
break;
|
break;
|
||||||
case svc_cdtrack:
|
|
||||||
param1 = MSG_ReadByte( msg );
|
|
||||||
param1 = bound( 1, param1, MAX_CDTRACKS ); // tracknum
|
|
||||||
param2 = MSG_ReadByte( msg );
|
|
||||||
param2 = bound( 1, param2, MAX_CDTRACKS ); // loopnum
|
|
||||||
S_StartBackgroundTrack( clgame.cdtracks[param1-1], clgame.cdtracks[param2-1], 0, false );
|
|
||||||
break;
|
|
||||||
case svc_restore:
|
case svc_restore:
|
||||||
CL_ParseRestore( msg );
|
CL_ParseRestore( msg );
|
||||||
break;
|
break;
|
||||||
case svc_legacy_eventindex:
|
case svc_legacy_eventindex:
|
||||||
CL_LegacyPrecacheEvent(msg);
|
CL_LegacyPrecacheEvent(msg);
|
||||||
break;
|
break;
|
||||||
case svc_weaponanim:
|
|
||||||
param1 = MSG_ReadByte( msg ); // iAnim
|
|
||||||
param2 = MSG_ReadByte( msg ); // body
|
|
||||||
CL_WeaponAnim( param1, param2 );
|
|
||||||
break;
|
|
||||||
case svc_bspdecal:
|
case svc_bspdecal:
|
||||||
CL_ParseStaticDecal( msg );
|
CL_ParseStaticDecal( msg );
|
||||||
break;
|
break;
|
||||||
case svc_roomtype:
|
|
||||||
param1 = MSG_ReadShort( msg );
|
|
||||||
Cvar_SetValue( "room_type", param1 );
|
|
||||||
break;
|
|
||||||
case svc_addangle:
|
case svc_addangle:
|
||||||
CL_ParseAddAngle( msg );
|
CL_ParseAddAngle( msg );
|
||||||
break;
|
break;
|
||||||
case svc_usermessage:
|
case svc_usermessage:
|
||||||
CL_RegisterUserMessage( msg );
|
CL_RegisterUserMessage( msg, PROTO_LEGACY );
|
||||||
break;
|
break;
|
||||||
case svc_packetentities:
|
case svc_packetentities:
|
||||||
playerbytes = CL_ParsePacketEntities( msg, false );
|
playerbytes = CL_ParsePacketEntities( msg, false, PROTO_LEGACY );
|
||||||
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||||
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||||
break;
|
break;
|
||||||
case svc_deltapacketentities:
|
case svc_deltapacketentities:
|
||||||
playerbytes = CL_ParsePacketEntities( msg, true );
|
playerbytes = CL_ParsePacketEntities( msg, true, PROTO_LEGACY );
|
||||||
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||||
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||||
break;
|
break;
|
||||||
@@ -601,41 +564,21 @@ void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
case svc_hltv:
|
case svc_hltv:
|
||||||
CL_ParseHLTV( msg );
|
CL_ParseHLTV( msg );
|
||||||
break;
|
break;
|
||||||
case svc_director:
|
|
||||||
CL_ParseDirector( msg );
|
|
||||||
break;
|
|
||||||
case svc_resourcelocation:
|
case svc_resourcelocation:
|
||||||
CL_ParseResLocation( msg );
|
CL_ParseResLocation( msg );
|
||||||
break;
|
break;
|
||||||
case svc_querycvarvalue:
|
case svc_querycvarvalue:
|
||||||
CL_ParseCvarValue( msg, false );
|
CL_ParseCvarValue( msg, false, PROTO_LEGACY );
|
||||||
break;
|
break;
|
||||||
case svc_querycvarvalue2:
|
case svc_querycvarvalue2:
|
||||||
CL_ParseCvarValue( msg, true );
|
CL_ParseCvarValue( msg, true, PROTO_LEGACY );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CL_ParseUserMessage( msg, cmd );
|
CL_ParseUserMessage( msg, cmd, PROTO_LEGACY );
|
||||||
cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart;
|
cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cl.frames[cl.parsecountmod].graphdata.msgbytes += MSG_GetNumBytesRead( msg ) - cls.starting_count;
|
|
||||||
CL_Parse_Debug( false ); // done
|
|
||||||
|
|
||||||
// we don't know if it is ok to save a demo message until
|
|
||||||
// after we have parsed the frame
|
|
||||||
if( !cls.demoplayback )
|
|
||||||
{
|
|
||||||
if( cls.demorecording && !cls.demowaiting )
|
|
||||||
{
|
|
||||||
CL_WriteDemoMessage( false, cls.starting_count, msg );
|
|
||||||
}
|
|
||||||
else if( cls.state != ca_active )
|
|
||||||
{
|
|
||||||
CL_WriteDemoMessage( true, cls.starting_count, msg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_LegacyPrecache_f( void )
|
void CL_LegacyPrecache_f( void )
|
||||||
@@ -643,7 +586,7 @@ void CL_LegacyPrecache_f( void )
|
|||||||
int spawncount, i;
|
int spawncount, i;
|
||||||
model_t *mod;
|
model_t *mod;
|
||||||
|
|
||||||
if( !cls.legacymode )
|
if( cls.legacymode != PROTO_LEGACY )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spawncount = Q_atoi( Cmd_Argv( 1 ));
|
spawncount = Q_atoi( Cmd_Argv( 1 ));
|
||||||
@@ -660,8 +603,8 @@ void CL_LegacyPrecache_f( void )
|
|||||||
if( clgame.entities )
|
if( clgame.entities )
|
||||||
clgame.entities->model = cl.worldmodel;
|
clgame.entities->model = cl.worldmodel;
|
||||||
|
|
||||||
// update the ref state.
|
// load skybox
|
||||||
R_UpdateRefState ();
|
R_SetupSky( clgame.movevars.skyName );
|
||||||
|
|
||||||
// tell rendering system we have a new set of models.
|
// tell rendering system we have a new set of models.
|
||||||
ref.dllFuncs.R_NewMap ();
|
ref.dllFuncs.R_NewMap ();
|
||||||
@@ -684,22 +627,5 @@ void CL_LegacyPrecache_f( void )
|
|||||||
// Include server count in case server disconnects and changes level during d/l
|
// Include server count in case server disconnects and changes level during d/l
|
||||||
MSG_BeginClientCmd( &cls.netchan.message, clc_stringcmd );
|
MSG_BeginClientCmd( &cls.netchan.message, clc_stringcmd );
|
||||||
MSG_WriteStringf( &cls.netchan.message, "begin %i", spawncount );
|
MSG_WriteStringf( &cls.netchan.message, "begin %i", spawncount );
|
||||||
cls.signon = SIGNONS;
|
cls.signon = SIGNONS - 1;
|
||||||
}
|
|
||||||
|
|
||||||
void CL_LegacyUpdateInfo( void )
|
|
||||||
{
|
|
||||||
if( !cls.legacymode )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( cls.state != ca_active )
|
|
||||||
return;
|
|
||||||
|
|
||||||
MSG_BeginClientCmd( &cls.netchan.message, clc_legacy_userinfo );
|
|
||||||
MSG_WriteString( &cls.netchan.message, cls.userinfo );
|
|
||||||
}
|
|
||||||
|
|
||||||
qboolean CL_LegacyMode( void )
|
|
||||||
{
|
|
||||||
return cls.legacymode;
|
|
||||||
}
|
}
|
||||||
|
|||||||
762
engine/client/cl_parse_gs.c
Normal file
762
engine/client/cl_parse_gs.c
Normal file
@@ -0,0 +1,762 @@
|
|||||||
|
/*
|
||||||
|
cl_parse.c - parse a message received from the server (GoldSrc 48 protocol)
|
||||||
|
Copyright (C) 2008 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 "net_encode.h"
|
||||||
|
#include "particledef.h"
|
||||||
|
#include "cl_tent.h"
|
||||||
|
#include "shake.h"
|
||||||
|
#include "hltv.h"
|
||||||
|
#include "input.h"
|
||||||
|
#include "server.h"
|
||||||
|
|
||||||
|
static void CL_ParseExtraInfo( sizebuf_t *msg )
|
||||||
|
{
|
||||||
|
string clientfallback;
|
||||||
|
|
||||||
|
Q_strncpy( clientfallback, MSG_ReadString( msg ), sizeof( clientfallback ));
|
||||||
|
if( COM_CheckStringEmpty( clientfallback ))
|
||||||
|
Con_Reportf( S_ERROR "%s: TODO: add fallback directory %s!\n", __func__, clientfallback );
|
||||||
|
|
||||||
|
if( MSG_ReadByte( msg ))
|
||||||
|
{
|
||||||
|
Cvar_FullSet( "sv_cheats", "1", FCVAR_READ_ONLY | FCVAR_SERVER );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Cvar_SetCheatState();
|
||||||
|
Cvar_FullSet( "sv_cheats", "0", FCVAR_READ_ONLY | FCVAR_SERVER );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_ParseNewMovevars( sizebuf_t *msg )
|
||||||
|
{
|
||||||
|
Delta_InitClient(); // finalize client delta's
|
||||||
|
|
||||||
|
clgame.movevars.gravity = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.stopspeed = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.maxspeed = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.spectatormaxspeed = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.accelerate = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.airaccelerate = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.wateraccelerate = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.friction = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.edgefriction = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.waterfriction = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.entgravity = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.bounce = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.stepsize = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.maxvelocity = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.zmax = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.waveHeight = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.footsteps = MSG_ReadByte( msg );
|
||||||
|
clgame.movevars.rollangle = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.rollspeed = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.skycolor_r = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.skycolor_g = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.skycolor_b = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.skyvec_x = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.skyvec_y = MSG_ReadFloat( msg );
|
||||||
|
clgame.movevars.skyvec_z = MSG_ReadFloat( msg );
|
||||||
|
|
||||||
|
Q_strncpy( clgame.movevars.skyName, MSG_ReadString( msg ), sizeof( clgame.movevars.skyName ));
|
||||||
|
|
||||||
|
// water alpha is not allowed
|
||||||
|
if( !FBitSet( world.flags, FWORLD_WATERALPHA ))
|
||||||
|
clgame.movevars.wateralpha = 1.0f;
|
||||||
|
|
||||||
|
// update sky if changed
|
||||||
|
if( Q_strcmp( clgame.oldmovevars.skyName, clgame.movevars.skyName ) && cl.video_prepped )
|
||||||
|
R_SetupSky( clgame.movevars.skyName );
|
||||||
|
|
||||||
|
clgame.oldmovevars = clgame.movevars;
|
||||||
|
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||||
|
|
||||||
|
// keep features an actual!
|
||||||
|
clgame.oldmovevars.features = clgame.movevars.features = host.features;
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct delta_header_t
|
||||||
|
{
|
||||||
|
qboolean remove : 1;
|
||||||
|
qboolean custom : 1;
|
||||||
|
qboolean instanced : 1;
|
||||||
|
uint instanced_baseline_index : 6;
|
||||||
|
uint offset : 6;
|
||||||
|
} delta_header_t;
|
||||||
|
|
||||||
|
static int CL_ParseDeltaHeader( sizebuf_t *msg, qboolean delta, int oldnum, struct delta_header_t *hdr )
|
||||||
|
{
|
||||||
|
int entnum = oldnum;
|
||||||
|
memset( hdr, 0, sizeof( *hdr ));
|
||||||
|
|
||||||
|
if( !delta )
|
||||||
|
{
|
||||||
|
// if we have one bit set, then it's a next entity in line
|
||||||
|
// if we have next bit NON set, then it's a one of next 64 entities
|
||||||
|
// if not, it's a new entity
|
||||||
|
if( MSG_ReadOneBit( msg ))
|
||||||
|
entnum++;
|
||||||
|
else if( MSG_ReadOneBit( msg ) == 0 )
|
||||||
|
entnum += MSG_ReadUBitLong( msg, 6 );
|
||||||
|
else
|
||||||
|
entnum = MSG_ReadUBitLong( msg, MAX_GOLDSRC_ENTITY_BITS );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// does this packet encode entity deletion?
|
||||||
|
hdr->remove = MSG_ReadOneBit( msg );
|
||||||
|
|
||||||
|
// same logic as above
|
||||||
|
if( MSG_ReadOneBit( msg ) == 0 )
|
||||||
|
entnum += MSG_ReadUBitLong( msg, 6 );
|
||||||
|
else entnum = MSG_ReadUBitLong( msg, MAX_GOLDSRC_ENTITY_BITS );
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we are not removing this entity
|
||||||
|
if( !hdr->remove )
|
||||||
|
{
|
||||||
|
hdr->custom = MSG_ReadOneBit( msg );
|
||||||
|
|
||||||
|
// do we got instanced baselines in svc_spawnbaselines?
|
||||||
|
if( cl.instanced_baseline_count )
|
||||||
|
{
|
||||||
|
hdr->instanced = MSG_ReadOneBit( msg );
|
||||||
|
if( hdr->instanced )
|
||||||
|
hdr->instanced_baseline_index = MSG_ReadUBitLong( msg, 6 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !delta && !hdr->instanced )
|
||||||
|
{
|
||||||
|
if( MSG_ReadOneBit( msg ))
|
||||||
|
hdr->offset = MSG_ReadUBitLong( msg, 6 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return entnum;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int CL_GetEntityDelta( const struct delta_header_t *hdr, int entnum )
|
||||||
|
{
|
||||||
|
if( hdr->custom )
|
||||||
|
return DT_CUSTOM_ENTITY_STATE_T;
|
||||||
|
|
||||||
|
if( CL_IsPlayerIndex( entnum ))
|
||||||
|
return DT_ENTITY_STATE_PLAYER_T;
|
||||||
|
|
||||||
|
return DT_ENTITY_STATE_T;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_FlushEntityPacketGS( frame_t *frame, sizebuf_t *msg )
|
||||||
|
{
|
||||||
|
frame->valid = false;
|
||||||
|
cl.validsequence = 0; // can't render a frame
|
||||||
|
|
||||||
|
// read it all but ignore it
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
entity_state_t from = { 0 }, to;
|
||||||
|
delta_header_t hdr;
|
||||||
|
|
||||||
|
if( MSG_ReadWord( msg ) != 0 )
|
||||||
|
{
|
||||||
|
MSG_SeekToBit( msg, -16, SEEK_CUR );
|
||||||
|
num = CL_ParseDeltaHeader( msg, false, num, &hdr );
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
|
||||||
|
if( MSG_CheckOverflow( msg ))
|
||||||
|
Host_Error( "%s: overflow\n", __func__ );
|
||||||
|
|
||||||
|
if( hdr.remove )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Delta_ReadGSFields( msg, CL_GetEntityDelta( &hdr, num ), &from, &to, cl.mtime[0] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_DeltaEntityGS( const delta_header_t *hdr, sizebuf_t *msg, frame_t *frame, int newnum, const entity_state_t *from )
|
||||||
|
{
|
||||||
|
cl_entity_t *ent;
|
||||||
|
entity_state_t *to;
|
||||||
|
qboolean newent = from == NULL;
|
||||||
|
int pack = frame->num_entities;
|
||||||
|
qboolean has_update = msg != NULL;
|
||||||
|
|
||||||
|
// alloc next slot to store update
|
||||||
|
to = &cls.packet_entities[cls.next_client_entities % cls.num_client_entities];
|
||||||
|
|
||||||
|
if(( newnum < 0 ) || ( newnum >= clgame.maxEntities ))
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "CL_DeltaEntity: invalid newnum: %d\n", newnum );
|
||||||
|
Host_Error( "%s: bad delta entity number: %i", __func__, newnum );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ent = CL_EDICT_NUM( newnum );
|
||||||
|
if( hdr->remove )
|
||||||
|
{
|
||||||
|
if( !newent )
|
||||||
|
CL_KillDeadBeams( ent );
|
||||||
|
else
|
||||||
|
Con_Printf( S_WARN "%s: entity remove on non-delta update (%d)\n", __func__, newnum );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ent->index = newnum; // enumerate entity index
|
||||||
|
if( newent )
|
||||||
|
{
|
||||||
|
if( hdr->instanced )
|
||||||
|
from = &cl.instanced_baseline[hdr->instanced_baseline_index];
|
||||||
|
else if( hdr->offset != 0 )
|
||||||
|
from = &cls.packet_entities[(cls.next_client_entities - hdr->offset) % cls.num_client_entities];
|
||||||
|
else
|
||||||
|
from = &ent->baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( has_update )
|
||||||
|
Delta_ReadGSFields( msg, CL_GetEntityDelta( hdr, newnum ), from, to, cl.mtime[0] );
|
||||||
|
else memcpy( to, from, sizeof( entity_state_t ));
|
||||||
|
|
||||||
|
to->entityType = hdr->custom ? ENTITY_BEAM : ENTITY_NORMAL;
|
||||||
|
to->number = newnum;
|
||||||
|
|
||||||
|
if( newent )
|
||||||
|
{
|
||||||
|
// interpolation must be reset
|
||||||
|
SETVISBIT( frame->flags, pack );
|
||||||
|
|
||||||
|
// release beams from previous entity
|
||||||
|
CL_KillDeadBeams( ent );
|
||||||
|
}
|
||||||
|
|
||||||
|
// add entity to packet
|
||||||
|
cls.next_client_entities++;
|
||||||
|
frame->num_entities++;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_CopyPacketEntity( frame_t *frame, int num, const entity_state_t *from )
|
||||||
|
{
|
||||||
|
delta_header_t fakehdr =
|
||||||
|
{
|
||||||
|
.custom = FBitSet( from->entityType, ENTITY_BEAM ) == ENTITY_BEAM,
|
||||||
|
};
|
||||||
|
CL_DeltaEntityGS( &fakehdr, NULL, frame, num, from );
|
||||||
|
}
|
||||||
|
|
||||||
|
static int CL_ParsePacketEntitiesGS( sizebuf_t *msg, qboolean delta )
|
||||||
|
{
|
||||||
|
frame_t *frame, *oldframe;
|
||||||
|
int oldindex, newnum, oldnum, numbase = 0;
|
||||||
|
entity_state_t *oldent;
|
||||||
|
int count;
|
||||||
|
int playerbytes = 0;
|
||||||
|
|
||||||
|
// save first uncompressed packet as timestamp
|
||||||
|
if( cls.changelevel && !delta && cls.demorecording )
|
||||||
|
CL_WriteDemoJumpTime();
|
||||||
|
|
||||||
|
count = MSG_ReadWord( msg );
|
||||||
|
|
||||||
|
frame = &cl.frames[cl.parsecountmod];
|
||||||
|
memset( frame->flags, 0, sizeof( frame->flags ));
|
||||||
|
frame->first_entity = cls.next_client_entities;
|
||||||
|
frame->num_entities = 0;
|
||||||
|
frame->valid = true;
|
||||||
|
|
||||||
|
if( delta )
|
||||||
|
{
|
||||||
|
uint oldpacket = MSG_ReadByte( msg );
|
||||||
|
oldframe = &cl.frames[oldpacket & CL_UPDATE_MASK];
|
||||||
|
|
||||||
|
if( !CL_ValidateDeltaPacket( oldpacket, oldframe ))
|
||||||
|
{
|
||||||
|
MSG_StartBitWriting( msg );
|
||||||
|
CL_FlushEntityPacketGS( frame, msg );
|
||||||
|
MSG_EndBitWriting( msg );
|
||||||
|
return playerbytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
oldframe = NULL;
|
||||||
|
cl.send_reply = true;
|
||||||
|
cls.demowaiting = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cl.validsequence = cls.netchan.incoming_sequence;
|
||||||
|
|
||||||
|
MSG_StartBitWriting( msg );
|
||||||
|
|
||||||
|
oldent = NULL;
|
||||||
|
oldindex = 0;
|
||||||
|
oldnum = CL_UpdateOldEntNum( oldindex, oldframe, &oldent );
|
||||||
|
|
||||||
|
// read it all but ignore it
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
int bufstart;
|
||||||
|
qboolean player;
|
||||||
|
delta_header_t hdr;
|
||||||
|
int val = MSG_ReadWord( msg );
|
||||||
|
|
||||||
|
if( val )
|
||||||
|
{
|
||||||
|
MSG_SeekToBit( msg, -16, SEEK_CUR );
|
||||||
|
numbase = newnum = CL_ParseDeltaHeader( msg, delta, numbase, &hdr );
|
||||||
|
}
|
||||||
|
else break;
|
||||||
|
|
||||||
|
if( MSG_CheckOverflow( msg ))
|
||||||
|
Host_Error( "%s: overflow\n", __func__ );
|
||||||
|
|
||||||
|
player = CL_IsPlayerIndex( newnum );
|
||||||
|
|
||||||
|
while( oldnum < newnum )
|
||||||
|
{
|
||||||
|
if( !delta )
|
||||||
|
Con_Printf( S_WARN "%s: old frame copy on non-delta update (%d < %d)\n", __func__, oldnum, newnum );
|
||||||
|
|
||||||
|
// one or more entities from the old packet are unchanged
|
||||||
|
CL_CopyPacketEntity( frame, oldnum, oldent );
|
||||||
|
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||||
|
}
|
||||||
|
|
||||||
|
bufstart = MSG_GetNumBytesRead( msg );
|
||||||
|
|
||||||
|
if( oldnum == newnum )
|
||||||
|
{
|
||||||
|
if( !delta )
|
||||||
|
Con_Printf( S_WARN "%s: delta entity on non-delta update (%d)\n", __func__, oldnum );
|
||||||
|
|
||||||
|
// from delta
|
||||||
|
CL_DeltaEntityGS( &hdr, msg, frame, newnum, oldent );
|
||||||
|
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||||
|
}
|
||||||
|
else if( oldnum > newnum )
|
||||||
|
{
|
||||||
|
// from baseline
|
||||||
|
CL_DeltaEntityGS( &hdr, msg, frame, newnum, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( player ) playerbytes += MSG_GetNumBytesRead( msg ) - bufstart;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( MSG_CheckOverflow( msg ))
|
||||||
|
Host_Error( "%s: overflow\n", __func__ );
|
||||||
|
|
||||||
|
// any remaining entities in the old frame are copied over
|
||||||
|
while( oldnum != MAX_ENTNUMBER )
|
||||||
|
{
|
||||||
|
// one or more entities from the old packet are unchanged
|
||||||
|
CL_CopyPacketEntity( frame, oldnum, oldent );
|
||||||
|
oldnum = CL_UpdateOldEntNum( ++oldindex, oldframe, &oldent );
|
||||||
|
}
|
||||||
|
|
||||||
|
MSG_EndBitWriting( msg );
|
||||||
|
|
||||||
|
if( frame->num_entities != count )
|
||||||
|
Con_Reportf( S_WARN "CL_Parse%sPacketEntitiesGS: (%i should be %i)\n", delta ? "Delta" : "", frame->num_entities, count );
|
||||||
|
|
||||||
|
if( !frame->valid )
|
||||||
|
return playerbytes;
|
||||||
|
|
||||||
|
CL_ProcessPacket( frame );
|
||||||
|
CL_SetSolidEntities();
|
||||||
|
|
||||||
|
// first update, received world, remove loading plaque
|
||||||
|
if( cls.signon == ( SIGNONS - 1 ))
|
||||||
|
{
|
||||||
|
cls.signon = SIGNONS;
|
||||||
|
CL_SignonReply( PROTO_GOLDSRC );
|
||||||
|
}
|
||||||
|
|
||||||
|
return playerbytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
static float MSG_ReadGSBitCoord( sizebuf_t *sb )
|
||||||
|
{
|
||||||
|
float value = 0;
|
||||||
|
int ival, fval;
|
||||||
|
|
||||||
|
ival = MSG_ReadOneBit( sb );
|
||||||
|
fval = MSG_ReadOneBit( sb );
|
||||||
|
|
||||||
|
if( ival || fval )
|
||||||
|
{
|
||||||
|
int sign = MSG_ReadOneBit( sb );
|
||||||
|
|
||||||
|
if( ival )
|
||||||
|
ival = MSG_ReadUBitLong( sb, 12 );
|
||||||
|
if( fval )
|
||||||
|
fval = MSG_ReadUBitLong( sb, 3 );
|
||||||
|
|
||||||
|
value = (float)( fval / 8.0 + ival );
|
||||||
|
if( sign )
|
||||||
|
value = -value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MSG_ReadGSBitVec3Coord( sizebuf_t *sb, vec3_t fa )
|
||||||
|
{
|
||||||
|
qboolean x, y, z;
|
||||||
|
|
||||||
|
VectorClear( fa );
|
||||||
|
|
||||||
|
x = MSG_ReadOneBit( sb );
|
||||||
|
y = MSG_ReadOneBit( sb );
|
||||||
|
z = MSG_ReadOneBit( sb );
|
||||||
|
if( x )
|
||||||
|
fa[0] = MSG_ReadGSBitCoord( sb );
|
||||||
|
if( y )
|
||||||
|
fa[1] = MSG_ReadGSBitCoord( sb );
|
||||||
|
if( z )
|
||||||
|
fa[2] = MSG_ReadGSBitCoord( sb );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_ParseSoundPacketGS( sizebuf_t *msg )
|
||||||
|
{
|
||||||
|
vec3_t pos;
|
||||||
|
int chan, sound;
|
||||||
|
float volume, attn;
|
||||||
|
int flags, pitch, entnum;
|
||||||
|
sound_t handle = 0;
|
||||||
|
|
||||||
|
MSG_StartBitWriting( msg );
|
||||||
|
|
||||||
|
flags = MSG_ReadUBitLong( msg, 9 );
|
||||||
|
|
||||||
|
if( FBitSet( flags, SND_VOLUME ))
|
||||||
|
volume = (float)MSG_ReadByte( msg ) / 255.0f;
|
||||||
|
else volume = VOL_NORM;
|
||||||
|
|
||||||
|
if( FBitSet( flags, SND_ATTENUATION ))
|
||||||
|
attn = (float)MSG_ReadByte( msg ) / 64.0f;
|
||||||
|
else attn = ATTN_NONE;
|
||||||
|
|
||||||
|
chan = MSG_ReadUBitLong( msg, 3 );
|
||||||
|
entnum = MSG_ReadUBitLong( msg, MAX_GOLDSRC_ENTITY_BITS );
|
||||||
|
if( FBitSet( flags, SND_LEGACY_LARGE_INDEX ))
|
||||||
|
sound = MSG_ReadWord( msg );
|
||||||
|
else sound = MSG_ReadByte( msg );
|
||||||
|
MSG_ReadGSBitVec3Coord( msg, pos );
|
||||||
|
|
||||||
|
if( FBitSet( flags, SND_PITCH ))
|
||||||
|
pitch = MSG_ReadByte( msg );
|
||||||
|
else pitch = PITCH_NORM;
|
||||||
|
|
||||||
|
MSG_EndBitWriting( msg );
|
||||||
|
|
||||||
|
ClearBits( flags, SND_LEGACY_LARGE_INDEX );
|
||||||
|
|
||||||
|
if( FBitSet( flags, SND_SENTENCE ))
|
||||||
|
{
|
||||||
|
char sentenceName[32];
|
||||||
|
Q_snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound );
|
||||||
|
handle = S_RegisterSound( sentenceName );
|
||||||
|
}
|
||||||
|
else handle = cl.sound_index[sound]; // see precached sound
|
||||||
|
|
||||||
|
if( !cl.audio_prepped )
|
||||||
|
return; // too early
|
||||||
|
|
||||||
|
// g-cont. sound and ambient sound have only difference with channel
|
||||||
|
if( chan == CHAN_STATIC )
|
||||||
|
{
|
||||||
|
S_AmbientSound( pos, entnum, handle, volume, attn, pitch, flags );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
S_StartSound( pos, entnum, chan, handle, volume, attn, pitch, flags );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CL_ParseSpawnStaticSound( sizebuf_t *msg )
|
||||||
|
{
|
||||||
|
vec3_t pos;
|
||||||
|
int handle, entnum, pitch, flags;
|
||||||
|
float volume, attn;
|
||||||
|
|
||||||
|
MSG_ReadVec3Coord( msg, pos );
|
||||||
|
handle = MSG_ReadShort( msg );
|
||||||
|
volume = MSG_ReadByte( msg ) * ( 1.0f / 255.0f );
|
||||||
|
attn = MSG_ReadByte( msg ) * ( 1.0f / 64.0f );
|
||||||
|
entnum = MSG_ReadShort( msg );
|
||||||
|
pitch = MSG_ReadByte( msg );
|
||||||
|
flags = MSG_ReadByte( msg );
|
||||||
|
|
||||||
|
S_AmbientSound( pos, entnum, handle, volume, attn, pitch, flags );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=====================================================================
|
||||||
|
|
||||||
|
ACTION MESSAGES
|
||||||
|
|
||||||
|
=====================================================================
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
=====================
|
||||||
|
CL_ParseGoldSrcServerMessage
|
||||||
|
|
||||||
|
dispatch messages
|
||||||
|
=====================
|
||||||
|
*/
|
||||||
|
void CL_ParseGoldSrcServerMessage( sizebuf_t *msg )
|
||||||
|
{
|
||||||
|
size_t bufStart, playerbytes;
|
||||||
|
int cmd, param1;
|
||||||
|
const char *s;
|
||||||
|
|
||||||
|
// parse the message
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
if( MSG_CheckOverflow( msg ))
|
||||||
|
{
|
||||||
|
Host_Error( "CL_ParseServerMessage: overflow!\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// mark start position
|
||||||
|
bufStart = MSG_GetNumBytesRead( msg );
|
||||||
|
|
||||||
|
// end of message (align bits)
|
||||||
|
if( MSG_GetNumBitsLeft( msg ) < 8 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
cmd = MSG_ReadServerCmd( msg );
|
||||||
|
|
||||||
|
// record command for debugging spew on parse problem
|
||||||
|
CL_Parse_RecordCommand( cmd, bufStart );
|
||||||
|
|
||||||
|
if( CL_ParseCommonDLLMessage( msg, PROTO_GOLDSRC, cmd, bufStart ))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// other commands
|
||||||
|
switch( cmd )
|
||||||
|
{
|
||||||
|
case svc_bad:
|
||||||
|
Host_Error( "svc_bad\n" );
|
||||||
|
break;
|
||||||
|
case svc_nop:
|
||||||
|
case svc_spawnstatic:
|
||||||
|
case svc_goldsrc_damage:
|
||||||
|
case svc_goldsrc_killedmonster:
|
||||||
|
case svc_goldsrc_foundsecret:
|
||||||
|
// this does nothing
|
||||||
|
break;
|
||||||
|
case svc_disconnect:
|
||||||
|
s = MSG_ReadString( msg );
|
||||||
|
if( COM_CheckStringEmpty( s ))
|
||||||
|
Con_Printf( "Server issued disconnect. Reason: %s\n", s );
|
||||||
|
CL_Drop ();
|
||||||
|
Host_AbortCurrentFrame ();
|
||||||
|
break;
|
||||||
|
case svc_event:
|
||||||
|
MSG_StartBitWriting( msg );
|
||||||
|
CL_ParseEvent( msg, PROTO_GOLDSRC );
|
||||||
|
MSG_EndBitWriting( msg );
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_version:
|
||||||
|
param1 = MSG_ReadLong( msg );
|
||||||
|
if( param1 != PROTOCOL_GOLDSRC_VERSION )
|
||||||
|
Host_Error( "Server use invalid protocol (%i should be %i)\n", param1, PROTOCOL_GOLDSRC_VERSION );
|
||||||
|
break;
|
||||||
|
case svc_setview:
|
||||||
|
CL_ParseViewEntity( msg );
|
||||||
|
break;
|
||||||
|
case svc_sound:
|
||||||
|
CL_ParseSoundPacketGS( msg );
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
|
break;
|
||||||
|
case svc_time:
|
||||||
|
CL_ParseServerTime( msg, PROTO_GOLDSRC );
|
||||||
|
break;
|
||||||
|
case svc_print:
|
||||||
|
Con_Printf( "%s", MSG_ReadString( msg ));
|
||||||
|
break;
|
||||||
|
case svc_stufftext:
|
||||||
|
s = MSG_ReadString( msg );
|
||||||
|
if( cl_trace_stufftext.value )
|
||||||
|
{
|
||||||
|
size_t len = Q_strlen( s );
|
||||||
|
Con_Printf( "Stufftext: %s%c", s, len && s[len-1] == '\n' ? '\0' : '\n' );
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HACKS_RELATED_HLMODS
|
||||||
|
// disable Cry Of Fear antisave protection
|
||||||
|
if( !Q_strnicmp( s, "disconnect", 10 ) && cls.signon != SIGNONS )
|
||||||
|
break; // too early
|
||||||
|
#endif
|
||||||
|
Cbuf_AddFilteredText( s );
|
||||||
|
break;
|
||||||
|
case svc_setangle:
|
||||||
|
CL_ParseSetAngle( msg );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_serverinfo:
|
||||||
|
Cbuf_Execute(); // make sure any stuffed commands are done
|
||||||
|
CL_ParseServerData( msg, PROTO_GOLDSRC );
|
||||||
|
break;
|
||||||
|
case svc_lightstyle:
|
||||||
|
CL_ParseLightStyle( msg, PROTO_GOLDSRC );
|
||||||
|
break;
|
||||||
|
case svc_updateuserinfo:
|
||||||
|
CL_UpdateUserinfo( msg, PROTO_GOLDSRC );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_deltadescription:
|
||||||
|
Delta_ParseTableField_GS( msg );
|
||||||
|
break;
|
||||||
|
case svc_clientdata:
|
||||||
|
MSG_StartBitWriting( msg );
|
||||||
|
CL_ParseClientData( msg, PROTO_GOLDSRC );
|
||||||
|
MSG_EndBitWriting( msg );
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.client += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_stopsound:
|
||||||
|
param1 = MSG_ReadWord( msg );
|
||||||
|
S_StopSound( param1 >> 3, param1 & 7, NULL );
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.sound += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
|
break;
|
||||||
|
case svc_pings:
|
||||||
|
MSG_StartBitWriting( msg );
|
||||||
|
CL_UpdateUserPings( msg );
|
||||||
|
MSG_EndBitWriting( msg );
|
||||||
|
break;
|
||||||
|
case svc_particle:
|
||||||
|
CL_ParseParticles( msg, PROTO_GOLDSRC );
|
||||||
|
break;
|
||||||
|
case svc_event_reliable:
|
||||||
|
MSG_StartBitWriting( msg );
|
||||||
|
CL_ParseReliableEvent( msg, PROTO_GOLDSRC );
|
||||||
|
MSG_EndBitWriting( msg );
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.event += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
|
break;
|
||||||
|
case svc_spawnbaseline:
|
||||||
|
MSG_StartBitWriting( msg );
|
||||||
|
CL_ParseBaseline( msg, PROTO_GOLDSRC );
|
||||||
|
MSG_EndBitWriting( msg );
|
||||||
|
break;
|
||||||
|
case svc_setpause:
|
||||||
|
cl.paused = ( MSG_ReadByte( msg ) != 0 );
|
||||||
|
break;
|
||||||
|
case svc_signonnum:
|
||||||
|
CL_ParseSignon( msg, PROTO_GOLDSRC );
|
||||||
|
break;
|
||||||
|
case svc_centerprint:
|
||||||
|
CL_CenterPrint( MSG_ReadString( msg ), 0.25f );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_spawnstaticsound:
|
||||||
|
CL_ParseSpawnStaticSound( msg );
|
||||||
|
break;
|
||||||
|
case svc_finale:
|
||||||
|
CL_ParseFinaleCutscene( msg, 2 );
|
||||||
|
break;
|
||||||
|
case svc_restore:
|
||||||
|
CL_ParseRestore( msg );
|
||||||
|
break;
|
||||||
|
case svc_cutscene:
|
||||||
|
CL_ParseFinaleCutscene( msg, 3 );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_decalname:
|
||||||
|
param1 = MSG_ReadByte( msg );
|
||||||
|
s = MSG_ReadString( msg );
|
||||||
|
Q_strncpy( host.draw_decals[param1], s, sizeof( host.draw_decals[param1] ));
|
||||||
|
break;
|
||||||
|
case svc_addangle:
|
||||||
|
CL_ParseAddAngle( msg );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_newusermsg:
|
||||||
|
CL_RegisterUserMessage( msg, PROTO_GOLDSRC );
|
||||||
|
break;
|
||||||
|
case svc_packetentities:
|
||||||
|
playerbytes = CL_ParsePacketEntitiesGS( msg, false );
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||||
|
break;
|
||||||
|
case svc_deltapacketentities:
|
||||||
|
playerbytes = CL_ParsePacketEntitiesGS( msg, true );
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.players += playerbytes;
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.entities += MSG_GetNumBytesRead( msg ) - bufStart - playerbytes;
|
||||||
|
break;
|
||||||
|
case svc_choke:
|
||||||
|
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = true;
|
||||||
|
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].receivedtime = -2.0;
|
||||||
|
break;
|
||||||
|
case svc_resourcelist:
|
||||||
|
MSG_StartBitWriting( msg );
|
||||||
|
CL_ParseResourceList( msg, PROTO_GOLDSRC );
|
||||||
|
MSG_EndBitWriting( msg );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_newmovevars:
|
||||||
|
CL_ParseNewMovevars( msg );
|
||||||
|
break;
|
||||||
|
case svc_resourcerequest:
|
||||||
|
CL_ParseResourceRequest( msg );
|
||||||
|
break;
|
||||||
|
case svc_customization:
|
||||||
|
CL_ParseCustomization( msg );
|
||||||
|
break;
|
||||||
|
case svc_crosshairangle:
|
||||||
|
CL_ParseCrosshairAngle( msg );
|
||||||
|
break;
|
||||||
|
case svc_soundfade:
|
||||||
|
CL_ParseSoundFade( msg );
|
||||||
|
break;
|
||||||
|
case svc_filetxferfailed:
|
||||||
|
CL_ParseFileTransferFailed( msg );
|
||||||
|
break;
|
||||||
|
case svc_hltv:
|
||||||
|
CL_ParseHLTV( msg );
|
||||||
|
break;
|
||||||
|
case svc_voiceinit:
|
||||||
|
CL_ParseVoiceInit( msg );
|
||||||
|
break;
|
||||||
|
case svc_voicedata:
|
||||||
|
CL_ParseVoiceData( msg, PROTO_GOLDSRC );
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.voicebytes += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
|
break;
|
||||||
|
case svc_resourcelocation:
|
||||||
|
CL_ParseResLocation( msg );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_sendextrainfo:
|
||||||
|
CL_ParseExtraInfo( msg );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_timescale:
|
||||||
|
// we can set sys_timescale to anything we want but in GoldSrc it's locked for
|
||||||
|
// HLTV and demoplayback. Do we really want to have it then if both are out of scope?
|
||||||
|
Con_Reportf( S_ERROR "%s: svc_goldsrc_timescale: implement me!\n", __func__ );
|
||||||
|
MSG_ReadFloat( msg );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_sendcvarvalue:
|
||||||
|
CL_ParseCvarValue( msg, false, PROTO_GOLDSRC );
|
||||||
|
break;
|
||||||
|
case svc_goldsrc_sendcvarvalue2:
|
||||||
|
CL_ParseCvarValue( msg, true, PROTO_GOLDSRC );
|
||||||
|
break;
|
||||||
|
case svc_exec:
|
||||||
|
CL_ParseExec( msg );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
CL_ParseUserMessage( msg, cmd, PROTO_LEGACY );
|
||||||
|
cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -54,37 +54,12 @@ void GAME_EXPORT CL_PopPMStates( void )
|
|||||||
clgame.pushed = false;
|
clgame.pushed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
CL_PushTraceBounds
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void GAME_EXPORT CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs )
|
|
||||||
{
|
|
||||||
hullnum = bound( 0, hullnum, 3 );
|
|
||||||
VectorCopy( mins, clgame.pmove->player_mins[hullnum] );
|
|
||||||
VectorCopy( maxs, clgame.pmove->player_maxs[hullnum] );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
CL_PopTraceBounds
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void GAME_EXPORT CL_PopTraceBounds( void )
|
|
||||||
{
|
|
||||||
memcpy( clgame.pmove->player_mins, host.player_mins, sizeof( host.player_mins ));
|
|
||||||
memcpy( clgame.pmove->player_maxs, host.player_maxs, sizeof( host.player_maxs ));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
CL_IsPredicted
|
CL_IsPredicted
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
qboolean CL_IsPredicted( void )
|
static qboolean CL_IsPredicted( void )
|
||||||
{
|
{
|
||||||
if( cl_nopred.value || cl.intermission )
|
if( cl_nopred.value || cl.intermission )
|
||||||
return false;
|
return false;
|
||||||
@@ -417,7 +392,7 @@ CL_AddLinksToPmove
|
|||||||
collect solid entities
|
collect solid entities
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_AddLinksToPmove( frame_t *frame )
|
static void CL_AddLinksToPmove( frame_t *frame )
|
||||||
{
|
{
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
model_t *model;
|
model_t *model;
|
||||||
@@ -569,8 +544,8 @@ void GAME_EXPORT CL_SetSolidPlayers( int playernum )
|
|||||||
// some fields needs to be override from cls.predicted_players
|
// some fields needs to be override from cls.predicted_players
|
||||||
VectorCopy( player->origin, pe->origin );
|
VectorCopy( player->origin, pe->origin );
|
||||||
VectorCopy( player->angles, pe->angles );
|
VectorCopy( player->angles, pe->angles );
|
||||||
VectorCopy( clgame.pmove->player_mins[player->usehull], pe->mins );
|
VectorCopy( host.player_mins[player->usehull], pe->mins );
|
||||||
VectorCopy( clgame.pmove->player_maxs[player->usehull], pe->maxs );
|
VectorCopy( host.player_maxs[player->usehull], pe->maxs );
|
||||||
pe->movetype = player->movetype;
|
pe->movetype = player->movetype;
|
||||||
pe->solid = player->solid;
|
pe->solid = player->solid;
|
||||||
}
|
}
|
||||||
@@ -687,11 +662,6 @@ cl_entity_t *CL_GetWaterEntity( const float *rgflPos )
|
|||||||
return CL_GetEntityByIndex( entnum );
|
return CL_GetEntityByIndex( entnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GAME_EXPORT CL_TestLine( const vec3_t start, const vec3_t end, int flags )
|
|
||||||
{
|
|
||||||
return PM_TestLineExt( clgame.pmove, clgame.pmove->physents, clgame.pmove->numphysent, start, end, flags );
|
|
||||||
}
|
|
||||||
|
|
||||||
static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
static int GAME_EXPORT pfnTestPlayerPosition( float *pos, pmtrace_t *ptrace )
|
||||||
{
|
{
|
||||||
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, NULL );
|
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, NULL );
|
||||||
@@ -824,6 +794,16 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
|||||||
cd = &from->client;
|
cd = &from->client;
|
||||||
|
|
||||||
pmove->player_index = ps->number - 1;
|
pmove->player_index = ps->number - 1;
|
||||||
|
|
||||||
|
// a1ba: workaround bug where the server refuse to send our local player in delta
|
||||||
|
// cl.playernum, in theory, must be equal to our local player index anyway
|
||||||
|
//
|
||||||
|
// this might not be a real solution, since everything else will be bogus
|
||||||
|
// but we need to properly run prediction and avoid potential memory
|
||||||
|
// corruption
|
||||||
|
if( pmove->player_index < 0 )
|
||||||
|
pmove->player_index = bound( 0, cl.playernum, cl.maxclients - 1 );
|
||||||
|
|
||||||
pmove->multiplayer = (cl.maxclients > 1);
|
pmove->multiplayer = (cl.maxclients > 1);
|
||||||
pmove->runfuncs = runfuncs;
|
pmove->runfuncs = runfuncs;
|
||||||
pmove->time = time * 1000.0f;
|
pmove->time = time * 1000.0f;
|
||||||
@@ -873,10 +853,10 @@ static void CL_SetupPMove( playermove_t *pmove, const local_state_t *from, const
|
|||||||
VectorCopy( cd->vuser4, pmove->vuser4 );
|
VectorCopy( cd->vuser4, pmove->vuser4 );
|
||||||
pmove->cmd = *ucmd; // copy current cmds
|
pmove->cmd = *ucmd; // copy current cmds
|
||||||
|
|
||||||
Q_strncpy( pmove->physinfo, cls.physinfo, MAX_INFO_STRING );
|
Q_strncpy( pmove->physinfo, cls.physinfo, sizeof( pmove->physinfo ));
|
||||||
}
|
}
|
||||||
|
|
||||||
const void CL_FinishPMove( const playermove_t *pmove, local_state_t *to )
|
static const void CL_FinishPMove( const playermove_t *pmove, local_state_t *to )
|
||||||
{
|
{
|
||||||
entity_state_t *ps;
|
entity_state_t *ps;
|
||||||
clientdata_t *cd;
|
clientdata_t *cd;
|
||||||
@@ -929,7 +909,7 @@ CL_RunUsercmd
|
|||||||
Runs prediction code for user cmd
|
Runs prediction code for user cmd
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void CL_RunUsercmd( local_state_t *from, local_state_t *to, usercmd_t *u, qboolean runfuncs, double *time, unsigned int random_seed )
|
static void CL_RunUsercmd( local_state_t *from, local_state_t *to, usercmd_t *u, qboolean runfuncs, double *time, unsigned int random_seed )
|
||||||
{
|
{
|
||||||
usercmd_t cmd;
|
usercmd_t cmd;
|
||||||
|
|
||||||
|
|||||||
@@ -22,22 +22,24 @@ GNU General Public License for more details.
|
|||||||
#include "hltv.h"
|
#include "hltv.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#define STAT_HEALTH 0
|
enum {
|
||||||
#define STAT_FRAGS 1
|
STAT_HEALTH = 0,
|
||||||
#define STAT_WEAPON 2
|
STAT_FRAGS,
|
||||||
#define STAT_AMMO 3
|
STAT_WEAPON,
|
||||||
#define STAT_ARMOR 4
|
STAT_AMMO,
|
||||||
#define STAT_WEAPONFRAME 5
|
STAT_ARMOR,
|
||||||
#define STAT_SHELLS 6
|
STAT_WEAPONFRAME,
|
||||||
#define STAT_NAILS 7
|
STAT_SHELLS,
|
||||||
#define STAT_ROCKETS 8
|
STAT_NAILS,
|
||||||
#define STAT_CELLS 9
|
STAT_ROCKETS,
|
||||||
#define STAT_ACTIVEWEAPON 10
|
STAT_CELLS,
|
||||||
#define STAT_TOTALSECRETS 11
|
STAT_ACTIVEWEAPON,
|
||||||
#define STAT_TOTALMONSTERS 12
|
STAT_TOTALSECRETS,
|
||||||
#define STAT_SECRETS 13 // bumped on client side by svc_foundsecret
|
STAT_TOTALMONSTERS,
|
||||||
#define STAT_MONSTERS 14 // bumped by svc_killedmonster
|
STAT_SECRETS, // bumped on client side by svc_foundsecret
|
||||||
#define MAX_STATS 32
|
STAT_MONSTERS, // bumped by svc_killedmonster
|
||||||
|
MAX_STATS = 32,
|
||||||
|
};
|
||||||
|
|
||||||
static char cmd_buf[8192];
|
static char cmd_buf[8192];
|
||||||
static char msg_buf[8192];
|
static char msg_buf[8192];
|
||||||
@@ -211,7 +213,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
|||||||
clgame.maxEntities = GI->max_edicts;
|
clgame.maxEntities = GI->max_edicts;
|
||||||
clgame.maxEntities = bound( 600, clgame.maxEntities, MAX_EDICTS );
|
clgame.maxEntities = bound( 600, clgame.maxEntities, MAX_EDICTS );
|
||||||
clgame.maxModels = MAX_MODELS;
|
clgame.maxModels = MAX_MODELS;
|
||||||
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), MAX_STRING );
|
Q_strncpy( clgame.maptitle, MSG_ReadString( msg ), sizeof( clgame.maptitle ));
|
||||||
|
|
||||||
// Re-init hud video, especially if we changed game directories
|
// Re-init hud video, especially if we changed game directories
|
||||||
clgame.dllFuncs.pfnVidInit();
|
clgame.dllFuncs.pfnVidInit();
|
||||||
@@ -328,7 +330,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
|||||||
clgame.movevars.gravity = 800.0f; // quake doesn't write gravity in demos
|
clgame.movevars.gravity = 800.0f; // quake doesn't write gravity in demos
|
||||||
clgame.movevars.maxvelocity = 2000.0f;
|
clgame.movevars.maxvelocity = 2000.0f;
|
||||||
|
|
||||||
memcpy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t ));
|
clgame.oldmovevars = clgame.movevars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -414,7 +416,7 @@ If an entities model or origin changes from frame to frame, it must be
|
|||||||
relinked. Other attributes can change without relinking.
|
relinked. Other attributes can change without relinking.
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
static void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
||||||
{
|
{
|
||||||
int i, newnum, pack;
|
int i, newnum, pack;
|
||||||
qboolean forcelink;
|
qboolean forcelink;
|
||||||
@@ -429,7 +431,7 @@ void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
|
|||||||
cls.signon = SIGNONS;
|
cls.signon = SIGNONS;
|
||||||
|
|
||||||
// Clear loading plaque.
|
// Clear loading plaque.
|
||||||
CL_SignonReply ();
|
CL_SignonReply( PROTO_QUAKE );
|
||||||
}
|
}
|
||||||
|
|
||||||
// alloc next slot to store update
|
// alloc next slot to store update
|
||||||
@@ -565,7 +567,7 @@ CL_ParseQuakeParticles
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ParseQuakeParticle( sizebuf_t *msg )
|
static void CL_ParseQuakeParticle( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int count, color;
|
int count, color;
|
||||||
vec3_t org, dir;
|
vec3_t org, dir;
|
||||||
@@ -587,7 +589,7 @@ CL_ParseQuakeStaticSound
|
|||||||
|
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void CL_ParseQuakeStaticSound( sizebuf_t *msg )
|
static void CL_ParseQuakeStaticSound( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int sound_num;
|
int sound_num;
|
||||||
float vol, attn;
|
float vol, attn;
|
||||||
@@ -620,7 +622,7 @@ static void CL_ParseQuakeDamage( sizebuf_t *msg )
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
===================
|
===================
|
||||||
CL_ParseQuakeStaticEntity
|
CL_ParseStaticEntity
|
||||||
|
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
@@ -646,7 +648,7 @@ static void CL_ParseQuakeStaticEntity( sizebuf_t *msg )
|
|||||||
i = clgame.numStatics;
|
i = clgame.numStatics;
|
||||||
if( i >= MAX_STATIC_ENTITIES )
|
if( i >= MAX_STATIC_ENTITIES )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "CL_ParseStaticEntity: static entities limit exceeded!\n" );
|
Con_Printf( S_ERROR "%s: static entities limit exceeded!\n", __func__ );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -697,7 +699,7 @@ static void CL_ParseQuakeBaseline( sizebuf_t *msg )
|
|||||||
newnum = MSG_ReadWord( msg ); // entnum
|
newnum = MSG_ReadWord( msg ); // entnum
|
||||||
|
|
||||||
if( newnum >= clgame.maxEntities )
|
if( newnum >= clgame.maxEntities )
|
||||||
Host_Error( "CL_AllocEdict: no free edicts\n" );
|
Host_Error( "%s: no free edicts\n", __func__ );
|
||||||
|
|
||||||
// parse baseline
|
// parse baseline
|
||||||
memset( &state, 0, sizeof( state ));
|
memset( &state, 0, sizeof( state ));
|
||||||
@@ -715,8 +717,7 @@ static void CL_ParseQuakeBaseline( sizebuf_t *msg )
|
|||||||
ent = CL_EDICT_NUM( newnum );
|
ent = CL_EDICT_NUM( newnum );
|
||||||
ent->index = newnum;
|
ent->index = newnum;
|
||||||
ent->player = CL_IsPlayerIndex( newnum );
|
ent->player = CL_IsPlayerIndex( newnum );
|
||||||
memcpy( &ent->baseline, &state, sizeof( entity_state_t ));
|
ent->prevstate = ent->baseline = state;
|
||||||
memcpy( &ent->prevstate, &state, sizeof( entity_state_t ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -778,7 +779,7 @@ static void CL_ParseQuakeSignon( sizebuf_t *msg )
|
|||||||
int i = MSG_ReadByte( msg );
|
int i = MSG_ReadByte( msg );
|
||||||
|
|
||||||
if( i == 3 ) cls.signon = SIGNONS - 1;
|
if( i == 3 ) cls.signon = SIGNONS - 1;
|
||||||
Con_Reportf( "CL_Signon: %d\n", i );
|
Con_Reportf( "%s: %d\n", __func__, i );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -816,7 +817,7 @@ CL_QuakeStuffText
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_QuakeStuffText( const char *text )
|
static void CL_QuakeStuffText( const char *text )
|
||||||
{
|
{
|
||||||
Q_strncat( cmd_buf, text, sizeof( cmd_buf ));
|
Q_strncat( cmd_buf, text, sizeof( cmd_buf ));
|
||||||
|
|
||||||
@@ -831,7 +832,7 @@ CL_QuakeExecStuff
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_QuakeExecStuff( void )
|
static void CL_QuakeExecStuff( void )
|
||||||
{
|
{
|
||||||
char *text = cmd_buf;
|
char *text = cmd_buf;
|
||||||
char token[256];
|
char token[256];
|
||||||
@@ -886,38 +887,21 @@ CL_ParseQuakeMessage
|
|||||||
|
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
|
void CL_ParseQuakeMessage( sizebuf_t *msg )
|
||||||
{
|
{
|
||||||
int cmd, param1, param2;
|
int cmd, param1, param2;
|
||||||
size_t bufStart;
|
size_t bufStart;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
cls.starting_count = MSG_GetNumBytesRead( msg ); // updates each frame
|
|
||||||
CL_Parse_Debug( true ); // begin parsing
|
|
||||||
|
|
||||||
// init excise buffer
|
// init excise buffer
|
||||||
MSG_Init( &msg_demo, "UserMsg", msg_buf, sizeof( msg_buf ));
|
MSG_Init( &msg_demo, "UserMsg", msg_buf, sizeof( msg_buf ));
|
||||||
|
|
||||||
if( normal_message )
|
|
||||||
{
|
|
||||||
// assume no entity/player update this packet
|
|
||||||
if( cls.state == ca_active )
|
|
||||||
{
|
|
||||||
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].valid = false;
|
|
||||||
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CL_ResetFrame( &cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse the message
|
// parse the message
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
if( MSG_CheckOverflow( msg ))
|
if( MSG_CheckOverflow( msg ))
|
||||||
{
|
{
|
||||||
Host_Error( "CL_ParseServerMessage: overflow!\n" );
|
Host_Error( "%s: overflow!\n", __func__ );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -966,7 +950,7 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
break;
|
break;
|
||||||
case svc_time:
|
case svc_time:
|
||||||
Cbuf_AddText( "\n" ); // new frame was started
|
Cbuf_AddText( "\n" ); // new frame was started
|
||||||
CL_ParseServerTime( msg );
|
CL_ParseServerTime( msg, PROTO_QUAKE );
|
||||||
break;
|
break;
|
||||||
case svc_print:
|
case svc_print:
|
||||||
str = MSG_ReadString( msg );
|
str = MSG_ReadString( msg );
|
||||||
@@ -1108,14 +1092,11 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error( "CL_ParseServerMessage: Illegible server message\n" );
|
Host_Error( "%s: Illegible server message\n", __func__ );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cl.frames[cl.parsecountmod].graphdata.msgbytes += MSG_GetNumBytesRead( msg ) - cls.starting_count;
|
|
||||||
CL_Parse_Debug( false ); // done
|
|
||||||
|
|
||||||
// now process packet.
|
// now process packet.
|
||||||
CL_ProcessPacket( &cl.frames[cl.parsecountmod] );
|
CL_ProcessPacket( &cl.frames[cl.parsecountmod] );
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis )
|
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis )
|
||||||
{
|
{
|
||||||
return Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis );
|
return Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
lightstyle_t *CL_GetLightStyle( int number )
|
lightstyle_t *CL_GetLightStyle( int number )
|
||||||
@@ -126,7 +126,7 @@ CL_GenericHandle
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
const char *CL_GenericHandle( int fileindex )
|
static const char *CL_GenericHandle( int fileindex )
|
||||||
{
|
{
|
||||||
if( fileindex < 0 || fileindex >= MAX_CUSTOM )
|
if( fileindex < 0 || fileindex >= MAX_CUSTOM )
|
||||||
return 0;
|
return 0;
|
||||||
@@ -142,8 +142,6 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
|||||||
return 1;
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
case PARM_SKY_SPHERE:
|
|
||||||
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
|
||||||
case PARAM_GAMEPAUSED:
|
case PARAM_GAMEPAUSED:
|
||||||
return cl.paused;
|
return cl.paused;
|
||||||
case PARM_CLIENT_INGAME:
|
case PARM_CLIENT_INGAME:
|
||||||
@@ -172,6 +170,12 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
|||||||
return refState.width;
|
return refState.width;
|
||||||
case PARM_SCREEN_HEIGHT:
|
case PARM_SCREEN_HEIGHT:
|
||||||
return refState.height;
|
return refState.height;
|
||||||
|
case PARM_SKY_SPHERE:
|
||||||
|
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
||||||
|
case PARM_SURF_SAMPLESIZE:
|
||||||
|
if( arg >= 0 && arg < cl.worldmodel->numsurfaces )
|
||||||
|
return Mod_SampleSizeForFace( &cl.worldmodel->surfaces[arg] );
|
||||||
|
return LM_SAMPLE_SIZE;
|
||||||
default:
|
default:
|
||||||
// indicates call from client.dll
|
// indicates call from client.dll
|
||||||
if( checkRef )
|
if( checkRef )
|
||||||
@@ -187,28 +191,30 @@ intptr_t CL_RenderGetParm( const int parm, const int arg, const qboolean checkRe
|
|||||||
return CL_IsThirdPerson();
|
return CL_IsThirdPerson();
|
||||||
case PARM_QUAKE_COMPATIBLE:
|
case PARM_QUAKE_COMPATIBLE:
|
||||||
return Host_IsQuakeCompatible();
|
return Host_IsQuakeCompatible();
|
||||||
case PARM_PLAYER_INDEX:
|
|
||||||
return cl.playernum + 1;
|
|
||||||
case PARM_VIEWENT_INDEX:
|
|
||||||
return cl.viewentity;
|
|
||||||
case PARM_CONNSTATE:
|
case PARM_CONNSTATE:
|
||||||
return (int)cls.state;
|
return (int)cls.state;
|
||||||
case PARM_PLAYING_DEMO:
|
case PARM_PLAYING_DEMO:
|
||||||
return cls.demoplayback;
|
return cls.demoplayback;
|
||||||
case PARM_WATER_LEVEL:
|
case PARM_WATER_LEVEL:
|
||||||
return cl.local.waterlevel;
|
return cl.local.waterlevel;
|
||||||
case PARM_MAX_CLIENTS:
|
|
||||||
return cl.maxclients;
|
|
||||||
case PARM_LOCAL_HEALTH:
|
case PARM_LOCAL_HEALTH:
|
||||||
return cl.local.health;
|
return cl.local.health;
|
||||||
case PARM_LOCAL_GAME:
|
case PARM_LOCAL_GAME:
|
||||||
return Host_IsLocalGame();
|
return Host_IsLocalGame();
|
||||||
case PARM_NUMENTITIES:
|
case PARM_NUMENTITIES:
|
||||||
return pfnNumberOfEntities();
|
return pfnNumberOfEntities();
|
||||||
case PARM_NUMMODELS:
|
case PARM_GET_CLIENT_PTR:
|
||||||
return cl.nummodels;
|
return (intptr_t)&cl.time; // with the offset
|
||||||
case PARM_WORLD_VERSION:
|
case PARM_GET_HOST_PTR:
|
||||||
return world.version;
|
return (intptr_t)&host.realtime; // with the offset
|
||||||
|
case PARM_GET_WORLD_PTR:
|
||||||
|
return (intptr_t)&world;
|
||||||
|
case PARM_GET_MOVEVARS_PTR:
|
||||||
|
return (intptr_t)&clgame.movevars;
|
||||||
|
case PARM_GET_PALETTE_PTR:
|
||||||
|
return (intptr_t)&clgame.palette;
|
||||||
|
case PARM_GET_VIEWENT_PTR:
|
||||||
|
return (intptr_t)&clgame.viewent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -341,7 +347,7 @@ qboolean R_InitRenderAPI( void )
|
|||||||
{
|
{
|
||||||
if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs ))
|
if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs ))
|
||||||
{
|
{
|
||||||
Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
|
Con_Reportf( "%s: ^2initailized extended RenderAPI ^7ver. %i\n", __func__, CL_RENDER_INTERFACE_VERSION );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ CVAR_DEFINE_AUTO( scr_centertime, "2.5", 0, "centerprint hold time" );
|
|||||||
CVAR_DEFINE_AUTO( scr_loading, "0", 0, "loading bar progress" );
|
CVAR_DEFINE_AUTO( scr_loading, "0", 0, "loading bar progress" );
|
||||||
CVAR_DEFINE_AUTO( scr_download, "-1", 0, "downloading bar progress" );
|
CVAR_DEFINE_AUTO( scr_download, "-1", 0, "downloading bar progress" );
|
||||||
CVAR_DEFINE( scr_viewsize, "viewsize", "120", FCVAR_ARCHIVE, "screen size (quake only)" );
|
CVAR_DEFINE( scr_viewsize, "viewsize", "120", FCVAR_ARCHIVE, "screen size (quake only)" );
|
||||||
CVAR_DEFINE_AUTO( cl_testlights, "0", 0, "test dynamic lights" );
|
CVAR_DEFINE_AUTO( cl_testlights, "0", FCVAR_CHEAT, "test dynamic lights" );
|
||||||
CVAR_DEFINE( cl_allow_levelshots, "allow_levelshots", "0", FCVAR_ARCHIVE, "allow engine to use indivdual levelshots instead of 'loading' image" );
|
CVAR_DEFINE( cl_allow_levelshots, "allow_levelshots", "0", FCVAR_ARCHIVE, "allow engine to use indivdual levelshots instead of 'loading' image" );
|
||||||
CVAR_DEFINE_AUTO( cl_levelshot_name, "*black", 0, "contains path to current levelshot" );
|
CVAR_DEFINE_AUTO( cl_levelshot_name, "*black", 0, "contains path to current levelshot" );
|
||||||
static CVAR_DEFINE_AUTO( cl_envshot_size, "256", FCVAR_ARCHIVE, "envshot size of cube side" );
|
static CVAR_DEFINE_AUTO( cl_envshot_size, "256", FCVAR_ARCHIVE, "envshot size of cube side" );
|
||||||
@@ -32,6 +32,7 @@ CVAR_DEFINE_AUTO( v_dark, "0", 0, "starts level from dark screen" );
|
|||||||
static CVAR_DEFINE_AUTO( net_speeds, "0", FCVAR_ARCHIVE, "show network packets" );
|
static CVAR_DEFINE_AUTO( net_speeds, "0", FCVAR_ARCHIVE, "show network packets" );
|
||||||
static CVAR_DEFINE_AUTO( cl_showfps, "0", FCVAR_ARCHIVE, "show client fps" );
|
static CVAR_DEFINE_AUTO( cl_showfps, "0", FCVAR_ARCHIVE, "show client fps" );
|
||||||
static CVAR_DEFINE_AUTO( cl_showpos, "0", FCVAR_ARCHIVE, "show local player position and velocity" );
|
static CVAR_DEFINE_AUTO( cl_showpos, "0", FCVAR_ARCHIVE, "show local player position and velocity" );
|
||||||
|
static CVAR_DEFINE_AUTO( cl_showents, "0", FCVAR_ARCHIVE | FCVAR_CHEAT, "show entities information (largely undone)" );
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -122,7 +123,7 @@ void SCR_DrawPos( void )
|
|||||||
if( cls.state != ca_active || !cl_showpos.value || cl.background )
|
if( cls.state != ca_active || !cl_showpos.value || cl.background )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ent = CL_GetLocalPlayer();
|
ent = CL_EDICT_NUM( cl.playernum + 1 );
|
||||||
speed = VectorLength( cl.simvel );
|
speed = VectorLength( cl.simvel );
|
||||||
|
|
||||||
Q_snprintf( msg, MAX_SYSPATH,
|
Q_snprintf( msg, MAX_SYSPATH,
|
||||||
@@ -140,6 +141,68 @@ void SCR_DrawPos( void )
|
|||||||
Con_DrawString( refState.width / 2, 4, msg, color );
|
Con_DrawString( refState.width / 2, 4, msg, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
SCR_DrawEnts
|
||||||
|
==============
|
||||||
|
*/
|
||||||
|
void SCR_DrawEnts( void )
|
||||||
|
{
|
||||||
|
rgba_t color = { 255, 255, 255, 255 };
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( cls.state != ca_active || !cl_showents.value || ( cl.maxclients > 1 && !cls.demoplayback ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// this probably better hook CL_AddVisibleEntities
|
||||||
|
// as entities might get added by client.dll
|
||||||
|
for( i = 0; i < clgame.maxEntities; i++ )
|
||||||
|
{
|
||||||
|
const cl_entity_t *ent = &clgame.entities[i];
|
||||||
|
string msg;
|
||||||
|
vec3_t screen, pos;
|
||||||
|
|
||||||
|
if( ent->curstate.messagenum != cl.parsecount )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
VectorCopy( ent->origin, pos );
|
||||||
|
|
||||||
|
if( ent->model != NULL )
|
||||||
|
{
|
||||||
|
vec3_t v;
|
||||||
|
|
||||||
|
// simple model type filter
|
||||||
|
if( cl_showents.value > 1 )
|
||||||
|
{
|
||||||
|
if( ent->model->type != (modtype_t)( cl_showents.value - 2 ))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
VectorAverage( ent->model->mins, ent->model->maxs, v );
|
||||||
|
VectorAdd( pos, v, pos );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !ref.dllFuncs.WorldToScreen( pos, screen ))
|
||||||
|
{
|
||||||
|
Q_snprintf( msg, sizeof( msg ),
|
||||||
|
"entity %d\n"
|
||||||
|
"model %s\n"
|
||||||
|
"movetype %d\n",
|
||||||
|
ent->index,
|
||||||
|
ent->model ? ent->model->name : "(null)",
|
||||||
|
ent->curstate.movetype );
|
||||||
|
|
||||||
|
screen[0] = 0.5f * screen[0] * refState.width;
|
||||||
|
screen[1] = -0.5f * screen[1] * refState.height;
|
||||||
|
screen[0] += 0.5f * refState.width;
|
||||||
|
screen[1] += 0.5f * refState.height;
|
||||||
|
|
||||||
|
|
||||||
|
Con_DrawString( screen[0], screen[1], msg, color );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
SCR_NetSpeeds
|
SCR_NetSpeeds
|
||||||
@@ -252,7 +315,7 @@ VID_WriteOverviewScript
|
|||||||
Create overview script file
|
Create overview script file
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void VID_WriteOverviewScript( void )
|
static void VID_WriteOverviewScript( void )
|
||||||
{
|
{
|
||||||
ref_overview_t *ov = &clgame.overView;
|
ref_overview_t *ov = &clgame.overView;
|
||||||
string filename;
|
string filename;
|
||||||
@@ -288,10 +351,15 @@ void SCR_MakeScreenShot( void )
|
|||||||
qboolean iRet = false;
|
qboolean iRet = false;
|
||||||
int viewsize;
|
int viewsize;
|
||||||
|
|
||||||
|
if( cls.scrshot_action == scrshot_inactive )
|
||||||
|
return;
|
||||||
|
|
||||||
if( cls.envshot_viewsize > 0 )
|
if( cls.envshot_viewsize > 0 )
|
||||||
viewsize = cls.envshot_viewsize;
|
viewsize = cls.envshot_viewsize;
|
||||||
else viewsize = cl_envshot_size.value;
|
else viewsize = cl_envshot_size.value;
|
||||||
|
|
||||||
|
V_CheckGamma();
|
||||||
|
|
||||||
switch( cls.scrshot_action )
|
switch( cls.scrshot_action )
|
||||||
{
|
{
|
||||||
case scrshot_normal:
|
case scrshot_normal:
|
||||||
@@ -317,8 +385,6 @@ void SCR_MakeScreenShot( void )
|
|||||||
if( iRet )
|
if( iRet )
|
||||||
VID_WriteOverviewScript(); // store overview script too
|
VID_WriteOverviewScript(); // store overview script too
|
||||||
break;
|
break;
|
||||||
case scrshot_inactive:
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// report
|
// report
|
||||||
@@ -342,7 +408,7 @@ void SCR_MakeScreenShot( void )
|
|||||||
SCR_DrawPlaque
|
SCR_DrawPlaque
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void SCR_DrawPlaque( void )
|
static qboolean SCR_DrawPlaque( void )
|
||||||
{
|
{
|
||||||
if(( cl_allow_levelshots.value && !cls.changelevel ) || cl.background )
|
if(( cl_allow_levelshots.value && !cls.changelevel ) || cl.background )
|
||||||
{
|
{
|
||||||
@@ -350,7 +416,11 @@ void SCR_DrawPlaque( void )
|
|||||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||||
ref.dllFuncs.R_DrawStretchPic( 0, 0, refState.width, refState.height, 0, 0, 1, 1, levelshot );
|
ref.dllFuncs.R_DrawStretchPic( 0, 0, refState.width, refState.height, 0, 0, 1, 1, levelshot );
|
||||||
if( !cl.background ) CL_DrawHUD( CL_LOADING );
|
if( !cl.background ) CL_DrawHUD( CL_LOADING );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -360,15 +430,10 @@ SCR_BeginLoadingPlaque
|
|||||||
*/
|
*/
|
||||||
void SCR_BeginLoadingPlaque( qboolean is_background )
|
void SCR_BeginLoadingPlaque( qboolean is_background )
|
||||||
{
|
{
|
||||||
float oldclear = 0;;
|
|
||||||
S_StopAllSounds( true );
|
S_StopAllSounds( true );
|
||||||
cl.audio_prepped = false; // don't play ambients
|
cl.audio_prepped = false; // don't play ambients
|
||||||
cl.video_prepped = false;
|
|
||||||
|
|
||||||
if( !Host_IsDedicated() )
|
if( cls.key_dest == key_menu && !cls.changedemo && !is_background )
|
||||||
oldclear = gl_clear.value;
|
|
||||||
|
|
||||||
if( CL_IsInMenu( ) && !cls.changedemo && !is_background )
|
|
||||||
{
|
{
|
||||||
UI_SetActiveMenu( false );
|
UI_SetActiveMenu( false );
|
||||||
if( cls.state == ca_disconnected && !(GameState->curstate == STATE_RUNFRAME && GameState->nextstate != STATE_RUNFRAME) )
|
if( cls.state == ca_disconnected && !(GameState->curstate == STATE_RUNFRAME && GameState->nextstate != STATE_RUNFRAME) )
|
||||||
@@ -381,18 +446,15 @@ void SCR_BeginLoadingPlaque( qboolean is_background )
|
|||||||
if( cls.key_dest == key_console )
|
if( cls.key_dest == key_console )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !Host_IsDedicated() )
|
|
||||||
gl_clear.value = 0.0f;
|
|
||||||
|
|
||||||
if( is_background ) IN_MouseSavePos( );
|
if( is_background ) IN_MouseSavePos( );
|
||||||
cls.draw_changelevel = !is_background;
|
cls.draw_changelevel = !is_background;
|
||||||
SCR_UpdateScreen();
|
SCR_UpdateScreen();
|
||||||
|
|
||||||
|
// set video_prepped after update screen, so engine can draw last remaining frame
|
||||||
|
cl.video_prepped = false;
|
||||||
cls.disable_screen = host.realtime;
|
cls.disable_screen = host.realtime;
|
||||||
cl.background = is_background; // set right state before svc_serverdata is came
|
cl.background = is_background; // set right state before svc_serverdata is came
|
||||||
|
|
||||||
if( !Host_IsDedicated() )
|
|
||||||
gl_clear.value = oldclear;
|
|
||||||
|
|
||||||
// SNDDMA_LockSound();
|
// SNDDMA_LockSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -413,7 +475,7 @@ void SCR_EndLoadingPlaque( void )
|
|||||||
SCR_AddDirtyPoint
|
SCR_AddDirtyPoint
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void SCR_AddDirtyPoint( int x, int y )
|
static void SCR_AddDirtyPoint( int x, int y )
|
||||||
{
|
{
|
||||||
if( x < scr_dirty.x1 ) scr_dirty.x1 = x;
|
if( x < scr_dirty.x1 ) scr_dirty.x1 = x;
|
||||||
if( x > scr_dirty.x2 ) scr_dirty.x2 = x;
|
if( x > scr_dirty.x2 ) scr_dirty.x2 = x;
|
||||||
@@ -442,7 +504,7 @@ void SCR_TileClear( void )
|
|||||||
int i, top, bottom, left, right;
|
int i, top, bottom, left, right;
|
||||||
dirty_t clear;
|
dirty_t clear;
|
||||||
|
|
||||||
if( scr_viewsize.value >= 120 )
|
if( likely( scr_viewsize.value >= 120 ))
|
||||||
return; // full screen rendering
|
return; // full screen rendering
|
||||||
|
|
||||||
// erase rect will be the union of the past three frames
|
// erase rect will be the union of the past three frames
|
||||||
@@ -520,6 +582,8 @@ text to the screen.
|
|||||||
*/
|
*/
|
||||||
void SCR_UpdateScreen( void )
|
void SCR_UpdateScreen( void )
|
||||||
{
|
{
|
||||||
|
qboolean screen_redraw = true; // assume screen has been redrawn
|
||||||
|
|
||||||
if( !V_PreRender( )) return;
|
if( !V_PreRender( )) return;
|
||||||
|
|
||||||
switch( cls.state )
|
switch( cls.state )
|
||||||
@@ -530,7 +594,7 @@ void SCR_UpdateScreen( void )
|
|||||||
case ca_connecting:
|
case ca_connecting:
|
||||||
case ca_connected:
|
case ca_connected:
|
||||||
case ca_validate:
|
case ca_validate:
|
||||||
SCR_DrawPlaque();
|
screen_redraw = SCR_DrawPlaque();
|
||||||
break;
|
break;
|
||||||
case ca_active:
|
case ca_active:
|
||||||
Con_RunConsole ();
|
Con_RunConsole ();
|
||||||
@@ -540,10 +604,14 @@ void SCR_UpdateScreen( void )
|
|||||||
SCR_DrawCinematic();
|
SCR_DrawCinematic();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error( "SCR_UpdateScreen: bad cls.state\n" );
|
Host_Error( "%s: bad cls.state\n", __func__ );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// during changelevel we might have a few frames when we have nothing to draw
|
||||||
|
// (assuming levelshots are off) and drawing 2d on top of nothing or cleared screen
|
||||||
|
// is ugly, specifically with Adreno and ImgTec GPUs
|
||||||
|
if( screen_redraw || !cls.changelevel || !cls.changedemo )
|
||||||
V_PostRender();
|
V_PostRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,15 +638,15 @@ void SCR_LoadCreditsFont( void )
|
|||||||
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
"creditsfont_%s.fnt", Cvar_VariableString( "con_charset" )) > 0 )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( charsetFnt, false ))
|
if( FS_FileExists( charsetFnt, false ))
|
||||||
success = Con_LoadVariableWidthFont( charsetFnt, font, scale, kRenderTransAdd, TF_FONT );
|
success = Con_LoadVariableWidthFont( charsetFnt, font, scale, &hud_fontrender, TF_FONT );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
success = Con_LoadVariableWidthFont( "gfx/creditsfont.fnt", font, scale, kRenderTransAdd, TF_FONT );
|
success = Con_LoadVariableWidthFont( "gfx/creditsfont.fnt", font, scale, &hud_fontrender, TF_FONT );
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
success = Con_LoadFixedWidthFont( "gfx/conchars", font, scale, kRenderTransAdd, TF_FONT );
|
success = Con_LoadFixedWidthFont( "gfx/conchars", font, scale, &hud_fontrender, TF_FONT );
|
||||||
|
|
||||||
// copy font size for client.dll
|
// copy font size for client.dll
|
||||||
if( success )
|
if( success )
|
||||||
@@ -600,7 +668,7 @@ SCR_InstallParticlePalette
|
|||||||
INTERNAL RESOURCE
|
INTERNAL RESOURCE
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void SCR_InstallParticlePalette( void )
|
static void SCR_InstallParticlePalette( void )
|
||||||
{
|
{
|
||||||
rgbdata_t *pic;
|
rgbdata_t *pic;
|
||||||
int i;
|
int i;
|
||||||
@@ -646,21 +714,21 @@ void SCR_RegisterTextures( void )
|
|||||||
// register gfx.wad images
|
// register gfx.wad images
|
||||||
|
|
||||||
if( FS_FileExists( "gfx/paused.lmp", false ))
|
if( FS_FileExists( "gfx/paused.lmp", false ))
|
||||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE );
|
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||||
else if( FS_FileExists( "gfx/pause.lmp", false ))
|
else if( FS_FileExists( "gfx/pause.lmp", false ))
|
||||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE );
|
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||||
|
|
||||||
if( FS_FileExists( "gfx/lambda.lmp", false ))
|
if( FS_FileExists( "gfx/lambda.lmp", false ))
|
||||||
{
|
{
|
||||||
if( cl_allow_levelshots.value )
|
if( cl_allow_levelshots.value )
|
||||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE|TF_ALLOW_NEAREST );
|
||||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE );
|
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||||
}
|
}
|
||||||
else if( FS_FileExists( "gfx/loading.lmp", false ))
|
else if( FS_FileExists( "gfx/loading.lmp", false ))
|
||||||
{
|
{
|
||||||
if( cl_allow_levelshots.value )
|
if( cl_allow_levelshots.value )
|
||||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE|TF_ALLOW_NEAREST );
|
||||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE );
|
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_ALLOW_NEAREST );
|
||||||
}
|
}
|
||||||
|
|
||||||
cls.tileImage = ref.dllFuncs.GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
|
cls.tileImage = ref.dllFuncs.GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
|
||||||
@@ -673,7 +741,7 @@ SCR_SizeUp_f
|
|||||||
Keybinding command
|
Keybinding command
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void SCR_SizeUp_f( void )
|
static void SCR_SizeUp_f( void )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "viewsize", Q_min( scr_viewsize.value + 10, 120 ));
|
Cvar_SetValue( "viewsize", Q_min( scr_viewsize.value + 10, 120 ));
|
||||||
}
|
}
|
||||||
@@ -686,7 +754,7 @@ SCR_SizeDown_f
|
|||||||
Keybinding command
|
Keybinding command
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void SCR_SizeDown_f( void )
|
static void SCR_SizeDown_f( void )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "viewsize", Q_max( scr_viewsize.value - 10, 30 ));
|
Cvar_SetValue( "viewsize", Q_max( scr_viewsize.value - 10, 30 ));
|
||||||
}
|
}
|
||||||
@@ -750,6 +818,9 @@ void SCR_Init( void )
|
|||||||
Cvar_RegisterVariable( &net_speeds );
|
Cvar_RegisterVariable( &net_speeds );
|
||||||
Cvar_RegisterVariable( &cl_showfps );
|
Cvar_RegisterVariable( &cl_showfps );
|
||||||
Cvar_RegisterVariable( &cl_showpos );
|
Cvar_RegisterVariable( &cl_showpos );
|
||||||
|
#ifdef _DEBUG
|
||||||
|
Cvar_RegisterVariable( &cl_showents );
|
||||||
|
#endif // NDEBUG
|
||||||
|
|
||||||
// register our commands
|
// register our commands
|
||||||
Cmd_AddCommand( "skyname", CL_SetSky_f, "set new skybox by basename" );
|
Cmd_AddCommand( "skyname", CL_SetSky_f, "set new skybox by basename" );
|
||||||
@@ -782,7 +853,6 @@ void SCR_Shutdown( void )
|
|||||||
{
|
{
|
||||||
if( !scr_init ) return;
|
if( !scr_init ) return;
|
||||||
|
|
||||||
Cmd_RemoveCommand( "timerefresh" );
|
|
||||||
Cmd_RemoveCommand( "skyname" );
|
Cmd_RemoveCommand( "skyname" );
|
||||||
Cmd_RemoveCommand( "viewpos" );
|
Cmd_RemoveCommand( "viewpos" );
|
||||||
UI_SetActiveMenu( false );
|
UI_SetActiveMenu( false );
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -77,11 +77,9 @@ void R_MultiGunshot( const vec3_t org, const vec3_t dir, const vec3_t noise, int
|
|||||||
void R_FireField( float *org, int radius, int modelIndex, int count, int flags, float life );
|
void R_FireField( float *org, int radius, int modelIndex, int count, int flags, float life );
|
||||||
void R_PlayerSprites( int client, int modelIndex, int count, int size );
|
void R_PlayerSprites( int client, int modelIndex, int count, int size );
|
||||||
void R_Sprite_WallPuff( struct tempent_s *pTemp, float scale );
|
void R_Sprite_WallPuff( struct tempent_s *pTemp, float scale );
|
||||||
void R_DebugParticle( const vec3_t pos, byte r, byte g, byte b );
|
|
||||||
void R_RicochetSound( const vec3_t pos );
|
void R_RicochetSound( const vec3_t pos );
|
||||||
struct dlight_s *CL_AllocDlight( int key );
|
struct dlight_s *CL_AllocDlight( int key );
|
||||||
struct dlight_s *CL_AllocElight( int key );
|
struct dlight_s *CL_AllocElight( int key );
|
||||||
void CL_UpdateFlashlight( cl_entity_t *pEnt );
|
|
||||||
void CL_AddEntityEffects( cl_entity_t *ent );
|
void CL_AddEntityEffects( cl_entity_t *ent );
|
||||||
void CL_AddModelEffects( cl_entity_t *ent );
|
void CL_AddModelEffects( cl_entity_t *ent );
|
||||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ qboolean SCR_NextMovie( void )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SCR_CreateStartupVids( void )
|
static void SCR_CreateStartupVids( void )
|
||||||
{
|
{
|
||||||
file_t *f;
|
file_t *f;
|
||||||
|
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ V_CalcViewRect
|
|||||||
calc frame rectangle (Quake1 style)
|
calc frame rectangle (Quake1 style)
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void V_CalcViewRect( void )
|
static void V_CalcViewRect( void )
|
||||||
{
|
{
|
||||||
qboolean full = false;
|
qboolean full = false;
|
||||||
int sb_lines;
|
int sb_lines;
|
||||||
float size;
|
float size;
|
||||||
|
|
||||||
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
if( Host_IsQuakeCompatible( ))
|
||||||
{
|
{
|
||||||
// intermission is always full screen
|
// intermission is always full screen
|
||||||
if( cl.intermission ) size = 120.0f;
|
if( cl.intermission ) size = 120.0f;
|
||||||
@@ -88,7 +88,7 @@ void V_CalcViewRect( void )
|
|||||||
V_SetupViewModel
|
V_SetupViewModel
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void V_SetupViewModel( void )
|
static void V_SetupViewModel( void )
|
||||||
{
|
{
|
||||||
cl_entity_t *view = &clgame.viewent;
|
cl_entity_t *view = &clgame.viewent;
|
||||||
player_info_t *info = &cl.players[cl.playernum];
|
player_info_t *info = &cl.players[cl.playernum];
|
||||||
@@ -118,7 +118,7 @@ void V_SetupViewModel( void )
|
|||||||
V_SetRefParams
|
V_SetRefParams
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void V_SetRefParams( ref_params_t *fd )
|
static void V_SetRefParams( ref_params_t *fd )
|
||||||
{
|
{
|
||||||
memset( fd, 0, sizeof( ref_params_t ));
|
memset( fd, 0, sizeof( ref_params_t ));
|
||||||
|
|
||||||
@@ -144,7 +144,9 @@ void V_SetRefParams( ref_params_t *fd )
|
|||||||
VectorCopy( cl.viewangles, fd->cl_viewangles );
|
VectorCopy( cl.viewangles, fd->cl_viewangles );
|
||||||
fd->health = cl.local.health;
|
fd->health = cl.local.health;
|
||||||
VectorCopy( cl.crosshairangle, fd->crosshairangle );
|
VectorCopy( cl.crosshairangle, fd->crosshairangle );
|
||||||
|
if( Host_IsQuakeCompatible( ))
|
||||||
fd->viewsize = scr_viewsize.value;
|
fd->viewsize = scr_viewsize.value;
|
||||||
|
else fd->viewsize = 120.0f;
|
||||||
|
|
||||||
VectorCopy( cl.punchangle, fd->punchangle );
|
VectorCopy( cl.punchangle, fd->punchangle );
|
||||||
fd->maxclients = cl.maxclients;
|
fd->maxclients = cl.maxclients;
|
||||||
@@ -182,7 +184,7 @@ V_MergeOverviewRefdef
|
|||||||
merge refdef with overview settings
|
merge refdef with overview settings
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void V_RefApplyOverview( ref_viewpass_t *rvp )
|
static void V_RefApplyOverview( ref_viewpass_t *rvp )
|
||||||
{
|
{
|
||||||
ref_overview_t *ov = &clgame.overView;
|
ref_overview_t *ov = &clgame.overView;
|
||||||
float aspect;
|
float aspect;
|
||||||
@@ -281,7 +283,7 @@ static void V_AdjustFov( float *fov_x, float *fov_y, float width, float height,
|
|||||||
V_GetRefParams
|
V_GetRefParams
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void V_GetRefParams( ref_params_t *fd, ref_viewpass_t *rvp )
|
static void V_GetRefParams( ref_params_t *fd, ref_viewpass_t *rvp )
|
||||||
{
|
{
|
||||||
// part1: deniable updates
|
// part1: deniable updates
|
||||||
VectorCopy( fd->simvel, cl.simvel );
|
VectorCopy( fd->simvel, cl.simvel );
|
||||||
@@ -341,12 +343,14 @@ qboolean V_PreRender( void )
|
|||||||
{
|
{
|
||||||
if(( host.realtime - cls.disable_screen ) > cl_timeout.value )
|
if(( host.realtime - cls.disable_screen ) > cl_timeout.value )
|
||||||
{
|
{
|
||||||
Con_Reportf( "V_PreRender: loading plaque timed out\n" );
|
Con_Reportf( "%s: loading plaque timed out\n", __func__ );
|
||||||
cls.disable_screen = 0.0f;
|
cls.disable_screen = 0.0f;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
V_CheckGamma();
|
||||||
|
|
||||||
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
||||||
|
|
||||||
GL_UpdateSwapInterval( );
|
GL_UpdateSwapInterval( );
|
||||||
@@ -406,14 +410,14 @@ void V_RenderView( void )
|
|||||||
#define NODE_INTERVAL_X(x) (x * 16.0f)
|
#define NODE_INTERVAL_X(x) (x * 16.0f)
|
||||||
#define NODE_INTERVAL_Y(x) (x * 16.0f)
|
#define NODE_INTERVAL_Y(x) (x * 16.0f)
|
||||||
|
|
||||||
void R_DrawLeafNode( float x, float y, float scale )
|
static void R_DrawLeafNode( float x, float y, float scale )
|
||||||
{
|
{
|
||||||
float downScale = scale * 0.25f;// * POINT_SIZE;
|
float downScale = scale * 0.25f;// * POINT_SIZE;
|
||||||
|
|
||||||
ref.dllFuncs.R_DrawStretchPic( x - downScale * 0.5f, y - downScale * 0.5f, downScale, downScale, 0, 0, 1, 1, R_GetBuiltinTexture( REF_PARTICLE_TEXTURE ) );
|
ref.dllFuncs.R_DrawStretchPic( x - downScale * 0.5f, y - downScale * 0.5f, downScale, downScale, 0, 0, 1, 1, R_GetBuiltinTexture( REF_PARTICLE_TEXTURE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
static void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.Begin( TRI_LINES );
|
ref.dllFuncs.Begin( TRI_LINES );
|
||||||
ref.dllFuncs.Vertex3f( x, y, 0 );
|
ref.dllFuncs.Vertex3f( x, y, 0 );
|
||||||
@@ -421,7 +425,7 @@ void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
|||||||
ref.dllFuncs.End( );
|
ref.dllFuncs.End( );
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes, mleaf_t *viewleaf )
|
static void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes, mleaf_t *viewleaf )
|
||||||
{
|
{
|
||||||
float downScale = scale * 0.8f;
|
float downScale = scale * 0.8f;
|
||||||
|
|
||||||
@@ -468,7 +472,7 @@ void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes,
|
|||||||
world.recursion_level--;
|
world.recursion_level--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_ShowTree( void )
|
static void R_ShowTree( void )
|
||||||
{
|
{
|
||||||
float x = (float)((refState.width - (int)POINT_SIZE) >> 1);
|
float x = (float)((refState.width - (int)POINT_SIZE) >> 1);
|
||||||
float y = NODE_INTERVAL_Y(1.0f);
|
float y = NODE_INTERVAL_Y(1.0f);
|
||||||
@@ -504,7 +508,6 @@ V_PostRender
|
|||||||
*/
|
*/
|
||||||
void V_PostRender( void )
|
void V_PostRender( void )
|
||||||
{
|
{
|
||||||
static double oldtime;
|
|
||||||
qboolean draw_2d = false;
|
qboolean draw_2d = false;
|
||||||
|
|
||||||
ref.dllFuncs.R_AllowFog( false );
|
ref.dllFuncs.R_AllowFog( false );
|
||||||
@@ -531,6 +534,7 @@ void V_PostRender( void )
|
|||||||
SCR_RSpeeds();
|
SCR_RSpeeds();
|
||||||
SCR_NetSpeeds();
|
SCR_NetSpeeds();
|
||||||
SCR_DrawPos();
|
SCR_DrawPos();
|
||||||
|
SCR_DrawEnts();
|
||||||
SCR_DrawNetGraph();
|
SCR_DrawNetGraph();
|
||||||
SV_DrawOrthoTriangles();
|
SV_DrawOrthoTriangles();
|
||||||
CL_DrawDemoRecording();
|
CL_DrawDemoRecording();
|
||||||
@@ -551,4 +555,6 @@ void V_PostRender( void )
|
|||||||
ref.dllFuncs.R_AllowFog( true );
|
ref.dllFuncs.R_AllowFog( true );
|
||||||
Platform_SetTimer( 0.0f );
|
Platform_SetTimer( 0.0f );
|
||||||
ref.dllFuncs.R_EndFrame();
|
ref.dllFuncs.R_EndFrame();
|
||||||
|
|
||||||
|
V_CheckGammaEnd();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,6 @@ typedef struct
|
|||||||
|
|
||||||
// misc local info
|
// misc local info
|
||||||
qboolean repredicting; // repredicting in progress
|
qboolean repredicting; // repredicting in progress
|
||||||
qboolean thirdperson;
|
|
||||||
qboolean apply_effects; // local player will not added but we should apply their effects: flashlight etc
|
qboolean apply_effects; // local player will not added but we should apply their effects: flashlight etc
|
||||||
float idealpitch;
|
float idealpitch;
|
||||||
int viewmodel;
|
int viewmodel;
|
||||||
@@ -174,6 +173,26 @@ typedef struct
|
|||||||
// at every server map change
|
// at every server map change
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
// ==== shared through RefAPI's ref_client_t ====
|
||||||
|
double time; // this is the time value that the client
|
||||||
|
// is rendering at. always <= cls.realtime
|
||||||
|
// a lerp point for other data
|
||||||
|
double oldtime; // previous cl.time, time-oldtime is used
|
||||||
|
// to decay light values and smooth step ups
|
||||||
|
int viewentity;
|
||||||
|
|
||||||
|
// server state information
|
||||||
|
int playernum;
|
||||||
|
int maxclients;
|
||||||
|
|
||||||
|
int nummodels;
|
||||||
|
model_t *models[MAX_MODELS+1]; // precached models (plus sentinel slot)
|
||||||
|
|
||||||
|
qboolean paused;
|
||||||
|
|
||||||
|
vec3_t simorg; // predicted origin
|
||||||
|
// ==== shared through RefAPI's ref_client_t ===
|
||||||
|
|
||||||
int servercount; // server identification for prespawns
|
int servercount; // server identification for prespawns
|
||||||
int validsequence; // this is the sequence number of the last good
|
int validsequence; // this is the sequence number of the last good
|
||||||
// world snapshot/update we got. If this is 0, we can't
|
// world snapshot/update we got. If this is 0, we can't
|
||||||
@@ -183,7 +202,6 @@ typedef struct
|
|||||||
|
|
||||||
qboolean video_prepped; // false if on new level or new ref dll
|
qboolean video_prepped; // false if on new level or new ref dll
|
||||||
qboolean audio_prepped; // false if on new level or new snd dll
|
qboolean audio_prepped; // false if on new level or new snd dll
|
||||||
qboolean paused;
|
|
||||||
|
|
||||||
int delta_sequence; // acknowledged sequence number
|
int delta_sequence; // acknowledged sequence number
|
||||||
|
|
||||||
@@ -205,17 +223,12 @@ typedef struct
|
|||||||
runcmd_t commands[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
|
runcmd_t commands[MULTIPLAYER_BACKUP]; // each mesage will send several old cmds
|
||||||
local_state_t predicted_frames[MULTIPLAYER_BACKUP]; // local client state
|
local_state_t predicted_frames[MULTIPLAYER_BACKUP]; // local client state
|
||||||
|
|
||||||
double time; // this is the time value that the client
|
|
||||||
// is rendering at. always <= cls.realtime
|
|
||||||
// a lerp point for other data
|
|
||||||
double oldtime; // previous cl.time, time-oldtime is used
|
|
||||||
// to decay light values and smooth step ups
|
|
||||||
double timedelta; // floating delta between two updates
|
double timedelta; // floating delta between two updates
|
||||||
|
|
||||||
char serverinfo[MAX_SERVERINFO_STRING];
|
char serverinfo[MAX_SERVERINFO_STRING];
|
||||||
player_info_t players[MAX_CLIENTS]; // collected info about all other players include himself
|
player_info_t players[MAX_CLIENTS]; // collected info about all other players include himself
|
||||||
double lastresourcecheck;
|
double lastresourcecheck;
|
||||||
string downloadUrl;
|
qboolean http_download;
|
||||||
event_state_t events;
|
event_state_t events;
|
||||||
|
|
||||||
// predicting stuff but not only...
|
// predicting stuff but not only...
|
||||||
@@ -223,7 +236,6 @@ typedef struct
|
|||||||
|
|
||||||
// player final info
|
// player final info
|
||||||
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
usercmd_t *cmd; // cl.commands[outgoing_sequence].cmd
|
||||||
int viewentity;
|
|
||||||
vec3_t viewangles;
|
vec3_t viewangles;
|
||||||
vec3_t viewheight;
|
vec3_t viewheight;
|
||||||
vec3_t punchangle;
|
vec3_t punchangle;
|
||||||
@@ -236,14 +248,9 @@ typedef struct
|
|||||||
float addangletotal;
|
float addangletotal;
|
||||||
float prevaddangletotal;
|
float prevaddangletotal;
|
||||||
|
|
||||||
// predicted origin and velocity
|
// predicted velocity
|
||||||
vec3_t simorg;
|
|
||||||
vec3_t simvel;
|
vec3_t simvel;
|
||||||
|
|
||||||
// server state information
|
|
||||||
int playernum;
|
|
||||||
int maxclients;
|
|
||||||
|
|
||||||
entity_state_t instanced_baseline[MAX_CUSTOM_BASELINES];
|
entity_state_t instanced_baseline[MAX_CUSTOM_BASELINES];
|
||||||
int instanced_baseline_count;
|
int instanced_baseline_count;
|
||||||
|
|
||||||
@@ -251,8 +258,6 @@ typedef struct
|
|||||||
char event_precache[MAX_EVENTS][MAX_QPATH];
|
char event_precache[MAX_EVENTS][MAX_QPATH];
|
||||||
char files_precache[MAX_CUSTOM][MAX_QPATH];
|
char files_precache[MAX_CUSTOM][MAX_QPATH];
|
||||||
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
lightstyle_t lightstyles[MAX_LIGHTSTYLES];
|
||||||
model_t *models[MAX_MODELS+1]; // precached models (plus sentinel slot)
|
|
||||||
int nummodels;
|
|
||||||
int numfiles;
|
int numfiles;
|
||||||
|
|
||||||
consistency_t consistency_list[MAX_MODELS];
|
consistency_t consistency_list[MAX_MODELS];
|
||||||
@@ -270,6 +275,10 @@ typedef struct
|
|||||||
model_t *worldmodel; // pointer to world
|
model_t *worldmodel; // pointer to world
|
||||||
|
|
||||||
int lostpackets; // count lost packets and show dialog in menu
|
int lostpackets; // count lost packets and show dialog in menu
|
||||||
|
|
||||||
|
double frametime_remainder;
|
||||||
|
|
||||||
|
uint worldmapCRC;
|
||||||
} client_t;
|
} client_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -336,8 +345,7 @@ typedef struct
|
|||||||
byte charWidths[256]; // scaled widths
|
byte charWidths[256]; // scaled widths
|
||||||
int charHeight; // scaled height
|
int charHeight; // scaled height
|
||||||
int type; // fixed width font or variable
|
int type; // fixed width font or variable
|
||||||
int rendermode; // default rendermode
|
convar_t *rendermode; // user-defined default rendermode
|
||||||
qboolean nearest; // nearest filtering enabled
|
|
||||||
qboolean valid; // all rectangles are valid
|
qboolean valid; // all rectangles are valid
|
||||||
} cl_font_t;
|
} cl_font_t;
|
||||||
|
|
||||||
@@ -486,7 +494,6 @@ typedef struct
|
|||||||
|
|
||||||
net_request_t net_requests[MAX_REQUESTS]; // no reason to keep more
|
net_request_t net_requests[MAX_REQUESTS]; // no reason to keep more
|
||||||
|
|
||||||
efrag_t *free_efrags; // linked efrags
|
|
||||||
cl_entity_t viewent; // viewmodel
|
cl_entity_t viewent; // viewmodel
|
||||||
|
|
||||||
qboolean client_dll_uses_sdl;
|
qboolean client_dll_uses_sdl;
|
||||||
@@ -503,8 +510,9 @@ typedef struct
|
|||||||
player_info_t playerinfo; // local playerinfo
|
player_info_t playerinfo; // local playerinfo
|
||||||
|
|
||||||
gameui_draw_t ds; // draw2d stuff (menu images)
|
gameui_draw_t ds; // draw2d stuff (menu images)
|
||||||
GAMEINFO gameInfo; // current gameInfo
|
gameinfo2_t gameInfo; // current gameInfo
|
||||||
GAMEINFO *modsInfo[MAX_MODS]; // simplified gameInfo for MainUI
|
gameinfo2_t *modsInfo; // simplified gameInfo for MainUI, allocated by demand
|
||||||
|
GAMEINFO **oldModsInfo; // simplified gameInfo for older MainUI, allocated by demand
|
||||||
|
|
||||||
ui_globalvars_t *globals;
|
ui_globalvars_t *globals;
|
||||||
|
|
||||||
@@ -513,7 +521,7 @@ typedef struct
|
|||||||
int logo_yres;
|
int logo_yres;
|
||||||
float logo_length;
|
float logo_length;
|
||||||
|
|
||||||
qboolean use_text_api;
|
qboolean use_extended_api;
|
||||||
} gameui_static_t;
|
} gameui_static_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -534,12 +542,8 @@ typedef struct
|
|||||||
|
|
||||||
poolhandle_t mempool; // client premamnent pool: edicts etc
|
poolhandle_t mempool; // client premamnent pool: edicts etc
|
||||||
|
|
||||||
netadr_t hltv_listen_address;
|
|
||||||
|
|
||||||
int signon; // 0 to SIGNONS, for the signon sequence.
|
int signon; // 0 to SIGNONS, for the signon sequence.
|
||||||
int quakePort; // a 16 bit value that allows quake servers
|
|
||||||
// to work around address translating routers
|
|
||||||
// g-cont. this port allow many copies of engine in multiplayer game
|
|
||||||
// connection information
|
// connection information
|
||||||
char servername[MAX_QPATH]; // name of server from original connect
|
char servername[MAX_QPATH]; // name of server from original connect
|
||||||
double connect_time; // for connection retransmits
|
double connect_time; // for connection retransmits
|
||||||
@@ -556,7 +560,6 @@ typedef struct
|
|||||||
byte datagram_buf[MAX_DATAGRAM];
|
byte datagram_buf[MAX_DATAGRAM];
|
||||||
|
|
||||||
netchan_t netchan;
|
netchan_t netchan;
|
||||||
int challenge; // from the server to use for connecting
|
|
||||||
|
|
||||||
float packet_loss;
|
float packet_loss;
|
||||||
double packet_loss_recalc_time;
|
double packet_loss_recalc_time;
|
||||||
@@ -623,12 +626,14 @@ typedef struct
|
|||||||
char internetservers_query[512]; // cached query
|
char internetservers_query[512]; // cached query
|
||||||
uint32_t internetservers_query_len;
|
uint32_t internetservers_query_len;
|
||||||
|
|
||||||
// legacy mode support
|
// multiprotocol support
|
||||||
qboolean legacymode; // one-way 48 protocol compatibility
|
connprotocol_t legacymode;
|
||||||
netadr_t legacyserver;
|
|
||||||
int extensions;
|
int extensions;
|
||||||
|
|
||||||
netadr_t serveradr;
|
netadr_t serveradr;
|
||||||
|
|
||||||
|
// do we accept utf8 as input
|
||||||
|
qboolean accept_utf8;
|
||||||
} client_static_t;
|
} client_static_t;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -647,15 +652,13 @@ extern gameui_static_t gameui;
|
|||||||
//
|
//
|
||||||
// cvars
|
// cvars
|
||||||
//
|
//
|
||||||
|
extern convar_t showpause;
|
||||||
extern convar_t mp_decals;
|
extern convar_t mp_decals;
|
||||||
extern convar_t cl_logofile;
|
extern convar_t cl_logomaxdim;
|
||||||
extern convar_t cl_logocolor;
|
|
||||||
extern convar_t cl_allow_download;
|
extern convar_t cl_allow_download;
|
||||||
extern convar_t cl_allow_upload;
|
|
||||||
extern convar_t cl_download_ingame;
|
extern convar_t cl_download_ingame;
|
||||||
extern convar_t cl_nopred;
|
extern convar_t cl_nopred;
|
||||||
extern convar_t cl_timeout;
|
extern convar_t cl_timeout;
|
||||||
extern convar_t cl_nodelta;
|
|
||||||
extern convar_t cl_interp;
|
extern convar_t cl_interp;
|
||||||
extern convar_t cl_nointerp;
|
extern convar_t cl_nointerp;
|
||||||
extern convar_t cl_showerror;
|
extern convar_t cl_showerror;
|
||||||
@@ -668,19 +671,20 @@ extern convar_t cl_updaterate;
|
|||||||
extern convar_t cl_solid_players;
|
extern convar_t cl_solid_players;
|
||||||
extern convar_t cl_idealpitchscale;
|
extern convar_t cl_idealpitchscale;
|
||||||
extern convar_t cl_allow_levelshots;
|
extern convar_t cl_allow_levelshots;
|
||||||
extern convar_t cl_lightstyle_lerping;
|
|
||||||
extern convar_t cl_draw_particles;
|
extern convar_t cl_draw_particles;
|
||||||
extern convar_t cl_draw_tracers;
|
extern convar_t cl_draw_tracers;
|
||||||
extern convar_t cl_levelshot_name;
|
extern convar_t cl_levelshot_name;
|
||||||
extern convar_t cl_draw_beams;
|
extern convar_t cl_draw_beams;
|
||||||
extern convar_t cl_clockreset;
|
extern convar_t cl_clockreset;
|
||||||
extern convar_t cl_fixtimerate;
|
|
||||||
extern convar_t hud_fontscale;
|
extern convar_t hud_fontscale;
|
||||||
|
extern convar_t hud_fontrender;
|
||||||
extern convar_t hud_scale;
|
extern convar_t hud_scale;
|
||||||
|
extern convar_t hud_scale_minimal_width;
|
||||||
extern convar_t r_showtextures;
|
extern convar_t r_showtextures;
|
||||||
extern convar_t cl_bmodelinterp;
|
extern convar_t cl_bmodelinterp;
|
||||||
extern convar_t cl_lw; // local weapons
|
extern convar_t cl_lw; // local weapons
|
||||||
extern convar_t cl_charset;
|
extern convar_t cl_charset;
|
||||||
|
extern convar_t cl_trace_stufftext;
|
||||||
extern convar_t cl_trace_messages;
|
extern convar_t cl_trace_messages;
|
||||||
extern convar_t cl_trace_events;
|
extern convar_t cl_trace_events;
|
||||||
extern convar_t hud_utf8;
|
extern convar_t hud_utf8;
|
||||||
@@ -694,11 +698,11 @@ extern convar_t rate;
|
|||||||
extern convar_t m_ignore;
|
extern convar_t m_ignore;
|
||||||
extern convar_t r_showtree;
|
extern convar_t r_showtree;
|
||||||
extern convar_t ui_renderworld;
|
extern convar_t ui_renderworld;
|
||||||
|
extern convar_t cl_fixmodelinterpolationartifacts;
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void CL_SetLightstyle( int style, const char* s, float f );
|
void CL_SetLightstyle( int style, const char* s, float f );
|
||||||
void CL_RunLightStyles( void );
|
|
||||||
void CL_DecayLights( void );
|
void CL_DecayLights( void );
|
||||||
dlight_t *CL_GetDynamicLight( int number );
|
dlight_t *CL_GetDynamicLight( int number );
|
||||||
dlight_t *CL_GetEntityLight( int number );
|
dlight_t *CL_GetEntityLight( int number );
|
||||||
@@ -709,12 +713,8 @@ dlight_t *CL_GetEntityLight( int number );
|
|||||||
// cl_cmds.c
|
// cl_cmds.c
|
||||||
//
|
//
|
||||||
void CL_Quit_f( void );
|
void CL_Quit_f( void );
|
||||||
void CL_ScreenShot_f( void );
|
void CL_GenericShot_f( void );
|
||||||
void CL_SnapShot_f( void );
|
|
||||||
void CL_PlayCDTrack_f( void );
|
void CL_PlayCDTrack_f( void );
|
||||||
void CL_EnvShot_f( void );
|
|
||||||
void CL_SkyShot_f( void );
|
|
||||||
void CL_SaveShot_f( void );
|
|
||||||
void CL_LevelShot_f( void );
|
void CL_LevelShot_f( void );
|
||||||
void CL_SetSky_f( void );
|
void CL_SetSky_f( void );
|
||||||
void SCR_Viewpos_f( void );
|
void SCR_Viewpos_f( void );
|
||||||
@@ -735,8 +735,6 @@ void CL_ClearResourceLists( void );
|
|||||||
void CL_Parse_Debug( qboolean enable );
|
void CL_Parse_Debug( qboolean enable );
|
||||||
void CL_Parse_RecordCommand( int cmd, int startoffset );
|
void CL_Parse_RecordCommand( int cmd, int startoffset );
|
||||||
void CL_ResetFrame( frame_t *frame );
|
void CL_ResetFrame( frame_t *frame );
|
||||||
void CL_WriteMessageHistory( void );
|
|
||||||
const char *CL_MsgInfo( int cmd );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_efx.c
|
// cl_efx.c
|
||||||
@@ -747,17 +745,15 @@ void CL_Particle( const vec3_t org, int color, float life, int zpos, int zvel );
|
|||||||
// cl_main.c
|
// cl_main.c
|
||||||
//
|
//
|
||||||
void CL_Init( void );
|
void CL_Init( void );
|
||||||
void CL_SendCommand( void );
|
|
||||||
void CL_Disconnect_f( void );
|
void CL_Disconnect_f( void );
|
||||||
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
||||||
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to );
|
void CL_WriteUsercmd( connprotocol_t proto, sizebuf_t *msg, int from, int to );
|
||||||
int CL_GetFragmentSize( void *unused , fragsize_t mode );
|
void CL_SetupNetchanForProtocol( connprotocol_t proto );
|
||||||
qboolean CL_PrecacheResources( void );
|
qboolean CL_PrecacheResources( void );
|
||||||
void CL_SetupOverviewParams( void );
|
void CL_SetupOverviewParams( void );
|
||||||
void CL_UpdateFrameLerp( void );
|
void CL_UpdateFrameLerp( void );
|
||||||
int CL_IsDevOverviewMode( void );
|
int CL_IsDevOverviewMode( void );
|
||||||
void CL_PingServers_f( void );
|
void CL_SignonReply( connprotocol_t proto );
|
||||||
void CL_SignonReply( void );
|
|
||||||
void CL_ClearState( void );
|
void CL_ClearState( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -774,8 +770,6 @@ void CL_CheckStartupDemos( void );
|
|||||||
void CL_WriteDemoJumpTime( void );
|
void CL_WriteDemoJumpTime( void );
|
||||||
void CL_CloseDemoHeader( void );
|
void CL_CloseDemoHeader( void );
|
||||||
void CL_DemoCompleted( void );
|
void CL_DemoCompleted( void );
|
||||||
void CL_StopPlayback( void );
|
|
||||||
void CL_StopRecord( void );
|
|
||||||
void CL_PlayDemo_f( void );
|
void CL_PlayDemo_f( void );
|
||||||
void CL_TimeDemo_f( void );
|
void CL_TimeDemo_f( void );
|
||||||
void CL_StartDemos_f( void );
|
void CL_StartDemos_f( void );
|
||||||
@@ -783,19 +777,18 @@ void CL_Demos_f( void );
|
|||||||
void CL_DeleteDemo_f( void );
|
void CL_DeleteDemo_f( void );
|
||||||
void CL_Record_f( void );
|
void CL_Record_f( void );
|
||||||
void CL_Stop_f( void );
|
void CL_Stop_f( void );
|
||||||
|
void CL_ListDemo_f( void );
|
||||||
|
int CL_GetDemoComment( const char *demoname, char *comment );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_events.c
|
// cl_events.c
|
||||||
//
|
//
|
||||||
void CL_ParseEvent( sizebuf_t *msg );
|
void CL_ParseEvent( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_ParseReliableEvent( sizebuf_t *msg );
|
void CL_ParseReliableEvent( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_SetEventIndex( const char *szEvName, int ev_index );
|
void CL_SetEventIndex( const char *szEvName, int ev_index );
|
||||||
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args );
|
|
||||||
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
|
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
|
||||||
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||||
void CL_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func );
|
void CL_RegisterEvent( int lastnum, const char *szEvName, pfnEventHook func );
|
||||||
void CL_BatchResourceRequest( qboolean initialize );
|
|
||||||
int CL_EstimateNeededResources( void );
|
|
||||||
void CL_ResetEvent( event_info_t *ei );
|
void CL_ResetEvent( event_info_t *ei );
|
||||||
word CL_EventIndex( const char *name );
|
word CL_EventIndex( const char *name );
|
||||||
void CL_FireEvents( void );
|
void CL_FireEvents( void );
|
||||||
@@ -804,9 +797,10 @@ void CL_FireEvents( void );
|
|||||||
// cl_font.c
|
// cl_font.c
|
||||||
//
|
//
|
||||||
qboolean CL_FixedFont( cl_font_t *font );
|
qboolean CL_FixedFont( cl_font_t *font );
|
||||||
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags );
|
qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
||||||
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, int rendermode, uint texFlags );
|
qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font, float scale, convar_t *rendermode, uint texFlags );
|
||||||
void CL_FreeFont( cl_font_t *font );
|
void CL_FreeFont( cl_font_t *font );
|
||||||
|
void CL_SetFontRendermode( cl_font_t *font );
|
||||||
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawCharacter( float x, float y, int number, rgba_t color, cl_font_t *font, int flags );
|
||||||
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
|
int CL_DrawString( float x, float y, const char *s, rgba_t color, cl_font_t *font, int flags );
|
||||||
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
void CL_DrawCharacterLen( cl_font_t *font, int number, int *width, int *height );
|
||||||
@@ -819,10 +813,7 @@ int CL_DrawStringf( cl_font_t *font, float x, float y, rgba_t color, int flags,
|
|||||||
//
|
//
|
||||||
void CL_UnloadProgs( void );
|
void CL_UnloadProgs( void );
|
||||||
qboolean CL_LoadProgs( const char *name );
|
qboolean CL_LoadProgs( const char *name );
|
||||||
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num );
|
|
||||||
void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize );
|
void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize );
|
||||||
void CL_ParseFinaleCutscene( sizebuf_t *msg, int level );
|
|
||||||
void CL_ParseTextMessage( sizebuf_t *msg );
|
|
||||||
void CL_DrawHUD( int state );
|
void CL_DrawHUD( int state );
|
||||||
void CL_InitEdicts( int maxclients );
|
void CL_InitEdicts( int maxclients );
|
||||||
void CL_FreeEdicts( void );
|
void CL_FreeEdicts( void );
|
||||||
@@ -839,33 +830,30 @@ model_t *CL_LoadClientSprite( const char *filename );
|
|||||||
model_t *CL_LoadModel( const char *modelname, int *index );
|
model_t *CL_LoadModel( const char *modelname, int *index );
|
||||||
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
||||||
void SPR_AdjustSize( float *x, float *y, float *w, float *h );
|
void SPR_AdjustSize( float *x, float *y, float *w, float *h );
|
||||||
void SPR_AdjustTexCoords( float width, float height, float *s1, float *t1, float *s2, float *t2 );
|
|
||||||
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
|
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
|
||||||
void CL_FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a );
|
|
||||||
pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
pmtrace_t *PM_CL_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||||
const char *PM_CL_TraceTexture( int ground, float *vstart, float *vend );
|
const char *PM_CL_TraceTexture( int ground, float *vstart, float *vend );
|
||||||
int PM_CL_PointContents( const float *p, int *truecontents );
|
int PM_CL_PointContents( const float *p, int *truecontents );
|
||||||
void CL_GetMousePosition( int *mx, int *my ); // TODO: move to input
|
|
||||||
cl_entity_t* CL_GetViewModel( void );
|
|
||||||
physent_t *pfnGetPhysent( int idx );
|
physent_t *pfnGetPhysent( int idx );
|
||||||
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
|
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
|
||||||
movevars_t *pfnGetMoveVars( void );
|
movevars_t *pfnGetMoveVars( void );
|
||||||
void CL_EnableScissor( scissor_state_t *scissor, int x, int y, int width, int height );
|
void CL_EnableScissor( scissor_state_t *scissor, int x, int y, int width, int height );
|
||||||
void CL_DisableScissor( scissor_state_t *scissor );
|
void CL_DisableScissor( scissor_state_t *scissor );
|
||||||
qboolean CL_Scissor( const scissor_state_t *scissor, float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 );
|
qboolean CL_Scissor( const scissor_state_t *scissor, float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 );
|
||||||
|
struct cl_entity_s *CL_GetEntityByIndex( int index );
|
||||||
|
|
||||||
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||||
{
|
{
|
||||||
if( !clgame.entities )
|
if( !clgame.entities )
|
||||||
{
|
{
|
||||||
Host_Error( "CL_EDICT_NUM: clgame.entities is NULL\n");
|
Host_Error( "%s: clgame.entities is NULL\n", __func__ );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(( n >= 0 ) && ( n < clgame.maxEntities ))
|
if(( n >= 0 ) && ( n < clgame.maxEntities ))
|
||||||
return clgame.entities + n;
|
return clgame.entities + n;
|
||||||
|
|
||||||
Host_Error( "CL_EDICT_NUM: bad number %i\n", n );
|
Host_Error( "%s: bad number %i\n", __func__, n );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -873,20 +861,21 @@ _inline cl_entity_t *CL_EDICT_NUM( int n )
|
|||||||
// cl_parse.c
|
// cl_parse.c
|
||||||
//
|
//
|
||||||
void CL_ParseSetAngle( sizebuf_t *msg );
|
void CL_ParseSetAngle( sizebuf_t *msg );
|
||||||
void CL_ParseServerData( sizebuf_t *msg, qboolean legacy );
|
void CL_ParseServerData( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_ParseLightStyle( sizebuf_t *msg );
|
void CL_ParseLightStyle( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_UpdateUserinfo( sizebuf_t *msg, qboolean legacy );
|
void CL_UpdateUserinfo( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_ParseResource( sizebuf_t *msg );
|
void CL_ParseResource( sizebuf_t *msg );
|
||||||
void CL_ParseClientData( sizebuf_t *msg );
|
void CL_ParseClientData( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_UpdateUserPings( sizebuf_t *msg );
|
void CL_UpdateUserPings( sizebuf_t *msg );
|
||||||
void CL_ParseParticles( sizebuf_t *msg );
|
void CL_ParseParticles( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_ParseRestoreSoundPacket( sizebuf_t *msg );
|
void CL_ParseRestoreSoundPacket( sizebuf_t *msg );
|
||||||
void CL_ParseBaseline( sizebuf_t *msg, qboolean legacy );
|
void CL_ParseBaseline( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_ParseSignon( sizebuf_t *msg );
|
void CL_ParseSignon( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_ParseRestore( sizebuf_t *msg );
|
void CL_ParseRestore( sizebuf_t *msg );
|
||||||
void CL_ParseStaticDecal( sizebuf_t *msg );
|
void CL_ParseStaticDecal( sizebuf_t *msg );
|
||||||
void CL_ParseAddAngle( sizebuf_t *msg );
|
void CL_ParseAddAngle( sizebuf_t *msg );
|
||||||
void CL_RegisterUserMessage( sizebuf_t *msg );
|
void CL_RegisterUserMessage( sizebuf_t *msg, connprotocol_t proto );
|
||||||
|
void CL_ParseResourceList( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_ParseMovevars( sizebuf_t *msg );
|
void CL_ParseMovevars( sizebuf_t *msg );
|
||||||
void CL_ParseResourceRequest( sizebuf_t *msg );
|
void CL_ParseResourceRequest( sizebuf_t *msg );
|
||||||
void CL_ParseCustomization( sizebuf_t *msg );
|
void CL_ParseCustomization( sizebuf_t *msg );
|
||||||
@@ -895,30 +884,42 @@ void CL_ParseSoundFade( sizebuf_t *msg );
|
|||||||
void CL_ParseFileTransferFailed( sizebuf_t *msg );
|
void CL_ParseFileTransferFailed( sizebuf_t *msg );
|
||||||
void CL_ParseHLTV( sizebuf_t *msg );
|
void CL_ParseHLTV( sizebuf_t *msg );
|
||||||
void CL_ParseDirector( sizebuf_t *msg );
|
void CL_ParseDirector( sizebuf_t *msg );
|
||||||
|
void CL_ParseVoiceInit( sizebuf_t *msg );
|
||||||
|
void CL_ParseVoiceData( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_ParseResLocation( sizebuf_t *msg );
|
void CL_ParseResLocation( sizebuf_t *msg );
|
||||||
void CL_ParseCvarValue( sizebuf_t *msg, const qboolean ext );
|
void CL_ParseCvarValue( sizebuf_t *msg, const qboolean ext, const connprotocol_t proto );
|
||||||
void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message );
|
void CL_ParseServerMessage( sizebuf_t *msg );
|
||||||
void CL_ParseTempEntity( sizebuf_t *msg );
|
qboolean CL_ParseCommonDLLMessage( sizebuf_t *msg, connprotocol_t proto, int svc_num, int startoffset );
|
||||||
|
void CL_ParseTempEntity( sizebuf_t *msg, connprotocol_t proto );
|
||||||
qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf );
|
qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf );
|
||||||
qboolean CL_RequestMissingResources( void );
|
qboolean CL_RequestMissingResources( void );
|
||||||
void CL_RegisterResources ( sizebuf_t *msg );
|
void CL_RegisterResources( sizebuf_t *msg, connprotocol_t proto );
|
||||||
void CL_ParseViewEntity( sizebuf_t *msg );
|
void CL_ParseViewEntity( sizebuf_t *msg );
|
||||||
void CL_ParseServerTime( sizebuf_t *msg );
|
void CL_ParseServerTime( sizebuf_t *msg, connprotocol_t proto );
|
||||||
|
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num, connprotocol_t proto );
|
||||||
|
void CL_ParseFinaleCutscene( sizebuf_t *msg, int level );
|
||||||
|
void CL_ParseTextMessage( sizebuf_t *msg );
|
||||||
|
void CL_ParseExec( sizebuf_t *msg );
|
||||||
|
void CL_BatchResourceRequest( qboolean initialize );
|
||||||
|
int CL_EstimateNeededResources( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_parse_48.c
|
// cl_parse_48.c
|
||||||
//
|
//
|
||||||
void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message );
|
void CL_ParseLegacyServerMessage( sizebuf_t *msg );
|
||||||
void CL_LegacyPrecache_f( void );
|
void CL_LegacyPrecache_f( void );
|
||||||
|
|
||||||
|
//
|
||||||
|
// cl_parse_gs.c
|
||||||
|
//
|
||||||
|
void CL_ParseGoldSrcServerMessage( sizebuf_t *msg );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_scrn.c
|
// cl_scrn.c
|
||||||
//
|
//
|
||||||
void SCR_VidInit( void );
|
void SCR_VidInit( void );
|
||||||
void SCR_TileClear( void );
|
void SCR_TileClear( void );
|
||||||
void SCR_DirtyScreen( void );
|
void SCR_DirtyScreen( void );
|
||||||
void SCR_AddDirtyPoint( int x, int y );
|
|
||||||
void SCR_InstallParticlePalette( void );
|
|
||||||
void SCR_EndLoadingPlaque( void );
|
void SCR_EndLoadingPlaque( void );
|
||||||
void SCR_RegisterTextures( void );
|
void SCR_RegisterTextures( void );
|
||||||
void SCR_LoadCreditsFont( void );
|
void SCR_LoadCreditsFont( void );
|
||||||
@@ -928,6 +929,7 @@ void SCR_NetSpeeds( void );
|
|||||||
void SCR_RSpeeds( void );
|
void SCR_RSpeeds( void );
|
||||||
void SCR_DrawFPS( int height );
|
void SCR_DrawFPS( int height );
|
||||||
void SCR_DrawPos( void );
|
void SCR_DrawPos( void );
|
||||||
|
void SCR_DrawEnts( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_netgraph.c
|
// cl_netgraph.c
|
||||||
@@ -953,43 +955,39 @@ void CL_SetSolidPlayers( int playernum );
|
|||||||
void CL_InitClientMove( void );
|
void CL_InitClientMove( void );
|
||||||
void CL_PredictMovement( qboolean repredicting );
|
void CL_PredictMovement( qboolean repredicting );
|
||||||
void CL_CheckPredictionError( void );
|
void CL_CheckPredictionError( void );
|
||||||
qboolean CL_IsPredicted( void );
|
|
||||||
int CL_TruePointContents( const vec3_t p );
|
|
||||||
int CL_WaterEntity( const float *rgflPos );
|
int CL_WaterEntity( const float *rgflPos );
|
||||||
cl_entity_t *CL_GetWaterEntity( const float *rgflPos );
|
cl_entity_t *CL_GetWaterEntity( const float *rgflPos );
|
||||||
int CL_TestLine( const vec3_t start, const vec3_t end, int flags );
|
|
||||||
pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags );
|
pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags );
|
||||||
pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags );
|
pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags );
|
||||||
void CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs );
|
|
||||||
void CL_PopTraceBounds( void );
|
|
||||||
void CL_MoveSpectatorCamera( void );
|
void CL_MoveSpectatorCamera( void );
|
||||||
void CL_SetLastUpdate( void );
|
void CL_SetLastUpdate( void );
|
||||||
void CL_RedoPrediction( void );
|
void CL_RedoPrediction( void );
|
||||||
void CL_PushPMStates( void );
|
void CL_PushPMStates( void );
|
||||||
void CL_PopPMStates( void );
|
void CL_PopPMStates( void );
|
||||||
void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );
|
void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );
|
||||||
|
void CL_SetIdealPitch( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_qparse.c
|
// cl_qparse.c
|
||||||
//
|
//
|
||||||
void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message );
|
void CL_ParseQuakeMessage( sizebuf_t *msg );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_frame.c
|
// cl_frame.c
|
||||||
//
|
//
|
||||||
struct channel_s;
|
struct channel_s;
|
||||||
struct rawchan_s;
|
struct rawchan_s;
|
||||||
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta );
|
qboolean CL_ValidateDeltaPacket( uint oldpacket, frame_t *oldframe );
|
||||||
|
int CL_UpdateOldEntNum( int oldindex, frame_t *oldframe, entity_state_t **oldent );
|
||||||
|
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta, connprotocol_t proto );
|
||||||
qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType );
|
qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType );
|
||||||
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset );
|
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset );
|
||||||
qboolean CL_GetEntitySpatialization( struct channel_s *ch );
|
qboolean CL_GetEntitySpatialization( struct channel_s *ch );
|
||||||
qboolean CL_GetMovieSpatialization( struct rawchan_s *ch );
|
qboolean CL_GetMovieSpatialization( struct rawchan_s *ch );
|
||||||
void CL_ProcessPlayerState( int playerindex, entity_state_t *state );
|
|
||||||
void CL_ComputePlayerOrigin( cl_entity_t *clent );
|
void CL_ComputePlayerOrigin( cl_entity_t *clent );
|
||||||
void CL_ProcessPacket( frame_t *frame );
|
void CL_ProcessPacket( frame_t *frame );
|
||||||
void CL_MoveThirdpersonCamera( void );
|
void CL_MoveThirdpersonCamera( void );
|
||||||
qboolean CL_IsPlayerIndex( int idx );
|
qboolean CL_IsPlayerIndex( int idx );
|
||||||
void CL_SetIdealPitch( void );
|
|
||||||
void CL_EmitEntities( void );
|
void CL_EmitEntities( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1013,6 +1011,7 @@ const ref_overview_t *GL_GetOverviewParms( void );
|
|||||||
//
|
//
|
||||||
void R_StoreEfrags( efrag_t **ppefrag, int framecount );
|
void R_StoreEfrags( efrag_t **ppefrag, int framecount );
|
||||||
void R_AddEfrags( cl_entity_t *ent );
|
void R_AddEfrags( cl_entity_t *ent );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_tent.c
|
// cl_tent.c
|
||||||
//
|
//
|
||||||
@@ -1023,7 +1022,6 @@ void CL_ClearEfrags( void );
|
|||||||
void CL_TestLights( void );
|
void CL_TestLights( void );
|
||||||
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale );
|
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale );
|
||||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||||
void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
|
|
||||||
void R_FreeDeadParticles( struct particle_s **ppparticles );
|
void R_FreeDeadParticles( struct particle_s **ppparticles );
|
||||||
void CL_AddClientResource( const char *filename, int type );
|
void CL_AddClientResource( const char *filename, int type );
|
||||||
void CL_AddClientResources( void );
|
void CL_AddClientResources( void );
|
||||||
@@ -1031,7 +1029,6 @@ void CL_InitParticles( void );
|
|||||||
void CL_ClearParticles( void );
|
void CL_ClearParticles( void );
|
||||||
void CL_FreeParticles( void );
|
void CL_FreeParticles( void );
|
||||||
void CL_InitTempEnts( void );
|
void CL_InitTempEnts( void );
|
||||||
void CL_ClearTempEnts( void );
|
|
||||||
void CL_FreeTempEnts( void );
|
void CL_FreeTempEnts( void );
|
||||||
void CL_TempEntUpdate( void );
|
void CL_TempEntUpdate( void );
|
||||||
void CL_InitViewBeams( void );
|
void CL_InitViewBeams( void );
|
||||||
@@ -1045,7 +1042,6 @@ void CL_ReadPointFile_f( void );
|
|||||||
void CL_DrawEFX( float time, qboolean fTrans );
|
void CL_DrawEFX( float time, qboolean fTrans );
|
||||||
void CL_ThinkParticle( double frametime, particle_t *p );
|
void CL_ThinkParticle( double frametime, particle_t *p );
|
||||||
void CL_ReadLineFile_f( void );
|
void CL_ReadLineFile_f( void );
|
||||||
void CL_RunLightStyles( void );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// console.c
|
// console.c
|
||||||
@@ -1065,27 +1061,22 @@ int Con_UtfProcessChar( int in );
|
|||||||
int Con_UtfProcessCharForce( int in );
|
int Con_UtfProcessCharForce( int in );
|
||||||
int Con_UtfMoveLeft( char *str, int pos );
|
int Con_UtfMoveLeft( char *str, int pos );
|
||||||
int Con_UtfMoveRight( char *str, int pos, int length );
|
int Con_UtfMoveRight( char *str, int pos, int length );
|
||||||
void Con_DefaultColor( int r, int g, int b );
|
void Con_DefaultColor( int r, int g, int b, qboolean gameui );
|
||||||
void Con_InvalidateFonts( void );
|
|
||||||
cl_font_t *Con_GetCurFont( void );
|
cl_font_t *Con_GetCurFont( void );
|
||||||
cl_font_t *Con_GetFont( int num );
|
cl_font_t *Con_GetFont( int num );
|
||||||
void Con_DrawCharacterLen( int number, int *width, int *height );
|
|
||||||
int Con_DrawString( int x, int y, const char *string, rgba_t setColor ); // legacy, use cl_font.c
|
int Con_DrawString( int x, int y, const char *string, rgba_t setColor ); // legacy, use cl_font.c
|
||||||
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height ); // legacy, use cl_font.c
|
||||||
void Con_CharEvent( int key );
|
void Con_CharEvent( int key );
|
||||||
void Con_RestoreFont( void );
|
|
||||||
void Key_Console( int key );
|
void Key_Console( int key );
|
||||||
void Key_Message( int key );
|
void Key_Message( int key );
|
||||||
void Con_FastClose( void );
|
void Con_FastClose( void );
|
||||||
void Con_Bottom( void );
|
void Con_Bottom( void );
|
||||||
void Con_Top( void );
|
|
||||||
void Con_PageDown( int lines );
|
void Con_PageDown( int lines );
|
||||||
void Con_PageUp( int lines );
|
void Con_PageUp( int lines );
|
||||||
|
|
||||||
//
|
//
|
||||||
// s_main.c
|
// s_main.c
|
||||||
//
|
//
|
||||||
void S_StreamRawSamples( int samples, int rate, int width, int channels, const byte *data );
|
|
||||||
void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime );
|
void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime );
|
||||||
void S_StartBackgroundTrack( const char *intro, const char *loop, int position, qboolean fullpath );
|
void S_StartBackgroundTrack( const char *intro, const char *loop, int position, qboolean fullpath );
|
||||||
void S_StopBackgroundTrack( void );
|
void S_StopBackgroundTrack( void );
|
||||||
@@ -1123,7 +1114,7 @@ qboolean UI_MouseInRect( void );
|
|||||||
qboolean UI_IsVisible( void );
|
qboolean UI_IsVisible( void );
|
||||||
void UI_ResetPing( void );
|
void UI_ResetPing( void );
|
||||||
void UI_ShowUpdateDialog( qboolean preferStore );
|
void UI_ShowUpdateDialog( qboolean preferStore );
|
||||||
void UI_ShowMessageBox( const char *text );
|
qboolean UI_ShowMessageBox( const char *text );
|
||||||
void UI_AddTouchButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags );
|
void UI_AddTouchButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags );
|
||||||
void UI_ConnectionProgress_Disconnect( void );
|
void UI_ConnectionProgress_Disconnect( void );
|
||||||
void UI_ConnectionProgress_Download( const char *pszFileName, const char *pszServerName, const char *pszServerPath, int iCurrent, int iTotal, const char *comment );
|
void UI_ConnectionProgress_Download( const char *pszFileName, const char *pszServerName, const char *pszServerPath, int iCurrent, int iTotal, const char *comment );
|
||||||
@@ -1132,11 +1123,6 @@ void UI_ConnectionProgress_Precache( void );
|
|||||||
void UI_ConnectionProgress_Connect( const char *server );
|
void UI_ConnectionProgress_Connect( const char *server );
|
||||||
void UI_ConnectionProgress_ChangeLevel( void );
|
void UI_ConnectionProgress_ChangeLevel( void );
|
||||||
void UI_ConnectionProgress_ParseServerInfo( const char *server );
|
void UI_ConnectionProgress_ParseServerInfo( const char *server );
|
||||||
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a );
|
|
||||||
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc );
|
|
||||||
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc );
|
|
||||||
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc );
|
|
||||||
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_mobile.c
|
// cl_mobile.c
|
||||||
@@ -1182,5 +1168,7 @@ int Key_ToUpper( int key );
|
|||||||
void OSK_Draw( void );
|
void OSK_Draw( void );
|
||||||
|
|
||||||
extern rgba_t g_color_table[8];
|
extern rgba_t g_color_table[8];
|
||||||
|
extern triangleapi_t gTriApi;
|
||||||
|
extern net_api_t gNetApi;
|
||||||
|
|
||||||
#endif//CLIENT_H
|
#endif//CLIENT_H
|
||||||
|
|||||||
@@ -21,18 +21,20 @@ GNU General Public License for more details.
|
|||||||
#include "qfont.h"
|
#include "qfont.h"
|
||||||
#include "wadfile.h"
|
#include "wadfile.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include "utflib.h"
|
||||||
|
|
||||||
static CVAR_DEFINE_AUTO( scr_conspeed, "600", FCVAR_ARCHIVE, "console moving speed" );
|
static CVAR_DEFINE_AUTO( scr_conspeed, "600", FCVAR_ARCHIVE, "console moving speed" );
|
||||||
static CVAR_DEFINE_AUTO( con_notifytime, "3", FCVAR_ARCHIVE, "notify time to live" );
|
static CVAR_DEFINE_AUTO( con_notifytime, "3", FCVAR_ARCHIVE, "notify time to live" );
|
||||||
CVAR_DEFINE_AUTO( con_fontsize, "1", FCVAR_ARCHIVE, "console font number (0, 1 or 2)" );
|
CVAR_DEFINE_AUTO( con_fontsize, "1", FCVAR_ARCHIVE, "console font number (0, 1 or 2)" );
|
||||||
|
static CVAR_DEFINE_AUTO( con_fontrender, "2", FCVAR_ARCHIVE, "console font render mode (0: additive, 1: holes, 2: trans)" );
|
||||||
static CVAR_DEFINE_AUTO( con_charset, "cp1251", FCVAR_ARCHIVE, "console font charset (only cp1251 supported now)" );
|
static CVAR_DEFINE_AUTO( con_charset, "cp1251", FCVAR_ARCHIVE, "console font charset (only cp1251 supported now)" );
|
||||||
static CVAR_DEFINE_AUTO( con_fontscale, "1.0", FCVAR_ARCHIVE, "scale font texture" );
|
static CVAR_DEFINE_AUTO( con_fontscale, "1.0", FCVAR_ARCHIVE, "scale font texture" );
|
||||||
static CVAR_DEFINE_AUTO( con_fontnum, "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
static CVAR_DEFINE_AUTO( con_fontnum, "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
||||||
static CVAR_DEFINE_AUTO( con_color, "240 180 24", FCVAR_ARCHIVE, "set a custom console color" );
|
static CVAR_DEFINE_AUTO( con_color, "240 180 24", FCVAR_ARCHIVE, "set a custom console color" );
|
||||||
|
static CVAR_DEFINE_AUTO( scr_drawversion, "1", FCVAR_ARCHIVE, "draw version in menu or screenshots, doesn't affect console" );
|
||||||
|
static CVAR_DEFINE_AUTO( con_oldfont, "0", 0, "use legacy font from gfx.wad, might be missing or broken" );
|
||||||
|
|
||||||
static int g_codepage = 0;
|
static int g_codepage = 0;
|
||||||
static qboolean g_utf8 = false;
|
|
||||||
|
|
||||||
static qboolean g_messagemode_privileged = true;
|
static qboolean g_messagemode_privileged = true;
|
||||||
|
|
||||||
@@ -139,8 +141,9 @@ typedef struct
|
|||||||
|
|
||||||
static console_t con;
|
static console_t con;
|
||||||
|
|
||||||
void Con_ClearField( field_t *edit );
|
static void Con_ClearField( field_t *edit );
|
||||||
void Field_CharEvent( field_t *edit, int ch );
|
static void Field_CharEvent( field_t *edit, int ch );
|
||||||
|
static void Con_InvalidateFonts( void );
|
||||||
|
|
||||||
static void Con_LoadHistory( con_history_t *self );
|
static void Con_LoadHistory( con_history_t *self );
|
||||||
static void Con_SaveHistory( con_history_t *self );
|
static void Con_SaveHistory( con_history_t *self );
|
||||||
@@ -150,7 +153,7 @@ static void Con_SaveHistory( con_history_t *self );
|
|||||||
Con_Clear_f
|
Con_Clear_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_Clear_f( void )
|
static void Con_Clear_f( void )
|
||||||
{
|
{
|
||||||
con.lines_count = 0;
|
con.lines_count = 0;
|
||||||
con.backscroll = 0; // go to end
|
con.backscroll = 0; // go to end
|
||||||
@@ -174,10 +177,10 @@ static void Con_SetColor( void )
|
|||||||
switch( num )
|
switch( num )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
Con_DefaultColor( r, r, r );
|
Con_DefaultColor( r, r, r, false );
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Con_DefaultColor( r, g, b );
|
Con_DefaultColor( r, g, b, false );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Cvar_DirectSet( &con_color, con_color.def_string );
|
Cvar_DirectSet( &con_color, con_color.def_string );
|
||||||
@@ -205,7 +208,7 @@ void Con_ClearNotify( void )
|
|||||||
Con_ClearTyping
|
Con_ClearTyping
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_ClearTyping( void )
|
static void Con_ClearTyping( void )
|
||||||
{
|
{
|
||||||
Con_ClearField( &con.input );
|
Con_ClearField( &con.input );
|
||||||
con.input.widthInChars = con.linewidth;
|
con.input.widthInChars = con.linewidth;
|
||||||
@@ -218,7 +221,7 @@ void Con_ClearTyping( void )
|
|||||||
Con_MessageMode_f
|
Con_MessageMode_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_MessageMode_f( void )
|
static void Con_MessageMode_f( void )
|
||||||
{
|
{
|
||||||
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
||||||
|
|
||||||
@@ -234,7 +237,7 @@ void Con_MessageMode_f( void )
|
|||||||
Con_MessageMode2_f
|
Con_MessageMode2_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_MessageMode2_f( void )
|
static void Con_MessageMode2_f( void )
|
||||||
{
|
{
|
||||||
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
g_messagemode_privileged = Cmd_CurrentCommandIsPrivileged();
|
||||||
|
|
||||||
@@ -279,7 +282,7 @@ void Con_ToggleConsole_f( void )
|
|||||||
Con_SetTimes_f
|
Con_SetTimes_f
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_SetTimes_f( void )
|
static void Con_SetTimes_f( void )
|
||||||
{
|
{
|
||||||
int newtimes;
|
int newtimes;
|
||||||
|
|
||||||
@@ -302,7 +305,7 @@ Notifies the console code about the current time
|
|||||||
went backwards)
|
went backwards)
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_FixTimes( void )
|
static void Con_FixTimes( void )
|
||||||
{
|
{
|
||||||
double diff;
|
double diff;
|
||||||
int i;
|
int i;
|
||||||
@@ -323,7 +326,7 @@ Con_DeleteLine
|
|||||||
Deletes the first line from the console history.
|
Deletes the first line from the console history.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_DeleteLine( void )
|
static void Con_DeleteLine( void )
|
||||||
{
|
{
|
||||||
if( con.lines_count == 0 )
|
if( con.lines_count == 0 )
|
||||||
return;
|
return;
|
||||||
@@ -338,7 +341,7 @@ Con_DeleteLastLine
|
|||||||
Deletes the last line from the console history.
|
Deletes the last line from the console history.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_DeleteLastLine( void )
|
static void Con_DeleteLastLine( void )
|
||||||
{
|
{
|
||||||
if( con.lines_count == 0 )
|
if( con.lines_count == 0 )
|
||||||
return;
|
return;
|
||||||
@@ -397,7 +400,7 @@ Con_AddLine
|
|||||||
Appends a given string as a new line to the console.
|
Appends a given string as a new line to the console.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_AddLine( const char *line, int length, qboolean newline )
|
static void Con_AddLine( const char *line, int length, qboolean newline )
|
||||||
{
|
{
|
||||||
char *putpos;
|
char *putpos;
|
||||||
con_lineinfo_t *p;
|
con_lineinfo_t *p;
|
||||||
@@ -443,7 +446,7 @@ Con_CheckResize
|
|||||||
If the line width has changed, reformat the buffer.
|
If the line width has changed, reformat the buffer.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_CheckResize( void )
|
static void Con_CheckResize( void )
|
||||||
{
|
{
|
||||||
int charWidth = 8;
|
int charWidth = 8;
|
||||||
int i, width;
|
int i, width;
|
||||||
@@ -492,7 +495,7 @@ void Con_PageDown( int lines )
|
|||||||
Con_Top
|
Con_Top
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_Top( void )
|
static void Con_Top( void )
|
||||||
{
|
{
|
||||||
con.backscroll = CON_MAXLINES;
|
con.backscroll = CON_MAXLINES;
|
||||||
}
|
}
|
||||||
@@ -543,10 +546,9 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
if( font->valid )
|
if( font->valid )
|
||||||
return; // already loaded
|
return; // already loaded
|
||||||
|
|
||||||
// loading conchars
|
if( con_oldfont.value )
|
||||||
if( Sys_CheckParm( "-oldfont" ))
|
|
||||||
{
|
{
|
||||||
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( "gfx/conchars.fnt", font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -559,14 +561,14 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
if( Q_snprintf( path, sizeof( path ),
|
if( Q_snprintf( path, sizeof( path ),
|
||||||
"font%i_%s.fnt", fontNumber, Cvar_VariableString( "con_charset" )) > 0 )
|
"font%i_%s.fnt", fontNumber, Cvar_VariableString( "con_charset" )) > 0 )
|
||||||
{
|
{
|
||||||
success = Con_LoadVariableWidthFont( path, font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( path, font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
Q_snprintf( path, sizeof( path ), "fonts/font%i", fontNumber );
|
Q_snprintf( path, sizeof( path ), "fonts/font%i", fontNumber );
|
||||||
success = Con_LoadVariableWidthFont( path, font, scale, kRenderTransTexture, TF_FONT|TF_NEAREST );
|
success = Con_LoadVariableWidthFont( path, font, scale, &con_fontrender, TF_FONT|TF_NEAREST );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,7 +576,7 @@ static void Con_LoadConsoleFont( int fontNumber, cl_font_t *font )
|
|||||||
{
|
{
|
||||||
// quake fixed font as fallback
|
// quake fixed font as fallback
|
||||||
// keep source to print directly into conback image
|
// keep source to print directly into conback image
|
||||||
if( !Con_LoadFixedWidthFont( "gfx/conchars", font, scale, kRenderTransTexture, TF_FONT|TF_KEEP_SOURCE ))
|
if( !Con_LoadFixedWidthFont( "gfx/conchars", font, scale, &con_fontrender, TF_FONT|TF_NEAREST|TF_KEEP_SOURCE ))
|
||||||
Con_DPrintf( S_ERROR "failed to load console font\n" );
|
Con_DPrintf( S_ERROR "failed to load console font\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -608,19 +610,6 @@ static void Con_LoadConchars( void )
|
|||||||
con.curFont = &con.chars[fontSize];
|
con.curFont = &con.chars[fontSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
// CP1251 table
|
|
||||||
|
|
||||||
int table_cp1251[64] = {
|
|
||||||
0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021,
|
|
||||||
0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,
|
|
||||||
0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
|
||||||
0x007F, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F,
|
|
||||||
0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7,
|
|
||||||
0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407,
|
|
||||||
0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7,
|
|
||||||
0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============================
|
============================
|
||||||
Con_UtfProcessChar
|
Con_UtfProcessChar
|
||||||
@@ -630,84 +619,28 @@ Convert utf char to current font's single-byte encoding
|
|||||||
*/
|
*/
|
||||||
int Con_UtfProcessCharForce( int in )
|
int Con_UtfProcessCharForce( int in )
|
||||||
{
|
{
|
||||||
static int m = -1, k = 0; //multibyte state
|
// TODO: get rid of global state where possible
|
||||||
static int uc = 0; //unicode char
|
static utfstate_t state = { 0 };
|
||||||
|
|
||||||
if( !in )
|
int ch = Q_DecodeUTF8( &state, in );
|
||||||
{
|
|
||||||
m = -1;
|
|
||||||
k = 0;
|
|
||||||
uc = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get character length
|
|
||||||
if(m == -1)
|
|
||||||
{
|
|
||||||
uc = 0;
|
|
||||||
if( in >= 0xF8 )
|
|
||||||
return 0;
|
|
||||||
else if( in >= 0xF0 )
|
|
||||||
uc = in & 0x07, m = 3;
|
|
||||||
else if( in >= 0xE0 )
|
|
||||||
uc = in & 0x0F, m = 2;
|
|
||||||
else if( in >= 0xC0 )
|
|
||||||
uc = in & 0x1F, m = 1;
|
|
||||||
else if( in <= 0x7F)
|
|
||||||
return in; //ascii
|
|
||||||
// return 0 if we need more chars to decode one
|
|
||||||
k=0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// get more chars
|
|
||||||
else if( k <= m )
|
|
||||||
{
|
|
||||||
uc <<= 6;
|
|
||||||
uc += in & 0x3F;
|
|
||||||
k++;
|
|
||||||
}
|
|
||||||
if( in > 0xBF || m < 0 )
|
|
||||||
{
|
|
||||||
m = -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if( k == m )
|
|
||||||
{
|
|
||||||
k = m = -1;
|
|
||||||
if( g_codepage == 1251 )
|
if( g_codepage == 1251 )
|
||||||
{
|
return Q_UnicodeToCP1251( ch );
|
||||||
// cp1251 now
|
if( g_codepage == 1252 )
|
||||||
if( uc >= 0x0410 && uc <= 0x042F )
|
return Q_UnicodeToCP1252( ch );
|
||||||
return uc - 0x410 + 0xC0;
|
|
||||||
if( uc >= 0x0430 && uc <= 0x044F )
|
|
||||||
return uc - 0x430 + 0xE0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for( i = 0; i < 64; i++ )
|
|
||||||
if( table_cp1251[i] == uc )
|
|
||||||
return i + 0x80;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( g_codepage == 1252 )
|
|
||||||
{
|
|
||||||
if( uc < 255 )
|
|
||||||
return uc;
|
|
||||||
}
|
|
||||||
|
|
||||||
// not implemented yet
|
return '?'; // not implemented yet
|
||||||
return '?';
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int GAME_EXPORT Con_UtfProcessChar( int in )
|
int GAME_EXPORT Con_UtfProcessChar( int in )
|
||||||
{
|
{
|
||||||
if( !g_utf8 )
|
if( !cls.accept_utf8 ) // incoming character is not a UTF-8 sequence
|
||||||
return in;
|
return in;
|
||||||
else
|
|
||||||
|
// otherwise, decode it and convert to selected codepage
|
||||||
return Con_UtfProcessCharForce( in );
|
return Con_UtfProcessCharForce( in );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Con_UtfMoveLeft
|
Con_UtfMoveLeft
|
||||||
@@ -717,16 +650,22 @@ get position of previous printful char
|
|||||||
*/
|
*/
|
||||||
int Con_UtfMoveLeft( char *str, int pos )
|
int Con_UtfMoveLeft( char *str, int pos )
|
||||||
{
|
{
|
||||||
int i, k = 0;
|
utfstate_t state = { 0 };
|
||||||
// int j;
|
int k = 0;
|
||||||
if( !g_utf8 )
|
int i;
|
||||||
|
|
||||||
|
if( !cls.accept_utf8 ) // incoming character is not a UTF-8 sequence
|
||||||
return pos - 1;
|
return pos - 1;
|
||||||
Con_UtfProcessChar( 0 );
|
|
||||||
if(pos == 1) return 0;
|
if( pos == 1 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
for( i = 0; i < pos - 1; i++ )
|
for( i = 0; i < pos - 1; i++ )
|
||||||
if( Con_UtfProcessChar( (unsigned char)str[i] ) )
|
{
|
||||||
|
if( Q_DecodeUTF8( &state, (byte)str[i] ))
|
||||||
k = i + 1;
|
k = i + 1;
|
||||||
Con_UtfProcessChar( 0 );
|
}
|
||||||
|
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -739,16 +678,18 @@ get next of previous printful char
|
|||||||
*/
|
*/
|
||||||
int Con_UtfMoveRight( char *str, int pos, int length )
|
int Con_UtfMoveRight( char *str, int pos, int length )
|
||||||
{
|
{
|
||||||
|
utfstate_t state = { 0 };
|
||||||
int i;
|
int i;
|
||||||
if( !g_utf8 )
|
|
||||||
|
if( !cls.accept_utf8 ) // incoming character is not a UTF-8 sequence
|
||||||
return pos + 1;
|
return pos + 1;
|
||||||
Con_UtfProcessChar( 0 );
|
|
||||||
for( i = pos; i <= length; i++ )
|
for( i = pos; i <= length; i++ )
|
||||||
{
|
{
|
||||||
if( Con_UtfProcessChar( (unsigned char)str[i] ) )
|
if( Q_DecodeUTF8( &state, (byte)str[i] ))
|
||||||
return i + 1;
|
return i + 1;
|
||||||
}
|
}
|
||||||
Con_UtfProcessChar( 0 );
|
|
||||||
return pos + 1;
|
return pos + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,8 +780,11 @@ void Con_Init( void )
|
|||||||
Cvar_RegisterVariable( &con_fontsize );
|
Cvar_RegisterVariable( &con_fontsize );
|
||||||
Cvar_RegisterVariable( &con_charset );
|
Cvar_RegisterVariable( &con_charset );
|
||||||
Cvar_RegisterVariable( &con_fontscale );
|
Cvar_RegisterVariable( &con_fontscale );
|
||||||
|
Cvar_RegisterVariable( &con_fontrender );
|
||||||
Cvar_RegisterVariable( &con_fontnum );
|
Cvar_RegisterVariable( &con_fontnum );
|
||||||
Cvar_RegisterVariable( &con_color );
|
Cvar_RegisterVariable( &con_color );
|
||||||
|
Cvar_RegisterVariable( &scr_drawversion );
|
||||||
|
Cvar_RegisterVariable( &con_oldfont );
|
||||||
|
|
||||||
// init the console buffer
|
// init the console buffer
|
||||||
con.bufsize = CON_TEXTSIZE;
|
con.bufsize = CON_TEXTSIZE;
|
||||||
@@ -903,7 +847,6 @@ void Con_Print( const char *txt )
|
|||||||
static char buf[MAX_PRINT_MSG];
|
static char buf[MAX_PRINT_MSG];
|
||||||
qboolean norefresh = false;
|
qboolean norefresh = false;
|
||||||
static int lastlength = 0;
|
static int lastlength = 0;
|
||||||
static qboolean inupdate;
|
|
||||||
static int bufpos = 0;
|
static int bufpos = 0;
|
||||||
int c, mask = 0;
|
int c, mask = 0;
|
||||||
|
|
||||||
@@ -932,7 +875,6 @@ void Con_Print( const char *txt )
|
|||||||
Con_DeleteLastLine();
|
Con_DeleteLastLine();
|
||||||
cr_pending = 0;
|
cr_pending = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
c = *txt;
|
c = *txt;
|
||||||
|
|
||||||
switch( c )
|
switch( c )
|
||||||
@@ -940,10 +882,13 @@ void Con_Print( const char *txt )
|
|||||||
case '\0':
|
case '\0':
|
||||||
break;
|
break;
|
||||||
case '\r':
|
case '\r':
|
||||||
|
if( txt[1] != '\n' )
|
||||||
|
{
|
||||||
Con_AddLine( buf, bufpos, true );
|
Con_AddLine( buf, bufpos, true );
|
||||||
lastlength = CON_LINES_LAST().length;
|
lastlength = CON_LINES_LAST().length;
|
||||||
cr_pending = 1;
|
cr_pending = 1;
|
||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
Con_AddLine( buf, bufpos, true );
|
Con_AddLine( buf, bufpos, true );
|
||||||
@@ -951,6 +896,7 @@ void Con_Print( const char *txt )
|
|||||||
bufpos = 0;
|
bufpos = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
buf[bufpos++] = c | mask;
|
buf[bufpos++] = c | mask;
|
||||||
if(( bufpos >= sizeof( buf ) - 1 ) || bufpos >= ( con.linewidth - 1 ))
|
if(( bufpos >= sizeof( buf ) - 1 ) || bufpos >= ( con.linewidth - 1 ))
|
||||||
{
|
{
|
||||||
@@ -994,6 +940,27 @@ void Con_Print( const char *txt )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
Con_NXPrintfv
|
||||||
|
|
||||||
|
Draw a single debug line with specified height, color and time to live
|
||||||
|
================
|
||||||
|
*/
|
||||||
|
static void Con_NXPrintfv( keydest_t key_dest, const con_nprint_t *info, const char *fmt, va_list va )
|
||||||
|
{
|
||||||
|
if( info->index < 0 || info->index >= ARRAYSIZE( con.notify ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_vsnprintf( con.notify[info->index].szNotify, sizeof( con.notify[info->index].szNotify ), fmt, va );
|
||||||
|
|
||||||
|
// setup values
|
||||||
|
con.notify[info->index].key_dest = key_dest;
|
||||||
|
con.notify[info->index].expire = host.realtime + info->time_to_live;
|
||||||
|
MakeRGBA( con.notify[info->index].color, (byte)(info->color[0] * 255), (byte)(info->color[1] * 255), (byte)(info->color[2] * 255), 255 );
|
||||||
|
con.draw_notify = true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
Con_NPrint
|
Con_NPrint
|
||||||
@@ -1004,21 +971,16 @@ Draw a single debug line with specified height
|
|||||||
void GAME_EXPORT Con_NPrintf( int idx, const char *fmt, ... )
|
void GAME_EXPORT Con_NPrintf( int idx, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
con_nprint_t info =
|
||||||
if( idx < 0 || idx >= MAX_DBG_NOTIFY )
|
{
|
||||||
return;
|
.index = idx,
|
||||||
|
.time_to_live = 4.0f,
|
||||||
memset( con.notify[idx].szNotify, 0, MAX_STRING );
|
.color = { 1.0f, 1.0f, 1.0f },
|
||||||
|
};
|
||||||
|
|
||||||
va_start( args, fmt );
|
va_start( args, fmt );
|
||||||
Q_vsnprintf( con.notify[idx].szNotify, MAX_STRING, fmt, args );
|
Con_NXPrintfv( key_game, &info, fmt, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
|
|
||||||
// reset values
|
|
||||||
con.notify[idx].key_dest = key_game;
|
|
||||||
con.notify[idx].expire = host.realtime + 4.0f;
|
|
||||||
MakeRGBA( con.notify[idx].color, 255, 255, 255, 255 );
|
|
||||||
con.draw_notify = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1034,20 +996,9 @@ void GAME_EXPORT Con_NXPrintf( con_nprint_t *info, const char *fmt, ... )
|
|||||||
|
|
||||||
if( !info ) return;
|
if( !info ) return;
|
||||||
|
|
||||||
if( info->index < 0 || info->index >= MAX_DBG_NOTIFY )
|
|
||||||
return;
|
|
||||||
|
|
||||||
memset( con.notify[info->index].szNotify, 0, MAX_STRING );
|
|
||||||
|
|
||||||
va_start( args, fmt );
|
va_start( args, fmt );
|
||||||
Q_vsnprintf( con.notify[info->index].szNotify, MAX_STRING, fmt, args );
|
Con_NXPrintfv( key_game, info, fmt, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
|
|
||||||
// setup values
|
|
||||||
con.notify[info->index].key_dest = key_game;
|
|
||||||
con.notify[info->index].expire = host.realtime + info->time_to_live;
|
|
||||||
MakeRGBA( con.notify[info->index].color, (byte)(info->color[0] * 255), (byte)(info->color[1] * 255), (byte)(info->color[2] * 255), 255 );
|
|
||||||
con.draw_notify = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1060,21 +1011,16 @@ Draw a single debug line with specified height (menu version)
|
|||||||
void GAME_EXPORT UI_NPrintf( int idx, const char *fmt, ... )
|
void GAME_EXPORT UI_NPrintf( int idx, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
con_nprint_t info =
|
||||||
if( idx < 0 || idx >= MAX_DBG_NOTIFY )
|
{
|
||||||
return;
|
.index = idx,
|
||||||
|
.time_to_live = 4.0f,
|
||||||
memset( con.notify[idx].szNotify, 0, MAX_STRING );
|
.color = { 1.0f, 1.0f, 1.0f },
|
||||||
|
};
|
||||||
|
|
||||||
va_start( args, fmt );
|
va_start( args, fmt );
|
||||||
Q_vsnprintf( con.notify[idx].szNotify, MAX_STRING, fmt, args );
|
Con_NXPrintfv( key_menu, &info, fmt, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
|
|
||||||
// reset values
|
|
||||||
con.notify[idx].key_dest = key_menu;
|
|
||||||
con.notify[idx].expire = host.realtime + 4.0f;
|
|
||||||
MakeRGBA( con.notify[idx].color, 255, 255, 255, 255 );
|
|
||||||
con.draw_notify = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1090,20 +1036,9 @@ void GAME_EXPORT UI_NXPrintf( con_nprint_t *info, const char *fmt, ... )
|
|||||||
|
|
||||||
if( !info ) return;
|
if( !info ) return;
|
||||||
|
|
||||||
if( info->index < 0 || info->index >= MAX_DBG_NOTIFY )
|
|
||||||
return;
|
|
||||||
|
|
||||||
memset( con.notify[info->index].szNotify, 0, MAX_STRING );
|
|
||||||
|
|
||||||
va_start( args, fmt );
|
va_start( args, fmt );
|
||||||
Q_vsnprintf( con.notify[info->index].szNotify, MAX_STRING, fmt, args );
|
Con_NXPrintfv( key_menu, info, fmt, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
|
|
||||||
// setup values
|
|
||||||
con.notify[info->index].key_dest = key_menu;
|
|
||||||
con.notify[info->index].expire = host.realtime + info->time_to_live;
|
|
||||||
MakeRGBA( con.notify[info->index].color, (byte)(info->color[0] * 255), (byte)(info->color[1] * 255), (byte)(info->color[2] * 255), 255 );
|
|
||||||
con.draw_notify = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1118,9 +1053,9 @@ EDIT FIELDS
|
|||||||
Con_ClearField
|
Con_ClearField
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_ClearField( field_t *edit )
|
static void Con_ClearField( field_t *edit )
|
||||||
{
|
{
|
||||||
memset( edit->buffer, 0, MAX_STRING );
|
memset( edit->buffer, 0, sizeof( edit->buffer ));
|
||||||
edit->cursor = 0;
|
edit->cursor = 0;
|
||||||
edit->scroll = 0;
|
edit->scroll = 0;
|
||||||
}
|
}
|
||||||
@@ -1133,7 +1068,7 @@ Field_Set
|
|||||||
static void Field_Set( field_t *f, const char *string )
|
static void Field_Set( field_t *f, const char *string )
|
||||||
{
|
{
|
||||||
f->scroll = 0;
|
f->scroll = 0;
|
||||||
f->cursor = Q_strncpy( f->buffer, string, MAX_STRING );
|
f->cursor = Q_strncpy( f->buffer, string, sizeof( f->buffer ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1141,7 +1076,7 @@ static void Field_Set( field_t *f, const char *string )
|
|||||||
Field_Paste
|
Field_Paste
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Field_Paste( field_t *edit )
|
static void Field_Paste( field_t *edit )
|
||||||
{
|
{
|
||||||
char *cbd;
|
char *cbd;
|
||||||
int i, pasteLen;
|
int i, pasteLen;
|
||||||
@@ -1177,7 +1112,7 @@ in-game talk, and menu fields
|
|||||||
Key events are used for non-printable characters, others are gotten from char events.
|
Key events are used for non-printable characters, others are gotten from char events.
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void Field_KeyDownEvent( field_t *edit, int key )
|
static void Field_KeyDownEvent( field_t *edit, int key )
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
@@ -1248,7 +1183,7 @@ void Field_KeyDownEvent( field_t *edit, int key )
|
|||||||
Field_CharEvent
|
Field_CharEvent
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void Field_CharEvent( field_t *edit, int ch )
|
static void Field_CharEvent( field_t *edit, int ch )
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
@@ -1309,7 +1244,7 @@ void Field_CharEvent( field_t *edit, int ch )
|
|||||||
Field_DrawInputLine
|
Field_DrawInputLine
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void Field_DrawInputLine( int x, int y, field_t *edit )
|
static void Field_DrawInputLine( int x, int y, field_t *edit )
|
||||||
{
|
{
|
||||||
int len, cursorChar;
|
int len, cursorChar;
|
||||||
int drawLen;
|
int drawLen;
|
||||||
@@ -1439,36 +1374,49 @@ static void Con_HistoryAppend( con_history_t *self, field_t *from )
|
|||||||
|
|
||||||
static void Con_LoadHistory( con_history_t *self )
|
static void Con_LoadHistory( con_history_t *self )
|
||||||
{
|
{
|
||||||
const byte *aFile = FS_LoadFile( "console_history.txt", NULL, true );
|
|
||||||
const char *pLine, *pFile;
|
|
||||||
int i, len;
|
|
||||||
field_t *f;
|
field_t *f;
|
||||||
|
file_t *fd;
|
||||||
|
int i;
|
||||||
|
|
||||||
if( !aFile )
|
fd = FS_Open( "console_history.txt", "rb", true );
|
||||||
|
|
||||||
|
if( !fd )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( pFile = pLine = (char *)aFile; *pFile; pFile++ )
|
while( !FS_Eof( fd ))
|
||||||
{
|
{
|
||||||
if( *pFile != '\n' )
|
f = &self->lines[self->next % CON_HISTORY];
|
||||||
|
|
||||||
|
Con_ClearField( f );
|
||||||
|
f->widthInChars = con.linewidth;
|
||||||
|
|
||||||
|
FS_Gets( fd, f->buffer, sizeof( f->buffer ));
|
||||||
|
f->cursor = Q_strlen( f->buffer );
|
||||||
|
|
||||||
|
// skip empty lines
|
||||||
|
if( f->cursor == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Con_ClearField( &self->lines[self->next] );
|
// skip repeating lines
|
||||||
|
if( self->next > 0 )
|
||||||
len = Q_min( pFile - pLine + 1, sizeof( f->buffer ));
|
{
|
||||||
f = &self->lines[self->next % CON_HISTORY];
|
field_t *prev;
|
||||||
f->widthInChars = con.linewidth;
|
prev = &self->lines[(self->next - 1) % CON_HISTORY];
|
||||||
f->cursor = len - 1;
|
if( !Q_stricmp( prev->buffer, f->buffer ))
|
||||||
Q_strncpy( f->buffer, pLine, len);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
self->next++;
|
self->next++;
|
||||||
|
|
||||||
pLine = pFile + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FS_Close( fd );
|
||||||
|
|
||||||
for( i = self->next; i < CON_HISTORY; i++ )
|
for( i = self->next; i < CON_HISTORY; i++ )
|
||||||
{
|
{
|
||||||
Con_ClearField( &self->lines[i] );
|
f = &self->lines[i];
|
||||||
self->lines[i].widthInChars = con.linewidth;
|
|
||||||
|
Con_ClearField( f );
|
||||||
|
f->widthInChars = con.linewidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->line = self->next;
|
self->line = self->next;
|
||||||
@@ -1486,10 +1434,18 @@ static void Con_SaveHistory( con_history_t *self )
|
|||||||
if( historyStart < 0 )
|
if( historyStart < 0 )
|
||||||
historyStart = 0;
|
historyStart = 0;
|
||||||
|
|
||||||
f = FS_Open( "console_history.txt", "w", true );
|
f = FS_Open( "console_history.txt", "wb", true );
|
||||||
|
|
||||||
for( i = historyStart; i < self->next; i++ )
|
for( i = historyStart; i < self->next; i++ )
|
||||||
FS_Printf( f, "%s\n", self->lines[i % CON_HISTORY].buffer );
|
{
|
||||||
|
const char *s = self->lines[i % CON_HISTORY].buffer;
|
||||||
|
|
||||||
|
// HACKHACK: don't save lines that have something that looks like a password
|
||||||
|
if( Q_stristr( s, "password" ) || Q_stristr( s, "_pw" ))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
FS_Printf( f, "%s\n", s );
|
||||||
|
}
|
||||||
|
|
||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
}
|
}
|
||||||
@@ -1531,6 +1487,9 @@ void Key_Console( int key )
|
|||||||
Con_Printf( ">%s\n", con.input.buffer );
|
Con_Printf( ">%s\n", con.input.buffer );
|
||||||
|
|
||||||
// copy line to history buffer
|
// copy line to history buffer
|
||||||
|
// just in case, remove all CR and LF characters pushing it to the history
|
||||||
|
// not sure how they get even added in the first place
|
||||||
|
COM_RemoveLineFeed( con.input.buffer, sizeof( con.input.buffer ));
|
||||||
Con_HistoryAppend( &con.history, &con.input );
|
Con_HistoryAppend( &con.history, &con.input );
|
||||||
|
|
||||||
Con_ClearField( &con.input );
|
Con_ClearField( &con.input );
|
||||||
@@ -1681,7 +1640,7 @@ Con_DrawInput
|
|||||||
The input line scrolls horizontally if typing goes beyond the right edge
|
The input line scrolls horizontally if typing goes beyond the right edge
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_DrawInput( int lines )
|
static void Con_DrawInput( int lines )
|
||||||
{
|
{
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
@@ -1701,7 +1660,7 @@ Con_DrawDebugLines
|
|||||||
Custom debug messages
|
Custom debug messages
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int Con_DrawDebugLines( void )
|
static int Con_DrawDebugLines( void )
|
||||||
{
|
{
|
||||||
notify_t *notify = con.notify;
|
notify_t *notify = con.notify;
|
||||||
int i, count = 0;
|
int i, count = 0;
|
||||||
@@ -1786,7 +1745,7 @@ Con_DrawNotify
|
|||||||
Draws the last few lines of output transparently over the game top
|
Draws the last few lines of output transparently over the game top
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_DrawNotify( void )
|
static void Con_DrawNotify( void )
|
||||||
{
|
{
|
||||||
double time = cl.time;
|
double time = cl.time;
|
||||||
int i, x, y = 0;
|
int i, x, y = 0;
|
||||||
@@ -1797,7 +1756,7 @@ void Con_DrawNotify( void )
|
|||||||
|
|
||||||
if( host.allow_console && ( !Cvar_VariableInteger( "cl_background" ) && !Cvar_VariableInteger( "sv_background" )))
|
if( host.allow_console && ( !Cvar_VariableInteger( "cl_background" ) && !Cvar_VariableInteger( "sv_background" )))
|
||||||
{
|
{
|
||||||
for( i = CON_LINES_COUNT - con.num_times; i < CON_LINES_COUNT; i++ )
|
for( i = Q_max( 0, CON_LINES_COUNT - con.num_times ); i < CON_LINES_COUNT; i++ )
|
||||||
{
|
{
|
||||||
con_lineinfo_t *l = &CON_LINES( i );
|
con_lineinfo_t *l = &CON_LINES( i );
|
||||||
|
|
||||||
@@ -1838,7 +1797,7 @@ If alpha is 0, the line is not drawn, but still wrapped and its height
|
|||||||
returned.
|
returned.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int Con_DrawConsoleLine( int y, int lineno )
|
static int Con_DrawConsoleLine( int y, int lineno )
|
||||||
{
|
{
|
||||||
con_lineinfo_t *li = &CON_LINES( lineno );
|
con_lineinfo_t *li = &CON_LINES( lineno );
|
||||||
|
|
||||||
@@ -1893,7 +1852,7 @@ Con_DrawConsole
|
|||||||
Draws the console with the solid background
|
Draws the console with the solid background
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_DrawSolidConsole( int lines )
|
static void Con_DrawSolidConsole( int lines )
|
||||||
{
|
{
|
||||||
int i, x, y;
|
int i, x, y;
|
||||||
float fraction;
|
float fraction;
|
||||||
@@ -1985,7 +1944,7 @@ void Con_DrawConsole( void )
|
|||||||
{
|
{
|
||||||
if( !cl_allow_levelshots.value && !cls.timedemo )
|
if( !cl_allow_levelshots.value && !cls.timedemo )
|
||||||
{
|
{
|
||||||
if(( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" )) && cls.key_dest != key_console )
|
if( cls.key_dest != key_console && ( Cvar_VariableInteger( "cl_background" ) || Cvar_VariableInteger( "sv_background" )))
|
||||||
con.vislines = con.showlines = 0;
|
con.vislines = con.showlines = 0;
|
||||||
else con.vislines = con.showlines = refState.height;
|
else con.vislines = con.showlines = refState.height;
|
||||||
}
|
}
|
||||||
@@ -2047,26 +2006,30 @@ void Con_DrawVersion( void )
|
|||||||
byte *color = g_color_table[7];
|
byte *color = g_color_table[7];
|
||||||
int stringLen, charH = 0;
|
int stringLen, charH = 0;
|
||||||
int start, height = refState.height;
|
int start, height = refState.height;
|
||||||
qboolean draw_version = false;
|
|
||||||
string curbuild;
|
string curbuild;
|
||||||
|
|
||||||
switch( cls.scrshot_action )
|
if( !scr_drawversion.value || CL_IsDevOverviewMode() == 2 || net_graph.value )
|
||||||
{
|
|
||||||
case scrshot_normal:
|
|
||||||
case scrshot_snapshot:
|
|
||||||
draw_version = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( host.force_draw_version_time > host.realtime )
|
|
||||||
draw_version = true;
|
|
||||||
|
|
||||||
if(( cls.key_dest != key_menu && !draw_version ) || CL_IsDevOverviewMode() == 2 || net_graph.value )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( draw_version )
|
if( cls.key_dest == key_menu )
|
||||||
Q_snprintf( curbuild, MAX_STRING, XASH_ENGINE_NAME " v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
{
|
||||||
else Q_snprintf( curbuild, MAX_STRING, "v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
Q_snprintf( curbuild, sizeof( curbuild ),
|
||||||
|
"v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qboolean draw_version;
|
||||||
|
|
||||||
|
draw_version = cls.scrshot_action == scrshot_normal
|
||||||
|
|| cls.scrshot_action == scrshot_snapshot
|
||||||
|
|| host.force_draw_version_time > host.realtime;
|
||||||
|
|
||||||
|
if( !draw_version )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_snprintf( curbuild, sizeof( curbuild ),
|
||||||
|
XASH_ENGINE_NAME " v%i/" XASH_VERSION " (%s-%s build %i)", PROTOCOL_VERSION, Q_buildos(), Q_buildarch(), Q_buildnum( ));
|
||||||
|
}
|
||||||
|
|
||||||
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
||||||
start = refState.width - stringLen * 1.05f;
|
start = refState.width - stringLen * 1.05f;
|
||||||
@@ -2091,9 +2054,13 @@ void Con_RunConsole( void )
|
|||||||
// decide on the destination height of the console
|
// decide on the destination height of the console
|
||||||
if( host.allow_console && cls.key_dest == key_console )
|
if( host.allow_console && cls.key_dest == key_console )
|
||||||
{
|
{
|
||||||
|
#if XASH_MOBILE_PLATFORM
|
||||||
|
con.showlines = refState.height; // always full screen on mobile devices
|
||||||
|
#else
|
||||||
if( cls.state < ca_active || cl.first_frame )
|
if( cls.state < ca_active || cl.first_frame )
|
||||||
con.showlines = refState.height; // full screen
|
con.showlines = refState.height; // full screen
|
||||||
else con.showlines = (refState.height >> 1); // half screen
|
else con.showlines = (refState.height >> 1); // half screen
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else con.showlines = 0; // none visible
|
else con.showlines = 0; // none visible
|
||||||
|
|
||||||
@@ -2112,10 +2079,7 @@ void Con_RunConsole( void )
|
|||||||
con.vislines = con.showlines;
|
con.vislines = con.showlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( con_charset.flags, FCVAR_CHANGED ) ||
|
if( FBitSet( con_charset.flags|con_fontscale.flags|con_fontnum.flags|cl_charset.flags|con_oldfont.flags, FCVAR_CHANGED ))
|
||||||
FBitSet( con_fontscale.flags, FCVAR_CHANGED ) ||
|
|
||||||
FBitSet( con_fontnum.flags, FCVAR_CHANGED ) ||
|
|
||||||
FBitSet( cl_charset.flags, FCVAR_CHANGED ))
|
|
||||||
{
|
{
|
||||||
// update codepage parameters
|
// update codepage parameters
|
||||||
if( !Q_stricmp( con_charset.string, "cp1251" ))
|
if( !Q_stricmp( con_charset.string, "cp1251" ))
|
||||||
@@ -2134,13 +2098,14 @@ void Con_RunConsole( void )
|
|||||||
g_codepage = 1252;
|
g_codepage = 1252;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_utf8 = !Q_stricmp( cl_charset.string, "utf-8" );
|
cls.accept_utf8 = !Q_stricmp( cl_charset.string, "utf-8" );
|
||||||
Con_InvalidateFonts();
|
Con_InvalidateFonts();
|
||||||
Con_LoadConchars();
|
Con_LoadConchars();
|
||||||
ClearBits( con_charset.flags, FCVAR_CHANGED );
|
ClearBits( con_charset.flags, FCVAR_CHANGED );
|
||||||
ClearBits( con_fontnum.flags, FCVAR_CHANGED );
|
ClearBits( con_fontnum.flags, FCVAR_CHANGED );
|
||||||
ClearBits( con_fontscale.flags, FCVAR_CHANGED );
|
ClearBits( con_fontscale.flags, FCVAR_CHANGED );
|
||||||
ClearBits( cl_charset.flags, FCVAR_CHANGED );
|
ClearBits( cl_charset.flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( con_oldfont.flags, FCVAR_CHANGED );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2171,6 +2136,34 @@ void Con_CharEvent( int key )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int Con_LoadSimpleConback( const char *name, int flags )
|
||||||
|
{
|
||||||
|
const char *paths[] = {
|
||||||
|
"gfx/shell/%s.dds",
|
||||||
|
"gfx/shell/%s.bmp",
|
||||||
|
"gfx/shell/%s.tga",
|
||||||
|
"cached/%s640",
|
||||||
|
"cached/%s",
|
||||||
|
};
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for( i = 0; i < ARRAYSIZE( paths ); i++ )
|
||||||
|
{
|
||||||
|
string path;
|
||||||
|
|
||||||
|
Q_snprintf( path, sizeof( path ), paths[i], name );
|
||||||
|
if( g_fsapi.FileExists( path, false ))
|
||||||
|
{
|
||||||
|
int gl_texturenum = ref.dllFuncs.GL_LoadTexture( path, NULL, 0, flags );
|
||||||
|
|
||||||
|
if( gl_texturenum )
|
||||||
|
return gl_texturenum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=========
|
=========
|
||||||
Con_VidInit
|
Con_VidInit
|
||||||
@@ -2180,46 +2173,25 @@ INTERNAL RESOURCE
|
|||||||
*/
|
*/
|
||||||
void Con_VidInit( void )
|
void Con_VidInit( void )
|
||||||
{
|
{
|
||||||
|
const uint flags = TF_IMAGE|TF_ALLOW_NEAREST;
|
||||||
|
|
||||||
if( !con.historyLoaded )
|
if( !con.historyLoaded )
|
||||||
{
|
{
|
||||||
Con_LoadHistory( &con.history );
|
Con_LoadHistory( &con.history );
|
||||||
con.historyLoaded = true;
|
con.historyLoaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( Sys_CheckParm( "-oldfont" ))
|
||||||
|
Cvar_DirectSet( &con_oldfont, "1" );
|
||||||
|
|
||||||
Con_LoadConchars();
|
Con_LoadConchars();
|
||||||
Con_CheckResize();
|
Con_CheckResize();
|
||||||
|
|
||||||
#if XASH_LOW_MEMORY
|
#if XASH_LOW_MEMORY
|
||||||
con.background = R_GetBuiltinTexture( REF_BLACK_TEXTURE );
|
con.background = R_GetBuiltinTexture( REF_GRAY_TEXTURE );
|
||||||
#else
|
#else
|
||||||
// loading console image
|
// loading console image
|
||||||
if( host.allow_console )
|
con.background = Con_LoadSimpleConback( host.allow_console ? "conback" : "loading", flags );
|
||||||
{
|
|
||||||
// trying to load truecolor image first
|
|
||||||
if( FS_FileExists( "gfx/shell/conback.bmp", false ) || FS_FileExists( "gfx/shell/conback.tga", false ))
|
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/conback", NULL, 0, TF_IMAGE );
|
|
||||||
|
|
||||||
if( !con.background )
|
|
||||||
{
|
|
||||||
if( FS_FileExists( "cached/conback640", false ))
|
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback640", NULL, 0, TF_IMAGE );
|
|
||||||
else if( FS_FileExists( "cached/conback", false ))
|
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/conback", NULL, 0, TF_IMAGE );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// trying to load truecolor image first
|
|
||||||
if( FS_FileExists( "gfx/shell/loading.bmp", false ) || FS_FileExists( "gfx/shell/loading.tga", false ))
|
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "gfx/shell/loading", NULL, 0, TF_IMAGE );
|
|
||||||
|
|
||||||
if( !con.background )
|
|
||||||
{
|
|
||||||
if( FS_FileExists( "cached/loading640", false ))
|
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading640", NULL, 0, TF_IMAGE );
|
|
||||||
else if( FS_FileExists( "cached/loading", false ))
|
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "cached/loading", NULL, 0, TF_IMAGE );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !con.background ) // last chance - quake conback image
|
if( !con.background ) // last chance - quake conback image
|
||||||
{
|
{
|
||||||
@@ -2303,11 +2275,20 @@ Con_DefaultColor
|
|||||||
called from MainUI
|
called from MainUI
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void GAME_EXPORT Con_DefaultColor( int r, int g, int b )
|
void Con_DefaultColor( int r, int g, int b, qboolean gameui )
|
||||||
{
|
{
|
||||||
r = bound( 0, r, 255 );
|
r = bound( 0, r, 255 );
|
||||||
g = bound( 0, g, 255 );
|
g = bound( 0, g, 255 );
|
||||||
b = bound( 0, b, 255 );
|
b = bound( 0, b, 255 );
|
||||||
|
|
||||||
|
// gameui wants to override console color... check if it's not default
|
||||||
|
if( gameui && ( g_color_table[7][0] != r || g_color_table[7][1] != g || g_color_table[7][2] != b ))
|
||||||
|
{
|
||||||
|
// yes, different from default orange, disable con_color
|
||||||
|
SetBits( con_color.flags, FCVAR_READ_ONLY );
|
||||||
|
ClearBits( con_color.flags, FCVAR_CHANGED );
|
||||||
|
}
|
||||||
|
|
||||||
MakeRGBA( g_color_table[7], r, g, b, 255 );
|
MakeRGBA( g_color_table[7], r, g, b, 255 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
438
engine/client/gamma.c
Normal file
438
engine/client/gamma.c
Normal file
@@ -0,0 +1,438 @@
|
|||||||
|
/*
|
||||||
|
gamma.c - gamma routines
|
||||||
|
Copyright (C) 2011 Uncle Mike
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include "xash3d_mathlib.h"
|
||||||
|
#include "enginefeatures.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Gamma conversion support
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
static qboolean gamma_rebuilt;
|
||||||
|
static byte texgammatable[256];
|
||||||
|
static uint lightgammatable[1024];
|
||||||
|
static uint lineargammatable[1024];
|
||||||
|
static uint screengammatable[1024];
|
||||||
|
static CVAR_DEFINE( v_direct, "direct", "0.9", 0, "direct studio lighting" );
|
||||||
|
static CVAR_DEFINE( v_texgamma, "texgamma", "2.0", 0, "texgamma amount" );
|
||||||
|
static CVAR_DEFINE( v_lightgamma, "lightgamma", "2.5", 0, "lightgamma amount" );
|
||||||
|
static CVAR_DEFINE( v_brightness, "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
||||||
|
static CVAR_DEFINE( v_gamma, "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" );
|
||||||
|
|
||||||
|
static void BuildGammaTable( const float gamma, const float brightness, const float texgamma, const float lightgamma )
|
||||||
|
{
|
||||||
|
float g1, g2, g3;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if( gamma != 0.0 )
|
||||||
|
g1 = 1.0 / gamma;
|
||||||
|
else g1 = 0.4;
|
||||||
|
|
||||||
|
g2 = g1 * texgamma;
|
||||||
|
|
||||||
|
if( brightness <= 0.0 )
|
||||||
|
g3 = 0.125;
|
||||||
|
else if( brightness <= 1.0 )
|
||||||
|
g3 = 0.125 - brightness * brightness * 0.075;
|
||||||
|
else
|
||||||
|
g3 = 0.05;
|
||||||
|
|
||||||
|
for( i = 0; i < 256; i++ )
|
||||||
|
{
|
||||||
|
double d = pow( i / 255.0, (double)g2 );
|
||||||
|
int inf = d * 255.0;
|
||||||
|
texgammatable[i] = bound( 0, inf, 255 );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < 1024; i++ )
|
||||||
|
{
|
||||||
|
double d;
|
||||||
|
float f = pow( i / 1023.0, (double)lightgamma );
|
||||||
|
int inf;
|
||||||
|
|
||||||
|
if( brightness > 1.0 )
|
||||||
|
f *= brightness;
|
||||||
|
|
||||||
|
if( f <= g3 )
|
||||||
|
f = ( f / g3 ) * 0.125;
|
||||||
|
else
|
||||||
|
f = (( f - g3 ) / ( 1.0 - g3 )) * 0.875 + 0.125;
|
||||||
|
|
||||||
|
d = pow( (double)f, (double)g1 ); // do not remove the cast, or tests fail
|
||||||
|
inf = d * 1023.0;
|
||||||
|
lightgammatable[i] = bound( 0, inf, 1023 );
|
||||||
|
|
||||||
|
// do these calculations in the same loop...
|
||||||
|
lineargammatable[i] = pow( i / 1023.0, (double)gamma ) * 1023.0;
|
||||||
|
screengammatable[i] = pow( i / 1023.0, 1.0 / gamma ) * 1023.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void V_ValidateGammaCvars( void )
|
||||||
|
{
|
||||||
|
if( v_gamma.value < 1.8f )
|
||||||
|
Cvar_DirectSet( &v_gamma, "1.8" );
|
||||||
|
else if( v_gamma.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_gamma, "3" );
|
||||||
|
|
||||||
|
if( v_texgamma.value < 1.8f )
|
||||||
|
Cvar_DirectSet( &v_texgamma, "1.8" );
|
||||||
|
else if( v_texgamma.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_texgamma, "3" );
|
||||||
|
|
||||||
|
if( v_lightgamma.value < 1.8f )
|
||||||
|
Cvar_DirectSet( &v_lightgamma, "1.8" );
|
||||||
|
else if( v_lightgamma.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_lightgamma, "3" );
|
||||||
|
|
||||||
|
if( v_brightness.value < 0.0f )
|
||||||
|
Cvar_DirectSet( &v_brightness, "0" );
|
||||||
|
else if( v_brightness.value > 3.0f )
|
||||||
|
Cvar_DirectSet( &v_brightness, "3" );
|
||||||
|
}
|
||||||
|
|
||||||
|
void V_CheckGamma( void )
|
||||||
|
{
|
||||||
|
static qboolean dirty = false;
|
||||||
|
|
||||||
|
// because these cvars were defined as archive
|
||||||
|
// but wasn't doing anything useful
|
||||||
|
// reset them into default values
|
||||||
|
// this might be removed after a while
|
||||||
|
if( v_direct.value == 1.0f || v_lightgamma.value == 1.0f )
|
||||||
|
{
|
||||||
|
Cvar_DirectSet( &v_direct, "0.9" );
|
||||||
|
Cvar_DirectSet( &v_lightgamma, "2.5" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( cls.scrshot_action == scrshot_envshot || cls.scrshot_action == scrshot_skyshot )
|
||||||
|
{
|
||||||
|
dirty = true; // force recalculate next normal frame
|
||||||
|
BuildGammaTable( 1.8f, 0.0f, 2.0f, 2.5f );
|
||||||
|
if( ref.initialized )
|
||||||
|
ref.dllFuncs.R_GammaChanged( true );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dirty || FBitSet( v_texgamma.flags|v_lightgamma.flags|v_brightness.flags|v_gamma.flags, FCVAR_CHANGED ))
|
||||||
|
{
|
||||||
|
V_ValidateGammaCvars();
|
||||||
|
|
||||||
|
dirty = false;
|
||||||
|
gamma_rebuilt = true;
|
||||||
|
|
||||||
|
BuildGammaTable( v_gamma.value, v_brightness.value, v_texgamma.value, v_lightgamma.value );
|
||||||
|
|
||||||
|
// force refdll to recalculate lightmaps
|
||||||
|
if( ref.initialized )
|
||||||
|
ref.dllFuncs.R_GammaChanged( false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void V_CheckGammaEnd( void )
|
||||||
|
{
|
||||||
|
// don't reset changed flag if it was set during frame
|
||||||
|
// keep it for next frame
|
||||||
|
if( !gamma_rebuilt )
|
||||||
|
return;
|
||||||
|
|
||||||
|
gamma_rebuilt = false;
|
||||||
|
|
||||||
|
// keep the flags until the end of frame so client.dll will catch these changes
|
||||||
|
if( FBitSet( v_texgamma.flags|v_lightgamma.flags|v_brightness.flags|v_gamma.flags, FCVAR_CHANGED ))
|
||||||
|
{
|
||||||
|
ClearBits( v_texgamma.flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( v_lightgamma.flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( v_brightness.flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( v_gamma.flags, FCVAR_CHANGED );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void V_Init( void )
|
||||||
|
{
|
||||||
|
Cvar_RegisterVariable( &v_texgamma );
|
||||||
|
Cvar_RegisterVariable( &v_lightgamma );
|
||||||
|
Cvar_RegisterVariable( &v_brightness );
|
||||||
|
Cvar_RegisterVariable( &v_gamma );
|
||||||
|
Cvar_RegisterVariable( &v_direct );
|
||||||
|
|
||||||
|
// force gamma init
|
||||||
|
SetBits( v_gamma.flags, FCVAR_CHANGED );
|
||||||
|
V_CheckGamma();
|
||||||
|
}
|
||||||
|
|
||||||
|
byte TextureToGamma( byte b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
return texgammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
byte LightToTexGamma( byte b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
// 255 << 2 is 1020, impossible to overflow
|
||||||
|
return lightgammatable[b << 2] >> 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint LightToTexGammaEx( uint b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
if( unlikely( b > ARRAYSIZE( lightgammatable )))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return lightgammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint ScreenGammaTable( uint b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
if( unlikely( b > ARRAYSIZE( screengammatable )))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return screengammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint LinearGammaTable( uint b )
|
||||||
|
{
|
||||||
|
if( FBitSet( host.features, ENGINE_LINEAR_GAMMA_SPACE ))
|
||||||
|
return b;
|
||||||
|
|
||||||
|
if( unlikely( b > ARRAYSIZE( lineargammatable )))
|
||||||
|
return 0;
|
||||||
|
return lineargammatable[b];
|
||||||
|
}
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
|
typedef struct precomputed_gamma_tables_s
|
||||||
|
{
|
||||||
|
float gamma;
|
||||||
|
float brightness;
|
||||||
|
float texgamma;
|
||||||
|
float lightgamma;
|
||||||
|
byte texgammatable[256];
|
||||||
|
int lightgammatable[1024];
|
||||||
|
int lineargammatable[1024];
|
||||||
|
int screengammatable[1024];
|
||||||
|
} precomputed_gamma_tables_t;
|
||||||
|
|
||||||
|
// put at the end of the file, to not confuse Qt Creator's parser
|
||||||
|
precomputed_gamma_tables_t *Test_GetGammaTables( int i );
|
||||||
|
|
||||||
|
static void Test_PrecomputedGammaTables( void )
|
||||||
|
{
|
||||||
|
precomputed_gamma_tables_t *data;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while(( data = Test_GetGammaTables( i )))
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
|
BuildGammaTable( data->gamma, data->brightness, data->texgamma, data->lightgamma );
|
||||||
|
|
||||||
|
for( j = 0; j < 1024; j++ )
|
||||||
|
{
|
||||||
|
if( j < 256 )
|
||||||
|
{
|
||||||
|
TASSERT_EQi( texgammatable[j], data->texgammatable[j] );
|
||||||
|
}
|
||||||
|
|
||||||
|
TASSERT_EQi( lightgammatable[j], data->lightgammatable[j] );
|
||||||
|
TASSERT_EQi( lineargammatable[j], data->lineargammatable[j] );
|
||||||
|
TASSERT_EQi( screengammatable[j], data->screengammatable[j] );
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Test_RunGamma( void )
|
||||||
|
{
|
||||||
|
TRUN( Test_PrecomputedGammaTables() );
|
||||||
|
}
|
||||||
|
|
||||||
|
precomputed_gamma_tables_t *Test_GetGammaTables( int i )
|
||||||
|
{
|
||||||
|
static precomputed_gamma_tables_t precomputed_data[] = {
|
||||||
|
{
|
||||||
|
.gamma = 2.5,
|
||||||
|
.brightness = 0.0,
|
||||||
|
.texgamma = 2.0,
|
||||||
|
.lightgamma = 2.5,
|
||||||
|
.texgammatable = {
|
||||||
|
0, 3, 5, 7, 9, 10, 12, 14, 15, 17, 19, 20, 22, 23, 25, 26, 27, 29, 30, 31, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 63, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, 80, 81, 82, 83, 84,
|
||||||
|
85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 132, 133, 134, 135, 136, 137, 138,
|
||||||
|
139, 140, 141, 142, 143, 144, 145, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 165, 166, 167, 168, 169, 170, 171, 172, 172, 173, 174, 175, 176, 177, 178, 179, 180, 180, 181, 182, 183, 184, 185,
|
||||||
|
186, 186, 187, 188, 189, 190, 191, 192, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 214, 215, 216, 217, 218, 219, 219, 220, 221, 222, 223, 224, 224, 225, 226, 227, 228, 229,
|
||||||
|
229, 230, 231, 232, 233, 233, 234, 235, 236, 237, 238, 238, 239, 240, 241, 242, 242, 243, 244, 245, 246, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, 255
|
||||||
|
},
|
||||||
|
.lightgammatable = {
|
||||||
|
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
|
||||||
|
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
|
||||||
|
124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||||
|
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
|
||||||
|
228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
|
||||||
|
280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331,
|
||||||
|
332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 343, 343, 344, 345, 346, 347, 348, 349, 350, 351, 353, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 376, 376, 377, 379, 379, 380, 381, 382, 383,
|
||||||
|
384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435,
|
||||||
|
436, 437, 438, 439, 440, 441, 442, 443, 444, 446, 446, 447, 449, 449, 450, 451, 452, 453, 455, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 468, 469, 470, 470, 472, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487,
|
||||||
|
488, 489, 490, 491, 493, 493, 494, 495, 496, 498, 498, 499, 500, 502, 502, 503, 504, 505, 507, 508, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 520, 521, 521, 522, 523, 524, 525, 526, 527, 528, 530, 530, 531, 532, 533, 534, 536, 536, 537, 538, 539,
|
||||||
|
540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 552, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 564, 564, 565, 566, 567, 568, 570, 571, 571, 572, 573, 574, 576, 576, 577, 578, 579, 580, 581, 583, 583, 584, 585, 586, 587, 588, 590, 591, 591,
|
||||||
|
593, 593, 594, 596, 596, 597, 598, 600, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 611, 611, 612, 613, 615, 615, 616, 618, 618, 620, 621, 621, 622, 624, 625, 626, 627, 627, 628, 629, 630, 632, 633, 633, 634, 635, 636, 638, 638, 639, 641, 642, 643, 643,
|
||||||
|
644, 645, 646, 648, 648, 650, 651, 651, 652, 654, 655, 656, 656, 658, 658, 660, 660, 662, 662, 664, 664, 665, 666, 668, 668, 669, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 682, 682, 683, 684, 685, 686, 687, 688, 690, 690, 691, 692, 693, 695, 696,
|
||||||
|
696, 697, 698, 699, 700, 701, 702, 703, 705, 706, 706, 707, 708, 709, 710, 711, 712, 713, 715, 716, 716, 717, 718, 719, 721, 721, 722, 724, 724, 725, 727, 727, 728, 729, 730, 731, 733, 733, 734, 735, 736, 737, 738, 740, 740, 741, 743, 744, 744, 745, 747, 747,
|
||||||
|
748, 749, 750, 752, 753, 753, 755, 755, 757, 757, 758, 759, 760, 761, 762, 764, 764, 766, 766, 767, 769, 770, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 780, 782, 783, 784, 784, 785, 786, 788, 789, 790, 791, 792, 792, 794, 794, 796, 796, 797, 799, 800,
|
||||||
|
801, 801, 802, 803, 804, 805, 806, 807, 809, 810, 810, 811, 813, 813, 815, 815, 816, 817, 819, 819, 820, 822, 823, 823, 824, 825, 826, 827, 829, 829, 830, 832, 832, 833, 835, 835, 837, 837, 839, 840, 840, 841, 842, 843, 844, 845, 847, 847, 849, 849, 850, 851,
|
||||||
|
852, 854, 854, 856, 856, 857, 859, 859, 860, 861, 862, 864, 864, 865, 867, 867, 868, 870, 870, 872, 872, 874, 875, 875, 876, 877, 879, 880, 881, 881, 882, 883, 885, 885, 886, 887, 888, 890, 891, 891, 893, 893, 894, 895, 897, 898, 899, 900, 901, 902, 902, 903,
|
||||||
|
904, 905, 907, 907, 908, 910, 910, 911, 912, 914, 914, 915, 917, 918, 919, 920, 921, 922, 922, 923, 925, 925, 926, 927, 928, 930, 931, 932, 932, 933, 935, 936, 936, 937, 939, 940, 940, 942, 942, 944, 944, 946, 947, 948, 949, 949, 950, 952, 952, 953, 955, 956,
|
||||||
|
957, 958, 959, 959, 960, 962, 962, 964, 965, 965, 967, 967, 969, 970, 971, 972, 973, 973, 975, 975, 976, 977, 978, 979, 980, 982, 982, 984, 984, 986, 986, 988, 988, 990, 991, 992, 993, 993, 994, 995, 996, 998, 999, 999, 1000, 1002, 1002, 1004, 1005, 1005,
|
||||||
|
1006, 1007, 1008, 1010, 1011, 1011, 1013, 1014, 1015, 1016, 1017, 1018, 1018, 1019, 1020, 1021, 1023
|
||||||
|
},
|
||||||
|
.lineargammatable = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11,
|
||||||
|
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 25, 25,
|
||||||
|
25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46,
|
||||||
|
47, 47, 48, 48, 48, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 74, 75, 75, 76, 76,
|
||||||
|
77, 77, 78, 78, 79, 79, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 99, 99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112,
|
||||||
|
113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 122, 122, 123, 124, 124, 125, 126, 126, 127, 128, 129, 129, 130, 131, 132, 132, 133, 134, 134, 135, 136, 137, 137, 138, 139, 140, 140, 141, 142, 143, 144, 144, 145, 146, 147, 147, 148, 149, 150,
|
||||||
|
151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 164, 164, 165, 166, 167, 168, 169, 169, 170, 171, 172, 173, 174, 175, 176, 176, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 193, 194,
|
||||||
|
195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246,
|
||||||
|
247, 248, 249, 250, 251, 252, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 282, 283, 284, 285, 286, 287, 289, 290, 291, 292, 293, 294, 296, 297, 298, 299, 300, 302, 303, 304, 305,
|
||||||
|
306, 308, 309, 310, 311, 312, 314, 315, 316, 317, 319, 320, 321, 322, 324, 325, 326, 327, 329, 330, 331, 333, 334, 335, 336, 338, 339, 340, 342, 343, 344, 345, 347, 348, 349, 351, 352, 353, 355, 356, 357, 359, 360, 361, 363, 364, 365, 367, 368, 369, 371, 372,
|
||||||
|
373, 375, 376, 378, 379, 380, 382, 383, 384, 386, 387, 389, 390, 391, 393, 394, 396, 397, 399, 400, 401, 403, 404, 406, 407, 409, 410, 411, 413, 414, 416, 417, 419, 420, 422, 423, 425, 426, 428, 429, 431, 432, 434, 435, 437, 438, 440, 441, 443, 444, 446, 447,
|
||||||
|
449, 450, 452, 453, 455, 456, 458, 459, 461, 462, 464, 466, 467, 469, 470, 472, 473, 475, 477, 478, 480, 481, 483, 485, 486, 488, 489, 491, 493, 494, 496, 497, 499, 501, 502, 504, 506, 507, 509, 511, 512, 514, 515, 517, 519, 520, 522, 524, 525, 527, 529, 531,
|
||||||
|
532, 534, 536, 537, 539, 541, 542, 544, 546, 548, 549, 551, 553, 554, 556, 558, 560, 561, 563, 565, 567, 568, 570, 572, 574, 575, 577, 579, 581, 583, 584, 586, 588, 590, 592, 593, 595, 597, 599, 601, 602, 604, 606, 608, 610, 612, 613, 615, 617, 619, 621, 623,
|
||||||
|
625, 626, 628, 630, 632, 634, 636, 638, 639, 641, 643, 645, 647, 649, 651, 653, 655, 657, 659, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722, 724,
|
||||||
|
726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 753, 755, 757, 759, 761, 763, 765, 767, 769, 771, 773, 776, 778, 780, 782, 784, 786, 788, 791, 793, 795, 797, 799, 801, 803, 806, 808, 810, 812, 814, 816, 819, 821, 823, 825, 827, 830, 832, 834,
|
||||||
|
836, 839, 841, 843, 845, 847, 850, 852, 854, 856, 859, 861, 863, 865, 868, 870, 872, 874, 877, 879, 881, 884, 886, 888, 890, 893, 895, 897, 900, 902, 904, 907, 909, 911, 914, 916, 918, 921, 923, 925, 928, 930, 932, 935, 937, 940, 942, 944, 947, 949, 952, 954,
|
||||||
|
956, 959, 961, 964, 966, 968, 971, 973, 976, 978, 981, 983, 985, 988, 990, 993, 995, 998, 1000, 1003, 1005, 1008, 1010, 1013, 1015, 1018, 1020, 1023
|
||||||
|
},
|
||||||
|
.screengammatable = {
|
||||||
|
0, 63, 84, 99, 111, 121, 130, 139, 146, 154, 160, 166, 172, 178, 183, 188, 193, 198, 203, 207, 212, 216, 220, 224, 228, 231, 235, 239, 242, 245, 249, 252, 255, 259, 262, 265, 268, 271, 274, 276, 279, 282, 285, 287, 290, 293, 295, 298, 300, 303, 305, 308,
|
||||||
|
310, 313, 315, 317, 320, 322, 324, 326, 328, 331, 333, 335, 337, 339, 341, 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, 363, 365, 367, 369, 370, 372, 374, 376, 378, 379, 381, 383, 385, 386, 388, 390, 392, 393, 395, 397, 398, 400, 401, 403, 405, 406, 408,
|
||||||
|
409, 411, 413, 414, 416, 417, 419, 420, 422, 423, 425, 426, 428, 429, 431, 432, 434, 435, 436, 438, 439, 441, 442, 444, 445, 446, 448, 449, 450, 452, 453, 455, 456, 457, 459, 460, 461, 463, 464, 465, 466, 468, 469, 470, 472, 473, 474, 475, 477, 478, 479, 480,
|
||||||
|
482, 483, 484, 485, 487, 488, 489, 490, 491, 493, 494, 495, 496, 497, 499, 500, 501, 502, 503, 504, 505, 507, 508, 509, 510, 511, 512, 513, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539,
|
||||||
|
540, 541, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, 567, 568, 568, 569, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 585, 586, 587, 588, 589, 590,
|
||||||
|
591, 592, 593, 594, 595, 595, 596, 597, 598, 599, 600, 601, 602, 603, 603, 604, 605, 606, 607, 608, 609, 610, 610, 611, 612, 613, 614, 615, 616, 616, 617, 618, 619, 620, 621, 622, 622, 623, 624, 625, 626, 627, 627, 628, 629, 630, 631, 632, 632, 633, 634, 635,
|
||||||
|
636, 637, 637, 638, 639, 640, 641, 641, 642, 643, 644, 645, 645, 646, 647, 648, 649, 649, 650, 651, 652, 652, 653, 654, 655, 656, 656, 657, 658, 659, 659, 660, 661, 662, 663, 663, 664, 665, 666, 666, 667, 668, 669, 669, 670, 671, 672, 672, 673, 674, 675, 675,
|
||||||
|
676, 677, 678, 678, 679, 680, 681, 681, 682, 683, 684, 684, 685, 686, 686, 687, 688, 689, 689, 690, 691, 692, 692, 693, 694, 694, 695, 696, 697, 697, 698, 699, 699, 700, 701, 701, 702, 703, 704, 704, 705, 706, 706, 707, 708, 708, 709, 710, 711, 711, 712, 713,
|
||||||
|
713, 714, 715, 715, 716, 717, 717, 718, 719, 719, 720, 721, 721, 722, 723, 723, 724, 725, 725, 726, 727, 727, 728, 729, 729, 730, 731, 731, 732, 733, 733, 734, 735, 735, 736, 737, 737, 738, 739, 739, 740, 741, 741, 742, 743, 743, 744, 745, 745, 746, 746, 747,
|
||||||
|
748, 748, 749, 750, 750, 751, 752, 752, 753, 753, 754, 755, 755, 756, 757, 757, 758, 758, 759, 760, 760, 761, 762, 762, 763, 763, 764, 765, 765, 766, 767, 767, 768, 768, 769, 770, 770, 771, 771, 772, 773, 773, 774, 774, 775, 776, 776, 777, 778, 778, 779, 779,
|
||||||
|
780, 781, 781, 782, 782, 783, 784, 784, 785, 785, 786, 786, 787, 788, 788, 789, 789, 790, 791, 791, 792, 792, 793, 794, 794, 795, 795, 796, 796, 797, 798, 798, 799, 799, 800, 801, 801, 802, 802, 803, 803, 804, 805, 805, 806, 806, 807, 807, 808, 809, 809, 810,
|
||||||
|
810, 811, 811, 812, 813, 813, 814, 814, 815, 815, 816, 816, 817, 818, 818, 819, 819, 820, 820, 821, 821, 822, 823, 823, 824, 824, 825, 825, 826, 826, 827, 828, 828, 829, 829, 830, 830, 831, 831, 832, 832, 833, 834, 834, 835, 835, 836, 836, 837, 837, 838, 838,
|
||||||
|
839, 839, 840, 841, 841, 842, 842, 843, 843, 844, 844, 845, 845, 846, 846, 847, 848, 848, 849, 849, 850, 850, 851, 851, 852, 852, 853, 853, 854, 854, 855, 855, 856, 856, 857, 857, 858, 859, 859, 860, 860, 861, 861, 862, 862, 863, 863, 864, 864, 865, 865, 866,
|
||||||
|
866, 867, 867, 868, 868, 869, 869, 870, 870, 871, 871, 872, 872, 873, 873, 874, 874, 875, 875, 876, 876, 877, 877, 878, 878, 879, 879, 880, 880, 881, 881, 882, 882, 883, 883, 884, 884, 885, 885, 886, 886, 887, 887, 888, 888, 889, 889, 890, 890, 891, 891, 892,
|
||||||
|
892, 893, 893, 894, 894, 895, 895, 896, 896, 897, 897, 898, 898, 899, 899, 900, 900, 901, 901, 902, 902, 903, 903, 904, 904, 904, 905, 905, 906, 906, 907, 907, 908, 908, 909, 909, 910, 910, 911, 911, 912, 912, 913, 913, 914, 914, 915, 915, 915, 916, 916, 917,
|
||||||
|
917, 918, 918, 919, 919, 920, 920, 921, 921, 922, 922, 922, 923, 923, 924, 924, 925, 925, 926, 926, 927, 927, 928, 928, 929, 929, 929, 930, 930, 931, 931, 932, 932, 933, 933, 934, 934, 935, 935, 935, 936, 936, 937, 937, 938, 938, 939, 939, 940, 940, 940, 941,
|
||||||
|
941, 942, 942, 943, 943, 944, 944, 944, 945, 945, 946, 946, 947, 947, 948, 948, 949, 949, 949, 950, 950, 951, 951, 952, 952, 953, 953, 953, 954, 954, 955, 955, 956, 956, 957, 957, 957, 958, 958, 959, 959, 960, 960, 961, 961, 961, 962, 962, 963, 963, 964, 964,
|
||||||
|
964, 965, 965, 966, 966, 967, 967, 968, 968, 968, 969, 969, 970, 970, 971, 971, 971, 972, 972, 973, 973, 974, 974, 974, 975, 975, 976, 976, 977, 977, 977, 978, 978, 979, 979, 980, 980, 980, 981, 981, 982, 982, 983, 983, 983, 984, 984, 985, 985, 986, 986, 986,
|
||||||
|
987, 987, 988, 988, 988, 989, 989, 990, 990, 991, 991, 991, 992, 992, 993, 993, 993, 994, 994, 995, 995, 996, 996, 996, 997, 997, 998, 998, 998, 999, 999, 1000, 1000, 1001, 1001, 1001, 1002, 1002, 1003, 1003, 1003, 1004, 1004, 1005, 1005, 1005, 1006, 1006,
|
||||||
|
1007, 1007, 1008, 1008, 1008, 1009, 1009, 1010, 1010, 1010, 1011, 1011, 1012, 1012, 1012, 1013, 1013, 1014, 1014, 1014, 1015, 1015, 1016, 1016, 1016, 1017, 1017, 1018, 1018, 1018, 1019, 1019, 1020, 1020, 1020, 1021, 1021, 1022, 1022, 1023
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
.gamma = 2.2,
|
||||||
|
.brightness = 1.0,
|
||||||
|
.texgamma = 2.2,
|
||||||
|
.lightgamma = 2.4,
|
||||||
|
.texgammatable = {
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
|
||||||
|
66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
|
||||||
|
124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||||
|
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227,
|
||||||
|
228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||||
|
},
|
||||||
|
.lightgammatable = {
|
||||||
|
0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 52, 53, 55, 56, 57, 58, 60, 61, 62, 63, 65, 66, 67, 69, 70, 71, 72, 74, 75, 76,
|
||||||
|
78, 79, 80, 81, 83, 84, 85, 87, 88, 89, 91, 92, 93, 94, 96, 97, 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 112, 113, 114, 116, 117, 118, 120, 121, 122, 124, 125, 126, 128, 129, 130, 132, 133, 134, 136, 137, 138, 140, 141, 142, 144, 145, 147, 148, 149,
|
||||||
|
151, 152, 153, 155, 156, 157, 159, 160, 162, 163, 164, 166, 167, 168, 170, 171, 173, 174, 175, 177, 178, 179, 181, 182, 184, 185, 186, 188, 189, 191, 192, 193, 195, 196, 198, 199, 200, 202, 203, 204, 206, 207, 209, 210, 211, 213, 214, 216, 217, 219, 220, 221,
|
||||||
|
223, 224, 226, 227, 228, 230, 231, 233, 234, 235, 237, 238, 240, 241, 243, 244, 245, 247, 248, 250, 251, 252, 254, 255, 257, 258, 260, 261, 262, 264, 265, 267, 268, 270, 271, 272, 274, 275, 277, 278, 280, 281, 282, 284, 285, 287, 288, 290, 291, 293, 294, 295,
|
||||||
|
297, 298, 300, 301, 303, 304, 306, 307, 308, 310, 311, 313, 314, 316, 317, 319, 320, 321, 323, 324, 326, 327, 329, 330, 332, 333, 335, 336, 337, 339, 340, 342, 343, 345, 346, 348, 349, 351, 352, 354, 355, 356, 358, 359, 361, 362, 364, 365, 367, 368, 370, 371,
|
||||||
|
373, 374, 376, 377, 378, 380, 381, 383, 384, 386, 387, 389, 390, 392, 393, 395, 396, 397, 398, 398, 399, 399, 400, 401, 401, 402, 402, 403, 403, 404, 404, 405, 406, 406, 407, 407, 408, 408, 409, 410, 410, 411, 411, 412, 413, 413, 414, 414, 415, 416, 416, 417,
|
||||||
|
417, 418, 419, 419, 420, 420, 421, 422, 422, 423, 423, 424, 425, 425, 426, 427, 427, 428, 428, 429, 430, 430, 431, 432, 432, 433, 433, 434, 435, 435, 436, 437, 437, 438, 439, 439, 440, 441, 441, 442, 443, 443, 444, 445, 445, 446, 447, 447, 448, 449, 449, 450,
|
||||||
|
451, 451, 452, 453, 453, 454, 455, 455, 456, 457, 457, 458, 459, 459, 460, 461, 461, 462, 463, 464, 464, 465, 466, 466, 467, 468, 468, 469, 470, 471, 471, 472, 473, 473, 474, 475, 476, 476, 477, 478, 478, 479, 480, 481, 481, 482, 483, 483, 484, 485, 486, 486,
|
||||||
|
487, 488, 489, 489, 490, 491, 492, 492, 493, 494, 495, 495, 496, 497, 498, 498, 499, 500, 501, 501, 502, 503, 504, 504, 505, 506, 507, 507, 508, 509, 510, 510, 511, 512, 513, 513, 514, 515, 516, 517, 517, 518, 519, 520, 520, 521, 522, 523, 524, 524, 525, 526,
|
||||||
|
527, 527, 528, 529, 530, 531, 531, 532, 533, 534, 535, 535, 536, 537, 538, 538, 539, 540, 541, 542, 542, 543, 544, 545, 546, 546, 547, 548, 549, 550, 550, 551, 552, 553, 554, 555, 555, 556, 557, 558, 559, 559, 560, 561, 562, 563, 564, 564, 565, 566, 567, 568,
|
||||||
|
568, 569, 570, 571, 572, 573, 573, 574, 575, 576, 577, 578, 578, 579, 580, 581, 582, 583, 583, 584, 585, 586, 587, 588, 588, 589, 590, 591, 592, 593, 593, 594, 595, 596, 597, 598, 599, 599, 600, 601, 602, 603, 604, 605, 605, 606, 607, 608, 609, 610, 611, 611,
|
||||||
|
612, 613, 614, 615, 616, 617, 617, 618, 619, 620, 621, 622, 623, 623, 624, 625, 626, 627, 628, 629, 629, 630, 631, 632, 633, 634, 635, 636, 636, 637, 638, 639, 640, 641, 642, 643, 643, 644, 645, 646, 647, 648, 649, 650, 651, 651, 652, 653, 654, 655, 656, 657,
|
||||||
|
658, 658, 659, 660, 661, 662, 663, 664, 665, 666, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 684, 685, 686, 687, 688, 689, 690, 691, 692, 693, 693, 694, 695, 696, 697, 698, 699, 700, 701, 702, 703, 703,
|
||||||
|
704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, 735, 736, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 749, 750, 751,
|
||||||
|
752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 778, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 795, 795, 796, 797, 798, 799, 800,
|
||||||
|
801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 812, 813, 814, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835, 836, 836, 837, 838, 839, 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, 850,
|
||||||
|
851, 852, 853, 854, 855, 856, 857, 858, 859, 860, 861, 862, 863, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, 900, 900,
|
||||||
|
901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952,
|
||||||
|
953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002,
|
||||||
|
1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1023
|
||||||
|
},
|
||||||
|
.lineargammatable = {
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4,
|
||||||
|
4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17,
|
||||||
|
17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24, 24, 24, 24, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 35, 36,
|
||||||
|
36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 51, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 61, 62, 62, 63,
|
||||||
|
63, 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 80, 81, 82, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 97, 98, 99,
|
||||||
|
99, 100, 100, 101, 102, 102, 103, 104, 104, 105, 105, 106, 107, 107, 108, 109, 109, 110, 111, 111, 112, 113, 113, 114, 115, 115, 116, 117, 117, 118, 119, 119, 120, 121, 121, 122, 123, 123, 124, 125, 126, 126, 127, 128, 128, 129, 130, 131, 131, 132, 133, 133,
|
||||||
|
134, 135, 136, 136, 137, 138, 139, 139, 140, 141, 142, 142, 143, 144, 145, 145, 146, 147, 148, 148, 149, 150, 151, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, 163, 163, 164, 165, 166, 167, 167, 168, 169, 170, 171, 172, 172, 173, 174,
|
||||||
|
175, 176, 177, 177, 178, 179, 180, 181, 182, 183, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 196, 197, 198, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
|
||||||
|
222, 223, 224, 225, 226, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
|
||||||
|
274, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 288, 289, 290, 291, 292, 293, 294, 295, 296, 298, 299, 300, 301, 302, 303, 304, 305, 307, 308, 309, 310, 311, 312, 313, 315, 316, 317, 318, 319, 320, 322, 323, 324, 325, 326, 328, 329, 330, 331, 332,
|
||||||
|
333, 335, 336, 337, 338, 339, 341, 342, 343, 344, 346, 347, 348, 349, 350, 352, 353, 354, 355, 357, 358, 359, 360, 362, 363, 364, 365, 367, 368, 369, 370, 372, 373, 374, 375, 377, 378, 379, 381, 382, 383, 384, 386, 387, 388, 390, 391, 392, 393, 395, 396, 397,
|
||||||
|
399, 400, 401, 403, 404, 405, 407, 408, 409, 411, 412, 413, 415, 416, 417, 419, 420, 421, 423, 424, 426, 427, 428, 430, 431, 432, 434, 435, 437, 438, 439, 441, 442, 443, 445, 446, 448, 449, 450, 452, 453, 455, 456, 458, 459, 460, 462, 463, 465, 466, 468, 469,
|
||||||
|
470, 472, 473, 475, 476, 478, 479, 481, 482, 483, 485, 486, 488, 489, 491, 492, 494, 495, 497, 498, 500, 501, 503, 504, 506, 507, 509, 510, 512, 513, 515, 516, 518, 519, 521, 522, 524, 525, 527, 528, 530, 532, 533, 535, 536, 538, 539, 541, 542, 544, 545, 547,
|
||||||
|
549, 550, 552, 553, 555, 556, 558, 560, 561, 563, 564, 566, 568, 569, 571, 572, 574, 576, 577, 579, 580, 582, 584, 585, 587, 589, 590, 592, 593, 595, 597, 598, 600, 602, 603, 605, 607, 608, 610, 612, 613, 615, 617, 618, 620, 622, 623, 625, 627, 628, 630, 632,
|
||||||
|
633, 635, 637, 639, 640, 642, 644, 645, 647, 649, 650, 652, 654, 656, 657, 659, 661, 663, 664, 666, 668, 670, 671, 673, 675, 677, 678, 680, 682, 684, 685, 687, 689, 691, 692, 694, 696, 698, 700, 701, 703, 705, 707, 709, 710, 712, 714, 716, 718, 719, 721, 723,
|
||||||
|
725, 727, 729, 730, 732, 734, 736, 738, 740, 741, 743, 745, 747, 749, 751, 753, 754, 756, 758, 760, 762, 764, 766, 767, 769, 771, 773, 775, 777, 779, 781, 783, 785, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, 806, 808, 809, 811, 813, 815, 817, 819, 821,
|
||||||
|
823, 825, 827, 829, 831, 833, 835, 837, 839, 841, 843, 845, 847, 849, 851, 853, 855, 857, 859, 861, 863, 865, 867, 869, 871, 873, 875, 877, 879, 881, 883, 885, 887, 889, 891, 893, 895, 897, 899, 901, 903, 905, 907, 910, 912, 914, 916, 918, 920, 922, 924, 926,
|
||||||
|
928, 930, 932, 934, 937, 939, 941, 943, 945, 947, 949, 951, 953, 956, 958, 960, 962, 964, 966, 968, 970, 973, 975, 977, 979, 981, 983, 985, 988, 990, 992, 994, 996, 998, 1001, 1003, 1005, 1007, 1009, 1012, 1014, 1016, 1018, 1020, 1023
|
||||||
|
},
|
||||||
|
.screengammatable = {
|
||||||
|
0, 43, 60, 72, 82, 91, 98, 106, 112, 118, 124, 130, 135, 140, 145, 150, 154, 158, 163, 167, 171, 174, 178, 182, 185, 189, 192, 196, 199, 202, 205, 208, 211, 214, 217, 220, 223, 226, 228, 231, 234, 237, 239, 242, 244, 247, 249, 252, 254, 257, 259, 261,
|
||||||
|
264, 266, 268, 270, 273, 275, 277, 279, 281, 283, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 311, 313, 315, 317, 319, 321, 323, 324, 326, 328, 330, 331, 333, 335, 337, 338, 340, 342, 343, 345, 347, 348, 350, 352, 353, 355, 357, 358, 360,
|
||||||
|
361, 363, 365, 366, 368, 369, 371, 372, 374, 375, 377, 378, 380, 381, 383, 384, 386, 387, 389, 390, 392, 393, 394, 396, 397, 399, 400, 401, 403, 404, 406, 407, 408, 410, 411, 412, 414, 415, 416, 418, 419, 420, 422, 423, 424, 426, 427, 428, 430, 431, 432, 433,
|
||||||
|
435, 436, 437, 438, 440, 441, 442, 443, 445, 446, 447, 448, 450, 451, 452, 453, 454, 456, 457, 458, 459, 460, 462, 463, 464, 465, 466, 467, 469, 470, 471, 472, 473, 474, 475, 477, 478, 479, 480, 481, 482, 483, 484, 486, 487, 488, 489, 490, 491, 492, 493, 494,
|
||||||
|
495, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, 545, 546, 547,
|
||||||
|
548, 549, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 560, 561, 562, 563, 563, 564, 565, 566, 567, 568, 569, 570, 571, 572, 573, 574, 574, 575, 576, 577, 578, 579, 580, 581, 582, 583, 583, 584, 585, 586, 587, 588, 589, 590, 591, 591, 592, 593, 594, 595,
|
||||||
|
596, 597, 598, 598, 599, 600, 601, 602, 603, 604, 604, 605, 606, 607, 608, 609, 609, 610, 611, 612, 613, 614, 615, 615, 616, 617, 618, 619, 620, 620, 621, 622, 623, 624, 624, 625, 626, 627, 628, 629, 629, 630, 631, 632, 633, 633, 634, 635, 636, 637, 637, 638,
|
||||||
|
639, 640, 641, 641, 642, 643, 644, 645, 645, 646, 647, 648, 649, 649, 650, 651, 652, 652, 653, 654, 655, 656, 656, 657, 658, 659, 659, 660, 661, 662, 663, 663, 664, 665, 666, 666, 667, 668, 669, 669, 670, 671, 672, 672, 673, 674, 675, 675, 676, 677, 678, 678,
|
||||||
|
679, 680, 681, 681, 682, 683, 684, 684, 685, 686, 686, 687, 688, 689, 689, 690, 691, 692, 692, 693, 694, 694, 695, 696, 697, 697, 698, 699, 700, 700, 701, 702, 702, 703, 704, 705, 705, 706, 707, 707, 708, 709, 709, 710, 711, 712, 712, 713, 714, 714, 715, 716,
|
||||||
|
716, 717, 718, 719, 719, 720, 721, 721, 722, 723, 723, 724, 725, 725, 726, 727, 728, 728, 729, 730, 730, 731, 732, 732, 733, 734, 734, 735, 736, 736, 737, 738, 738, 739, 740, 740, 741, 742, 742, 743, 744, 744, 745, 746, 746, 747, 748, 748, 749, 750, 750, 751,
|
||||||
|
752, 752, 753, 754, 754, 755, 756, 756, 757, 758, 758, 759, 759, 760, 761, 761, 762, 763, 763, 764, 765, 765, 766, 767, 767, 768, 769, 769, 770, 770, 771, 772, 772, 773, 774, 774, 775, 776, 776, 777, 777, 778, 779, 779, 780, 781, 781, 782, 782, 783, 784, 784,
|
||||||
|
785, 786, 786, 787, 787, 788, 789, 789, 790, 791, 791, 792, 792, 793, 794, 794, 795, 795, 796, 797, 797, 798, 799, 799, 800, 800, 801, 802, 802, 803, 803, 804, 805, 805, 806, 806, 807, 808, 808, 809, 809, 810, 811, 811, 812, 812, 813, 814, 814, 815, 815, 816,
|
||||||
|
817, 817, 818, 818, 819, 820, 820, 821, 821, 822, 823, 823, 824, 824, 825, 825, 826, 827, 827, 828, 828, 829, 830, 830, 831, 831, 832, 833, 833, 834, 834, 835, 835, 836, 837, 837, 838, 838, 839, 839, 840, 841, 841, 842, 842, 843, 843, 844, 845, 845, 846, 846,
|
||||||
|
847, 847, 848, 849, 849, 850, 850, 851, 851, 852, 853, 853, 854, 854, 855, 855, 856, 857, 857, 858, 858, 859, 859, 860, 860, 861, 862, 862, 863, 863, 864, 864, 865, 865, 866, 867, 867, 868, 868, 869, 869, 870, 870, 871, 872, 872, 873, 873, 874, 874, 875, 875,
|
||||||
|
876, 876, 877, 878, 878, 879, 879, 880, 880, 881, 881, 882, 882, 883, 884, 884, 885, 885, 886, 886, 887, 887, 888, 888, 889, 889, 890, 891, 891, 892, 892, 893, 893, 894, 894, 895, 895, 896, 896, 897, 898, 898, 899, 899, 900, 900, 901, 901, 902, 902, 903, 903,
|
||||||
|
904, 904, 905, 905, 906, 906, 907, 908, 908, 909, 909, 910, 910, 911, 911, 912, 912, 913, 913, 914, 914, 915, 915, 916, 916, 917, 917, 918, 918, 919, 920, 920, 921, 921, 922, 922, 923, 923, 924, 924, 925, 925, 926, 926, 927, 927, 928, 928, 929, 929, 930, 930,
|
||||||
|
931, 931, 932, 932, 933, 933, 934, 934, 935, 935, 936, 936, 937, 937, 938, 938, 939, 939, 940, 940, 941, 941, 942, 942, 943, 943, 944, 944, 945, 945, 946, 946, 947, 947, 948, 948, 949, 949, 950, 950, 951, 951, 952, 952, 953, 953, 954, 954, 955, 955, 956, 956,
|
||||||
|
957, 957, 958, 958, 959, 959, 960, 960, 961, 961, 962, 962, 963, 963, 964, 964, 965, 965, 966, 966, 967, 967, 968, 968, 969, 969, 969, 970, 970, 971, 971, 972, 972, 973, 973, 974, 974, 975, 975, 976, 976, 977, 977, 978, 978, 979, 979, 980, 980, 981, 981, 982,
|
||||||
|
982, 982, 983, 983, 984, 984, 985, 985, 986, 986, 987, 987, 988, 988, 989, 989, 990, 990, 991, 991, 991, 992, 992, 993, 993, 994, 994, 995, 995, 996, 996, 997, 997, 998, 998, 999, 999, 999, 1000, 1000, 1001, 1001, 1002, 1002, 1003, 1003, 1004, 1004, 1005,
|
||||||
|
1005, 1006, 1006, 1006, 1007, 1007, 1008, 1008, 1009, 1009, 1010, 1010, 1011, 1011, 1012, 1012, 1012, 1013, 1013, 1014, 1014, 1015, 1015, 1016, 1016, 1017, 1017, 1017, 1018, 1018, 1019, 1019, 1020, 1020, 1021, 1021, 1022, 1022, 1023
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if( i < 0 || i >= ARRAYSIZE( precomputed_data ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return &precomputed_data[i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -134,7 +134,7 @@ static void Joy_ProcessTrigger( const engineAxis_t engineAxis, short value )
|
|||||||
trigThreshold = joy_lt_threshold.value;
|
trigThreshold = joy_lt_threshold.value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Con_Reportf( S_ERROR "Joy_ProcessTrigger: invalid axis = %i", engineAxis );
|
Con_Reportf( S_ERROR "%s: invalid axis = %i\n", __func__, engineAxis );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ static void Joy_ProcessStick( const engineAxis_t engineAxis, short value )
|
|||||||
case JOY_AXIS_PITCH: deadzone = joy_pitch_deadzone.value; break;
|
case JOY_AXIS_PITCH: deadzone = joy_pitch_deadzone.value; break;
|
||||||
case JOY_AXIS_YAW: deadzone = joy_yaw_deadzone.value; break;
|
case JOY_AXIS_YAW: deadzone = joy_yaw_deadzone.value; break;
|
||||||
default:
|
default:
|
||||||
Con_Reportf( S_ERROR "Joy_ProcessStick: invalid axis = %i", engineAxis );
|
Con_Reportf( S_ERROR "%s: invalid axis = %i\n", __func__, engineAxis );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ static void Joy_ProcessStick( const engineAxis_t engineAxis, short value )
|
|||||||
|
|
||||||
// fwd/side axis simulate hat movement
|
// fwd/side axis simulate hat movement
|
||||||
if( ( engineAxis == JOY_AXIS_SIDE || engineAxis == JOY_AXIS_FWD ) &&
|
if( ( engineAxis == JOY_AXIS_SIDE || engineAxis == JOY_AXIS_FWD ) &&
|
||||||
( CL_IsInMenu() || CL_IsInConsole() ) )
|
( cls.key_dest == key_menu || cls.key_dest == key_console ))
|
||||||
{
|
{
|
||||||
int val = 0;
|
int val = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ static struct touch_s
|
|||||||
touchdefaultbutton_t g_DefaultButtons[256];
|
touchdefaultbutton_t g_DefaultButtons[256];
|
||||||
int g_LastDefaultButton;
|
int g_LastDefaultButton;
|
||||||
|
|
||||||
static CVAR_DEFINE_AUTO( touch_in_menu, "0", FCVAR_FILTERABLE, "draw touch in menu (for internal use only)" );
|
static CVAR_DEFINE_AUTO( touch_in_menu, "0", FCVAR_PRIVILEGED, "draw touch in menu (for internal use only)" );
|
||||||
static CVAR_DEFINE_AUTO( touch_forwardzone, "0.06", FCVAR_FILTERABLE, "forward touch zone" );
|
static CVAR_DEFINE_AUTO( touch_forwardzone, "0.06", FCVAR_FILTERABLE, "forward touch zone" );
|
||||||
static CVAR_DEFINE_AUTO( touch_sidezone, "0.06", FCVAR_FILTERABLE, "side touch zone" );
|
static CVAR_DEFINE_AUTO( touch_sidezone, "0.06", FCVAR_FILTERABLE, "side touch zone" );
|
||||||
static CVAR_DEFINE_AUTO( touch_pitch, "90", FCVAR_FILTERABLE, "touch pitch sensitivity" );
|
static CVAR_DEFINE_AUTO( touch_pitch, "90", FCVAR_FILTERABLE, "touch pitch sensitivity" );
|
||||||
@@ -163,8 +163,8 @@ static CVAR_DEFINE_AUTO( touch_dpad_radius, "1.0", FCVAR_FILTERABLE, "dpad radiu
|
|||||||
static CVAR_DEFINE_AUTO( touch_joy_radius, "1.0", FCVAR_FILTERABLE, "joy radius multiplier" );
|
static CVAR_DEFINE_AUTO( touch_joy_radius, "1.0", FCVAR_FILTERABLE, "joy radius multiplier" );
|
||||||
static CVAR_DEFINE_AUTO( touch_move_indicator, "0.0", FCVAR_FILTERABLE, "indicate move events (0 to disable)" );
|
static CVAR_DEFINE_AUTO( touch_move_indicator, "0.0", FCVAR_FILTERABLE, "indicate move events (0 to disable)" );
|
||||||
static CVAR_DEFINE_AUTO( touch_joy_texture, "touch_default/joy", FCVAR_FILTERABLE, "texture for move indicator");
|
static CVAR_DEFINE_AUTO( touch_joy_texture, "touch_default/joy", FCVAR_FILTERABLE, "texture for move indicator");
|
||||||
|
static CVAR_DEFINE_AUTO( touch_emulate, "0", FCVAR_ARCHIVE | FCVAR_PRIVILEGED, "emulate touch with mouse" );
|
||||||
CVAR_DEFINE_AUTO( touch_enable, DEFAULT_TOUCH_ENABLE, FCVAR_ARCHIVE | FCVAR_FILTERABLE, "enable touch controls" );
|
CVAR_DEFINE_AUTO( touch_enable, DEFAULT_TOUCH_ENABLE, FCVAR_ARCHIVE | FCVAR_FILTERABLE, "enable touch controls" );
|
||||||
CVAR_DEFINE_AUTO( touch_emulate, "0", FCVAR_ARCHIVE | FCVAR_FILTERABLE, "emulate touch with mouse" );
|
|
||||||
|
|
||||||
// code looks smaller with it
|
// code looks smaller with it
|
||||||
#define B(x) (button->x)
|
#define B(x) (button->x)
|
||||||
@@ -252,7 +252,7 @@ Touch_DumpConfig
|
|||||||
Dump config to file
|
Dump config to file
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean Touch_DumpConfig( const char *name, const char *profilename )
|
static qboolean Touch_DumpConfig( const char *name, const char *profilename )
|
||||||
{
|
{
|
||||||
file_t *f;
|
file_t *f;
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
@@ -333,7 +333,7 @@ void Touch_WriteConfig( void )
|
|||||||
if( Sys_CheckParm( "-nowriteconfig" ) || !touch.configchanged || !touch.config_loaded )
|
if( Sys_CheckParm( "-nowriteconfig" ) || !touch.configchanged || !touch.config_loaded )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Con_DPrintf( "Touch_WriteConfig(): %s\n", touch_config_file.string );
|
Con_DPrintf( "%s: %s\n", __func__, touch_config_file.string );
|
||||||
|
|
||||||
Q_snprintf( newconfigfile, sizeof( newconfigfile ), "%s.new", touch_config_file.string );
|
Q_snprintf( newconfigfile, sizeof( newconfigfile ), "%s.new", touch_config_file.string );
|
||||||
Q_snprintf( oldconfigfile, sizeof( oldconfigfile ), "%s.bak", touch_config_file.string );
|
Q_snprintf( oldconfigfile, sizeof( oldconfigfile ), "%s.bak", touch_config_file.string );
|
||||||
@@ -767,14 +767,18 @@ static void Touch_ReloadConfig_f( void )
|
|||||||
touch.state = state_none;
|
touch.state = state_none;
|
||||||
if( touch.edit )
|
if( touch.edit )
|
||||||
touch.edit->finger = -1;
|
touch.edit->finger = -1;
|
||||||
|
|
||||||
if( touch.selection )
|
if( touch.selection )
|
||||||
touch.selection->finger = -1;
|
touch.selection->finger = -1;
|
||||||
|
|
||||||
touch.edit = touch.selection = NULL;
|
touch.edit = touch.selection = NULL;
|
||||||
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
|
touch.resize_finger = touch.move_finger = touch.look_finger = touch.wheel_finger = -1;
|
||||||
|
|
||||||
|
if( touch_in_menu.value )
|
||||||
|
Cvar_DirectSet( &touch_in_menu, "0" );
|
||||||
|
|
||||||
if( FS_FileExists( touch_config_file.string, true ))
|
if( FS_FileExists( touch_config_file.string, true ))
|
||||||
{
|
|
||||||
Cbuf_AddTextf( "exec \"%s\"\n", touch_config_file.string );
|
Cbuf_AddTextf( "exec \"%s\"\n", touch_config_file.string );
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Touch_LoadDefaults_f();
|
Touch_LoadDefaults_f();
|
||||||
@@ -1064,7 +1068,7 @@ void Touch_Init( void )
|
|||||||
return;
|
return;
|
||||||
touch.mempool = Mem_AllocPool( "Touch" );
|
touch.mempool = Mem_AllocPool( "Touch" );
|
||||||
//touch.first = touch.last = NULL;
|
//touch.first = touch.last = NULL;
|
||||||
Con_Printf( "IN_TouchInit()\n");
|
Con_Printf( "%s()\n", __func__ );
|
||||||
touch.move_finger = touch.resize_finger = touch.look_finger = touch.wheel_finger = -1;
|
touch.move_finger = touch.resize_finger = touch.look_finger = touch.wheel_finger = -1;
|
||||||
touch.state = state_none;
|
touch.state = state_none;
|
||||||
touch.showeditbuttons = true;
|
touch.showeditbuttons = true;
|
||||||
@@ -1087,18 +1091,19 @@ void Touch_Init( void )
|
|||||||
Touch_AddDefaultButton( "jump", "touch_default/jump", "+jump", 0.880000, 0.227228, 1.000000, 0.454457, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "jump", "touch_default/jump", "+jump", 0.880000, 0.227228, 1.000000, 0.454457, color, 2, 1, 0 );
|
||||||
Touch_AddDefaultButton( "attack", "touch_default/shoot", "+attack", 0.760000, 0.530200, 0.880000, 0.757428, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "attack", "touch_default/shoot", "+attack", 0.760000, 0.530200, 0.880000, 0.757428, color, 2, 1, 0 );
|
||||||
Touch_AddDefaultButton( "attack2", "touch_default/shoot_alt", "+attack2", 0.760000, 0.302971, 0.880000, 0.530200, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "attack2", "touch_default/shoot_alt", "+attack2", 0.760000, 0.302971, 0.880000, 0.530200, color, 2, 1, 0 );
|
||||||
Touch_AddDefaultButton( "loadquick", "touch_default/load", "loadquick", 0.680000, 0.000000, 0.760000, 0.151486, color, 2, 1, 16 );
|
Touch_AddDefaultButton( "loadquick", "touch_default/load", "loadquick", 0.760000, 0.000000, 0.840000, 0.142222, color, 2, 1, 16 );
|
||||||
Touch_AddDefaultButton( "savequick", "touch_default/save", "savequick", 0.760000, 0.000000, 0.840000, 0.151486, color, 2, 1, 16 );
|
Touch_AddDefaultButton( "savequick", "touch_default/save", "savequick", 0.840000, 0.000000, 0.920000, 0.142222, color, 2, 1, 16 );
|
||||||
Touch_AddDefaultButton( "messagemode", "touch_default/keyboard", "messagemode", 0.760000, 0.000000, 0.840000, 0.151486, color, 2, 1, 8 );
|
Touch_AddDefaultButton( "messagemode", "touch_default/keyboard", "messagemode", 0.840000, 0.000000, 0.920000, 0.142222, color, 2, 1, 8 );
|
||||||
Touch_AddDefaultButton( "reload", "touch_default/reload", "+reload", 0.000000, 0.302971, 0.120000, 0.530200, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "reload", "touch_default/reload", "+reload", 0.000000, 0.302971, 0.120000, 0.530200, color, 2, 1, 0 );
|
||||||
Touch_AddDefaultButton( "flashlight", "touch_default/flash_light_filled", "impulse 100", 0.920000, 0.000000, 1.000000, 0.151486, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "flashlight", "touch_default/flash_light_filled", "impulse 100", 0.920000, 0.000000, 1.000000, 0.151486, color, 2, 1, 0 );
|
||||||
Touch_AddDefaultButton( "scores", "touch_default/map", "+showscores", 0.680000, 0.000000, 0.760000, 0.151486, color, 2, 1, 8 );
|
Touch_AddDefaultButton( "scores", "touch_default/map", "+showscores", 0.760000, 0.000000, 0.840000, 0.142222, color, 2, 1, 8 );
|
||||||
Touch_AddDefaultButton( "show_numbers", "touch_default/show_weapons", "exec touch_default/numbers.cfg", 0.440000, 0.833171, 0.520000, 0.984656, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "show_numbers", "touch_default/show_weapons", "exec touch_default/numbers.cfg", 0.440000, 0.833171, 0.520000, 0.984656, color, 2, 1, 0 );
|
||||||
Touch_AddDefaultButton( "duck", "touch_default/crouch", "+duck", 0.880000, 0.757428, 1.000000, 0.984656, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "duck", "touch_default/crouch", "+duck", 0.880000, 0.757428, 1.000000, 0.984656, color, 2, 1, 0 );
|
||||||
Touch_AddDefaultButton( "tduck", "touch_default/tduck", ";+duck", 0.560000, 0.833171, 0.620000, 0.946785, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "tduck", "touch_default/tduck", ";+duck", 0.560000, 0.833171, 0.620000, 0.946785, color, 2, 1, 0 );
|
||||||
Touch_AddDefaultButton( "edit", "touch_default/settings", "touch_enableedit", 0.420000, 0.000000, 0.500000, 0.151486, color, 2, 1, 32 );
|
Touch_AddDefaultButton( "edit", "touch_default/settings", "touch_enableedit", 0.420000, 0.000000, 0.500000, 0.151486, color, 2, 1, 32 );
|
||||||
Touch_AddDefaultButton( "menu", "touch_default/menu", "escape", 0.000000, 0.833171, 0.080000, 0.984656, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "menu", "touch_default/menu", "escape", 0.000000, 0.833171, 0.080000, 0.984656, color, 2, 1, 0 );
|
||||||
Touch_AddDefaultButton( "spray", "touch_default/spray", "impulse 201", 0.840000, 0.000000, 0.920000, 0.151486, color, 2, 1, 0 );
|
Touch_AddDefaultButton( "spray", "touch_default/spray", "impulse 201", 0.680000, 0.000000, 0.760000, 0.142222, color, 2, 1, 8 );
|
||||||
|
Touch_AddDefaultButton( "voicechat", "touch_default/microphone", "+voicerecord", 0.780000, 0.817778, 0.860000, 0.960000, color, 2, 1, 8 );
|
||||||
|
|
||||||
Cmd_AddCommand( "touch_addbutton", Touch_AddButton_f, "add native touch button" );
|
Cmd_AddCommand( "touch_addbutton", Touch_AddButton_f, "add native touch button" );
|
||||||
Cmd_AddCommand( "touch_removebutton", IN_TouchRemoveButton_f, "remove native touch button" );
|
Cmd_AddCommand( "touch_removebutton", IN_TouchRemoveButton_f, "remove native touch button" );
|
||||||
@@ -1217,10 +1222,10 @@ static qboolean Touch_IsVisible( touch_button_t *button )
|
|||||||
if( FBitSet( button->flags, TOUCH_FL_HIDE ))
|
if( FBitSet( button->flags, TOUCH_FL_HIDE ))
|
||||||
return false; // skip hidden
|
return false; // skip hidden
|
||||||
|
|
||||||
if( FBitSet( button->flags, TOUCH_FL_SP ) && CL_GetMaxClients() != 1 )
|
if( FBitSet( button->flags, TOUCH_FL_SP ) && cl.maxclients != 1 )
|
||||||
return false; // skip singleplayer(load, save) buttons in multiplayer
|
return false; // skip singleplayer(load, save) buttons in multiplayer
|
||||||
|
|
||||||
if( FBitSet( button->flags, TOUCH_FL_MP ) && CL_GetMaxClients() == 1 )
|
if( FBitSet( button->flags, TOUCH_FL_MP ) && cl.maxclients == 1 )
|
||||||
return false; // skip multiplayer buttons in singleplayer
|
return false; // skip multiplayer buttons in singleplayer
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2029,10 +2034,18 @@ int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx
|
|||||||
{
|
{
|
||||||
touch.move_finger = touch.resize_finger = touch.look_finger = -1;
|
touch.move_finger = touch.resize_finger = touch.look_finger = -1;
|
||||||
// Hack for keyboard, hope it help
|
// Hack for keyboard, hope it help
|
||||||
|
// a1ba: this is absolutely horrible
|
||||||
if( cls.key_dest == key_console || cls.key_dest == key_message )
|
if( cls.key_dest == key_console || cls.key_dest == key_message )
|
||||||
{
|
{
|
||||||
if ( type == event_down ) // don't pop it again on event_up
|
static float x1 = 0.0f;
|
||||||
|
x1 += dx;
|
||||||
|
|
||||||
|
if( type == event_up ) // don't show keyboard on every tap
|
||||||
|
{
|
||||||
Key_EnableTextInput( true, true );
|
Key_EnableTextInput( true, true );
|
||||||
|
x1 = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if( cls.key_dest == key_console )
|
if( cls.key_dest == key_console )
|
||||||
{
|
{
|
||||||
static float y1 = 0;
|
static float y1 = 0;
|
||||||
@@ -2054,6 +2067,13 @@ int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx
|
|||||||
// exit of console area
|
// exit of console area
|
||||||
if( type == event_down && x < 0.1f && y > 0.9f )
|
if( type == event_down && x < 0.1f && y > 0.9f )
|
||||||
Cbuf_AddText( "escape\n" );
|
Cbuf_AddText( "escape\n" );
|
||||||
|
|
||||||
|
// swipe from edge to exit console/chat
|
||||||
|
if(( x > 0.8f && x1 < -0.1f ) || ( x < 0.2f && x1 > 0.1f ))
|
||||||
|
{
|
||||||
|
Cbuf_AddText( "escape\n" );
|
||||||
|
x1 = 0.0f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
UI_MouseMove( TO_SCRN_X(x), TO_SCRN_Y(y) );
|
UI_MouseMove( TO_SCRN_X(x), TO_SCRN_Y(y) );
|
||||||
//MsgDev( D_NOTE, "touch %d %d\n", TO_SCRN_X(x), TO_SCRN_Y(y) );
|
//MsgDev( D_NOTE, "touch %d %d\n", TO_SCRN_X(x), TO_SCRN_Y(y) );
|
||||||
@@ -2107,7 +2127,7 @@ void Touch_KeyEvent( int key, int down )
|
|||||||
float x, y;
|
float x, y;
|
||||||
int finger, xi, yi;
|
int finger, xi, yi;
|
||||||
|
|
||||||
if( !touch_emulate.value )
|
if( !Touch_Emulated( ))
|
||||||
{
|
{
|
||||||
if( touch_enable.value )
|
if( touch_enable.value )
|
||||||
return;
|
return;
|
||||||
@@ -2148,8 +2168,7 @@ void Touch_KeyEvent( int key, int down )
|
|||||||
x = xi / SCR_W;
|
x = xi / SCR_W;
|
||||||
y = yi / SCR_H;
|
y = yi / SCR_H;
|
||||||
|
|
||||||
Con_DPrintf( "event %d %.2f %.2f %.2f %.2f\n",
|
// Con_DPrintf( "event %d %.2f %.2f %.2f %.2f\n", event, x, y, x - lx, y - ly );
|
||||||
event, x, y, x - lx, y - ly );
|
|
||||||
|
|
||||||
IN_TouchEvent( event, finger, x, y, x - lx, y - ly );
|
IN_TouchEvent( event, finger, x, y, x - lx, y - ly );
|
||||||
|
|
||||||
@@ -2162,6 +2181,11 @@ qboolean Touch_WantVisibleCursor( void )
|
|||||||
return ( touch_enable.value && touch_emulate.value ) || touch.clientonly;
|
return ( touch_enable.value && touch_emulate.value ) || touch.clientonly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qboolean Touch_Emulated( void )
|
||||||
|
{
|
||||||
|
return touch_emulate.value || touch_in_menu.value;
|
||||||
|
}
|
||||||
|
|
||||||
void Touch_Shutdown( void )
|
void Touch_Shutdown( void )
|
||||||
{
|
{
|
||||||
if( !touch.initialized )
|
if( !touch.initialized )
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ GNU General Public License for more details.
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "vgui_draw.h"
|
#include "vgui_draw.h"
|
||||||
|
#include "cursor_type.h"
|
||||||
|
|
||||||
#if XASH_SDL
|
#if XASH_SDL
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
@@ -46,6 +47,8 @@ static CVAR_DEFINE_AUTO( cl_forwardspeed, "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL
|
|||||||
static CVAR_DEFINE_AUTO( cl_backspeed, "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL | FCVAR_FILTERABLE, "Default back move speed" );
|
static CVAR_DEFINE_AUTO( cl_backspeed, "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL | FCVAR_FILTERABLE, "Default back move speed" );
|
||||||
static CVAR_DEFINE_AUTO( cl_sidespeed, "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL | FCVAR_FILTERABLE, "Default side move speed" );
|
static CVAR_DEFINE_AUTO( cl_sidespeed, "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL | FCVAR_FILTERABLE, "Default side move speed" );
|
||||||
|
|
||||||
|
static CVAR_DEFINE_AUTO( m_grab_debug, "0", FCVAR_PRIVILEGED, "show debug messages on mouse state change" );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
IN_CollectInputDevices
|
IN_CollectInputDevices
|
||||||
@@ -107,7 +110,7 @@ void IN_LockInputDevices( qboolean lock )
|
|||||||
IN_StartupMouse
|
IN_StartupMouse
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void IN_StartupMouse( void )
|
static void IN_StartupMouse( void )
|
||||||
{
|
{
|
||||||
Cvar_RegisterVariable( &m_ignore );
|
Cvar_RegisterVariable( &m_ignore );
|
||||||
|
|
||||||
@@ -115,6 +118,7 @@ void IN_StartupMouse( void )
|
|||||||
Cvar_RegisterVariable( &m_yaw );
|
Cvar_RegisterVariable( &m_yaw );
|
||||||
Cvar_RegisterVariable( &look_filter );
|
Cvar_RegisterVariable( &look_filter );
|
||||||
Cvar_RegisterVariable( &m_rawinput );
|
Cvar_RegisterVariable( &m_rawinput );
|
||||||
|
Cvar_RegisterVariable( &m_grab_debug );
|
||||||
|
|
||||||
// You can use -nomouse argument to prevent using mouse from client
|
// You can use -nomouse argument to prevent using mouse from client
|
||||||
// -noenginemouse will disable all mouse input
|
// -noenginemouse will disable all mouse input
|
||||||
@@ -123,11 +127,6 @@ void IN_StartupMouse( void )
|
|||||||
in_mouseinitialized = true;
|
in_mouseinitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GAME_EXPORT IN_SetCursor( void *hCursor )
|
|
||||||
{
|
|
||||||
// stub
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===========
|
===========
|
||||||
IN_MouseSavePos
|
IN_MouseSavePos
|
||||||
@@ -206,68 +205,81 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IN_CheckMouseState( qboolean active )
|
static void IN_SetRelativeMouseMode( qboolean set, qboolean verbose )
|
||||||
{
|
{
|
||||||
static qboolean s_bRawInput, s_bMouseGrab;
|
static qboolean s_bRawInput;
|
||||||
|
|
||||||
#if XASH_WIN32
|
if( set && !s_bRawInput )
|
||||||
qboolean useRawInput = ( m_rawinput.value && clgame.client_dll_uses_sdl ) || clgame.dllFuncs.pfnLookEvent != NULL;
|
|
||||||
#else
|
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
#if XASH_SDL == 2
|
#if XASH_SDL == 2
|
||||||
SDL_GetRelativeMouseState( NULL, NULL );
|
SDL_GetRelativeMouseState( NULL, NULL );
|
||||||
SDL_SetRelativeMouseMode( SDL_TRUE );
|
SDL_SetRelativeMouseMode( SDL_TRUE );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Con_Printf( "Enable relative mode\n" );
|
|
||||||
s_bRawInput = true;
|
s_bRawInput = true;
|
||||||
|
if( verbose )
|
||||||
|
Con_Printf( "%s: true\n", __func__ );
|
||||||
}
|
}
|
||||||
}
|
else if( !set && s_bRawInput )
|
||||||
else
|
|
||||||
{
|
|
||||||
if( s_bRawInput )
|
|
||||||
{
|
{
|
||||||
#if XASH_SDL == 2
|
#if XASH_SDL == 2
|
||||||
SDL_GetRelativeMouseState( NULL, NULL );
|
SDL_GetRelativeMouseState( NULL, NULL );
|
||||||
SDL_SetRelativeMouseMode( SDL_FALSE );
|
SDL_SetRelativeMouseMode( SDL_FALSE );
|
||||||
#endif
|
#endif
|
||||||
// Con_Printf( "Disable relative mode\n" );
|
|
||||||
s_bRawInput = false;
|
s_bRawInput = false;
|
||||||
|
if( verbose )
|
||||||
|
Con_Printf( "%s: false\n", __func__ );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( active && !host.mouse_visible && cls.state == ca_active )
|
static void IN_SetMouseGrab( qboolean set, qboolean verbose )
|
||||||
{
|
{
|
||||||
if( !s_bMouseGrab )
|
static qboolean s_bMouseGrab;
|
||||||
|
|
||||||
|
if( set && !s_bMouseGrab )
|
||||||
{
|
{
|
||||||
#if XASH_SDL
|
#if XASH_SDL
|
||||||
SDL_SetWindowGrab( host.hWnd, SDL_TRUE );
|
SDL_SetWindowGrab( host.hWnd, SDL_TRUE );
|
||||||
#endif
|
#endif
|
||||||
// Con_Printf( "Enable grab\n" );
|
|
||||||
s_bMouseGrab = true;
|
s_bMouseGrab = true;
|
||||||
|
if( verbose )
|
||||||
|
Con_Printf( "%s: true\n", __func__ );
|
||||||
}
|
}
|
||||||
}
|
else if( !set && s_bMouseGrab )
|
||||||
else
|
|
||||||
{
|
|
||||||
if( s_bMouseGrab )
|
|
||||||
{
|
{
|
||||||
#if XASH_SDL
|
#if XASH_SDL
|
||||||
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Con_Printf( "Disable grab\n" );
|
|
||||||
s_bMouseGrab = false;
|
s_bMouseGrab = false;
|
||||||
|
if( verbose )
|
||||||
|
Con_Printf( "%s: false\n", __func__ );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void IN_CheckMouseState( qboolean active )
|
||||||
|
{
|
||||||
|
qboolean use_raw_input, verbose;
|
||||||
|
|
||||||
|
#if XASH_WIN32
|
||||||
|
use_raw_input = ( m_rawinput.value && clgame.client_dll_uses_sdl ) || clgame.dllFuncs.pfnLookEvent != NULL;
|
||||||
|
#else
|
||||||
|
use_raw_input = true; // always use SDL code
|
||||||
|
#endif
|
||||||
|
|
||||||
|
verbose = m_grab_debug.value ? true : false;
|
||||||
|
|
||||||
|
if( m_ignore.value )
|
||||||
|
active = false;
|
||||||
|
|
||||||
|
if( active && use_raw_input && !host.mouse_visible && cls.state == ca_active )
|
||||||
|
IN_SetRelativeMouseMode( true, verbose );
|
||||||
|
else
|
||||||
|
IN_SetRelativeMouseMode( false, verbose );
|
||||||
|
|
||||||
|
if( active && !host.mouse_visible && cls.state == ca_active )
|
||||||
|
IN_SetMouseGrab( true, verbose );
|
||||||
|
else
|
||||||
|
IN_SetMouseGrab( false, verbose );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -313,14 +325,14 @@ void IN_DeactivateMouse( void )
|
|||||||
IN_MouseMove
|
IN_MouseMove
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void IN_MouseMove( void )
|
static void IN_MouseMove( void )
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if( !in_mouseinitialized )
|
if( !in_mouseinitialized )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( touch_emulate.value )
|
if( Touch_Emulated( ))
|
||||||
{
|
{
|
||||||
// touch emulation overrides all input
|
// touch emulation overrides all input
|
||||||
Touch_KeyEvent( 0, 0 );
|
Touch_KeyEvent( 0, 0 );
|
||||||
@@ -351,7 +363,7 @@ void IN_MouseEvent( int key, int down )
|
|||||||
else ClearBits( in_mstate, BIT( key ));
|
else ClearBits( in_mstate, BIT( key ));
|
||||||
|
|
||||||
// touch emulation overrides all input
|
// touch emulation overrides all input
|
||||||
if( touch_emulate.value )
|
if( Touch_Emulated( ))
|
||||||
{
|
{
|
||||||
Touch_KeyEvent( K_MOUSE1 + key, down );
|
Touch_KeyEvent( K_MOUSE1 + key, down );
|
||||||
}
|
}
|
||||||
@@ -557,10 +569,9 @@ IN_EngineAppendMove
|
|||||||
Called from cl_main.c after generating command in client
|
Called from cl_main.c after generating command in client
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void IN_EngineAppendMove( float frametime, void *cmd1, qboolean active )
|
void IN_EngineAppendMove( float frametime, usercmd_t *cmd, qboolean active )
|
||||||
{
|
{
|
||||||
float forward, side, pitch, yaw;
|
float forward, side, pitch, yaw;
|
||||||
usercmd_t *cmd = cmd1;
|
|
||||||
|
|
||||||
if( clgame.dllFuncs.pfnLookEvent )
|
if( clgame.dllFuncs.pfnLookEvent )
|
||||||
return;
|
return;
|
||||||
@@ -588,7 +599,7 @@ void IN_EngineAppendMove( float frametime, void *cmd1, qboolean active )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IN_Commands( void )
|
static void IN_Commands( void )
|
||||||
{
|
{
|
||||||
#if XASH_USE_EVDEV
|
#if XASH_USE_EVDEV
|
||||||
IN_EvdevFrame();
|
IN_EvdevFrame();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ INPUT
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "keydefs.h"
|
#include "keydefs.h"
|
||||||
|
#include "usercmd.h"
|
||||||
|
|
||||||
//
|
//
|
||||||
// input.c
|
// input.c
|
||||||
@@ -40,11 +41,10 @@ void IN_DeactivateMouse( void );
|
|||||||
void IN_MouseSavePos( void );
|
void IN_MouseSavePos( void );
|
||||||
void IN_MouseRestorePos( void );
|
void IN_MouseRestorePos( void );
|
||||||
void IN_ToggleClientMouse( int newstate, int oldstate );
|
void IN_ToggleClientMouse( int newstate, int oldstate );
|
||||||
void IN_SetCursor( void *hCursor );
|
|
||||||
|
|
||||||
uint IN_CollectInputDevices( void );
|
uint IN_CollectInputDevices( void );
|
||||||
void IN_LockInputDevices( qboolean lock );
|
void IN_LockInputDevices( qboolean lock );
|
||||||
void IN_EngineAppendMove( float frametime, void *cmd, qboolean active );
|
void IN_EngineAppendMove( float frametime, usercmd_t *cmd, qboolean active );
|
||||||
|
|
||||||
extern convar_t m_yaw;
|
extern convar_t m_yaw;
|
||||||
extern convar_t m_pitch;
|
extern convar_t m_pitch;
|
||||||
@@ -59,7 +59,6 @@ typedef enum
|
|||||||
} touchEventType;
|
} touchEventType;
|
||||||
|
|
||||||
extern convar_t touch_enable;
|
extern convar_t touch_enable;
|
||||||
extern convar_t touch_emulate;
|
|
||||||
|
|
||||||
void Touch_Draw( void );
|
void Touch_Draw( void );
|
||||||
void Touch_SetClientOnly( byte state );
|
void Touch_SetClientOnly( byte state );
|
||||||
@@ -75,6 +74,7 @@ void Touch_ResetDefaultButtons( void );
|
|||||||
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
||||||
void Touch_KeyEvent( int key, int down );
|
void Touch_KeyEvent( int key, int down );
|
||||||
qboolean Touch_WantVisibleCursor( void );
|
qboolean Touch_WantVisibleCursor( void );
|
||||||
|
qboolean Touch_Emulated( void );
|
||||||
void Touch_NotifyResize( void );
|
void Touch_NotifyResize( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ int Key_GetKey( const char *pBinding )
|
|||||||
Key_Unbind_f
|
Key_Unbind_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_Unbind_f( void )
|
static void Key_Unbind_f( void )
|
||||||
{
|
{
|
||||||
int b;
|
int b;
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@ void Key_Unbind_f( void )
|
|||||||
Key_Unbindall_f
|
Key_Unbindall_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_Unbindall_f( void )
|
static void Key_Unbindall_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@ void Key_Unbindall_f( void )
|
|||||||
Key_Reset_f
|
Key_Reset_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_Reset_f( void )
|
static void Key_Reset_f( void )
|
||||||
{
|
{
|
||||||
keyname_t *kn;
|
keyname_t *kn;
|
||||||
int i;
|
int i;
|
||||||
@@ -400,7 +400,7 @@ void Key_Reset_f( void )
|
|||||||
Key_Bind_f
|
Key_Bind_f
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_Bind_f( void )
|
static void Key_Bind_f( void )
|
||||||
{
|
{
|
||||||
char cmd[1024];
|
char cmd[1024];
|
||||||
int i, c, b;
|
int i, c, b;
|
||||||
@@ -473,7 +473,7 @@ Key_Bindlist_f
|
|||||||
|
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Key_Bindlist_f( void )
|
static void Key_Bindlist_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ void Key_Init( void )
|
|||||||
Key_AddKeyCommands
|
Key_AddKeyCommands
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_AddKeyCommands( int key, const char *kb, qboolean down )
|
static void Key_AddKeyCommands( int key, const char *kb, qboolean down )
|
||||||
{
|
{
|
||||||
char button[1024];
|
char button[1024];
|
||||||
char *buttonPtr;
|
char *buttonPtr;
|
||||||
@@ -553,7 +553,7 @@ void Key_AddKeyCommands( int key, const char *kb, qboolean down )
|
|||||||
}
|
}
|
||||||
|
|
||||||
buttonPtr = button;
|
buttonPtr = button;
|
||||||
while(( kb[i] <= ' ' || kb[i] == ';' ) && kb[i] != 0 )
|
while((((byte)kb[i]) <= ' ' || kb[i] == ';' ) && kb[i] != 0 )
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -749,10 +749,10 @@ void GAME_EXPORT Key_Event( int key, int down )
|
|||||||
if( cls.key_dest == key_menu )
|
if( cls.key_dest == key_menu )
|
||||||
{
|
{
|
||||||
// only non printable keys passed
|
// only non printable keys passed
|
||||||
if( !gameui.use_text_api )
|
if( !gameui.use_extended_api )
|
||||||
Key_EnableTextInput( true, false );
|
Key_EnableTextInput( true, false );
|
||||||
//pass printable chars for old menus
|
//pass printable chars for old menus
|
||||||
if( !gameui.use_text_api && !host.textmode && down && ( key >= 32 ) && ( key <= 'z' ) )
|
if( !gameui.use_extended_api && !host.textmode && down && ( key >= 32 ) && ( key <= 'z' ) )
|
||||||
{
|
{
|
||||||
if( Key_IsDown( K_SHIFT ) )
|
if( Key_IsDown( K_SHIFT ) )
|
||||||
{
|
{
|
||||||
@@ -840,7 +840,7 @@ void GAME_EXPORT Key_SetKeyDest( int key_dest )
|
|||||||
cls.key_dest = key_message;
|
cls.key_dest = key_message;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error( "Key_SetKeyDest: wrong destination (%i)\n", key_dest );
|
Host_Error( "%s: wrong destination (%i)\n", __func__, key_dest );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1055,18 +1055,16 @@ static qboolean OSK_KeyEvent( int key, int down )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !Q_stricmp( cl_charset.string, "utf-8" ) )
|
ch = (byte)osk.curbutton.val;
|
||||||
ch = (unsigned char)osk.curbutton.val;
|
|
||||||
else
|
// do not pass UTF-8 sequence into the engine, convert it here
|
||||||
ch = Con_UtfProcessCharForce( (unsigned char)osk.curbutton.val );
|
if( !cls.accept_utf8 )
|
||||||
|
ch = Con_UtfProcessCharForce( ch );
|
||||||
|
|
||||||
if( !ch )
|
if( !ch )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Con_CharEvent( ch );
|
CL_CharEvent( ch );
|
||||||
if( cls.key_dest == key_menu )
|
|
||||||
UI_CharEvent ( ch );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1121,7 +1119,6 @@ static void OSK_EnableTextInput( qboolean enable, qboolean force )
|
|||||||
{
|
{
|
||||||
osk.curlayout = 0;
|
osk.curlayout = 0;
|
||||||
osk.curbutton.val = osk_keylayout[osk.curlayout][osk.curbutton.y][osk.curbutton.x];
|
osk.curbutton.val = osk_keylayout[osk.curlayout][osk.curbutton.y][osk.curbutton.x];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ static void free_winding( winding_t *w )
|
|||||||
{
|
{
|
||||||
// simple sentinel by Carmack
|
// simple sentinel by Carmack
|
||||||
if( *(unsigned *)w == 0xDEADC0DE )
|
if( *(unsigned *)w == 0xDEADC0DE )
|
||||||
Host_Error( "free_winding: freed a freed winding\n" );
|
Host_Error( "%s: freed a freed winding\n", __func__ );
|
||||||
*(unsigned *)w = 0xDEADC0DE;
|
*(unsigned *)w = 0xDEADC0DE;
|
||||||
free( w );
|
free( w );
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ static winding_t *winding_for_plane( const mplane_t *p )
|
|||||||
vup[0] = 1;
|
vup[0] = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error( "BaseWindingForPlane: no axis found\n" );
|
Host_Error( "%s: no axis found\n", __func__ );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,6 +685,9 @@ void Mod_CreatePolygonsForHull( int hullnum )
|
|||||||
if( hullnum < 1 || hullnum > 3 )
|
if( hullnum < 1 || hullnum > 3 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if( !world.num_hull_models )
|
||||||
|
Mod_InitDebugHulls( mod ); // FIXME: build hulls for separate bmodels (shells, medkits etc)
|
||||||
|
|
||||||
Con_Printf( "generating polygons for hull %u...\n", hullnum );
|
Con_Printf( "generating polygons for hull %u...\n", hullnum );
|
||||||
start = Sys_DoubleTime();
|
start = Sys_DoubleTime();
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,9 @@
|
|||||||
struct ref_state_s ref;
|
struct ref_state_s ref;
|
||||||
ref_globals_t refState;
|
ref_globals_t refState;
|
||||||
|
|
||||||
CVAR_DEFINE_AUTO( gl_vsync, "0", FCVAR_ARCHIVE, "enable vertical syncronization" );
|
static const char* r_skyBoxSuffix[SKYBOX_MAX_SIDES] = { "rt", "bk", "lf", "ft", "up", "dn" };
|
||||||
|
|
||||||
|
CVAR_DEFINE_AUTO( gl_vsync, "1", FCVAR_ARCHIVE, "enable vertical syncronization" );
|
||||||
CVAR_DEFINE_AUTO( r_showtextures, "0", FCVAR_CHEAT, "show all uploaded textures" );
|
CVAR_DEFINE_AUTO( r_showtextures, "0", FCVAR_CHEAT, "show all uploaded textures" );
|
||||||
CVAR_DEFINE_AUTO( r_adjust_fov, "1", FCVAR_ARCHIVE, "making FOV adjustment for wide-screens" );
|
CVAR_DEFINE_AUTO( r_adjust_fov, "1", FCVAR_ARCHIVE, "making FOV adjustment for wide-screens" );
|
||||||
CVAR_DEFINE_AUTO( r_decals, "4096", FCVAR_ARCHIVE, "sets the maximum number of decals" );
|
CVAR_DEFINE_AUTO( r_decals, "4096", FCVAR_ARCHIVE, "sets the maximum number of decals" );
|
||||||
@@ -18,19 +20,133 @@ CVAR_DEFINE_AUTO( r_showtree, "0", FCVAR_ARCHIVE, "build the graph of visible BS
|
|||||||
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
static CVAR_DEFINE_AUTO( r_refdll, "", FCVAR_RENDERINFO, "choose renderer implementation, if supported" );
|
||||||
static CVAR_DEFINE_AUTO( r_refdll_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );
|
static CVAR_DEFINE_AUTO( r_refdll_loaded, "", FCVAR_READ_ONLY, "currently loaded renderer" );
|
||||||
|
|
||||||
|
// there is no need to expose whole host and cl structs into the renderer
|
||||||
|
// but we still need to update timings accurately as possible
|
||||||
|
// this looks horrible but the only other option would be passing four
|
||||||
|
// time pointers and then it's looks even worse with dereferences everywhere
|
||||||
|
#define STATIC_OFFSET_CHECK( s1, s2, field, base, msg ) \
|
||||||
|
STATIC_ASSERT( offsetof( s1, field ) == offsetof( s2, field ) - offsetof( s2, base ), msg )
|
||||||
|
#define REF_CLIENT_CHECK( field ) \
|
||||||
|
STATIC_OFFSET_CHECK( ref_client_t, client_t, field, time, "broken ref_client_t offset" ); \
|
||||||
|
STATIC_ASSERT_( szchk_##__LINE__, sizeof(((ref_client_t *)0)->field ) == sizeof( cl.field ), "broken ref_client_t size" )
|
||||||
|
#define REF_HOST_CHECK( field ) \
|
||||||
|
STATIC_OFFSET_CHECK( ref_host_t, host_parm_t, field, realtime, "broken ref_client_t offset" ); \
|
||||||
|
STATIC_ASSERT_( szchk_##__LINE__, sizeof(((ref_host_t *)0)->field ) == sizeof( host.field ), "broken ref_client_t size" )
|
||||||
|
|
||||||
|
REF_CLIENT_CHECK( time );
|
||||||
|
REF_CLIENT_CHECK( oldtime );
|
||||||
|
REF_CLIENT_CHECK( viewentity );
|
||||||
|
REF_CLIENT_CHECK( playernum );
|
||||||
|
REF_CLIENT_CHECK( maxclients );
|
||||||
|
REF_CLIENT_CHECK( models );
|
||||||
|
REF_CLIENT_CHECK( paused );
|
||||||
|
REF_CLIENT_CHECK( simorg );
|
||||||
|
REF_HOST_CHECK( realtime );
|
||||||
|
REF_HOST_CHECK( frametime );
|
||||||
|
REF_HOST_CHECK( features );
|
||||||
|
|
||||||
void R_GetTextureParms( int *w, int *h, int texnum )
|
void R_GetTextureParms( int *w, int *h, int texnum )
|
||||||
{
|
{
|
||||||
if( w ) *w = REF_GET_PARM( PARM_TEX_WIDTH, texnum );
|
if( w ) *w = REF_GET_PARM( PARM_TEX_WIDTH, texnum );
|
||||||
if( h ) *h = REF_GET_PARM( PARM_TEX_HEIGHT, texnum );
|
if( h ) *h = REF_GET_PARM( PARM_TEX_HEIGHT, texnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static qboolean CheckSkybox( const char *name, char out[SKYBOX_MAX_SIDES][MAX_STRING] )
|
||||||
================
|
{
|
||||||
GL_FreeImage
|
static const char *skybox_ext[3] = { "dds", "tga", "bmp" };
|
||||||
|
static const char *skybox_delim[2] = { "", "_" }; // no space for HL style, underscore for Q1 style
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// search for skybox images
|
||||||
|
for( i = 0; i < ARRAYSIZE( skybox_ext ); i++ )
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
|
for( j = 0; j < ARRAYSIZE( skybox_delim ); j++ )
|
||||||
|
{
|
||||||
|
int k, num_checked_sides = 0;
|
||||||
|
|
||||||
|
for( k = 0; k < SKYBOX_MAX_SIDES; k++ )
|
||||||
|
{
|
||||||
|
char sidename[MAX_VA_STRING];
|
||||||
|
|
||||||
|
Q_snprintf( sidename, sizeof( sidename ), "%s%s%s.%s", name, skybox_delim[j], r_skyBoxSuffix[k], skybox_ext[i] );
|
||||||
|
if( g_fsapi.FileExists( sidename, false ))
|
||||||
|
{
|
||||||
|
Q_strncpy( out[k], sidename, sizeof( out[k] ));
|
||||||
|
num_checked_sides++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( num_checked_sides == SKYBOX_MAX_SIDES )
|
||||||
|
return true; // image exists
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_SetupSky( const char *name )
|
||||||
|
{
|
||||||
|
string loadname;
|
||||||
|
char sidenames[SKYBOX_MAX_SIDES][MAX_STRING];
|
||||||
|
int skyboxTextures[SKYBOX_MAX_SIDES] = { 0 };
|
||||||
|
int i, len;
|
||||||
|
qboolean result;
|
||||||
|
|
||||||
|
if( !COM_CheckString( name ))
|
||||||
|
{
|
||||||
|
ref.dllFuncs.R_SetupSky( NULL ); // unload skybox
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_snprintf( loadname, sizeof( loadname ), "gfx/env/%s", name );
|
||||||
|
COM_StripExtension( loadname );
|
||||||
|
|
||||||
|
// kill the underline suffix to find them manually later
|
||||||
|
len = Q_strlen( loadname );
|
||||||
|
|
||||||
|
if( loadname[len - 1] == '_' )
|
||||||
|
loadname[len - 1] = '\0';
|
||||||
|
result = CheckSkybox( loadname, sidenames );
|
||||||
|
|
||||||
|
// to prevent infinite recursion if default skybox was missed
|
||||||
|
if( !result && Q_stricmp( name, DEFAULT_SKYBOX_NAME ))
|
||||||
|
{
|
||||||
|
Con_Reportf( S_WARN "missed or incomplete skybox '%s'\n", name );
|
||||||
|
R_SetupSky( DEFAULT_SKYBOX_NAME ); // force to default
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ref.dllFuncs.R_SetupSky( NULL ); // unload skybox
|
||||||
|
Con_DPrintf( "SKY: " );
|
||||||
|
|
||||||
|
for( i = 0; i < SKYBOX_MAX_SIDES; i++ )
|
||||||
|
{
|
||||||
|
skyboxTextures[i] = ref.dllFuncs.GL_LoadTexture( sidenames[i], NULL, 0, TF_CLAMP|TF_SKY );
|
||||||
|
|
||||||
|
if( !skyboxTextures[i] )
|
||||||
|
break;
|
||||||
|
|
||||||
|
Con_DPrintf( "%s%s%s", name, r_skyBoxSuffix[i], i != 5 ? ", " : ". " );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i == SKYBOX_MAX_SIDES )
|
||||||
|
{
|
||||||
|
SetBits( world.flags, FWORLD_CUSTOM_SKYBOX );
|
||||||
|
Con_DPrintf( "done\n" );
|
||||||
|
ref.dllFuncs.R_SetupSky( skyboxTextures );
|
||||||
|
return; // loaded
|
||||||
|
}
|
||||||
|
|
||||||
|
Con_DPrintf( "^2failed\n" );
|
||||||
|
for( i = 0; i < SKYBOX_MAX_SIDES; i++ )
|
||||||
|
{
|
||||||
|
if( skyboxTextures[i] )
|
||||||
|
ref.dllFuncs.GL_FreeTexture( skyboxTextures[i] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Frees image by name
|
|
||||||
================
|
|
||||||
*/
|
|
||||||
void GAME_EXPORT GL_FreeImage( const char *name )
|
void GAME_EXPORT GL_FreeImage( const char *name )
|
||||||
{
|
{
|
||||||
int texnum;
|
int texnum;
|
||||||
@@ -42,18 +158,8 @@ void GAME_EXPORT GL_FreeImage( const char *name )
|
|||||||
ref.dllFuncs.GL_FreeTexture( texnum );
|
ref.dllFuncs.GL_FreeTexture( texnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_UpdateRefState( void )
|
|
||||||
{
|
|
||||||
refState.time = cl.time;
|
|
||||||
refState.oldtime = cl.oldtime;
|
|
||||||
refState.realtime = host.realtime;
|
|
||||||
refState.frametime = host.frametime;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GL_RenderFrame( const ref_viewpass_t *rvp )
|
void GL_RenderFrame( const ref_viewpass_t *rvp )
|
||||||
{
|
{
|
||||||
R_UpdateRefState();
|
|
||||||
|
|
||||||
VectorCopy( rvp->vieworigin, refState.vieworg );
|
VectorCopy( rvp->vieworigin, refState.vieworg );
|
||||||
VectorCopy( rvp->viewangles, refState.viewangles );
|
VectorCopy( rvp->viewangles, refState.viewangles );
|
||||||
|
|
||||||
@@ -65,9 +171,20 @@ static intptr_t pfnEngineGetParm( int parm, int arg )
|
|||||||
return CL_RenderGetParm( parm, arg, false ); // prevent recursion
|
return CL_RenderGetParm( parm, arg, false ); // prevent recursion
|
||||||
}
|
}
|
||||||
|
|
||||||
static world_static_t *pfnGetWorld( void )
|
static cvar_t *pfnCvar_Get( const char *szName, const char *szValue, int flags, const char *description )
|
||||||
{
|
{
|
||||||
return &world;
|
return (cvar_t *)Cvar_Get( szName, szValue, flags | FCVAR_REFDLL, description );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pfnCvar_RegisterVariable( convar_t *var )
|
||||||
|
{
|
||||||
|
SetBits( var->flags, FCVAR_REFDLL );
|
||||||
|
Cvar_RegisterVariable( var );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void pfnCvar_FullSet( const char *var_name, const char *value, int flags )
|
||||||
|
{
|
||||||
|
Cvar_FullSet( var_name, value, flags | FCVAR_REFDLL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnStudioEvent( const mstudioevent_t *event, const cl_entity_t *e )
|
static void pfnStudioEvent( const mstudioevent_t *event, const cl_entity_t *e )
|
||||||
@@ -81,7 +198,7 @@ static model_t *pfnGetDefaultSprite( enum ref_defaultsprite_e spr )
|
|||||||
{
|
{
|
||||||
case REF_DOT_SPRITE: return cl_sprite_dot;
|
case REF_DOT_SPRITE: return cl_sprite_dot;
|
||||||
case REF_CHROME_SPRITE: return cl_sprite_shell;
|
case REF_CHROME_SPRITE: return cl_sprite_shell;
|
||||||
default: Host_Error( "GetDefaultSprite: unknown sprite %d\n", spr );
|
default: Host_Error( "%s: unknown sprite %d\n", __func__, spr );
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -94,19 +211,15 @@ static void *pfnMod_Extradata( int type, model_t *m )
|
|||||||
case mod_studio: return Mod_StudioExtradata( m );
|
case mod_studio: return Mod_StudioExtradata( m );
|
||||||
case mod_sprite: // fallthrough
|
case mod_sprite: // fallthrough
|
||||||
case mod_brush: return NULL;
|
case mod_brush: return NULL;
|
||||||
default: Host_Error( "Mod_Extradata: unknown type %d\n", type );
|
default: Host_Error( "%s: unknown type %d\n", __func__, type );
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnGetPredictedOrigin( vec3_t v )
|
static void CL_ExtraUpdate( void )
|
||||||
{
|
{
|
||||||
VectorCopy( cl.simorg, v );
|
clgame.dllFuncs.IN_Accumulate();
|
||||||
}
|
S_ExtraUpdate();
|
||||||
|
|
||||||
static color24 *pfnCL_GetPaletteColor( void ) // clgame.palette[color]
|
|
||||||
{
|
|
||||||
return clgame.palette;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
static void pfnCL_GetScreenInfo( int *width, int *height ) // clgame.scrInfo, ptrs may be NULL
|
||||||
@@ -178,25 +291,6 @@ static screenfade_t *pfnRefGetScreenFade( void )
|
|||||||
return &clgame.fade;
|
return &clgame.fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
===============
|
|
||||||
R_DoResetGamma
|
|
||||||
gamma will be reset for
|
|
||||||
some type of screenshots
|
|
||||||
===============
|
|
||||||
*/
|
|
||||||
static qboolean R_DoResetGamma( void )
|
|
||||||
{
|
|
||||||
switch( cls.scrshot_action )
|
|
||||||
{
|
|
||||||
case scrshot_envshot:
|
|
||||||
case scrshot_skyshot:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static qboolean R_Init_Video_( const int type )
|
static qboolean R_Init_Video_( const int type )
|
||||||
{
|
{
|
||||||
host.apply_opengl_config = true;
|
host.apply_opengl_config = true;
|
||||||
@@ -207,23 +301,18 @@ static qboolean R_Init_Video_( const int type )
|
|||||||
return R_Init_Video( type );
|
return R_Init_Video( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
static model_t **pfnGetModels( void )
|
static const ref_api_t gEngfuncs =
|
||||||
{
|
|
||||||
return cl.models;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ref_api_t gEngfuncs =
|
|
||||||
{
|
{
|
||||||
pfnEngineGetParm,
|
pfnEngineGetParm,
|
||||||
|
|
||||||
(void*)Cvar_Get,
|
pfnCvar_Get,
|
||||||
(void*)Cvar_FindVarExt,
|
(void*)Cvar_FindVarExt,
|
||||||
Cvar_VariableValue,
|
Cvar_VariableValue,
|
||||||
Cvar_VariableString,
|
Cvar_VariableString,
|
||||||
Cvar_SetValue,
|
Cvar_SetValue,
|
||||||
Cvar_Set,
|
Cvar_Set,
|
||||||
Cvar_RegisterVariable,
|
pfnCvar_RegisterVariable,
|
||||||
Cvar_FullSet,
|
pfnCvar_FullSet,
|
||||||
|
|
||||||
Cmd_AddRefCommand,
|
Cmd_AddRefCommand,
|
||||||
Cmd_RemoveCommand,
|
Cmd_RemoveCommand,
|
||||||
@@ -246,14 +335,12 @@ static ref_api_t gEngfuncs =
|
|||||||
Con_DrawString,
|
Con_DrawString,
|
||||||
CL_DrawCenterPrint,
|
CL_DrawCenterPrint,
|
||||||
|
|
||||||
CL_GetViewModel,
|
|
||||||
R_BeamGetEntity,
|
R_BeamGetEntity,
|
||||||
CL_GetWaterEntity,
|
CL_GetWaterEntity,
|
||||||
CL_AddVisibleEntity,
|
CL_AddVisibleEntity,
|
||||||
|
|
||||||
Mod_SampleSizeForFace,
|
Mod_SampleSizeForFace,
|
||||||
Mod_BoxVisible,
|
Mod_BoxVisible,
|
||||||
pfnGetWorld,
|
|
||||||
Mod_PointInLeaf,
|
Mod_PointInLeaf,
|
||||||
Mod_CreatePolygonsForHull,
|
Mod_CreatePolygonsForHull,
|
||||||
|
|
||||||
@@ -270,7 +357,6 @@ static ref_api_t gEngfuncs =
|
|||||||
|
|
||||||
Mod_ForName,
|
Mod_ForName,
|
||||||
pfnMod_Extradata,
|
pfnMod_Extradata,
|
||||||
pfnGetModels,
|
|
||||||
|
|
||||||
CL_EntitySetRemapColors,
|
CL_EntitySetRemapColors,
|
||||||
CL_GetRemapInfoForEntity,
|
CL_GetRemapInfoForEntity,
|
||||||
@@ -281,8 +367,6 @@ static ref_api_t gEngfuncs =
|
|||||||
COM_RandomFloat,
|
COM_RandomFloat,
|
||||||
COM_RandomLong,
|
COM_RandomLong,
|
||||||
pfnRefGetScreenFade,
|
pfnRefGetScreenFade,
|
||||||
pfnGetPredictedOrigin,
|
|
||||||
pfnCL_GetPaletteColor,
|
|
||||||
pfnCL_GetScreenInfo,
|
pfnCL_GetScreenInfo,
|
||||||
pfnSetLocalLightLevel,
|
pfnSetLocalLightLevel,
|
||||||
Sys_CheckParm,
|
Sys_CheckParm,
|
||||||
@@ -316,9 +400,11 @@ static ref_api_t gEngfuncs =
|
|||||||
SW_LockBuffer,
|
SW_LockBuffer,
|
||||||
SW_UnlockBuffer,
|
SW_UnlockBuffer,
|
||||||
|
|
||||||
BuildGammaTable,
|
|
||||||
LightToTexGamma,
|
LightToTexGamma,
|
||||||
R_DoResetGamma,
|
LightToTexGammaEx,
|
||||||
|
TextureToGamma,
|
||||||
|
ScreenGammaTable,
|
||||||
|
LinearGammaTable,
|
||||||
|
|
||||||
CL_GetLightStyle,
|
CL_GetLightStyle,
|
||||||
CL_GetDynamicLight,
|
CL_GetDynamicLight,
|
||||||
@@ -332,7 +418,6 @@ static ref_api_t gEngfuncs =
|
|||||||
PM_CL_TraceLine,
|
PM_CL_TraceLine,
|
||||||
CL_VisTraceLine,
|
CL_VisTraceLine,
|
||||||
CL_TraceLine,
|
CL_TraceLine,
|
||||||
pfnGetMoveVars,
|
|
||||||
|
|
||||||
Image_AddCmdFlags,
|
Image_AddCmdFlags,
|
||||||
Image_SetForceFlags,
|
Image_SetForceFlags,
|
||||||
@@ -362,7 +447,7 @@ static void R_UnloadProgs( void )
|
|||||||
|
|
||||||
Cvar_FullSet( "host_refloaded", "0", FCVAR_READ_ONLY );
|
Cvar_FullSet( "host_refloaded", "0", FCVAR_READ_ONLY );
|
||||||
|
|
||||||
Cvar_Unlink( FCVAR_RENDERINFO | FCVAR_GLCONFIG );
|
Cvar_Unlink( FCVAR_RENDERINFO | FCVAR_GLCONFIG | FCVAR_REFDLL );
|
||||||
Cmd_Unlink( CMD_REFDLL );
|
Cmd_Unlink( CMD_REFDLL );
|
||||||
|
|
||||||
COM_FreeLibrary( ref.hInstance );
|
COM_FreeLibrary( ref.hInstance );
|
||||||
@@ -398,7 +483,6 @@ static void CL_FillTriAPIFromRef( triangleapi_t *dst, const ref_interface_t *src
|
|||||||
|
|
||||||
static qboolean R_LoadProgs( const char *name )
|
static qboolean R_LoadProgs( const char *name )
|
||||||
{
|
{
|
||||||
extern triangleapi_t gTriApi;
|
|
||||||
static ref_api_t gpEngfuncs;
|
static ref_api_t gpEngfuncs;
|
||||||
REFAPI GetRefAPI; // single export
|
REFAPI GetRefAPI; // single export
|
||||||
|
|
||||||
@@ -408,7 +492,7 @@ static qboolean R_LoadProgs( const char *name )
|
|||||||
if( !( ref.hInstance = COM_LoadLibrary( name, false, true )))
|
if( !( ref.hInstance = COM_LoadLibrary( name, false, true )))
|
||||||
{
|
{
|
||||||
FS_AllowDirectPaths( false );
|
FS_AllowDirectPaths( false );
|
||||||
Con_Reportf( "R_LoadProgs: can't load renderer library %s: %s\n", name, COM_GetLibraryError() );
|
Con_Reportf( "%s: can't load renderer library %s: %s\n", __func__, name, COM_GetLibraryError() );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -416,20 +500,16 @@ static qboolean R_LoadProgs( const char *name )
|
|||||||
|
|
||||||
if( !( GetRefAPI = (REFAPI)COM_GetProcAddress( ref.hInstance, GET_REF_API )))
|
if( !( GetRefAPI = (REFAPI)COM_GetProcAddress( ref.hInstance, GET_REF_API )))
|
||||||
{
|
{
|
||||||
COM_FreeLibrary( ref.hInstance );
|
Con_Reportf( "%s: can't find GetRefAPI entry point in %s\n", __func__, name );
|
||||||
Con_Reportf( "R_LoadProgs: can't find GetRefAPI entry point in %s\n", name );
|
|
||||||
ref.hInstance = NULL;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||||
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
gpEngfuncs = gEngfuncs;
|
||||||
|
|
||||||
if( GetRefAPI( REF_API_VERSION, &ref.dllFuncs, &gpEngfuncs, &refState ) != REF_API_VERSION )
|
if( GetRefAPI( REF_API_VERSION, &ref.dllFuncs, &gpEngfuncs, &refState ) != REF_API_VERSION )
|
||||||
{
|
{
|
||||||
COM_FreeLibrary( ref.hInstance );
|
Con_Reportf( "%s: can't init renderer API: wrong version\n", __func__ );
|
||||||
Con_Reportf( "R_LoadProgs: can't init renderer API: wrong version\n" );
|
|
||||||
ref.hInstance = NULL;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,9 +517,7 @@ static qboolean R_LoadProgs( const char *name )
|
|||||||
|
|
||||||
if( !ref.dllFuncs.R_Init( ))
|
if( !ref.dllFuncs.R_Init( ))
|
||||||
{
|
{
|
||||||
COM_FreeLibrary( ref.hInstance );
|
Con_Reportf( "%s: can't init renderer!\n", __func__ ); //, ref.dllFuncs.R_GetInitError() );
|
||||||
Con_Reportf( "R_LoadProgs: can't init renderer!\n" ); //, ref.dllFuncs.R_GetInitError() );
|
|
||||||
ref.hInstance = NULL;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,21 +554,19 @@ static void R_GetRendererName( char *dest, size_t size, const char *opt )
|
|||||||
{
|
{
|
||||||
if( !Q_strstr( opt, "." OS_LIB_EXT ))
|
if( !Q_strstr( opt, "." OS_LIB_EXT ))
|
||||||
{
|
{
|
||||||
const char *format;
|
|
||||||
|
|
||||||
#ifdef XASH_INTERNAL_GAMELIBS
|
#ifdef XASH_INTERNAL_GAMELIBS
|
||||||
if( !Q_strcmp( opt, "ref_" ))
|
#define FMT1 "%s"
|
||||||
format = "%s";
|
#define FMT2 "ref_%s"
|
||||||
else
|
|
||||||
format = "ref_%s";
|
|
||||||
#else
|
#else
|
||||||
if( !Q_strcmp( opt, "ref_" ))
|
#define FMT1 OS_LIB_PREFIX "%s." OS_LIB_EXT
|
||||||
format = OS_LIB_PREFIX "%s." OS_LIB_EXT;
|
#define FMT2 OS_LIB_PREFIX "ref_%s." OS_LIB_EXT
|
||||||
else
|
|
||||||
format = OS_LIB_PREFIX "ref_%s." OS_LIB_EXT;
|
|
||||||
#endif
|
#endif
|
||||||
Q_snprintf( dest, size, format, opt );
|
if( !Q_strncmp( opt, "ref_", 4 ))
|
||||||
|
Q_snprintf( dest, size, FMT1, opt );
|
||||||
|
else
|
||||||
|
Q_snprintf( dest, size, FMT2, opt );
|
||||||
|
#undef FMT1
|
||||||
|
#undef FMT2
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -587,7 +663,7 @@ static void R_CollectRendererNames( void )
|
|||||||
"GL4ES",
|
"GL4ES",
|
||||||
#endif
|
#endif
|
||||||
#if XASH_REF_GLES3COMPAT_ENABLED
|
#if XASH_REF_GLES3COMPAT_ENABLED
|
||||||
"GLES3 (gl2_shim)"
|
"GLES3 (gl2_shim)",
|
||||||
#endif
|
#endif
|
||||||
#if XASH_REF_SOFT_ENABLED
|
#if XASH_REF_SOFT_ENABLED
|
||||||
"Software",
|
"Software",
|
||||||
@@ -602,7 +678,8 @@ static void R_CollectRendererNames( void )
|
|||||||
qboolean R_Init( void )
|
qboolean R_Init( void )
|
||||||
{
|
{
|
||||||
qboolean success = false;
|
qboolean success = false;
|
||||||
string requested;
|
string requested_cmdline;
|
||||||
|
string requested_cvar;
|
||||||
|
|
||||||
Cvar_RegisterVariable( &gl_vsync );
|
Cvar_RegisterVariable( &gl_vsync );
|
||||||
Cvar_RegisterVariable( &r_showtextures );
|
Cvar_RegisterVariable( &r_showtextures );
|
||||||
@@ -633,6 +710,7 @@ qboolean R_Init( void )
|
|||||||
|
|
||||||
// cvars that are expected to exist by client.dll
|
// cvars that are expected to exist by client.dll
|
||||||
// refdll should just get pointer to them
|
// refdll should just get pointer to them
|
||||||
|
Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "compatibility cvar, does nothing" );
|
||||||
Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
||||||
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
||||||
|
|
||||||
@@ -651,15 +729,16 @@ qboolean R_Init( void )
|
|||||||
// 1. Command line `-ref` argument.
|
// 1. Command line `-ref` argument.
|
||||||
// 2. `ref_dll` cvar.
|
// 2. `ref_dll` cvar.
|
||||||
// 3. Detected renderers in `DEFAULT_RENDERERS` order.
|
// 3. Detected renderers in `DEFAULT_RENDERERS` order.
|
||||||
requested[0] = 0;
|
requested_cmdline[0] = 0;
|
||||||
|
requested_cvar[0] = 0;
|
||||||
|
|
||||||
if( !success && Sys_GetParmFromCmdLine( "-ref", requested ))
|
if( Sys_GetParmFromCmdLine( "-ref", requested_cmdline ))
|
||||||
success = R_LoadRenderer( requested );
|
success = R_LoadRenderer( requested_cmdline );
|
||||||
|
|
||||||
if( !success && COM_CheckString( r_refdll.string ))
|
if( !success && COM_CheckString( r_refdll.string ) && Q_stricmp( requested_cmdline, r_refdll.string ))
|
||||||
{
|
{
|
||||||
Q_strncpy( requested, r_refdll.string, sizeof( requested ));
|
Q_strncpy( requested_cvar, r_refdll.string, sizeof( requested_cvar ));
|
||||||
success = R_LoadRenderer( requested );
|
success = R_LoadRenderer( requested_cvar );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
@@ -669,7 +748,10 @@ qboolean R_Init( void )
|
|||||||
for( i = 0; i < ref.numRenderers && !success; i++ )
|
for( i = 0; i < ref.numRenderers && !success; i++ )
|
||||||
{
|
{
|
||||||
// skip renderer that was requested but failed to load
|
// skip renderer that was requested but failed to load
|
||||||
if( !Q_strcmp( requested, ref.shortNames[i] ))
|
if( !Q_strcmp( requested_cmdline, ref.shortNames[i] ))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( !Q_strcmp( requested_cvar, ref.shortNames[i] ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
success = R_LoadRenderer( ref.shortNames[i] );
|
success = R_LoadRenderer( ref.shortNames[i] );
|
||||||
@@ -678,7 +760,7 @@ qboolean R_Init( void )
|
|||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
Host_Error( "Can't initialize any renderer. Check your video drivers!\n" );
|
Sys_Error( "Can't initialize any renderer. Check your video drivers!\n" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,13 +22,12 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
struct ref_state_s
|
struct ref_state_s
|
||||||
{
|
{
|
||||||
qboolean initialized;
|
|
||||||
|
|
||||||
HINSTANCE hInstance;
|
HINSTANCE hInstance;
|
||||||
|
qboolean initialized;
|
||||||
|
int numRenderers;
|
||||||
ref_interface_t dllFuncs;
|
ref_interface_t dllFuncs;
|
||||||
|
|
||||||
// depends on build configuration
|
// depends on build configuration
|
||||||
int numRenderers;
|
|
||||||
const char **shortNames;
|
const char **shortNames;
|
||||||
const char **readableNames;
|
const char **readableNames;
|
||||||
};
|
};
|
||||||
@@ -45,6 +44,8 @@ void R_GetTextureParms( int *w, int *h, int texnum );
|
|||||||
|
|
||||||
void GL_RenderFrame( const struct ref_viewpass_s *rvp );
|
void GL_RenderFrame( const struct ref_viewpass_s *rvp );
|
||||||
|
|
||||||
|
void R_SetupSky( const char *name );
|
||||||
|
|
||||||
// common engine and renderer cvars
|
// common engine and renderer cvars
|
||||||
extern convar_t r_decals;
|
extern convar_t r_decals;
|
||||||
extern convar_t r_adjust_fov;
|
extern convar_t r_adjust_fov;
|
||||||
@@ -52,8 +53,5 @@ extern convar_t gl_clear;
|
|||||||
|
|
||||||
qboolean R_Init( void );
|
qboolean R_Init( void );
|
||||||
void R_Shutdown( void );
|
void R_Shutdown( void );
|
||||||
void R_UpdateRefState( void );
|
|
||||||
|
|
||||||
extern triangleapi_t gTriApi;
|
|
||||||
|
|
||||||
#endif // REF_COMMON_H
|
#endif // REF_COMMON_H
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
s_dsp.c - digital signal processing algorithms for audio FX
|
s_dsp.c - digital signal processing algorithms for audio FX
|
||||||
Copyright (C) 2009 Uncle Mike
|
Copyright (C) 2009 Uncle Mike
|
||||||
|
Copyright (C) 2016-2024 Alibek Omarov
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -153,7 +154,8 @@ static const sx_preset_t rgsxpre_hlalpha052[] =
|
|||||||
static const sx_preset_t *ptable = rgsxpre;
|
static const sx_preset_t *ptable = rgsxpre;
|
||||||
|
|
||||||
// cvars
|
// cvars
|
||||||
static CVAR_DEFINE_AUTO( dsp_off, "0", FCVAR_ARCHIVE, "disable DSP processing" );
|
static CVAR_DEFINE_AUTO( dsp_off, "0", FCVAR_ARCHIVE, "disable DSP processing (deprecated)" );
|
||||||
|
static CVAR_DEFINE_AUTO( room_off, "0", FCVAR_ARCHIVE, "disable DSP processing (GoldSrc compatible cvar)" );
|
||||||
static CVAR_DEFINE_AUTO( dsp_coeff_table, "0", FCVAR_ARCHIVE, "select DSP coefficient table: 0 for release or 1 for alpha 0.52" );
|
static CVAR_DEFINE_AUTO( dsp_coeff_table, "0", FCVAR_ARCHIVE, "select DSP coefficient table: 0 for release or 1 for alpha 0.52" );
|
||||||
static CVAR_DEFINE_AUTO( room_type, "0", 0, "current room type preset" );
|
static CVAR_DEFINE_AUTO( room_type, "0", 0, "current room type preset" );
|
||||||
|
|
||||||
@@ -231,6 +233,7 @@ void SX_Init( void )
|
|||||||
sxmod2cur = sxmod2 = 450 * ( idsp_dma_speed / SOUND_11k );
|
sxmod2cur = sxmod2 = 450 * ( idsp_dma_speed / SOUND_11k );
|
||||||
|
|
||||||
Cvar_RegisterVariable( &dsp_off );
|
Cvar_RegisterVariable( &dsp_off );
|
||||||
|
Cvar_RegisterVariable( &room_off );
|
||||||
Cvar_RegisterVariable( &dsp_coeff_table );
|
Cvar_RegisterVariable( &dsp_coeff_table );
|
||||||
|
|
||||||
Cvar_RegisterVariable( &roomwater_type );
|
Cvar_RegisterVariable( &roomwater_type );
|
||||||
@@ -333,7 +336,7 @@ DLY_MovePointer
|
|||||||
Checks overflow and moves pointer
|
Checks overflow and moves pointer
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
_inline void DLY_MovePointer( dly_t *dly )
|
static void DLY_MovePointer( dly_t *dly )
|
||||||
{
|
{
|
||||||
if( ++dly->idelayinput >= dly->cdelaysamplesmax )
|
if( ++dly->idelayinput >= dly->cdelaysamplesmax )
|
||||||
dly->idelayinput = 0;
|
dly->idelayinput = 0;
|
||||||
@@ -806,13 +809,9 @@ DSP_Process
|
|||||||
(xash dsp interface)
|
(xash dsp interface)
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount )
|
void DSP_Process( portable_samplepair_t *pbfront, int sampleCount )
|
||||||
{
|
{
|
||||||
if( dsp_off.value )
|
if( dsp_off.value || room_off.value || !sampleCount )
|
||||||
return;
|
|
||||||
|
|
||||||
// don't process DSP while in menu
|
|
||||||
if( cls.key_dest == key_menu || !sampleCount )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// preset is already installed by CheckNewDspPresets
|
// preset is already installed by CheckNewDspPresets
|
||||||
@@ -833,7 +832,7 @@ DSP_ClearState
|
|||||||
*/
|
*/
|
||||||
void DSP_ClearState( void )
|
void DSP_ClearState( void )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "room_type", 0.0f );
|
Cvar_DirectSet( &room_type, "0" );
|
||||||
SX_ReloadRoomFX();
|
SX_ReloadRoomFX();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,7 +845,7 @@ CheckNewDspPresets
|
|||||||
*/
|
*/
|
||||||
void CheckNewDspPresets( void )
|
void CheckNewDspPresets( void )
|
||||||
{
|
{
|
||||||
if( dsp_off.value != 0.0f )
|
if( dsp_off.value || room_off.value )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( FBitSet( dsp_coeff_table.flags, FCVAR_CHANGED ))
|
if( FBitSet( dsp_coeff_table.flags, FCVAR_CHANGED ))
|
||||||
@@ -892,15 +891,15 @@ void CheckNewDspPresets( void )
|
|||||||
|
|
||||||
cur = ptable + idsp_room;
|
cur = ptable + idsp_room;
|
||||||
|
|
||||||
Cvar_SetValue( "room_lp", cur->room_lp );
|
Cvar_DirectSetValue( &sxmod_lowpass, cur->room_lp );
|
||||||
Cvar_SetValue( "room_mod", cur->room_mod );
|
Cvar_DirectSetValue( &sxmod_mod, cur->room_mod );
|
||||||
Cvar_SetValue( "room_size", cur->room_size );
|
Cvar_DirectSetValue( &sxrvb_size, cur->room_size );
|
||||||
Cvar_SetValue( "room_refl", cur->room_refl );
|
Cvar_DirectSetValue( &sxrvb_feedback, cur->room_refl );
|
||||||
Cvar_SetValue( "room_rvblp", cur->room_rvblp );
|
Cvar_DirectSetValue( &sxrvb_lp, cur->room_rvblp );
|
||||||
Cvar_SetValue( "room_delay", cur->room_delay );
|
Cvar_DirectSetValue( &sxdly_delay, cur->room_delay );
|
||||||
Cvar_SetValue( "room_feedback", cur->room_feedback );
|
Cvar_DirectSetValue( &sxdly_feedback, cur->room_feedback );
|
||||||
Cvar_SetValue( "room_dlylp", cur->room_dlylp );
|
Cvar_DirectSetValue( &sxdly_lp, cur->room_dlylp );
|
||||||
Cvar_SetValue( "room_left", cur->room_left );
|
Cvar_DirectSetValue( &sxste_delay, cur->room_left );
|
||||||
}
|
}
|
||||||
|
|
||||||
room_typeprev = idsp_room;
|
room_typeprev = idsp_room;
|
||||||
@@ -929,7 +928,7 @@ static void SX_Profiling_f( void )
|
|||||||
|
|
||||||
if( Cmd_Argc() > 1 )
|
if( Cmd_Argc() > 1 )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "room_type", Q_atof( Cmd_Argv( 1 )));
|
Cvar_DirectSetValue( &room_type, Q_atof( Cmd_Argv( 1 )));
|
||||||
SX_ReloadRoomFX();
|
SX_ReloadRoomFX();
|
||||||
CheckNewDspPresets(); // we just need idsp_room immediately, for message below
|
CheckNewDspPresets(); // we just need idsp_room immediately, for message below
|
||||||
}
|
}
|
||||||
@@ -939,7 +938,7 @@ static void SX_Profiling_f( void )
|
|||||||
start = Sys_DoubleTime();
|
start = Sys_DoubleTime();
|
||||||
for( calls = 10000; calls; calls-- )
|
for( calls = 10000; calls; calls-- )
|
||||||
{
|
{
|
||||||
DSP_Process( idsp_room, testbuffer, 512 );
|
DSP_Process( testbuffer, 512 );
|
||||||
}
|
}
|
||||||
end = Sys_DoubleTime();
|
end = Sys_DoubleTime();
|
||||||
|
|
||||||
@@ -947,7 +946,7 @@ static void SX_Profiling_f( void )
|
|||||||
|
|
||||||
if( Cmd_Argc() > 1 )
|
if( Cmd_Argc() > 1 )
|
||||||
{
|
{
|
||||||
Cvar_SetValue( "room_type", oldroom );
|
Cvar_DirectSetValue( &room_type, oldroom );
|
||||||
SX_ReloadRoomFX();
|
SX_ReloadRoomFX();
|
||||||
CheckNewDspPresets();
|
CheckNewDspPresets();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,8 +52,11 @@ void S_SoundList_f( void )
|
|||||||
{
|
{
|
||||||
totalSize += sc->size;
|
totalSize += sc->size;
|
||||||
|
|
||||||
if( sc->loopStart >= 0 ) Con_Printf( "L" );
|
if( FBitSet( sc->flags, SOUND_LOOPED ))
|
||||||
else Con_Printf( " " );
|
Con_Printf( "L" );
|
||||||
|
else
|
||||||
|
Con_Printf( " " );
|
||||||
|
|
||||||
if( sfx->name[0] == '*' || !Q_strncmp( sfx->name, DEFAULT_SOUNDPATH, sizeof( DEFAULT_SOUNDPATH ) - 1 ))
|
if( sfx->name[0] == '*' || !Q_strncmp( sfx->name, DEFAULT_SOUNDPATH, sizeof( DEFAULT_SOUNDPATH ) - 1 ))
|
||||||
Con_Printf( " (%2db) %s : %s\n", sc->width * 8, Q_memprint( sc->size ), sfx->name );
|
Con_Printf( " (%2db) %s : %s\n", sc->width * 8, Q_memprint( sc->size ), sfx->name );
|
||||||
else Con_Printf( " (%2db) %s : " DEFAULT_SOUNDPATH "%s\n", sc->width * 8, Q_memprint( sc->size ), sfx->name );
|
else Con_Printf( " (%2db) %s : " DEFAULT_SOUNDPATH "%s\n", sc->width * 8, Q_memprint( sc->size ), sfx->name );
|
||||||
@@ -110,7 +113,7 @@ static wavdata_t *S_CreateDefaultSound( void )
|
|||||||
|
|
||||||
sc->width = 2;
|
sc->width = 2;
|
||||||
sc->channels = 1;
|
sc->channels = 1;
|
||||||
sc->loopStart = -1;
|
sc->loopStart = 0;
|
||||||
sc->rate = SOUND_DMA_SPEED;
|
sc->rate = SOUND_DMA_SPEED;
|
||||||
sc->samples = SOUND_DMA_SPEED;
|
sc->samples = SOUND_DMA_SPEED;
|
||||||
sc->size = sc->samples * sc->width * sc->channels;
|
sc->size = sc->samples * sc->width * sc->channels;
|
||||||
@@ -141,8 +144,8 @@ wavdata_t *S_LoadSound( sfx_t *sfx )
|
|||||||
if( Q_stricmp( sfx->name, "*default" ))
|
if( Q_stricmp( sfx->name, "*default" ))
|
||||||
{
|
{
|
||||||
// load it from disk
|
// load it from disk
|
||||||
if( s_warn_late_precache.value > 0 && CL_Active() )
|
if( s_warn_late_precache.value > 0 && cls.state == ca_active )
|
||||||
Con_Printf( S_WARN "S_LoadSound: late precache of %s\n", sfx->name );
|
Con_Printf( S_WARN "%s: late precache of %s\n", __func__, sfx->name );
|
||||||
|
|
||||||
if( sfx->name[0] == '*' )
|
if( sfx->name[0] == '*' )
|
||||||
sc = FS_LoadSound( sfx->name + 1, NULL, 0 );
|
sc = FS_LoadSound( sfx->name + 1, NULL, 0 );
|
||||||
@@ -152,11 +155,11 @@ wavdata_t *S_LoadSound( sfx_t *sfx )
|
|||||||
if( !sc ) sc = S_CreateDefaultSound();
|
if( !sc ) sc = S_CreateDefaultSound();
|
||||||
|
|
||||||
if( sc->rate < SOUND_11k ) // some bad sounds
|
if( sc->rate < SOUND_11k ) // some bad sounds
|
||||||
Sound_Process( &sc, SOUND_11k, sc->width, SOUND_RESAMPLE );
|
Sound_Process( &sc, SOUND_11k, sc->width, sc->channels, SOUND_RESAMPLE );
|
||||||
else if( sc->rate > SOUND_11k && sc->rate < SOUND_22k ) // some bad sounds
|
else if( sc->rate > SOUND_11k && sc->rate < SOUND_22k ) // some bad sounds
|
||||||
Sound_Process( &sc, SOUND_22k, sc->width, SOUND_RESAMPLE );
|
Sound_Process( &sc, SOUND_22k, sc->width, sc->channels, SOUND_RESAMPLE );
|
||||||
else if( sc->rate > SOUND_22k && sc->rate <= SOUND_32k ) // some bad sounds
|
else if( sc->rate > SOUND_22k && sc->rate < SOUND_44k ) // some bad sounds
|
||||||
Sound_Process( &sc, SOUND_44k, sc->width, SOUND_RESAMPLE );
|
Sound_Process( &sc, SOUND_44k, sc->width, sc->channels, SOUND_RESAMPLE );
|
||||||
|
|
||||||
sfx->cache = sc;
|
sfx->cache = sc;
|
||||||
|
|
||||||
@@ -218,7 +221,7 @@ sfx_t *S_FindName( const char *pname, int *pfInCache )
|
|||||||
sfx = &s_knownSfx[i];
|
sfx = &s_knownSfx[i];
|
||||||
memset( sfx, 0, sizeof( *sfx ));
|
memset( sfx, 0, sizeof( *sfx ));
|
||||||
if( pfInCache ) *pfInCache = false;
|
if( pfInCache ) *pfInCache = false;
|
||||||
Q_strncpy( sfx->name, name, MAX_STRING );
|
Q_strncpy( sfx->name, name, sizeof( sfx->name ));
|
||||||
sfx->servercount = cl.servercount;
|
sfx->servercount = cl.servercount;
|
||||||
sfx->hashValue = COM_HashKey( sfx->name, MAX_SFX_HASH );
|
sfx->hashValue = COM_HashKey( sfx->name, MAX_SFX_HASH );
|
||||||
|
|
||||||
@@ -377,7 +380,7 @@ S_InitSounds
|
|||||||
void S_InitSounds( void )
|
void S_InitSounds( void )
|
||||||
{
|
{
|
||||||
// create unused 0-entry
|
// create unused 0-entry
|
||||||
Q_strncpy( s_knownSfx->name, "*default", MAX_QPATH );
|
Q_strncpy( s_knownSfx->name, "*default", sizeof( s_knownSfx->name ));
|
||||||
s_knownSfx->hashValue = COM_HashKey( s_knownSfx->name, MAX_SFX_HASH );
|
s_knownSfx->hashValue = COM_HashKey( s_knownSfx->name, MAX_SFX_HASH );
|
||||||
s_knownSfx->hashNext = s_sfxHashList[s_knownSfx->hashValue];
|
s_knownSfx->hashNext = s_sfxHashList[s_knownSfx->hashValue];
|
||||||
s_sfxHashList[s_knownSfx->hashValue] = s_knownSfx;
|
s_sfxHashList[s_knownSfx->hashValue] = s_knownSfx;
|
||||||
|
|||||||
@@ -64,6 +64,12 @@ float S_GetMasterVolume( void )
|
|||||||
{
|
{
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
|
||||||
|
if( host.status == HOST_NOFOCUS && snd_mute_losefocus.value != 0.0f )
|
||||||
|
{
|
||||||
|
// we return zero volume to keep sounds running
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if( !s_listener.inmenu && soundfade.percent != 0 )
|
if( !s_listener.inmenu && soundfade.percent != 0 )
|
||||||
{
|
{
|
||||||
scale = bound( 0.0f, soundfade.percent / 100.0f, 1.0f );
|
scale = bound( 0.0f, soundfade.percent / 100.0f, 1.0f );
|
||||||
@@ -91,7 +97,7 @@ void S_FadeClientVolume( float fadePercent, float fadeOutSeconds, float holdTime
|
|||||||
S_IsClient
|
S_IsClient
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean S_IsClient( int entnum )
|
static qboolean S_IsClient( int entnum )
|
||||||
{
|
{
|
||||||
return ( entnum == s_listener.entnum );
|
return ( entnum == s_listener.entnum );
|
||||||
}
|
}
|
||||||
@@ -124,7 +130,7 @@ void S_FreeChannel( channel_t *ch )
|
|||||||
S_UpdateSoundFade
|
S_UpdateSoundFade
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_UpdateSoundFade( void )
|
static void S_UpdateSoundFade( void )
|
||||||
{
|
{
|
||||||
float f, totaltime, elapsed;
|
float f, totaltime, elapsed;
|
||||||
|
|
||||||
@@ -184,7 +190,7 @@ override any other sound playing on the same channel (see code comments below fo
|
|||||||
exceptions).
|
exceptions).
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean SND_FStreamIsPlaying( sfx_t *sfx )
|
static qboolean SND_FStreamIsPlaying( sfx_t *sfx )
|
||||||
{
|
{
|
||||||
int ch_idx;
|
int ch_idx;
|
||||||
|
|
||||||
@@ -322,7 +328,7 @@ channel_t *SND_PickDynamicChannel( int entnum, int channel, sfx_t *sfx, qboolean
|
|||||||
// don't restart looping sounds for the same entity
|
// don't restart looping sounds for the same entity
|
||||||
wavdata_t *sc = channels[first_to_die].sfx->cache;
|
wavdata_t *sc = channels[first_to_die].sfx->cache;
|
||||||
|
|
||||||
if( sc && sc->loopStart != -1 )
|
if( sc && FBitSet( sc->flags, SOUND_LOOPED ))
|
||||||
{
|
{
|
||||||
channel_t *ch = &channels[first_to_die];
|
channel_t *ch = &channels[first_to_die];
|
||||||
|
|
||||||
@@ -376,7 +382,7 @@ channel_t *SND_PickStaticChannel( const vec3_t pos, sfx_t *sfx )
|
|||||||
// no empty slots, alloc a new static sound channel
|
// no empty slots, alloc a new static sound channel
|
||||||
if( total_channels == MAX_CHANNELS )
|
if( total_channels == MAX_CHANNELS )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "S_PickStaticChannel: no free channels\n" );
|
Con_DPrintf( S_ERROR "%s: no free channels\n", __func__ );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +405,7 @@ returns TRUE if sound was altered,
|
|||||||
returns FALSE if sound was not found (sound is not playing)
|
returns FALSE if sound was not found (sound is not playing)
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int flags )
|
static int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int flags )
|
||||||
{
|
{
|
||||||
channel_t *ch;
|
channel_t *ch;
|
||||||
int i;
|
int i;
|
||||||
@@ -457,7 +463,7 @@ int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int
|
|||||||
S_SpatializeChannel
|
S_SpatializeChannel
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol, float gain, float dot, float dist )
|
static void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol, float gain, float dot, float dist )
|
||||||
{
|
{
|
||||||
float lscale, rscale, scale;
|
float lscale, rscale, scale;
|
||||||
|
|
||||||
@@ -480,7 +486,7 @@ void S_SpatializeChannel( int *left_vol, int *right_vol, int master_vol, float g
|
|||||||
SND_Spatialize
|
SND_Spatialize
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void SND_Spatialize( channel_t *ch )
|
static void SND_Spatialize( channel_t *ch )
|
||||||
{
|
{
|
||||||
vec3_t source_vec;
|
vec3_t source_vec;
|
||||||
float dist, dot, gain = 1.0f;
|
float dist, dot, gain = 1.0f;
|
||||||
@@ -497,7 +503,7 @@ void SND_Spatialize( channel_t *ch )
|
|||||||
|
|
||||||
pSource = ch->sfx->cache;
|
pSource = ch->sfx->cache;
|
||||||
|
|
||||||
if( ch->use_loop && pSource && pSource->loopStart != -1 )
|
if( ch->use_loop && pSource && FBitSet( pSource->flags, SOUND_LOOPED ))
|
||||||
looping = true;
|
looping = true;
|
||||||
|
|
||||||
if( !ch->staticsound )
|
if( !ch->staticsound )
|
||||||
@@ -518,8 +524,11 @@ void SND_Spatialize( channel_t *ch )
|
|||||||
dist = VectorNormalizeLength( source_vec );
|
dist = VectorNormalizeLength( source_vec );
|
||||||
dot = DotProduct( s_listener.right, source_vec );
|
dot = DotProduct( s_listener.right, source_vec );
|
||||||
|
|
||||||
|
if( !FBitSet( host.bugcomp, BUGCOMP_SPATIALIZE_SOUND_WITH_ATTN_NONE ))
|
||||||
|
{
|
||||||
// don't pan sounds with no attenuation
|
// don't pan sounds with no attenuation
|
||||||
if( ch->dist_mult <= 0.0f ) dot = 0.0f;
|
if( ch->dist_mult <= 0.0f ) dot = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// fill out channel volumes for single location
|
// fill out channel volumes for single location
|
||||||
S_SpatializeChannel( &ch->leftvol, &ch->rightvol, ch->master_vol, gain, dot, dist * ch->dist_mult );
|
S_SpatializeChannel( &ch->leftvol, &ch->rightvol, ch->master_vol, gain, dot, dist * ch->dist_mult );
|
||||||
@@ -635,7 +644,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
|
|||||||
if( !target_chan->leftvol && !target_chan->rightvol )
|
if( !target_chan->leftvol && !target_chan->rightvol )
|
||||||
{
|
{
|
||||||
// looping sounds don't use this optimization because they should stick around until they're killed.
|
// looping sounds don't use this optimization because they should stick around until they're killed.
|
||||||
if( !sfx->cache || sfx->cache->loopStart == -1 )
|
if( !sfx->cache || !FBitSet( sfx->cache->flags, SOUND_LOOPED ))
|
||||||
{
|
{
|
||||||
// if this is a streaming sound, play the whole thing.
|
// if this is a streaming sound, play the whole thing.
|
||||||
if( chan != CHAN_STREAM )
|
if( chan != CHAN_STREAM )
|
||||||
@@ -648,20 +657,6 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
|
|||||||
|
|
||||||
// Init client entity mouth movement vars
|
// Init client entity mouth movement vars
|
||||||
SND_InitMouth( ent, chan );
|
SND_InitMouth( ent, chan );
|
||||||
|
|
||||||
for( ch_idx = NUM_AMBIENTS, check = channels + NUM_AMBIENTS; ch_idx < MAX_DYNAMIC_CHANNELS; ch_idx++, check++)
|
|
||||||
{
|
|
||||||
if( check == target_chan ) continue;
|
|
||||||
|
|
||||||
if( check->sfx == sfx && !check->pMixer.sample )
|
|
||||||
{
|
|
||||||
// skip up to 0.1 seconds of audio
|
|
||||||
int skip = COM_RandomLong( 0, (long)( 0.1f * check->sfx->cache->rate ));
|
|
||||||
|
|
||||||
S_SetSampleStart( check, sfx->cache, skip );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -901,7 +896,7 @@ int S_GetCurrentStaticSounds( soundlist_t *pout, int size )
|
|||||||
VectorCopy( channels[i].origin, pout->origin );
|
VectorCopy( channels[i].origin, pout->origin );
|
||||||
pout->volume = (float)channels[i].master_vol / 255.0f;
|
pout->volume = (float)channels[i].master_vol / 255.0f;
|
||||||
pout->attenuation = channels[i].dist_mult * SND_CLIP_DISTANCE;
|
pout->attenuation = channels[i].dist_mult * SND_CLIP_DISTANCE;
|
||||||
pout->looping = ( channels[i].use_loop && channels[i].sfx->cache->loopStart != -1 );
|
pout->looping = ( channels[i].use_loop && FBitSet( channels[i].sfx->cache->flags, SOUND_LOOPED ));
|
||||||
pout->pitch = channels[i].basePitch;
|
pout->pitch = channels[i].basePitch;
|
||||||
pout->channel = channels[i].entchannel;
|
pout->channel = channels[i].entchannel;
|
||||||
pout->wordIndex = channels[i].wordIndex;
|
pout->wordIndex = channels[i].wordIndex;
|
||||||
@@ -936,7 +931,7 @@ int S_GetCurrentDynamicSounds( soundlist_t *pout, int size )
|
|||||||
if( !channels[i].sfx || !channels[i].sfx->name[0] || !Q_stricmp( channels[i].sfx->name, "*default" ))
|
if( !channels[i].sfx || !channels[i].sfx->name[0] || !Q_stricmp( channels[i].sfx->name, "*default" ))
|
||||||
continue; // don't serialize default sounds
|
continue; // don't serialize default sounds
|
||||||
|
|
||||||
looped = ( channels[i].use_loop && channels[i].sfx->cache->loopStart != -1 );
|
looped = ( channels[i].use_loop && FBitSet( channels[i].sfx->cache->flags, SOUND_LOOPED ));
|
||||||
|
|
||||||
if( channels[i].entchannel == CHAN_STATIC && looped && !Host_IsQuakeCompatible())
|
if( channels[i].entchannel == CHAN_STATIC && looped && !Host_IsQuakeCompatible())
|
||||||
continue; // never serialize static looped sounds. It will be restoring in game code
|
continue; // never serialize static looped sounds. It will be restoring in game code
|
||||||
@@ -967,7 +962,7 @@ int S_GetCurrentDynamicSounds( soundlist_t *pout, int size )
|
|||||||
S_InitAmbientChannels
|
S_InitAmbientChannels
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void S_InitAmbientChannels( void )
|
static void S_InitAmbientChannels( void )
|
||||||
{
|
{
|
||||||
int ambient_channel;
|
int ambient_channel;
|
||||||
channel_t *chan;
|
channel_t *chan;
|
||||||
@@ -989,7 +984,7 @@ void S_InitAmbientChannels( void )
|
|||||||
S_UpdateAmbientSounds
|
S_UpdateAmbientSounds
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void S_UpdateAmbientSounds( void )
|
static void S_UpdateAmbientSounds( void )
|
||||||
{
|
{
|
||||||
mleaf_t *leaf;
|
mleaf_t *leaf;
|
||||||
float vol;
|
float vol;
|
||||||
@@ -1100,7 +1095,7 @@ rawchan_t *S_FindRawChannel( int entnum, qboolean create )
|
|||||||
if( !raw_channels[best] )
|
if( !raw_channels[best] )
|
||||||
{
|
{
|
||||||
raw_samples = MAX_RAW_SAMPLES;
|
raw_samples = MAX_RAW_SAMPLES;
|
||||||
raw_channels[best] = Mem_Calloc( sndpool, sizeof( *ch ) + sizeof( portable_samplepair_t ) * ( raw_samples - 1 ));
|
raw_channels[best] = Mem_Calloc( sndpool, sizeof( *ch ) + sizeof( portable_samplepair_t ) * raw_samples );
|
||||||
}
|
}
|
||||||
|
|
||||||
ch = raw_channels[best];
|
ch = raw_channels[best];
|
||||||
@@ -1421,7 +1416,7 @@ static void S_FreeRawChannels( void )
|
|||||||
S_ClearBuffer
|
S_ClearBuffer
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void S_ClearBuffer( void )
|
static void S_ClearBuffer( void )
|
||||||
{
|
{
|
||||||
S_ClearRawChannels();
|
S_ClearRawChannels();
|
||||||
|
|
||||||
@@ -1520,7 +1515,7 @@ static int S_GetSoundtime( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void S_UpdateChannels( void )
|
static void S_UpdateChannels( void )
|
||||||
{
|
{
|
||||||
uint endtime;
|
uint endtime;
|
||||||
int samps;
|
int samps;
|
||||||
@@ -1607,11 +1602,10 @@ void SND_UpdateSound( void )
|
|||||||
// release raw-channels that no longer used more than 10 secs
|
// release raw-channels that no longer used more than 10 secs
|
||||||
S_FreeIdleRawChannels();
|
S_FreeIdleRawChannels();
|
||||||
|
|
||||||
VectorCopy( cl.simvel, s_listener.velocity );
|
|
||||||
s_listener.frametime = (cl.time - cl.oldtime);
|
s_listener.frametime = (cl.time - cl.oldtime);
|
||||||
s_listener.waterlevel = cl.local.waterlevel;
|
s_listener.waterlevel = cl.local.waterlevel;
|
||||||
s_listener.active = CL_IsInGame();
|
s_listener.active = CL_IsInGame();
|
||||||
s_listener.inmenu = CL_IsInMenu();
|
s_listener.inmenu = cls.key_dest == key_menu;
|
||||||
s_listener.paused = cl.paused;
|
s_listener.paused = cl.paused;
|
||||||
|
|
||||||
// update general area ambient sound sources
|
// update general area ambient sound sources
|
||||||
@@ -1709,7 +1703,7 @@ console functions
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
*/
|
*/
|
||||||
void S_Play_f( void )
|
static void S_Play_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1720,7 +1714,7 @@ void S_Play_f( void )
|
|||||||
S_StartLocalSound( Cmd_Argv( 1 ), VOL_NORM, false );
|
S_StartLocalSound( Cmd_Argv( 1 ), VOL_NORM, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_Play2_f( void )
|
static void S_Play2_f( void )
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
@@ -1737,7 +1731,7 @@ void S_Play2_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_PlayVol_f( void )
|
static void S_PlayVol_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1763,7 +1757,7 @@ static void S_Say( const char *name, qboolean reliable )
|
|||||||
S_StartLocalSound( sentence, 1.0f, reliable );
|
S_StartLocalSound( sentence, 1.0f, reliable );
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_Say_f( void )
|
static void S_Say_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1774,7 +1768,7 @@ void S_Say_f( void )
|
|||||||
S_Say( Cmd_Argv( 1 ), false );
|
S_Say( Cmd_Argv( 1 ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_SayReliable_f( void )
|
static void S_SayReliable_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
@@ -1790,7 +1784,7 @@ void S_SayReliable_f( void )
|
|||||||
S_Music_f
|
S_Music_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_Music_f( void )
|
static void S_Music_f( void )
|
||||||
{
|
{
|
||||||
int c = Cmd_Argc();
|
int c = Cmd_Argc();
|
||||||
|
|
||||||
@@ -1854,7 +1848,7 @@ void S_Music_f( void )
|
|||||||
S_StopSound_f
|
S_StopSound_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_StopSound_f( void )
|
static void S_StopSound_f( void )
|
||||||
{
|
{
|
||||||
S_StopAllSounds( true );
|
S_StopAllSounds( true );
|
||||||
}
|
}
|
||||||
@@ -1864,7 +1858,7 @@ void S_StopSound_f( void )
|
|||||||
S_SoundFade_f
|
S_SoundFade_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_SoundFade_f( void )
|
static void S_SoundFade_f( void )
|
||||||
{
|
{
|
||||||
int c = Cmd_Argc();
|
int c = Cmd_Argc();
|
||||||
float fadeTime = 5.0f;
|
float fadeTime = 5.0f;
|
||||||
@@ -1898,9 +1892,9 @@ void S_SoundInfo_f( void )
|
|||||||
S_VoiceRecordStart_f
|
S_VoiceRecordStart_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_VoiceRecordStart_f( void )
|
static void S_VoiceRecordStart_f( void )
|
||||||
{
|
{
|
||||||
if( cls.state != ca_active || cls.legacymode )
|
if( cls.state != ca_active )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Voice_RecordStart();
|
Voice_RecordStart();
|
||||||
@@ -1911,7 +1905,7 @@ void S_VoiceRecordStart_f( void )
|
|||||||
S_VoiceRecordStop_f
|
S_VoiceRecordStop_f
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void S_VoiceRecordStop_f( void )
|
static void S_VoiceRecordStop_f( void )
|
||||||
{
|
{
|
||||||
if( cls.state != ca_active || !Voice_IsRecording() )
|
if( cls.state != ca_active || !Voice_IsRecording() )
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,13 +17,20 @@ GNU General Public License for more details.
|
|||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
#define IPAINTBUFFER 0
|
enum
|
||||||
#define IROOMBUFFER 1
|
{
|
||||||
#define ISTREAMBUFFER 2
|
IPAINTBUFFER = 0,
|
||||||
|
IROOMBUFFER,
|
||||||
|
ISTREAMBUFFER,
|
||||||
|
CPAINTBUFFERS,
|
||||||
|
};
|
||||||
|
|
||||||
#define FILTERTYPE_NONE 0
|
enum
|
||||||
#define FILTERTYPE_LINEAR 1
|
{
|
||||||
#define FILTERTYPE_CUBIC 2
|
FILTERTYPE_NONE = 0,
|
||||||
|
FILTERTYPE_LINEAR,
|
||||||
|
FILTERTYPE_CUBIC,
|
||||||
|
};
|
||||||
|
|
||||||
#define CCHANVOLUMES 2
|
#define CCHANVOLUMES 2
|
||||||
|
|
||||||
@@ -31,16 +38,35 @@ GNU General Public License for more details.
|
|||||||
#define SND_SCALE_SHIFT ( 8 - SND_SCALE_BITS )
|
#define SND_SCALE_SHIFT ( 8 - SND_SCALE_BITS )
|
||||||
#define SND_SCALE_LEVELS ( 1 << SND_SCALE_BITS )
|
#define SND_SCALE_LEVELS ( 1 << SND_SCALE_BITS )
|
||||||
|
|
||||||
portable_samplepair_t *g_curpaintbuffer;
|
// sound mixing buffer
|
||||||
portable_samplepair_t streambuffer[(PAINTBUFFER_SIZE+1)];
|
#define CPAINTFILTERMEM 3
|
||||||
portable_samplepair_t paintbuffer[(PAINTBUFFER_SIZE+1)];
|
#define CPAINTFILTERS 4 // maximum number of consecutive upsample passes per paintbuffer
|
||||||
portable_samplepair_t roombuffer[(PAINTBUFFER_SIZE+1)];
|
|
||||||
portable_samplepair_t facingbuffer[(PAINTBUFFER_SIZE+1)];
|
|
||||||
portable_samplepair_t temppaintbuffer[(PAINTBUFFER_SIZE+1)];
|
|
||||||
paintbuffer_t paintbuffers[CPAINTBUFFERS];
|
|
||||||
|
|
||||||
int snd_scaletable[SND_SCALE_LEVELS][256];
|
// fixed point stuff for real-time resampling
|
||||||
|
#define FIX_BITS 28
|
||||||
|
#define FIX_SCALE ( 1 << FIX_BITS )
|
||||||
|
#define FIX_MASK (( 1 << FIX_BITS ) - 1 )
|
||||||
|
#define FIX_FLOAT( a ) ((int)(( a ) * FIX_SCALE ))
|
||||||
|
#define FIX( a ) (((int)( a )) << FIX_BITS )
|
||||||
|
#define FIX_INTPART( a ) (((int)( a )) >> FIX_BITS )
|
||||||
|
#define FIX_FRACPART( a ) (( a ) & FIX_MASK )
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
qboolean factive; // if true, mix to this paintbuffer using flags
|
||||||
|
portable_samplepair_t *pbuf; // front stereo mix buffer, for 2 or 4 channel mixing
|
||||||
|
int ifilter; // current filter memory buffer to use for upsampling pass
|
||||||
|
portable_samplepair_t fltmem[CPAINTFILTERS][CPAINTFILTERMEM];
|
||||||
|
} paintbuffer_t;
|
||||||
|
|
||||||
|
static portable_samplepair_t *g_curpaintbuffer;
|
||||||
|
static portable_samplepair_t streambuffer[(PAINTBUFFER_SIZE+1)];
|
||||||
|
static portable_samplepair_t paintbuffer[(PAINTBUFFER_SIZE+1)];
|
||||||
|
static portable_samplepair_t roombuffer[(PAINTBUFFER_SIZE+1)];
|
||||||
|
static portable_samplepair_t temppaintbuffer[(PAINTBUFFER_SIZE+1)];
|
||||||
|
static paintbuffer_t paintbuffers[CPAINTBUFFERS];
|
||||||
|
|
||||||
|
static int snd_scaletable[SND_SCALE_LEVELS][256];
|
||||||
void S_InitScaletable( void )
|
void S_InitScaletable( void )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -58,7 +84,7 @@ S_TransferPaintBuffer
|
|||||||
|
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void S_TransferPaintBuffer( int endtime )
|
static void S_TransferPaintBuffer( int endtime )
|
||||||
{
|
{
|
||||||
int *snd_p, snd_linear_count;
|
int *snd_p, snd_linear_count;
|
||||||
int lpos, lpaintedtime;
|
int lpos, lpaintedtime;
|
||||||
@@ -67,7 +93,7 @@ void S_TransferPaintBuffer( int endtime )
|
|||||||
dword *pbuf;
|
dword *pbuf;
|
||||||
|
|
||||||
pbuf = (dword *)dma.buffer;
|
pbuf = (dword *)dma.buffer;
|
||||||
snd_p = (int *)PAINTBUFFER;
|
snd_p = (int *)g_curpaintbuffer;
|
||||||
lpaintedtime = paintedtime;
|
lpaintedtime = paintedtime;
|
||||||
sampleMask = ((dma.samples >> 1) - 1);
|
sampleMask = ((dma.samples >> 1) - 1);
|
||||||
|
|
||||||
@@ -111,20 +137,20 @@ void S_TransferPaintBuffer( int endtime )
|
|||||||
//===============================================================================
|
//===============================================================================
|
||||||
// Activate a paintbuffer. All active paintbuffers are mixed in parallel within
|
// Activate a paintbuffer. All active paintbuffers are mixed in parallel within
|
||||||
// MIX_MixChannelsToPaintbuffer, according to flags
|
// MIX_MixChannelsToPaintbuffer, according to flags
|
||||||
_inline void MIX_ActivatePaintbuffer( int ipaintbuffer )
|
static void MIX_ActivatePaintbuffer( int ipaintbuffer )
|
||||||
{
|
{
|
||||||
Assert( ipaintbuffer < CPAINTBUFFERS );
|
Assert( ipaintbuffer < CPAINTBUFFERS );
|
||||||
paintbuffers[ipaintbuffer].factive = true;
|
paintbuffers[ipaintbuffer].factive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline void MIX_SetCurrentPaintbuffer( int ipaintbuffer )
|
static void MIX_SetCurrentPaintbuffer( int ipaintbuffer )
|
||||||
{
|
{
|
||||||
Assert( ipaintbuffer < CPAINTBUFFERS );
|
Assert( ipaintbuffer < CPAINTBUFFERS );
|
||||||
g_curpaintbuffer = paintbuffers[ipaintbuffer].pbuf;
|
g_curpaintbuffer = paintbuffers[ipaintbuffer].pbuf;
|
||||||
Assert( g_curpaintbuffer != NULL );
|
Assert( g_curpaintbuffer != NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline int MIX_GetCurrentPaintbufferIndex( void )
|
static int MIX_GetCurrentPaintbufferIndex( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -136,7 +162,7 @@ _inline int MIX_GetCurrentPaintbufferIndex( void )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline paintbuffer_t *MIX_GetCurrentPaintbufferPtr( void )
|
static paintbuffer_t *MIX_GetCurrentPaintbufferPtr( void )
|
||||||
{
|
{
|
||||||
int ipaint = MIX_GetCurrentPaintbufferIndex();
|
int ipaint = MIX_GetCurrentPaintbufferIndex();
|
||||||
|
|
||||||
@@ -145,7 +171,7 @@ _inline paintbuffer_t *MIX_GetCurrentPaintbufferPtr( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't mix into any paintbuffers
|
// Don't mix into any paintbuffers
|
||||||
_inline void MIX_DeactivateAllPaintbuffers( void )
|
static void MIX_DeactivateAllPaintbuffers( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -154,7 +180,7 @@ _inline void MIX_DeactivateAllPaintbuffers( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set upsampling filter indexes back to 0
|
// set upsampling filter indexes back to 0
|
||||||
_inline void MIX_ResetPaintbufferFilterCounters( void )
|
static void MIX_ResetPaintbufferFilterCounters( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -163,13 +189,13 @@ _inline void MIX_ResetPaintbufferFilterCounters( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return pointer to front paintbuffer pbuf, given index
|
// return pointer to front paintbuffer pbuf, given index
|
||||||
_inline portable_samplepair_t *MIX_GetPFrontFromIPaint( int ipaintbuffer )
|
static portable_samplepair_t *MIX_GetPFrontFromIPaint( int ipaintbuffer )
|
||||||
{
|
{
|
||||||
Assert( ipaintbuffer < CPAINTBUFFERS );
|
Assert( ipaintbuffer < CPAINTBUFFERS );
|
||||||
return paintbuffers[ipaintbuffer].pbuf;
|
return paintbuffers[ipaintbuffer].pbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
_inline paintbuffer_t *MIX_GetPPaintFromIPaint( int ipaint )
|
static paintbuffer_t *MIX_GetPPaintFromIPaint( int ipaint )
|
||||||
{
|
{
|
||||||
Assert( ipaint < CPAINTBUFFERS );
|
Assert( ipaint < CPAINTBUFFERS );
|
||||||
return &paintbuffers[ipaint];
|
return &paintbuffers[ipaint];
|
||||||
@@ -201,7 +227,7 @@ CHANNEL MIXING
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
*/
|
*/
|
||||||
void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
static void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
||||||
{
|
{
|
||||||
int *lscale, *rscale;
|
int *lscale, *rscale;
|
||||||
int i, data;
|
int i, data;
|
||||||
@@ -217,7 +243,7 @@ void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_PaintStereoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
static void S_PaintStereoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, int outCount )
|
||||||
{
|
{
|
||||||
int *lscale, *rscale;
|
int *lscale, *rscale;
|
||||||
uint left, right;
|
uint left, right;
|
||||||
@@ -237,7 +263,7 @@ void S_PaintStereoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_PaintMonoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
static void S_PaintMonoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
||||||
{
|
{
|
||||||
int left, right;
|
int left, right;
|
||||||
int i, data;
|
int i, data;
|
||||||
@@ -252,7 +278,7 @@ void S_PaintMonoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
static void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData, int outCount )
|
||||||
{
|
{
|
||||||
uint *data;
|
uint *data;
|
||||||
int left, right;
|
int left, right;
|
||||||
@@ -273,11 +299,11 @@ void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_Mix8MonoTimeCompress( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
static void S_Mix8MonoTimeCompress( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_Mix8Mono( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
static void S_Mix8Mono( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount, int timecompress )
|
||||||
{
|
{
|
||||||
int i, sampleIndex = 0;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
uint sampleFrac = inputOffset;
|
||||||
@@ -309,7 +335,7 @@ void S_Mix8Mono( portable_samplepair_t *pbuf, int *volume, byte *pData, int inpu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_Mix8Stereo( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount )
|
static void S_Mix8Stereo( portable_samplepair_t *pbuf, int *volume, byte *pData, int inputOffset, uint rateScale, int outCount )
|
||||||
{
|
{
|
||||||
int i, sampleIndex = 0;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
uint sampleFrac = inputOffset;
|
||||||
@@ -335,7 +361,7 @@ void S_Mix8Stereo( portable_samplepair_t *pbuf, int *volume, byte *pData, int in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_Mix16Mono( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
static void S_Mix16Mono( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
||||||
{
|
{
|
||||||
int i, sampleIndex = 0;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
uint sampleFrac = inputOffset;
|
||||||
@@ -357,7 +383,7 @@ void S_Mix16Mono( portable_samplepair_t *pbuf, int *volume, short *pData, int in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_Mix16Stereo( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
static void S_Mix16Stereo( portable_samplepair_t *pbuf, int *volume, short *pData, int inputOffset, uint rateScale, int outCount )
|
||||||
{
|
{
|
||||||
int i, sampleIndex = 0;
|
int i, sampleIndex = 0;
|
||||||
uint sampleFrac = inputOffset;
|
uint sampleFrac = inputOffset;
|
||||||
@@ -379,7 +405,7 @@ void S_Mix16Stereo( portable_samplepair_t *pbuf, int *volume, short *pData, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_MixChannel( channel_t *pChannel, void *pData, int outputOffset, int inputOffset, uint fracRate, int outCount, int timecompress )
|
static void S_MixChannel( channel_t *pChannel, void *pData, int outputOffset, int inputOffset, uint fracRate, int outCount, int timecompress )
|
||||||
{
|
{
|
||||||
int pvol[CCHANVOLUMES];
|
int pvol[CCHANVOLUMES];
|
||||||
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
||||||
@@ -496,7 +522,7 @@ int S_MixDataToDevice( channel_t *pChannel, int sampleCount, int outRate, int ou
|
|||||||
return outOffset - startingOffset;
|
return outOffset - startingOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean S_ShouldContinueMixing( channel_t *ch )
|
static qboolean S_ShouldContinueMixing( channel_t *ch )
|
||||||
{
|
{
|
||||||
if( ch->isSentence )
|
if( ch->isSentence )
|
||||||
{
|
{
|
||||||
@@ -517,12 +543,13 @@ qboolean S_ShouldContinueMixing( channel_t *ch )
|
|||||||
// this routine will fill the paintbuffer to endtime. Otherwise, fewer samples are mixed.
|
// this routine will fill the paintbuffer to endtime. Otherwise, fewer samples are mixed.
|
||||||
// if( endtime - paintedtime ) is not aligned on boundaries of 4,
|
// if( endtime - paintedtime ) is not aligned on boundaries of 4,
|
||||||
// we'll miss data if outputRate < SOUND_DMA_SPEED!
|
// we'll miss data if outputRate < SOUND_DMA_SPEED!
|
||||||
void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
static void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
||||||
{
|
{
|
||||||
channel_t *ch;
|
channel_t *ch;
|
||||||
wavdata_t *pSource;
|
wavdata_t *pSource;
|
||||||
int i, sampleCount;
|
int i, sampleCount;
|
||||||
qboolean bZeroVolume;
|
qboolean bZeroVolume;
|
||||||
|
qboolean local = Host_IsLocalGame();
|
||||||
|
|
||||||
// mix each channel into paintbuffer
|
// mix each channel into paintbuffer
|
||||||
ch = channels;
|
ch = channels;
|
||||||
@@ -549,7 +576,7 @@ void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
|||||||
{
|
{
|
||||||
// play, playvol
|
// play, playvol
|
||||||
}
|
}
|
||||||
else if(( s_listener.inmenu || s_listener.paused ) && !ch->localsound )
|
else if(( s_listener.inmenu || s_listener.paused ) && !ch->localsound && local )
|
||||||
{
|
{
|
||||||
// play only local sounds, keep pause for other
|
// play only local sounds, keep pause for other
|
||||||
continue;
|
continue;
|
||||||
@@ -567,6 +594,7 @@ void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
|||||||
|
|
||||||
// Don't mix sound data for sounds with zero volume. If it's a non-looping sound,
|
// Don't mix sound data for sounds with zero volume. If it's a non-looping sound,
|
||||||
// just remove the sound when its volume goes to zero.
|
// just remove the sound when its volume goes to zero.
|
||||||
|
|
||||||
bZeroVolume = !ch->leftvol && !ch->rightvol;
|
bZeroVolume = !ch->leftvol && !ch->rightvol;
|
||||||
|
|
||||||
if( !bZeroVolume )
|
if( !bZeroVolume )
|
||||||
@@ -576,7 +604,7 @@ void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
|||||||
bZeroVolume = true;
|
bZeroVolume = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !pSource || ( bZeroVolume && pSource->loopStart == -1 ))
|
if( !pSource || ( bZeroVolume && !FBitSet( pSource->flags, SOUND_LOOPED )))
|
||||||
{
|
{
|
||||||
if( !pSource )
|
if( !pSource )
|
||||||
{
|
{
|
||||||
@@ -629,7 +657,7 @@ void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pass in index -1...count+2, return pointer to source sample in either paintbuffer or delay buffer
|
// pass in index -1...count+2, return pointer to source sample in either paintbuffer or delay buffer
|
||||||
_inline portable_samplepair_t *S_GetNextpFilter( int i, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem )
|
static portable_samplepair_t *S_GetNextpFilter( int i, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem )
|
||||||
{
|
{
|
||||||
// The delay buffer is assumed to precede the paintbuffer by 6 duplicated samples
|
// The delay buffer is assumed to precede the paintbuffer by 6 duplicated samples
|
||||||
if( i == -1 ) return (&(pfiltermem[0]));
|
if( i == -1 ) return (&(pfiltermem[0]));
|
||||||
@@ -647,7 +675,7 @@ _inline portable_samplepair_t *S_GetNextpFilter( int i, portable_samplepair_t *p
|
|||||||
// if NULL then perform no filtering.
|
// if NULL then perform no filtering.
|
||||||
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
||||||
|
|
||||||
void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
static void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
||||||
{
|
{
|
||||||
|
|
||||||
// implement cubic interpolation on 2x upsampled buffer. Effectively delays buffer contents by 2 samples.
|
// implement cubic interpolation on 2x upsampled buffer. Effectively delays buffer contents by 2 samples.
|
||||||
@@ -740,7 +768,7 @@ void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t
|
|||||||
// prevfilter: filter memory. NOTE: this must match the filtertype ie: filterlinear[] for FILTERTYPE_LINEAR
|
// prevfilter: filter memory. NOTE: this must match the filtertype ie: filterlinear[] for FILTERTYPE_LINEAR
|
||||||
// if NULL then perform no filtering.
|
// if NULL then perform no filtering.
|
||||||
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
// count: how many samples to upsample. will become count*2 samples in buffer, in place.
|
||||||
void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
static void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int count )
|
||||||
{
|
{
|
||||||
int i, upCount = count<<1;
|
int i, upCount = count<<1;
|
||||||
|
|
||||||
@@ -769,7 +797,7 @@ void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_
|
|||||||
// if NULL then perform no filtering.
|
// if NULL then perform no filtering.
|
||||||
// cfltmem: max number of sample pairs filter can use
|
// cfltmem: max number of sample pairs filter can use
|
||||||
// filtertype: FILTERTYPE_NONE, _LINEAR, _CUBIC etc. Must match prevfilter.
|
// filtertype: FILTERTYPE_NONE, _LINEAR, _CUBIC etc. Must match prevfilter.
|
||||||
void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int filtertype )
|
static void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int filtertype )
|
||||||
{
|
{
|
||||||
int upCount = count<<1;
|
int upCount = count<<1;
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -822,7 +850,7 @@ void MIX_ClearAllPaintBuffers( int SampleCount, qboolean clearFilters )
|
|||||||
// mixes pbuf1 + pbuf2 into pbuf3, count samples
|
// mixes pbuf1 + pbuf2 into pbuf3, count samples
|
||||||
// fgain is output gain 0-1.0
|
// fgain is output gain 0-1.0
|
||||||
// NOTE: pbuf3 may equal pbuf1 or pbuf2!
|
// NOTE: pbuf3 may equal pbuf1 or pbuf2!
|
||||||
void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgain )
|
static void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgain )
|
||||||
{
|
{
|
||||||
portable_samplepair_t *pbuf1, *pbuf2, *pbuf3;
|
portable_samplepair_t *pbuf1, *pbuf2, *pbuf3;
|
||||||
int i, gain;
|
int i, gain;
|
||||||
@@ -838,6 +866,14 @@ void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgai
|
|||||||
pbuf2 = paintbuffers[ibuf2].pbuf;
|
pbuf2 = paintbuffers[ibuf2].pbuf;
|
||||||
pbuf3 = paintbuffers[ibuf3].pbuf;
|
pbuf3 = paintbuffers[ibuf3].pbuf;
|
||||||
|
|
||||||
|
if( !gain )
|
||||||
|
{
|
||||||
|
// do not mix buf2 into buf3, just copy
|
||||||
|
if( pbuf1 != pbuf3 )
|
||||||
|
memcpy( pbuf3, pbuf1, sizeof( *pbuf1 ) * count );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// destination buffer stereo - average n chans down to stereo
|
// destination buffer stereo - average n chans down to stereo
|
||||||
|
|
||||||
// destination 2ch:
|
// destination 2ch:
|
||||||
@@ -855,7 +891,7 @@ void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgai
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MIX_CompressPaintbuffer( int ipaint, int count )
|
static void MIX_CompressPaintbuffer( int ipaint, int count )
|
||||||
{
|
{
|
||||||
portable_samplepair_t *pbuf;
|
portable_samplepair_t *pbuf;
|
||||||
paintbuffer_t *ppaint;
|
paintbuffer_t *ppaint;
|
||||||
@@ -871,7 +907,7 @@ void MIX_CompressPaintbuffer( int ipaint, int count )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_MixUpsample( int sampleCount, int filtertype )
|
static void S_MixUpsample( int sampleCount, int filtertype )
|
||||||
{
|
{
|
||||||
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
paintbuffer_t *ppaint = MIX_GetCurrentPaintbufferPtr();
|
||||||
int ifilter = ppaint->ifilter;
|
int ifilter = ppaint->ifilter;
|
||||||
@@ -884,7 +920,7 @@ void S_MixUpsample( int sampleCount, int filtertype )
|
|||||||
ppaint->ifilter++;
|
ppaint->ifilter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MIX_MixRawSamplesBuffer( int end )
|
static void MIX_MixRawSamplesBuffer( int end )
|
||||||
{
|
{
|
||||||
portable_samplepair_t *pbuf, *roombuf, *streambuf;
|
portable_samplepair_t *pbuf, *roombuf, *streambuf;
|
||||||
uint i, j, stop;
|
uint i, j, stop;
|
||||||
@@ -920,7 +956,11 @@ void MIX_MixRawSamplesBuffer( int end )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( ch->entnum > 0 )
|
if( ch->entnum > 0 )
|
||||||
SND_MoveMouthRaw( ch, &ch->rawsamples[paintedtime & ( ch->max_samples - 1 )], stop - paintedtime );
|
{
|
||||||
|
int pos = paintedtime & ( ch->max_samples - 1 );
|
||||||
|
|
||||||
|
SND_MoveMouthRaw( ch, &ch->rawsamples[pos], bound( 0, ch->max_samples - pos, stop - paintedtime ));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -928,7 +968,7 @@ void MIX_MixRawSamplesBuffer( int end )
|
|||||||
// IROOMBUFFER, IFACINGBUFFER, IFACINGAWAY
|
// IROOMBUFFER, IFACINGBUFFER, IFACINGAWAY
|
||||||
// dsp fx are then applied to these buffers by the caller.
|
// dsp fx are then applied to these buffers by the caller.
|
||||||
// caller also remixes all into final IPAINTBUFFER output.
|
// caller also remixes all into final IPAINTBUFFER output.
|
||||||
void MIX_UpsampleAllPaintbuffers( int end, int count )
|
static void MIX_UpsampleAllPaintbuffers( int end, int count )
|
||||||
{
|
{
|
||||||
// 11khz sounds are mixed into 3 buffers based on distance from listener, and facing direction
|
// 11khz sounds are mixed into 3 buffers based on distance from listener, and facing direction
|
||||||
// These buffers are facing, facingaway, room
|
// These buffers are facing, facingaway, room
|
||||||
@@ -999,7 +1039,8 @@ void MIX_PaintChannels( int endtime )
|
|||||||
MIX_UpsampleAllPaintbuffers( end, count );
|
MIX_UpsampleAllPaintbuffers( end, count );
|
||||||
|
|
||||||
// process all sounds with DSP
|
// process all sounds with DSP
|
||||||
DSP_Process( idsp_room, MIX_GetPFrontFromIPaint( IROOMBUFFER ), count );
|
if( cls.key_dest != key_menu )
|
||||||
|
DSP_Process( MIX_GetPFrontFromIPaint( IROOMBUFFER ), count );
|
||||||
|
|
||||||
// add music or soundtrack from movie (no dsp)
|
// add music or soundtrack from movie (no dsp)
|
||||||
MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() );
|
MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() );
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ float S_GetMusicVolume( void )
|
|||||||
{
|
{
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
|
|
||||||
|
if( host.status == HOST_NOFOCUS && snd_mute_losefocus.value != 0.0f )
|
||||||
|
{
|
||||||
|
// we return zero volume to keep sounds running
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
if( !s_listener.inmenu && musicfade.percent != 0 )
|
if( !s_listener.inmenu && musicfade.percent != 0 )
|
||||||
{
|
{
|
||||||
scale = bound( 0.0f, musicfade.percent / 100.0f, 1.0f );
|
scale = bound( 0.0f, musicfade.percent / 100.0f, 1.0f );
|
||||||
@@ -96,6 +102,7 @@ void S_StartBackgroundTrack( const char *introTrack, const char *mainTrack, int
|
|||||||
|
|
||||||
// open stream
|
// open stream
|
||||||
s_bgTrack.stream = FS_OpenStream( introTrack );
|
s_bgTrack.stream = FS_OpenStream( introTrack );
|
||||||
|
|
||||||
Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current ));
|
Q_strncpy( s_bgTrack.current, introTrack, sizeof( s_bgTrack.current ));
|
||||||
memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
|
memset( &musicfade, 0, sizeof( musicfade )); // clear any soundfade
|
||||||
s_bgTrack.source = cls.key_dest;
|
s_bgTrack.source = cls.key_dest;
|
||||||
@@ -141,7 +148,7 @@ S_StreamGetCurrentState
|
|||||||
save\restore code
|
save\restore code
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *position )
|
qboolean S_StreamGetCurrentState( char *currentTrack, size_t currentTrackSize, char *loopTrack, size_t loopTrackSize, int *position )
|
||||||
{
|
{
|
||||||
if( !s_bgTrack.stream )
|
if( !s_bgTrack.stream )
|
||||||
return false; // not active
|
return false; // not active
|
||||||
@@ -149,15 +156,15 @@ qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *posi
|
|||||||
if( currentTrack )
|
if( currentTrack )
|
||||||
{
|
{
|
||||||
if( s_bgTrack.current[0] )
|
if( s_bgTrack.current[0] )
|
||||||
Q_strncpy( currentTrack, s_bgTrack.current, MAX_STRING );
|
Q_strncpy( currentTrack, s_bgTrack.current, currentTrackSize );
|
||||||
else Q_strncpy( currentTrack, "*", MAX_STRING ); // no track
|
else Q_strncpy( currentTrack, "*", currentTrackSize ); // no track
|
||||||
}
|
}
|
||||||
|
|
||||||
if( loopTrack )
|
if( loopTrack )
|
||||||
{
|
{
|
||||||
if( s_bgTrack.loopName[0] )
|
if( s_bgTrack.loopName[0] )
|
||||||
Q_strncpy( loopTrack, s_bgTrack.loopName, MAX_STRING );
|
Q_strncpy( loopTrack, s_bgTrack.loopName, loopTrackSize );
|
||||||
else Q_strncpy( loopTrack, "*", MAX_STRING ); // no track
|
else Q_strncpy( loopTrack, "*", loopTrackSize ); // no track
|
||||||
}
|
}
|
||||||
|
|
||||||
if( position )
|
if( position )
|
||||||
|
|||||||
@@ -16,204 +16,6 @@ GNU General Public License for more details.
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
|
|
||||||
// hardcoded macros to test for zero crossing
|
|
||||||
#define ZERO_X_8( b ) (( b ) < 2 && ( b ) > -2 )
|
|
||||||
#define ZERO_X_16( b ) (( b ) < 512 && ( b ) > -512 )
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Purpose: Search backward for a zero crossing starting at sample
|
|
||||||
// Input : sample - starting point
|
|
||||||
// Output : position of zero crossing
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample )
|
|
||||||
{
|
|
||||||
if( pWaveData == NULL )
|
|
||||||
return sample;
|
|
||||||
|
|
||||||
if( pWaveData->type == WF_PCMDATA )
|
|
||||||
{
|
|
||||||
int sampleSize;
|
|
||||||
|
|
||||||
sampleSize = pWaveData->width * pWaveData->channels;
|
|
||||||
|
|
||||||
// this can never be zero -- other functions divide by this.
|
|
||||||
// This should never happen, but avoid crashing
|
|
||||||
if( sampleSize <= 0 ) sampleSize = 1;
|
|
||||||
|
|
||||||
if( pWaveData->width == 1 )
|
|
||||||
{
|
|
||||||
signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample--;
|
|
||||||
pData--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ) && ZERO_X_8( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample--;
|
|
||||||
pData--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
short *pData = (short *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16(*pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pData--;
|
|
||||||
sample--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16( *pData ) && ZERO_X_16( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample--;
|
|
||||||
pData--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sample;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Purpose: Search forward for a zero crossing
|
|
||||||
// Input : sample - starting point
|
|
||||||
// Output : position of found zero crossing
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
int S_ZeroCrossingAfter( wavdata_t *pWaveData, int sample )
|
|
||||||
{
|
|
||||||
if( pWaveData == NULL )
|
|
||||||
return sample;
|
|
||||||
|
|
||||||
if( pWaveData->type == WF_PCMDATA )
|
|
||||||
{
|
|
||||||
int sampleSize;
|
|
||||||
|
|
||||||
sampleSize = pWaveData->width * pWaveData->channels;
|
|
||||||
|
|
||||||
// this can never be zero -- other functions divide by this.
|
|
||||||
// This should never happen, but avoid crashing
|
|
||||||
if( sampleSize <= 0 ) sampleSize = 1;
|
|
||||||
|
|
||||||
if( pWaveData->width == 1 ) // 8-bit
|
|
||||||
{
|
|
||||||
signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample < pWaveData->samples && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample++;
|
|
||||||
pData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample < pWaveData->samples && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_8( *pData ) && ZERO_X_8( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample++;
|
|
||||||
pData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
short *pData = (short *)(pWaveData->buffer + sample * sampleSize);
|
|
||||||
qboolean zero = false;
|
|
||||||
|
|
||||||
if( pWaveData->channels == 1 )
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16( *pData ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pData++;
|
|
||||||
sample++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while( sample > 0 && !zero )
|
|
||||||
{
|
|
||||||
if( ZERO_X_16( *pData ) && ZERO_X_16( pData[1] ))
|
|
||||||
{
|
|
||||||
zero = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sample++;
|
|
||||||
pData++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sample;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: wrap the position wrt looping
|
// Purpose: wrap the position wrt looping
|
||||||
// Input : samplePosition - absolute position
|
// Input : samplePosition - absolute position
|
||||||
@@ -225,7 +27,7 @@ int S_ConvertLoopedPosition( wavdata_t *pSource, int samplePosition, qboolean us
|
|||||||
// convert to a position within the loop
|
// convert to a position within the loop
|
||||||
// At the end of the loop, we return a short buffer, and subsequent call
|
// At the end of the loop, we return a short buffer, and subsequent call
|
||||||
// will loop back and get the rest of the buffer
|
// will loop back and get the rest of the buffer
|
||||||
if( pSource->loopStart >= 0 && samplePosition >= pSource->samples && use_loop )
|
if( FBitSet( pSource->flags, SOUND_LOOPED ) && samplePosition >= pSource->samples && use_loop )
|
||||||
{
|
{
|
||||||
// size of loop
|
// size of loop
|
||||||
int loopSize = pSource->samples - pSource->loopStart;
|
int loopSize = pSource->samples - pSource->loopStart;
|
||||||
@@ -279,28 +81,3 @@ int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int s
|
|||||||
|
|
||||||
return sampleCount;
|
return sampleCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// move the current position to newPosition
|
|
||||||
void S_SetSampleStart( channel_t *pChan, wavdata_t *pSource, int newPosition )
|
|
||||||
{
|
|
||||||
if( pSource )
|
|
||||||
newPosition = S_ZeroCrossingAfter( pSource, newPosition );
|
|
||||||
|
|
||||||
pChan->pMixer.sample = newPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
// end playback at newEndPosition
|
|
||||||
void S_SetSampleEnd( channel_t *pChan, wavdata_t *pSource, int newEndPosition )
|
|
||||||
{
|
|
||||||
// forced end of zero means play the whole sample
|
|
||||||
if( !newEndPosition ) newEndPosition = 1;
|
|
||||||
|
|
||||||
if( pSource )
|
|
||||||
newEndPosition = S_ZeroCrossingBefore( pSource, newEndPosition );
|
|
||||||
|
|
||||||
// past current position? limit.
|
|
||||||
if( newEndPosition < pChan->pMixer.sample )
|
|
||||||
newEndPosition = pChan->pMixer.sample;
|
|
||||||
|
|
||||||
pChan->pMixer.forcedEndSample = newEndPosition;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -18,10 +18,126 @@ GNU General Public License for more details.
|
|||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#define TRIM_SCAN_MAX 255
|
||||||
|
#define TRIM_SAMPLES_BELOW_8 2
|
||||||
|
#define TRIM_SAMPLES_BELOW_16 512 // 65k * 2 / 256
|
||||||
|
|
||||||
|
#define CVOXFILESENTENCEMAX 4096
|
||||||
|
|
||||||
static int cszrawsentences = 0;
|
static int cszrawsentences = 0;
|
||||||
static char *rgpszrawsentence[CVOXFILESENTENCEMAX];
|
static char *rgpszrawsentence[CVOXFILESENTENCEMAX];
|
||||||
static const char *voxperiod = "_period", *voxcomma = "_comma";
|
static const char *voxperiod = "_period", *voxcomma = "_comma";
|
||||||
|
|
||||||
|
static qboolean S_ShouldTrimSample8( const int8_t *buf, int channels )
|
||||||
|
{
|
||||||
|
if( abs( buf[0] ) > TRIM_SAMPLES_BELOW_8 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( channels >= 2 && abs( buf[1] ) > TRIM_SAMPLES_BELOW_8 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean S_ShouldTrimSample16( const int16_t *buf, int channels )
|
||||||
|
{
|
||||||
|
if( abs( buf[0] ) > TRIM_SAMPLES_BELOW_16 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( channels >= 2 && abs( buf[1] ) > TRIM_SAMPLES_BELOW_16 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int S_TrimStart( const wavdata_t *wav, int start )
|
||||||
|
{
|
||||||
|
size_t channels = wav->channels, width = wav->width, i;
|
||||||
|
|
||||||
|
if( wav->type != WF_PCMDATA )
|
||||||
|
return start;
|
||||||
|
|
||||||
|
if( width == 1 )
|
||||||
|
{
|
||||||
|
const int8_t *data = (const int8_t *)&wav->buffer[channels * width * start];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && start < wav->samples; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample8( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
start += channels;
|
||||||
|
data += channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( width == 2 )
|
||||||
|
{
|
||||||
|
const int16_t *data = (const int16_t *)&wav->buffer[channels * width * start];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && start < wav->samples; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample16( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
start += channels;
|
||||||
|
data += channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int S_TrimEnd( const wavdata_t *wav, int end )
|
||||||
|
{
|
||||||
|
size_t channels = wav->channels, width = wav->width, i;
|
||||||
|
|
||||||
|
if( wav->type != WF_PCMDATA )
|
||||||
|
return end;
|
||||||
|
|
||||||
|
if( width == 1 )
|
||||||
|
{
|
||||||
|
const int8_t *data = (const int8_t *)&wav->buffer[channels * width * ( end - 1 )];
|
||||||
|
|
||||||
|
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 - 1 )];
|
||||||
|
|
||||||
|
for( i = 0; i < TRIM_SCAN_MAX && end > 0; i++ )
|
||||||
|
{
|
||||||
|
if( !S_ShouldTrimSample16( data, wav->channels ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
end -= channels;
|
||||||
|
data -= channels;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return end;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void S_TrimStartEndTimes( channel_t *ch, wavdata_t *wav, int start, int end )
|
||||||
|
{
|
||||||
|
ch->pMixer.sample = start = S_TrimStart( wav, start );
|
||||||
|
|
||||||
|
// don't overrun the buffer while trimming end
|
||||||
|
if( end == 0 )
|
||||||
|
end = wav->samples - wav->channels;
|
||||||
|
|
||||||
|
if( end < start )
|
||||||
|
end = start;
|
||||||
|
|
||||||
|
ch->pMixer.forcedEndSample = S_TrimEnd( wav, end );
|
||||||
|
}
|
||||||
|
|
||||||
// return number of samples mixed
|
// return number of samples mixed
|
||||||
int VOX_MixDataToDevice( channel_t *pchan, int sampleCount, int outputRate, int outputOffset )
|
int VOX_MixDataToDevice( channel_t *pchan, int sampleCount, int outputRate, int outputOffset )
|
||||||
{
|
{
|
||||||
@@ -78,11 +194,7 @@ void VOX_LoadWord( channel_t *ch )
|
|||||||
|
|
||||||
if( end <= start ) end = 0;
|
if( end <= start ) end = 0;
|
||||||
|
|
||||||
if( start )
|
S_TrimStartEndTimes( ch, data, start * 0.01f * samples, end * 0.01f * samples );
|
||||||
S_SetSampleStart( ch, data, start * 0.01f * samples );
|
|
||||||
|
|
||||||
if( end )
|
|
||||||
S_SetSampleEnd( ch, data, end * 0.01f * samples );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VOX_FreeWord( channel_t *ch )
|
void VOX_FreeWord( channel_t *ch )
|
||||||
@@ -136,6 +248,12 @@ static const char *VOX_GetDirectory( char *szpath, const char *psz, int nsize )
|
|||||||
const char *p;
|
const char *p;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
// HACKHACK: some modders send strings like "/fvox/_period four"
|
||||||
|
// which should get parsed as "_period four" said by fvox
|
||||||
|
// it might be incorrect but ignore first slash here for now
|
||||||
|
if( psz[0] == '/' )
|
||||||
|
psz++;
|
||||||
|
|
||||||
// search / backwards
|
// search / backwards
|
||||||
p = Q_strrchr( psz, '/' );
|
p = Q_strrchr( psz, '/' );
|
||||||
|
|
||||||
@@ -149,7 +267,7 @@ static const char *VOX_GetDirectory( char *szpath, const char *psz, int nsize )
|
|||||||
|
|
||||||
if( len > nsize )
|
if( len > nsize )
|
||||||
{
|
{
|
||||||
Con_Printf( "VOX_GetDirectory: invalid directory in: %s\n", psz );
|
Con_Printf( "%s: invalid directory in: %s\n", __func__, psz );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +473,7 @@ void VOX_LoadSound( channel_t *ch, const char *pszin )
|
|||||||
|
|
||||||
if( !psz )
|
if( !psz )
|
||||||
{
|
{
|
||||||
Con_Printf( "VOX_LoadSound: no sentence named %s\n", pszin );
|
Con_Printf( "%s: no sentence named %s\n", __func__, pszin );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,13 +481,13 @@ void VOX_LoadSound( channel_t *ch, const char *pszin )
|
|||||||
|
|
||||||
if( !psz )
|
if( !psz )
|
||||||
{
|
{
|
||||||
Con_Printf( "VOX_LoadSound: failed getting directory for %s\n", pszin );
|
Con_Printf( "%s: failed getting directory for %s\n", __func__, pszin );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Q_strlen( psz ) >= sizeof( buffer ) )
|
if( Q_strlen( psz ) >= sizeof( buffer ) )
|
||||||
{
|
{
|
||||||
Con_Printf( "VOX_LoadSound: sentence is too long %s", psz );
|
Con_Printf( "%s: sentence is too long %s", __func__, psz );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,8 +601,8 @@ static void Test_VOX_GetDirectory( void )
|
|||||||
{
|
{
|
||||||
"", "", "vox/",
|
"", "", "vox/",
|
||||||
"bark bark", "bark bark", "vox/",
|
"bark bark", "bark bark", "vox/",
|
||||||
"barney/meow", "meow", "barney/"
|
"barney/meow", "meow", "barney/",
|
||||||
|
"/fvox/_period", "_period", "fvox/",
|
||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
@@ -20,57 +20,37 @@ extern poolhandle_t sndpool;
|
|||||||
|
|
||||||
#include "xash3d_mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
|
|
||||||
// sound engine rate defines
|
#define XASH_AUDIO_CD_QUALITY 1 // some platforms might need this
|
||||||
#define SOUND_DMA_SPEED 44100 // hardware playback rate
|
|
||||||
#define SOUND_11k 11025 // 11khz sample rate
|
|
||||||
#define SOUND_16k 16000 // 16khz sample rate
|
|
||||||
#define SOUND_22k 22050 // 22khz sample rate
|
|
||||||
#define SOUND_32k 32000 // 32khz sample rate
|
|
||||||
#define SOUND_44k 44100 // 44khz sample rate
|
|
||||||
#define DMA_MSEC_PER_SAMPLE ((float)(1000.0 / SOUND_DMA_SPEED))
|
|
||||||
|
|
||||||
// fixed point stuff for real-time resampling
|
// sound engine rate defines
|
||||||
#define FIX_BITS 28
|
#if XASH_AUDIO_CD_QUALITY
|
||||||
#define FIX_SCALE (1 << FIX_BITS)
|
#define SOUND_11k 11025 // 11khz sample rate
|
||||||
#define FIX_MASK ((1 << FIX_BITS)-1)
|
#define SOUND_22k 22050 // 22khz sample rate
|
||||||
#define FIX_FLOAT(a) ((int)((a) * FIX_SCALE))
|
#define SOUND_44k 44100 // 44khz sample rate
|
||||||
#define FIX(a) (((int)(a)) << FIX_BITS)
|
#else // XASH_AUDIO_CD_QUALITY
|
||||||
#define FIX_INTPART(a) (((int)(a)) >> FIX_BITS)
|
#define SOUND_11k 12000 // 11khz sample rate
|
||||||
#define FIX_FRACTION(a,b) (FIX(a)/(b))
|
#define SOUND_22k 24000 // 22khz sample rate
|
||||||
#define FIX_FRACPART(a) ((a) & FIX_MASK)
|
#define SOUND_44k 48000 // 44khz sample rate
|
||||||
|
#endif // XASH_AUDIO_CD_QUALITY
|
||||||
|
|
||||||
|
#define SOUND_DMA_SPEED SOUND_44k // hardware playback rate
|
||||||
|
|
||||||
// NOTE: clipped sound at 32760 to avoid overload
|
// NOTE: clipped sound at 32760 to avoid overload
|
||||||
#define CLIP( x ) (( x ) > 32760 ? 32760 : (( x ) < -32760 ? -32760 : ( x )))
|
#define CLIP( x ) (( x ) > 32760 ? 32760 : (( x ) < -32760 ? -32760 : ( x )))
|
||||||
|
|
||||||
#define PAINTBUFFER_SIZE 1024 // 44k: was 512
|
#define PAINTBUFFER_SIZE 1024 // 44k: was 512
|
||||||
#define PAINTBUFFER (g_curpaintbuffer)
|
|
||||||
#define CPAINTBUFFERS 3
|
|
||||||
|
|
||||||
// sound mixing buffer
|
|
||||||
#define CPAINTFILTERMEM 3
|
|
||||||
#define CPAINTFILTERS 4 // maximum number of consecutive upsample passes per paintbuffer
|
|
||||||
|
|
||||||
#define S_RAW_SOUND_IDLE_SEC 10 // time interval for idling raw sound before it's freed
|
#define S_RAW_SOUND_IDLE_SEC 10 // time interval for idling raw sound before it's freed
|
||||||
#define S_RAW_SOUND_BACKGROUNDTRACK -2
|
#define S_RAW_SOUND_BACKGROUNDTRACK -2
|
||||||
#define S_RAW_SOUND_SOUNDTRACK -1
|
#define S_RAW_SOUND_SOUNDTRACK -1
|
||||||
#define S_RAW_SAMPLES_PRECISION_BITS 14
|
#define S_RAW_SAMPLES_PRECISION_BITS 14
|
||||||
|
|
||||||
#define CIN_FRAMETIME (1.0f / 30.0f)
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int left;
|
int left;
|
||||||
int right;
|
int right;
|
||||||
} portable_samplepair_t;
|
} portable_samplepair_t;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
qboolean factive; // if true, mix to this paintbuffer using flags
|
|
||||||
portable_samplepair_t *pbuf; // front stereo mix buffer, for 2 or 4 channel mixing
|
|
||||||
int ifilter; // current filter memory buffer to use for upsampling pass
|
|
||||||
portable_samplepair_t fltmem[CPAINTFILTERS][CPAINTFILTERMEM];
|
|
||||||
} paintbuffer_t;
|
|
||||||
|
|
||||||
typedef struct sfx_s
|
typedef struct sfx_s
|
||||||
{
|
{
|
||||||
char name[MAX_QPATH];
|
char name[MAX_QPATH];
|
||||||
@@ -81,12 +61,6 @@ typedef struct sfx_s
|
|||||||
struct sfx_s *hashNext;
|
struct sfx_s *hashNext;
|
||||||
} sfx_t;
|
} sfx_t;
|
||||||
|
|
||||||
extern portable_samplepair_t paintbuffer[];
|
|
||||||
extern portable_samplepair_t roombuffer[];
|
|
||||||
extern portable_samplepair_t temppaintbuffer[];
|
|
||||||
extern portable_samplepair_t *g_curpaintbuffer;
|
|
||||||
extern paintbuffer_t paintbuffers[];
|
|
||||||
|
|
||||||
// structure used for fading in and out client sound volume.
|
// structure used for fading in and out client sound volume.
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -105,9 +79,9 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct snd_format_s
|
typedef struct snd_format_s
|
||||||
{
|
{
|
||||||
unsigned int speed;
|
uint speed;
|
||||||
unsigned int width;
|
byte width;
|
||||||
unsigned int channels;
|
byte channels;
|
||||||
} snd_format_t;
|
} snd_format_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -115,8 +89,8 @@ typedef struct
|
|||||||
snd_format_t format;
|
snd_format_t format;
|
||||||
int samples; // mono samples in buffer
|
int samples; // mono samples in buffer
|
||||||
int samplepos; // in mono samples
|
int samplepos; // in mono samples
|
||||||
byte *buffer;
|
|
||||||
qboolean initialized; // sound engine is active
|
qboolean initialized; // sound engine is active
|
||||||
|
byte *buffer;
|
||||||
const char *backendName;
|
const char *backendName;
|
||||||
} dma_t;
|
} dma_t;
|
||||||
|
|
||||||
@@ -125,7 +99,6 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
double sample;
|
double sample;
|
||||||
|
|
||||||
wavdata_t *pData;
|
wavdata_t *pData;
|
||||||
double forcedEndSample;
|
double forcedEndSample;
|
||||||
qboolean finished;
|
qboolean finished;
|
||||||
@@ -140,15 +113,15 @@ typedef struct rawchan_s
|
|||||||
float dist_mult; // distance multiplier (attenuation/clipK)
|
float dist_mult; // distance multiplier (attenuation/clipK)
|
||||||
vec3_t origin; // only use if fixed_origin is set
|
vec3_t origin; // only use if fixed_origin is set
|
||||||
volatile uint s_rawend;
|
volatile uint s_rawend;
|
||||||
wavdata_t sound_info; // advance play position
|
|
||||||
float oldtime; // catch time jumps
|
float oldtime; // catch time jumps
|
||||||
|
wavdata_t sound_info; // advance play position
|
||||||
size_t max_samples; // buffer length
|
size_t max_samples; // buffer length
|
||||||
portable_samplepair_t rawsamples[1]; // variable sized
|
portable_samplepair_t rawsamples[]; // variable sized
|
||||||
} rawchan_t;
|
} rawchan_t;
|
||||||
|
|
||||||
typedef struct channel_s
|
typedef struct channel_s
|
||||||
{
|
{
|
||||||
char name[16]; // keept sentence name
|
char name[16]; // keep sentence name
|
||||||
sfx_t *sfx; // sfx number
|
sfx_t *sfx; // sfx number
|
||||||
|
|
||||||
int leftvol; // 0-255 left volume
|
int leftvol; // 0-255 left volume
|
||||||
@@ -159,7 +132,6 @@ typedef struct channel_s
|
|||||||
vec3_t origin; // only use if fixed_origin is set
|
vec3_t origin; // only use if fixed_origin is set
|
||||||
float dist_mult; // distance multiplier (attenuation/clipK)
|
float dist_mult; // distance multiplier (attenuation/clipK)
|
||||||
int master_vol; // 0-255 master volume
|
int master_vol; // 0-255 master volume
|
||||||
qboolean isSentence; // bit who indicated sentence
|
|
||||||
int basePitch; // base pitch percent (100% is normal pitch playback)
|
int basePitch; // base pitch percent (100% is normal pitch playback)
|
||||||
float pitch; // real-time pitch after any modulation or shift by dynamic data
|
float pitch; // real-time pitch after any modulation or shift by dynamic data
|
||||||
qboolean use_loop; // don't loop default and local sounds
|
qboolean use_loop; // don't loop default and local sounds
|
||||||
@@ -168,6 +140,7 @@ typedef struct channel_s
|
|||||||
mixer_t pMixer;
|
mixer_t pMixer;
|
||||||
|
|
||||||
// sentence mixer
|
// sentence mixer
|
||||||
|
qboolean isSentence; // bit indicating sentence
|
||||||
int wordIndex;
|
int wordIndex;
|
||||||
mixer_t *currentWord; // NULL if sentence is finished
|
mixer_t *currentWord; // NULL if sentence is finished
|
||||||
voxword_t words[CVOXWORDMAX];
|
voxword_t words[CVOXWORDMAX];
|
||||||
@@ -176,7 +149,6 @@ typedef struct channel_s
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
vec3_t origin; // simorg + view_ofs
|
vec3_t origin; // simorg + view_ofs
|
||||||
vec3_t velocity;
|
|
||||||
vec3_t forward;
|
vec3_t forward;
|
||||||
vec3_t right;
|
vec3_t right;
|
||||||
vec3_t up;
|
vec3_t up;
|
||||||
@@ -219,10 +191,10 @@ extern dma_t dma;
|
|||||||
|
|
||||||
extern convar_t s_musicvolume;
|
extern convar_t s_musicvolume;
|
||||||
extern convar_t s_lerping;
|
extern convar_t s_lerping;
|
||||||
extern convar_t s_test; // cvar to testify new effects
|
extern convar_t s_test; // cvar to test new effects
|
||||||
extern convar_t s_samplecount;
|
extern convar_t s_samplecount;
|
||||||
extern convar_t snd_mute_losefocus;
|
|
||||||
extern convar_t s_warn_late_precache;
|
extern convar_t s_warn_late_precache;
|
||||||
|
extern convar_t snd_mute_losefocus;
|
||||||
|
|
||||||
void S_InitScaletable( void );
|
void S_InitScaletable( void );
|
||||||
wavdata_t *S_LoadSound( sfx_t *sfx );
|
wavdata_t *S_LoadSound( sfx_t *sfx );
|
||||||
@@ -255,8 +227,7 @@ void S_InitSounds( void );
|
|||||||
void SX_Init( void );
|
void SX_Init( void );
|
||||||
void SX_Free( void );
|
void SX_Free( void );
|
||||||
void CheckNewDspPresets( void );
|
void CheckNewDspPresets( void );
|
||||||
void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount );
|
void DSP_Process( portable_samplepair_t *pbfront, int sampleCount );
|
||||||
float DSP_GetGain( int idsp );
|
|
||||||
void DSP_ClearState( void );
|
void DSP_ClearState( void );
|
||||||
|
|
||||||
qboolean S_Init( void );
|
qboolean S_Init( void );
|
||||||
@@ -294,7 +265,6 @@ void SND_ForceCloseMouth( int entnum );
|
|||||||
//
|
//
|
||||||
void S_StreamSoundTrack( void );
|
void S_StreamSoundTrack( void );
|
||||||
void S_StreamBackgroundTrack( void );
|
void S_StreamBackgroundTrack( void );
|
||||||
qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *position );
|
|
||||||
void S_PrintBackgroundTrackState( void );
|
void S_PrintBackgroundTrackState( void );
|
||||||
void S_FadeMusicVolume( float fadePercent );
|
void S_FadeMusicVolume( float fadePercent );
|
||||||
|
|
||||||
@@ -305,8 +275,6 @@ int S_ZeroCrossingAfter( wavdata_t *pWaveData, int sample );
|
|||||||
int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample );
|
int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample );
|
||||||
int S_ConvertLoopedPosition( wavdata_t *pSource, int samplePosition, qboolean use_loop );
|
int S_ConvertLoopedPosition( wavdata_t *pSource, int samplePosition, qboolean use_loop );
|
||||||
int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int sampleCount, qboolean use_loop );
|
int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int sampleCount, qboolean use_loop );
|
||||||
void S_SetSampleStart( channel_t *pChan, wavdata_t *pSource, int newPosition );
|
|
||||||
void S_SetSampleEnd( channel_t *pChan, wavdata_t *pSource, int newEndPosition );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// s_vox.c
|
// s_vox.c
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
|
|||||||
|
|
||||||
if( IsEndOfText( trim ))
|
if( IsEndOfText( trim ))
|
||||||
{
|
{
|
||||||
Con_Reportf( "TextMessage: unexpected '}' found, line %d\n", lineNumber );
|
Con_Reportf( "%s: unexpected '}' found, line %d\n", __func__, lineNumber );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Q_strncpy( currentName, trim, sizeof( currentName ));
|
Q_strncpy( currentName, trim, sizeof( currentName ));
|
||||||
@@ -263,7 +263,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
|
|||||||
// save name on name heap
|
// save name on name heap
|
||||||
if( lastNamePos + length > 32768 )
|
if( lastNamePos + length > 32768 )
|
||||||
{
|
{
|
||||||
Con_Reportf( "TextMessage: error while parsing!\n" );
|
Con_Reportf( "%s: error while parsing!\n", __func__ );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
|
|||||||
}
|
}
|
||||||
if( IsStartOfText( trim ))
|
if( IsStartOfText( trim ))
|
||||||
{
|
{
|
||||||
Con_Reportf( "TextMessage: unexpected '{' found, line %d\n", lineNumber );
|
Con_Reportf( "%s: unexpected '{' found, line %d\n", __func__, lineNumber );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -302,7 +302,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Reportf( "TextMessage: parsed %d text messages\n", messageCount );
|
Con_Reportf( "%s: parsed %d text messages\n", __func__, messageCount );
|
||||||
nameHeapSize = lastNamePos;
|
nameHeapSize = lastNamePos;
|
||||||
textHeapSize = 0;
|
textHeapSize = 0;
|
||||||
|
|
||||||
@@ -347,7 +347,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(( pCurrentText - (char *)clgame.titles ) != ( textHeapSize + nameHeapSize + messageSize ))
|
if(( pCurrentText - (char *)clgame.titles ) != ( textHeapSize + nameHeapSize + messageSize ))
|
||||||
Con_DPrintf( S_ERROR "TextMessage: overflow text message buffer!\n" );
|
Con_DPrintf( S_ERROR "%s: overflow text message buffer!\n", __func__ );
|
||||||
|
|
||||||
clgame.numTitles = messageCount;
|
clgame.numTitles = messageCount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,55 +23,182 @@ GNU General Public License for more details.
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
CVAR_DEFINE_AUTO( vgui_utf8, "0", FCVAR_ARCHIVE, "enable utf-8 support for vgui text" );
|
#define VGUI_MAX_TEXTURES 1024
|
||||||
|
|
||||||
static void GAME_EXPORT *VGUI_EngineMalloc( size_t size );
|
typedef struct vgui_static_s
|
||||||
static void GAME_EXPORT VGUI_GetMousePos( int *, int * );
|
|
||||||
static void GAME_EXPORT VGUI_CursorSelect( VGUI_DefaultCursor );
|
|
||||||
static byte GAME_EXPORT VGUI_GetColor( int, int );
|
|
||||||
static int GAME_EXPORT VGUI_UtfProcessChar( int in );
|
|
||||||
static qboolean GAME_EXPORT VGUI_IsInGame( void );
|
|
||||||
|
|
||||||
static struct
|
|
||||||
{
|
{
|
||||||
qboolean initialized;
|
qboolean initialized;
|
||||||
vguiapi_t dllFuncs;
|
|
||||||
VGUI_DefaultCursor cursor;
|
VGUI_DefaultCursor cursor;
|
||||||
|
vguiapi_t dllFuncs;
|
||||||
|
|
||||||
|
int textures[VGUI_MAX_TEXTURES];
|
||||||
|
int texture_id;
|
||||||
|
int bound_texture;
|
||||||
|
byte color[4];
|
||||||
|
qboolean enable_texture;
|
||||||
|
|
||||||
HINSTANCE hInstance;
|
HINSTANCE hInstance;
|
||||||
|
|
||||||
enum VGUI_KeyCode virtualKeyTrans[256];
|
enum VGUI_KeyCode virtualKeyTrans[256];
|
||||||
} vgui =
|
} vgui_static_t;
|
||||||
{
|
|
||||||
false,
|
static vgui_static_t vgui = {
|
||||||
{
|
false, -1
|
||||||
false, // Not initialized yet
|
|
||||||
NULL, // VGUI_DrawInit,
|
|
||||||
NULL, // VGUI_DrawShutdown,
|
|
||||||
NULL, // VGUI_SetupDrawingText,
|
|
||||||
NULL, // VGUI_SetupDrawingRect,
|
|
||||||
NULL, // VGUI_SetupDrawingImage,
|
|
||||||
NULL, // VGUI_BindTexture,
|
|
||||||
NULL, // VGUI_EnableTexture,
|
|
||||||
NULL, // VGUI_CreateTexture,
|
|
||||||
NULL, // VGUI_UploadTexture,
|
|
||||||
NULL, // VGUI_UploadTextureBlock,
|
|
||||||
NULL, // VGUI_DrawQuad,
|
|
||||||
NULL, // VGUI_GetTextureSizes,
|
|
||||||
NULL, // VGUI_GenerateTexture,
|
|
||||||
VGUI_EngineMalloc,
|
|
||||||
VGUI_CursorSelect,
|
|
||||||
VGUI_GetColor,
|
|
||||||
VGUI_IsInGame,
|
|
||||||
Key_EnableTextInput,
|
|
||||||
VGUI_GetMousePos,
|
|
||||||
VGUI_UtfProcessChar,
|
|
||||||
Platform_GetClipboardText,
|
|
||||||
Platform_SetClipboardText,
|
|
||||||
Platform_GetKeyModifiers,
|
|
||||||
},
|
|
||||||
-1
|
|
||||||
};
|
};
|
||||||
|
static CVAR_DEFINE_AUTO( vgui_utf8, "0", FCVAR_ARCHIVE, "enable utf-8 support for vgui text" );
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_DrawInit( void )
|
||||||
|
{
|
||||||
|
memset( vgui.textures, 0, sizeof( vgui.textures ));
|
||||||
|
memset( vgui.color, 0, sizeof( vgui.color ));
|
||||||
|
vgui.texture_id = vgui.bound_texture = 0;
|
||||||
|
vgui.enable_texture = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_DrawShutdown( void )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 1; i < vgui.texture_id; i++ )
|
||||||
|
ref.dllFuncs.GL_FreeTexture( vgui.textures[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
static int GAME_EXPORT VGUI_GenerateTexture( void )
|
||||||
|
{
|
||||||
|
if( ++vgui.texture_id >= VGUI_MAX_TEXTURES )
|
||||||
|
Host_Error( "%s: VGUI_MAX_TEXTURES limit exceeded\n", __func__ );
|
||||||
|
|
||||||
|
return vgui.texture_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_UploadTexture( int id, const char *buffer, int width, int height )
|
||||||
|
{
|
||||||
|
rgbdata_t r_image = { 0 };
|
||||||
|
char texName[32];
|
||||||
|
|
||||||
|
if( id <= 0 || id >= VGUI_MAX_TEXTURES )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "%s: bad texture %i. Ignored\n", __func__, id );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_snprintf( texName, sizeof( texName ), "*vgui%i", id );
|
||||||
|
|
||||||
|
r_image.width = width;
|
||||||
|
r_image.height = height;
|
||||||
|
r_image.type = PF_RGBA_32;
|
||||||
|
r_image.size = width * height * 4;
|
||||||
|
r_image.flags = IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA;
|
||||||
|
r_image.buffer = (byte*)buffer;
|
||||||
|
|
||||||
|
vgui.textures[id] = GL_LoadTextureInternal( texName, &r_image, TF_IMAGE );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_CreateTexture( int id, int width, int height )
|
||||||
|
{
|
||||||
|
rgbdata_t r_image = { 0 };
|
||||||
|
char texName[32];
|
||||||
|
|
||||||
|
if( id <= 0 || id >= VGUI_MAX_TEXTURES )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "%s: bad texture %i. Ignored\n", __func__, id );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_snprintf( texName, sizeof( texName ), "*vgui%i", id );
|
||||||
|
|
||||||
|
r_image.width = width;
|
||||||
|
r_image.height = height;
|
||||||
|
r_image.type = PF_RGBA_32;
|
||||||
|
r_image.size = width * height * 4;
|
||||||
|
r_image.flags = IMAGE_HAS_COLOR|IMAGE_HAS_ALPHA;
|
||||||
|
r_image.buffer = NULL;
|
||||||
|
|
||||||
|
vgui.textures[id] = GL_LoadTextureInternal( texName, &r_image, TF_IMAGE );
|
||||||
|
vgui.bound_texture = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_UploadTextureBlock( int id, int drawX, int drawY, const byte *rgba, int blockWidth, int blockHeight )
|
||||||
|
{
|
||||||
|
if( id <= 0 || id >= VGUI_MAX_TEXTURES || vgui.textures[id] == 0 )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "%s: bad texture %i. Ignored\n", __func__, id );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ref.dllFuncs.VGUI_UploadTextureBlock( drawX, drawY, rgba, blockWidth, blockHeight );
|
||||||
|
vgui.bound_texture = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_BindTexture( int id )
|
||||||
|
{
|
||||||
|
if( id <= 0 || id >= VGUI_MAX_TEXTURES || !vgui.textures[id] )
|
||||||
|
id = 1; // NOTE: same as bogus index 2700 in GoldSrc
|
||||||
|
|
||||||
|
ref.dllFuncs.GL_Bind( XASH_TEXTURE0, vgui.textures[id] );
|
||||||
|
vgui.bound_texture = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_GetTextureSizes( int *w, int *h )
|
||||||
|
{
|
||||||
|
int texnum;
|
||||||
|
|
||||||
|
if( vgui.bound_texture )
|
||||||
|
texnum = vgui.textures[vgui.bound_texture];
|
||||||
|
else
|
||||||
|
texnum = R_GetBuiltinTexture( REF_DEFAULT_TEXTURE );
|
||||||
|
|
||||||
|
R_GetTextureParms( w, h, texnum );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_SetupDrawingRect( int *pColor )
|
||||||
|
{
|
||||||
|
ref.dllFuncs.VGUI_SetupDrawing( true );
|
||||||
|
Vector4Set( vgui.color, pColor[0], pColor[1], pColor[2], 255 - pColor[3] );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_SetupDrawingText( int *pColor )
|
||||||
|
{
|
||||||
|
ref.dllFuncs.VGUI_SetupDrawing( false );
|
||||||
|
Vector4Set( vgui.color, pColor[0], pColor[1], pColor[2], 255 - pColor[3] );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_DrawQuad( const vpoint_t *ul, const vpoint_t *lr )
|
||||||
|
{
|
||||||
|
float x, y, w, h;
|
||||||
|
|
||||||
|
if( !ul || !lr )
|
||||||
|
return;
|
||||||
|
|
||||||
|
x = ul->point[0];
|
||||||
|
y = ul->point[1];
|
||||||
|
w = lr->point[0] - x;
|
||||||
|
h = lr->point[1] - y;
|
||||||
|
|
||||||
|
SPR_AdjustSize( &x, &y, &w, &h );
|
||||||
|
|
||||||
|
if( vgui.enable_texture )
|
||||||
|
{
|
||||||
|
float s1, s2, t1, t2;
|
||||||
|
|
||||||
|
s1 = ul->coord[0];
|
||||||
|
t1 = ul->coord[1];
|
||||||
|
s2 = lr->coord[0];
|
||||||
|
t2 = lr->coord[1];
|
||||||
|
|
||||||
|
ref.dllFuncs.Color4ub( vgui.color[0], vgui.color[1], vgui.color[2], vgui.color[3] );
|
||||||
|
ref.dllFuncs.R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, vgui.textures[vgui.bound_texture] );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ref.dllFuncs.FillRGBABlend( x, y, w, h, vgui.color[0], vgui.color[1], vgui.color[2], vgui.color[3] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void GAME_EXPORT VGUI_EnableTexture( qboolean enable )
|
||||||
|
{
|
||||||
|
vgui.enable_texture = enable;
|
||||||
|
}
|
||||||
|
|
||||||
static void GAME_EXPORT *VGUI_EngineMalloc( size_t size )
|
static void GAME_EXPORT *VGUI_EngineMalloc( size_t size )
|
||||||
{
|
{
|
||||||
@@ -117,33 +244,46 @@ qboolean VGui_IsActive( void )
|
|||||||
return vgui.initialized;
|
return vgui.initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VGui_FillAPIFromRef( vguiapi_t *to, const ref_interface_t *from )
|
|
||||||
{
|
|
||||||
to->DrawInit = from->VGUI_DrawInit;
|
|
||||||
to->DrawShutdown = from->VGUI_DrawShutdown;
|
|
||||||
to->SetupDrawingText = from->VGUI_SetupDrawingText;
|
|
||||||
to->SetupDrawingRect = from->VGUI_SetupDrawingRect;
|
|
||||||
to->SetupDrawingImage = from->VGUI_SetupDrawingImage;
|
|
||||||
to->BindTexture = from->VGUI_BindTexture;
|
|
||||||
to->EnableTexture = from->VGUI_EnableTexture;
|
|
||||||
to->CreateTexture = from->VGUI_CreateTexture;
|
|
||||||
to->UploadTexture = from->VGUI_UploadTexture;
|
|
||||||
to->UploadTextureBlock = from->VGUI_UploadTextureBlock;
|
|
||||||
to->DrawQuad = from->VGUI_DrawQuad;
|
|
||||||
to->GetTextureSizes = from->VGUI_GetTextureSizes;
|
|
||||||
to->GenerateTexture = from->VGUI_GenerateTexture;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VGui_RegisterCvars( void )
|
void VGui_RegisterCvars( void )
|
||||||
{
|
{
|
||||||
Cvar_RegisterVariable( &vgui_utf8 );
|
Cvar_RegisterVariable( &vgui_utf8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const vguiapi_t gEngfuncs =
|
||||||
|
{
|
||||||
|
false, // Not initialized yet
|
||||||
|
VGUI_DrawInit, // VGUI_DrawInit,
|
||||||
|
VGUI_DrawShutdown, // VGUI_DrawShutdown,
|
||||||
|
VGUI_SetupDrawingText, // VGUI_SetupDrawingText,
|
||||||
|
VGUI_SetupDrawingRect, // VGUI_SetupDrawingRect,
|
||||||
|
VGUI_SetupDrawingText, // VGUI_SetupDrawingImage, (same as text)
|
||||||
|
VGUI_BindTexture, // VGUI_BindTexture,
|
||||||
|
VGUI_EnableTexture, // VGUI_EnableTexture,
|
||||||
|
VGUI_CreateTexture, // VGUI_CreateTexture,
|
||||||
|
VGUI_UploadTexture, // VGUI_UploadTexture,
|
||||||
|
VGUI_UploadTextureBlock, // VGUI_UploadTextureBlock,
|
||||||
|
VGUI_DrawQuad, // VGUI_DrawQuad,
|
||||||
|
VGUI_GetTextureSizes, // VGUI_GetTextureSizes,
|
||||||
|
VGUI_GenerateTexture, // VGUI_GenerateTexture,
|
||||||
|
VGUI_EngineMalloc,
|
||||||
|
VGUI_CursorSelect,
|
||||||
|
VGUI_GetColor,
|
||||||
|
VGUI_IsInGame,
|
||||||
|
Key_EnableTextInput,
|
||||||
|
VGUI_GetMousePos,
|
||||||
|
VGUI_UtfProcessChar,
|
||||||
|
Platform_GetClipboardText,
|
||||||
|
Platform_SetClipboardText,
|
||||||
|
Platform_GetKeyModifiers,
|
||||||
|
};
|
||||||
|
|
||||||
qboolean VGui_LoadProgs( HINSTANCE hInstance )
|
qboolean VGui_LoadProgs( HINSTANCE hInstance )
|
||||||
{
|
{
|
||||||
void (*F)( vguiapi_t* );
|
void (*F)( vguiapi_t* );
|
||||||
qboolean client = hInstance != NULL;
|
qboolean client = hInstance != NULL;
|
||||||
|
|
||||||
|
vgui.dllFuncs = gEngfuncs;
|
||||||
|
|
||||||
// not loading interface from client.dll, load vgui_support.dll instead
|
// not loading interface from client.dll, load vgui_support.dll instead
|
||||||
if( !client )
|
if( !client )
|
||||||
{
|
{
|
||||||
@@ -167,7 +307,7 @@ qboolean VGui_LoadProgs( HINSTANCE hInstance )
|
|||||||
{
|
{
|
||||||
if( FS_FileExists( vguiloader, false ))
|
if( FS_FileExists( vguiloader, false ))
|
||||||
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s\n", COM_GetLibraryError() );
|
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s\n", COM_GetLibraryError() );
|
||||||
else Con_Reportf( "vgui_support: not found\n" );
|
else Con_Reportf( "%s: not found\n", __func__ );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -178,16 +318,15 @@ qboolean VGui_LoadProgs( HINSTANCE hInstance )
|
|||||||
|
|
||||||
if( F )
|
if( F )
|
||||||
{
|
{
|
||||||
VGui_FillAPIFromRef( &vgui.dllFuncs, &ref.dllFuncs );
|
|
||||||
F( &vgui.dllFuncs );
|
F( &vgui.dllFuncs );
|
||||||
|
|
||||||
vgui.initialized = vgui.dllFuncs.initialized = true;
|
vgui.initialized = vgui.dllFuncs.initialized = true;
|
||||||
Con_Reportf( "vgui_support: initialized legacy API in %s module\n", client ? "client" : "support" );
|
Con_Reportf( "%s: initialized legacy API in %s module\n", __func__, client ? "client" : "support" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Reportf( S_ERROR "Failed to find VGUI support API entry point in %s module\n", client ? "client" : "support" );
|
Con_Reportf( S_ERROR "%s: Failed to find VGUI support API entry point in %s module\n", __func__, client ? "client" : "support" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,8 +372,9 @@ void VGui_Shutdown( void )
|
|||||||
if( vgui.hInstance )
|
if( vgui.hInstance )
|
||||||
COM_FreeLibrary( vgui.hInstance );
|
COM_FreeLibrary( vgui.hInstance );
|
||||||
|
|
||||||
|
// drop pointers to now unloaded vgui_support
|
||||||
|
vgui.dllFuncs = gEngfuncs;
|
||||||
vgui.hInstance = NULL;
|
vgui.hInstance = NULL;
|
||||||
vgui.initialized = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,35 +20,20 @@ GNU General Public License for more details.
|
|||||||
#include "vid_common.h"
|
#include "vid_common.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
static CVAR_DEFINE( window_width, "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" );
|
|
||||||
static CVAR_DEFINE( window_height, "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" );
|
|
||||||
static CVAR_DEFINE( vid_brightness, "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
|
||||||
static CVAR_DEFINE( vid_gamma, "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" );
|
|
||||||
static CVAR_DEFINE_AUTO( vid_mode, "0", FCVAR_RENDERINFO, "current video mode index (used only for storage)" );
|
static CVAR_DEFINE_AUTO( vid_mode, "0", FCVAR_RENDERINFO, "current video mode index (used only for storage)" );
|
||||||
static CVAR_DEFINE_AUTO( vid_rotate, "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" );
|
static CVAR_DEFINE_AUTO( vid_rotate, "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" );
|
||||||
static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
static CVAR_DEFINE_AUTO( vid_scale, "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
||||||
|
|
||||||
CVAR_DEFINE_AUTO( vid_highdpi, "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" );
|
CVAR_DEFINE_AUTO( vid_highdpi, "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" );
|
||||||
CVAR_DEFINE_AUTO( vid_maximized, "0", FCVAR_RENDERINFO, "window maximized state, read-only" );
|
CVAR_DEFINE_AUTO( vid_maximized, "0", FCVAR_RENDERINFO, "window maximized state, read-only" );
|
||||||
CVAR_DEFINE( vid_fullscreen, "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "fullscreen state (0 windowed, 1 fullscreen, 2 borderless)" );
|
CVAR_DEFINE( vid_fullscreen, "fullscreen", DEFAULT_FULLSCREEN, FCVAR_RENDERINFO|FCVAR_VIDRESTART, "fullscreen state (0 windowed, 1 fullscreen, 2 borderless)" );
|
||||||
|
CVAR_DEFINE( window_width, "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" );
|
||||||
|
CVAR_DEFINE( window_height, "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" );
|
||||||
CVAR_DEFINE( window_xpos, "_window_xpos", "-1", FCVAR_RENDERINFO, "window position by horizontal" );
|
CVAR_DEFINE( window_xpos, "_window_xpos", "-1", FCVAR_RENDERINFO, "window position by horizontal" );
|
||||||
CVAR_DEFINE( window_ypos, "_window_ypos", "-1", FCVAR_RENDERINFO, "window position by vertical" );
|
CVAR_DEFINE( window_ypos, "_window_ypos", "-1", FCVAR_RENDERINFO, "window position by vertical" );
|
||||||
|
|
||||||
glwstate_t glw_state;
|
glwstate_t glw_state;
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
VID_StartupGamma
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void VID_StartupGamma( void )
|
|
||||||
{
|
|
||||||
BuildGammaTable( vid_gamma.value, vid_brightness.value );
|
|
||||||
Con_Reportf( "VID_StartupGamma: gamma %g brightness %g\n", vid_gamma.value, vid_brightness.value );
|
|
||||||
ClearBits( vid_brightness.flags, FCVAR_CHANGED );
|
|
||||||
ClearBits( vid_gamma.flags, FCVAR_CHANGED );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
VID_InitDefaultResolution
|
VID_InitDefaultResolution
|
||||||
@@ -190,7 +175,7 @@ static void VID_Mode_f( void )
|
|||||||
vidmode = R_GetVideoMode( Q_atoi( Cmd_Argv( 1 )) );
|
vidmode = R_GetVideoMode( Q_atoi( Cmd_Argv( 1 )) );
|
||||||
if( !vidmode )
|
if( !vidmode )
|
||||||
{
|
{
|
||||||
Con_Print( S_ERROR "unable to set mode, backend returned null" );
|
Con_Printf( S_ERROR "unable to set mode, backend returned null" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,8 +209,6 @@ void VID_Init( void )
|
|||||||
Cvar_RegisterVariable( &vid_scale );
|
Cvar_RegisterVariable( &vid_scale );
|
||||||
Cvar_RegisterVariable( &vid_fullscreen );
|
Cvar_RegisterVariable( &vid_fullscreen );
|
||||||
Cvar_RegisterVariable( &vid_maximized );
|
Cvar_RegisterVariable( &vid_maximized );
|
||||||
Cvar_RegisterVariable( &vid_brightness );
|
|
||||||
Cvar_RegisterVariable( &vid_gamma );
|
|
||||||
Cvar_RegisterVariable( &window_xpos );
|
Cvar_RegisterVariable( &window_xpos );
|
||||||
Cvar_RegisterVariable( &window_ypos );
|
Cvar_RegisterVariable( &window_ypos );
|
||||||
|
|
||||||
@@ -233,5 +216,6 @@ void VID_Init( void )
|
|||||||
// but supported mode list is filled by backends, so numbers are not portable any more
|
// but supported mode list is filled by backends, so numbers are not portable any more
|
||||||
Cmd_AddRestrictedCommand( "vid_setmode", VID_Mode_f, "display video mode" );
|
Cmd_AddRestrictedCommand( "vid_setmode", VID_Mode_f, "display video mode" );
|
||||||
|
|
||||||
|
V_Init(); // init gamma
|
||||||
R_Init(); // init renderer
|
R_Init(); // init renderer
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ extern glwstate_t glw_state;
|
|||||||
extern convar_t vid_fullscreen;
|
extern convar_t vid_fullscreen;
|
||||||
extern convar_t vid_maximized;
|
extern convar_t vid_maximized;
|
||||||
extern convar_t vid_highdpi;
|
extern convar_t vid_highdpi;
|
||||||
|
extern convar_t window_width;
|
||||||
|
extern convar_t window_height;
|
||||||
extern convar_t window_xpos;
|
extern convar_t window_xpos;
|
||||||
extern convar_t window_ypos;
|
extern convar_t window_ypos;
|
||||||
extern convar_t gl_msaa_samples;
|
extern convar_t gl_msaa_samples;
|
||||||
@@ -46,6 +48,5 @@ void R_SaveVideoMode( int w, int h, int render_w, int render_h, qboolean maximiz
|
|||||||
void VID_SetDisplayTransform( int *render_w, int *render_h );
|
void VID_SetDisplayTransform( int *render_w, int *render_h );
|
||||||
void VID_CheckChanges( void );
|
void VID_CheckChanges( void );
|
||||||
const char *VID_GetModeString( int vid_mode );
|
const char *VID_GetModeString( int vid_mode );
|
||||||
void VID_StartupGamma( void );
|
|
||||||
|
|
||||||
#endif // VID_COMMON
|
#endif // VID_COMMON
|
||||||
|
|||||||
@@ -25,11 +25,17 @@ voice_state_t voice = { 0 };
|
|||||||
CVAR_DEFINE_AUTO( voice_enable, "1", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "enable voice chat" );
|
CVAR_DEFINE_AUTO( voice_enable, "1", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "enable voice chat" );
|
||||||
CVAR_DEFINE_AUTO( voice_loopback, "0", FCVAR_PRIVILEGED, "loopback voice back to the speaker" );
|
CVAR_DEFINE_AUTO( voice_loopback, "0", FCVAR_PRIVILEGED, "loopback voice back to the speaker" );
|
||||||
CVAR_DEFINE_AUTO( voice_scale, "1.0", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "incoming voice volume scale" );
|
CVAR_DEFINE_AUTO( voice_scale, "1.0", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "incoming voice volume scale" );
|
||||||
|
CVAR_DEFINE_AUTO( voice_transmit_scale, "1.0", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "outcoming voice volume scale" );
|
||||||
CVAR_DEFINE_AUTO( voice_avggain, "0.5", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "automatic voice gain control (average)" );
|
CVAR_DEFINE_AUTO( voice_avggain, "0.5", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "automatic voice gain control (average)" );
|
||||||
CVAR_DEFINE_AUTO( voice_maxgain, "5.0", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "automatic voice gain control (maximum)" );
|
CVAR_DEFINE_AUTO( voice_maxgain, "5.0", FCVAR_PRIVILEGED|FCVAR_ARCHIVE, "automatic voice gain control (maximum)" );
|
||||||
CVAR_DEFINE_AUTO( voice_inputfromfile, "0", FCVAR_PRIVILEGED, "input voice from voice_input.wav" );
|
CVAR_DEFINE_AUTO( voice_inputfromfile, "0", FCVAR_PRIVILEGED, "input voice from voice_input.wav" );
|
||||||
|
|
||||||
static void Voice_ApplyGainAdjust( int16_t *samples, int count );
|
static void Voice_ApplyGainAdjust( int16_t *samples, int count, float scale );
|
||||||
|
|
||||||
|
// in case user enabled voice after connection
|
||||||
|
// can't keep in `voice` struct because it gets zeroed on shutdown
|
||||||
|
static string voice_codec_init;
|
||||||
|
static int voice_quality_init;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============================================================================
|
===============================================================================
|
||||||
@@ -39,6 +45,25 @@ static void Voice_ApplyGainAdjust( int16_t *samples, int count );
|
|||||||
===============================================================================
|
===============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static qboolean Voice_InitCustomMode( void )
|
||||||
|
{
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
|
voice.width = sizeof( opus_int16 );
|
||||||
|
voice.samplerate = VOICE_OPUS_CUSTOM_SAMPLERATE;
|
||||||
|
voice.frame_size = VOICE_OPUS_CUSTOM_FRAME_SIZE;
|
||||||
|
|
||||||
|
voice.custom_mode = opus_custom_mode_create( SOUND_44k, voice.frame_size, &err );
|
||||||
|
|
||||||
|
if( !voice.custom_mode )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "Can't create Opus Custom mode: %s\n", opus_strerror( err ));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=========================
|
=========================
|
||||||
Voice_InitOpusDecoder
|
Voice_InitOpusDecoder
|
||||||
@@ -47,24 +72,17 @@ Voice_InitOpusDecoder
|
|||||||
*/
|
*/
|
||||||
static qboolean Voice_InitOpusDecoder( void )
|
static qboolean Voice_InitOpusDecoder( void )
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
voice.width = sizeof( opus_int16 );
|
for( int i = 0; i < cl.maxclients; i++ )
|
||||||
voice.samplerate = VOICE_OPUS_CUSTOM_SAMPLERATE;
|
|
||||||
voice.frame_size = VOICE_OPUS_CUSTOM_FRAME_SIZE;
|
|
||||||
|
|
||||||
voice.custom_mode = opus_custom_mode_create( SOUND_44k, voice.frame_size, &err );
|
|
||||||
if( !voice.custom_mode )
|
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "Can't create Opus Custom mode: %s\n", opus_strerror( err ));
|
voice.decoders[i] = opus_custom_decoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
||||||
|
|
||||||
|
if( !voice.decoders[i] )
|
||||||
|
{
|
||||||
|
Con_Printf( S_ERROR "Can't create Opus decoder for %i: %s\n", i, opus_strerror( err ));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
voice.decoder = opus_custom_decoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
|
||||||
if( !voice.decoder )
|
|
||||||
{
|
|
||||||
Con_Printf( S_ERROR "Can't create Opus encoder: %s\n", opus_strerror( err ));
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -78,7 +96,7 @@ Voice_InitOpusEncoder
|
|||||||
*/
|
*/
|
||||||
static qboolean Voice_InitOpusEncoder( int quality )
|
static qboolean Voice_InitOpusEncoder( int quality )
|
||||||
{
|
{
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
voice.encoder = opus_custom_encoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
voice.encoder = opus_custom_encoder_create( voice.custom_mode, VOICE_PCM_CHANNELS, &err );
|
||||||
if( !voice.encoder )
|
if( !voice.encoder )
|
||||||
@@ -117,10 +135,13 @@ Voice_ShutdownOpusDecoder
|
|||||||
*/
|
*/
|
||||||
static void Voice_ShutdownOpusDecoder( void )
|
static void Voice_ShutdownOpusDecoder( void )
|
||||||
{
|
{
|
||||||
if( voice.decoder )
|
for( int i = 0; i < MAX_CLIENTS; i++ )
|
||||||
{
|
{
|
||||||
opus_custom_decoder_destroy( voice.decoder );
|
if( !voice.decoders[i] )
|
||||||
voice.decoder = NULL;
|
continue;
|
||||||
|
|
||||||
|
opus_custom_decoder_destroy( voice.decoders[i] );
|
||||||
|
voice.decoders[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +158,10 @@ static void Voice_ShutdownOpusEncoder( void )
|
|||||||
opus_custom_encoder_destroy( voice.encoder );
|
opus_custom_encoder_destroy( voice.encoder );
|
||||||
voice.encoder = NULL;
|
voice.encoder = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Voice_ShutdownCustomMode( void )
|
||||||
|
{
|
||||||
if( voice.custom_mode )
|
if( voice.custom_mode )
|
||||||
{
|
{
|
||||||
opus_custom_mode_destroy( voice.custom_mode );
|
opus_custom_mode_destroy( voice.custom_mode );
|
||||||
@@ -184,7 +208,7 @@ static uint Voice_GetOpusCompressedData( byte *out, uint maxsize, uint *frames )
|
|||||||
if( !voice.input_file )
|
if( !voice.input_file )
|
||||||
{
|
{
|
||||||
// adjust gain before encoding, but only for input from voice
|
// adjust gain before encoding, but only for input from voice
|
||||||
Voice_ApplyGainAdjust((opus_int16*)(voice.input_buffer + ofs), voice.frame_size);
|
Voice_ApplyGainAdjust((opus_int16*)(voice.input_buffer + ofs), voice.frame_size, voice_transmit_scale.value);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -238,10 +262,10 @@ Voice_ApplyGainAdjust
|
|||||||
|
|
||||||
=========================
|
=========================
|
||||||
*/
|
*/
|
||||||
static void Voice_ApplyGainAdjust( int16_t *samples, int count )
|
static void Voice_ApplyGainAdjust( int16_t *samples, int count, float scale )
|
||||||
{
|
{
|
||||||
float gain, modifiedMax;
|
float gain, modifiedMax;
|
||||||
int average, adjustedSample, blockOffset = 0;
|
int average, blockOffset = 0;
|
||||||
|
|
||||||
for( ;; )
|
for( ;; )
|
||||||
{
|
{
|
||||||
@@ -260,10 +284,8 @@ static void Voice_ApplyGainAdjust( int16_t *samples, int count )
|
|||||||
localMax = absSample;
|
localMax = absSample;
|
||||||
|
|
||||||
localSum += absSample;
|
localSum += absSample;
|
||||||
|
|
||||||
gain = voice.autogain.current_gain + i * voice.autogain.gain_multiplier;
|
gain = voice.autogain.current_gain + i * voice.autogain.gain_multiplier;
|
||||||
adjustedSample = Q_min( SHRT_MAX, Q_max(( int )( sample * gain ), SHRT_MIN ));
|
samples[blockOffset + i] = bound( SHRT_MIN, (int)( sample * gain ), SHRT_MAX );
|
||||||
samples[blockOffset + i] = adjustedSample;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( blockOffset % voice.autogain.block_size == 0 )
|
if( blockOffset % voice.autogain.block_size == 0 )
|
||||||
@@ -271,9 +293,9 @@ static void Voice_ApplyGainAdjust( int16_t *samples, int count )
|
|||||||
average = localSum / blockSize;
|
average = localSum / blockSize;
|
||||||
modifiedMax = average + ( localMax - average ) * voice_avggain.value;
|
modifiedMax = average + ( localMax - average ) * voice_avggain.value;
|
||||||
|
|
||||||
voice.autogain.current_gain = voice.autogain.next_gain * voice_scale.value;
|
voice.autogain.current_gain = voice.autogain.next_gain * scale;
|
||||||
voice.autogain.next_gain = Q_min( (float)SHRT_MAX / modifiedMax, voice_maxgain.value ) * voice_scale.value;
|
voice.autogain.next_gain = Q_min( (float)SHRT_MAX / modifiedMax, voice_maxgain.value ) * scale;
|
||||||
voice.autogain.gain_multiplier = ( voice.autogain.next_gain - voice.autogain.current_gain ) / ( voice.autogain.block_size - 1 );
|
voice.autogain.gain_multiplier = ( voice.autogain.next_gain - voice.autogain.current_gain ) / ( blockSize - 1 );
|
||||||
}
|
}
|
||||||
blockOffset += blockSize;
|
blockOffset += blockSize;
|
||||||
}
|
}
|
||||||
@@ -374,13 +396,16 @@ void Voice_RecordStart( void )
|
|||||||
{
|
{
|
||||||
Voice_RecordStop();
|
Voice_RecordStop();
|
||||||
|
|
||||||
|
if( !voice.initialized )
|
||||||
|
return;
|
||||||
|
|
||||||
if( voice_inputfromfile.value )
|
if( voice_inputfromfile.value )
|
||||||
{
|
{
|
||||||
voice.input_file = FS_LoadSound( "voice_input.wav", NULL, 0 );
|
voice.input_file = FS_LoadSound( "voice_input.wav", NULL, 0 );
|
||||||
|
|
||||||
if( voice.input_file )
|
if( voice.input_file )
|
||||||
{
|
{
|
||||||
Sound_Process( &voice.input_file, voice.samplerate, voice.width, SOUND_RESAMPLE );
|
Sound_Process( &voice.input_file, voice.samplerate, voice.width, VOICE_PCM_CHANNELS, SOUND_RESAMPLE );
|
||||||
voice.input_file_pos = 0;
|
voice.input_file_pos = 0;
|
||||||
|
|
||||||
voice.start_time = Sys_DoubleTime();
|
voice.start_time = Sys_DoubleTime();
|
||||||
@@ -393,7 +418,7 @@ void Voice_RecordStart( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !Voice_IsRecording() )
|
if( !Voice_IsRecording( ) && voice.device_opened )
|
||||||
voice.is_recording = VoiceCapture_Activate( true );
|
voice.is_recording = VoiceCapture_Activate( true );
|
||||||
|
|
||||||
if( Voice_IsRecording() )
|
if( Voice_IsRecording() )
|
||||||
@@ -428,6 +453,9 @@ void Voice_Disconnect( void )
|
|||||||
voice.players_status[i].talking_ack = false;
|
voice.players_status[i].talking_ack = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VoiceCapture_Shutdown();
|
||||||
|
voice.device_opened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -440,7 +468,7 @@ Feed the decoded data to engine sound subsystem
|
|||||||
static void Voice_StartChannel( uint samples, byte *data, int entnum )
|
static void Voice_StartChannel( uint samples, byte *data, int entnum )
|
||||||
{
|
{
|
||||||
SND_ForceInitMouth( entnum );
|
SND_ForceInitMouth( entnum );
|
||||||
S_RawEntSamples( entnum, samples, voice.samplerate, voice.width, VOICE_PCM_CHANNELS, data, 255 );
|
S_RawEntSamples( entnum, samples, voice.samplerate, voice.width, VOICE_PCM_CHANNELS, data, bound( 0, 255 * voice_scale.value, 255 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -452,10 +480,11 @@ Received encoded voice data, decode it
|
|||||||
*/
|
*/
|
||||||
void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
|
void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
|
||||||
{
|
{
|
||||||
|
const int playernum = ent - 1;
|
||||||
int samples = 0;
|
int samples = 0;
|
||||||
int ofs = 0;
|
int ofs = 0;
|
||||||
|
|
||||||
if( !voice.decoder )
|
if( playernum < 0 || playernum >= cl.maxclients || !voice.decoders[playernum] )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// decode frame by frame
|
// decode frame by frame
|
||||||
@@ -475,7 +504,7 @@ void Voice_AddIncomingData( int ent, const byte *data, uint size, uint frames )
|
|||||||
if( ofs + compressed_size > size )
|
if( ofs + compressed_size > size )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
frame_samples = opus_custom_decode( voice.decoder, data + ofs, compressed_size,
|
frame_samples = opus_custom_decode( voice.decoders[playernum], data + ofs, compressed_size,
|
||||||
(opus_int16*)voice.decompress_buffer + samples, voice.frame_size );
|
(opus_int16*)voice.decompress_buffer + samples, voice.frame_size );
|
||||||
|
|
||||||
ofs += compressed_size;
|
ofs += compressed_size;
|
||||||
@@ -500,7 +529,7 @@ void CL_AddVoiceToDatagram( void )
|
|||||||
if( cls.state != ca_active || !Voice_IsRecording() || !voice.encoder )
|
if( cls.state != ca_active || !Voice_IsRecording() || !voice.encoder )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
size = Voice_GetOpusCompressedData( voice.output_buffer, sizeof( voice.output_buffer ), &frames );
|
size = Voice_GetOpusCompressedData( voice.compress_buffer, sizeof( voice.compress_buffer ), &frames );
|
||||||
|
|
||||||
if( size > 0 && MSG_GetNumBytesLeft( &cls.datagram ) >= size + 32 )
|
if( size > 0 && MSG_GetNumBytesLeft( &cls.datagram ) >= size + 32 )
|
||||||
{
|
{
|
||||||
@@ -508,7 +537,7 @@ void CL_AddVoiceToDatagram( void )
|
|||||||
MSG_WriteByte( &cls.datagram, voice_loopback.value != 0 );
|
MSG_WriteByte( &cls.datagram, voice_loopback.value != 0 );
|
||||||
MSG_WriteByte( &cls.datagram, frames );
|
MSG_WriteByte( &cls.datagram, frames );
|
||||||
MSG_WriteShort( &cls.datagram, size );
|
MSG_WriteShort( &cls.datagram, size );
|
||||||
MSG_WriteBytes( &cls.datagram, voice.output_buffer, size );
|
MSG_WriteBytes( &cls.datagram, voice.compress_buffer, size );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,6 +553,7 @@ void Voice_RegisterCvars( void )
|
|||||||
Cvar_RegisterVariable( &voice_enable );
|
Cvar_RegisterVariable( &voice_enable );
|
||||||
Cvar_RegisterVariable( &voice_loopback );
|
Cvar_RegisterVariable( &voice_loopback );
|
||||||
Cvar_RegisterVariable( &voice_scale );
|
Cvar_RegisterVariable( &voice_scale );
|
||||||
|
Cvar_RegisterVariable( &voice_transmit_scale );
|
||||||
Cvar_RegisterVariable( &voice_avggain );
|
Cvar_RegisterVariable( &voice_avggain );
|
||||||
Cvar_RegisterVariable( &voice_maxgain );
|
Cvar_RegisterVariable( &voice_maxgain );
|
||||||
Cvar_RegisterVariable( &voice_inputfromfile );
|
Cvar_RegisterVariable( &voice_inputfromfile );
|
||||||
@@ -541,8 +571,9 @@ static void Voice_Shutdown( void )
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
Voice_RecordStop();
|
Voice_RecordStop();
|
||||||
Voice_ShutdownOpusEncoder();
|
|
||||||
Voice_ShutdownOpusDecoder();
|
Voice_ShutdownOpusDecoder();
|
||||||
|
Voice_ShutdownOpusEncoder();
|
||||||
|
Voice_ShutdownCustomMode();
|
||||||
VoiceCapture_Shutdown();
|
VoiceCapture_Shutdown();
|
||||||
|
|
||||||
if( voice.local.talking_ack )
|
if( voice.local.talking_ack )
|
||||||
@@ -568,10 +599,17 @@ void Voice_Idle( double frametime )
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( FBitSet( voice_enable.flags, FCVAR_CHANGED ) && !voice_enable.value )
|
if( FBitSet( voice_enable.flags, FCVAR_CHANGED ))
|
||||||
{
|
{
|
||||||
|
ClearBits( voice_enable.flags, FCVAR_CHANGED );
|
||||||
|
|
||||||
|
if( voice_enable.value )
|
||||||
|
{
|
||||||
|
if( cls.state == ca_active && COM_CheckString( voice_codec_init ) && voice_quality_init != 0 )
|
||||||
|
Voice_Init( voice_codec_init, voice_quality_init, false );
|
||||||
|
}
|
||||||
|
else
|
||||||
Voice_Shutdown();
|
Voice_Shutdown();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update local player status first
|
// update local player status first
|
||||||
@@ -588,30 +626,35 @@ Voice_Init
|
|||||||
Initialize the voice subsystem
|
Initialize the voice subsystem
|
||||||
=========================
|
=========================
|
||||||
*/
|
*/
|
||||||
qboolean Voice_Init( const char *pszCodecName, int quality )
|
qboolean Voice_Init( const char *pszCodecName, int quality, qboolean preinit )
|
||||||
{
|
{
|
||||||
if( !voice_enable.value )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( Q_strcmp( pszCodecName, VOICE_OPUS_CUSTOM_CODEC ))
|
if( Q_strcmp( pszCodecName, VOICE_OPUS_CUSTOM_CODEC ))
|
||||||
{
|
{
|
||||||
|
if( COM_CheckStringEmpty( pszCodecName ))
|
||||||
Con_Printf( S_ERROR "Server requested unsupported codec: %s\n", pszCodecName );
|
Con_Printf( S_ERROR "Server requested unsupported codec: %s\n", pszCodecName );
|
||||||
|
|
||||||
|
// reset saved codec name, we won't enable voice for this connection
|
||||||
|
voice_codec_init[0] = 0;
|
||||||
|
voice_quality_init = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_strncpy( voice_codec_init, pszCodecName, sizeof( voice_codec_init ));
|
||||||
|
voice_quality_init = quality;
|
||||||
|
|
||||||
|
if( !voice_enable.value )
|
||||||
|
return false;
|
||||||
|
|
||||||
// reinitialize only if codec parameters are different
|
// reinitialize only if codec parameters are different
|
||||||
if( !Q_strcmp( voice.codec, pszCodecName ) && voice.quality == quality )
|
if( Q_strcmp( pszCodecName, voice.codec ) || voice.quality != quality )
|
||||||
return true;
|
{
|
||||||
|
|
||||||
Voice_Shutdown();
|
Voice_Shutdown();
|
||||||
|
|
||||||
voice.autogain.block_size = 128;
|
voice.autogain.block_size = 128;
|
||||||
|
|
||||||
if( !Voice_InitOpusDecoder( ))
|
if( !Voice_InitCustomMode( ))
|
||||||
{
|
{
|
||||||
// no reason to init encoder and open audio device
|
// no reason to init encoder and open audio device
|
||||||
// if we can't hear other players
|
// if we can't hear other players
|
||||||
Con_Printf( S_ERROR "Voice chat disabled.\n" );
|
|
||||||
Voice_Shutdown();
|
Voice_Shutdown();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -627,9 +670,25 @@ qboolean Voice_Init( const char *pszCodecName, int quality )
|
|||||||
}
|
}
|
||||||
|
|
||||||
voice.quality = quality;
|
voice.quality = quality;
|
||||||
|
}
|
||||||
|
|
||||||
if( !VoiceCapture_Init( ))
|
if( !preinit )
|
||||||
|
{
|
||||||
|
Voice_ShutdownOpusDecoder();
|
||||||
|
if( !Voice_InitOpusDecoder())
|
||||||
|
{
|
||||||
|
// no reason to init encoder and open audio device
|
||||||
|
// if we can't hear other players
|
||||||
|
Con_Printf( S_ERROR "Can't create decoders, voice chat is disabled.\n" );
|
||||||
|
Voice_Shutdown();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
voice.device_opened = VoiceCapture_Init();
|
||||||
|
|
||||||
|
if( !voice.device_opened )
|
||||||
Con_Printf( S_WARN "No microphone is available.\n" );
|
Con_Printf( S_WARN "No microphone is available.\n" );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user