mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-11 14:42:05 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70a3ff531c | ||
|
|
501ff944b9 | ||
|
|
f16641b606 | ||
|
|
f045103abb | ||
|
|
8ab97fbbf0 | ||
|
|
a5a66f6c3e | ||
|
|
1c6604806c | ||
|
|
39893609fd | ||
|
|
b9901bcb70 | ||
|
|
6571c78ed4 | ||
|
|
d1e6063650 | ||
|
|
42db1faa51 | ||
|
|
efc156fcf5 | ||
|
|
207675990e | ||
|
|
e8cd6e9d65 | ||
|
|
ab256e294e | ||
|
|
d9fd6aa05c | ||
|
|
57382c7cea | ||
|
|
1042291ad6 | ||
|
|
c9e4912a2a | ||
|
|
e5e1570aed | ||
|
|
621399c49b | ||
|
|
c3684109bf | ||
|
|
f3fedbfdba | ||
|
|
29a8bfb1dc | ||
|
|
004e190435 | ||
|
|
378c4f30f3 | ||
|
|
a8c877c841 | ||
|
|
8ce448cc77 | ||
|
|
4ba95277b9 | ||
|
|
cce7c7d782 | ||
|
|
9e5d5e0ea3 | ||
|
|
a235bec5f1 | ||
|
|
a3a8acfe6c | ||
|
|
9e4e9cab04 | ||
|
|
e4ad8def0d | ||
|
|
ec95948b69 | ||
|
|
ef6ff3cfa6 | ||
|
|
7bcfce5a7a | ||
|
|
08c04200fb | ||
|
|
8bbd0d5119 | ||
|
|
ade0fd4afa | ||
|
|
ed7ed818bb | ||
|
|
91f845c335 | ||
|
|
81ef12be9e | ||
|
|
2aafe9df9f | ||
|
|
3b933eabf5 | ||
|
|
f5ccf093d6 | ||
|
|
fe0da74e75 | ||
|
|
2939ab8ea4 | ||
|
|
dd90262db2 | ||
|
|
4f8e4b5f64 | ||
|
|
32068d8090 | ||
|
|
bd4979f5b0 | ||
|
|
a5e1e9646c | ||
|
|
013918a371 | ||
|
|
1b20694a1c | ||
|
|
2db6ad2c8a | ||
|
|
8c351d9255 | ||
|
|
c4ef42009c | ||
|
|
8d5426cdcd | ||
|
|
7b8ec0ad4b | ||
|
|
901e52615b | ||
|
|
88ce5fd0b6 | ||
|
|
588dede2a2 | ||
|
|
0efc5e82ec | ||
|
|
c3da9d8c8f | ||
|
|
a547526e86 | ||
|
|
09d647182d | ||
|
|
af3c0686c5 | ||
|
|
8b76ab93fb | ||
|
|
9ffc02b6e9 | ||
|
|
5d307d603c | ||
|
|
affc64c6da | ||
|
|
e00c20b288 | ||
|
|
dcf7ec2c3d | ||
|
|
21a31ec81d | ||
|
|
9287a0f5c5 | ||
|
|
4723eb2586 | ||
|
|
15ec6539e3 | ||
|
|
8d793521c4 | ||
|
|
2147542e33 | ||
|
|
a0af256641 | ||
|
|
21174dc9cf | ||
|
|
894726d699 | ||
|
|
f8e6033ae6 | ||
|
|
4abe1a77f4 | ||
|
|
79f3a6f60e | ||
|
|
a2c83144c0 | ||
|
|
6e0d372504 | ||
|
|
91ee9bd32a | ||
|
|
6ea25b8194 | ||
|
|
5bc4359a2f | ||
|
|
17d3eaa590 | ||
|
|
6ceb101ba1 | ||
|
|
f7f069a38b | ||
|
|
37c5dfa49f | ||
|
|
0260a6c234 | ||
|
|
2ad209b973 | ||
|
|
e9712fc24f | ||
|
|
eef52ea2d0 | ||
|
|
8018f4a000 | ||
|
|
9d0c7338ab | ||
|
|
18d8ef287d | ||
|
|
9b1fccd1fa | ||
|
|
32e96bdad1 | ||
|
|
c50f73b892 | ||
|
|
a1c948e591 | ||
|
|
db3e71bfcc | ||
|
|
2b436dced0 | ||
|
|
a89f9fa181 | ||
|
|
6063149b93 | ||
|
|
a28d15e519 | ||
|
|
94959110f6 | ||
|
|
86be161677 | ||
|
|
9313f7e80e | ||
|
|
43f1137565 | ||
|
|
ad4062969b | ||
|
|
60c10333aa | ||
|
|
0f84ce40f0 | ||
|
|
3894edcb98 | ||
|
|
5b387ba36a | ||
|
|
d011dccaab | ||
|
|
b7922368bd | ||
|
|
947a615707 | ||
|
|
b2d93b7b55 | ||
|
|
49a20a9ac5 | ||
|
|
8966172ce0 | ||
|
|
ddd48c420b | ||
|
|
f31e9ae19e | ||
|
|
4543008012 | ||
|
|
d54a648792 | ||
|
|
13a3f22001 | ||
|
|
75e80bc2ff | ||
|
|
386ae2067b | ||
|
|
b289de26a6 | ||
|
|
415f5baa1c | ||
|
|
3fdfbff09b | ||
|
|
163225e180 | ||
|
|
1369c2029b | ||
|
|
4f31d7504a | ||
|
|
585955eb19 | ||
|
|
1a5b2576f7 | ||
|
|
ddc4d76668 | ||
|
|
f5e400de69 | ||
|
|
9c8059ea96 | ||
|
|
c62db950f1 | ||
|
|
9c9953bb60 | ||
|
|
acaf15c5d2 | ||
|
|
25569db053 | ||
|
|
a391038d27 | ||
|
|
9ea45a71f5 | ||
|
|
ea39836b88 | ||
|
|
bfa01f5b3b | ||
|
|
23974d24c3 | ||
|
|
868947cbb4 | ||
|
|
cb942d7e81 | ||
|
|
05cf8d0edc | ||
|
|
071f15b570 | ||
|
|
e5a40fd745 | ||
|
|
f2ab4c0d0e | ||
|
|
0ba1a8e7bc | ||
|
|
ed0ca2b2d2 | ||
|
|
26404315cb | ||
|
|
be1958473b | ||
|
|
8b59875e93 | ||
|
|
accacd54f5 | ||
|
|
331a2046c8 | ||
|
|
c9f176f802 | ||
|
|
523798857b | ||
|
|
2edc8b16ae | ||
|
|
29902f48d5 | ||
|
|
d25a661701 | ||
|
|
a93d9ac71c | ||
|
|
c68af64fe5 | ||
|
|
3d9a4560d5 | ||
|
|
9120d40ce5 | ||
|
|
4db2aaffc4 | ||
|
|
155eb1ba58 | ||
|
|
efaf7ac622 | ||
|
|
6cc2205321 | ||
|
|
0a818f3f3f | ||
|
|
fe2c4af8c2 | ||
|
|
3e7dd30fd7 | ||
|
|
42f47f51b5 | ||
|
|
aea9e8efa2 | ||
|
|
a6cd67cc65 | ||
|
|
585ae28dd2 | ||
|
|
4abac92891 | ||
|
|
a813be7d54 | ||
|
|
e77957bc81 | ||
|
|
9b6f26c191 | ||
|
|
385cc3f497 | ||
|
|
c0db39594b | ||
|
|
add4cf4232 | ||
|
|
586d613a27 | ||
|
|
45334064b6 | ||
|
|
ca84a1a10e | ||
|
|
14008703f6 | ||
|
|
58edfbc485 | ||
|
|
fa555c1f09 | ||
|
|
75210b1ff6 | ||
|
|
b278751834 | ||
|
|
3b192ca490 | ||
|
|
12dd225db2 | ||
|
|
56d5f08128 | ||
|
|
256284d76f | ||
|
|
cf5ebd128c | ||
|
|
5b597028fe | ||
|
|
012d1fa8bd | ||
|
|
1b426b67e7 | ||
|
|
8d50049db7 | ||
|
|
cba9fb1a07 | ||
|
|
932fc8e3c7 | ||
|
|
5884cf88d3 | ||
|
|
d2157fa28c | ||
|
|
6e43f9bdd0 | ||
|
|
d9ed654f04 | ||
|
|
8090db2e75 | ||
|
|
652a946e09 | ||
|
|
d6d90f03a0 | ||
|
|
d7b3c7b681 | ||
|
|
c158771f59 | ||
|
|
63c4b2748c | ||
|
|
9bc3d6d315 | ||
|
|
1a59389261 | ||
|
|
221a9bab54 | ||
|
|
102fb8ec40 | ||
|
|
db89c4236a | ||
|
|
b1048556c6 | ||
|
|
11194f339d | ||
|
|
c95e847890 | ||
|
|
4daa7c23a0 | ||
|
|
3e8e751dc7 | ||
|
|
239474b01e | ||
|
|
12b579bc34 | ||
|
|
6d614e028a | ||
|
|
a234888d44 | ||
|
|
5e0a0765ce | ||
|
|
3af742f103 | ||
|
|
9452a389a5 | ||
|
|
766ef84af4 | ||
|
|
5b8d504817 | ||
|
|
61fe9fd1fe | ||
|
|
33ba1f25f3 | ||
|
|
2106eef4b2 | ||
|
|
23998ef720 | ||
|
|
1332381e2d | ||
|
|
7f98998765 | ||
|
|
5aef09ce5d | ||
|
|
69e15e9c7b | ||
|
|
9e1170fc56 | ||
|
|
5a36a26dd1 | ||
|
|
a92b310e0e | ||
|
|
b40344f1f0 | ||
|
|
36b32cad0f | ||
|
|
7b127c23f5 | ||
|
|
9acedb3408 | ||
|
|
5f54582692 | ||
|
|
63d8794902 | ||
|
|
ede9e5095d | ||
|
|
abd9778ef3 | ||
|
|
299e3fe957 | ||
|
|
3e7e251828 | ||
|
|
f2120672d0 | ||
|
|
d3ab2023ae | ||
|
|
cdcd139171 | ||
|
|
88e1780c68 | ||
|
|
68e10d7b53 | ||
|
|
378b655cd2 | ||
|
|
b7fa48a1eb | ||
|
|
eb652d53ac | ||
|
|
c53985c0bc | ||
|
|
f60c398f32 | ||
|
|
bb387cfe4b | ||
|
|
341e440c07 | ||
|
|
e6b9b67825 | ||
|
|
9c6183e6a0 | ||
|
|
2aaa6c6e04 | ||
|
|
80a5c53cb2 | ||
|
|
e4a71afe63 | ||
|
|
23ea7ecbcc | ||
|
|
5cdb35f508 | ||
|
|
03668116d7 | ||
|
|
f3d8a2bcb0 | ||
|
|
09ae961221 | ||
|
|
d015e97eae | ||
|
|
b4aecfbf23 | ||
|
|
df7f8259a1 | ||
|
|
fff71e449e | ||
|
|
d4003f9527 | ||
|
|
9acd2f5d22 | ||
|
|
d30605c09f | ||
|
|
9ff6d44178 | ||
|
|
90b163dc1d | ||
|
|
2d97126baf | ||
|
|
3f3160e220 | ||
|
|
065811cc46 | ||
|
|
e69956c9ea | ||
|
|
e96271a8a9 | ||
|
|
f0c9aa1585 | ||
|
|
ce269f8c6d | ||
|
|
4515d3e3cb | ||
|
|
c80da05e94 | ||
|
|
bef873e1f8 | ||
|
|
a5e3a74e93 | ||
|
|
d9290f2e03 | ||
|
|
98ffbaf87a | ||
|
|
1e1c0a9aa3 | ||
|
|
9979d4feb7 | ||
|
|
5f2d346b9b | ||
|
|
64a96b26ad | ||
|
|
0db1a7743d | ||
|
|
a641488b98 | ||
|
|
371cfc1cce | ||
|
|
46b0590e4e | ||
|
|
95393cde72 | ||
|
|
ea6846e2f9 | ||
|
|
9b22149509 | ||
|
|
ce1fc386a2 | ||
|
|
77bebe3000 | ||
|
|
9292d81052 | ||
|
|
e1985eeb4f | ||
|
|
53768c84d6 | ||
|
|
3c2840f7d1 | ||
|
|
32f6f359a4 | ||
|
|
0428de6285 | ||
|
|
92f0bf54f1 | ||
|
|
8fcfde1e42 | ||
|
|
e0dfc4c0b4 | ||
|
|
80a806aaad | ||
|
|
762d57fd88 | ||
|
|
732cb925e5 | ||
|
|
f59a3ca417 | ||
|
|
deb7591d1e | ||
|
|
82c54b1b54 | ||
|
|
8d942bcc86 | ||
|
|
c39d42cc62 | ||
|
|
51a45d745e | ||
|
|
544fc63b6b | ||
|
|
e06518c594 | ||
|
|
012a193685 | ||
|
|
dc2ab714f6 | ||
|
|
4c6fd79f07 | ||
|
|
293b42b9d4 | ||
|
|
88ab42cc15 | ||
|
|
7429a6bc8a | ||
|
|
89ca0dec5e | ||
|
|
9045657352 | ||
|
|
3984a58025 | ||
|
|
237d6f8689 | ||
|
|
79a7b7b1a3 | ||
|
|
b81345f063 | ||
|
|
87340ceca8 | ||
|
|
7a58813254 | ||
|
|
3d9c482eae | ||
|
|
5d97a293fe | ||
|
|
3c8ce640c4 | ||
|
|
efafd7c01c | ||
|
|
fb165dfec1 | ||
|
|
248c8a745c | ||
|
|
7c47bfd0db | ||
|
|
e96ea719d5 | ||
|
|
17cf4bf402 | ||
|
|
04c17995a2 | ||
|
|
4994a7ef6f | ||
|
|
e3d9ac4840 | ||
|
|
0c69f7649c | ||
|
|
84a3f6883d | ||
|
|
8f8c8e6614 | ||
|
|
1b4f997951 | ||
|
|
6e6185dba2 | ||
|
|
1f134fdb72 | ||
|
|
64b001a505 | ||
|
|
5f4d81866f | ||
|
|
19303f7bd7 | ||
|
|
a967caa91f | ||
|
|
3ce16227ba | ||
|
|
3e7351cb33 | ||
|
|
4021d7bf5c | ||
|
|
68472f90eb | ||
|
|
7ad658ee3a | ||
|
|
0ee5ff3aad | ||
|
|
9a0da3cd4f | ||
|
|
e3b547c8a9 | ||
|
|
e602ca1d66 | ||
|
|
01e2ea24da | ||
|
|
f5783ae1df | ||
|
|
49445f0663 | ||
|
|
27da2e10ff | ||
|
|
7d0e45b507 | ||
|
|
9b40d91a9b | ||
|
|
02c68c3a70 | ||
|
|
a0d09c9954 | ||
|
|
c7e3eae9dd | ||
|
|
70cc52e203 | ||
|
|
51849c6140 | ||
|
|
fe07c48431 | ||
|
|
d8f20f3642 | ||
|
|
828def3b25 | ||
|
|
97228a4249 | ||
|
|
3e3aff040e | ||
|
|
adc718f4d5 | ||
|
|
22c148a39e | ||
|
|
70cddcb9ca | ||
|
|
2b90790071 | ||
|
|
070272489d | ||
|
|
538d8a6fb4 | ||
|
|
c8be38e75d | ||
|
|
303a88730c | ||
|
|
26a1ba543f | ||
|
|
2e2a716710 | ||
|
|
4c7e19adeb | ||
|
|
59f053b1db | ||
|
|
dce35f453d | ||
|
|
3a416636f1 | ||
|
|
bbd033c254 | ||
|
|
22dc5b7416 | ||
|
|
40c73719c0 | ||
|
|
022792709d | ||
|
|
b9ec7ac886 | ||
|
|
32eb42a92f | ||
|
|
5d8b770e6c | ||
|
|
0fe18ae6dc | ||
|
|
d0dbd185ad | ||
|
|
e11a08064d | ||
|
|
e424112020 | ||
|
|
4a56dfcd00 | ||
|
|
6a8cd7090a | ||
|
|
c57d8995c6 | ||
|
|
37435365e2 | ||
|
|
94fc0febc7 | ||
|
|
6f58ef2394 | ||
|
|
177f8ed653 | ||
|
|
d4efb55492 | ||
|
|
ef270eb642 | ||
|
|
d1af73bfcb | ||
|
|
a3a0db447b | ||
|
|
3589537147 | ||
|
|
26b8a1fe1d | ||
|
|
609235b4f1 | ||
|
|
b3ad557dd2 | ||
|
|
9c7c279a5b | ||
|
|
f376d5d59c | ||
|
|
2493659b23 | ||
|
|
e1efacb399 | ||
|
|
05d793c34b | ||
|
|
86867dcbe3 | ||
|
|
c8eac04e9b | ||
|
|
d96dcfba59 | ||
|
|
690a317f4f | ||
|
|
9c4a0d2397 | ||
|
|
a2cba95a3a | ||
|
|
fd962869e6 | ||
|
|
7663da80c3 | ||
|
|
103077b686 | ||
|
|
fbef500fb3 | ||
|
|
37ee9752e1 | ||
|
|
a6572dd042 | ||
|
|
8a99d64139 | ||
|
|
1c0262a8c4 | ||
|
|
ee67d350e3 | ||
|
|
60e3a78221 | ||
|
|
b2105a113c | ||
|
|
c293a7a26d | ||
|
|
4dae13d7bc | ||
|
|
5140bb8d7f | ||
|
|
320a3b0834 | ||
|
|
79405c7cc9 | ||
|
|
99fa5d0252 | ||
|
|
b584e89d90 | ||
|
|
7f1491f884 | ||
|
|
9fbb8a8201 | ||
|
|
4aa5778606 | ||
|
|
338b404055 | ||
|
|
500ff629bf | ||
|
|
033a947631 | ||
|
|
c08c35df69 | ||
|
|
cefe42fd66 | ||
|
|
e0cd5edddb | ||
|
|
ebd1da2730 | ||
|
|
4bbcd5daef | ||
|
|
8d88ecb951 | ||
|
|
b5e1382232 | ||
|
|
8f5c72c510 | ||
|
|
c52453faa3 | ||
|
|
8c9aa2588c | ||
|
|
d03d29f6f5 | ||
|
|
77f8da275a | ||
|
|
0c6c0003b1 | ||
|
|
1c49d76fb7 | ||
|
|
714084bf5b | ||
|
|
2efdf56317 | ||
|
|
7fc09da482 | ||
|
|
d315a838bd | ||
|
|
6879c1f097 | ||
|
|
25860f6263 | ||
|
|
c52d4b7998 | ||
|
|
0c62967d8a | ||
|
|
f34db62940 | ||
|
|
b0ed8a5ba3 | ||
|
|
95ff769020 | ||
|
|
9b158f5926 | ||
|
|
29c2169012 | ||
|
|
56ef16b0f9 | ||
|
|
eeda097603 | ||
|
|
77e296ffef | ||
|
|
72d5dfed34 | ||
|
|
7f8caf1634 | ||
|
|
1871f39b2b | ||
|
|
6eae7acd34 | ||
|
|
36a5247181 | ||
|
|
153b8cbcc3 | ||
|
|
44a8ede94d | ||
|
|
529bb53d52 | ||
|
|
b35415637b | ||
|
|
35e42a2295 | ||
|
|
dbabb861f2 | ||
|
|
224bf07930 | ||
|
|
870ae030ca | ||
|
|
9ba39f65b3 | ||
|
|
3d8fe065b5 | ||
|
|
513381a322 | ||
|
|
c36f415793 | ||
|
|
3617e8e7a1 | ||
|
|
65cf77c32b | ||
|
|
e0ce5640d1 | ||
|
|
e7f369a765 | ||
|
|
58429bbc79 | ||
|
|
5fc39662ec | ||
|
|
4c73f026b2 | ||
|
|
932ad73441 | ||
|
|
bf0d694c71 | ||
|
|
a2e689aba3 | ||
|
|
c82eb39d54 | ||
|
|
a00256a61c | ||
|
|
842a15ee45 | ||
|
|
e7785c9ccb | ||
|
|
2b521ee201 | ||
|
|
ce27aad67b | ||
|
|
6784b9062e | ||
|
|
f23ecc6895 | ||
|
|
ae6b460f35 | ||
|
|
1ca28badad |
+20
-17
@@ -1,32 +1,35 @@
|
|||||||
task:
|
|
||||||
name: freebsd-10-amd64
|
|
||||||
freebsd_instance:
|
|
||||||
image_family: freebsd-10-4
|
|
||||||
setup_script:
|
|
||||||
- pkg install -y git sdl2 python
|
|
||||||
- git submodule update --init --recursive
|
|
||||||
test_script:
|
|
||||||
# - ./scripts/build_freebsd_engine.sh dedicated
|
|
||||||
- ./scripts/build_freebsd_engine.sh
|
|
||||||
|
|
||||||
task:
|
task:
|
||||||
name: freebsd-11-amd64
|
name: freebsd-11-amd64
|
||||||
freebsd_instance:
|
freebsd_instance:
|
||||||
image_family: freebsd-11-3
|
image_family: freebsd-11-4
|
||||||
setup_script:
|
setup_script:
|
||||||
|
- pkg update
|
||||||
- pkg install -y git sdl2 python
|
- pkg install -y git sdl2 python
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
test_script:
|
test_script:
|
||||||
# - ./scripts/build_freebsd_engine.sh dedicated
|
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||||
- ./scripts/build_freebsd_engine.sh
|
- ./scripts/cirrus/build_freebsd.sh full
|
||||||
|
|
||||||
task:
|
task:
|
||||||
name: freebsd-12-amd64
|
name: freebsd-12-amd64
|
||||||
freebsd_instance:
|
freebsd_instance:
|
||||||
image_family: freebsd-12-0
|
image_family: freebsd-12-2
|
||||||
setup_script:
|
setup_script:
|
||||||
|
- pkg update
|
||||||
- pkg install -y git sdl2 python
|
- pkg install -y git sdl2 python
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
test_script:
|
test_script:
|
||||||
# - ./scripts/build_freebsd_engine.sh dedicated
|
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||||
- ./scripts/build_freebsd_engine.sh
|
- ./scripts/cirrus/build_freebsd.sh full
|
||||||
|
|
||||||
|
task:
|
||||||
|
name: freebsd-13-amd64
|
||||||
|
freebsd_instance:
|
||||||
|
image_family: freebsd-13-0-snap
|
||||||
|
setup_script:
|
||||||
|
- pkg update
|
||||||
|
- pkg install -y git sdl2 python
|
||||||
|
- git submodule update --init --recursive
|
||||||
|
test_script:
|
||||||
|
- ./scripts/cirrus/build_freebsd.sh dedicated
|
||||||
|
- ./scripts/cirrus/build_freebsd.sh full
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
*.c text eol=lf diff=cpp
|
||||||
|
*.h text eol=lf diff=cpp
|
||||||
|
wscript text eol=lf diff=python
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
name: Build & Deploy Engine
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
continue-on-error: true
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-18.04
|
||||||
|
targetos: linux
|
||||||
|
targetarch: amd64
|
||||||
|
- os: ubuntu-18.04
|
||||||
|
targetos: linux
|
||||||
|
targetarch: i386
|
||||||
|
|
||||||
|
- os: ubuntu-18.04
|
||||||
|
targetos: android
|
||||||
|
targetarch: 32
|
||||||
|
- os: ubuntu-18.04
|
||||||
|
targetos: android
|
||||||
|
targetarch: 64
|
||||||
|
|
||||||
|
- os: ubuntu-18.04
|
||||||
|
targetos: motomagx
|
||||||
|
targetarch: armv6
|
||||||
|
|
||||||
|
- os: windows-latest
|
||||||
|
targetos: win32
|
||||||
|
targetarch: amd64
|
||||||
|
- os: windows-latest
|
||||||
|
targetos: win32
|
||||||
|
targetarch: i386
|
||||||
|
env:
|
||||||
|
SDL_VERSION: 2.0.14
|
||||||
|
GH_CPU_ARCH: ${{ matrix.targetarch }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
ANDROID_SDK_TOOLS_VER: 4333796
|
||||||
|
ANDROID_NDK_VER: r10e
|
||||||
|
UPLOADTOOL_ISPRERELEASE: true
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
- name: Checkout xash-extras
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: FWGS/xash-extras
|
||||||
|
path: xash-extras
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: bash scripts/gha/deps_${{ matrix.targetos }}.sh
|
||||||
|
|
||||||
|
- name: Build engine
|
||||||
|
run: bash scripts/gha/build_${{ matrix.targetos }}.sh
|
||||||
|
|
||||||
|
- name: Upload engine (android)
|
||||||
|
if: matrix.targetos == 'android'
|
||||||
|
run: bash scripts/continious_upload.sh xashdroid-${{ matrix.targetarch }}.apk
|
||||||
|
- name: Upload engine (motomagx)
|
||||||
|
if: matrix.targetos == 'motomagx'
|
||||||
|
run: bash scripts/continious_upload.sh xash3d-fwgs-magx.7z
|
||||||
|
- name: Upload engine (linux)
|
||||||
|
if: matrix.targetos == 'linux'
|
||||||
|
run: bash scripts/continious_upload.sh xash3d-fwgs-${{ matrix.targetarch }}.AppImage xashds-linux-${{ matrix.targetarch }}
|
||||||
|
- name: Upload engine (windows)
|
||||||
|
if: matrix.targetos == 'win32'
|
||||||
|
run: bash scripts/continious_upload.sh xash3d-fwgs-win32-${{ matrix.targetarch }}.7z
|
||||||
+8
-3
@@ -314,9 +314,8 @@ build-*
|
|||||||
|
|
||||||
# Waf
|
# Waf
|
||||||
build_current
|
build_current
|
||||||
.waf-*
|
*waf-*/
|
||||||
waf-*/
|
*waf3-*/
|
||||||
waf3-*/
|
|
||||||
.lock-waf*
|
.lock-waf*
|
||||||
*.lastbuildstate
|
*.lastbuildstate
|
||||||
*.unsuccessfulbuild
|
*.unsuccessfulbuild
|
||||||
@@ -327,3 +326,9 @@ __pycache__
|
|||||||
*.vcproj
|
*.vcproj
|
||||||
*.sln
|
*.sln
|
||||||
*.vcxproj
|
*.vcxproj
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/*
|
||||||
|
*.code-workspace
|
||||||
|
.history/*
|
||||||
|
.cache/*
|
||||||
@@ -10,3 +10,6 @@
|
|||||||
[submodule "vgui-dev"]
|
[submodule "vgui-dev"]
|
||||||
path = vgui-dev
|
path = vgui-dev
|
||||||
url = https://github.com/FWGS/vgui-dev
|
url = https://github.com/FWGS/vgui-dev
|
||||||
|
[submodule "ref_gl/gl4es"]
|
||||||
|
path = ref_gl/gl4es
|
||||||
|
url = https://github.com/ptitSeb/gl4es
|
||||||
|
|||||||
+26
-204
@@ -3,211 +3,33 @@ compiler: gcc
|
|||||||
sudo: false
|
sudo: false
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- SDL_VERSION=2.0.8
|
- SDL_VERSION=2.0.14
|
||||||
- DEPLOY_BRANCH=anewengine
|
|
||||||
git:
|
git:
|
||||||
depth: 50
|
depth: 50
|
||||||
submodules: true
|
submodules: true
|
||||||
jdk:
|
|
||||||
- oraclejdk8
|
|
||||||
|
|
||||||
jobs:
|
os: linux
|
||||||
include:
|
arch:
|
||||||
- stage: init
|
- aarch64
|
||||||
name: "Initialize webdav cache"
|
- ppc64le
|
||||||
os: linux
|
- s390x
|
||||||
cache: false
|
addons:
|
||||||
script:
|
apt:
|
||||||
- sh scripts/yadisk_clear.sh
|
update: true
|
||||||
- stage: build
|
packages:
|
||||||
name: "Build for Windows MSVC"
|
- libx11-dev
|
||||||
cache: ccache
|
- libxext-dev
|
||||||
os: windows
|
- x11-utils
|
||||||
before_script:
|
- libgl1-mesa-dev
|
||||||
- sh scripts/travis_common_deps.sh
|
- libasound-dev
|
||||||
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
- libstdc++6
|
||||||
script:
|
- libfuse2
|
||||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
|
- unzip
|
||||||
after_script:
|
before_script:
|
||||||
- sh scripts/continious_upload.sh xash3d-vc.7z xash3d-vc2008-sln.7z
|
- sh scripts/travis/deps_common.sh
|
||||||
- # ...
|
- sh scripts/travis/deps_${TRAVIS_OS_NAME}.sh
|
||||||
name: "Build for Linux i686"
|
script:
|
||||||
cache: ccache
|
- sh scripts/travis/build_${TRAVIS_OS_NAME}.sh
|
||||||
os: linux
|
after_script:
|
||||||
dist: xenial
|
- ccache --show-stats
|
||||||
addons:
|
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.tar.xz xashds-linux-${ARCH}
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- gcc-multilib
|
|
||||||
- g++-multilib
|
|
||||||
- libx11-dev:i386
|
|
||||||
- libxext-dev:i386
|
|
||||||
- x11-utils
|
|
||||||
- libgl1-mesa-dev
|
|
||||||
- libasound-dev
|
|
||||||
- libstdc++6:i386
|
|
||||||
- libfuse2:i386
|
|
||||||
- zlib1g:i386
|
|
||||||
- unzip
|
|
||||||
before_script:
|
|
||||||
- export ARCH=i686
|
|
||||||
- sh scripts/travis_common_deps.sh
|
|
||||||
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
|
||||||
script:
|
|
||||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
|
|
||||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
|
|
||||||
after_script:
|
|
||||||
- ccache --show-stats
|
|
||||||
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
|
|
||||||
- # ...
|
|
||||||
name: "Build for Android"
|
|
||||||
cache: ccache
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
language: java # we want xenial, so just java, not android
|
|
||||||
jdk: openjdk8
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-9
|
|
||||||
- lld-9
|
|
||||||
- p7zip-full
|
|
||||||
sources:
|
|
||||||
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
|
|
||||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
|
||||||
before_script:
|
|
||||||
- export ANDROID_HOME=$TRAVIS_BUILD_DIR/sdk
|
|
||||||
- sh scripts/travis_common_deps.sh
|
|
||||||
- sh scripts/travis_android_deps.sh r10e
|
|
||||||
- export ANDROID_SDK_HOME=$ANDROID_HOME
|
|
||||||
- export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
|
|
||||||
script:
|
|
||||||
- cd android
|
|
||||||
- export ARCHS="armeabi armeabi-v7a x86"
|
|
||||||
- export TOOLCHAIN="host"
|
|
||||||
- sh compile.sh release
|
|
||||||
after_script:
|
|
||||||
- ccache --show-stats
|
|
||||||
- sh ../scripts/continious_upload.sh xashdroid.apk
|
|
||||||
- # ...
|
|
||||||
name: "Build for Android 64"
|
|
||||||
cache: ccache
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
language: java # we want xenial, so just java, not android
|
|
||||||
jdk: openjdk8
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-9
|
|
||||||
- lld-9
|
|
||||||
- p7zip-full
|
|
||||||
sources:
|
|
||||||
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
|
|
||||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
|
||||||
before_script:
|
|
||||||
- export ANDROID_HOME=$TRAVIS_BUILD_DIR/sdk
|
|
||||||
- sh scripts/travis_common_deps.sh
|
|
||||||
- sh scripts/travis_android_deps.sh r10e
|
|
||||||
- export ANDROID_SDK_HOME=$ANDROID_HOME
|
|
||||||
- export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
|
|
||||||
script:
|
|
||||||
- cd android
|
|
||||||
- export ARCHS="aarch64 x86_64"
|
|
||||||
- export API=21
|
|
||||||
- export TOOLCHAIN="host"
|
|
||||||
- sh compile.sh release
|
|
||||||
after_script:
|
|
||||||
- ccache --show-stats
|
|
||||||
- mv xashdroid.apk xashdroid-64-test.apk
|
|
||||||
- sh ../scripts/continious_upload.sh xashdroid-64-test.apk
|
|
||||||
- # ...
|
|
||||||
name: "Build for Linux amd64"
|
|
||||||
cache: ccache
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- libx11-dev
|
|
||||||
- libxext-dev
|
|
||||||
- x11-utils
|
|
||||||
- libgl1-mesa-dev
|
|
||||||
- libasound-dev
|
|
||||||
- libstdc++6
|
|
||||||
- libfuse2
|
|
||||||
- unzip
|
|
||||||
before_script:
|
|
||||||
- export ARCH=x86_64
|
|
||||||
- sh scripts/travis_common_deps.sh
|
|
||||||
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
|
||||||
script:
|
|
||||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
|
|
||||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
|
|
||||||
after_script:
|
|
||||||
- ccache --show-stats
|
|
||||||
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
|
|
||||||
# - # ...
|
|
||||||
# name: "Build for Windows MinGW"
|
|
||||||
# cache: ccache
|
|
||||||
# os: linux
|
|
||||||
# dist: xenial
|
|
||||||
# addons:
|
|
||||||
# apt:
|
|
||||||
# packages:
|
|
||||||
# - mingw-w64-i686-dev
|
|
||||||
# - binutils-mingw-w64-i686
|
|
||||||
# - gcc-mingw-w64-i686
|
|
||||||
# - g++-mingw-w64-i686
|
|
||||||
# - p7zip-full
|
|
||||||
# before_script:
|
|
||||||
# - sh scripts/travis_common_deps.sh
|
|
||||||
# - sh scripts/travis_mingw_deps.sh
|
|
||||||
# script:
|
|
||||||
# - sh scripts/build_mingw_engine.sh
|
|
||||||
# after_script:
|
|
||||||
# - ccache --show-stats
|
|
||||||
# - sh scripts/continious_upload.sh xash3d-mingw.7z
|
|
||||||
# - # ...
|
|
||||||
# name: "Build for OSX"
|
|
||||||
# cache: ccache
|
|
||||||
# os: osx
|
|
||||||
# before_script:
|
|
||||||
# - sh scripts/travis_common_deps.sh
|
|
||||||
# - sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
|
||||||
# script:
|
|
||||||
# - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
|
|
||||||
# after_script:
|
|
||||||
# - sh scripts/continious_upload.sh xash3d-osx.tar.bz2
|
|
||||||
- # ...
|
|
||||||
name: "Build for MotoMAGX"
|
|
||||||
sudo: true
|
|
||||||
cache: ccache
|
|
||||||
os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- libc6:i386
|
|
||||||
- libstdc++6:i386
|
|
||||||
- gcc-multilib
|
|
||||||
- g++-multilib
|
|
||||||
- p7zip-full
|
|
||||||
sources:
|
|
||||||
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
|
|
||||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
|
||||||
before_script:
|
|
||||||
- sh scripts/travis_common_deps.sh
|
|
||||||
- sh scripts/travis_motomagx_deps.sh
|
|
||||||
script:
|
|
||||||
- sh scripts/build_motomagx_engine.sh
|
|
||||||
after_script:
|
|
||||||
- cd $TRAVIS_BUILD_DIR
|
|
||||||
- ccache --show-stats
|
|
||||||
- sh scripts/continious_upload.sh xash3d-magx.7z
|
|
||||||
- stage: deploy
|
|
||||||
name: "Deploy to github repo"
|
|
||||||
os: linux
|
|
||||||
cache: false
|
|
||||||
script:
|
|
||||||
- sh scripts/travis-deploy.sh xash3d-fwgs-i686.AppImage xash3d-fwgs-x86_64.AppImage xash3d-vc.7z xash3d-vc2008-sln.7z xashdroid.apk xashdroid-64-test.apk xashds-linux-i686 xashds-linux-x86_64 xash3d-magx.7z
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# Not supported mods and reasons why
|
||||||
|
|
||||||
|
|Name |Version |Why not working |What was made for that
|
||||||
|
|---- |------- |--------------- |----------------------
|
||||||
|
|Blue Shift |The latest steam release |Uses vgui2 library which xash3d does not support |Recreated source code here: https://github.com/FWGS/hlsdk-xash3d/tree/bshift
|
||||||
|
|Counter Strike |1.6(The latest steam release) |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||||
|
|Counter Strike: Condition Zero |The latest steam release |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||||
|
|Counter Strike: Condition Zero - Deleted scenes |The latest steam release |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||||
|
|Day of Defeat |The latest steam release |Uses vgui2 library which xash3d does not support |Some work on vgui2 support was made here: https://github.com/FWGS/xash3d/tree/vinterface
|
||||||
|
|Sven-Coop |5.0+ |Uses filesystem_stdio library which xash3d does not support |filesystem_stdio replacement already was made: https://github.com/FWGS/filesystem_stdio_xash
|
||||||
|
|XDM |3.0.4.0 | |
|
||||||
|
|
||||||
@@ -0,0 +1,321 @@
|
|||||||
|
Source code of this mods is available for modders and porters in public access.
|
||||||
|
|
||||||
|
# Original Work
|
||||||
|
## Absolute Zero
|
||||||
|
Official gitlab repository - https://gitlab.com/Cobalt-57/half-life-absolute-zero/
|
||||||
|
|
||||||
|
## Adrenaline Gamer
|
||||||
|
Official github repository by Martin \"Bullet\" Webrant - https://github.com/martinwebrant/agmod
|
||||||
|
|
||||||
|
## Arrangement
|
||||||
|
Mirrored on github - https://github.com/JoelTroch/am_src_30jan2011
|
||||||
|
|
||||||
|
## Arrangemode: Rebirth
|
||||||
|
Mirrored on github - https://github.com/JoelTroch/am_src_rebirth
|
||||||
|
|
||||||
|
## Battle Grounds
|
||||||
|
Mirrored on github - https://github.com/nekonomicon/BattleGrounds
|
||||||
|
|
||||||
|
## Bubblemod
|
||||||
|
Download page on official site - http://www.bubblemod.org/dl_default.php
|
||||||
|
|
||||||
|
## Chicken Fortress
|
||||||
|
Official github repository - https://github.com/CKFDevPowered/CKF3Alpha
|
||||||
|
|
||||||
|
## Cold Ice
|
||||||
|
Version 1.9 is available on ModDB - https://www.moddb.com/mods/cold-ice/downloads/cold-ice-sdk
|
||||||
|
|
||||||
|
## Cthulhu
|
||||||
|
Uploaded to github by Oleg Cherkasky - https://github.com/gunrunners-paradise/Cthulhu-HLmod-SDK
|
||||||
|
|
||||||
|
## Deathmatch Classic
|
||||||
|
Available in Valve's Half-Life repository - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
||||||
|
|
||||||
|
## ESHQ
|
||||||
|
Official github repository - https://github.com/adslbarxatov/xash3d-for-ESHQ
|
||||||
|
|
||||||
|
## Flat-Life
|
||||||
|
Available on GamerLab - http://gamer-lab.com/eng/code_mods_goldsrc/Half-Life_2D_(Flat-Life)
|
||||||
|
|
||||||
|
## Gang Wars
|
||||||
|
Mirrored on github - https://github.com/hammermaps/gw1.45src
|
||||||
|
|
||||||
|
## Go-mod
|
||||||
|
Versions 2.0 and 3.0, available in mod archives on ModDB - https://www.moddb.com/mods/go-mod/downloads
|
||||||
|
|
||||||
|
## GT mod
|
||||||
|
Available on GamerLab - http://gamer-lab.com/eng/code_mods_goldsrc/GT_mod_(Polnie_ishodniki)
|
||||||
|
|
||||||
|
## Half-Life: Echoes
|
||||||
|
Download link on dropbox - https://www.dropbox.com/s/s6j8gtegn10wgvj/dlls.zip?dl=1
|
||||||
|
|
||||||
|
## Half-Life: Expanded Arsenal
|
||||||
|
Available on ModDB - https://www.moddb.com/mods/half-life-expanded-arsenal
|
||||||
|
|
||||||
|
## Half-Life: Gravgun mod
|
||||||
|
Branch **gravgun** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/gravgun
|
||||||
|
|
||||||
|
## Half-Life: Invasion
|
||||||
|
official github repository - https://github.com/jlecorre/hlinvasion
|
||||||
|
|
||||||
|
## Half-Life: Quest Mode
|
||||||
|
Available on cs-mapping.com.ua - https://old.cs-mapping.com.ua/forum/showthread.php?t=38030
|
||||||
|
|
||||||
|
## Half-Life: Top-Down
|
||||||
|
Official gitlab repository - https://gitlab.com/Sockman/hltopdown
|
||||||
|
|
||||||
|
## Half-Life: Update
|
||||||
|
Official github repository - https://github.com/Fograin/hl-subsmod-ex
|
||||||
|
|
||||||
|
## Half-Life: Weapon Edition
|
||||||
|
Available on ModDB - https://www.moddb.com/mods/half-life-weapon-edition/downloads/half-life-weapon-edition-1508-alpha-open-src
|
||||||
|
|
||||||
|
## Half-Life: Year of the Dragon
|
||||||
|
Available on ModDB - https://www.moddb.com/mods/year-of-the-dragon
|
||||||
|
|
||||||
|
## Half-Nuked
|
||||||
|
Available on ModDB - https://www.moddb.com/mods/half-nuked/downloads/half-nuked-src
|
||||||
|
|
||||||
|
## Half-Payne
|
||||||
|
Official github repository - https://github.com/suXinjke/HalfPayne
|
||||||
|
|
||||||
|
## Half-Quake
|
||||||
|
Official github repository - https://github.com/muddasheep/hqtrilogy
|
||||||
|
|
||||||
|
## Half-Rats: Parasomnia
|
||||||
|
Official github repository - https://github.com/HeathGames/half_rats_parasomnia_src
|
||||||
|
|
||||||
|
## Half-Screwed
|
||||||
|
Official github repository - https://github.com/desukuran/half-screwed
|
||||||
|
|
||||||
|
## Headcrab Frenzy
|
||||||
|
Version 1.3 on ModDB - https://www.moddb.com/mods/headcrab-frenzy/downloads/headcrab-frenzy-13-beta-source-code
|
||||||
|
|
||||||
|
## Heart of Evil
|
||||||
|
Available on ModDB - https://www.moddb.com/mods/heart-of-evil/downloads/heart-of-evil-dlls-source-code
|
||||||
|
|
||||||
|
## Ingram Chillin' Mod
|
||||||
|
Official SourceForge repository - https://sourceforge.net/projects/icm-hl/
|
||||||
|
|
||||||
|
## MechMod
|
||||||
|
Official github repository - https://github.com/vermagav/mechmod
|
||||||
|
|
||||||
|
## Mortal Combat Forever
|
||||||
|
Available on GamerLab - http://gamer-lab.com/eng/code_mods_goldsrc/Mortal_Combat_Forever_(Polnie_ishodniki)
|
||||||
|
|
||||||
|
## Natural Selection
|
||||||
|
Official github repository - https://github.com/unknownworlds/NS
|
||||||
|
|
||||||
|
## Overturn
|
||||||
|
Available in mod archive on ModDB - https://www.moddb.com/mods/overturn
|
||||||
|
|
||||||
|
## Spirit of Half-Life
|
||||||
|
[Logic&Trick's](https://github.com/LogicAndTrick) mirror - https://files.logic-and-trick.com/#/Half-Life/Mods/Spirit%20of%20Half-Life
|
||||||
|
|
||||||
|
## Threewave CTF
|
||||||
|
*Unfinished mod by Valve Software*
|
||||||
|
|
||||||
|
Available in Valve's Half-Life repository with Deathmatch Classic sources - https://github.com/ValveSoftware/halflife/tree/master/dmc
|
||||||
|
|
||||||
|
## Trinity Render
|
||||||
|
Available on ModDB: https://www.moddb.com/mods/half-life-episode-two/downloads/trinity-rendering-engine-v308f
|
||||||
|
|
||||||
|
## Tyrian: Ground Assault
|
||||||
|
Available on ModDB: https://www.moddb.com/mods/tyriangroundassault/downloads/tyrianga-v1-0-src
|
||||||
|
|
||||||
|
## Paranoia
|
||||||
|
Available on ModDB: https://www.moddb.com/mods/paranoia/downloads/paranoia-toolkit
|
||||||
|
|
||||||
|
## Paranoia 2: The Savior
|
||||||
|
Prealpha, mirrored on github - https://github.com/a1batross/Paranoia2_ancient
|
||||||
|
|
||||||
|
Version 1.51, mirrored on github - https://github.com/a1batross/Paranoia2_original
|
||||||
|
|
||||||
|
## Raven City
|
||||||
|
*Unfinished mod*
|
||||||
|
|
||||||
|
Was found on HLFX - http://hlfx.ru/forum/showthread.php?s=2c892dfc52f72be52a89c3f52a397cd0&threadid=1819&postid=44674#post44674
|
||||||
|
|
||||||
|
## Ricochet
|
||||||
|
Available in Valve's Half-Life repository - https://github.com/ValveSoftware/halflife/tree/master/ricochet
|
||||||
|
|
||||||
|
## Wizard Wars
|
||||||
|
Download page on official site - http://www.thothie.com/ww/
|
||||||
|
|
||||||
|
## XashXT
|
||||||
|
Mirrored on github - https://github.com/a1batross/XashXT_original
|
||||||
|
|
||||||
|
## Zombie-X
|
||||||
|
Available in mod archive on ModDB - https://www.moddb.com/mods/zombie-x-10-final/downloads/zombie-x-10-dle-beta6-last-version
|
||||||
|
|
||||||
|
## ZXC
|
||||||
|
Available on ModDB - https://www.moddb.com/mods/zxc-mod-133/downloads/zxc-mod-136-final
|
||||||
|
|
||||||
|
Mirrored on github - https://github.com/ZXCmod/ZXCmod
|
||||||
|
|
||||||
|
# Reimplementation
|
||||||
|
## Absolute Redemption
|
||||||
|
Branch **redempt** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/redempt
|
||||||
|
|
||||||
|
## Adrenaline Gamer
|
||||||
|
OpenAG by YaLTeR - https://github.com/YaLTeR/OpenAG
|
||||||
|
|
||||||
|
## Afraid of Monsters
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-aom
|
||||||
|
|
||||||
|
Branch **aom** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/aom
|
||||||
|
|
||||||
|
## Afraid of Monsters: Director's cut
|
||||||
|
Reverse-engineered code, branch **aomdc** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/aomdc
|
||||||
|
|
||||||
|
## Azure Sheep
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-asheep
|
||||||
|
|
||||||
|
Reverse-engineered code, branch **asheep** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/asheep
|
||||||
|
|
||||||
|
## Big Lolly
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-biglolly
|
||||||
|
|
||||||
|
Branch **biglolly** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/biglolly
|
||||||
|
|
||||||
|
## Black Ops
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-blackops
|
||||||
|
|
||||||
|
Branch **blackops** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/blackops
|
||||||
|
|
||||||
|
## Bloody Pizza: Vendetta
|
||||||
|
Branch **caseclosed** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/caseclosed
|
||||||
|
|
||||||
|
## Case Closed
|
||||||
|
Branch **caseclosed** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/caseclosed
|
||||||
|
|
||||||
|
## Cleaner's Adventures
|
||||||
|
Branch **CAd** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/CAd
|
||||||
|
|
||||||
|
## Counter Strike
|
||||||
|
Reverse-engineered code of client part by a1batross - https://github.com/FWGS/cs16-client/tree/v1.32
|
||||||
|
|
||||||
|
Reverse-engineered code of server part by nagist - https://github.com/nagist/cs16nd
|
||||||
|
|
||||||
|
Reverse-engineered code of server part by s1lentq - https://github.com/s1lentq/ReGameDLL_CS
|
||||||
|
|
||||||
|
## Counter Strike Online
|
||||||
|
CSO-like Xash3D-based mod, CSMoE - https://github.com/MoeMod/CSMoE
|
||||||
|
|
||||||
|
## Crack-Life: Campaign Mode
|
||||||
|
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/crack_life
|
||||||
|
|
||||||
|
## Escape from the Darkness
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-eftd
|
||||||
|
|
||||||
|
Reverse-engineered code, branch **eftd** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/eftd
|
||||||
|
|
||||||
|
## Half-Life: Blue Shift
|
||||||
|
Unkle Mike's recreation - https://hlfx.ru/forum/showthread.php?s=&threadid=5253
|
||||||
|
|
||||||
|
Reverse-engineered code, branch **bshift** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/bshift
|
||||||
|
|
||||||
|
## Half-Life: Induction
|
||||||
|
Branch **induction** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/induction
|
||||||
|
|
||||||
|
## Half-Life: Opposing Force
|
||||||
|
Recreation by lostgamer aka nillerusr - https://github.com/LostGamerHL/hlsdk-xash3d
|
||||||
|
|
||||||
|
Reverse-engineered code, clean branch **opfor** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/opfor
|
||||||
|
|
||||||
|
Spirit of Half Life: Opposing-Force Edition - https://github.com/Hammermaps-DEV/SOHL-V1.9-Opposing-Force-Edition
|
||||||
|
|
||||||
|
## Half-Life: Rebellion
|
||||||
|
Reverse-engineered code, branch **rebellion** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/rebellion
|
||||||
|
|
||||||
|
## Half-Life: Visitors
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-visitors
|
||||||
|
|
||||||
|
Reverse-engineered code, branch **visitors** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/visitors
|
||||||
|
|
||||||
|
## Half-Secret
|
||||||
|
Branch **half-secret** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/half-secret
|
||||||
|
|
||||||
|
## Night at the Office
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-noffice
|
||||||
|
|
||||||
|
Branch **noffice** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/noffice
|
||||||
|
|
||||||
|
## Poke 646
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-poke646
|
||||||
|
|
||||||
|
Reverse-engineered code, branch **poke646** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/poke646
|
||||||
|
|
||||||
|
## Poke 646: Vendetta
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-poke646
|
||||||
|
|
||||||
|
Reverse-engineered code, branch **poke646_vendetta** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/poke646_vendetta
|
||||||
|
|
||||||
|
## Residual Life
|
||||||
|
Reverse-engineered code, branch **residual_point** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/residual_point
|
||||||
|
|
||||||
|
## Residual Point
|
||||||
|
Reverse-engineered code, branch **residual_point** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/residual_point
|
||||||
|
|
||||||
|
## Team Fortress Classic
|
||||||
|
Reverse-engineered code by Velaron - https://github.com/Velaron/tf15-client
|
||||||
|
|
||||||
|
## The Gate
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-TheGate
|
||||||
|
|
||||||
|
Reverse-engineered code, branch **thegate** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/thegate
|
||||||
|
|
||||||
|
## They Hunger
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-Hunger
|
||||||
|
|
||||||
|
Reverse-engineered code, branch **theyhunger** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/theyhunger
|
||||||
|
|
||||||
|
They Hunger: Tactical - https://www.moddb.com/mods/they-hunger-tactical/downloads/tht-source-code-documentation
|
||||||
|
|
||||||
|
## Times of Troubles
|
||||||
|
malortie's recreation - https://github.com/malortie/halflife/tree/mod-hl-tot
|
||||||
|
|
||||||
|
Branch **tot** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/tot
|
||||||
|
|
||||||
|
# Derived work
|
||||||
|
## Adrenaline Gamer
|
||||||
|
Branch **aghl** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/aghl
|
||||||
|
|
||||||
|
## Bubblemod
|
||||||
|
Branch **bubblemod** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/bubblemod
|
||||||
|
|
||||||
|
## Deathmatch Classic
|
||||||
|
Deathmatch Classic: Adrenaline Gamer Edition - https://github.com/martinwebrant/agmod/tree/master/src/dmc
|
||||||
|
|
||||||
|
Deathmatch Quaked - https://www.moddb.com/games/deathmatch-classic/downloads/dmq2
|
||||||
|
|
||||||
|
Branch **dmc** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/dmc
|
||||||
|
|
||||||
|
## Half-Life: Echoes
|
||||||
|
Branch **echoes** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/echoes
|
||||||
|
|
||||||
|
## Half-Life: Invasion
|
||||||
|
Port to HLSDK 2.4 by malortie - https://github.com/malortie/halflife/tree/mod-hl-invasion
|
||||||
|
|
||||||
|
Port to Linux by fmoraw - https://github.com/fmoraw/hlinvasion
|
||||||
|
|
||||||
|
## Half-Life: Top-Down
|
||||||
|
Branch **hltopdown** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/hltopdown
|
||||||
|
|
||||||
|
## Half-Screwed
|
||||||
|
Branch **half-screwed** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/half-screwed
|
||||||
|
|
||||||
|
## Natural Selection
|
||||||
|
Port to Linux - https://github.com/fmoraw/NS
|
||||||
|
|
||||||
|
## Swiss Cheese Halloween 2002
|
||||||
|
Just more playable version by malortie - https://github.com/malortie/halflife/tree/mod-hl-halloween
|
||||||
|
|
||||||
|
Branch **halloween** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/halloween
|
||||||
|
|
||||||
|
## Threewave CTF
|
||||||
|
Branch **dmc** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/dmc
|
||||||
|
|
||||||
|
## Zombie-X
|
||||||
|
Branch **zombie-x** in hlsdk-xash3d - https://github.com/FWGS/hlsdk-xash3d/tree/zombie-x
|
||||||
|
|
||||||
+13
-11
@@ -18,19 +18,21 @@ Table is sorted by status.
|
|||||||
| Platform | Status | Maintainer | Note
|
| Platform | Status | Maintainer | Note
|
||||||
| -------- | ------ | ---------- | ----
|
| -------- | ------ | ---------- | ----
|
||||||
| Windows | Supported | @a1batross |
|
| Windows | Supported | @a1batross |
|
||||||
| Linux(x86) | Supported | @a1batross, @mittorn |
|
|
||||||
| Linux(amd64) | Supported | @mittorn |
|
|
||||||
| *BSD | Supported | @nekonomicon |
|
| *BSD | Supported | @nekonomicon |
|
||||||
| Linux(arm) | Supported | @a1batross, @mittorn |
|
| GNU/Linux(x86, amd64, arm) | Supported | @a1batross, @mittorn |
|
||||||
| Android | Supported | @a1batross, @mittorn |
|
| Android | Supported | @a1batross, @mittorn |
|
||||||
| MotoMAGX | Supported | @a1batross |
|
| MotoMAGX | Supported | @a1batross |
|
||||||
| Linux(elbrus) | In progress | @a1batross, @mittorn | Rare and eventual access to e2k machine
|
| GNU/Linux(elbrus) | Supported | @a1batross, @mittorn | Rare and eventual access to e2k machine
|
||||||
| Android/Linux(aarch64) | In progress | @a1batross |
|
| Haiku | Supported | not maintained | Was added by #478 and #483
|
||||||
| Linux(mipsel) | In progress | @mittorn |
|
| DOS4GW | Supported | @mittorn |
|
||||||
| Haiku | Incomplete, Old Engine | not maintained |
|
| GNU/Linux(mipsel) | Supported | @mittorn |
|
||||||
| Emscripten | Incomplete, Old Engine | not maintained |
|
| Switch | In progress | @fgsfdsfgs | [Github Repository](https://github.com/fgsfdsfgs/xash3d-fwgs/tree/switch_new)
|
||||||
| PSVita | Not merged, Old Engine | not maintained | [GitHub Repository](https://github.com/fgsfdsfgs/vitaXash3D)
|
| Wii | In progress | Collaborative effort | [Github Repository](https://github.com/saucesaft/xash3d-wii)
|
||||||
| Switch | Not merged, Old Engine | not maintained | [GitHub Repository](https://github.com/switchports/xash3d-switch)
|
| PSP | In progress | Collaborative effort | No sources available at this moment
|
||||||
| 3DS | Not merged, Old Engine | not maintained | [GitHub Repository](https://github.com/masterfeizz/Xash3DS)
|
| Emscripten | Old Engine | not maintained |
|
||||||
|
| Oculus Quest | Old Engine fork | @DrBeef | [GitHub Repository](https://github.com/DrBeef/Lambda1VR)
|
||||||
|
| PSVita | Old Engine fork | not maintained | [GitHub Repository](https://github.com/fgsfdsfgs/vitaXash3D)
|
||||||
|
| Switch | Old Engine fork | not maintained | [GitHub Repository](https://github.com/switchports/xash3d-switch)
|
||||||
|
| 3DS | Old Engine fork | not maintained | [GitHub Repository](https://github.com/masterfeizz/Xash3DS)
|
||||||
| macOS | Deprecated | not maintained | See GitHub issue #61
|
| macOS | Deprecated | not maintained | See GitHub issue #61
|
||||||
| iOS | Deprecated | not maintained | See GitHub issue #61
|
| iOS | Deprecated | not maintained | See GitHub issue #61
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
|||||||
89. [Gut Reaction](http://www.moddb.com/mods/gut-reaction)
|
89. [Gut Reaction](http://www.moddb.com/mods/gut-reaction)
|
||||||
90. [Half-Life C.A.G.E.D.](https://store.steampowered.com/app/679990/HalfLife_Caged/) (set **-num edicts 4096** in command-line parameters for successful start)
|
90. [Half-Life C.A.G.E.D.](https://store.steampowered.com/app/679990/HalfLife_Caged/) (set **-num edicts 4096** in command-line parameters for successful start)
|
||||||
90. [Half-Life: Dreamcast v1.1](http://www.moddb.com/mods/half-life-dreamcast)
|
90. [Half-Life: Dreamcast v1.1](http://www.moddb.com/mods/half-life-dreamcast)
|
||||||
91. [Half-Life: OPS](http://www.dcfan.net.ru/forum/f109/half-life-ops-3791/) (link dead!)
|
91. [Half-Life: OPS](https://www.runthinkshootlive.com/posts/half-life-ops/)
|
||||||
92. [Half-Life: Uplink](https://www.fileplanet.com/10360/10000/fileinfo/Half-Life:-UpLink-Demo)
|
92. [Half-Life: Uplink](https://www.fileplanet.com/10360/10000/fileinfo/Half-Life:-UpLink-Demo)
|
||||||
92. [Half-Quake](http://www.moddb.com/mods/halfquake-amen)
|
92. [Half-Quake](http://www.moddb.com/mods/halfquake-amen)
|
||||||
93. [Half-Quake 2: Amen](http://www.moddb.com/mods/halfquake-amen)
|
93. [Half-Quake 2: Amen](http://www.moddb.com/mods/halfquake-amen)
|
||||||
@@ -206,7 +206,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
|||||||
173. [Run for Life](https://www.runthinkshootlive.com/posts/run-for-life/) (the "stolen" version of this mod with changed menu background also known as *Mad Escape*)
|
173. [Run for Life](https://www.runthinkshootlive.com/posts/run-for-life/) (the "stolen" version of this mod with changed menu background also known as *Mad Escape*)
|
||||||
174. [S.W.A.T.](http://www.moddb.com/mods/swat2)
|
174. [S.W.A.T.](http://www.moddb.com/mods/swat2)
|
||||||
175. [Sabotage](https://www.runthinkshootlive.com/posts/sabotage-2/)
|
175. [Sabotage](https://www.runthinkshootlive.com/posts/sabotage-2/)
|
||||||
176. [Sagharmath](http://hl.webz.cz/hl1/eng.php?what=rec&zkratka=sa) (link dead!)
|
176. [Sagharmath](https://www.moddb.com/games/half-life/addons/sagharmath)
|
||||||
177. [Sandscroll](https://gamebanana.com/maps/15988)
|
177. [Sandscroll](https://gamebanana.com/maps/15988)
|
||||||
178. [Saving Bob](https://www.runthinkshootlive.com/posts/saving-bob/)
|
178. [Saving Bob](https://www.runthinkshootlive.com/posts/saving-bob/)
|
||||||
179. [Secret Base](https://www.runthinkshootlive.com/posts/secret-base/)
|
179. [Secret Base](https://www.runthinkshootlive.com/posts/secret-base/)
|
||||||
@@ -217,12 +217,12 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
|||||||
184. [Sky Mesa](http://www.moddb.com/mods/sky-mesa)
|
184. [Sky Mesa](http://www.moddb.com/mods/sky-mesa)
|
||||||
185. [Sleephorst v1.5](http://www.moddb.com/mods/sleephorst-v15)
|
185. [Sleephorst v1.5](http://www.moddb.com/mods/sleephorst-v15)
|
||||||
186. [Smart Decoy](http://www.moddb.com/mods/smart-decoy)
|
186. [Smart Decoy](http://www.moddb.com/mods/smart-decoy)
|
||||||
187. [Somewhere in Time](http://twhl.info/vault.php?map=5530) (link dead!)
|
187. [Somewhere in Time](https://www.runthinkshootlive.com/posts/somewhere-in-time/)
|
||||||
188. [Sooper 2](http://www.k-saz.freeserve.co.uk/projects.htm) (link dead!)
|
188. [Sooper2](https://www.runthinkshootlive.com/posts/sooper-2/)
|
||||||
189. [Split-Second](http://twhl.info/vault.php?map=4343)
|
189. [Split-Second](http://twhl.info/vault.php?map=4343)
|
||||||
190. [Subhumanity](https://www.runthinkshootlive.com/posts/sub-humanity/)
|
190. [Subhumanity](https://www.runthinkshootlive.com/posts/sub-humanity/)
|
||||||
191. [Terror Side](https://www.runthinkshootlive.com/posts/terror-side/) (set **sv_validate_changelevel** to **0** to avoid problem with level change between some maps)
|
191. [Terror Side](https://www.runthinkshootlive.com/posts/terror-side/) (set **sv_validate_changelevel** to **0** to avoid problem with level change between some maps)
|
||||||
192. [Test Your Skill](http://www.tys-mod.de.vu/&e=40455876) (link dead!)
|
192. [Test Your Skill](https://www.moddb.com/games/half-life/addons/test-your-skill)
|
||||||
193. [The Challenger Deep](https://www.runthinkshootlive.com/posts/challenger-deep/)
|
193. [The Challenger Deep](https://www.runthinkshootlive.com/posts/challenger-deep/)
|
||||||
194. [The Challenger Deep 2](http://www.moddb.com/mods/the-challenger-deep-2)
|
194. [The Challenger Deep 2](http://www.moddb.com/mods/the-challenger-deep-2)
|
||||||
195. [The Evil Thing](http://www.moddb.com/mods/the-evil-thing)
|
195. [The Evil Thing](http://www.moddb.com/mods/the-evil-thing)
|
||||||
@@ -287,7 +287,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
|||||||
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)
|
||||||
13. [Kleiners Adventures Demo](http://www.moddb.com/mods/kleiners-adventures)
|
13. [Kleiners Adventures Demo](http://www.moddb.com/mods/kleiners-adventures)
|
||||||
14. [Kleiners Adventures: The White Line Demo](https://www.gamefront.com/files/13595030/Kleiners_Adventure_siemka321_edition) (link dead!)
|
14. [Kleiners Adventures: The White Line Demo](https://www.moddb.com/mods/kleiners-adventure-siemka321-edition)
|
||||||
15. [LV-426: Episode 1](https://www.runthinkshootlive.com/posts/lv426-version-a/)
|
15. [LV-426: Episode 1](https://www.runthinkshootlive.com/posts/lv426-version-a/)
|
||||||
16. [Malevolence(1.3 and older)](http://www.moddb.com/mods/malevolence)
|
16. [Malevolence(1.3 and older)](http://www.moddb.com/mods/malevolence)
|
||||||
17. [Meth-Life Demo v1.0](https://www.gamewatcher.com/mods/half-life-mod/meth-life-mod-demo-1-0)
|
17. [Meth-Life Demo v1.0](https://www.gamewatcher.com/mods/half-life-mod/meth-life-mod-demo-1-0)
|
||||||
@@ -317,7 +317,7 @@ For mappacks - place *.bsp files to **valve/maps** folder, *.wad files to **valv
|
|||||||
41. [Zombieland v1.1](http://www.moddb.com/mods/zombieland)
|
41. [Zombieland v1.1](http://www.moddb.com/mods/zombieland)
|
||||||
|
|
||||||
## Just mappacks
|
## Just mappacks
|
||||||
1. [AvsM 1 v1.2](http://www.moddb.com/mods/avsm-2-project-xen/downloads/avsm-1-v12-full-version-croeng) (link dead!)
|
1. [AvsM 1 v1.2](https://www.moddb.com/mods/avsm-1-2003-version-re-release/)
|
||||||
2. [Cook The Headcrab Episodes 1 & 2](http://www.moddb.com/games/half-life/addons/cook-the-headcrab-episode-series)
|
2. [Cook The Headcrab Episodes 1 & 2](http://www.moddb.com/games/half-life/addons/cook-the-headcrab-episode-series)
|
||||||
3. [Cook The Headcrab Episode 3](http://www.moddb.com/games/half-life/addons/cook-the-headcrab-episode-3)
|
3. [Cook The Headcrab Episode 3](http://www.moddb.com/games/half-life/addons/cook-the-headcrab-episode-3)
|
||||||
4. [Cook The Headcrab Episode 4](http://www.moddb.com/games/half-life/addons/cook-the-headcrab-episode-4)
|
4. [Cook The Headcrab Episode 4](http://www.moddb.com/games/half-life/addons/cook-the-headcrab-episode-4)
|
||||||
@@ -422,7 +422,7 @@ Mods:
|
|||||||
33. [C2](https://www.runthinkshootlive.com/posts/c2/)
|
33. [C2](https://www.runthinkshootlive.com/posts/c2/)
|
||||||
34. [C3](https://www.runthinkshootlive.com/posts/c3/)
|
34. [C3](https://www.runthinkshootlive.com/posts/c3/)
|
||||||
35. [C5](https://www.runthinkshootlive.com/posts/c5/)
|
35. [C5](https://www.runthinkshootlive.com/posts/c5/)
|
||||||
36. [Caged](http://www.caylegeorge.com/ld_history/cg_maps.htm) (link dead!)
|
36. [Caged](https://store.steampowered.com/app/679990/HalfLife_Caged/)
|
||||||
37. [Camera Puzzle](http://twhl.info/vault.php?map=740) (this map perfectly demonstrates an improved feature of Xash3D Engine - game is correctly saving and restoring 3rd person view for the player after loading a previously saved game)
|
37. [Camera Puzzle](http://twhl.info/vault.php?map=740) (this map perfectly demonstrates an improved feature of Xash3D Engine - game is correctly saving and restoring 3rd person view for the player after loading a previously saved game)
|
||||||
38. [CataXen](http://twhl.info/vault.php?map=3429)
|
38. [CataXen](http://twhl.info/vault.php?map=3429)
|
||||||
39. [Cause of Death](http://twhl.info/competitions.php?results=7)
|
39. [Cause of Death](http://twhl.info/competitions.php?results=7)
|
||||||
@@ -641,7 +641,7 @@ Mods:
|
|||||||
252. [Tower](http://twhl.info/vault.php?map=250) (Required Spirit of Half-Life for item_suit)
|
252. [Tower](http://twhl.info/vault.php?map=250) (Required Spirit of Half-Life for item_suit)
|
||||||
253. [TriggerHappy](https://www.fileplanet.com/8929/0/fileinfo/TriggerHappy)
|
253. [TriggerHappy](https://www.fileplanet.com/8929/0/fileinfo/TriggerHappy)
|
||||||
254. [TriggerHappy2](https://www.fileplanet.com/13503/10000/fileinfo/TriggerHappy2)
|
254. [TriggerHappy2](https://www.fileplanet.com/13503/10000/fileinfo/TriggerHappy2)
|
||||||
255. [TriggerHappy2.5](http://www.atomicgamer.com/files/14120/trhappy25-zip) (link dead!)
|
255. [TriggerHappy2.5](https://www.moddb.com/games/half-life/addons/trigger-happy-v25)
|
||||||
256. [Trouble](https://gamebanana.com/maps/166033)
|
256. [Trouble](https://gamebanana.com/maps/166033)
|
||||||
257. [Tunnels](http://twhl.info/vault.php?map=5350)
|
257. [Tunnels](http://twhl.info/vault.php?map=5350)
|
||||||
258. [Twisted Hazard Course](https://www.fileplanet.com/52919/50000/fileinfo/Twisted-Hazard-Course)
|
258. [Twisted Hazard Course](https://www.fileplanet.com/52919/50000/fileinfo/Twisted-Hazard-Course)
|
||||||
@@ -708,7 +708,7 @@ For Linux and OS X you must download crossbuild from [here](http://www.moddb.com
|
|||||||
16. [Radiation Alert: Episode 1 v1.1](http://www.moddb.com/mods/radiation-alert-episode-1)
|
16. [Radiation Alert: Episode 1 v1.1](http://www.moddb.com/mods/radiation-alert-episode-1)
|
||||||
17. [Run From Hell v1.1b](https://www.runthinkshootlive.com/posts/run-from-hell/) (there is an inner bug with underwater crates in the map **firstmap9** - they can't be broken, so you should use **noclip** to pass through them)
|
17. [Run From Hell v1.1b](https://www.runthinkshootlive.com/posts/run-from-hell/) (there is an inner bug with underwater crates in the map **firstmap9** - they can't be broken, so you should use **noclip** to pass through them)
|
||||||
18. [Santa's Revenge](http://twhl.info/vault.php?map=4332) (set **fps_max** to **60** to avoid an inner problem of the last map with final scripted sequence, otherwise the mod can not be finished properly)
|
18. [Santa's Revenge](http://twhl.info/vault.php?map=4332) (set **fps_max** to **60** to avoid an inner problem of the last map with final scripted sequence, otherwise the mod can not be finished properly)
|
||||||
19. [Sector 6](http://www.moddb.com/mods/sector-6x) (link dead!)
|
19. [Sector 6](https://www.moddb.com/mods/sector-6/)
|
||||||
20. [Space Prisoner v1.1](http://www.moddb.com/games/half-life/addons/space-prisoner-v11) (after installing of the mod open **liblist.gam** or **gameinfo.txt** file in the mod's folder and correct the line **gamedll "..\prison\dlls\spirit.dll"** for **gamedll "dlls\spirit.dll"**, otherwise you'll not be able to start a game; there is also a scripting error on a third map of the mod, so you'll be forced to use **noclip** to pass around bugged place)
|
20. [Space Prisoner v1.1](http://www.moddb.com/games/half-life/addons/space-prisoner-v11) (after installing of the mod open **liblist.gam** or **gameinfo.txt** file in the mod's folder and correct the line **gamedll "..\prison\dlls\spirit.dll"** for **gamedll "dlls\spirit.dll"**, otherwise you'll not be able to start a game; there is also a scripting error on a third map of the mod, so you'll be forced to use **noclip** to pass around bugged place)
|
||||||
21. [Terrorist Attack 2](http://terroristattack.wz.cz/mody.html) (link dead!)
|
21. [Terrorist Attack 2](http://terroristattack.wz.cz/mody.html) (link dead!)
|
||||||
22. [Timeline III: The Heart of Darkness](http://www.moddb.com/mods/timeline-series)
|
22. [Timeline III: The Heart of Darkness](http://www.moddb.com/mods/timeline-series)
|
||||||
@@ -739,7 +739,7 @@ For Linux and OS X you must download crossbuild from [here](http://www.moddb.com
|
|||||||
1. [Before v1.0](http://www.moddb.com/mods/half-life-before)
|
1. [Before v1.0](http://www.moddb.com/mods/half-life-before)
|
||||||
2. [Christmas Life v1.0](http://www.moddb.com/mods/christmas-life) (initial mod works properly, but additional mappacks for this mod contain few maps that have some gameplay problems under Xash3D)
|
2. [Christmas Life v1.0](http://www.moddb.com/mods/christmas-life) (initial mod works properly, but additional mappacks for this mod contain few maps that have some gameplay problems under Xash3D)
|
||||||
3. [COLONY 42 Alpha](http://twhl.info/vault.php?map=6055)
|
3. [COLONY 42 Alpha](http://twhl.info/vault.php?map=6055)
|
||||||
4. [Crazy Crabs Demo 1 & 2](http://www.moddb.com/mods/mad-crabs-2014) (link dead!)
|
4. [Crazy Crabs Demo 1 & 2](https://www.moddb.com/mods/mad-crabs)
|
||||||
5. [Far Crab Demo v2](http://www.moddb.com/mods/far-crab)
|
5. [Far Crab Demo v2](http://www.moddb.com/mods/far-crab)
|
||||||
6. [Firefighter Demo v1.1](http://www.moddb.com/mods/firefighter-mod)
|
6. [Firefighter Demo v1.1](http://www.moddb.com/mods/firefighter-mod)
|
||||||
7. [Halfquake 3: Sunrise](http://www.moddb.com/mods/halfquake-amen)
|
7. [Halfquake 3: Sunrise](http://www.moddb.com/mods/halfquake-amen)
|
||||||
@@ -780,7 +780,7 @@ For mappacks - place *.bsp files to **gearbox/maps** folder, *.wad files to **ge
|
|||||||
16. [Mechanized Death: An Army of None](http://www.moddb.com/games/half-life-opposing-force/addons/mechanized-death-army-of-none)
|
16. [Mechanized Death: An Army of None](http://www.moddb.com/games/half-life-opposing-force/addons/mechanized-death-army-of-none)
|
||||||
17. [Nuclear Winter](http://www.moddb.com/mods/nuclear-winter-opfor)
|
17. [Nuclear Winter](http://www.moddb.com/mods/nuclear-winter-opfor)
|
||||||
18. [Opposing Force Aliens Addon](https://www.fileplanet.com/82829/80000/fileinfo/Half-Life:-Opposing-Force-Aliens-Addon-1.2)
|
18. [Opposing Force Aliens Addon](https://www.fileplanet.com/82829/80000/fileinfo/Half-Life:-Opposing-Force-Aliens-Addon-1.2)
|
||||||
19. [Opposing Life2Life](https://www.gamewatcher.com/) (link dead!)
|
19. [Opposing Life2Life](https://www.moddb.com/games/half-life/addons/opposing-life2life-final-hd)
|
||||||
20. [Realms](http://www.snarkpit.net/index.php?s=maps&map=3483)
|
20. [Realms](http://www.snarkpit.net/index.php?s=maps&map=3483)
|
||||||
21. [Shepard's Adventures](http://www.moddb.com/mods/shepards-adventures)
|
21. [Shepard's Adventures](http://www.moddb.com/mods/shepards-adventures)
|
||||||
22. [Snowy Rock](http://www.moddb.com/games/half-life-opposing-force/addons/snow-rock)
|
22. [Snowy Rock](http://www.moddb.com/games/half-life-opposing-force/addons/snow-rock)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# Xash3D FWGS Engine
|
# Xash3D FWGS Engine
|
||||||
[](https://travis-ci.org/FWGS/xash3d-fwgs) [](https://discord.gg/TbnHcVb)
|
[](https://github.com/FWGS/xash3d-fwgs/actions/workflows/c-cpp.yml) [](https://travis-ci.org/FWGS/xash3d-fwgs) [](https://cirrus-ci.com/github/FWGS/xash3d-fwgs) [](http://discord.fwgs.ru/) \
|
||||||
|
[](https://github.com/FWGS/xash3d-fwgs/releases/latest) [](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous)
|
||||||
|
|
||||||
Xash3D FWGS is a fork of Xash3D Engine by Unkle Mike with extended features and crossplatform.
|
Xash3D FWGS is a fork of Xash3D Engine by Unkle Mike with extended features and crossplatform.
|
||||||
|
|
||||||
@@ -9,19 +10,15 @@ as well as to give game developers well known workflow and extend it.
|
|||||||
Read more about Xash3D on ModDB: https://www.moddb.com/engines/xash3d-engine
|
Read more about Xash3D on ModDB: https://www.moddb.com/engines/xash3d-engine
|
||||||
```
|
```
|
||||||
|
|
||||||
Latest release build: https://github.com/FWGS/xash3d-fwgs/releases/latest
|
|
||||||
|
|
||||||
Latest development build: https://github.com/FWGS/xash3d-deploy/tree/newengine-master
|
|
||||||
|
|
||||||
## Fork features
|
## Fork features
|
||||||
* HLSDK 2.4 support.
|
* HLSDK 2.4 support.
|
||||||
* Crossplatform: officially supported x86 and ARM on Windows/Linux/BSD/Android. (see Documentation/ports.md for more info)
|
* Crossplatform: supported x86 and ARM on Windows/Linux/BSD/Android. ([see docs for more info](Documentation/ports.md))
|
||||||
* Modern compilers support: say no more to MSVC6.
|
* Modern compilers support: say no more to MSVC6.
|
||||||
* Better multiplayer support: multiple master servers, headless dedicated server.
|
* Better multiplayer support: multiple master servers, headless dedicated server.
|
||||||
* Mobility API: allows better game integration on mobile devices(vibration, touch controls)
|
* Mobility API: allows better game integration on mobile devices(vibration, touch controls)
|
||||||
* Different input methods: touch, gamepad and classic mouse & keyboard.
|
* Different input methods: touch, gamepad and classic mouse & keyboard.
|
||||||
* TrueType font rendering, as a part of mainui_cpp.
|
* TrueType font rendering, as a part of mainui_cpp.
|
||||||
* Multiple renderers support(OpenGL, GLES, Software)
|
* Multiple renderers support: OpenGL, GLESv1, GLESv2, Software
|
||||||
* A set of small improvements, without broken compatibility.
|
* A set of small improvements, without broken compatibility.
|
||||||
|
|
||||||
## Planned fork features
|
## Planned fork features
|
||||||
@@ -29,17 +26,32 @@ Latest development build: https://github.com/FWGS/xash3d-deploy/tree/newengine-m
|
|||||||
* Voice support
|
* Voice support
|
||||||
* Vulkan renderer
|
* Vulkan renderer
|
||||||
|
|
||||||
|
## Installation & Running
|
||||||
|
0) Get Xash3D binaries: you can use [testing](https://github.com/FWGS/xash3d-fwgs/releases/tag/continuous) build or you can compile engine from source code.
|
||||||
|
Choose proper build package depending on which platform you're using.
|
||||||
|
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.
|
||||||
|
Also if you're using Windows: you should copy `vgui.dll` library from Half-Life directory to Xash3D directory.
|
||||||
|
As alternative, you can compile [hlsdk-xash3d](https://github.com/FWGS/hlsdk-xash3d) instead of using official Valve game binaries, but you still needed to copy `valve` directory as all game resources located in there.
|
||||||
|
3) Download [extras.pak](https://github.com/FWGS/xash-extras/releases/tag/v0.19.2) and place it to `valve` directory.
|
||||||
|
4) Run `xash3d.exe`/`xash3d.sh`/`xash3d` depending on which platform you're using.
|
||||||
|
|
||||||
|
Note: on Linux, you may need to create an sh file with the command `LD_LIBRARY_PATH=. ./xash3d`.
|
||||||
|
|
||||||
|
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
|
||||||
* Before sending a PR, check if you followed our coding guide in CODING_STYLE.md file.
|
* Issues are accepted in both English and Russian
|
||||||
|
* 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 https://waf.io/book/
|
||||||
|
|
||||||
If you're stuck somewhere and you need a clear example, read `.travis.yml` and `scripts/build*.sh`.
|
NOTE: NEVER USE GitHub's ZIP ARCHIVES. GitHub doesn't include external dependencies we're using!
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
#### Windows(Visual Studio)
|
#### Windows (Visual Studio)
|
||||||
* Install Visual Studio.
|
* Install Visual Studio.
|
||||||
* Install latest [Python](https://python.org) **OR** run `cinst python.install` if you have Chocolatey.
|
* Install latest [Python](https://python.org) **OR** run `cinst python.install` if you have Chocolatey.
|
||||||
* Install latest [Git](https://git-scm.com/download/win) **OR** run `cinst git.install` if you have Chocolatey.
|
* Install latest [Git](https://git-scm.com/download/win) **OR** run `cinst git.install` if you have Chocolatey.
|
||||||
@@ -49,7 +61,7 @@ If you're stuck somewhere and you need a clear example, read `.travis.yml` and `
|
|||||||
|
|
||||||
#### GNU/Linux
|
#### GNU/Linux
|
||||||
NOTE FOR USERS WITH X86 COMPATIBLE CPUs:
|
NOTE FOR USERS WITH X86 COMPATIBLE CPUs:
|
||||||
We have forced build system to throw an error, if you're trying to build 64-bit engine. This done for keeping compatibility with Steam releases of Half-Life and based on it's engine games.
|
We have forced Waf to throw an error, if you're trying to build 64-bit engine. This was done for keeping 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!
|
||||||
|
|
||||||
##### Debian/Ubuntu
|
##### Debian/Ubuntu
|
||||||
@@ -57,20 +69,15 @@ Even if Xash3D FWGS does support targetting 64-bit, you can't load games without
|
|||||||
|
|
||||||
`$ sudo dpkg --add-architecture i386`
|
`$ sudo dpkg --add-architecture i386`
|
||||||
* Install development tools
|
* Install development tools
|
||||||
* For 32-bit engine on amd64:
|
* 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`
|
`$ sudo apt install build-essential gcc-multilib g++-multilib python libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype6-dev:i386`
|
||||||
* For everything else:
|
* For everything else: \
|
||||||
|
|
||||||
`$ sudo apt install build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev`
|
`$ sudo apt install build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev`
|
||||||
* Clone this repostory:
|
* Clone this repostory:
|
||||||
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`
|
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`
|
||||||
|
|
||||||
#### ArchLinux
|
|
||||||
* ArchLinux users are lucky enough and there is a `xash3d-git` AUR package for them.
|
|
||||||
|
|
||||||
### 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) Carefully examine which build options are available: `waf --help`
|
||||||
@@ -81,13 +88,9 @@ Even if Xash3D FWGS does support targetting 64-bit, you can't load games without
|
|||||||
#### Linux
|
#### Linux
|
||||||
0) Examine which build options are available: `./waf --help`
|
0) Examine which build options are available: `./waf --help`
|
||||||
1) Configure build: `./waf configure -T release --prefix=/path/to/any/output/directory`
|
1) Configure build: `./waf configure -T release --prefix=/path/to/any/output/directory`
|
||||||
(To compile 64-bit engine on 64-bit x86 processor, you need to pass `-8` also)
|
(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(optional): `./waf install`
|
3) Install(optional): `./waf install`
|
||||||
|
|
||||||
## Running
|
Note: 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.
|
||||||
0) Copy libraries and main executable somewhere, if you're skipped installation stage.
|
|
||||||
1) Copy game files to same directory
|
|
||||||
2) Run `xash3d.exe`/`xash3d.sh`/`xash3d` depending on which platform you're using.
|
|
||||||
|
|
||||||
For additional info, run Xash3D with `-help` command line key.
|
|
||||||
|
|||||||
+12
-1
@@ -20,6 +20,8 @@ GNU General Public License for more details.
|
|||||||
#define VIDEO_SDL 1
|
#define VIDEO_SDL 1
|
||||||
#define VIDEO_ANDROID 2
|
#define VIDEO_ANDROID 2
|
||||||
#define VIDEO_FBDEV 3
|
#define VIDEO_FBDEV 3
|
||||||
|
#define VIDEO_DOS 4
|
||||||
|
|
||||||
|
|
||||||
// audio backends (XASH_SOUND)
|
// audio backends (XASH_SOUND)
|
||||||
#define SOUND_NULL 0
|
#define SOUND_NULL 0
|
||||||
@@ -42,8 +44,9 @@ GNU General Public License for more details.
|
|||||||
// timer (XASH_TIMER)
|
// timer (XASH_TIMER)
|
||||||
#define TIMER_NULL 0 // not used
|
#define TIMER_NULL 0 // not used
|
||||||
#define TIMER_SDL 1
|
#define TIMER_SDL 1
|
||||||
#define TIMER_LINUX 2
|
#define TIMER_POSIX 2
|
||||||
#define TIMER_WIN32 3
|
#define TIMER_WIN32 3
|
||||||
|
#define TIMER_DOS 4
|
||||||
|
|
||||||
// messageboxes (XASH_MESSAGEBOX)
|
// messageboxes (XASH_MESSAGEBOX)
|
||||||
#define MSGBOX_STDERR 0
|
#define MSGBOX_STDERR 0
|
||||||
@@ -51,4 +54,12 @@ GNU General Public License for more details.
|
|||||||
#define MSGBOX_ANDROID 2
|
#define MSGBOX_ANDROID 2
|
||||||
#define MSGBOX_WIN32 3
|
#define MSGBOX_WIN32 3
|
||||||
|
|
||||||
|
|
||||||
|
// library loading (XASH_LIB)
|
||||||
|
#define LIB_NULL 0
|
||||||
|
#define LIB_POSIX 1
|
||||||
|
#define LIB_WIN32 2
|
||||||
|
#define LIB_STATIC 3
|
||||||
|
|
||||||
|
|
||||||
#endif /* BACKENDS_H */
|
#endif /* BACKENDS_H */
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ NOTE: number at end of pixelformat name it's a total bitscount e.g. PF_RGB_24 ==
|
|||||||
*/
|
*/
|
||||||
#define ImageRAW( type ) (type == PF_RGBA_32 || type == PF_BGRA_32 || type == PF_RGB_24 || type == PF_BGR_24 || type == PF_LUMINANCE)
|
#define ImageRAW( type ) (type == PF_RGBA_32 || type == PF_BGRA_32 || type == PF_RGB_24 || type == PF_BGR_24 || type == PF_LUMINANCE)
|
||||||
#define ImageDXT( type ) (type == PF_DXT1 || type == PF_DXT3 || type == PF_DXT5 || type == PF_ATI2)
|
#define ImageDXT( type ) (type == PF_DXT1 || type == PF_DXT3 || type == PF_DXT5 || type == PF_ATI2)
|
||||||
|
#define Image16( type ) (type == PF_RGBA_64 || type == PF_RGB_48)
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,8 @@ typedef enum
|
|||||||
PF_DXT3, // s3tc DXT3 format
|
PF_DXT3, // s3tc DXT3 format
|
||||||
PF_DXT5, // s3tc DXT5 format
|
PF_DXT5, // s3tc DXT5 format
|
||||||
PF_ATI2, // latc ATI2N format
|
PF_ATI2, // latc ATI2N format
|
||||||
|
PF_RGBA_64, // 16-bit RGBA
|
||||||
|
PF_RGB_48, // 16-bit RGB
|
||||||
PF_TOTALCOUNT, // must be last
|
PF_TOTALCOUNT, // must be last
|
||||||
} pixformat_t;
|
} pixformat_t;
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -32,7 +32,8 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#define MIPLEVELS 4
|
#define MIPLEVELS 4
|
||||||
#define VERTEXSIZE 7
|
#define VERTEXSIZE 7
|
||||||
#define MAXLIGHTMAPS 4
|
#define MAXLIGHTMAPS 4 // max light styles per face
|
||||||
|
#define MAXDYNLIGHTS 8 // maximum dynamic lights per one pixel
|
||||||
#define NUM_AMBIENTS 4 // automatic ambient sounds
|
#define NUM_AMBIENTS 4 // automatic ambient sounds
|
||||||
|
|
||||||
// model types
|
// model types
|
||||||
@@ -290,7 +291,7 @@ typedef struct model_s
|
|||||||
// shared modelinfo
|
// shared modelinfo
|
||||||
modtype_t type; // model type
|
modtype_t type; // model type
|
||||||
int numframes; // sprite's framecount
|
int numframes; // sprite's framecount
|
||||||
byte *mempool; // private mempool (was synctype)
|
poolhandle_t mempool; // private mempool (was synctype)
|
||||||
int flags; // hl compatibility
|
int flags; // hl compatibility
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
+54
-61
@@ -20,45 +20,45 @@
|
|||||||
// Most came from server.h
|
// Most came from server.h
|
||||||
|
|
||||||
// edict->flags
|
// edict->flags
|
||||||
#define FL_FLY (1<<0) // Changes the SV_Movestep() behavior to not need to be on ground
|
#define FL_FLY (1U<<0) // Changes the SV_Movestep() behavior to not need to be on ground
|
||||||
#define FL_SWIM (1<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
|
#define FL_SWIM (1U<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
|
||||||
#define FL_CONVEYOR (1<<2)
|
#define FL_CONVEYOR (1U<<2)
|
||||||
#define FL_CLIENT (1<<3)
|
#define FL_CLIENT (1U<<3)
|
||||||
#define FL_INWATER (1<<4)
|
#define FL_INWATER (1U<<4)
|
||||||
#define FL_MONSTER (1<<5)
|
#define FL_MONSTER (1U<<5)
|
||||||
#define FL_GODMODE (1<<6)
|
#define FL_GODMODE (1U<<6)
|
||||||
#define FL_NOTARGET (1<<7)
|
#define FL_NOTARGET (1U<<7)
|
||||||
#define FL_SKIPLOCALHOST (1<<8) // Don't send entity to local host, it's predicting this entity itself
|
#define FL_SKIPLOCALHOST (1U<<8) // Don't send entity to local host, it's predicting this entity itself
|
||||||
#define FL_ONGROUND (1<<9) // At rest / on the ground
|
#define FL_ONGROUND (1U<<9) // At rest / on the ground
|
||||||
#define FL_PARTIALGROUND (1<<10) // not all corners are valid
|
#define FL_PARTIALGROUND (1U<<10) // not all corners are valid
|
||||||
#define FL_WATERJUMP (1<<11) // player jumping out of water
|
#define FL_WATERJUMP (1U<<11) // player jumping out of water
|
||||||
#define FL_FROZEN (1<<12) // Player is frozen for 3rd person camera
|
#define FL_FROZEN (1U<<12) // Player is frozen for 3rd person camera
|
||||||
#define FL_FAKECLIENT (1<<13) // JAC: fake client, simulated server side; don't send network messages to them
|
#define FL_FAKECLIENT (1U<<13) // JAC: fake client, simulated server side; don't send network messages to them
|
||||||
#define FL_DUCKING (1<<14) // Player flag -- Player is fully crouched
|
#define FL_DUCKING (1U<<14) // Player flag -- Player is fully crouched
|
||||||
#define FL_FLOAT (1<<15) // Apply floating force to this entity when in water
|
#define FL_FLOAT (1U<<15) // Apply floating force to this entity when in water
|
||||||
#define FL_GRAPHED (1<<16) // worldgraph has this ent listed as something that blocks a connection
|
#define FL_GRAPHED (1U<<16) // worldgraph has this ent listed as something that blocks a connection
|
||||||
|
|
||||||
// UNDONE: Do we need these?
|
// UNDONE: Do we need these?
|
||||||
#define FL_IMMUNE_WATER (1<<17)
|
#define FL_IMMUNE_WATER (1U<<17)
|
||||||
#define FL_IMMUNE_SLIME (1<<18)
|
#define FL_IMMUNE_SLIME (1U<<18)
|
||||||
#define FL_IMMUNE_LAVA (1<<19)
|
#define FL_IMMUNE_LAVA (1U<<19)
|
||||||
|
|
||||||
#define FL_PROXY (1<<20) // This is a spectator proxy
|
#define FL_PROXY (1U<<20) // This is a spectator proxy
|
||||||
#define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
|
#define FL_ALWAYSTHINK (1U<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
|
||||||
#define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
|
#define FL_BASEVELOCITY (1U<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
|
||||||
#define FL_MONSTERCLIP (1<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
|
#define FL_MONSTERCLIP (1U<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
|
||||||
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
|
#define FL_ONTRAIN (1U<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
|
||||||
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
|
#define FL_WORLDBRUSH (1U<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
|
||||||
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
|
#define FL_SPECTATOR (1U<<26) // This client is a spectator, don't run touch functions, etc.
|
||||||
#define FL_LASERDOT (1<<27) // Predicted laser spot from rocket launcher
|
#define FL_LASERDOT (1U<<27) // Predicted laser spot from rocket launcher
|
||||||
|
|
||||||
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
|
#define FL_CUSTOMENTITY (1U<<29) // This is a custom entity
|
||||||
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
|
#define FL_KILLME (1U<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
|
||||||
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
|
#define FL_DORMANT (1U<<31) // Entity is dormant, no updates to client
|
||||||
|
|
||||||
// Goes into globalvars_t.trace_flags
|
// Goes into globalvars_t.trace_flags
|
||||||
#define FTRACE_SIMPLEBOX (1<<0) // Traceline with a simple box
|
#define FTRACE_SIMPLEBOX (1U<<0) // Traceline with a simple box
|
||||||
#define FTRACE_IGNORE_GLASS (1<<1) // traceline will be ignored entities with rendermode != kRenderNormal
|
#define FTRACE_IGNORE_GLASS (1U<<1) // traceline will be ignored entities with rendermode != kRenderNormal
|
||||||
|
|
||||||
// walkmove modes
|
// walkmove modes
|
||||||
#define WALKMOVE_NORMAL 0 // normal walkmove
|
#define WALKMOVE_NORMAL 0 // normal walkmove
|
||||||
@@ -114,11 +114,11 @@
|
|||||||
#define EF_LIGHT 64 // rocket flare glow sprite
|
#define EF_LIGHT 64 // rocket flare glow sprite
|
||||||
#define EF_NODRAW 128 // don't draw entity
|
#define EF_NODRAW 128 // don't draw entity
|
||||||
|
|
||||||
#define EF_WATERSIDES (1<<26) // Do not remove sides for func_water entity
|
#define EF_WATERSIDES (1U<<26) // Do not remove sides for func_water entity
|
||||||
#define EF_FULLBRIGHT (1<<27) // Just get fullbright
|
#define EF_FULLBRIGHT (1U<<27) // Just get fullbright
|
||||||
#define EF_NOSHADOW (1<<28) // ignore shadow for this entity
|
#define EF_NOSHADOW (1U<<28) // ignore shadow for this entity
|
||||||
#define EF_MERGE_VISIBILITY (1<<29) // this entity allowed to merge vis (e.g. env_sky or portal camera)
|
#define EF_MERGE_VISIBILITY (1U<<29) // this entity allowed to merge vis (e.g. env_sky or portal camera)
|
||||||
#define EF_REQUEST_PHS (1<<30) // This entity requested phs bitvector instead of pvsbitvector in AddToFullPack calls
|
#define EF_REQUEST_PHS (1U<<30) // This entity requested phs bitvector instead of pvsbitvector in AddToFullPack calls
|
||||||
// g-cont. one reserved bit here for me
|
// g-cont. one reserved bit here for me
|
||||||
|
|
||||||
// entity flags
|
// entity flags
|
||||||
@@ -606,13 +606,6 @@
|
|||||||
#define CONTENT_GRAVITY_FLYFIELD -18
|
#define CONTENT_GRAVITY_FLYFIELD -18
|
||||||
#define CONTENT_FOG -19
|
#define CONTENT_FOG -19
|
||||||
|
|
||||||
#define CONTENT_EMPTY -1
|
|
||||||
#define CONTENT_SOLID -2
|
|
||||||
#define CONTENT_WATER -3
|
|
||||||
#define CONTENT_SLIME -4
|
|
||||||
#define CONTENT_LAVA -5
|
|
||||||
#define CONTENT_SKY -6
|
|
||||||
|
|
||||||
// channels
|
// channels
|
||||||
#define CHAN_AUTO 0
|
#define CHAN_AUTO 0
|
||||||
#define CHAN_WEAPON 1
|
#define CHAN_WEAPON 1
|
||||||
@@ -647,22 +640,22 @@
|
|||||||
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
|
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
|
||||||
|
|
||||||
// buttons
|
// buttons
|
||||||
#define IN_ATTACK (1<<0)
|
#define IN_ATTACK (1U<<0)
|
||||||
#define IN_JUMP (1<<1)
|
#define IN_JUMP (1U<<1)
|
||||||
#define IN_DUCK (1<<2)
|
#define IN_DUCK (1U<<2)
|
||||||
#define IN_FORWARD (1<<3)
|
#define IN_FORWARD (1U<<3)
|
||||||
#define IN_BACK (1<<4)
|
#define IN_BACK (1U<<4)
|
||||||
#define IN_USE (1<<5)
|
#define IN_USE (1U<<5)
|
||||||
#define IN_CANCEL (1<<6)
|
#define IN_CANCEL (1U<<6)
|
||||||
#define IN_LEFT (1<<7)
|
#define IN_LEFT (1U<<7)
|
||||||
#define IN_RIGHT (1<<8)
|
#define IN_RIGHT (1U<<8)
|
||||||
#define IN_MOVELEFT (1<<9)
|
#define IN_MOVELEFT (1U<<9)
|
||||||
#define IN_MOVERIGHT (1<<10)
|
#define IN_MOVERIGHT (1U<<10)
|
||||||
#define IN_ATTACK2 (1<<11)
|
#define IN_ATTACK2 (1U<<11)
|
||||||
#define IN_RUN (1<<12)
|
#define IN_RUN (1U<<12)
|
||||||
#define IN_RELOAD (1<<13)
|
#define IN_RELOAD (1U<<13)
|
||||||
#define IN_ALT1 (1<<14)
|
#define IN_ALT1 (1U<<14)
|
||||||
#define IN_SCORE (1<<15) // Used by client.dll for when scoreboard is held down
|
#define IN_SCORE (1U<<15) // Used by client.dll for when scoreboard is held down
|
||||||
|
|
||||||
// Break Model Defines
|
// Break Model Defines
|
||||||
#define BREAK_TYPEMASK 0x4F
|
#define BREAK_TYPEMASK 0x4F
|
||||||
|
|||||||
+27
-16
@@ -69,6 +69,7 @@ SETUP BACKENDS DEFINITIONS
|
|||||||
#endif // XASH_MESSAGEBOX
|
#endif // XASH_MESSAGEBOX
|
||||||
|
|
||||||
#define XASH_USE_EVDEV
|
#define XASH_USE_EVDEV
|
||||||
|
#define XASH_DYNAMIC_DLADDR
|
||||||
#elif XASH_LINUX
|
#elif XASH_LINUX
|
||||||
// we are building for Linux without SDL2, can draw only to framebuffer yet
|
// we are building for Linux without SDL2, can draw only to framebuffer yet
|
||||||
#ifndef XASH_VIDEO
|
#ifndef XASH_VIDEO
|
||||||
@@ -84,7 +85,17 @@ SETUP BACKENDS DEFINITIONS
|
|||||||
#endif // XASH_SOUND
|
#endif // XASH_SOUND
|
||||||
|
|
||||||
#define XASH_USE_EVDEV
|
#define XASH_USE_EVDEV
|
||||||
#endif // XASH_LINUX
|
#elif XASH_DOS4GW
|
||||||
|
#ifndef XASH_VIDEO
|
||||||
|
#define XASH_VIDEO VIDEO_DOS
|
||||||
|
#endif
|
||||||
|
#ifndef XASH_TIMER
|
||||||
|
#define XASH_TIMER TIMER_DOS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// usually only 10-20 fds availiable
|
||||||
|
#define XASH_REDUCE_FD
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // XASH_DEDICATED
|
#endif // XASH_DEDICATED
|
||||||
|
|
||||||
@@ -107,8 +118,6 @@ SETUP BACKENDS DEFINITIONS
|
|||||||
#define XASH_CRASHHANDLER CRASHHANDLER_DBGHELP
|
#define XASH_CRASHHANDLER CRASHHANDLER_DBGHELP
|
||||||
#elif XASH_LINUX || XASH_BSD
|
#elif XASH_LINUX || XASH_BSD
|
||||||
#define XASH_CRASHHANDLER CRASHHANDLER_UCONTEXT
|
#define XASH_CRASHHANDLER CRASHHANDLER_UCONTEXT
|
||||||
#else // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
|
|
||||||
#define XASH_CRASHHANDLER CRASHHANDLER_NULL
|
|
||||||
#endif // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
|
#endif // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -119,10 +128,20 @@ SETUP BACKENDS DEFINITIONS
|
|||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
#define XASH_TIMER TIMER_WIN32
|
#define XASH_TIMER TIMER_WIN32
|
||||||
#else // !XASH_WIN32
|
#else // !XASH_WIN32
|
||||||
#define XASH_TIMER TIMER_LINUX
|
#define XASH_TIMER TIMER_POSIX
|
||||||
#endif // !XASH_WIN32
|
#endif // !XASH_WIN32
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XASH_STATIC_LIBS
|
||||||
|
#define XASH_LIB LIB_STATIC
|
||||||
|
#define XASH_INTERNAL_GAMELIBS
|
||||||
|
#define XASH_ALLOW_SAVERESTORE_OFFSETS
|
||||||
|
#elif XASH_WIN32
|
||||||
|
#define XASH_LIB LIB_WIN32
|
||||||
|
#elif XASH_POSIX
|
||||||
|
#define XASH_LIB LIB_POSIX
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// fallback to NULL
|
// fallback to NULL
|
||||||
//
|
//
|
||||||
@@ -138,6 +157,10 @@ SETUP BACKENDS DEFINITIONS
|
|||||||
#define XASH_INPUT INPUT_NULL
|
#define XASH_INPUT INPUT_NULL
|
||||||
#endif // XASH_INPUT
|
#endif // XASH_INPUT
|
||||||
|
|
||||||
|
#ifndef XASH_CRASHHANDLER
|
||||||
|
#define XASH_CRASHHANDLER CRASHHANDLER_NULL
|
||||||
|
#endif // XASH_CRASHHANDLER
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=========================================================================
|
=========================================================================
|
||||||
|
|
||||||
@@ -169,16 +192,4 @@ Default build-depended cvar and constant values
|
|||||||
#define DEFAULT_FULLSCREEN 1
|
#define DEFAULT_FULLSCREEN 1
|
||||||
#endif // DEFAULT_FULLSCREEN
|
#endif // DEFAULT_FULLSCREEN
|
||||||
|
|
||||||
#ifndef DEFAULT_ACCELERATED_RENDERER
|
|
||||||
#if XASH_MOBILE_PLATFORM
|
|
||||||
#define DEFAULT_ACCELERATED_RENDERER "gles1"
|
|
||||||
#else // !XASH_MOBILE_PLATFORM
|
|
||||||
#define DEFAULT_ACCELERATED_RENDERER "gl"
|
|
||||||
#endif // !XASH_MOBILE_PLATFORM
|
|
||||||
#endif // DEFAULT_ACCELERATED_RENDERER
|
|
||||||
|
|
||||||
#ifndef DEFAULT_SOFTWARE_RENDERER
|
|
||||||
#define DEFAULT_SOFTWARE_RENDERER "soft" // mittorn's ref_soft
|
|
||||||
#endif // DEFAULT_SOFTWARE_RENDERER
|
|
||||||
|
|
||||||
#endif // DEFAULTS_H
|
#endif // DEFAULTS_H
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ typedef struct net_api_s
|
|||||||
void (*SendRequest)( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response );
|
void (*SendRequest)( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response );
|
||||||
void (*CancelRequest)( int context );
|
void (*CancelRequest)( int context );
|
||||||
void (*CancelAllRequests)( void );
|
void (*CancelAllRequests)( void );
|
||||||
char *(*AdrToString)( struct netadr_s *a );
|
const char *(*AdrToString)( struct netadr_s *a );
|
||||||
int ( *CompareAdr)( struct netadr_s *a, struct netadr_s *b );
|
int ( *CompareAdr)( struct netadr_s *a, struct netadr_s *b );
|
||||||
int ( *StringToAdr)( char *s, struct netadr_s *a );
|
int ( *StringToAdr)( char *s, struct netadr_s *a );
|
||||||
const char *(*ValueForKey)( const char *s, const char *key );
|
const char *(*ValueForKey)( const char *s, const char *key );
|
||||||
|
|||||||
+19
-8
@@ -20,14 +20,10 @@ GNU General Public License for more details.
|
|||||||
#include "build.h"
|
#include "build.h"
|
||||||
|
|
||||||
#if !XASH_WIN32
|
#if !XASH_WIN32
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#define PATH_SPLITTER "/"
|
|
||||||
|
|
||||||
#if XASH_APPLE
|
#if XASH_APPLE
|
||||||
#include <sys/syslimits.h>
|
#include <sys/syslimits.h>
|
||||||
#include "TargetConditionals.h"
|
|
||||||
#define OS_LIB_EXT "dylib"
|
#define OS_LIB_EXT "dylib"
|
||||||
#define OPEN_COMMAND "open"
|
#define OPEN_COMMAND "open"
|
||||||
#else
|
#else
|
||||||
@@ -54,20 +50,33 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#define _inline static inline
|
#define _inline static inline
|
||||||
#define FORCEINLINE inline __attribute__((always_inline))
|
#define FORCEINLINE inline __attribute__((always_inline))
|
||||||
|
|
||||||
|
#if XASH_POSIX
|
||||||
|
#define PATH_SPLITTER "/"
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
#define O_BINARY 0 // O_BINARY is Windows extension
|
#define O_BINARY 0 // O_BINARY is Windows extension
|
||||||
#define O_TEXT 0 // O_TEXT is Windows extension
|
#define O_TEXT 0 // O_TEXT is Windows extension
|
||||||
|
// Windows functions to posix equivalent
|
||||||
// Windows functions to Linux equivalent
|
|
||||||
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
|
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
|
||||||
#define LoadLibrary( x ) dlopen( x, RTLD_NOW )
|
#define LoadLibrary( x ) dlopen( x, RTLD_NOW )
|
||||||
#define GetProcAddress( x, y ) dlsym( x, y )
|
#define GetProcAddress( x, y ) dlsym( x, y )
|
||||||
#define SetCurrentDirectory( x ) (!chdir( x ))
|
|
||||||
#define FreeLibrary( x ) dlclose( x )
|
#define FreeLibrary( x ) dlclose( x )
|
||||||
|
#define tell( a ) lseek(a, 0, SEEK_CUR)
|
||||||
|
#define HAVE_DUP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if XASH_DOS4GW
|
||||||
|
#define PATH_SPLITTER "\\"
|
||||||
|
#define LoadLibrary( x ) (0)
|
||||||
|
#define GetProcAddress( x, y ) (0)
|
||||||
|
#define FreeLibrary( x ) (0)
|
||||||
|
#endif
|
||||||
//#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))
|
//#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))
|
||||||
#define max( a, b ) (((a) > (b)) ? (a) : (b))
|
#define max( a, b ) (((a) > (b)) ? (a) : (b))
|
||||||
#define min( a, b ) (((a) < (b)) ? (a) : (b))
|
#define min( a, b ) (((a) < (b)) ? (a) : (b))
|
||||||
#define tell( a ) lseek(a, 0, SEEK_CUR)
|
|
||||||
|
|
||||||
|
/// TODO: check if we may clean this defines, it should not appear in non-platform code!
|
||||||
typedef unsigned char BYTE;
|
typedef unsigned char BYTE;
|
||||||
typedef short int WORD;
|
typedef short int WORD;
|
||||||
typedef unsigned int DWORD;
|
typedef unsigned int DWORD;
|
||||||
@@ -125,6 +134,8 @@ GNU General Public License for more details.
|
|||||||
// windows NameForFunction not implemented yet
|
// windows NameForFunction not implemented yet
|
||||||
#define XASH_ALLOW_SAVERESTORE_OFFSETS
|
#define XASH_ALLOW_SAVERESTORE_OFFSETS
|
||||||
#endif
|
#endif
|
||||||
|
#define HAVE_DUP
|
||||||
|
|
||||||
#endif //WIN32
|
#endif //WIN32
|
||||||
#ifndef XASH_LOW_MEMORY
|
#ifndef XASH_LOW_MEMORY
|
||||||
#define XASH_LOW_MEMORY 0
|
#define XASH_LOW_MEMORY 0
|
||||||
|
|||||||
+8
-6
@@ -111,16 +111,18 @@ typedef enum
|
|||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CONTEXT_TYPE_GL = 0,
|
CONTEXT_TYPE_GL = 0, // compatibility profile
|
||||||
CONTEXT_TYPE_GLES_1_X,
|
CONTEXT_TYPE_GLES_1_X,
|
||||||
CONTEXT_TYPE_GLES_2_X
|
CONTEXT_TYPE_GLES_2_X,
|
||||||
|
CONTEXT_TYPE_GL_CORE
|
||||||
} gl_context_type_t;
|
} gl_context_type_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GLES_WRAPPER_NONE = 0, // native GLES
|
GLES_WRAPPER_NONE = 0, // native GL
|
||||||
GLES_WRAPPER_NANOGL, // used on GLES platforms
|
GLES_WRAPPER_NANOGL, // used on GLES platforms
|
||||||
GLES_WRAPPER_WES, // used on GLES platforms
|
GLES_WRAPPER_WES, // used on GLES platforms
|
||||||
|
GLES_WRAPPER_GL4ES, // used on GLES platforms
|
||||||
} gles_wrapper_t;
|
} gles_wrapper_t;
|
||||||
|
|
||||||
// 30 bytes here
|
// 30 bytes here
|
||||||
@@ -190,9 +192,9 @@ typedef struct render_api_s
|
|||||||
|
|
||||||
// AVIkit support
|
// AVIkit support
|
||||||
void *(*AVI_LoadVideo)( const char *filename, qboolean load_audio );
|
void *(*AVI_LoadVideo)( const char *filename, qboolean load_audio );
|
||||||
int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration );
|
int (*AVI_GetVideoInfo)( void *Avi, int *xres, int *yres, float *duration ); // a1ba: changed longs to int
|
||||||
long (*AVI_GetVideoFrameNumber)( void *Avi, float time );
|
int (*AVI_GetVideoFrameNumber)( void *Avi, float time );
|
||||||
byte *(*AVI_GetVideoFrame)( void *Avi, long frame );
|
byte *(*AVI_GetVideoFrame)( void *Avi, int frame );
|
||||||
void (*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data );
|
void (*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data );
|
||||||
void (*AVI_FreeVideo)( void *Avi );
|
void (*AVI_FreeVideo)( void *Avi );
|
||||||
int (*AVI_IsActive)( void *Avi );
|
int (*AVI_IsActive)( void *Avi );
|
||||||
|
|||||||
+16
-6
@@ -12,16 +12,26 @@
|
|||||||
* without written permission from Valve LLC.
|
* without written permission from Valve LLC.
|
||||||
*
|
*
|
||||||
****/
|
****/
|
||||||
|
#pragma once
|
||||||
#ifndef STUDIO_EVENT_H
|
#ifndef STUDIO_EVENT_H
|
||||||
#define STUDIO_EVENT_H
|
#define STUDIO_EVENT_H
|
||||||
|
|
||||||
|
#define MAXEVENTSTRING 64
|
||||||
|
|
||||||
typedef struct mstudioevent_s
|
typedef struct mstudioevent_s
|
||||||
{
|
{
|
||||||
int frame;
|
// the frame at which this animation event occurs
|
||||||
int event;
|
int32_t frame;
|
||||||
int type;
|
|
||||||
char options[64];
|
// the script event type
|
||||||
|
int32_t event;
|
||||||
|
|
||||||
|
// was "type"
|
||||||
|
int32_t unused;
|
||||||
|
|
||||||
|
// options
|
||||||
|
// could be path to sound WAVE files
|
||||||
|
char options[MAXEVENTSTRING];
|
||||||
} mstudioevent_t;
|
} mstudioevent_t;
|
||||||
|
|
||||||
#endif//STUDIO_EVENT_H
|
#endif // STUDIO_EVENT_H
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
#include <sys/types.h> // off_t
|
#include <sys/types.h> // off_t
|
||||||
|
#include STDINT_H
|
||||||
|
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
typedef int sound_t;
|
typedef int sound_t;
|
||||||
@@ -19,6 +20,7 @@ typedef byte rgba_t[4]; // unsigned byte colorpack
|
|||||||
typedef byte rgb_t[3]; // unsigned byte colorpack
|
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];
|
||||||
|
typedef uint32_t poolhandle_t;
|
||||||
|
|
||||||
#undef true
|
#undef true
|
||||||
#undef false
|
#undef false
|
||||||
@@ -29,14 +31,7 @@ typedef enum { false, true } qboolean;
|
|||||||
typedef int qboolean;
|
typedef int qboolean;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER == 1200
|
typedef uint64_t longtime_t;
|
||||||
typedef __int64 integer64; //msvc6
|
|
||||||
#elif defined (XASH_SDL) && !defined(REF_DLL)
|
|
||||||
typedef Uint64 integer64;
|
|
||||||
#else
|
|
||||||
typedef unsigned long long integer64;
|
|
||||||
#endif
|
|
||||||
typedef integer64 longtime_t;
|
|
||||||
|
|
||||||
#define MAX_STRING 256 // generic string
|
#define MAX_STRING 256 // generic string
|
||||||
#define MAX_INFO_STRING 256 // infostrings are transmitted across network
|
#define MAX_INFO_STRING 256 // infostrings are transmitted across network
|
||||||
|
|||||||
+2
-2
@@ -285,9 +285,9 @@ typedef struct cl_enginefuncs_s
|
|||||||
const char *(*LocalPlayerInfo_ValueForKey)( const char* key );
|
const char *(*LocalPlayerInfo_ValueForKey)( const char* key );
|
||||||
int (*pfnVGUI2DrawCharacter)( int x, int y, int ch, unsigned int font );
|
int (*pfnVGUI2DrawCharacter)( int x, int y, int ch, unsigned int font );
|
||||||
int (*pfnVGUI2DrawCharacterAdditive)( int x, int y, int ch, int r, int g, int b, unsigned int font );
|
int (*pfnVGUI2DrawCharacterAdditive)( int x, int y, int ch, int r, int g, int b, unsigned int font );
|
||||||
unsigned int (*pfnGetApproxWavePlayLen)( char *filename );
|
unsigned int (*pfnGetApproxWavePlayLen)( const char *filename );
|
||||||
void* (*GetCareerGameUI)( void ); // g-cont. !!!! potential crash-point!
|
void* (*GetCareerGameUI)( void ); // g-cont. !!!! potential crash-point!
|
||||||
void (*Cvar_Set)( char *name, char *value );
|
void (*Cvar_Set)( const char *name, const char *value );
|
||||||
int (*pfnIsPlayingCareerMatch)( void );
|
int (*pfnIsPlayingCareerMatch)( void );
|
||||||
void (*pfnPlaySoundVoiceByName)( char *szSound, float volume, int pitch );
|
void (*pfnPlaySoundVoiceByName)( char *szSound, float volume, int pitch );
|
||||||
void (*pfnPrimeMusicStream)( char *filename, int looping );
|
void (*pfnPrimeMusicStream)( char *filename, int looping );
|
||||||
|
|||||||
+16
-16
@@ -59,14 +59,14 @@ dll_info_t msacm_dll = { "msacm32.dll", msacm_funcs, false };
|
|||||||
static int (_stdcall *pAVIStreamInfo)( PAVISTREAM pavi, AVISTREAMINFO *psi, LONG lSize );
|
static int (_stdcall *pAVIStreamInfo)( PAVISTREAM pavi, AVISTREAMINFO *psi, LONG lSize );
|
||||||
static int (_stdcall *pAVIStreamRead)( PAVISTREAM pavi, LONG lStart, LONG lSamples, void *lpBuffer, LONG cbBuffer, LONG *plBytes, LONG *plSamples );
|
static int (_stdcall *pAVIStreamRead)( PAVISTREAM pavi, LONG lStart, LONG lSamples, void *lpBuffer, LONG cbBuffer, LONG *plBytes, LONG *plSamples );
|
||||||
static PGETFRAME (_stdcall *pAVIStreamGetFrameOpen)( PAVISTREAM pavi, LPBITMAPINFOHEADER lpbiWanted );
|
static PGETFRAME (_stdcall *pAVIStreamGetFrameOpen)( PAVISTREAM pavi, LPBITMAPINFOHEADER lpbiWanted );
|
||||||
static long (_stdcall *pAVIStreamTimeToSample)( PAVISTREAM pavi, LONG lTime );
|
static int (_stdcall *pAVIStreamTimeToSample)( PAVISTREAM pavi, LONG lTime );
|
||||||
static void* (_stdcall *pAVIStreamGetFrame)( PGETFRAME pg, LONG lPos );
|
static void* (_stdcall *pAVIStreamGetFrame)( PGETFRAME pg, LONG lPos );
|
||||||
static int (_stdcall *pAVIStreamGetFrameClose)( PGETFRAME pg );
|
static int (_stdcall *pAVIStreamGetFrameClose)( PGETFRAME pg );
|
||||||
static dword (_stdcall *pAVIStreamRelease)( PAVISTREAM pavi );
|
static dword (_stdcall *pAVIStreamRelease)( PAVISTREAM pavi );
|
||||||
static int (_stdcall *pAVIFileOpen)( PAVIFILE *ppfile, LPCSTR szFile, UINT uMode, LPCLSID lpHandler );
|
static int (_stdcall *pAVIFileOpen)( PAVIFILE *ppfile, LPCSTR szFile, UINT uMode, LPCLSID lpHandler );
|
||||||
static int (_stdcall *pAVIFileGetStream)( PAVIFILE pfile, PAVISTREAM *ppavi, DWORD fccType, LONG lParam );
|
static int (_stdcall *pAVIFileGetStream)( PAVIFILE pfile, PAVISTREAM *ppavi, DWORD fccType, LONG lParam );
|
||||||
static int (_stdcall *pAVIStreamReadFormat)( PAVISTREAM pavi, LONG lPos,LPVOID lpFormat, LONG *lpcbFormat );
|
static int (_stdcall *pAVIStreamReadFormat)( PAVISTREAM pavi, LONG lPos,LPVOID lpFormat, LONG *lpcbFormat );
|
||||||
static long (_stdcall *pAVIStreamStart)( PAVISTREAM pavi );
|
static int (_stdcall *pAVIStreamStart)( PAVISTREAM pavi );
|
||||||
static dword (_stdcall *pAVIFileRelease)( PAVIFILE pfile );
|
static dword (_stdcall *pAVIFileRelease)( PAVIFILE pfile );
|
||||||
static void (_stdcall *pAVIFileInit)( void );
|
static void (_stdcall *pAVIFileInit)( void );
|
||||||
static void (_stdcall *pAVIFileExit)( void );
|
static void (_stdcall *pAVIFileExit)( void );
|
||||||
@@ -100,17 +100,17 @@ typedef struct movie_state_s
|
|||||||
PAVIFILE pfile; // avi file pointer
|
PAVIFILE pfile; // avi file pointer
|
||||||
PAVISTREAM video_stream; // video stream pointer
|
PAVISTREAM video_stream; // video stream pointer
|
||||||
PGETFRAME video_getframe; // pointer to getframe object for video stream
|
PGETFRAME video_getframe; // pointer to getframe object for video stream
|
||||||
long video_frames; // total frames
|
int video_frames; // total frames
|
||||||
long video_xres; // video stream resolution
|
int video_xres; // video stream resolution
|
||||||
long video_yres;
|
int video_yres;
|
||||||
float video_fps; // video stream fps
|
float video_fps; // video stream fps
|
||||||
|
|
||||||
PAVISTREAM audio_stream; // audio stream pointer
|
PAVISTREAM audio_stream; // audio stream pointer
|
||||||
WAVEFORMAT *audio_header; // audio stream header
|
WAVEFORMAT *audio_header; // audio stream header
|
||||||
long audio_header_size; // WAVEFORMAT is returned for PCM data; WAVEFORMATEX for others
|
int audio_header_size; // WAVEFORMAT is returned for PCM data; WAVEFORMATEX for others
|
||||||
long audio_codec; // WAVE_FORMAT_PCM is oldstyle: anything else needs conversion
|
int audio_codec; // WAVE_FORMAT_PCM is oldstyle: anything else needs conversion
|
||||||
long audio_length; // in converted samples
|
int audio_length; // in converted samples
|
||||||
long audio_bytes_per_sample; // guess.
|
int audio_bytes_per_sample; // guess.
|
||||||
|
|
||||||
// compressed audio specific data
|
// compressed audio specific data
|
||||||
dword cpa_blockalign; // block size to read
|
dword cpa_blockalign; // block size to read
|
||||||
@@ -296,7 +296,7 @@ int AVI_TimeToSoundPosition( movie_state_t *Avi, int time )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// gets the raw frame data
|
// gets the raw frame data
|
||||||
byte *AVI_GetVideoFrame( movie_state_t *Avi, long frame )
|
byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame )
|
||||||
{
|
{
|
||||||
LPBITMAPINFOHEADER frame_info;
|
LPBITMAPINFOHEADER frame_info;
|
||||||
byte *frame_raw;
|
byte *frame_raw;
|
||||||
@@ -385,7 +385,7 @@ qboolean AVI_SeekPosition( movie_state_t *Avi, dword offset )
|
|||||||
// get a chunk of audio from the stream (in bytes)
|
// get a chunk of audio from the stream (in bytes)
|
||||||
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length )
|
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length )
|
||||||
{
|
{
|
||||||
long result = 0;
|
int result = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// zero data past the end of the file
|
// zero data past the end of the file
|
||||||
@@ -393,7 +393,7 @@ int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int leng
|
|||||||
{
|
{
|
||||||
if( offset <= Avi->audio_length )
|
if( offset <= Avi->audio_length )
|
||||||
{
|
{
|
||||||
long remaining_length = Avi->audio_length - offset;
|
int remaining_length = Avi->audio_length - offset;
|
||||||
|
|
||||||
AVI_GetAudioChunk( Avi, audiodata, offset, remaining_length );
|
AVI_GetAudioChunk( Avi, audiodata, offset, remaining_length );
|
||||||
|
|
||||||
@@ -428,7 +428,7 @@ int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int leng
|
|||||||
|
|
||||||
while( length > 0 )
|
while( length > 0 )
|
||||||
{
|
{
|
||||||
long blockread = Avi->cpa_conversion_header.cbDstLengthUsed - Avi->cpa_blockpos;
|
int blockread = Avi->cpa_conversion_header.cbDstLengthUsed - Avi->cpa_blockpos;
|
||||||
|
|
||||||
if( blockread <= 0 ) // read next
|
if( blockread <= 0 ) // read next
|
||||||
{
|
{
|
||||||
@@ -491,7 +491,7 @@ void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audi
|
|||||||
{
|
{
|
||||||
BITMAPINFOHEADER bmih;
|
BITMAPINFOHEADER bmih;
|
||||||
AVISTREAMINFO stream_info;
|
AVISTREAMINFO stream_info;
|
||||||
long opened_streams = 0;
|
int opened_streams = 0;
|
||||||
LONG hr;
|
LONG hr;
|
||||||
|
|
||||||
// default state: non-working.
|
// default state: non-working.
|
||||||
@@ -558,7 +558,7 @@ void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audi
|
|||||||
}
|
}
|
||||||
else if( stream_info.fccType == streamtypeAUDIO && Avi->audio_stream == NULL && load_audio )
|
else if( stream_info.fccType == streamtypeAUDIO && Avi->audio_stream == NULL && load_audio )
|
||||||
{
|
{
|
||||||
long size;
|
int size;
|
||||||
|
|
||||||
Avi->audio_stream = stream;
|
Avi->audio_stream = stream;
|
||||||
|
|
||||||
@@ -571,7 +571,7 @@ void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audi
|
|||||||
Avi->audio_codec = Avi->audio_header->wFormatTag;
|
Avi->audio_codec = Avi->audio_header->wFormatTag;
|
||||||
|
|
||||||
// length of converted audio in samples
|
// length of converted audio in samples
|
||||||
Avi->audio_length = (long)((float)stream_info.dwLength / Avi->audio_header->nAvgBytesPerSec );
|
Avi->audio_length = (int)((float)stream_info.dwLength / Avi->audio_header->nAvgBytesPerSec );
|
||||||
Avi->audio_length *= Avi->audio_header->nSamplesPerSec;
|
Avi->audio_length *= Avi->audio_header->nSamplesPerSec;
|
||||||
|
|
||||||
if( Avi->audio_codec != WAVE_FORMAT_PCM )
|
if( Avi->audio_codec != WAVE_FORMAT_PCM )
|
||||||
|
|||||||
+33
-4
@@ -126,7 +126,7 @@ void CL_PlayCDTrack_f( void )
|
|||||||
int i, maxTrack;
|
int i, maxTrack;
|
||||||
|
|
||||||
for( maxTrack = i = 0; i < MAX_CDTRACKS; i++ )
|
for( maxTrack = i = 0; i < MAX_CDTRACKS; i++ )
|
||||||
if( Q_strlen( clgame.cdtracks[i] )) maxTrack++;
|
if( COM_CheckStringEmpty( clgame.cdtracks[i] ) ) maxTrack++;
|
||||||
|
|
||||||
Con_Printf( "%u tracks\n", maxTrack );
|
Con_Printf( "%u tracks\n", maxTrack );
|
||||||
if( track )
|
if( track )
|
||||||
@@ -153,7 +153,7 @@ qboolean CL_ScreenshotGetName( int lastnum, char *filename )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_sprintf( filename, "scrshots/%s_shot%0004d.png", clgame.mapname, lastnum );
|
Q_sprintf( filename, "scrshots/%s_shot%04d.png", clgame.mapname, lastnum );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ qboolean CL_SnapshotGetName( int lastnum, char *filename )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_sprintf( filename, "../%s_%0004d.png", clgame.mapname, lastnum );
|
Q_sprintf( filename, "../%s_%04d.png", clgame.mapname, lastnum );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -360,7 +360,7 @@ void CL_SaveShot_f( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_sprintf( cls.shotname, "%s%s.bmp", DEFAULT_SAVE_DIRECTORY, Cmd_Argv( 1 ));
|
Q_sprintf( cls.shotname, DEFAULT_SAVE_DIRECTORY "%s.bmp", Cmd_Argv( 1 ));
|
||||||
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
|
cls.scrshot_action = scrshot_savegame; // build new frame for saveshot
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,3 +418,32 @@ void SCR_Viewpos_f( void )
|
|||||||
Con_Printf( "org ( %g %g %g )\n", refState.vieworg[0], refState.vieworg[1], refState.vieworg[2] );
|
Con_Printf( "org ( %g %g %g )\n", refState.vieworg[0], refState.vieworg[1], refState.vieworg[2] );
|
||||||
Con_Printf( "ang ( %g %g %g )\n", refState.viewangles[0], refState.viewangles[1], refState.viewangles[2] );
|
Con_Printf( "ang ( %g %g %g )\n", refState.viewangles[0], refState.viewangles[1], refState.viewangles[2] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
CL_WavePlayLen_f
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
void CL_WavePlayLen_f( void )
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
uint msecs;
|
||||||
|
|
||||||
|
if( Cmd_Argc() != 2 )
|
||||||
|
{
|
||||||
|
Con_Printf( "waveplaylen <wave file name>: returns approximate number of milliseconds a wave file will take to play.\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
name = Cmd_Argv( 1 );
|
||||||
|
msecs = Sound_GetApproxWavePlayLen( name );
|
||||||
|
|
||||||
|
if( msecs == 0 )
|
||||||
|
{
|
||||||
|
Con_Printf( "Unable to read %s, file may be missing or incorrectly formatted.\n", name );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Con_Printf( "Play time is approximately %dms\n", msecs );
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( pResource->type == t_sound )
|
if( pResource->type == t_sound )
|
||||||
Q_strncpy( filepath, va( "%s%s", DEFAULT_SOUNDPATH, pResource->szFileName ), sizeof( filepath ));
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", pResource->szFileName );
|
||||||
else Q_strncpy( filepath, pResource->szFileName, sizeof( filepath ));
|
else Q_strncpy( filepath, pResource->szFileName, sizeof( filepath ));
|
||||||
|
|
||||||
if( !COM_IsSafeFileToDownload( filepath ))
|
if( !COM_IsSafeFileToDownload( filepath ))
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ const char *svc_strings[svc_lastmsg+1] =
|
|||||||
"svc_resourcelocation",
|
"svc_resourcelocation",
|
||||||
"svc_querycvarvalue",
|
"svc_querycvarvalue",
|
||||||
"svc_querycvarvalue2",
|
"svc_querycvarvalue2",
|
||||||
|
"svc_exec",
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|||||||
+19
-12
@@ -371,7 +371,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 = PROTOCOL_VERSION;
|
demo.header.net_protocol = cls.legacymode ? PROTOCOL_LEGACY_VERSION : PROTOCOL_VERSION;
|
||||||
demo.header.host_fps = bound( MIN_FPS, host_maxfps->value, MAX_FPS );
|
demo.header.host_fps = bound( MIN_FPS, host_maxfps->value, 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 ));
|
||||||
@@ -1171,7 +1171,7 @@ void CL_StopPlayback( void )
|
|||||||
CL_GetDemoComment
|
CL_GetDemoComment
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
int CL_GetDemoComment( const char *demoname, char *comment )
|
int GAME_EXPORT CL_GetDemoComment( const char *demoname, char *comment )
|
||||||
{
|
{
|
||||||
file_t *demfile;
|
file_t *demfile;
|
||||||
demoheader_t demohdr;
|
demoheader_t demohdr;
|
||||||
@@ -1185,7 +1185,7 @@ int CL_GetDemoComment( const char *demoname, char *comment )
|
|||||||
demfile = FS_Open( demoname, "rb", false );
|
demfile = FS_Open( demoname, "rb", false );
|
||||||
if( !demfile )
|
if( !demfile )
|
||||||
{
|
{
|
||||||
Q_strncpy( comment, "", MAX_STRING );
|
comment[0] = '\0';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1199,7 +1199,9 @@ int CL_GetDemoComment( const char *demoname, char *comment )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( demohdr.net_protocol != PROTOCOL_VERSION || demohdr.dem_protocol != DEMO_PROTOCOL )
|
if(( demohdr.net_protocol != PROTOCOL_VERSION &&
|
||||||
|
demohdr.net_protocol != PROTOCOL_LEGACY_VERSION ) ||
|
||||||
|
demohdr.dem_protocol != DEMO_PROTOCOL )
|
||||||
{
|
{
|
||||||
FS_Close( demfile );
|
FS_Close( demfile );
|
||||||
Q_strncpy( comment, "<invalid protocol>", MAX_STRING );
|
Q_strncpy( comment, "<invalid protocol>", MAX_STRING );
|
||||||
@@ -1226,7 +1228,7 @@ int CL_GetDemoComment( const char *demoname, char *comment )
|
|||||||
// split comment to sections
|
// split comment to sections
|
||||||
Q_strncpy( comment, demohdr.mapname, CS_SIZE );
|
Q_strncpy( comment, demohdr.mapname, CS_SIZE );
|
||||||
Q_strncpy( comment + CS_SIZE, demohdr.comment, CS_SIZE );
|
Q_strncpy( comment + CS_SIZE, demohdr.comment, CS_SIZE );
|
||||||
Q_strncpy( comment + CS_SIZE * 2, va( "%g sec", playtime ), CS_TIME );
|
Q_snprintf( comment + CS_SIZE * 2, CS_TIME, "%g sec", playtime );
|
||||||
|
|
||||||
// all done
|
// all done
|
||||||
FS_Close( demfile );
|
FS_Close( demfile );
|
||||||
@@ -1311,7 +1313,7 @@ static void CL_DemoGetName( int lastnum, char *filename )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_sprintf( filename, "demo%0004d", lastnum );
|
Q_sprintf( filename, "demo%04d", lastnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1381,7 +1383,7 @@ void CL_Record_f( void )
|
|||||||
// open the demo file
|
// open the demo file
|
||||||
Q_sprintf( demopath, "%s.dem", demoname );
|
Q_sprintf( demopath, "%s.dem", demoname );
|
||||||
|
|
||||||
// make sure what old demo is removed
|
// make sure that old demo is removed
|
||||||
if( FS_FileExists( demopath, false ))
|
if( FS_FileExists( demopath, false ))
|
||||||
FS_Delete( demopath );
|
FS_Delete( demopath );
|
||||||
|
|
||||||
@@ -1476,13 +1478,17 @@ void CL_PlayDemo_f( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( demo.header.net_protocol != PROTOCOL_VERSION || demo.header.dem_protocol != DEMO_PROTOCOL )
|
if( demo.header.dem_protocol != DEMO_PROTOCOL )
|
||||||
{
|
{
|
||||||
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 );
|
||||||
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 )
|
if( demo.header.net_protocol != PROTOCOL_VERSION &&
|
||||||
Con_Printf( S_ERROR "playdemo: net protocol outdated (%i should be %i)\n", 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();
|
CL_DemoAborted();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1515,6 +1521,7 @@ void CL_PlayDemo_f( void )
|
|||||||
|
|
||||||
// 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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ GNU General Public License for more details.
|
|||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
#include "world.h" // BOX_ON_PLANE_SIDE
|
#include "world.h" // BOX_ON_PLANE_SIDE
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============================================================================
|
===============================================================================
|
||||||
|
|||||||
+44
-43
@@ -39,7 +39,7 @@ R_LookupColor
|
|||||||
find nearest color in particle palette
|
find nearest color in particle palette
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
short R_LookupColor( byte r, byte g, byte b )
|
short GAME_EXPORT R_LookupColor( byte r, byte g, byte b )
|
||||||
{
|
{
|
||||||
int i, best;
|
int i, best;
|
||||||
float diff, bestdiff;
|
float diff, bestdiff;
|
||||||
@@ -74,7 +74,7 @@ R_GetPackedColor
|
|||||||
in hardware mode does nothing
|
in hardware mode does nothing
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void R_GetPackedColor( short *packed, short color )
|
void GAME_EXPORT R_GetPackedColor( short *packed, short color )
|
||||||
{
|
{
|
||||||
if( packed ) *packed = 0;
|
if( packed ) *packed = 0;
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ R_AllocParticle
|
|||||||
can return NULL if particles is out
|
can return NULL if particles is out
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
particle_t *R_AllocParticle( void (*callback)( particle_t*, float ))
|
particle_t * GAME_EXPORT R_AllocParticle( void (*callback)( particle_t*, float ))
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
|
|
||||||
@@ -513,19 +513,19 @@ void CL_ReadLineFile_f( void )
|
|||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
p1[0] = Q_atof( token );
|
p1[0] = Q_atof( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
p1[1] = Q_atof( token );
|
p1[1] = Q_atof( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
p1[2] = Q_atof( token );
|
p1[2] = Q_atof( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
|
|
||||||
if( token[0] != '-' )
|
if( token[0] != '-' )
|
||||||
@@ -534,15 +534,15 @@ void CL_ReadLineFile_f( void )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
p2[0] = Q_atof( token );
|
p2[0] = Q_atof( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
p2[1] = Q_atof( token );
|
p2[1] = Q_atof( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
p2[2] = Q_atof( token );
|
p2[2] = Q_atof( token );
|
||||||
|
|
||||||
@@ -654,7 +654,7 @@ Remove beam attached to specified entity
|
|||||||
and all particle trails (if this is a beamfollow)
|
and all particle trails (if this is a beamfollow)
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_BeamKill( int deadEntity )
|
void GAME_EXPORT R_BeamKill( int deadEntity )
|
||||||
{
|
{
|
||||||
cl_entity_t *pDeadEntity;
|
cl_entity_t *pDeadEntity;
|
||||||
|
|
||||||
@@ -828,7 +828,7 @@ R_BeamEnts
|
|||||||
Create beam between two ents
|
Create beam between two ents
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
BEAM *R_BeamEnts( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness,
|
BEAM * GAME_EXPORT R_BeamEnts( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness,
|
||||||
float speed, int startFrame, float framerate, float r, float g, float b )
|
float speed, int startFrame, float framerate, float r, float g, float b )
|
||||||
{
|
{
|
||||||
cl_entity_t *start, *end;
|
cl_entity_t *start, *end;
|
||||||
@@ -873,7 +873,7 @@ R_BeamPoints
|
|||||||
Create beam between two points
|
Create beam between two points
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
BEAM *R_BeamPoints( vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude,
|
BEAM * GAME_EXPORT R_BeamPoints( vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude,
|
||||||
float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
|
float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
|
||||||
{
|
{
|
||||||
BEAM *pbeam;
|
BEAM *pbeam;
|
||||||
@@ -904,7 +904,7 @@ R_BeamCirclePoints
|
|||||||
Create beam cicrle
|
Create beam cicrle
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
BEAM *R_BeamCirclePoints( int type, vec3_t start, vec3_t end, int modelIndex, float life, float width,
|
BEAM * GAME_EXPORT R_BeamCirclePoints( int type, vec3_t start, vec3_t end, int modelIndex, float life, float width,
|
||||||
float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
|
float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
|
||||||
{
|
{
|
||||||
BEAM *pbeam = R_BeamLightning( start, end, modelIndex, life, width, amplitude, brightness, speed );
|
BEAM *pbeam = R_BeamLightning( start, end, modelIndex, life, width, amplitude, brightness, speed );
|
||||||
@@ -925,7 +925,7 @@ R_BeamEntPoint
|
|||||||
Create beam between entity and point
|
Create beam between entity and point
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
BEAM *R_BeamEntPoint( int startEnt, vec3_t end, int modelIndex, float life, float width, float amplitude,
|
BEAM *GAME_EXPORT R_BeamEntPoint( int startEnt, vec3_t end, int modelIndex, float life, float width, float amplitude,
|
||||||
float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
|
float brightness, float speed, int startFrame, float framerate, float r, float g, float b )
|
||||||
{
|
{
|
||||||
BEAM *pbeam;
|
BEAM *pbeam;
|
||||||
@@ -965,7 +965,7 @@ R_BeamRing
|
|||||||
Create beam between two ents
|
Create beam between two ents
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
BEAM *R_BeamRing( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness,
|
BEAM * GAME_EXPORT R_BeamRing( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness,
|
||||||
float speed, int startFrame, float framerate, float r, float g, float b )
|
float speed, int startFrame, float framerate, float r, float g, float b )
|
||||||
{
|
{
|
||||||
BEAM *pbeam;
|
BEAM *pbeam;
|
||||||
@@ -1001,7 +1001,7 @@ R_BeamFollow
|
|||||||
Create beam following with entity
|
Create beam following with entity
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
BEAM *R_BeamFollow( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness )
|
BEAM *GAME_EXPORT R_BeamFollow( int startEnt, int modelIndex, float life, float width, float r, float g, float b, float brightness )
|
||||||
{
|
{
|
||||||
BEAM *pbeam = R_BeamAlloc();
|
BEAM *pbeam = R_BeamAlloc();
|
||||||
|
|
||||||
@@ -1030,7 +1030,7 @@ R_BeamLightning
|
|||||||
template for new beams
|
template for new beams
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
BEAM *R_BeamLightning( vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed )
|
BEAM *GAME_EXPORT R_BeamLightning( vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed )
|
||||||
{
|
{
|
||||||
BEAM *pbeam = R_BeamAlloc();
|
BEAM *pbeam = R_BeamAlloc();
|
||||||
|
|
||||||
@@ -1054,7 +1054,7 @@ R_EntityParticles
|
|||||||
set EF_BRIGHTFIELD effect
|
set EF_BRIGHTFIELD effect
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_EntityParticles( cl_entity_t *ent )
|
void GAME_EXPORT R_EntityParticles( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
float angle;
|
float angle;
|
||||||
float sr, sp, sy, cr, cp, cy;
|
float sr, sp, sy, cr, cp, cy;
|
||||||
@@ -1089,7 +1089,7 @@ R_ParticleExplosion
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_ParticleExplosion( const vec3_t org )
|
void GAME_EXPORT R_ParticleExplosion( const vec3_t org )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -1120,7 +1120,7 @@ R_ParticleExplosion2
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_ParticleExplosion2( const vec3_t org, int colorStart, int colorLength )
|
void GAME_EXPORT R_ParticleExplosion2( const vec3_t org, int colorStart, int colorLength )
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int colorMod = 0;
|
int colorMod = 0;
|
||||||
@@ -1152,7 +1152,7 @@ R_BlobExplosion
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_BlobExplosion( const vec3_t org )
|
void GAME_EXPORT R_BlobExplosion( const vec3_t org )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -1191,7 +1191,7 @@ ParticleEffect
|
|||||||
PARTICLE_EFFECT on server
|
PARTICLE_EFFECT on server
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_RunParticleEffect( const vec3_t org, const vec3_t dir, int color, int count )
|
void GAME_EXPORT R_RunParticleEffect( const vec3_t org, const vec3_t dir, int color, int count )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
int i;
|
int i;
|
||||||
@@ -1224,7 +1224,7 @@ R_Blood
|
|||||||
particle spray
|
particle spray
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_Blood( const vec3_t org, const vec3_t ndir, int pcolor, int speed )
|
void GAME_EXPORT R_Blood( const vec3_t org, const vec3_t ndir, int pcolor, int speed )
|
||||||
{
|
{
|
||||||
vec3_t pos, dir, vec;
|
vec3_t pos, dir, vec;
|
||||||
float pspeed = speed * 3.0f;
|
float pspeed = speed * 3.0f;
|
||||||
@@ -1260,7 +1260,7 @@ R_BloodStream
|
|||||||
particle spray 2
|
particle spray 2
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_BloodStream( const vec3_t org, const vec3_t dir, int pcolor, int speed )
|
void GAME_EXPORT R_BloodStream( const vec3_t org, const vec3_t dir, int pcolor, int speed )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
int i, j;
|
int i, j;
|
||||||
@@ -1337,7 +1337,7 @@ R_LavaSplash
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_LavaSplash( const vec3_t org )
|
void GAME_EXPORT R_LavaSplash( const vec3_t org )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
float vel;
|
float vel;
|
||||||
@@ -1379,7 +1379,7 @@ R_ParticleBurst
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_ParticleBurst( const vec3_t org, int size, int color, float life )
|
void GAME_EXPORT R_ParticleBurst( const vec3_t org, int size, int color, float life )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
vec3_t dir, dest;
|
vec3_t dir, dest;
|
||||||
@@ -1412,7 +1412,7 @@ R_LargeFunnel
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_LargeFunnel( const vec3_t org, int reverse )
|
void GAME_EXPORT R_LargeFunnel( const vec3_t org, int reverse )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
float vel, dist;
|
float vel, dist;
|
||||||
@@ -1459,7 +1459,7 @@ R_TeleportSplash
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_TeleportSplash( const vec3_t org )
|
void GAME_EXPORT R_TeleportSplash( const vec3_t org )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
vec3_t dir;
|
vec3_t dir;
|
||||||
@@ -1501,7 +1501,7 @@ R_RocketTrail
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_RocketTrail( vec3_t start, vec3_t end, int type )
|
void GAME_EXPORT R_RocketTrail( vec3_t start, vec3_t end, int type )
|
||||||
{
|
{
|
||||||
vec3_t vec, right, up;
|
vec3_t vec, right, up;
|
||||||
static int tracercount;
|
static int tracercount;
|
||||||
@@ -1620,7 +1620,7 @@ R_ParticleLine
|
|||||||
|
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void R_ParticleLine( const vec3_t start, const vec3_t end, byte r, byte g, byte b, float life )
|
void GAME_EXPORT R_ParticleLine( const vec3_t start, const vec3_t end, byte r, byte g, byte b, float life )
|
||||||
{
|
{
|
||||||
int pcolor;
|
int pcolor;
|
||||||
|
|
||||||
@@ -1634,7 +1634,7 @@ R_ParticleBox
|
|||||||
|
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void R_ParticleBox( const vec3_t absmin, const vec3_t absmax, byte r, byte g, byte b, float life )
|
void GAME_EXPORT R_ParticleBox( const vec3_t absmin, const vec3_t absmax, byte r, byte g, byte b, float life )
|
||||||
{
|
{
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
@@ -1655,7 +1655,7 @@ R_ShowLine
|
|||||||
|
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void R_ShowLine( const vec3_t start, const vec3_t end )
|
void GAME_EXPORT R_ShowLine( const vec3_t start, const vec3_t end )
|
||||||
{
|
{
|
||||||
vec3_t dir, org;
|
vec3_t dir, org;
|
||||||
float len;
|
float len;
|
||||||
@@ -1687,7 +1687,7 @@ R_BulletImpactParticles
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_BulletImpactParticles( const vec3_t pos )
|
void GAME_EXPORT R_BulletImpactParticles( const vec3_t pos )
|
||||||
{
|
{
|
||||||
int i, quantity;
|
int i, quantity;
|
||||||
int color;
|
int color;
|
||||||
@@ -1729,7 +1729,7 @@ R_FlickerParticles
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_FlickerParticles( const vec3_t org )
|
void GAME_EXPORT R_FlickerParticles( const vec3_t org )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
int i;
|
int i;
|
||||||
@@ -1757,7 +1757,7 @@ R_StreakSplash
|
|||||||
create a splash of streaks
|
create a splash of streaks
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_StreakSplash( const vec3_t pos, const vec3_t dir, int color, int count, float speed, int velocityMin, int velocityMax )
|
void GAME_EXPORT R_StreakSplash( const vec3_t pos, const vec3_t dir, int color, int count, float speed, int velocityMin, int velocityMax )
|
||||||
{
|
{
|
||||||
vec3_t vel, vel2;
|
vec3_t vel, vel2;
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
@@ -1822,7 +1822,7 @@ R_TracerEffect
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_TracerEffect( const vec3_t start, const vec3_t end )
|
void GAME_EXPORT R_TracerEffect( const vec3_t start, const vec3_t end )
|
||||||
{
|
{
|
||||||
vec3_t pos, vel, dir;
|
vec3_t pos, vel, dir;
|
||||||
float len, speed;
|
float len, speed;
|
||||||
@@ -1849,7 +1849,7 @@ R_UserTracerParticle
|
|||||||
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_UserTracerParticle( float *org, float *vel, float life, int colorIndex, float length, byte deathcontext, void (*deathfunc)( particle_t *p ))
|
void GAME_EXPORT R_UserTracerParticle( float *org, float *vel, float life, int colorIndex, float length, byte deathcontext, void (*deathfunc)( particle_t *p ))
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
|
|
||||||
@@ -1884,7 +1884,7 @@ R_SparkStreaks
|
|||||||
create a streak tracers
|
create a streak tracers
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_SparkStreaks( const vec3_t pos, int count, int velocityMin, int velocityMax )
|
void GAME_EXPORT R_SparkStreaks( const vec3_t pos, int count, int velocityMin, int velocityMax )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
vec3_t vel;
|
vec3_t vel;
|
||||||
@@ -1912,7 +1912,7 @@ R_Implosion
|
|||||||
make implosion tracers
|
make implosion tracers
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_Implosion( const vec3_t end, float radius, int count, float life )
|
void GAME_EXPORT R_Implosion( const vec3_t end, float radius, int count, float life )
|
||||||
{
|
{
|
||||||
float dist = ( radius / 100.0f );
|
float dist = ( radius / 100.0f );
|
||||||
vec3_t start, temp, vel;
|
vec3_t start, temp, vel;
|
||||||
@@ -2020,15 +2020,15 @@ void CL_ReadPointFile_f( void )
|
|||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
org[0] = Q_atof( token );
|
org[0] = Q_atof( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
org[1] = Q_atof( token );
|
org[1] = Q_atof( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !pfile ) break;
|
if( !pfile ) break;
|
||||||
org[2] = Q_atof( token );
|
org[2] = Q_atof( token );
|
||||||
|
|
||||||
@@ -2152,6 +2152,7 @@ void CL_ThinkParticle( double frametime, particle_t *p )
|
|||||||
p->vel[2] -= grav;
|
p->vel[2] -= grav;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// intentionally fallthrough
|
||||||
case pt_blob2:
|
case pt_blob2:
|
||||||
if( p->packedColor == 255 )
|
if( p->packedColor == 255 )
|
||||||
{
|
{
|
||||||
|
|||||||
+37
-12
@@ -78,23 +78,48 @@ CL_DescribeEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_DescribeEvent( int slot, int flags, const char *eventname )
|
void CL_DescribeEvent( event_info_t *ei, int slot )
|
||||||
{
|
{
|
||||||
int idx = (slot & 31);
|
int idx = (slot & 63) * 2;
|
||||||
con_nprint_t info;
|
con_nprint_t info;
|
||||||
|
string origin_str = { 0 }; //, angles_str = { 0 };
|
||||||
|
|
||||||
if( !eventname || !cl_showevents->value )
|
if( !cl_showevents->value )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// mark reliable as green and unreliable as red
|
info.time_to_live = 1.0f;
|
||||||
if( FBitSet( flags, FEV_RELIABLE ))
|
|
||||||
VectorSet( info.color, 0.0f, 1.0f, 0.0f );
|
|
||||||
else VectorSet( info.color, 1.0f, 0.0f, 0.0f );
|
|
||||||
|
|
||||||
info.time_to_live = 0.5f;
|
|
||||||
info.index = idx;
|
info.index = idx;
|
||||||
|
|
||||||
Con_NXPrintf( &info, "%i %f %s", slot, cl.time, eventname );
|
// mark reliable as green and unreliable as red
|
||||||
|
if( FBitSet( ei->flags, FEV_RELIABLE ))
|
||||||
|
VectorSet( info.color, 0.5f, 1.0f, 0.5f );
|
||||||
|
else VectorSet( info.color, 1.0f, 0.5f, 0.5f );
|
||||||
|
|
||||||
|
if( !VectorIsNull( ei->args.origin ))
|
||||||
|
{
|
||||||
|
Q_snprintf( origin_str, sizeof( origin_str ), "(%.2f,%.2f,%.2f)",
|
||||||
|
ei->args.origin[0], ei->args.origin[1], ei->args.origin[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if( !VectorIsNull( ei->args.angles ))
|
||||||
|
{
|
||||||
|
Q_snprintf( angles_str, sizeof( angles_str ), "ang %.2f %.2f %.2f",
|
||||||
|
ei->args.angles[0], ei->args.angles[1], ei->args.angles[2]);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
Con_NXPrintf( &info, "%i %.2f %c %s %s",
|
||||||
|
slot, cl.time,
|
||||||
|
(FBitSet( ei->flags, FEV_CLIENT ) ? 'c' :
|
||||||
|
FBitSet( ei->flags, FEV_SERVER ) ? 's' : '?'),
|
||||||
|
cl.event_precache[ei->index],
|
||||||
|
origin_str);
|
||||||
|
|
||||||
|
info.index++;
|
||||||
|
|
||||||
|
Con_NXPrintf( &info, "b(%i,%i) i(%i,%i) f(%.2f,%.2f)",
|
||||||
|
ei->args.bparam1, ei->args.bparam2,
|
||||||
|
ei->args.iparam1, ei->args.iparam2,
|
||||||
|
ei->args.fparam1, ei->args.fparam2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -202,7 +227,7 @@ qboolean CL_FireEvent( event_info_t *ei, int slot )
|
|||||||
{
|
{
|
||||||
if( ev->func )
|
if( ev->func )
|
||||||
{
|
{
|
||||||
CL_DescribeEvent( slot, ei->flags, cl.event_precache[ei->index] );
|
CL_DescribeEvent( ei, slot );
|
||||||
ev->func( &ei->args );
|
ev->func( &ei->args );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -450,7 +475,7 @@ CL_PlaybackEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
|
void GAME_EXPORT 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 )
|
||||||
{
|
{
|
||||||
event_args_t args;
|
event_args_t args;
|
||||||
|
|||||||
+29
-14
@@ -131,6 +131,9 @@ some ents will be ignore lerping
|
|||||||
*/
|
*/
|
||||||
qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
qboolean CL_EntityIgnoreLerp( cl_entity_t *e )
|
||||||
{
|
{
|
||||||
|
if( cl_nointerp->value > 0.f )
|
||||||
|
return true;
|
||||||
|
|
||||||
if( e->model && e->model->type == mod_alias )
|
if( e->model && e->model->type == mod_alias )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -529,6 +532,13 @@ void CL_ComputePlayerOrigin( cl_entity_t *ent )
|
|||||||
if( !ent->player || ent->index == ( cl.playernum + 1 ))
|
if( !ent->player || ent->index == ( cl.playernum + 1 ))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if( cl_nointerp->value > 0.f )
|
||||||
|
{
|
||||||
|
VectorCopy( ent->curstate.angles, ent->angles );
|
||||||
|
VectorCopy( ent->curstate.origin, ent->origin );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( cls.demoplayback == DEMO_QUAKE1 )
|
if( cls.demoplayback == DEMO_QUAKE1 )
|
||||||
{
|
{
|
||||||
// quake lerping is easy
|
// quake lerping is easy
|
||||||
@@ -1368,17 +1378,19 @@ qboolean CL_GetEntitySpatialization( channel_t *ch )
|
|||||||
ent = CL_GetEntityByIndex( ch->entnum );
|
ent = CL_GetEntityByIndex( ch->entnum );
|
||||||
|
|
||||||
// entity is not present on the client but has valid origin
|
// entity is not present on the client but has valid origin
|
||||||
if( !ent || !ent->index || ent->curstate.messagenum == 0 )
|
if( !ent || !ent->model || ent->curstate.messagenum != cl.parsecount )
|
||||||
return valid_origin;
|
return valid_origin;
|
||||||
|
|
||||||
#if 0
|
|
||||||
// uncomment this if you want enable additional check by PVS
|
|
||||||
if( ent->curstate.messagenum != cl.parsecount )
|
|
||||||
return valid_origin;
|
|
||||||
#endif
|
|
||||||
// setup origin
|
// setup origin
|
||||||
VectorAverage( ent->curstate.mins, ent->curstate.maxs, ch->origin );
|
if( ent->model->type == mod_brush )
|
||||||
VectorAdd( ch->origin, ent->curstate.origin, ch->origin );
|
{
|
||||||
|
VectorAverage( ent->model->mins, ent->model->maxs, ch->origin );
|
||||||
|
VectorAdd( ent->origin, ch->origin, ch->origin );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VectorCopy( ent->origin, ch->origin );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1396,12 +1408,15 @@ qboolean CL_GetMovieSpatialization( rawchan_t *ch )
|
|||||||
return valid_origin;
|
return valid_origin;
|
||||||
|
|
||||||
// setup origin
|
// setup origin
|
||||||
VectorAverage( ent->curstate.mins, ent->curstate.maxs, ch->origin );
|
if( ent->model->type == mod_brush )
|
||||||
VectorAdd( ch->origin, ent->curstate.origin, ch->origin );
|
{
|
||||||
|
VectorAverage( ent->model->mins, ent->model->maxs, ch->origin );
|
||||||
// setup radius
|
VectorAdd( ent->origin, ch->origin, ch->origin );
|
||||||
if( ent->model != NULL && ent->model->radius ) ch->radius = ent->model->radius;
|
}
|
||||||
else ch->radius = RadiusFromBounds( ent->curstate.mins, ent->curstate.maxs );
|
else
|
||||||
|
{
|
||||||
|
VectorCopy( ent->origin, ch->origin );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+108
-117
@@ -234,7 +234,7 @@ void CL_InitCDAudio( const char *filename )
|
|||||||
pfile = (char *)afile;
|
pfile = (char *)afile;
|
||||||
|
|
||||||
// format: trackname\n [num]
|
// format: trackname\n [num]
|
||||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
||||||
{
|
{
|
||||||
if( !Q_stricmp( token, "blank" )) token[0] = '\0';
|
if( !Q_stricmp( token, "blank" )) token[0] = '\0';
|
||||||
Q_strncpy( clgame.cdtracks[c], token, sizeof( clgame.cdtracks[0] ));
|
Q_strncpy( clgame.cdtracks[c], token, sizeof( clgame.cdtracks[0] ));
|
||||||
@@ -816,7 +816,7 @@ CL_GetMaxlients
|
|||||||
Render callback for studio models
|
Render callback for studio models
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
int CL_GetMaxClients( void )
|
int GAME_EXPORT CL_GetMaxClients( void )
|
||||||
{
|
{
|
||||||
return cl.maxclients;
|
return cl.maxclients;
|
||||||
}
|
}
|
||||||
@@ -859,7 +859,7 @@ SPR_EnableScissor
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void SPR_EnableScissor( int x, int y, int width, int height )
|
static void GAME_EXPORT SPR_EnableScissor( int x, int y, int width, int height )
|
||||||
{
|
{
|
||||||
// check bounds
|
// check bounds
|
||||||
x = bound( 0, x, clgame.scrInfo.iWidth );
|
x = bound( 0, x, clgame.scrInfo.iWidth );
|
||||||
@@ -880,7 +880,7 @@ SPR_DisableScissor
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void SPR_DisableScissor( void )
|
static void GAME_EXPORT SPR_DisableScissor( void )
|
||||||
{
|
{
|
||||||
clgame.ds.scissor_x = 0;
|
clgame.ds.scissor_x = 0;
|
||||||
clgame.ds.scissor_width = 0;
|
clgame.ds.scissor_width = 0;
|
||||||
@@ -966,29 +966,17 @@ static void CL_DrawLoadingOrPaused( qboolean paused, float percent )
|
|||||||
|
|
||||||
SPR_AdjustSizei( &x, &y, &width, &height );
|
SPR_AdjustSizei( &x, &y, &width, &height );
|
||||||
|
|
||||||
if( !paused && cl_allow_levelshots->value )
|
if( !paused )
|
||||||
{
|
{
|
||||||
float step, s2;
|
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||||
|
|
||||||
ref.dllFuncs.Color4ub( 128, 128, 128, 255 );
|
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.loadingBar );
|
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.loadingBar );
|
||||||
|
|
||||||
step = (float)width / 100.0f;
|
|
||||||
right = (int)ceil( percent * step );
|
|
||||||
s2 = (float)right / width;
|
|
||||||
width = right;
|
|
||||||
|
|
||||||
ref.dllFuncs.Color4ub( 208, 152, 0, 255 );
|
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
|
||||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, s2, 1, cls.loadingBar );
|
|
||||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.loadingBar );
|
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, cls.pauseIcon );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1209,7 +1197,8 @@ static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite,
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf = FS_LoadFile( szSpriteName, &size, false );
|
buf = FS_LoadFile( szSpriteName, &size, false );
|
||||||
ASSERT( buf != NULL );
|
if( buf == NULL )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( type == SPR_MAPSPRITE )
|
if( type == SPR_MAPSPRITE )
|
||||||
ref.dllFuncs.Mod_LoadMapSprite( m_pSprite, buf, size, &loaded );
|
ref.dllFuncs.Mod_LoadMapSprite( m_pSprite, buf, size, &loaded );
|
||||||
@@ -1328,7 +1317,7 @@ pfnSPR_Load
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
HSPRITE pfnSPR_Load( const char *szPicName )
|
HSPRITE EXPORT pfnSPR_Load( const char *szPicName )
|
||||||
{
|
{
|
||||||
model_t *spr;
|
model_t *spr;
|
||||||
|
|
||||||
@@ -1375,7 +1364,7 @@ pfnSPR_Frames
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int pfnSPR_Frames( HSPRITE hPic )
|
int EXPORT pfnSPR_Frames( HSPRITE hPic )
|
||||||
{
|
{
|
||||||
int numFrames;
|
int numFrames;
|
||||||
|
|
||||||
@@ -1390,7 +1379,7 @@ pfnSPR_Height
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int pfnSPR_Height( HSPRITE hPic, int frame )
|
static int GAME_EXPORT pfnSPR_Height( HSPRITE hPic, int frame )
|
||||||
{
|
{
|
||||||
int sprHeight;
|
int sprHeight;
|
||||||
|
|
||||||
@@ -1405,7 +1394,7 @@ pfnSPR_Width
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int pfnSPR_Width( HSPRITE hPic, int frame )
|
static int GAME_EXPORT pfnSPR_Width( HSPRITE hPic, int frame )
|
||||||
{
|
{
|
||||||
int sprWidth;
|
int sprWidth;
|
||||||
|
|
||||||
@@ -1420,7 +1409,7 @@ pfnSPR_Set
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void pfnSPR_Set( HSPRITE hPic, int r, int g, int b )
|
static void GAME_EXPORT pfnSPR_Set( HSPRITE hPic, int r, int g, int b )
|
||||||
{
|
{
|
||||||
clgame.ds.pSprite = CL_GetSpritePointer( hPic );
|
clgame.ds.pSprite = CL_GetSpritePointer( hPic );
|
||||||
clgame.ds.spriteColor[0] = bound( 0, r, 255 );
|
clgame.ds.spriteColor[0] = bound( 0, r, 255 );
|
||||||
@@ -1435,7 +1424,7 @@ pfnSPR_Draw
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void 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( kRenderNormal );
|
||||||
SPR_DrawGeneric( frame, x, y, -1, -1, prc );
|
SPR_DrawGeneric( frame, x, y, -1, -1, prc );
|
||||||
@@ -1447,7 +1436,7 @@ pfnSPR_DrawHoles
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void pfnSPR_DrawHoles( int frame, int x, int y, const wrect_t *prc )
|
static void GAME_EXPORT pfnSPR_DrawHoles( int frame, int x, int y, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
#if 1 // REFTODO
|
#if 1 // REFTODO
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransColor );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransColor );
|
||||||
@@ -1472,7 +1461,7 @@ pfnSPR_DrawAdditive
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void pfnSPR_DrawAdditive( int frame, int x, int y, const wrect_t *prc )
|
static void GAME_EXPORT pfnSPR_DrawAdditive( int frame, int x, int y, const wrect_t *prc )
|
||||||
{
|
{
|
||||||
#if 1 // REFTODO
|
#if 1 // REFTODO
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||||
@@ -1534,7 +1523,7 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount )
|
|||||||
if( !afile ) return NULL;
|
if( !afile ) return NULL;
|
||||||
|
|
||||||
pfile = (char *)afile;
|
pfile = (char *)afile;
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
numSprites = Q_atoi( token );
|
numSprites = Q_atoi( token );
|
||||||
|
|
||||||
Q_strncpy( pEntry->szListName, psz, sizeof( pEntry->szListName ));
|
Q_strncpy( pEntry->szListName, psz, sizeof( pEntry->szListName ));
|
||||||
@@ -1544,30 +1533,30 @@ static client_sprite_t *pfnSPR_GetList( char *psz, int *piCount )
|
|||||||
|
|
||||||
for( index = 0; index < numSprites; index++ )
|
for( index = 0; index < numSprites; index++ )
|
||||||
{
|
{
|
||||||
if(( pfile = COM_ParseFile( pfile, token )) == NULL )
|
if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Q_strncpy( pEntry->pList[index].szName, token, sizeof( pEntry->pList[0].szName ));
|
Q_strncpy( pEntry->pList[index].szName, token, sizeof( pEntry->pList[0].szName ));
|
||||||
|
|
||||||
// read resolution
|
// read resolution
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
pEntry->pList[index].iRes = Q_atoi( token );
|
pEntry->pList[index].iRes = Q_atoi( token );
|
||||||
|
|
||||||
// read spritename
|
// read spritename
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
Q_strncpy( pEntry->pList[index].szSprite, token, sizeof( pEntry->pList[0].szSprite ));
|
Q_strncpy( pEntry->pList[index].szSprite, token, sizeof( pEntry->pList[0].szSprite ));
|
||||||
|
|
||||||
// parse rectangle
|
// parse rectangle
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
pEntry->pList[index].rc.left = Q_atoi( token );
|
pEntry->pList[index].rc.left = Q_atoi( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
pEntry->pList[index].rc.top = Q_atoi( token );
|
pEntry->pList[index].rc.top = Q_atoi( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
pEntry->pList[index].rc.right = pEntry->pList[index].rc.left + Q_atoi( token );
|
pEntry->pList[index].rc.right = pEntry->pList[index].rc.left + Q_atoi( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
pEntry->pList[index].rc.bottom = pEntry->pList[index].rc.top + Q_atoi( token );
|
pEntry->pList[index].rc.bottom = pEntry->pList[index].rc.top + Q_atoi( token );
|
||||||
|
|
||||||
pEntry->count++;
|
pEntry->count++;
|
||||||
@@ -1587,7 +1576,7 @@ CL_FillRGBA
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_FillRGBA( int x, int y, int w, int h, int r, int g, int b, int a )
|
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;
|
||||||
|
|
||||||
@@ -1627,7 +1616,7 @@ pfnGetScreenInfo
|
|||||||
get actual screen info
|
get actual screen info
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
int GAME_EXPORT CL_GetScreenInfo( SCREENINFO *pscrinfo )
|
||||||
{
|
{
|
||||||
float scale_factor = hud_scale->value;
|
float scale_factor = hud_scale->value;
|
||||||
|
|
||||||
@@ -1666,7 +1655,7 @@ pfnSetCrosshair
|
|||||||
setup crosshair
|
setup crosshair
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnSetCrosshair( HSPRITE hspr, wrect_t rc, int r, int g, int b )
|
static void GAME_EXPORT pfnSetCrosshair( HSPRITE hspr, wrect_t rc, int r, int g, int b )
|
||||||
{
|
{
|
||||||
clgame.ds.rgbaCrosshair[0] = (byte)r;
|
clgame.ds.rgbaCrosshair[0] = (byte)r;
|
||||||
clgame.ds.rgbaCrosshair[1] = (byte)g;
|
clgame.ds.rgbaCrosshair[1] = (byte)g;
|
||||||
@@ -1682,7 +1671,7 @@ pfnHookUserMsg
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static int pfnHookUserMsg( const char *pszName, pfnUserMsgHook pfn )
|
static int GAME_EXPORT pfnHookUserMsg( const char *pszName, pfnUserMsgHook pfn )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -1716,7 +1705,7 @@ pfnServerCmd
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static int pfnServerCmd( const char *szCmdString )
|
static int GAME_EXPORT pfnServerCmd( const char *szCmdString )
|
||||||
{
|
{
|
||||||
string buf;
|
string buf;
|
||||||
|
|
||||||
@@ -1736,7 +1725,7 @@ pfnClientCmd
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static int pfnClientCmd( const char *szCmdString )
|
static int GAME_EXPORT pfnClientCmd( const char *szCmdString )
|
||||||
{
|
{
|
||||||
if( !COM_CheckString( szCmdString ))
|
if( !COM_CheckString( szCmdString ))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1761,7 +1750,7 @@ pfnGetPlayerInfo
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnGetPlayerInfo( int ent_num, hud_player_info_t *pinfo )
|
static void GAME_EXPORT pfnGetPlayerInfo( int ent_num, hud_player_info_t *pinfo )
|
||||||
{
|
{
|
||||||
player_info_t *player;
|
player_info_t *player;
|
||||||
|
|
||||||
@@ -1791,7 +1780,7 @@ pfnPlaySoundByName
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnPlaySoundByName( const char *szSound, float volume )
|
static void GAME_EXPORT pfnPlaySoundByName( const char *szSound, float volume )
|
||||||
{
|
{
|
||||||
int hSound = S_RegisterSound( szSound );
|
int hSound = S_RegisterSound( szSound );
|
||||||
S_StartSound( NULL, cl.viewentity, CHAN_ITEM, hSound, volume, ATTN_NORM, PITCH_NORM, SND_STOP_LOOPING );
|
S_StartSound( NULL, cl.viewentity, CHAN_ITEM, hSound, volume, ATTN_NORM, PITCH_NORM, SND_STOP_LOOPING );
|
||||||
@@ -1803,7 +1792,7 @@ pfnPlaySoundByIndex
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnPlaySoundByIndex( int iSound, float volume )
|
static void GAME_EXPORT pfnPlaySoundByIndex( int iSound, float volume )
|
||||||
{
|
{
|
||||||
int hSound;
|
int hSound;
|
||||||
|
|
||||||
@@ -1849,7 +1838,7 @@ pfnDrawCharacter
|
|||||||
returns drawed chachter width (in real screen pixels)
|
returns drawed chachter width (in real screen pixels)
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static int pfnDrawCharacter( int x, int y, int number, int r, int g, int b )
|
static int GAME_EXPORT pfnDrawCharacter( int x, int y, int number, int r, int g, int b )
|
||||||
{
|
{
|
||||||
if( !cls.creditsFont.valid )
|
if( !cls.creditsFont.valid )
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1878,7 +1867,7 @@ pfnDrawConsoleString
|
|||||||
drawing string like a console string
|
drawing string like a console string
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnDrawConsoleString( int x, int y, char *string )
|
int GAME_EXPORT pfnDrawConsoleString( int x, int y, char *string )
|
||||||
{
|
{
|
||||||
int drawLen;
|
int drawLen;
|
||||||
|
|
||||||
@@ -1903,7 +1892,7 @@ pfnDrawSetTextColor
|
|||||||
set color for anything
|
set color for anything
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnDrawSetTextColor( float r, float g, float b )
|
void GAME_EXPORT pfnDrawSetTextColor( float r, float g, float b )
|
||||||
{
|
{
|
||||||
// bound color and convert to byte
|
// bound color and convert to byte
|
||||||
clgame.ds.textColor[0] = (byte)bound( 0, r * 255, 255 );
|
clgame.ds.textColor[0] = (byte)bound( 0, r * 255, 255 );
|
||||||
@@ -1919,7 +1908,7 @@ pfnDrawConsoleStringLen
|
|||||||
compute string length in screen pixels
|
compute string length in screen pixels
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnDrawConsoleStringLen( const char *pText, int *length, int *height )
|
void GAME_EXPORT pfnDrawConsoleStringLen( const char *pText, int *length, int *height )
|
||||||
{
|
{
|
||||||
Con_SetFont( con_fontsize->value );
|
Con_SetFont( con_fontsize->value );
|
||||||
Con_DrawStringLen( pText, length, height );
|
Con_DrawStringLen( pText, length, height );
|
||||||
@@ -1933,7 +1922,7 @@ pfnConsolePrint
|
|||||||
prints directly into console (can skip notify)
|
prints directly into console (can skip notify)
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnConsolePrint( const char *string )
|
static void GAME_EXPORT pfnConsolePrint( const char *string )
|
||||||
{
|
{
|
||||||
Con_Printf( "%s", string );
|
Con_Printf( "%s", string );
|
||||||
}
|
}
|
||||||
@@ -1946,7 +1935,7 @@ holds and fade message at center of screen
|
|||||||
like trigger_multiple message in q1
|
like trigger_multiple message in q1
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnCenterPrint( const char *string )
|
static void GAME_EXPORT pfnCenterPrint( const char *string )
|
||||||
{
|
{
|
||||||
CL_CenterPrint( string, 0.25f );
|
CL_CenterPrint( string, 0.25f );
|
||||||
}
|
}
|
||||||
@@ -1957,7 +1946,7 @@ GetWindowCenterX
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int pfnGetWindowCenterX( void )
|
static int GAME_EXPORT pfnGetWindowCenterX( void )
|
||||||
{
|
{
|
||||||
int x = 0;
|
int x = 0;
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
@@ -1982,7 +1971,7 @@ GetWindowCenterY
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int pfnGetWindowCenterY( void )
|
static int GAME_EXPORT pfnGetWindowCenterY( void )
|
||||||
{
|
{
|
||||||
int y = 0;
|
int y = 0;
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32
|
||||||
@@ -2008,7 +1997,7 @@ pfnGetViewAngles
|
|||||||
return interpolated angles from previous frame
|
return interpolated angles from previous frame
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnGetViewAngles( float *angles )
|
static void GAME_EXPORT pfnGetViewAngles( float *angles )
|
||||||
{
|
{
|
||||||
if( angles ) VectorCopy( cl.viewangles, angles );
|
if( angles ) VectorCopy( cl.viewangles, angles );
|
||||||
}
|
}
|
||||||
@@ -2020,7 +2009,7 @@ pfnSetViewAngles
|
|||||||
return interpolated angles from previous frame
|
return interpolated angles from previous frame
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnSetViewAngles( float *angles )
|
static void GAME_EXPORT pfnSetViewAngles( float *angles )
|
||||||
{
|
{
|
||||||
if( angles ) VectorCopy( angles, cl.viewangles );
|
if( angles ) VectorCopy( angles, cl.viewangles );
|
||||||
}
|
}
|
||||||
@@ -2031,7 +2020,7 @@ pfnPhysInfo_ValueForKey
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static const char* pfnPhysInfo_ValueForKey( const char *key )
|
static const char* GAME_EXPORT pfnPhysInfo_ValueForKey( const char *key )
|
||||||
{
|
{
|
||||||
return Info_ValueForKey( cls.physinfo, key );
|
return Info_ValueForKey( cls.physinfo, key );
|
||||||
}
|
}
|
||||||
@@ -2042,7 +2031,7 @@ pfnServerInfo_ValueForKey
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static const char* pfnServerInfo_ValueForKey( const char *key )
|
static const char* GAME_EXPORT pfnServerInfo_ValueForKey( const char *key )
|
||||||
{
|
{
|
||||||
return Info_ValueForKey( cl.serverinfo, key );
|
return Info_ValueForKey( cl.serverinfo, key );
|
||||||
}
|
}
|
||||||
@@ -2054,7 +2043,7 @@ pfnGetClientMaxspeed
|
|||||||
value that come from server
|
value that come from server
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static float pfnGetClientMaxspeed( void )
|
static float GAME_EXPORT pfnGetClientMaxspeed( void )
|
||||||
{
|
{
|
||||||
return cl.local.maxspeed;
|
return cl.local.maxspeed;
|
||||||
}
|
}
|
||||||
@@ -2065,7 +2054,7 @@ pfnIsNoClipping
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static int pfnIsNoClipping( void )
|
static int GAME_EXPORT pfnIsNoClipping( void )
|
||||||
{
|
{
|
||||||
return ( cl.frames[cl.parsecountmod].playerstate[cl.playernum].movetype == MOVETYPE_NOCLIP );
|
return ( cl.frames[cl.parsecountmod].playerstate[cl.playernum].movetype == MOVETYPE_NOCLIP );
|
||||||
}
|
}
|
||||||
@@ -2076,7 +2065,7 @@ pfnGetViewModel
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
cl_entity_t* CL_GetViewModel( void )
|
cl_entity_t* GAME_EXPORT CL_GetViewModel( void )
|
||||||
{
|
{
|
||||||
return &clgame.viewent;
|
return &clgame.viewent;
|
||||||
}
|
}
|
||||||
@@ -2087,7 +2076,7 @@ pfnGetClientTime
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static float pfnGetClientTime( void )
|
static float GAME_EXPORT pfnGetClientTime( void )
|
||||||
{
|
{
|
||||||
return cl.time;
|
return cl.time;
|
||||||
}
|
}
|
||||||
@@ -2098,7 +2087,7 @@ pfnCalcShake
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnCalcShake( void )
|
void GAME_EXPORT pfnCalcShake( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float fraction, freq;
|
float fraction, freq;
|
||||||
@@ -2160,7 +2149,7 @@ pfnApplyShake
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnApplyShake( float *origin, float *angles, float factor )
|
void GAME_EXPORT pfnApplyShake( float *origin, float *angles, float factor )
|
||||||
{
|
{
|
||||||
if( origin ) VectorMA( origin, factor, clgame.shake.applied_offset, origin );
|
if( origin ) VectorMA( origin, factor, clgame.shake.applied_offset, origin );
|
||||||
if( angles ) angles[ROLL] += clgame.shake.applied_angle * factor;
|
if( angles ) angles[ROLL] += clgame.shake.applied_angle * factor;
|
||||||
@@ -2172,7 +2161,7 @@ pfnIsSpectateOnly
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static int pfnIsSpectateOnly( void )
|
static int GAME_EXPORT pfnIsSpectateOnly( void )
|
||||||
{
|
{
|
||||||
return (cls.spectator != 0);
|
return (cls.spectator != 0);
|
||||||
}
|
}
|
||||||
@@ -2183,7 +2172,7 @@ pfnPointContents
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static int pfnPointContents( const float *p, int *truecontents )
|
static int GAME_EXPORT pfnPointContents( const float *p, int *truecontents )
|
||||||
{
|
{
|
||||||
int cont, truecont;
|
int cont, truecont;
|
||||||
|
|
||||||
@@ -2224,10 +2213,10 @@ static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull
|
|||||||
return &tr;
|
return &tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnPlaySoundByNameAtLocation( char *szSound, float volume, float *origin )
|
static void GAME_EXPORT pfnPlaySoundByNameAtLocation( char *szSound, float volume, float *origin )
|
||||||
{
|
{
|
||||||
int hSound = S_RegisterSound( szSound );
|
int hSound = S_RegisterSound( szSound );
|
||||||
S_StartSound( origin, 0, CHAN_AUTO, hSound, volume, ATTN_NORM, PITCH_NORM, 0 );
|
S_StartSound( origin, cl.viewentity, CHAN_AUTO, hSound, volume, ATTN_NORM, PITCH_NORM, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2236,7 +2225,7 @@ pfnPrecacheEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static word pfnPrecacheEvent( int type, const char* psz )
|
static word GAME_EXPORT pfnPrecacheEvent( int type, const char* psz )
|
||||||
{
|
{
|
||||||
return CL_EventIndex( psz );
|
return CL_EventIndex( psz );
|
||||||
}
|
}
|
||||||
@@ -2247,7 +2236,7 @@ pfnHookEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnHookEvent( const char *filename, pfnEventHook pfn )
|
static void GAME_EXPORT pfnHookEvent( const char *filename, pfnEventHook pfn )
|
||||||
{
|
{
|
||||||
char name[64];
|
char name[64];
|
||||||
cl_user_event_t *ev;
|
cl_user_event_t *ev;
|
||||||
@@ -2282,7 +2271,7 @@ pfnKillEvent
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnKillEvents( int entnum, const char *eventname )
|
static void GAME_EXPORT pfnKillEvents( int entnum, const char *eventname )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
event_state_t *es;
|
event_state_t *es;
|
||||||
@@ -2316,7 +2305,7 @@ pfnPlaySound
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnPlaySound( int ent, float *org, int chan, const char *samp, float vol, float attn, int flags, int pitch )
|
void GAME_EXPORT pfnPlaySound( int ent, float *org, int chan, const char *samp, float vol, float attn, int flags, int pitch )
|
||||||
{
|
{
|
||||||
S_StartSound( org, ent, chan, S_RegisterSound( samp ), vol, attn, pitch, flags );
|
S_StartSound( org, ent, chan, S_RegisterSound( samp ), vol, attn, pitch, flags );
|
||||||
}
|
}
|
||||||
@@ -2327,7 +2316,7 @@ CL_FindModelIndex
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int CL_FindModelIndex( const char *m )
|
int GAME_EXPORT CL_FindModelIndex( const char *m )
|
||||||
{
|
{
|
||||||
char filepath[MAX_QPATH];
|
char filepath[MAX_QPATH];
|
||||||
static float lasttimewarn;
|
static float lasttimewarn;
|
||||||
@@ -2364,7 +2353,7 @@ pfnIsLocal
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnIsLocal( int playernum )
|
int GAME_EXPORT pfnIsLocal( int playernum )
|
||||||
{
|
{
|
||||||
if( playernum == cl.playernum )
|
if( playernum == cl.playernum )
|
||||||
return true;
|
return true;
|
||||||
@@ -2377,7 +2366,7 @@ pfnLocalPlayerDucking
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnLocalPlayerDucking( void )
|
int GAME_EXPORT pfnLocalPlayerDucking( void )
|
||||||
{
|
{
|
||||||
return (cl.local.usehull == 1) ? true : false;
|
return (cl.local.usehull == 1) ? true : false;
|
||||||
}
|
}
|
||||||
@@ -2388,7 +2377,7 @@ pfnLocalPlayerViewheight
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnLocalPlayerViewheight( float *view_ofs )
|
void GAME_EXPORT pfnLocalPlayerViewheight( float *view_ofs )
|
||||||
{
|
{
|
||||||
if( view_ofs ) VectorCopy( cl.viewheight, view_ofs );
|
if( view_ofs ) VectorCopy( cl.viewheight, view_ofs );
|
||||||
}
|
}
|
||||||
@@ -2399,7 +2388,7 @@ pfnLocalPlayerBounds
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnLocalPlayerBounds( int hull, float *mins, float *maxs )
|
void GAME_EXPORT pfnLocalPlayerBounds( int hull, float *mins, float *maxs )
|
||||||
{
|
{
|
||||||
if( hull >= 0 && hull < 4 )
|
if( hull >= 0 && hull < 4 )
|
||||||
{
|
{
|
||||||
@@ -2414,14 +2403,17 @@ pfnIndexFromTrace
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnIndexFromTrace( struct pmtrace_s *pTrace )
|
int GAME_EXPORT pfnIndexFromTrace( struct pmtrace_s *pTrace )
|
||||||
{
|
{
|
||||||
|
#if 0 // Velaron: breaks compatibility with mods that call the function after CL_PopPMStates
|
||||||
if( pTrace->ent >= 0 && pTrace->ent < clgame.pmove->numphysent )
|
if( pTrace->ent >= 0 && pTrace->ent < clgame.pmove->numphysent )
|
||||||
{
|
{
|
||||||
// return cl.entities number
|
// return cl.entities number
|
||||||
return clgame.pmove->physents[pTrace->ent].info;
|
return clgame.pmove->physents[pTrace->ent].info;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
#endif
|
||||||
|
return clgame.pmove->physents[pTrace->ent].info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2462,7 +2454,7 @@ pfnSetTraceHull
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_SetTraceHull( int hull )
|
void GAME_EXPORT CL_SetTraceHull( int hull )
|
||||||
{
|
{
|
||||||
clgame.pmove->usehull = bound( 0, hull, 3 );
|
clgame.pmove->usehull = bound( 0, hull, 3 );
|
||||||
|
|
||||||
@@ -2474,7 +2466,7 @@ pfnPlayerTrace
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_PlayerTrace( float *start, float *end, int traceFlags, int ignore_pe, pmtrace_t *tr )
|
void GAME_EXPORT CL_PlayerTrace( float *start, float *end, int traceFlags, int ignore_pe, pmtrace_t *tr )
|
||||||
{
|
{
|
||||||
if( !tr ) return;
|
if( !tr ) return;
|
||||||
*tr = PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
|
*tr = PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
|
||||||
@@ -2486,7 +2478,7 @@ pfnPlayerTraceExt
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_PlayerTraceExt( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), pmtrace_t *tr )
|
void GAME_EXPORT CL_PlayerTraceExt( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), pmtrace_t *tr )
|
||||||
{
|
{
|
||||||
if( !tr ) return;
|
if( !tr ) return;
|
||||||
*tr = PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, -1, pfnIgnore );
|
*tr = PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, -1, pfnIgnore );
|
||||||
@@ -2543,7 +2535,7 @@ pfnStopAllSounds
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnStopAllSounds( int ent, int entchannel )
|
void GAME_EXPORT pfnStopAllSounds( int ent, int entchannel )
|
||||||
{
|
{
|
||||||
S_StopSound( ent, entchannel, NULL );
|
S_StopSound( ent, entchannel, NULL );
|
||||||
}
|
}
|
||||||
@@ -2568,7 +2560,7 @@ model_t *CL_LoadModel( const char *modelname, int *index )
|
|||||||
return CL_ModelHandle( i );
|
return CL_ModelHandle( i );
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_AddEntity( int entityType, cl_entity_t *pEnt )
|
int GAME_EXPORT CL_AddEntity( int entityType, cl_entity_t *pEnt )
|
||||||
{
|
{
|
||||||
if( !pEnt ) return false;
|
if( !pEnt ) return false;
|
||||||
|
|
||||||
@@ -2627,7 +2619,7 @@ pfnGetScreenFade
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnGetScreenFade( struct screenfade_s *fade )
|
void GAME_EXPORT pfnGetScreenFade( struct screenfade_s *fade )
|
||||||
{
|
{
|
||||||
if( fade ) *fade = clgame.fade;
|
if( fade ) *fade = clgame.fade;
|
||||||
}
|
}
|
||||||
@@ -2638,7 +2630,7 @@ pfnSetScreenFade
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnSetScreenFade( struct screenfade_s *fade )
|
static void GAME_EXPORT pfnSetScreenFade( struct screenfade_s *fade )
|
||||||
{
|
{
|
||||||
if( fade ) clgame.fade = *fade;
|
if( fade ) clgame.fade = *fade;
|
||||||
}
|
}
|
||||||
@@ -2678,7 +2670,7 @@ PlayerInfo_SetValueForKey
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void PlayerInfo_SetValueForKey( const char *key, const char *value )
|
void GAME_EXPORT PlayerInfo_SetValueForKey( const char *key, const char *value )
|
||||||
{
|
{
|
||||||
convar_t *var;
|
convar_t *var;
|
||||||
|
|
||||||
@@ -2704,7 +2696,7 @@ pfnGetPlayerUniqueID
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
qboolean pfnGetPlayerUniqueID( int iPlayer, char playerID[16] )
|
qboolean GAME_EXPORT pfnGetPlayerUniqueID( int iPlayer, char playerID[16] )
|
||||||
{
|
{
|
||||||
if( iPlayer < 1 || iPlayer > cl.maxclients )
|
if( iPlayer < 1 || iPlayer > cl.maxclients )
|
||||||
return false;
|
return false;
|
||||||
@@ -2724,7 +2716,7 @@ pfnGetTrackerIDForPlayer
|
|||||||
obsolete, unused
|
obsolete, unused
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnGetTrackerIDForPlayer( int playerSlot )
|
int GAME_EXPORT pfnGetTrackerIDForPlayer( int playerSlot )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2736,7 +2728,7 @@ pfnGetPlayerForTrackerID
|
|||||||
obsolete, unused
|
obsolete, unused
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnGetPlayerForTrackerID( int trackerID )
|
int GAME_EXPORT pfnGetPlayerForTrackerID( int trackerID )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2747,7 +2739,7 @@ pfnServerCmdUnreliable
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnServerCmdUnreliable( char *szCmdString )
|
int GAME_EXPORT pfnServerCmdUnreliable( char *szCmdString )
|
||||||
{
|
{
|
||||||
if( !COM_CheckString( szCmdString ))
|
if( !COM_CheckString( szCmdString ))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2764,7 +2756,7 @@ pfnGetMousePos
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnGetMousePos( struct tagPOINT *ppt )
|
void GAME_EXPORT pfnGetMousePos( struct tagPOINT *ppt )
|
||||||
{
|
{
|
||||||
if( !ppt )
|
if( !ppt )
|
||||||
return;
|
return;
|
||||||
@@ -2779,7 +2771,7 @@ pfnSetMouseEnable
|
|||||||
legacy of dinput code
|
legacy of dinput code
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnSetMouseEnable( qboolean fEnable )
|
void GAME_EXPORT pfnSetMouseEnable( qboolean fEnable )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3074,9 +3066,7 @@ char *pfnParseFile( char *data, char *token )
|
|||||||
{
|
{
|
||||||
char *out;
|
char *out;
|
||||||
|
|
||||||
host.com_handlecolon = true;
|
out = _COM_ParseFileSafe( data, token, INT_MAX, PFILE_HANDLECOLON, NULL );
|
||||||
out = COM_ParseFile( data, token );
|
|
||||||
host.com_handlecolon = false;
|
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@@ -3256,7 +3246,7 @@ Demo_IsRecording
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static int Demo_IsRecording( void )
|
static int GAME_EXPORT Demo_IsRecording( void )
|
||||||
{
|
{
|
||||||
return cls.demorecording;
|
return cls.demorecording;
|
||||||
}
|
}
|
||||||
@@ -3267,7 +3257,7 @@ Demo_IsPlayingback
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static int Demo_IsPlayingback( void )
|
static int GAME_EXPORT Demo_IsPlayingback( void )
|
||||||
{
|
{
|
||||||
return cls.demoplayback;
|
return cls.demoplayback;
|
||||||
}
|
}
|
||||||
@@ -3278,7 +3268,7 @@ Demo_IsTimeDemo
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static int Demo_IsTimeDemo( void )
|
static int GAME_EXPORT Demo_IsTimeDemo( void )
|
||||||
{
|
{
|
||||||
return cls.timedemo;
|
return cls.timedemo;
|
||||||
}
|
}
|
||||||
@@ -3289,7 +3279,7 @@ Demo_WriteBuffer
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Demo_WriteBuffer( int size, byte *buffer )
|
static void GAME_EXPORT Demo_WriteBuffer( int size, byte *buffer )
|
||||||
{
|
{
|
||||||
CL_WriteDemoUserMessage( buffer, size );
|
CL_WriteDemoUserMessage( buffer, size );
|
||||||
}
|
}
|
||||||
@@ -3306,7 +3296,7 @@ NetAPI_InitNetworking
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void NetAPI_InitNetworking( void )
|
void GAME_EXPORT NetAPI_InitNetworking( void )
|
||||||
{
|
{
|
||||||
NET_Config( true ); // allow remote
|
NET_Config( true ); // allow remote
|
||||||
}
|
}
|
||||||
@@ -3317,7 +3307,7 @@ NetAPI_InitNetworking
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void NetAPI_Status( net_status_t *status )
|
void GAME_EXPORT NetAPI_Status( net_status_t *status )
|
||||||
{
|
{
|
||||||
qboolean connected = false;
|
qboolean connected = false;
|
||||||
int packet_loss = 0;
|
int packet_loss = 0;
|
||||||
@@ -3345,7 +3335,7 @@ NetAPI_SendRequest
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void NetAPI_SendRequest( int context, int request, int flags, double timeout, netadr_t *remote_address, net_api_response_func_t response )
|
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;
|
string req;
|
||||||
@@ -3401,7 +3391,8 @@ void NetAPI_SendRequest( int context, int request, int flags, double timeout, ne
|
|||||||
char fullquery[512] = "1\xFF" "0.0.0.0:0\0" "\\gamedir\\";
|
char fullquery[512] = "1\xFF" "0.0.0.0:0\0" "\\gamedir\\";
|
||||||
|
|
||||||
// make sure what port is specified
|
// make sure what port is specified
|
||||||
if( !nr->resp.remote_address.port ) nr->resp.remote_address.port = MSG_BigShort( PORT_MASTER );
|
if( !nr->resp.remote_address.port )
|
||||||
|
nr->resp.remote_address.port = MSG_BigShort( PORT_MASTER );
|
||||||
|
|
||||||
// grab the list from the master server
|
// grab the list from the master server
|
||||||
Q_strcpy( &fullquery[22], GI->gamefolder );
|
Q_strcpy( &fullquery[22], GI->gamefolder );
|
||||||
@@ -3423,7 +3414,7 @@ NetAPI_CancelRequest
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void NetAPI_CancelRequest( int context )
|
void GAME_EXPORT NetAPI_CancelRequest( int context )
|
||||||
{
|
{
|
||||||
net_request_t *nr;
|
net_request_t *nr;
|
||||||
int i;
|
int i;
|
||||||
@@ -3461,7 +3452,7 @@ NetAPI_CancelAllRequests
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void NetAPI_CancelAllRequests( void )
|
void GAME_EXPORT NetAPI_CancelAllRequests( void )
|
||||||
{
|
{
|
||||||
net_request_t *nr;
|
net_request_t *nr;
|
||||||
int i;
|
int i;
|
||||||
@@ -3487,7 +3478,7 @@ NetAPI_AdrToString
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
char *NetAPI_AdrToString( netadr_t *a )
|
const char *NetAPI_AdrToString( netadr_t *a )
|
||||||
{
|
{
|
||||||
return NET_AdrToString( *a );
|
return NET_AdrToString( *a );
|
||||||
}
|
}
|
||||||
@@ -3498,7 +3489,7 @@ NetAPI_CompareAdr
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
int NetAPI_CompareAdr( netadr_t *a, netadr_t *b )
|
int GAME_EXPORT NetAPI_CompareAdr( netadr_t *a, netadr_t *b )
|
||||||
{
|
{
|
||||||
return NET_CompareAdr( *a, *b );
|
return NET_CompareAdr( *a, *b );
|
||||||
}
|
}
|
||||||
@@ -3509,7 +3500,7 @@ NetAPI_StringToAdr
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
int NetAPI_StringToAdr( char *s, netadr_t *a )
|
int GAME_EXPORT NetAPI_StringToAdr( char *s, netadr_t *a )
|
||||||
{
|
{
|
||||||
return NET_StringToAdr( s, a );
|
return NET_StringToAdr( s, a );
|
||||||
}
|
}
|
||||||
@@ -3531,7 +3522,7 @@ NetAPI_RemoveKey
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void NetAPI_RemoveKey( char *s, const char *key )
|
void GAME_EXPORT NetAPI_RemoveKey( char *s, const char *key )
|
||||||
{
|
{
|
||||||
Info_RemoveKey( s, key );
|
Info_RemoveKey( s, key );
|
||||||
}
|
}
|
||||||
@@ -3542,7 +3533,7 @@ NetAPI_SetValueForKey
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void NetAPI_SetValueForKey( char *s, const char *key, const char *value, int maxsize )
|
void GAME_EXPORT NetAPI_SetValueForKey( char *s, const char *key, const char *value, int maxsize )
|
||||||
{
|
{
|
||||||
if( key[0] == '*' ) return;
|
if( key[0] == '*' ) return;
|
||||||
Info_SetValueForStarKey( s, key, value, maxsize );
|
Info_SetValueForStarKey( s, key, value, maxsize );
|
||||||
@@ -3562,7 +3553,7 @@ Voice_StartVoiceTweakMode
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
int Voice_StartVoiceTweakMode( void )
|
int GAME_EXPORT Voice_StartVoiceTweakMode( void )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3573,7 +3564,7 @@ Voice_EndVoiceTweakMode
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void Voice_EndVoiceTweakMode( void )
|
void GAME_EXPORT Voice_EndVoiceTweakMode( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3583,7 +3574,7 @@ Voice_SetControlFloat
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void Voice_SetControlFloat( VoiceTweakControl iControl, float value )
|
void GAME_EXPORT Voice_SetControlFloat( VoiceTweakControl iControl, float value )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3593,7 +3584,7 @@ Voice_GetControlFloat
|
|||||||
|
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
float Voice_GetControlFloat( VoiceTweakControl iControl )
|
float GAME_EXPORT Voice_GetControlFloat( VoiceTweakControl iControl )
|
||||||
{
|
{
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
@@ -3872,9 +3863,9 @@ static cl_enginefunc_t gEngfuncs =
|
|||||||
LocalPlayerInfo_ValueForKey,
|
LocalPlayerInfo_ValueForKey,
|
||||||
pfnVGUI2DrawCharacter,
|
pfnVGUI2DrawCharacter,
|
||||||
pfnVGUI2DrawCharacterAdditive,
|
pfnVGUI2DrawCharacterAdditive,
|
||||||
(void*)Sound_GetApproxWavePlayLen,
|
Sound_GetApproxWavePlayLen,
|
||||||
GetCareerGameInterface,
|
GetCareerGameInterface,
|
||||||
(void*)Cvar_Set,
|
Cvar_Set,
|
||||||
pfnIsCareerMatch,
|
pfnIsCareerMatch,
|
||||||
pfnPlaySoundVoiceByName,
|
pfnPlaySoundVoiceByName,
|
||||||
pfnMP3_InitStream,
|
pfnMP3_InitStream,
|
||||||
@@ -3944,7 +3935,7 @@ qboolean CL_LoadProgs( const char *name )
|
|||||||
|
|
||||||
// a1ba: we need to check if client.dll has direct dependency on SDL2
|
// a1ba: we need to check if client.dll has direct dependency on SDL2
|
||||||
// and if so, disable relative mouse mode
|
// and if so, disable relative mouse mode
|
||||||
#if XASH_WIN32
|
#if XASH_WIN32 && !XASH_64BIT
|
||||||
if( ( clgame.client_dll_uses_sdl = COM_CheckLibraryDirectDependency( name, OS_LIB_PREFIX "SDL2." OS_LIB_EXT, false ) ) )
|
if( ( clgame.client_dll_uses_sdl = COM_CheckLibraryDirectDependency( name, OS_LIB_PREFIX "SDL2." OS_LIB_EXT, false ) ) )
|
||||||
{
|
{
|
||||||
Con_Printf( S_NOTE "%s uses SDL2 for mouse input\n", name );
|
Con_Printf( S_NOTE "%s uses SDL2 for mouse input\n", name );
|
||||||
@@ -3956,7 +3947,7 @@ qboolean CL_LoadProgs( const char *name )
|
|||||||
#else
|
#else
|
||||||
// this doesn't mean other platforms uses SDL2 in any case
|
// this doesn't mean other platforms uses SDL2 in any case
|
||||||
// it just helps input code to stay platform-independent
|
// it just helps input code to stay platform-independent
|
||||||
clgame.client_dll_uses_sdl = true;
|
clgame.client_dll_uses_sdl = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
clgame.hInstance = COM_LoadLibrary( name, false, false );
|
clgame.hInstance = COM_LoadLibrary( name, false, false );
|
||||||
|
|||||||
+55
-42
@@ -290,7 +290,7 @@ void UI_ConnectionProgress_ParseServerInfo( const char *server )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UI_DrawLogo( const char *filename, float x, float y, float width, float height )
|
static void GAME_EXPORT UI_DrawLogo( const char *filename, float x, float y, float width, float height )
|
||||||
{
|
{
|
||||||
static float cin_time;
|
static float cin_time;
|
||||||
static int last_frame = -1;
|
static int last_frame = -1;
|
||||||
@@ -359,17 +359,17 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
|
|||||||
ref.dllFuncs.R_DrawStretchRaw( x, y, width, height, gameui.logo_xres, gameui.logo_yres, cin_data, redraw );
|
ref.dllFuncs.R_DrawStretchRaw( x, y, width, height, gameui.logo_xres, gameui.logo_yres, cin_data, redraw );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int UI_GetLogoWidth( void )
|
static int GAME_EXPORT UI_GetLogoWidth( void )
|
||||||
{
|
{
|
||||||
return gameui.logo_xres;
|
return gameui.logo_xres;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int UI_GetLogoHeight( void )
|
static int GAME_EXPORT UI_GetLogoHeight( void )
|
||||||
{
|
{
|
||||||
return gameui.logo_yres;
|
return gameui.logo_yres;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float UI_GetLogoLength( void )
|
static float GAME_EXPORT UI_GetLogoLength( void )
|
||||||
{
|
{
|
||||||
return gameui.logo_length;
|
return gameui.logo_length;
|
||||||
}
|
}
|
||||||
@@ -403,7 +403,7 @@ static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
|
|||||||
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->title, in->title, sizeof( out->title ));
|
Q_strncpy( out->title, in->title, sizeof( out->title ));
|
||||||
Q_strncpy( out->version, va( "%g", in->version ), sizeof( out->version ));
|
Q_snprintf( out->version, sizeof( out->version ), "%g", in->version );
|
||||||
|
|
||||||
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 ));
|
||||||
@@ -529,7 +529,7 @@ pfnPIC_Load
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static HIMAGE pfnPIC_Load( const char *szPicName, const byte *image_buf, int image_size, int flags )
|
static HIMAGE GAME_EXPORT pfnPIC_Load( const char *szPicName, const byte *image_buf, int image_size, int flags )
|
||||||
{
|
{
|
||||||
HIMAGE tx;
|
HIMAGE tx;
|
||||||
|
|
||||||
@@ -555,7 +555,7 @@ pfnPIC_Width
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int pfnPIC_Width( HIMAGE hPic )
|
static int GAME_EXPORT pfnPIC_Width( HIMAGE hPic )
|
||||||
{
|
{
|
||||||
int picWidth;
|
int picWidth;
|
||||||
|
|
||||||
@@ -570,7 +570,7 @@ pfnPIC_Height
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int pfnPIC_Height( HIMAGE hPic )
|
static int GAME_EXPORT pfnPIC_Height( HIMAGE hPic )
|
||||||
{
|
{
|
||||||
int picHeight;
|
int picHeight;
|
||||||
|
|
||||||
@@ -585,7 +585,7 @@ pfnPIC_Set
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
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 );
|
||||||
@@ -601,7 +601,7 @@ pfnPIC_Draw
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
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 );
|
||||||
@@ -613,7 +613,7 @@ pfnPIC_DrawTrans
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
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 );
|
||||||
@@ -625,7 +625,7 @@ pfnPIC_DrawHoles
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
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 );
|
||||||
@@ -637,7 +637,7 @@ pfnPIC_DrawAdditive
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
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 );
|
||||||
@@ -649,7 +649,7 @@ pfnPIC_EnableScissor
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void pfnPIC_EnableScissor( int x, int y, int width, int height )
|
static void GAME_EXPORT pfnPIC_EnableScissor( int x, int y, int width, int height )
|
||||||
{
|
{
|
||||||
// check bounds
|
// check bounds
|
||||||
x = bound( 0, x, gameui.globals->scrWidth );
|
x = bound( 0, x, gameui.globals->scrWidth );
|
||||||
@@ -670,7 +670,7 @@ pfnPIC_DisableScissor
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void pfnPIC_DisableScissor( void )
|
static void GAME_EXPORT pfnPIC_DisableScissor( void )
|
||||||
{
|
{
|
||||||
gameui.ds.scissor_x = 0;
|
gameui.ds.scissor_x = 0;
|
||||||
gameui.ds.scissor_width = 0;
|
gameui.ds.scissor_width = 0;
|
||||||
@@ -685,7 +685,7 @@ pfnFillRGBA
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnFillRGBA( int x, int y, int width, int height, int r, int g, int b, int a )
|
static void GAME_EXPORT pfnFillRGBA( int x, int y, int width, int height, int r, int g, int b, int a )
|
||||||
{
|
{
|
||||||
r = bound( 0, r, 255 );
|
r = bound( 0, r, 255 );
|
||||||
g = bound( 0, g, 255 );
|
g = bound( 0, g, 255 );
|
||||||
@@ -703,7 +703,7 @@ pfnClientCmd
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnClientCmd( int exec_now, const char *szCmdString )
|
static void GAME_EXPORT pfnClientCmd( int exec_now, const char *szCmdString )
|
||||||
{
|
{
|
||||||
if( !szCmdString || !szCmdString[0] )
|
if( !szCmdString || !szCmdString[0] )
|
||||||
return;
|
return;
|
||||||
@@ -721,7 +721,7 @@ pfnPlaySound
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnPlaySound( const char *szSound )
|
static void GAME_EXPORT pfnPlaySound( const char *szSound )
|
||||||
{
|
{
|
||||||
if( !COM_CheckString( szSound )) return;
|
if( !COM_CheckString( szSound )) return;
|
||||||
S_StartLocalSound( szSound, VOL_NORM, false );
|
S_StartLocalSound( szSound, VOL_NORM, false );
|
||||||
@@ -734,7 +734,7 @@ pfnDrawCharacter
|
|||||||
quakefont draw character
|
quakefont draw character
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnDrawCharacter( int ix, int iy, int iwidth, int iheight, int ch, int ulRGBA, HIMAGE hFont )
|
static void GAME_EXPORT pfnDrawCharacter( int ix, int iy, int iwidth, int iheight, int ch, int ulRGBA, HIMAGE hFont )
|
||||||
{
|
{
|
||||||
rgba_t color;
|
rgba_t color;
|
||||||
float row, col, size;
|
float row, col, size;
|
||||||
@@ -779,7 +779,7 @@ UI_DrawConsoleString
|
|||||||
drawing string like a console string
|
drawing string like a console string
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static int UI_DrawConsoleString( int x, int y, const char *string )
|
static int GAME_EXPORT UI_DrawConsoleString( int x, int y, const char *string )
|
||||||
{
|
{
|
||||||
int drawLen;
|
int drawLen;
|
||||||
|
|
||||||
@@ -797,7 +797,7 @@ pfnDrawSetTextColor
|
|||||||
set color for anything
|
set color for anything
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void UI_DrawSetTextColor( int r, int g, int b, int alpha )
|
static void GAME_EXPORT UI_DrawSetTextColor( int r, int g, int b, int alpha )
|
||||||
{
|
{
|
||||||
// bound color and convert to byte
|
// bound color and convert to byte
|
||||||
gameui.ds.textColor[0] = r;
|
gameui.ds.textColor[0] = r;
|
||||||
@@ -813,7 +813,7 @@ pfnGetPlayerModel
|
|||||||
for drawing playermodel previews
|
for drawing playermodel previews
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static cl_entity_t* pfnGetPlayerModel( void )
|
static cl_entity_t* GAME_EXPORT pfnGetPlayerModel( void )
|
||||||
{
|
{
|
||||||
return &gameui.playermodel;
|
return &gameui.playermodel;
|
||||||
}
|
}
|
||||||
@@ -825,7 +825,7 @@ pfnSetPlayerModel
|
|||||||
for drawing playermodel previews
|
for drawing playermodel previews
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void pfnSetPlayerModel( cl_entity_t *ent, const char *path )
|
static void GAME_EXPORT pfnSetPlayerModel( cl_entity_t *ent, const char *path )
|
||||||
{
|
{
|
||||||
ent->model = Mod_ForName( path, false, false );
|
ent->model = Mod_ForName( path, false, false );
|
||||||
ent->curstate.modelindex = MAX_MODELS; // unreachable index
|
ent->curstate.modelindex = MAX_MODELS; // unreachable index
|
||||||
@@ -838,7 +838,7 @@ pfnClearScene
|
|||||||
for drawing playermodel previews
|
for drawing playermodel previews
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void pfnClearScene( void )
|
static void GAME_EXPORT pfnClearScene( void )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.R_PushScene();
|
ref.dllFuncs.R_PushScene();
|
||||||
ref.dllFuncs.R_ClearScene();
|
ref.dllFuncs.R_ClearScene();
|
||||||
@@ -851,7 +851,7 @@ pfnRenderScene
|
|||||||
for drawing playermodel previews
|
for drawing playermodel previews
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void pfnRenderScene( const ref_viewpass_t *rvp )
|
static void GAME_EXPORT pfnRenderScene( const ref_viewpass_t *rvp )
|
||||||
{
|
{
|
||||||
ref_viewpass_t copy;
|
ref_viewpass_t copy;
|
||||||
|
|
||||||
@@ -877,7 +877,7 @@ pfnAddEntity
|
|||||||
adding player model into visible list
|
adding player model into visible list
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static int pfnAddEntity( int entityType, cl_entity_t *ent )
|
static int GAME_EXPORT pfnAddEntity( int entityType, cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
if( !ref.dllFuncs.R_AddEntity( ent, entityType ))
|
if( !ref.dllFuncs.R_AddEntity( ent, entityType ))
|
||||||
return false;
|
return false;
|
||||||
@@ -891,7 +891,7 @@ pfnClientJoin
|
|||||||
send client connect
|
send client connect
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void pfnClientJoin( const netadr_t adr )
|
static void GAME_EXPORT pfnClientJoin( const netadr_t adr )
|
||||||
{
|
{
|
||||||
Cbuf_AddText( va( "connect %s\n", NET_AdrToString( adr )));
|
Cbuf_AddText( va( "connect %s\n", NET_AdrToString( adr )));
|
||||||
}
|
}
|
||||||
@@ -903,7 +903,7 @@ pfnKeyGetOverstrikeMode
|
|||||||
get global key overstrike state
|
get global key overstrike state
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static int pfnKeyGetOverstrikeMode( void )
|
static int GAME_EXPORT pfnKeyGetOverstrikeMode( void )
|
||||||
{
|
{
|
||||||
return host.key_overstrike;
|
return host.key_overstrike;
|
||||||
}
|
}
|
||||||
@@ -915,7 +915,7 @@ pfnKeySetOverstrikeMode
|
|||||||
set global key overstrike mode
|
set global key overstrike mode
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
static void pfnKeySetOverstrikeMode( int fActive )
|
static void GAME_EXPORT pfnKeySetOverstrikeMode( int fActive )
|
||||||
{
|
{
|
||||||
host.key_overstrike = fActive;
|
host.key_overstrike = fActive;
|
||||||
}
|
}
|
||||||
@@ -951,7 +951,7 @@ pfnMemFree
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void pfnMemFree( void *mem, const char *filename, const int fileline )
|
static void GAME_EXPORT pfnMemFree( void *mem, const char *filename, const int fileline )
|
||||||
{
|
{
|
||||||
_Mem_Free( mem, filename, fileline );
|
_Mem_Free( mem, filename, fileline );
|
||||||
}
|
}
|
||||||
@@ -962,7 +962,7 @@ pfnGetGameInfo
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static int pfnGetGameInfo( GAMEINFO *pgameinfo )
|
static int GAME_EXPORT pfnGetGameInfo( GAMEINFO *pgameinfo )
|
||||||
{
|
{
|
||||||
if( !pgameinfo ) return 0;
|
if( !pgameinfo ) return 0;
|
||||||
|
|
||||||
@@ -976,7 +976,7 @@ pfnGetGamesList
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static GAMEINFO **pfnGetGamesList( int *numGames )
|
static GAMEINFO ** GAME_EXPORT pfnGetGamesList( int *numGames )
|
||||||
{
|
{
|
||||||
if( numGames ) *numGames = SI.numgames;
|
if( numGames ) *numGames = SI.numgames;
|
||||||
return gameui.modsInfo;
|
return gameui.modsInfo;
|
||||||
@@ -989,7 +989,7 @@ pfnGetFilesList
|
|||||||
release prev search on a next call
|
release prev search on a next call
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static char **pfnGetFilesList( const char *pattern, int *numFiles, int gamedironly )
|
static char ** GAME_EXPORT pfnGetFilesList( const char *pattern, int *numFiles, int gamedironly )
|
||||||
{
|
{
|
||||||
static search_t *t = NULL;
|
static search_t *t = NULL;
|
||||||
|
|
||||||
@@ -1024,7 +1024,7 @@ pfnCheckGameDll
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
int pfnCheckGameDll( void )
|
int GAME_EXPORT pfnCheckGameDll( void )
|
||||||
{
|
{
|
||||||
string dllpath;
|
string dllpath;
|
||||||
void *hInst;
|
void *hInst;
|
||||||
@@ -1046,7 +1046,7 @@ int pfnCheckGameDll( void )
|
|||||||
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
|
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Con_Reportf( S_WARN "Could not load server library:\n%s", COM_GetLibraryError() );
|
Con_Reportf( S_WARN "Could not load server library: %s\n", COM_GetLibraryError() );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1056,7 +1056,7 @@ pfnChangeInstance
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void pfnChangeInstance( const char *newInstance, const char *szFinalMessage )
|
static void GAME_EXPORT pfnChangeInstance( const char *newInstance, const char *szFinalMessage )
|
||||||
{
|
{
|
||||||
if( !szFinalMessage ) szFinalMessage = "";
|
if( !szFinalMessage ) szFinalMessage = "";
|
||||||
if( !newInstance || !*newInstance ) return;
|
if( !newInstance || !*newInstance ) return;
|
||||||
@@ -1070,7 +1070,7 @@ pfnHostEndGame
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void pfnHostEndGame( const char *szFinalMessage )
|
static void GAME_EXPORT pfnHostEndGame( const char *szFinalMessage )
|
||||||
{
|
{
|
||||||
if( !szFinalMessage ) szFinalMessage = "";
|
if( !szFinalMessage ) szFinalMessage = "";
|
||||||
Host_EndGame( false, "%s", szFinalMessage );
|
Host_EndGame( false, "%s", szFinalMessage );
|
||||||
@@ -1082,12 +1082,12 @@ pfnStartBackgroundTrack
|
|||||||
|
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
static void pfnStartBackgroundTrack( const char *introTrack, const char *mainTrack )
|
static void GAME_EXPORT pfnStartBackgroundTrack( const char *introTrack, const char *mainTrack )
|
||||||
{
|
{
|
||||||
S_StartBackgroundTrack( introTrack, mainTrack, 0, false );
|
S_StartBackgroundTrack( introTrack, mainTrack, 0, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
|
static void GAME_EXPORT GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_ProcessTexture( texnum, gamma, topColor, bottomColor );
|
ref.dllFuncs.GL_ProcessTexture( texnum, gamma, topColor, bottomColor );
|
||||||
}
|
}
|
||||||
@@ -1098,7 +1098,7 @@ static void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottom
|
|||||||
UI_ShellExecute
|
UI_ShellExecute
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void UI_ShellExecute( const char *path, const char *parms, int shouldExit )
|
static void GAME_EXPORT UI_ShellExecute( const char *path, const char *parms, int shouldExit )
|
||||||
{
|
{
|
||||||
Platform_ShellExecute( path, parms );
|
Platform_ShellExecute( path, parms );
|
||||||
|
|
||||||
@@ -1106,6 +1106,17 @@ static void UI_ShellExecute( const char *path, const char *parms, int shouldExit
|
|||||||
Sys_Quit();
|
Sys_Quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
pfnParseFile
|
||||||
|
|
||||||
|
legacy wrapper
|
||||||
|
==============
|
||||||
|
*/
|
||||||
|
static char *pfnParseFile( char *buf, char *token )
|
||||||
|
{
|
||||||
|
return COM_ParseFile( buf, token, INT_MAX );
|
||||||
|
}
|
||||||
|
|
||||||
// engine callbacks
|
// engine callbacks
|
||||||
static ui_enginefuncs_t gEngfuncs =
|
static ui_enginefuncs_t gEngfuncs =
|
||||||
@@ -1159,7 +1170,7 @@ static ui_enginefuncs_t gEngfuncs =
|
|||||||
CL_Active,
|
CL_Active,
|
||||||
pfnClientJoin,
|
pfnClientJoin,
|
||||||
COM_LoadFileForMe,
|
COM_LoadFileForMe,
|
||||||
COM_ParseFile,
|
pfnParseFile,
|
||||||
COM_FreeFile,
|
COM_FreeFile,
|
||||||
Key_ClearStates,
|
Key_ClearStates,
|
||||||
Key_SetKeyDest,
|
Key_SetKeyDest,
|
||||||
@@ -1220,7 +1231,9 @@ static ui_extendedfuncs_t gExtendedfuncs =
|
|||||||
Con_UtfProcessChar,
|
Con_UtfProcessChar,
|
||||||
Con_UtfMoveLeft,
|
Con_UtfMoveLeft,
|
||||||
Con_UtfMoveRight,
|
Con_UtfMoveRight,
|
||||||
pfnGetRenderers
|
pfnGetRenderers,
|
||||||
|
Sys_DoubleTime,
|
||||||
|
_COM_ParseFileSafe
|
||||||
};
|
};
|
||||||
|
|
||||||
void UI_UnloadProgs( void )
|
void UI_UnloadProgs( void )
|
||||||
|
|||||||
+48
-41
@@ -43,7 +43,6 @@ convar_t *rcon_client_password;
|
|||||||
convar_t *rcon_address;
|
convar_t *rcon_address;
|
||||||
convar_t *cl_timeout;
|
convar_t *cl_timeout;
|
||||||
convar_t *cl_nopred;
|
convar_t *cl_nopred;
|
||||||
convar_t *cl_showfps;
|
|
||||||
convar_t *cl_nodelta;
|
convar_t *cl_nodelta;
|
||||||
convar_t *cl_crosshair;
|
convar_t *cl_crosshair;
|
||||||
convar_t *cl_cmdbackup;
|
convar_t *cl_cmdbackup;
|
||||||
@@ -64,6 +63,7 @@ convar_t *cl_updaterate;
|
|||||||
convar_t *cl_showevents;
|
convar_t *cl_showevents;
|
||||||
convar_t *cl_cmdrate;
|
convar_t *cl_cmdrate;
|
||||||
convar_t *cl_interp;
|
convar_t *cl_interp;
|
||||||
|
convar_t *cl_nointerp;
|
||||||
convar_t *cl_dlmax;
|
convar_t *cl_dlmax;
|
||||||
convar_t *cl_upmax;
|
convar_t *cl_upmax;
|
||||||
|
|
||||||
@@ -89,7 +89,7 @@ clgame_static_t clgame;
|
|||||||
void CL_InternetServers_f( void );
|
void CL_InternetServers_f( void );
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
int CL_Active( void )
|
int GAME_EXPORT CL_Active( void )
|
||||||
{
|
{
|
||||||
return ( cls.state == ca_active );
|
return ( cls.state == ca_active );
|
||||||
}
|
}
|
||||||
@@ -241,6 +241,11 @@ void CL_SignonReply( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float CL_LerpInterval( void )
|
||||||
|
{
|
||||||
|
return max( cl_interp->value, 1.f / cl_updaterate->value );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
CL_LerpPoint
|
CL_LerpPoint
|
||||||
@@ -251,25 +256,29 @@ should be put at.
|
|||||||
*/
|
*/
|
||||||
static float CL_LerpPoint( void )
|
static float CL_LerpPoint( void )
|
||||||
{
|
{
|
||||||
float f, frac = 1.0f;
|
float frac = 1.0f;
|
||||||
|
float server_frametime = cl_serverframetime();
|
||||||
|
|
||||||
f = cl_serverframetime();
|
if( server_frametime == 0.0f || cls.timedemo )
|
||||||
|
|
||||||
if( f == 0.0f || cls.timedemo )
|
|
||||||
{
|
{
|
||||||
cl.time = cl.mtime[0];
|
cl.time = cl.mtime[0];
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( f > 0.1f )
|
if( server_frametime > 0.1f )
|
||||||
{
|
{
|
||||||
// dropped packet, or start of demo
|
// dropped packet, or start of demo
|
||||||
cl.mtime[1] = cl.mtime[0] - 0.1f;
|
cl.mtime[1] = cl.mtime[0] - 0.1f;
|
||||||
f = 0.1f;
|
server_frametime = 0.1f;
|
||||||
}
|
}
|
||||||
#if 1
|
#if 0
|
||||||
|
/*
|
||||||
|
g-cont: this code more suitable for singleplayer
|
||||||
|
NOTE in multiplayer causes significant framerate stutter/jitter and
|
||||||
|
occuring frames with zero time delta and even with negative time delta.
|
||||||
|
game becomes more twitchy and as if without interpolation.
|
||||||
|
*/
|
||||||
frac = (cl.time - cl.mtime[1]) / f;
|
frac = (cl.time - cl.mtime[1]) / f;
|
||||||
|
|
||||||
if( frac < 0.0f )
|
if( frac < 0.0f )
|
||||||
{
|
{
|
||||||
if( frac < -0.01f )
|
if( frac < -0.01f )
|
||||||
@@ -283,15 +292,17 @@ static float CL_LerpPoint( void )
|
|||||||
frac = 1.0f;
|
frac = 1.0f;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
// for multiplayer
|
||||||
if( cl_interp->value > 0.001f )
|
if( cl_interp->value > 0.001f )
|
||||||
{
|
{
|
||||||
// manual lerp value (goldsrc mode)
|
// manual lerp value (goldsrc mode)
|
||||||
frac = ( cl.time - cl.mtime[0] ) / cl_interp->value;
|
float td = max( 0.f, cl.time - cl.mtime[0] );
|
||||||
|
frac = td / CL_LerpInterval();
|
||||||
}
|
}
|
||||||
else if( f > 0.001f )
|
else if( server_frametime > 0.001f )
|
||||||
{
|
{
|
||||||
// automatic lerp (classic mode)
|
// automatic lerp (classic mode)
|
||||||
frac = ( cl.time - cl.mtime[1] ) / f;
|
frac = ( cl.time - cl.mtime[1] ) / server_frametime;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return frac;
|
return frac;
|
||||||
@@ -334,10 +345,10 @@ Validate interpolation cvars, calc interpolation window
|
|||||||
*/
|
*/
|
||||||
void CL_ComputeClientInterpolationAmount( usercmd_t *cmd )
|
void CL_ComputeClientInterpolationAmount( usercmd_t *cmd )
|
||||||
{
|
{
|
||||||
int min_interp = MIN_EX_INTERP;
|
const float epsilon = 0.001f; // to avoid float invalid comparision
|
||||||
int max_interp = MAX_EX_INTERP;
|
float min_interp = MIN_EX_INTERP;
|
||||||
int interpolation_msec;
|
float max_interp = MAX_EX_INTERP;
|
||||||
qboolean forced = false;
|
float interpolation_time;
|
||||||
|
|
||||||
if( cl_updaterate->value < MIN_UPDATERATE )
|
if( cl_updaterate->value < MIN_UPDATERATE )
|
||||||
{
|
{
|
||||||
@@ -352,29 +363,24 @@ void CL_ComputeClientInterpolationAmount( usercmd_t *cmd )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( cls.spectator )
|
if( cls.spectator )
|
||||||
max_interp = 200;
|
max_interp = 0.2f;
|
||||||
|
|
||||||
min_interp = 1000.0f / cl_updaterate->value;
|
min_interp = 1.0f / cl_updaterate->value;
|
||||||
min_interp = Q_max( 1, min_interp );
|
interpolation_time = CL_LerpInterval( );
|
||||||
interpolation_msec = cl_interp->value * 1000.0f;
|
|
||||||
|
|
||||||
if(( interpolation_msec + 1 ) < min_interp )
|
if( (cl_interp->value + epsilon) < min_interp )
|
||||||
{
|
{
|
||||||
Con_Printf( "ex_interp forced up to %i msec\n", interpolation_msec );
|
Con_Printf( "ex_interp forced up to %.1f msec\n", min_interp * 1000.f );
|
||||||
interpolation_msec = min_interp;
|
Cvar_SetValue( "ex_interp", min_interp );
|
||||||
forced = true;
|
|
||||||
}
|
}
|
||||||
else if(( interpolation_msec - 1 ) > max_interp )
|
else if( (cl_interp->value - epsilon) > max_interp )
|
||||||
{
|
{
|
||||||
Con_Printf( "ex_interp forced down to %i msec\n", interpolation_msec );
|
Con_Printf( "ex_interp forced down to %.1f msec\n", max_interp * 1000.f );
|
||||||
interpolation_msec = max_interp;
|
Cvar_SetValue( "ex_interp", max_interp );
|
||||||
forced = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( forced ) Cvar_SetValue( "ex_interp", (float)interpolation_msec * 0.001f );
|
interpolation_time = bound( min_interp, interpolation_time, max_interp );
|
||||||
interpolation_msec = bound( min_interp, interpolation_msec, max_interp );
|
cmd->lerp_msec = CL_DriftInterpolationAmount( interpolation_time * 1000 );
|
||||||
|
|
||||||
cmd->lerp_msec = CL_DriftInterpolationAmount( interpolation_msec );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2397,7 +2403,7 @@ A file has been received via the fragmentation/reassembly layer, put it in the r
|
|||||||
*/
|
*/
|
||||||
void CL_ProcessFile( qboolean successfully_received, const char *filename )
|
void CL_ProcessFile( qboolean successfully_received, const char *filename )
|
||||||
{
|
{
|
||||||
int sound_len = Q_strlen( DEFAULT_SOUNDPATH );
|
int sound_len = sizeof( DEFAULT_SOUNDPATH ) - 1;
|
||||||
byte rgucMD5_hash[16];
|
byte rgucMD5_hash[16];
|
||||||
const char *pfilename;
|
const char *pfilename;
|
||||||
resource_t *p;
|
resource_t *p;
|
||||||
@@ -2529,7 +2535,7 @@ CL_ServerCommand
|
|||||||
send command to a server
|
send command to a server
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_ServerCommand( qboolean reliable, char *fmt, ... )
|
void CL_ServerCommand( qboolean reliable, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
char string[MAX_SYSPATH];
|
char string[MAX_SYSPATH];
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
@@ -2666,7 +2672,7 @@ qboolean CL_PrecacheResources( void )
|
|||||||
{
|
{
|
||||||
if( FBitSet( pRes->ucFlags, RES_WASMISSING ))
|
if( FBitSet( pRes->ucFlags, RES_WASMISSING ))
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "Could not load sound %s%s\n", DEFAULT_SOUNDPATH, pRes->szFileName );
|
Con_Printf( S_ERROR "Could not load sound " DEFAULT_SOUNDPATH "%s\n", pRes->szFileName );
|
||||||
cl.sound_precache[pRes->nIndex][0] = 0;
|
cl.sound_precache[pRes->nIndex][0] = 0;
|
||||||
cl.sound_index[pRes->nIndex] = 0;
|
cl.sound_index[pRes->nIndex] = 0;
|
||||||
}
|
}
|
||||||
@@ -2840,8 +2846,8 @@ void CL_InitLocal( void )
|
|||||||
Cvar_Get( "team", "", FCVAR_USERINFO, "player team" );
|
Cvar_Get( "team", "", FCVAR_USERINFO, "player team" );
|
||||||
Cvar_Get( "skin", "", FCVAR_USERINFO, "player skin" );
|
Cvar_Get( "skin", "", FCVAR_USERINFO, "player skin" );
|
||||||
|
|
||||||
cl_showfps = Cvar_Get( "cl_showfps", "1", FCVAR_ARCHIVE, "show client fps" );
|
cl_nosmooth = Cvar_Get( "cl_nosmooth", "0", FCVAR_ARCHIVE, "disable smooth up stair climbing" );
|
||||||
cl_nosmooth = Cvar_Get( "cl_nosmooth", "0", FCVAR_ARCHIVE, "disable smooth up stair climbing and interpolate position in multiplayer" );
|
cl_nointerp = Cvar_Get( "cl_nointerp", "0", FCVAR_CLIENTDLL, "disable interpolation of entities and players" );
|
||||||
cl_smoothtime = Cvar_Get( "cl_smoothtime", "0", FCVAR_ARCHIVE, "time to smooth up" );
|
cl_smoothtime = Cvar_Get( "cl_smoothtime", "0", FCVAR_ARCHIVE, "time to smooth up" );
|
||||||
cl_cmdbackup = Cvar_Get( "cl_cmdbackup", "10", FCVAR_ARCHIVE, "how many additional history commands are sent" );
|
cl_cmdbackup = Cvar_Get( "cl_cmdbackup", "10", FCVAR_ARCHIVE, "how many additional history commands are sent" );
|
||||||
cl_cmdrate = Cvar_Get( "cl_cmdrate", "30", FCVAR_ARCHIVE, "Max number of command packets sent to server per second" );
|
cl_cmdrate = Cvar_Get( "cl_cmdrate", "30", FCVAR_ARCHIVE, "Max number of command packets sent to server per second" );
|
||||||
@@ -2881,6 +2887,7 @@ void CL_InitLocal( void )
|
|||||||
Cmd_AddCommand ("internetservers", CL_InternetServers_f, "collect info about internet servers" );
|
Cmd_AddCommand ("internetservers", CL_InternetServers_f, "collect info about internet servers" );
|
||||||
Cmd_AddCommand ("cd", CL_PlayCDTrack_f, "Play cd-track (not real cd-player of course)" );
|
Cmd_AddCommand ("cd", CL_PlayCDTrack_f, "Play cd-track (not real cd-player of course)" );
|
||||||
Cmd_AddCommand ("mp3", CL_PlayCDTrack_f, "Play mp3-track (based on virtual cd-player)" );
|
Cmd_AddCommand ("mp3", CL_PlayCDTrack_f, "Play mp3-track (based on virtual cd-player)" );
|
||||||
|
Cmd_AddCommand ("waveplaylen", CL_WavePlayLen_f, "Get approximate length of wave file");
|
||||||
|
|
||||||
Cmd_AddCommand ("setinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of userinfo)" );
|
Cmd_AddCommand ("setinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of userinfo)" );
|
||||||
Cmd_AddCommand ("userinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of setinfo)" );
|
Cmd_AddCommand ("userinfo", CL_SetInfo_f, "examine or change the userinfo string (alias of setinfo)" );
|
||||||
@@ -2966,12 +2973,12 @@ Host_ClientBegin
|
|||||||
*/
|
*/
|
||||||
void Host_ClientBegin( void )
|
void Host_ClientBegin( void )
|
||||||
{
|
{
|
||||||
// if client is not active, do nothing
|
|
||||||
if( !cls.initialized ) return;
|
|
||||||
|
|
||||||
// exec console commands
|
// exec console commands
|
||||||
Cbuf_Execute ();
|
Cbuf_Execute ();
|
||||||
|
|
||||||
|
// if client is not active, do nothing
|
||||||
|
if( !cls.initialized ) return;
|
||||||
|
|
||||||
// finalize connection process if needs
|
// finalize connection process if needs
|
||||||
CL_CheckClientState();
|
CL_CheckClientState();
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,8 @@ static mobile_engfuncs_t gpMobileEngfuncs =
|
|||||||
pfnDrawScaledCharacter,
|
pfnDrawScaledCharacter,
|
||||||
Sys_Warn,
|
Sys_Warn,
|
||||||
pfnGetNativeObject,
|
pfnGetNativeObject,
|
||||||
ID_SetCustomClientID
|
ID_SetCustomClientID,
|
||||||
|
_COM_ParseFileSafe
|
||||||
};
|
};
|
||||||
|
|
||||||
qboolean Mobile_Init( void )
|
qboolean Mobile_Init( void )
|
||||||
|
|||||||
+43
-26
@@ -15,10 +15,13 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "kbutton.h"
|
||||||
|
|
||||||
#if XASH_LOW_MEMORY
|
#if XASH_LOW_MEMORY == 0
|
||||||
#define NET_TIMINGS 1024
|
#define NET_TIMINGS 1024
|
||||||
#else
|
#elif XASH_LOW_MEMORY == 1
|
||||||
|
#define NET_TIMINGS 256
|
||||||
|
#elif XASH_LOW_MEMORY == 2
|
||||||
#define NET_TIMINGS 64
|
#define NET_TIMINGS 64
|
||||||
#endif
|
#endif
|
||||||
#define NET_TIMINGS_MASK (NET_TIMINGS - 1)
|
#define NET_TIMINGS_MASK (NET_TIMINGS - 1)
|
||||||
@@ -31,11 +34,11 @@ GNU General Public License for more details.
|
|||||||
#define NUM_LATENCY_SAMPLES 8
|
#define NUM_LATENCY_SAMPLES 8
|
||||||
|
|
||||||
convar_t *net_graph;
|
convar_t *net_graph;
|
||||||
convar_t *net_graphpos;
|
static convar_t *net_graphpos;
|
||||||
convar_t *net_graphwidth;
|
static convar_t *net_graphwidth;
|
||||||
convar_t *net_graphheight;
|
static convar_t *net_graphheight;
|
||||||
convar_t *net_graphsolid;
|
static convar_t *net_graphsolid;
|
||||||
convar_t *net_scale;
|
static convar_t *net_scale;
|
||||||
|
|
||||||
static struct packet_latency_t
|
static struct packet_latency_t
|
||||||
{
|
{
|
||||||
@@ -93,7 +96,7 @@ NetGraph_AtEdge
|
|||||||
edge detect
|
edge detect
|
||||||
==========
|
==========
|
||||||
*/
|
*/
|
||||||
qboolean NetGraph_AtEdge( int x, int width )
|
static qboolean NetGraph_AtEdge( int x, int width )
|
||||||
{
|
{
|
||||||
if( x > 3 )
|
if( x > 3 )
|
||||||
{
|
{
|
||||||
@@ -111,7 +114,7 @@ NetGraph_InitColors
|
|||||||
init netgraph colors
|
init netgraph colors
|
||||||
==========
|
==========
|
||||||
*/
|
*/
|
||||||
void NetGraph_InitColors( void )
|
static void NetGraph_InitColors( void )
|
||||||
{
|
{
|
||||||
byte mincolor[2][3];
|
byte mincolor[2][3];
|
||||||
byte maxcolor[2][3];
|
byte maxcolor[2][3];
|
||||||
@@ -165,7 +168,7 @@ NetGraph_GetFrameData
|
|||||||
get frame data info, like chokes, packet losses, also update graph, packet and cmdinfo
|
get frame data info, like chokes, packet losses, also update graph, packet and cmdinfo
|
||||||
==========
|
==========
|
||||||
*/
|
*/
|
||||||
void NetGraph_GetFrameData( float *latency, int *latency_count )
|
static void NetGraph_GetFrameData( float *latency, int *latency_count )
|
||||||
{
|
{
|
||||||
int i, choke_count = 0, loss_count = 0;
|
int i, choke_count = 0, loss_count = 0;
|
||||||
double newtime = Sys_DoubleTime();
|
double newtime = Sys_DoubleTime();
|
||||||
@@ -247,7 +250,7 @@ NetGraph_DrawTimes
|
|||||||
|
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void NetGraph_DrawTimes( wrect_t rect, int x, int w )
|
static void NetGraph_DrawTimes( wrect_t rect, int x, int w )
|
||||||
{
|
{
|
||||||
int i, j, extrap_point = NETGRAPH_LERP_HEIGHT / 3, a, h;
|
int i, j, extrap_point = NETGRAPH_LERP_HEIGHT / 3, a, h;
|
||||||
rgba_t colors = { 0.9 * 255, 0.9 * 255, 0.7 * 255, 255 };
|
rgba_t colors = { 0.9 * 255, 0.9 * 255, 0.7 * 255, 255 };
|
||||||
@@ -322,7 +325,7 @@ NetGraph_DrawHatches
|
|||||||
|
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void NetGraph_DrawHatches( int x, int y )
|
static void NetGraph_DrawHatches( int x, int y )
|
||||||
{
|
{
|
||||||
int ystep = (int)( 10.0f / net_scale->value );
|
int ystep = (int)( 10.0f / net_scale->value );
|
||||||
byte colorminor[4] = { 0, 63, 63, 200 };
|
byte colorminor[4] = { 0, 63, 63, 200 };
|
||||||
@@ -351,7 +354,7 @@ NetGraph_DrawTextFields
|
|||||||
|
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, float avg, int packet_loss, int packet_choke )
|
static void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, float avg, int packet_loss, int packet_choke, int graphtype )
|
||||||
{
|
{
|
||||||
static int lastout;
|
static int lastout;
|
||||||
rgba_t colors = { 0.9 * 255, 0.9 * 255, 0.7 * 255, 255 };
|
rgba_t colors = { 0.9 * 255, 0.9 * 255, 0.7 * 255, 255 };
|
||||||
@@ -398,7 +401,7 @@ void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, floa
|
|||||||
Con_DrawString( x, y, va( "out: %i %.2f k/s", out, cls.netchan.flow[FLOW_OUTGOING].avgkbytespersec ), colors );
|
Con_DrawString( x, y, va( "out: %i %.2f k/s", out, cls.netchan.flow[FLOW_OUTGOING].avgkbytespersec ), colors );
|
||||||
y += 15;
|
y += 15;
|
||||||
|
|
||||||
if( net_graph->value > 2 )
|
if( graphtype > 2 )
|
||||||
{
|
{
|
||||||
int loss = (int)(( packet_loss + PACKETLOSS_AVG_FRAC ) - 0.01f );
|
int loss = (int)(( packet_loss + PACKETLOSS_AVG_FRAC ) - 0.01f );
|
||||||
int choke = (int)(( packet_choke + PACKETCHOKE_AVG_FRAC ) - 0.01f );
|
int choke = (int)(( packet_choke + PACKETCHOKE_AVG_FRAC ) - 0.01f );
|
||||||
@@ -407,7 +410,7 @@ void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, floa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( net_graph->value < 3 )
|
if( graphtype < 3 )
|
||||||
Con_DrawString( ptx, pty, va( "%i/s", (int)cl_cmdrate->value ), colors );
|
Con_DrawString( ptx, pty, va( "%i/s", (int)cl_cmdrate->value ), colors );
|
||||||
|
|
||||||
Con_DrawString( ptx, last_y, va( "%i/s" , (int)cl_updaterate->value ), colors );
|
Con_DrawString( ptx, last_y, va( "%i/s" , (int)cl_updaterate->value ), colors );
|
||||||
@@ -421,7 +424,7 @@ NetGraph_DrawDataSegment
|
|||||||
|
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
int NetGraph_DrawDataSegment( wrect_t *fill, int bytes, byte r, byte g, byte b, byte a )
|
static int NetGraph_DrawDataSegment( wrect_t *fill, int bytes, byte r, byte g, byte b, byte a )
|
||||||
{
|
{
|
||||||
float h = bytes / net_scale->value;
|
float h = bytes / net_scale->value;
|
||||||
byte colors[4] = { r, g, b, a };
|
byte colors[4] = { r, g, b, a };
|
||||||
@@ -448,7 +451,7 @@ NetGraph_ColorForHeight
|
|||||||
color based on packet latency
|
color based on packet latency
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void NetGraph_ColorForHeight( struct packet_latency_t *packet, byte color[4], int *ping )
|
static void NetGraph_ColorForHeight( struct packet_latency_t *packet, byte color[4], int *ping )
|
||||||
{
|
{
|
||||||
switch( packet->latency )
|
switch( packet->latency )
|
||||||
{
|
{
|
||||||
@@ -483,7 +486,7 @@ NetGraph_DrawDataUsage
|
|||||||
|
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void NetGraph_DrawDataUsage( int x, int y, int w )
|
static void NetGraph_DrawDataUsage( int x, int y, int w, int graphtype )
|
||||||
{
|
{
|
||||||
int a, i, h, lastvalidh = 0, ping;
|
int a, i, h, lastvalidh = 0, ping;
|
||||||
int pingheight = net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2;
|
int pingheight = net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2;
|
||||||
@@ -538,7 +541,7 @@ void NetGraph_DrawDataUsage( int x, int y, int w )
|
|||||||
if( NetGraph_AtEdge( a, w ))
|
if( NetGraph_AtEdge( a, w ))
|
||||||
NetGraph_DrawRect( &fill, color );
|
NetGraph_DrawRect( &fill, color );
|
||||||
|
|
||||||
if( net_graph->value < 2 )
|
if( graphtype < 2 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
color[0] = color[1] = color[2] = color[3] = 255;
|
color[0] = color[1] = color[2] = color[3] = 255;
|
||||||
@@ -585,7 +588,7 @@ void NetGraph_DrawDataUsage( int x, int y, int w )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( net_graph->value >= 2 )
|
if( graphtype >= 2 )
|
||||||
NetGraph_DrawHatches( x, y - net_graphheight->value - 1 );
|
NetGraph_DrawHatches( x, y - net_graphheight->value - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +598,7 @@ NetGraph_GetScreenPos
|
|||||||
|
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
void NetGraph_GetScreenPos( wrect_t *rect, int *w, int *x, int *y )
|
static void NetGraph_GetScreenPos( wrect_t *rect, int *w, int *x, int *y )
|
||||||
{
|
{
|
||||||
rect->left = rect->top = 0;
|
rect->left = rect->top = 0;
|
||||||
rect->right = refState.width;
|
rect->right = refState.width;
|
||||||
@@ -634,6 +637,8 @@ void SCR_DrawNetGraph( void )
|
|||||||
float avg_ping;
|
float avg_ping;
|
||||||
int ping_count;
|
int ping_count;
|
||||||
int w, x, y;
|
int w, x, y;
|
||||||
|
kbutton_t *in_graph;
|
||||||
|
int graphtype;
|
||||||
|
|
||||||
if( !host.allow_console )
|
if( !host.allow_console )
|
||||||
return;
|
return;
|
||||||
@@ -641,8 +646,20 @@ void SCR_DrawNetGraph( void )
|
|||||||
if( cls.state != ca_active )
|
if( cls.state != ca_active )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !net_graph->value )
|
in_graph = clgame.dllFuncs.KB_Find( "in_graph" );
|
||||||
|
|
||||||
|
if( in_graph->state & 1 )
|
||||||
|
{
|
||||||
|
graphtype = 2;
|
||||||
|
}
|
||||||
|
else if( net_graph->value != 0.0f )
|
||||||
|
{
|
||||||
|
graphtype = (int)net_graph->value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( net_scale->value <= 0 )
|
if( net_scale->value <= 0 )
|
||||||
Cvar_SetValue( "net_scale", 0.1f );
|
Cvar_SetValue( "net_scale", 0.1f );
|
||||||
@@ -651,16 +668,16 @@ void SCR_DrawNetGraph( void )
|
|||||||
|
|
||||||
NetGraph_GetFrameData( &avg_ping, &ping_count );
|
NetGraph_GetFrameData( &avg_ping, &ping_count );
|
||||||
|
|
||||||
NetGraph_DrawTextFields( x, y, w, rect, ping_count, avg_ping, packet_loss, packet_choke );
|
NetGraph_DrawTextFields( x, y, w, rect, ping_count, avg_ping, packet_loss, packet_choke, graphtype );
|
||||||
|
|
||||||
if( net_graph->value < 3 )
|
if( graphtype < 3 )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||||
|
ref.dllFuncs.GL_Bind( XASH_TEXTURE0, R_GetBuiltinTexture( REF_WHITE_TEXTURE ) );
|
||||||
ref.dllFuncs.Begin( TRI_QUADS ); // draw all the fills as a long solid sequence of quads for speedup reasons
|
ref.dllFuncs.Begin( TRI_QUADS ); // draw all the fills as a long solid sequence of quads for speedup reasons
|
||||||
|
|
||||||
// NOTE: fill colors without texture at this point
|
// NOTE: fill colors without texture at this point
|
||||||
NetGraph_DrawDataUsage( x, y, w );
|
NetGraph_DrawDataUsage( x, y, w, graphtype );
|
||||||
NetGraph_DrawTimes( rect, x, w );
|
NetGraph_DrawTimes( rect, x, w );
|
||||||
|
|
||||||
ref.dllFuncs.End();
|
ref.dllFuncs.End();
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ CL_WeaponAnim
|
|||||||
Set new weapon animation
|
Set new weapon animation
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_WeaponAnim( int iAnim, int body )
|
void GAME_EXPORT CL_WeaponAnim( int iAnim, int body )
|
||||||
{
|
{
|
||||||
cl_entity_t *view = &clgame.viewent;
|
cl_entity_t *view = &clgame.viewent;
|
||||||
|
|
||||||
@@ -501,11 +501,8 @@ void CL_BatchResourceRequest( qboolean initialize )
|
|||||||
{
|
{
|
||||||
if( !FBitSet( p->ucFlags, RES_REQUESTED ))
|
if( !FBitSet( p->ucFlags, RES_REQUESTED ))
|
||||||
{
|
{
|
||||||
string filename;
|
|
||||||
|
|
||||||
Q_snprintf( filename, sizeof( filename ), "!MD5%s", MD5_Print( p->rgucMD5_hash ));
|
|
||||||
MSG_BeginClientCmd( &msg, clc_stringcmd );
|
MSG_BeginClientCmd( &msg, clc_stringcmd );
|
||||||
MSG_WriteString( &msg, va( "dlfile %s", filename ));
|
MSG_WriteString( &msg, va( "dlfile !MD5%s", MD5_Print( p->rgucMD5_hash ) ) );
|
||||||
SetBits( p->ucFlags, RES_REQUESTED );
|
SetBits( p->ucFlags, RES_REQUESTED );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -560,7 +557,7 @@ int CL_EstimateNeededResources( void )
|
|||||||
switch( p->type )
|
switch( p->type )
|
||||||
{
|
{
|
||||||
case t_sound:
|
case t_sound:
|
||||||
if( p->szFileName[0] != '*' && !FS_FileExists( va( "%s%s", DEFAULT_SOUNDPATH, p->szFileName ), false ) )
|
if( p->szFileName[0] != '*' && !FS_FileExists( va( DEFAULT_SOUNDPATH "%s", p->szFileName ), false ) )
|
||||||
{
|
{
|
||||||
SetBits( p->ucFlags, RES_WASMISSING );
|
SetBits( p->ucFlags, RES_WASMISSING );
|
||||||
nTotalSize += p->nDownloadSize;
|
nTotalSize += p->nDownloadSize;
|
||||||
@@ -1496,7 +1493,7 @@ void CL_SendConsistencyInfo( sizebuf_t *msg )
|
|||||||
MSG_WriteUBitLong( msg, pc->orig_index, MAX_MODEL_BITS );
|
MSG_WriteUBitLong( msg, pc->orig_index, MAX_MODEL_BITS );
|
||||||
|
|
||||||
if( pc->issound )
|
if( pc->issound )
|
||||||
Q_snprintf( filename, sizeof( filename ), "%s%s", DEFAULT_SOUNDPATH, pc->filename );
|
Q_snprintf( filename, sizeof( filename ), DEFAULT_SOUNDPATH "%s", pc->filename );
|
||||||
else Q_strncpy( filename, pc->filename, sizeof( filename ));
|
else Q_strncpy( filename, pc->filename, sizeof( filename ));
|
||||||
|
|
||||||
if( Q_strstr( filename, "models/" ))
|
if( Q_strstr( filename, "models/" ))
|
||||||
@@ -1578,6 +1575,9 @@ void CL_RegisterResources( sizebuf_t *msg )
|
|||||||
|
|
||||||
CL_ClearWorld ();
|
CL_ClearWorld ();
|
||||||
|
|
||||||
|
// update the ref state.
|
||||||
|
R_UpdateRefState ();
|
||||||
|
|
||||||
// tell rendering system we have a new set of models.
|
// tell rendering system we have a new set of models.
|
||||||
ref.dllFuncs.R_NewMap ();
|
ref.dllFuncs.R_NewMap ();
|
||||||
|
|
||||||
@@ -1743,7 +1743,7 @@ void CL_ParseResLocation( sizebuf_t *msg )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( ( data = COM_ParseFile( data, token ) ) )
|
while( ( data = COM_ParseFile( data, token, sizeof( token ) ) ) )
|
||||||
{
|
{
|
||||||
Con_Reportf( "Adding %s as download location\n", token );
|
Con_Reportf( "Adding %s as download location\n", token );
|
||||||
|
|
||||||
@@ -1925,6 +1925,53 @@ void CL_ParseCvarValue2( sizebuf_t *msg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
CL_ParseExec
|
||||||
|
|
||||||
|
Exec map/class specific configs
|
||||||
|
==============
|
||||||
|
*/
|
||||||
|
void CL_ParseExec( sizebuf_t *msg )
|
||||||
|
{
|
||||||
|
qboolean is_class;
|
||||||
|
int class_idx;
|
||||||
|
string mapname;
|
||||||
|
const char *class_cfgs[] = {
|
||||||
|
"",
|
||||||
|
"exec scout.cfg\n",
|
||||||
|
"exec sniper.cfg\n",
|
||||||
|
"exec soldier.cfg\n",
|
||||||
|
"exec demoman.cfg\n",
|
||||||
|
"exec medic.cfg\n",
|
||||||
|
"exec hwguy.cfg\n",
|
||||||
|
"exec pyro.cfg\n",
|
||||||
|
"exec spy.cfg\n",
|
||||||
|
"exec engineer.cfg\n",
|
||||||
|
"",
|
||||||
|
"exec civilian.cfg\n"
|
||||||
|
};
|
||||||
|
|
||||||
|
is_class = MSG_ReadByte( msg );
|
||||||
|
|
||||||
|
if ( is_class )
|
||||||
|
{
|
||||||
|
class_idx = MSG_ReadByte( msg );
|
||||||
|
|
||||||
|
if ( class_idx >= 0 && class_idx <= 11 && !Q_stricmp( GI->gamefolder, "tfc" ) )
|
||||||
|
Cbuf_AddText( class_cfgs[class_idx] );
|
||||||
|
}
|
||||||
|
else if ( !Q_stricmp( GI->gamefolder, "tfc" ) )
|
||||||
|
{
|
||||||
|
Cbuf_AddText( "exec mapdefault.cfg\n" );
|
||||||
|
|
||||||
|
COM_FileBase( clgame.mapname, mapname );
|
||||||
|
|
||||||
|
if ( COM_CheckString( mapname ) )
|
||||||
|
Cbuf_AddText( va( "exec %s.cfg\n", mapname ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
CL_DispatchUserMessage
|
CL_DispatchUserMessage
|
||||||
@@ -2334,6 +2381,9 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
|
|||||||
case svc_querycvarvalue2:
|
case svc_querycvarvalue2:
|
||||||
CL_ParseCvarValue2( msg );
|
CL_ParseCvarValue2( msg );
|
||||||
break;
|
break;
|
||||||
|
case svc_exec:
|
||||||
|
CL_ParseExec( msg );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
CL_ParseUserMessage( msg, cmd );
|
CL_ParseUserMessage( msg, cmd );
|
||||||
cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart;
|
cl.frames[cl.parsecountmod].graphdata.usr += MSG_GetNumBytesRead( msg ) - bufStart;
|
||||||
@@ -2802,7 +2852,7 @@ void CL_LegacyParseResourceList( sizebuf_t *msg )
|
|||||||
const char *path;
|
const char *path;
|
||||||
|
|
||||||
if( reslist.restype[i] == t_sound )
|
if( reslist.restype[i] == t_sound )
|
||||||
path = va( "sound/%s", reslist.resnames[i] );
|
path = va( DEFAULT_SOUNDPATH "%s", reslist.resnames[i] );
|
||||||
else path = reslist.resnames[i];
|
else path = reslist.resnames[i];
|
||||||
|
|
||||||
if( FS_FileExists( path, false ))
|
if( FS_FileExists( path, false ))
|
||||||
@@ -3168,6 +3218,9 @@ void CL_LegacyPrecache_f( void )
|
|||||||
if( clgame.entities )
|
if( clgame.entities )
|
||||||
clgame.entities->model = cl.worldmodel;
|
clgame.entities->model = cl.worldmodel;
|
||||||
|
|
||||||
|
// update the ref state.
|
||||||
|
R_UpdateRefState ();
|
||||||
|
|
||||||
// tell rendering system we have a new set of models.
|
// tell rendering system we have a new set of models.
|
||||||
ref.dllFuncs.R_NewMap ();
|
ref.dllFuncs.R_NewMap ();
|
||||||
|
|
||||||
|
|||||||
+36
-35
@@ -46,7 +46,7 @@ CL_PushPMStates
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_PushPMStates( void )
|
void GAME_EXPORT CL_PushPMStates( void )
|
||||||
{
|
{
|
||||||
if( clgame.pushed ) return;
|
if( clgame.pushed ) return;
|
||||||
clgame.oldphyscount = clgame.pmove->numphysent;
|
clgame.oldphyscount = clgame.pmove->numphysent;
|
||||||
@@ -60,7 +60,7 @@ CL_PopPMStates
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_PopPMStates( void )
|
void GAME_EXPORT CL_PopPMStates( void )
|
||||||
{
|
{
|
||||||
if( !clgame.pushed ) return;
|
if( !clgame.pushed ) return;
|
||||||
clgame.pmove->numphysent = clgame.oldphyscount;
|
clgame.pmove->numphysent = clgame.oldphyscount;
|
||||||
@@ -74,7 +74,7 @@ CL_PushTraceBounds
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs )
|
void GAME_EXPORT CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs )
|
||||||
{
|
{
|
||||||
hullnum = bound( 0, hullnum, 3 );
|
hullnum = bound( 0, hullnum, 3 );
|
||||||
VectorCopy( mins, clgame.pmove->player_mins[hullnum] );
|
VectorCopy( mins, clgame.pmove->player_mins[hullnum] );
|
||||||
@@ -87,7 +87,7 @@ CL_PopTraceBounds
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_PopTraceBounds( void )
|
void GAME_EXPORT CL_PopTraceBounds( void )
|
||||||
{
|
{
|
||||||
memcpy( clgame.pmove->player_mins, host.player_mins, sizeof( host.player_mins ));
|
memcpy( clgame.pmove->player_mins, host.player_mins, sizeof( host.player_mins ));
|
||||||
memcpy( clgame.pmove->player_maxs, host.player_maxs, sizeof( host.player_maxs ));
|
memcpy( clgame.pmove->player_maxs, host.player_maxs, sizeof( host.player_maxs ));
|
||||||
@@ -264,7 +264,9 @@ void CL_CheckPredictionError( void )
|
|||||||
// save for error interpolation
|
// save for error interpolation
|
||||||
VectorCopy( delta, cl.local.prediction_error );
|
VectorCopy( delta, cl.local.prediction_error );
|
||||||
|
|
||||||
if( dist > MIN_CORRECTION_DISTANCE )
|
// GoldSrc checks for singleplayer
|
||||||
|
// we would check for local server
|
||||||
|
if( dist > MIN_CORRECTION_DISTANCE && !SV_Active() )
|
||||||
cls.correction_time = cl_smoothtime->value;
|
cls.correction_time = cl_smoothtime->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -280,7 +282,7 @@ then with clipping against them.
|
|||||||
This sets up the first phase.
|
This sets up the first phase.
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient )
|
void GAME_EXPORT CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient )
|
||||||
{
|
{
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
predicted_player_t *player;
|
predicted_player_t *player;
|
||||||
@@ -538,7 +540,7 @@ pmove must be setup with world and solid entity hulls before calling
|
|||||||
(via CL_PredictMove)
|
(via CL_PredictMove)
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void CL_SetSolidPlayers( int playernum )
|
void GAME_EXPORT CL_SetSolidPlayers( int playernum )
|
||||||
{
|
{
|
||||||
entity_state_t *state;
|
entity_state_t *state;
|
||||||
predicted_player_t *player;
|
predicted_player_t *player;
|
||||||
@@ -594,7 +596,7 @@ CL_WaterEntity
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int CL_WaterEntity( const float *rgflPos )
|
int GAME_EXPORT CL_WaterEntity( const float *rgflPos )
|
||||||
{
|
{
|
||||||
physent_t *pe;
|
physent_t *pe;
|
||||||
hull_t *hull;
|
hull_t *hull;
|
||||||
@@ -699,17 +701,17 @@ cl_entity_t *CL_GetWaterEntity( const float *rgflPos )
|
|||||||
return CL_GetEntityByIndex( entnum );
|
return CL_GetEntityByIndex( entnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_TestLine( const vec3_t start, const vec3_t end, int flags )
|
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 );
|
return PM_TestLineExt( clgame.pmove, clgame.pmove->physents, clgame.pmove->numphysent, start, end, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnStuckTouch( int hitent, pmtrace_t *tr )
|
static void GAME_EXPORT pfnStuckTouch( int hitent, pmtrace_t *tr )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -728,7 +730,7 @@ static void pfnStuckTouch( int hitent, pmtrace_t *tr )
|
|||||||
clgame.pmove->touchindex[clgame.pmove->numtouch++] = *tr;
|
clgame.pmove->touchindex[clgame.pmove->numtouch++] = *tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pfnPointContents( float *p, int *truecontents )
|
static int GAME_EXPORT pfnPointContents( float *p, int *truecontents )
|
||||||
{
|
{
|
||||||
int cont, truecont;
|
int cont, truecont;
|
||||||
|
|
||||||
@@ -740,17 +742,17 @@ static int pfnPointContents( float *p, int *truecontents )
|
|||||||
return cont;
|
return cont;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pfnTruePointContents( float *p )
|
static int GAME_EXPORT pfnTruePointContents( float *p )
|
||||||
{
|
{
|
||||||
return PM_TruePointContents( clgame.pmove, p );
|
return PM_TruePointContents( clgame.pmove, p );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pfnHullPointContents( struct hull_s *hull, int num, float *p )
|
static int GAME_EXPORT pfnHullPointContents( struct hull_s *hull, int num, float *p )
|
||||||
{
|
{
|
||||||
return PM_HullPointContents( hull, num, p );
|
return PM_HullPointContents( hull, num, p );
|
||||||
}
|
}
|
||||||
|
|
||||||
static pmtrace_t pfnPlayerTrace( float *start, float *end, int traceFlags, int ignore_pe )
|
static pmtrace_t GAME_EXPORT pfnPlayerTrace( float *start, float *end, int traceFlags, int ignore_pe )
|
||||||
{
|
{
|
||||||
return PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
|
return PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
|
||||||
}
|
}
|
||||||
@@ -783,7 +785,7 @@ static hull_t *pfnHullForBsp( physent_t *pe, float *offset )
|
|||||||
return PM_HullForBsp( pe, clgame.pmove, offset );
|
return PM_HullForBsp( pe, clgame.pmove, offset );
|
||||||
}
|
}
|
||||||
|
|
||||||
static float pfnTraceModel( physent_t *pe, float *start, float *end, trace_t *trace )
|
static float GAME_EXPORT pfnTraceModel( physent_t *pe, float *start, float *end, trace_t *trace )
|
||||||
{
|
{
|
||||||
int old_usehull;
|
int old_usehull;
|
||||||
vec3_t start_l, end_l;
|
vec3_t start_l, end_l;
|
||||||
@@ -840,7 +842,7 @@ static const char *pfnTraceTexture( int ground, float *vstart, float *vend )
|
|||||||
return PM_TraceTexture( pe, vstart, vend );
|
return PM_TraceTexture( pe, vstart, vend );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch )
|
static void GAME_EXPORT pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch )
|
||||||
{
|
{
|
||||||
if( !clgame.pmove->runfuncs )
|
if( !clgame.pmove->runfuncs )
|
||||||
return;
|
return;
|
||||||
@@ -848,18 +850,18 @@ static void pfnPlaySound( int channel, const char *sample, float volume, float a
|
|||||||
S_StartSound( NULL, clgame.pmove->player_index + 1, channel, S_RegisterSound( sample ), volume, attenuation, pitch, fFlags );
|
S_StartSound( NULL, clgame.pmove->player_index + 1, channel, S_RegisterSound( sample ), volume, attenuation, pitch, fFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pfnPlaybackEventFull( int flags, int clientindex, word eventindex, float delay, float *origin,
|
static void GAME_EXPORT pfnPlaybackEventFull( int flags, int clientindex, 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 )
|
||||||
{
|
{
|
||||||
CL_PlaybackEvent( flags, NULL, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 );
|
CL_PlaybackEvent( flags, NULL, eventindex, delay, origin, angles, fparam1, fparam2, iparam1, iparam2, bparam1, bparam2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static pmtrace_t pfnPlayerTraceEx( float *start, float *end, int traceFlags, pfnIgnore pmFilter )
|
static pmtrace_t GAME_EXPORT pfnPlayerTraceEx( float *start, float *end, int traceFlags, pfnIgnore pmFilter )
|
||||||
{
|
{
|
||||||
return PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, -1, pmFilter );
|
return PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, -1, pmFilter );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pfnTestPlayerPositionEx( float *pos, pmtrace_t *ptrace, pfnIgnore pmFilter )
|
static int GAME_EXPORT pfnTestPlayerPositionEx( float *pos, pmtrace_t *ptrace, pfnIgnore pmFilter )
|
||||||
{
|
{
|
||||||
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, pmFilter );
|
return PM_TestPlayerPosition( clgame.pmove, pos, ptrace, pmFilter );
|
||||||
}
|
}
|
||||||
@@ -1048,7 +1050,7 @@ void CL_FinishPMove( playermove_t *pmove, local_state_t *to )
|
|||||||
VectorCopy( pmove->angles, ps->angles );
|
VectorCopy( pmove->angles, ps->angles );
|
||||||
VectorCopy( pmove->basevelocity, ps->basevelocity );
|
VectorCopy( pmove->basevelocity, ps->basevelocity );
|
||||||
VectorCopy( pmove->punchangle, cd->punchangle );
|
VectorCopy( pmove->punchangle, cd->punchangle );
|
||||||
ps->oldbuttons = pmove->oldbuttons;
|
ps->oldbuttons = pmove->cmd.buttons;
|
||||||
ps->friction = pmove->friction;
|
ps->friction = pmove->friction;
|
||||||
ps->movetype = pmove->movetype;
|
ps->movetype = pmove->movetype;
|
||||||
ps->onground = pmove->onground;
|
ps->onground = pmove->onground;
|
||||||
@@ -1080,13 +1082,14 @@ 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 )
|
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;
|
||||||
local_state_t temp;
|
|
||||||
usercmd_t split;
|
|
||||||
|
|
||||||
memset( &temp, 0, sizeof( temp ));
|
|
||||||
|
|
||||||
if( u->msec > 50 )
|
if( u->msec > 50 )
|
||||||
{
|
{
|
||||||
|
local_state_t temp;
|
||||||
|
usercmd_t split;
|
||||||
|
|
||||||
|
memset( &temp, 0, sizeof( temp ));
|
||||||
|
|
||||||
split = *u;
|
split = *u;
|
||||||
split.msec /= 2;
|
split.msec /= 2;
|
||||||
CL_RunUsercmd( from, &temp, &split, runfuncs, time, random_seed );
|
CL_RunUsercmd( from, &temp, &split, runfuncs, time, random_seed );
|
||||||
@@ -1153,12 +1156,12 @@ Sets cl.predicted.origin and cl.predicted.angles
|
|||||||
*/
|
*/
|
||||||
void CL_PredictMovement( qboolean repredicting )
|
void CL_PredictMovement( qboolean repredicting )
|
||||||
{
|
{
|
||||||
runcmd_t *to_cmd, *from_cmd;
|
runcmd_t *to_cmd = NULL, *from_cmd;
|
||||||
local_state_t *from = NULL, *to = NULL;
|
local_state_t *from = NULL, *to = NULL;
|
||||||
int current_command;
|
uint current_command;
|
||||||
int current_command_mod;
|
uint current_command_mod;
|
||||||
frame_t *frame = NULL;
|
frame_t *frame = NULL;
|
||||||
int i, stoppoint;
|
uint i, stoppoint;
|
||||||
qboolean runfuncs;
|
qboolean runfuncs;
|
||||||
double f = 1.0;
|
double f = 1.0;
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
@@ -1227,10 +1230,6 @@ void CL_PredictMovement( qboolean repredicting )
|
|||||||
if( to_cmd->senttime >= host.realtime )
|
if( to_cmd->senttime >= host.realtime )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// now interpolate some fraction of the final frame
|
|
||||||
if( to_cmd->senttime != from_cmd->senttime )
|
|
||||||
f = (host.realtime - from_cmd->senttime) / (to_cmd->senttime - from_cmd->senttime) * 0.1;
|
|
||||||
|
|
||||||
from = to;
|
from = to;
|
||||||
from_cmd = to_cmd;
|
from_cmd = to_cmd;
|
||||||
}
|
}
|
||||||
@@ -1263,8 +1262,10 @@ void CL_PredictMovement( qboolean repredicting )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = bound( 0.0f, f, 1.0f );
|
// now interpolate some fraction of the final frame
|
||||||
f = 0.0; // FIXME: make work, do revision
|
if( to_cmd->senttime != from_cmd->senttime )
|
||||||
|
f = bound( 0.0, (host.realtime - from_cmd->senttime) / (to_cmd->senttime - from_cmd->senttime) * 0.1, 1.0 );
|
||||||
|
else f = 0.0;
|
||||||
|
|
||||||
if( CL_PlayerTeleported( from, to ))
|
if( CL_PlayerTeleported( from, to ))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -861,9 +861,7 @@ void CL_QuakeExecStuff( void )
|
|||||||
|
|
||||||
if( !*text ) break;
|
if( !*text ) break;
|
||||||
|
|
||||||
host.com_ignorebracket = true;
|
text = _COM_ParseFileSafe( text, token, sizeof( token ), PFILE_IGNOREBRACKET, NULL );
|
||||||
text = COM_ParseFile( text, token );
|
|
||||||
host.com_ignorebracket = false;
|
|
||||||
|
|
||||||
if( !text ) break;
|
if( !text ) break;
|
||||||
|
|
||||||
|
|||||||
+31
-31
@@ -98,7 +98,7 @@ CL_DuplicateTexture
|
|||||||
Dupliacte texture with remap pixels
|
Dupliacte texture with remap pixels
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
void CL_DuplicateTexture( cl_entity_t *entity, model_t *model, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
texture_t *tx = NULL;
|
texture_t *tx = NULL;
|
||||||
@@ -111,12 +111,12 @@ void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomco
|
|||||||
// save off the real texture index
|
// save off the real texture index
|
||||||
index = ptexture->index;
|
index = ptexture->index;
|
||||||
name = ref.dllFuncs.GL_TextureName( index );
|
name = ref.dllFuncs.GL_TextureName( index );
|
||||||
Q_snprintf( texname, sizeof( texname ), "#%i_%s", refState.currententity->curstate.number, name + 1 );
|
Q_snprintf( texname, sizeof( texname ), "#%i_%s", entity->curstate.number, name + 1 );
|
||||||
|
|
||||||
// search for pixels
|
// search for pixels
|
||||||
for( i = 0; i < refState.currentmodel->numtextures; i++ )
|
for( i = 0; i < model->numtextures; i++ )
|
||||||
{
|
{
|
||||||
tx = refState.currentmodel->textures[i];
|
tx = model->textures[i];
|
||||||
if( tx->gl_texturenum == index )
|
if( tx->gl_texturenum == index )
|
||||||
break; // found
|
break; // found
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ CL_UpdateStudioTexture
|
|||||||
Update texture top and bottom colors
|
Update texture top and bottom colors
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_UpdateStudioTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
void CL_UpdateStudioTexture( cl_entity_t *entity, mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
rgbdata_t *pic;
|
rgbdata_t *pic;
|
||||||
texture_t *tx = NULL;
|
texture_t *tx = NULL;
|
||||||
@@ -156,7 +156,7 @@ void CL_UpdateStudioTexture( mstudiotexture_t *ptexture, int topcolor, int botto
|
|||||||
origtexname = ref.dllFuncs.GL_TextureName( ptexture->index );
|
origtexname = ref.dllFuncs.GL_TextureName( ptexture->index );
|
||||||
|
|
||||||
// build name of original texture
|
// build name of original texture
|
||||||
Q_strncpy( mdlname, refState.currentmodel->name, sizeof( mdlname ));
|
Q_strncpy( mdlname, entity->model->name, sizeof( mdlname ));
|
||||||
COM_FileBase( ptexture->name, name );
|
COM_FileBase( ptexture->name, name );
|
||||||
COM_StripExtension( mdlname );
|
COM_StripExtension( mdlname );
|
||||||
|
|
||||||
@@ -165,9 +165,9 @@ void CL_UpdateStudioTexture( mstudiotexture_t *ptexture, int topcolor, int botto
|
|||||||
if( !index ) return; // couldn't find texture
|
if( !index ) return; // couldn't find texture
|
||||||
|
|
||||||
// search for pixels
|
// search for pixels
|
||||||
for( i = 0; i < refState.currentmodel->numtextures; i++ )
|
for( i = 0; i < entity->model->numtextures; i++ )
|
||||||
{
|
{
|
||||||
tx = refState.currentmodel->textures[i];
|
tx = entity->model->textures[i];
|
||||||
if( tx->gl_texturenum == index )
|
if( tx->gl_texturenum == index )
|
||||||
break; // found
|
break; // found
|
||||||
}
|
}
|
||||||
@@ -202,21 +202,21 @@ CL_UpdateAliasTexture
|
|||||||
Update texture top and bottom colors
|
Update texture top and bottom colors
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_UpdateAliasTexture( unsigned short *texture, int skinnum, int topcolor, int bottomcolor )
|
void CL_UpdateAliasTexture( cl_entity_t *entity, unsigned short *texture, int skinnum, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
char texname[MAX_QPATH];
|
char texname[MAX_QPATH];
|
||||||
rgbdata_t skin, *pic;
|
rgbdata_t skin, *pic;
|
||||||
texture_t *tx;
|
texture_t *tx;
|
||||||
|
|
||||||
if( !texture || !refState.currentmodel->textures )
|
if( !texture || !entity->model->textures )
|
||||||
return; // no remapinfo in model
|
return; // no remapinfo in model
|
||||||
|
|
||||||
tx = refState.currentmodel->textures[skinnum];
|
tx = entity->model->textures[skinnum];
|
||||||
if( !tx ) return; // missing texture ?
|
if( !tx ) return; // missing texture ?
|
||||||
|
|
||||||
if( *texture == 0 )
|
if( *texture == 0 )
|
||||||
{
|
{
|
||||||
Q_snprintf( texname, sizeof( texname ), "%s:remap%i_%i", refState.currentmodel->name, skinnum, refState.currententity->index );
|
Q_snprintf( texname, sizeof( texname ), "%s:remap%i_%i", entity->model->name, skinnum, entity->index );
|
||||||
skin.width = tx->width;
|
skin.width = tx->width;
|
||||||
skin.height = tx->height;
|
skin.height = tx->height;
|
||||||
skin.depth = skin.numMips = 1;
|
skin.depth = skin.numMips = 1;
|
||||||
@@ -242,7 +242,7 @@ Allocate new remap info per entity
|
|||||||
and make copy of remap textures
|
and make copy of remap textures
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
remap_info_t *info;
|
remap_info_t *info;
|
||||||
studiohdr_t *phdr;
|
studiohdr_t *phdr;
|
||||||
@@ -250,10 +250,10 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
|||||||
mstudiotexture_t *src, *dst;
|
mstudiotexture_t *src, *dst;
|
||||||
int i, size;
|
int i, size;
|
||||||
|
|
||||||
if( !refState.currententity ) return;
|
if( !entity ) return;
|
||||||
i = ( refState.currententity == &clgame.viewent ) ? clgame.maxEntities : refState.currententity->curstate.number;
|
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number;
|
||||||
|
|
||||||
if( !refState.currentmodel || ( refState.currentmodel->type != mod_alias && refState.currentmodel->type != mod_studio ))
|
if( !model || ( model->type != mod_alias && model->type != mod_studio ))
|
||||||
{
|
{
|
||||||
// entity has changed model by another type, release remap info
|
// entity has changed model by another type, release remap info
|
||||||
if( clgame.remap_info[i] )
|
if( clgame.remap_info[i] )
|
||||||
@@ -265,7 +265,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// model doesn't contains remap textures
|
// model doesn't contains remap textures
|
||||||
if( refState.currentmodel->numtextures <= 0 )
|
if( model->numtextures <= 0 )
|
||||||
{
|
{
|
||||||
// entity has changed model with no remap textures
|
// entity has changed model with no remap textures
|
||||||
if( clgame.remap_info[i] )
|
if( clgame.remap_info[i] )
|
||||||
@@ -276,16 +276,16 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( refState.currentmodel->type == mod_studio )
|
if( model->type == mod_studio )
|
||||||
{
|
{
|
||||||
phdr = (studiohdr_t *)Mod_StudioExtradata( refState.currentmodel );
|
phdr = (studiohdr_t *)Mod_StudioExtradata( model );
|
||||||
if( !phdr ) return; // bad model?
|
if( !phdr ) return; // bad model?
|
||||||
|
|
||||||
src = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex);
|
src = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex);
|
||||||
dst = (clgame.remap_info[i] ? clgame.remap_info[i]->ptexture : NULL);
|
dst = (clgame.remap_info[i] ? clgame.remap_info[i]->ptexture : NULL);
|
||||||
|
|
||||||
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
|
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
|
||||||
if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != refState.currentmodel )
|
if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != model )
|
||||||
{
|
{
|
||||||
// this code catches studiomodel change with another studiomodel with remap textures
|
// this code catches studiomodel change with another studiomodel with remap textures
|
||||||
// e.g. playermodel 'barney' with playermodel 'gordon'
|
// e.g. playermodel 'barney' with playermodel 'gordon'
|
||||||
@@ -314,16 +314,16 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
|||||||
for( i = 0; i < info->numtextures; i++ )
|
for( i = 0; i < info->numtextures; i++ )
|
||||||
{
|
{
|
||||||
if( dst[i].flags & STUDIO_NF_COLORMAP )
|
if( dst[i].flags & STUDIO_NF_COLORMAP )
|
||||||
CL_DuplicateTexture( &dst[i], topcolor, bottomcolor );
|
CL_DuplicateTexture( entity, model, &dst[i], topcolor, bottomcolor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( refState.currentmodel->type == mod_alias )
|
else if( model->type == mod_alias )
|
||||||
{
|
{
|
||||||
ahdr = (aliashdr_t *)Mod_AliasExtradata( refState.currentmodel );
|
ahdr = (aliashdr_t *)Mod_AliasExtradata( model );
|
||||||
if( !ahdr ) return; // bad model?
|
if( !ahdr ) return; // bad model?
|
||||||
|
|
||||||
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
|
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
|
||||||
if( !clgame.remap_info[i] || clgame.remap_info[i]->model != refState.currentmodel )
|
if( !clgame.remap_info[i] || clgame.remap_info[i]->model != model )
|
||||||
{
|
{
|
||||||
// this code catches studiomodel change with another studiomodel with remap textures
|
// this code catches studiomodel change with another studiomodel with remap textures
|
||||||
// e.g. playermodel 'barney' with playermodel 'gordon'
|
// e.g. playermodel 'barney' with playermodel 'gordon'
|
||||||
@@ -336,10 +336,10 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->numtextures = refState.currentmodel->numtextures;
|
info->numtextures = model->numtextures;
|
||||||
|
|
||||||
// alias remapping is easy
|
// alias remapping is easy
|
||||||
CL_UpdateRemapInfo( topcolor, bottomcolor );
|
CL_UpdateRemapInfo( entity, topcolor, bottomcolor );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -347,7 +347,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->model = refState.currentmodel;
|
info->model = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -357,12 +357,12 @@ CL_UpdateRemapInfo
|
|||||||
Update all remaps per entity
|
Update all remaps per entity
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void CL_UpdateRemapInfo( int topcolor, int bottomcolor )
|
void CL_UpdateRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
|
||||||
{
|
{
|
||||||
remap_info_t *info;
|
remap_info_t *info;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = ( refState.currententity == &clgame.viewent ) ? clgame.maxEntities : refState.currententity->curstate.number;
|
i = ( entity == &clgame.viewent ) ? clgame.maxEntities : entity->curstate.number;
|
||||||
info = clgame.remap_info[i];
|
info = clgame.remap_info[i];
|
||||||
if( !info ) return; // no remap info
|
if( !info ) return; // no remap info
|
||||||
|
|
||||||
@@ -374,9 +374,9 @@ void CL_UpdateRemapInfo( int topcolor, int bottomcolor )
|
|||||||
if( info->ptexture != NULL )
|
if( info->ptexture != NULL )
|
||||||
{
|
{
|
||||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||||
CL_UpdateStudioTexture( &info->ptexture[i], topcolor, bottomcolor );
|
CL_UpdateStudioTexture( entity, &info->ptexture[i], topcolor, bottomcolor );
|
||||||
}
|
}
|
||||||
else CL_UpdateAliasTexture( &info->textures[i], i, topcolor, bottomcolor );
|
else CL_UpdateAliasTexture( entity, &info->textures[i], i, topcolor, bottomcolor );
|
||||||
}
|
}
|
||||||
|
|
||||||
info->topcolor = topcolor;
|
info->topcolor = topcolor;
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ static render_api_t gRenderAPI =
|
|||||||
NULL, // GL_TexGen,
|
NULL, // GL_TexGen,
|
||||||
NULL, // GL_TextureTarget,
|
NULL, // GL_TextureTarget,
|
||||||
NULL, // GL_SetTexCoordArrayMode,
|
NULL, // GL_SetTexCoordArrayMode,
|
||||||
GL_GetProcAddress,
|
NULL, // GL_GetProcAddress,
|
||||||
NULL, // GL_UpdateTexSize,
|
NULL, // GL_UpdateTexSize,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@@ -309,6 +309,7 @@ static void R_FillRenderAPIFromRef( render_api_t *to, const ref_interface_t *fro
|
|||||||
to->GL_DrawParticles = from->GL_DrawParticles;
|
to->GL_DrawParticles = from->GL_DrawParticles;
|
||||||
to->LightVec = from->LightVec;
|
to->LightVec = from->LightVec;
|
||||||
to->StudioGetTexture = from->StudioGetTexture;
|
to->StudioGetTexture = from->StudioGetTexture;
|
||||||
|
to->GL_GetProcAddress = from->R_GetProcAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+66
-9
@@ -27,8 +27,11 @@ convar_t *scr_viewsize;
|
|||||||
convar_t *cl_testlights;
|
convar_t *cl_testlights;
|
||||||
convar_t *cl_allow_levelshots;
|
convar_t *cl_allow_levelshots;
|
||||||
convar_t *cl_levelshot_name;
|
convar_t *cl_levelshot_name;
|
||||||
convar_t *cl_envshot_size;
|
static convar_t *cl_envshot_size;
|
||||||
convar_t *v_dark;
|
convar_t *v_dark;
|
||||||
|
static convar_t *net_speeds;
|
||||||
|
static convar_t *cl_showfps;
|
||||||
|
static convar_t *cl_showpos;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -102,6 +105,41 @@ void SCR_DrawFPS( int height )
|
|||||||
Con_DrawString( refState.width - offset - 4, height, fpsstring, color );
|
Con_DrawString( refState.width - offset - 4, height, fpsstring, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
SCR_DrawPos
|
||||||
|
|
||||||
|
Draw local player position, angles and velocity
|
||||||
|
==============
|
||||||
|
*/
|
||||||
|
void SCR_DrawPos( void )
|
||||||
|
{
|
||||||
|
static char msg[MAX_SYSPATH];
|
||||||
|
float speed;
|
||||||
|
cl_entity_t *ent;
|
||||||
|
rgba_t color;
|
||||||
|
|
||||||
|
if( cls.state != ca_active || !cl_showpos->value || cl.background )
|
||||||
|
return;
|
||||||
|
|
||||||
|
ent = CL_GetLocalPlayer();
|
||||||
|
speed = VectorLength( cl.simvel );
|
||||||
|
|
||||||
|
Q_snprintf( msg, MAX_SYSPATH,
|
||||||
|
"pos: %.2f %.2f %.2f\n"
|
||||||
|
"ang: %.2f %.2f %.2f\n"
|
||||||
|
"velocity: %.2f",
|
||||||
|
cl.simorg[0], cl.simorg[1], cl.simorg[2],
|
||||||
|
// should we use entity angles or viewangles?
|
||||||
|
// view isn't always bound to player
|
||||||
|
ent->angles[0], ent->angles[1], ent->angles[2],
|
||||||
|
speed );
|
||||||
|
|
||||||
|
MakeRGBA( color, 255, 255, 255, 255 );
|
||||||
|
|
||||||
|
Con_DrawString( refState.width / 2, 4, msg, color );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
SCR_NetSpeeds
|
SCR_NetSpeeds
|
||||||
@@ -145,8 +183,18 @@ void SCR_NetSpeeds( void )
|
|||||||
if( cur_clfps > max_clfps ) max_clfps = cur_clfps;
|
if( cur_clfps > max_clfps ) max_clfps = cur_clfps;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_snprintf( msg, sizeof( msg ), "sv fps: ^1%4i min, ^3%4i cur, ^2%4i max\ncl fps: ^1%4i min, ^3%4i cur, ^2%4i max\nGame Time: %02d:%02d\nTotal received from server: %s\nTotal sent to server: %s\n",
|
Q_snprintf( msg, sizeof( msg ),
|
||||||
min_svfps, cur_svfps, max_svfps, min_clfps, cur_clfps, max_clfps, (int)(time / 60.0f ), (int)fmod( time, 60.0f ), Q_memprint( cls.netchan.total_received ), Q_memprint( cls.netchan.total_sended ));
|
"Updaterate: ^1%2i min, ^3%2i cur, ^2%2i max\n"
|
||||||
|
"Client FPS: ^1%i min, ^3%3i cur, ^2%3i max\n"
|
||||||
|
"Game Time: %02d:%02d\n"
|
||||||
|
"Total received from server: %s\n"
|
||||||
|
"Total sent to server: %s\n",
|
||||||
|
min_svfps, cur_svfps, max_svfps,
|
||||||
|
min_clfps, cur_clfps, max_clfps,
|
||||||
|
(int)(time / 60.0f ), (int)fmod( time, 60.0f ),
|
||||||
|
Q_memprint( cls.netchan.total_received ),
|
||||||
|
Q_memprint( cls.netchan.total_sended )
|
||||||
|
);
|
||||||
|
|
||||||
x = refState.width - 320;
|
x = refState.width - 320;
|
||||||
y = 384;
|
y = 384;
|
||||||
@@ -342,17 +390,18 @@ SCR_BeginLoadingPlaque
|
|||||||
*/
|
*/
|
||||||
void SCR_BeginLoadingPlaque( qboolean is_background )
|
void SCR_BeginLoadingPlaque( qboolean is_background )
|
||||||
{
|
{
|
||||||
float oldclear;
|
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;
|
cl.video_prepped = false;
|
||||||
oldclear = gl_clear->value;
|
|
||||||
|
if( !Host_IsDedicated() )
|
||||||
|
oldclear = gl_clear->value;
|
||||||
|
|
||||||
if( CL_IsInMenu( ) && !cls.changedemo && !is_background )
|
if( CL_IsInMenu( ) && !cls.changedemo && !is_background )
|
||||||
{
|
{
|
||||||
UI_SetActiveMenu( false );
|
UI_SetActiveMenu( false );
|
||||||
if( cls.state == ca_disconnected )
|
if( cls.state == ca_disconnected && !(GameState->curstate == STATE_RUNFRAME && GameState->nextstate != STATE_RUNFRAME) )
|
||||||
SCR_UpdateScreen();
|
SCR_UpdateScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -362,14 +411,19 @@ void SCR_BeginLoadingPlaque( qboolean is_background )
|
|||||||
if( cls.key_dest == key_console )
|
if( cls.key_dest == key_console )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gl_clear->value = 0.0f;
|
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();
|
||||||
cls.disable_screen = host.realtime;
|
cls.disable_screen = host.realtime;
|
||||||
cls.disable_servercount = cl.servercount;
|
cls.disable_servercount = cl.servercount;
|
||||||
cl.background = is_background; // set right state before svc_serverdata is came
|
cl.background = is_background; // set right state before svc_serverdata is came
|
||||||
gl_clear->value = oldclear;
|
|
||||||
|
if( !Host_IsDedicated() )
|
||||||
|
gl_clear->value = oldclear;
|
||||||
|
|
||||||
// SNDDMA_LockSound();
|
// SNDDMA_LockSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,6 +825,9 @@ void SCR_Init( void )
|
|||||||
cl_envshot_size = Cvar_Get( "cl_envshot_size", "256", FCVAR_ARCHIVE, "envshot size of cube side" );
|
cl_envshot_size = Cvar_Get( "cl_envshot_size", "256", FCVAR_ARCHIVE, "envshot size of cube side" );
|
||||||
v_dark = Cvar_Get( "v_dark", "0", 0, "starts level from dark screen" );
|
v_dark = Cvar_Get( "v_dark", "0", 0, "starts level from dark screen" );
|
||||||
scr_viewsize = Cvar_Get( "viewsize", "120", FCVAR_ARCHIVE, "screen size" );
|
scr_viewsize = Cvar_Get( "viewsize", "120", FCVAR_ARCHIVE, "screen size" );
|
||||||
|
net_speeds = Cvar_Get( "net_speeds", "0", FCVAR_ARCHIVE, "show network packets" );
|
||||||
|
cl_showfps = Cvar_Get( "cl_showfps", "1", FCVAR_ARCHIVE, "show client fps" );
|
||||||
|
cl_showpos = Cvar_Get( "cl_showpos", "0", FCVAR_ARCHIVE, "show local player position and velocity" );
|
||||||
|
|
||||||
// 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" );
|
||||||
|
|||||||
+41
-41
@@ -163,7 +163,7 @@ void CL_AddClientResources( void )
|
|||||||
// then check sounds
|
// then check sounds
|
||||||
for( i = 0; i < ARRAYSIZE( cl_player_shell_sounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( cl_player_shell_sounds ); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), "%s%s", DEFAULT_SOUNDPATH, cl_player_shell_sounds[i] );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_player_shell_sounds[i] );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( cl_player_shell_sounds[i], t_sound );
|
CL_AddClientResource( cl_player_shell_sounds[i], t_sound );
|
||||||
@@ -171,7 +171,7 @@ void CL_AddClientResources( void )
|
|||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( cl_weapon_shell_sounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( cl_weapon_shell_sounds ); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), "%s%s", DEFAULT_SOUNDPATH, cl_weapon_shell_sounds[i] );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_weapon_shell_sounds[i] );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( cl_weapon_shell_sounds[i], t_sound );
|
CL_AddClientResource( cl_weapon_shell_sounds[i], t_sound );
|
||||||
@@ -179,7 +179,7 @@ void CL_AddClientResources( void )
|
|||||||
|
|
||||||
for( i = 0; i < ARRAYSIZE( cl_explode_sounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( cl_explode_sounds ); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), "%s%s", DEFAULT_SOUNDPATH, cl_explode_sounds[i] );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_explode_sounds[i] );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( cl_explode_sounds[i], t_sound );
|
CL_AddClientResource( cl_explode_sounds[i], t_sound );
|
||||||
@@ -188,7 +188,7 @@ void CL_AddClientResources( void )
|
|||||||
#if 0 // ric sounds was precached by server-side
|
#if 0 // ric sounds was precached by server-side
|
||||||
for( i = 0; i < ARRAYSIZE( cl_ricochet_sounds ); i++ )
|
for( i = 0; i < ARRAYSIZE( cl_ricochet_sounds ); i++ )
|
||||||
{
|
{
|
||||||
Q_snprintf( filepath, sizeof( filepath ), "%s%s", DEFAULT_SOUNDPATH, cl_ricochet_sounds[i] );
|
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", cl_ricochet_sounds[i] );
|
||||||
|
|
||||||
if( !FS_FileExists( filepath, false ))
|
if( !FS_FileExists( filepath, false ))
|
||||||
CL_AddClientResource( cl_ricochet_sounds[i], t_sound );
|
CL_AddClientResource( cl_ricochet_sounds[i], t_sound );
|
||||||
@@ -322,15 +322,15 @@ void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
|
|||||||
Q_snprintf( soundname, sizeof( soundname ), "debris/wood%i.wav", COM_RandomLong( 1, 4 ));
|
Q_snprintf( soundname, sizeof( soundname ), "debris/wood%i.wav", COM_RandomLong( 1, 4 ));
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHRAP:
|
case BOUNCE_SHRAP:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "%s", cl_ricochet_sounds[COM_RandomLong( 0, 4 )] );
|
Q_strncpy( soundname, cl_ricochet_sounds[COM_RandomLong( 0, 4 )], sizeof( soundname ) );
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHOTSHELL:
|
case BOUNCE_SHOTSHELL:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "%s", cl_weapon_shell_sounds[COM_RandomLong( 0, 2 )] );
|
Q_strncpy( soundname, cl_weapon_shell_sounds[COM_RandomLong( 0, 2 )], sizeof( soundname ) );
|
||||||
isshellcasing = true; // shell casings have different playback parameters
|
isshellcasing = true; // shell casings have different playback parameters
|
||||||
fvol = 0.5f;
|
fvol = 0.5f;
|
||||||
break;
|
break;
|
||||||
case BOUNCE_SHELL:
|
case BOUNCE_SHELL:
|
||||||
Q_snprintf( soundname, sizeof( soundname ), "%s", cl_player_shell_sounds[COM_RandomLong( 0, 2 )] );
|
Q_strncpy( soundname, cl_player_shell_sounds[COM_RandomLong( 0, 2 )], sizeof( soundname ) );
|
||||||
isshellcasing = true; // shell casings have different playback parameters
|
isshellcasing = true; // shell casings have different playback parameters
|
||||||
break;
|
break;
|
||||||
case BOUNCE_CONCRETE:
|
case BOUNCE_CONCRETE:
|
||||||
@@ -550,7 +550,7 @@ CL_TempEntAlloc
|
|||||||
custom tempentity allocation
|
custom tempentity allocation
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
TEMPENTITY *CL_TempEntAllocCustom( const vec3_t org, model_t *model, int high, void (*pfn)( TEMPENTITY*, float, float ))
|
TEMPENTITY * GAME_EXPORT CL_TempEntAllocCustom( const vec3_t org, model_t *model, int high, void (*pfn)( TEMPENTITY*, float, float ))
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
|
|
||||||
@@ -587,7 +587,7 @@ R_FizzEffect
|
|||||||
Create a fizz effect
|
Create a fizz effect
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_FizzEffect( cl_entity_t *pent, int modelIndex, int density )
|
void GAME_EXPORT R_FizzEffect( cl_entity_t *pent, int modelIndex, int density )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
int i, width, depth, count;
|
int i, width, depth, count;
|
||||||
@@ -650,7 +650,7 @@ R_Bubbles
|
|||||||
Create bubbles
|
Create bubbles
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_Bubbles( const vec3_t mins, const vec3_t maxs, float height, int modelIndex, int count, float speed )
|
void GAME_EXPORT R_Bubbles( const vec3_t mins, const vec3_t maxs, float height, int modelIndex, int count, float speed )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
float sine, cosine;
|
float sine, cosine;
|
||||||
@@ -696,7 +696,7 @@ R_BubbleTrail
|
|||||||
Create bubble trail
|
Create bubble trail
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_BubbleTrail( const vec3_t start, const vec3_t end, float height, int modelIndex, int count, float speed )
|
void GAME_EXPORT R_BubbleTrail( const vec3_t start, const vec3_t end, float height, int modelIndex, int count, float speed )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
float sine, cosine, zspeed;
|
float sine, cosine, zspeed;
|
||||||
@@ -741,7 +741,7 @@ R_AttachTentToPlayer
|
|||||||
Attaches entity to player
|
Attaches entity to player
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_AttachTentToPlayer( int client, int modelIndex, float zoffset, float life )
|
void GAME_EXPORT R_AttachTentToPlayer( int client, int modelIndex, float zoffset, float life )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
vec3_t position;
|
vec3_t position;
|
||||||
@@ -797,7 +797,7 @@ R_KillAttachedTents
|
|||||||
Detach entity from player
|
Detach entity from player
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_KillAttachedTents( int client )
|
void GAME_EXPORT R_KillAttachedTents( int client )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -828,7 +828,7 @@ R_RicochetSprite
|
|||||||
Create ricochet sprite
|
Create ricochet sprite
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_RicochetSprite( const vec3_t pos, model_t *pmodel, float duration, float scale )
|
void GAME_EXPORT R_RicochetSprite( const vec3_t pos, model_t *pmodel, float duration, float scale )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
|
|
||||||
@@ -854,7 +854,7 @@ R_RocketFlare
|
|||||||
Create rocket flare
|
Create rocket flare
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_RocketFlare( const vec3_t pos )
|
void GAME_EXPORT R_RocketFlare( const vec3_t pos )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
|
|
||||||
@@ -880,7 +880,7 @@ R_MuzzleFlash
|
|||||||
Do muzzleflash
|
Do muzzleflash
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_MuzzleFlash( const vec3_t pos, int type )
|
void GAME_EXPORT R_MuzzleFlash( const vec3_t pos, int type )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
int index;
|
int index;
|
||||||
@@ -919,7 +919,7 @@ Create a high priority blood sprite
|
|||||||
and some blood drops. This is high-priority tent
|
and some blood drops. This is high-priority tent
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_BloodSprite( const vec3_t org, int colorIndex, int modelIndex, int modelIndex2, float size )
|
void GAME_EXPORT R_BloodSprite( const vec3_t org, int colorIndex, int modelIndex, int modelIndex2, float size )
|
||||||
{
|
{
|
||||||
model_t *pModel, *pModel2;
|
model_t *pModel, *pModel2;
|
||||||
int impactindex;
|
int impactindex;
|
||||||
@@ -1005,7 +1005,7 @@ R_BreakModel
|
|||||||
Create a shards
|
Create a shards
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_BreakModel( const vec3_t pos, const vec3_t size, const vec3_t dir, float random, float life, int count, int modelIndex, char flags )
|
void GAME_EXPORT R_BreakModel( const vec3_t pos, const vec3_t size, const vec3_t dir, float random, float life, int count, int modelIndex, char flags )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
model_t *pmodel;
|
model_t *pmodel;
|
||||||
@@ -1180,7 +1180,7 @@ R_SparkShower
|
|||||||
Create an animated moving sprite
|
Create an animated moving sprite
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_SparkShower( const vec3_t pos )
|
void GAME_EXPORT R_SparkShower( const vec3_t pos )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
|
|
||||||
@@ -1243,7 +1243,7 @@ R_Sprite_Explode
|
|||||||
apply params for exploding sprite
|
apply params for exploding sprite
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_Sprite_Explode( TEMPENTITY *pTemp, float scale, int flags )
|
void GAME_EXPORT R_Sprite_Explode( TEMPENTITY *pTemp, float scale, int flags )
|
||||||
{
|
{
|
||||||
if( !pTemp ) return;
|
if( !pTemp ) return;
|
||||||
|
|
||||||
@@ -1285,7 +1285,7 @@ R_Sprite_Smoke
|
|||||||
apply params for smoke sprite
|
apply params for smoke sprite
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_Sprite_Smoke( TEMPENTITY *pTemp, float scale )
|
void GAME_EXPORT R_Sprite_Smoke( TEMPENTITY *pTemp, float scale )
|
||||||
{
|
{
|
||||||
int iColor;
|
int iColor;
|
||||||
|
|
||||||
@@ -1309,7 +1309,7 @@ R_Spray
|
|||||||
Throws a shower of sprites or models
|
Throws a shower of sprites or models
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_Spray( const vec3_t pos, const vec3_t dir, int modelIndex, int count, int speed, int spread, int rendermode )
|
void GAME_EXPORT R_Spray( const vec3_t pos, const vec3_t dir, int modelIndex, int count, int speed, int spread, int rendermode )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
float noise;
|
float noise;
|
||||||
@@ -1375,7 +1375,7 @@ R_Sprite_Spray
|
|||||||
Spray of alpha sprites
|
Spray of alpha sprites
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_Sprite_Spray( const vec3_t pos, const vec3_t dir, int modelIndex, int count, int speed, int spread )
|
void GAME_EXPORT R_Sprite_Spray( const vec3_t pos, const vec3_t dir, int modelIndex, int count, int speed, int spread )
|
||||||
{
|
{
|
||||||
R_Spray( pos, dir, modelIndex, count, speed, spread, kRenderGlow );
|
R_Spray( pos, dir, modelIndex, count, speed, spread, kRenderGlow );
|
||||||
}
|
}
|
||||||
@@ -1388,7 +1388,7 @@ Line of moving glow sprites with gravity,
|
|||||||
fadeout, and collisions
|
fadeout, and collisions
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_Sprite_Trail( int type, vec3_t start, vec3_t end, int modelIndex, int count, float life, float size, float amp, int renderamt, float speed )
|
void GAME_EXPORT R_Sprite_Trail( int type, vec3_t start, vec3_t end, int modelIndex, int count, float life, float size, float amp, int renderamt, float speed )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
vec3_t delta, dir;
|
vec3_t delta, dir;
|
||||||
@@ -1440,7 +1440,7 @@ R_FunnelSprite
|
|||||||
Create a funnel effect with custom sprite
|
Create a funnel effect with custom sprite
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_FunnelSprite( const vec3_t org, int modelIndex, int reverse )
|
void GAME_EXPORT R_FunnelSprite( const vec3_t org, int modelIndex, int reverse )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
vec3_t dir, dest;
|
vec3_t dir, dest;
|
||||||
@@ -1502,7 +1502,7 @@ R_SparkEffect
|
|||||||
Create a streaks + richochet sprite
|
Create a streaks + richochet sprite
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void R_SparkEffect( const vec3_t pos, int count, int velocityMin, int velocityMax )
|
void GAME_EXPORT R_SparkEffect( const vec3_t pos, int count, int velocityMin, int velocityMax )
|
||||||
{
|
{
|
||||||
R_RicochetSprite( pos, cl_sprite_ricochet, 0.1f, COM_RandomFloat( 0.5f, 1.0f ));
|
R_RicochetSprite( pos, cl_sprite_ricochet, 0.1f, COM_RandomFloat( 0.5f, 1.0f ));
|
||||||
R_SparkStreaks( pos, count, velocityMin, velocityMax );
|
R_SparkStreaks( pos, count, velocityMin, velocityMax );
|
||||||
@@ -1515,14 +1515,14 @@ R_RicochetSound
|
|||||||
Make a random ricochet sound
|
Make a random ricochet sound
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_RicochetSound( const vec3_t pos )
|
void GAME_EXPORT R_RicochetSound( const vec3_t pos )
|
||||||
{
|
{
|
||||||
int iPitch = COM_RandomLong( 90, 105 );
|
int iPitch = COM_RandomLong( 90, 105 );
|
||||||
float fvol = COM_RandomFloat( 0.7f, 0.9f );
|
float fvol = COM_RandomFloat( 0.7f, 0.9f );
|
||||||
char soundpath[32];
|
char soundpath[32];
|
||||||
sound_t handle;
|
sound_t handle;
|
||||||
|
|
||||||
Q_snprintf( soundpath, sizeof( soundpath ), "%s", cl_ricochet_sounds[COM_RandomLong( 0, 4 )] );
|
Q_strncpy( soundpath, cl_ricochet_sounds[COM_RandomLong( 0, 4 )], sizeof( soundpath ) );
|
||||||
handle = S_RegisterSound( soundpath );
|
handle = S_RegisterSound( soundpath );
|
||||||
|
|
||||||
S_StartSound( pos, 0, CHAN_AUTO, handle, fvol, ATTN_NORM, iPitch, 0 );
|
S_StartSound( pos, 0, CHAN_AUTO, handle, fvol, ATTN_NORM, iPitch, 0 );
|
||||||
@@ -1535,7 +1535,7 @@ R_Projectile
|
|||||||
Create an projectile entity
|
Create an projectile entity
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_Projectile( const vec3_t origin, const vec3_t velocity, int modelIndex, int life, int owner, void (*hitcallback)( TEMPENTITY*, pmtrace_t* ))
|
void GAME_EXPORT R_Projectile( const vec3_t origin, const vec3_t velocity, int modelIndex, int life, int owner, void (*hitcallback)( TEMPENTITY*, pmtrace_t* ))
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
model_t *pmodel;
|
model_t *pmodel;
|
||||||
@@ -1584,7 +1584,7 @@ R_TempSphereModel
|
|||||||
Spherical shower of models, picks from set
|
Spherical shower of models, picks from set
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_TempSphereModel( const vec3_t pos, float speed, float life, int count, int modelIndex )
|
void GAME_EXPORT R_TempSphereModel( const vec3_t pos, float speed, float life, int count, int modelIndex )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
int i;
|
int i;
|
||||||
@@ -1632,7 +1632,7 @@ R_Explosion
|
|||||||
Create an explosion (scale is magnitude)
|
Create an explosion (scale is magnitude)
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_Explosion( vec3_t pos, int model, float scale, float framerate, int flags )
|
void GAME_EXPORT R_Explosion( vec3_t pos, int model, float scale, float framerate, int flags )
|
||||||
{
|
{
|
||||||
sound_t hSound;
|
sound_t hSound;
|
||||||
|
|
||||||
@@ -1672,7 +1672,7 @@ void R_Explosion( vec3_t pos, int model, float scale, float framerate, int flags
|
|||||||
|
|
||||||
if( !FBitSet( flags, TE_EXPLFLAG_NOSOUND ))
|
if( !FBitSet( flags, TE_EXPLFLAG_NOSOUND ))
|
||||||
{
|
{
|
||||||
hSound = S_RegisterSound( va( "%s", cl_explode_sounds[COM_RandomLong( 0, 2 )] ));
|
hSound = S_RegisterSound( cl_explode_sounds[COM_RandomLong( 0, 2 )] );
|
||||||
S_StartSound( pos, 0, CHAN_STATIC, hSound, VOL_NORM, 0.3f, PITCH_NORM, 0 );
|
S_StartSound( pos, 0, CHAN_STATIC, hSound, VOL_NORM, 0.3f, PITCH_NORM, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1684,7 +1684,7 @@ R_PlayerSprites
|
|||||||
Create a particle smoke around player
|
Create a particle smoke around player
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_PlayerSprites( int client, int modelIndex, int count, int size )
|
void GAME_EXPORT R_PlayerSprites( int client, int modelIndex, int count, int size )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
cl_entity_t *pEnt;
|
cl_entity_t *pEnt;
|
||||||
@@ -1749,7 +1749,7 @@ R_FireField
|
|||||||
Makes a field of fire
|
Makes a field of fire
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_FireField( float *org, int radius, int modelIndex, int count, int flags, float life )
|
void GAME_EXPORT R_FireField( float *org, int radius, int modelIndex, int count, int flags, float life )
|
||||||
{
|
{
|
||||||
TEMPENTITY *pTemp;
|
TEMPENTITY *pTemp;
|
||||||
model_t *pmodel;
|
model_t *pmodel;
|
||||||
@@ -1824,7 +1824,7 @@ R_MultiGunshot
|
|||||||
Client version of shotgun shot
|
Client version of shotgun shot
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_MultiGunshot( const vec3_t org, const vec3_t dir, const vec3_t noise, int count, int decalCount, int *decalIndices )
|
void GAME_EXPORT R_MultiGunshot( const vec3_t org, const vec3_t dir, const vec3_t noise, int count, int decalCount, int *decalIndices )
|
||||||
{
|
{
|
||||||
pmtrace_t trace;
|
pmtrace_t trace;
|
||||||
vec3_t right, up;
|
vec3_t right, up;
|
||||||
@@ -1880,7 +1880,7 @@ R_Sprite_WallPuff
|
|||||||
Create a wallpuff
|
Create a wallpuff
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void R_Sprite_WallPuff( TEMPENTITY *pTemp, float scale )
|
void GAME_EXPORT R_Sprite_WallPuff( TEMPENTITY *pTemp, float scale )
|
||||||
{
|
{
|
||||||
if( !pTemp ) return;
|
if( !pTemp ) return;
|
||||||
|
|
||||||
@@ -2878,7 +2878,7 @@ CL_FireCustomDecal
|
|||||||
custom temporary decal
|
custom temporary decal
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale )
|
void GAME_EXPORT CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale )
|
||||||
{
|
{
|
||||||
ref.dllFuncs.R_DecalShoot( textureIndex, entityIndex, modelIndex, pos, flags, scale );
|
ref.dllFuncs.R_DecalShoot( textureIndex, entityIndex, modelIndex, pos, flags, scale );
|
||||||
}
|
}
|
||||||
@@ -2890,7 +2890,7 @@ CL_DecalShoot
|
|||||||
normal temporary decal
|
normal temporary decal
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags )
|
void GAME_EXPORT CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags )
|
||||||
{
|
{
|
||||||
CL_FireCustomDecal( textureIndex, entityIndex, modelIndex, pos, flags, 1.0f );
|
CL_FireCustomDecal( textureIndex, entityIndex, modelIndex, pos, flags, 1.0f );
|
||||||
}
|
}
|
||||||
@@ -2933,7 +2933,7 @@ CL_DecalIndexFromName
|
|||||||
get decal global index from decalname
|
get decal global index from decalname
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
int CL_DecalIndexFromName( const char *name )
|
int GAME_EXPORT CL_DecalIndexFromName( const char *name )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -2956,7 +2956,7 @@ CL_DecalIndex
|
|||||||
get texture index from decal global index
|
get texture index from decal global index
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
int CL_DecalIndex( int id )
|
int GAME_EXPORT CL_DecalIndex( int id )
|
||||||
{
|
{
|
||||||
id = bound( 0, id, MAX_DECALS - 1 );
|
id = bound( 0, id, MAX_DECALS - 1 );
|
||||||
|
|
||||||
@@ -2977,7 +2977,7 @@ CL_DecalRemoveAll
|
|||||||
remove all decals with specified texture
|
remove all decals with specified texture
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void CL_DecalRemoveAll( int textureIndex )
|
void GAME_EXPORT CL_DecalRemoveAll( int textureIndex )
|
||||||
{
|
{
|
||||||
int id = bound( 0, textureIndex, MAX_DECALS - 1 );
|
int id = bound( 0, textureIndex, MAX_DECALS - 1 );
|
||||||
ref.dllFuncs.R_DecalRemoveAll( cl.decal_index[id] );
|
ref.dllFuncs.R_DecalRemoveAll( cl.decal_index[id] );
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void SCR_CheckStartupVids( void )
|
|||||||
|
|
||||||
pfile = (char *)afile;
|
pfile = (char *)afile;
|
||||||
|
|
||||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
||||||
{
|
{
|
||||||
Q_strncpy( cls.movies[c], token, sizeof( cls.movies[0] ));
|
Q_strncpy( cls.movies[c], token, sizeof( cls.movies[0] ));
|
||||||
|
|
||||||
|
|||||||
@@ -475,6 +475,7 @@ void V_PostRender( void )
|
|||||||
{
|
{
|
||||||
SCR_RSpeeds();
|
SCR_RSpeeds();
|
||||||
SCR_NetSpeeds();
|
SCR_NetSpeeds();
|
||||||
|
SCR_DrawPos();
|
||||||
SCR_DrawNetGraph();
|
SCR_DrawNetGraph();
|
||||||
SV_DrawOrthoTriangles();
|
SV_DrawOrthoTriangles();
|
||||||
CL_DrawDemoRecording();
|
CL_DrawDemoRecording();
|
||||||
|
|||||||
+19
-12
@@ -17,7 +17,7 @@ GNU General Public License for more details.
|
|||||||
#define CLIENT_H
|
#define CLIENT_H
|
||||||
|
|
||||||
#include "xash3d_types.h"
|
#include "xash3d_types.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "cdll_int.h"
|
#include "cdll_int.h"
|
||||||
#include "menu_int.h"
|
#include "menu_int.h"
|
||||||
#include "cl_entity.h"
|
#include "cl_entity.h"
|
||||||
@@ -107,8 +107,8 @@ extern int CL_UPDATE_BACKUP;
|
|||||||
#define MIN_UPDATERATE 10.0f
|
#define MIN_UPDATERATE 10.0f
|
||||||
#define MAX_UPDATERATE 102.0f
|
#define MAX_UPDATERATE 102.0f
|
||||||
|
|
||||||
#define MIN_EX_INTERP 50.0f
|
#define MIN_EX_INTERP 0.005f
|
||||||
#define MAX_EX_INTERP 100.0f
|
#define MAX_EX_INTERP 0.1f
|
||||||
|
|
||||||
#define CL_MIN_RESEND_TIME 1.5f // mininum time gap (in seconds) before a subsequent connection request is sent.
|
#define CL_MIN_RESEND_TIME 1.5f // mininum time gap (in seconds) before a subsequent connection request is sent.
|
||||||
#define CL_MAX_RESEND_TIME 20.0f // max time. The cvar cl_resend is bounded by these.
|
#define CL_MAX_RESEND_TIME 20.0f // max time. The cvar cl_resend is bounded by these.
|
||||||
@@ -437,7 +437,7 @@ typedef struct
|
|||||||
void *hInstance; // pointer to client.dll
|
void *hInstance; // pointer to client.dll
|
||||||
cldll_func_t dllFuncs; // dll exported funcs
|
cldll_func_t dllFuncs; // dll exported funcs
|
||||||
render_interface_t drawFuncs; // custom renderer support
|
render_interface_t drawFuncs; // custom renderer support
|
||||||
byte *mempool; // client edicts pool
|
poolhandle_t mempool; // client edicts pool
|
||||||
string mapname; // map name
|
string mapname; // map name
|
||||||
string maptitle; // display map title
|
string maptitle; // display map title
|
||||||
string itemspath; // path to items description for auto-complete func
|
string itemspath; // path to items description for auto-complete func
|
||||||
@@ -496,7 +496,7 @@ typedef struct
|
|||||||
void *hInstance; // pointer to client.dll
|
void *hInstance; // pointer to client.dll
|
||||||
UI_FUNCTIONS dllFuncs; // dll exported funcs
|
UI_FUNCTIONS dllFuncs; // dll exported funcs
|
||||||
UI_EXTENDED_FUNCTIONS dllFuncs2; // fwgs extension
|
UI_EXTENDED_FUNCTIONS dllFuncs2; // fwgs extension
|
||||||
byte *mempool; // client edicts pool
|
poolhandle_t mempool; // client edicts pool
|
||||||
|
|
||||||
cl_entity_t playermodel; // uiPlayerSetup drawing model
|
cl_entity_t playermodel; // uiPlayerSetup drawing model
|
||||||
player_info_t playerinfo; // local playerinfo
|
player_info_t playerinfo; // local playerinfo
|
||||||
@@ -534,7 +534,7 @@ typedef struct
|
|||||||
|
|
||||||
keydest_t key_dest;
|
keydest_t key_dest;
|
||||||
|
|
||||||
byte *mempool; // client premamnent pool: edicts etc
|
poolhandle_t mempool; // client premamnent pool: edicts etc
|
||||||
|
|
||||||
netadr_t hltv_listen_address;
|
netadr_t hltv_listen_address;
|
||||||
|
|
||||||
@@ -655,11 +655,10 @@ extern convar_t cl_allow_download;
|
|||||||
extern convar_t cl_allow_upload;
|
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_showfps;
|
|
||||||
extern convar_t *cl_envshot_size;
|
|
||||||
extern convar_t *cl_timeout;
|
extern convar_t *cl_timeout;
|
||||||
extern convar_t *cl_nodelta;
|
extern convar_t *cl_nodelta;
|
||||||
extern convar_t *cl_interp;
|
extern convar_t *cl_interp;
|
||||||
|
extern convar_t *cl_nointerp;
|
||||||
extern convar_t *cl_showerror;
|
extern convar_t *cl_showerror;
|
||||||
extern convar_t *cl_nosmooth;
|
extern convar_t *cl_nosmooth;
|
||||||
extern convar_t *cl_smoothtime;
|
extern convar_t *cl_smoothtime;
|
||||||
@@ -709,7 +708,7 @@ dlight_t *CL_GetEntityLight( int number );
|
|||||||
//
|
//
|
||||||
// cl_cmds.c
|
// cl_cmds.c
|
||||||
//
|
//
|
||||||
void CL_Quit_f( void );
|
void CL_Quit_f( void ) NORETURN;
|
||||||
void CL_ScreenShot_f( void );
|
void CL_ScreenShot_f( void );
|
||||||
void CL_SnapShot_f( void );
|
void CL_SnapShot_f( void );
|
||||||
void CL_PlayCDTrack_f( void );
|
void CL_PlayCDTrack_f( void );
|
||||||
@@ -719,6 +718,7 @@ 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 );
|
||||||
|
void CL_WavePlayLen_f( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_custom.c
|
// cl_custom.c
|
||||||
@@ -827,7 +827,7 @@ int CL_FindModelIndex( const char *m );
|
|||||||
cl_entity_t *CL_GetLocalPlayer( void );
|
cl_entity_t *CL_GetLocalPlayer( void );
|
||||||
model_t *CL_LoadClientSprite( const char *filename );
|
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_Load( const char *szPicName );
|
HSPRITE EXPORT pfnSPR_Load( const char *szPicName );
|
||||||
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
||||||
void PicAdjustSize( float *x, float *y, float *w, float *h );
|
void PicAdjustSize( float *x, float *y, float *w, float *h );
|
||||||
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
|
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
|
||||||
@@ -844,6 +844,12 @@ movevars_t *pfnGetMoveVars( void );
|
|||||||
|
|
||||||
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||||
{
|
{
|
||||||
|
if( !clgame.entities )
|
||||||
|
{
|
||||||
|
Host_Error( "CL_EDICT_NUM: clgame.entities is NULL\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if(( n >= 0 ) && ( n < clgame.maxEntities ))
|
if(( n >= 0 ) && ( n < clgame.maxEntities ))
|
||||||
return clgame.entities + n;
|
return clgame.entities + n;
|
||||||
|
|
||||||
@@ -882,6 +888,7 @@ void SCR_MakeLevelShot( void );
|
|||||||
void SCR_NetSpeeds( void );
|
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 );
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_netgraph.c
|
// cl_netgraph.c
|
||||||
@@ -953,9 +960,9 @@ void CL_EmitEntities( void );
|
|||||||
// cl_remap.c
|
// cl_remap.c
|
||||||
//
|
//
|
||||||
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
|
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
|
||||||
void CL_AllocRemapInfo( int topcolor, int bottomcolor );
|
void CL_AllocRemapInfo( cl_entity_t *entity, model_t *model, int topcolor, int bottomcolor );
|
||||||
void CL_FreeRemapInfo( remap_info_t *info );
|
void CL_FreeRemapInfo( remap_info_t *info );
|
||||||
void CL_UpdateRemapInfo( int topcolor, int bottomcolor );
|
void CL_UpdateRemapInfo( cl_entity_t *ent, int topcolor, int bottomcolor );
|
||||||
void CL_ClearAllRemaps( void );
|
void CL_ClearAllRemaps( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
+43
-33
@@ -28,6 +28,7 @@ convar_t *con_fontsize;
|
|||||||
convar_t *con_charset;
|
convar_t *con_charset;
|
||||||
convar_t *con_fontscale;
|
convar_t *con_fontscale;
|
||||||
convar_t *con_fontnum;
|
convar_t *con_fontnum;
|
||||||
|
convar_t *con_color;
|
||||||
|
|
||||||
static int g_codepage = 0;
|
static int g_codepage = 0;
|
||||||
static qboolean g_utf8 = false;
|
static qboolean g_utf8 = false;
|
||||||
@@ -145,31 +146,34 @@ void Con_Clear_f( void )
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
Con_SetColor_f
|
Con_SetColor
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_SetColor_f( void )
|
static void Con_SetColor( void )
|
||||||
{
|
{
|
||||||
vec3_t color;
|
vec3_t color;
|
||||||
|
int r, g, b;
|
||||||
|
int num;
|
||||||
|
|
||||||
switch( Cmd_Argc( ))
|
if( !FBitSet( con_color->flags, FCVAR_CHANGED ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
num = sscanf( con_color->string, "%i %i %i", &r, &g, &b );
|
||||||
|
|
||||||
|
switch( num )
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
Con_Printf( "\"con_color\" is %i %i %i\n", g_color_table[7][0], g_color_table[7][1], g_color_table[7][2] );
|
Con_DefaultColor( r, r, r );
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 3:
|
||||||
VectorSet( color, g_color_table[7][0], g_color_table[7][1], g_color_table[7][2] );
|
Con_DefaultColor( r, g, b );
|
||||||
Q_atov( color, Cmd_Argv( 1 ), 3 );
|
|
||||||
Con_DefaultColor( color[0], color[1], color[2] );
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
VectorSet( color, Q_atof( Cmd_Argv( 1 )), Q_atof( Cmd_Argv( 2 )), Q_atof( Cmd_Argv( 3 )));
|
|
||||||
Con_DefaultColor( color[0], color[1], color[2] );
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Con_Printf( S_USAGE "con_color \"r g b\"\n" );
|
Cvar_DirectSet( con_color, con_color->def_string );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClearBits( con_color->flags, FCVAR_CHANGED );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -524,7 +528,7 @@ void Con_Bottom( void )
|
|||||||
Con_Visible
|
Con_Visible
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
int Con_Visible( void )
|
int GAME_EXPORT Con_Visible( void )
|
||||||
{
|
{
|
||||||
return (con.vislines > 0);
|
return (con.vislines > 0);
|
||||||
}
|
}
|
||||||
@@ -671,7 +675,9 @@ static void Con_LoadConchars( void )
|
|||||||
Con_LoadConsoleFont( i, con.chars + i );
|
Con_LoadConsoleFont( i, con.chars + i );
|
||||||
|
|
||||||
// select properly fontsize
|
// select properly fontsize
|
||||||
if( refState.width <= 640 )
|
if( con_fontnum->value >= 0 && con_fontnum->value <= CON_NUMFONTS - 1 )
|
||||||
|
fontSize = con_fontnum->value;
|
||||||
|
else if( refState.width <= 640 )
|
||||||
fontSize = 0;
|
fontSize = 0;
|
||||||
else if( refState.width >= 1280 )
|
else if( refState.width >= 1280 )
|
||||||
fontSize = 2;
|
fontSize = 2;
|
||||||
@@ -986,14 +992,16 @@ Con_DrawStringLen
|
|||||||
compute string width and height in screen pixels
|
compute string width and height in screen pixels
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void Con_DrawStringLen( const char *pText, int *length, int *height )
|
void GAME_EXPORT Con_DrawStringLen( const char *pText, int *length, int *height )
|
||||||
{
|
{
|
||||||
int curLength = 0;
|
int curLength = 0;
|
||||||
|
|
||||||
if( !con.curFont ) return;
|
if( !con.curFont )
|
||||||
|
return;
|
||||||
if( height ) *height = con.curFont->charHeight;
|
if( height )
|
||||||
if( !length ) return;
|
*height = con.curFont->charHeight;
|
||||||
|
if (!length)
|
||||||
|
return;
|
||||||
|
|
||||||
*length = 0;
|
*length = 0;
|
||||||
|
|
||||||
@@ -1174,6 +1182,7 @@ void Con_Init( void )
|
|||||||
con_charset = Cvar_Get( "con_charset", "cp1251", FCVAR_ARCHIVE, "console font charset (only cp1251 supported now)" );
|
con_charset = Cvar_Get( "con_charset", "cp1251", FCVAR_ARCHIVE, "console font charset (only cp1251 supported now)" );
|
||||||
con_fontscale = Cvar_Get( "con_fontscale", "1.0", FCVAR_ARCHIVE, "scale font texture" );
|
con_fontscale = Cvar_Get( "con_fontscale", "1.0", FCVAR_ARCHIVE, "scale font texture" );
|
||||||
con_fontnum = Cvar_Get( "con_fontnum", "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
con_fontnum = Cvar_Get( "con_fontnum", "-1", FCVAR_ARCHIVE, "console font number (0, 1 or 2), -1 for autoselect" );
|
||||||
|
con_color = Cvar_Get( "con_color", "240 180 24", FCVAR_ARCHIVE, "set a custom console color" );
|
||||||
|
|
||||||
// init the console buffer
|
// init the console buffer
|
||||||
con.bufsize = CON_TEXTSIZE;
|
con.bufsize = CON_TEXTSIZE;
|
||||||
@@ -1192,7 +1201,6 @@ void Con_Init( void )
|
|||||||
con.chat.widthInChars = con.linewidth;
|
con.chat.widthInChars = con.linewidth;
|
||||||
|
|
||||||
Cmd_AddCommand( "toggleconsole", Con_ToggleConsole_f, "opens or closes the console" );
|
Cmd_AddCommand( "toggleconsole", Con_ToggleConsole_f, "opens or closes the console" );
|
||||||
Cmd_AddCommand( "con_color", Con_SetColor_f, "set a custom console color" );
|
|
||||||
Cmd_AddCommand( "clear", Con_Clear_f, "clear console history" );
|
Cmd_AddCommand( "clear", Con_Clear_f, "clear console history" );
|
||||||
Cmd_AddCommand( "messagemode", Con_MessageMode_f, "enable message mode \"say\"" );
|
Cmd_AddCommand( "messagemode", Con_MessageMode_f, "enable message mode \"say\"" );
|
||||||
Cmd_AddCommand( "messagemode2", Con_MessageMode2_f, "enable message mode \"say_team\"" );
|
Cmd_AddCommand( "messagemode2", Con_MessageMode2_f, "enable message mode \"say_team\"" );
|
||||||
@@ -1335,7 +1343,7 @@ Con_NPrint
|
|||||||
Draw a single debug line with specified height
|
Draw a single debug line with specified height
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_NPrintf( int idx, const char *fmt, ... )
|
void GAME_EXPORT Con_NPrintf( int idx, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
@@ -1362,7 +1370,7 @@ Con_NXPrint
|
|||||||
Draw a single debug line with specified height, color and time to live
|
Draw a single debug line with specified height, color and time to live
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Con_NXPrintf( con_nprint_t *info, const char *fmt, ... )
|
void GAME_EXPORT Con_NXPrintf( con_nprint_t *info, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
@@ -1391,7 +1399,7 @@ UI_NPrint
|
|||||||
Draw a single debug line with specified height (menu version)
|
Draw a single debug line with specified height (menu version)
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void UI_NPrintf( int idx, const char *fmt, ... )
|
void GAME_EXPORT UI_NPrintf( int idx, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
@@ -1418,7 +1426,7 @@ UI_NXPrint
|
|||||||
Draw a single debug line with specified height, color and time to live (menu version)
|
Draw a single debug line with specified height, color and time to live (menu version)
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void UI_NXPrintf( con_nprint_t *info, const char *fmt, ... )
|
void GAME_EXPORT UI_NXPrintf( con_nprint_t *info, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
@@ -1915,7 +1923,7 @@ int Con_DrawDebugLines( void )
|
|||||||
if( host.realtime < con.notify[i].expire && con.notify[i].key_dest == cls.key_dest )
|
if( host.realtime < con.notify[i].expire && con.notify[i].key_dest == cls.key_dest )
|
||||||
{
|
{
|
||||||
int x, len;
|
int x, len;
|
||||||
int fontTall;
|
int fontTall = 0;
|
||||||
|
|
||||||
Con_DrawStringLen( con.notify[i].szNotify, &len, &fontTall );
|
Con_DrawStringLen( con.notify[i].szNotify, &len, &fontTall );
|
||||||
x = refState.width - Q_max( defaultX, len ) - 10;
|
x = refState.width - Q_max( defaultX, len ) - 10;
|
||||||
@@ -2238,7 +2246,7 @@ void Con_DrawVersion( void )
|
|||||||
{
|
{
|
||||||
// draws the current build
|
// draws the current build
|
||||||
byte *color = g_color_table[7];
|
byte *color = g_color_table[7];
|
||||||
int i, stringLen, width = 0, charH;
|
int i, stringLen, width = 0, charH = 0;
|
||||||
int start, height = refState.height;
|
int start, height = refState.height;
|
||||||
qboolean draw_version = false;
|
qboolean draw_version = false;
|
||||||
string curbuild;
|
string curbuild;
|
||||||
@@ -2284,6 +2292,8 @@ void Con_RunConsole( void )
|
|||||||
{
|
{
|
||||||
float lines_per_frame;
|
float lines_per_frame;
|
||||||
|
|
||||||
|
Con_SetColor( );
|
||||||
|
|
||||||
// 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 )
|
||||||
{
|
{
|
||||||
@@ -2427,13 +2437,13 @@ void Con_VidInit( void )
|
|||||||
lmp_t *cb = (lmp_t *)FS_LoadFile( "gfx/conback.lmp", &length, false );
|
lmp_t *cb = (lmp_t *)FS_LoadFile( "gfx/conback.lmp", &length, false );
|
||||||
char ver[64];
|
char ver[64];
|
||||||
byte *dest;
|
byte *dest;
|
||||||
int x, y;
|
int x, y, len;
|
||||||
|
|
||||||
if( cb && cb->width == 320 && cb->height == 200 )
|
if( cb && cb->width == 320 && cb->height == 200 )
|
||||||
{
|
{
|
||||||
Q_snprintf( ver, 64, "%i", Q_buildnum( )); // can store only buildnum
|
len = Q_snprintf( ver, 64, "%i", Q_buildnum( )); // can store only buildnum
|
||||||
dest = (byte *)(cb + 1) + 320 * 186 + 320 - 11 - 8 * Q_strlen( ver );
|
dest = (byte *)(cb + 1) + 320 * 186 + 320 - 11 - 8 * len;
|
||||||
y = Q_strlen( ver );
|
y = len;
|
||||||
for( x = 0; x < y; x++ )
|
for( x = 0; x < y; x++ )
|
||||||
Con_DrawCharToConback( ver[x], buf, dest + (x << 3));
|
Con_DrawCharToConback( ver[x], buf, dest + (x << 3));
|
||||||
con.background = ref.dllFuncs.GL_LoadTexture( "#gfx/conback.lmp", (byte *)cb, length, TF_IMAGE );
|
con.background = ref.dllFuncs.GL_LoadTexture( "#gfx/conback.lmp", (byte *)cb, length, TF_IMAGE );
|
||||||
@@ -2485,7 +2495,7 @@ Con_DefaultColor
|
|||||||
called from MainUI
|
called from MainUI
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void Con_DefaultColor( int r, int g, int b )
|
void GAME_EXPORT Con_DefaultColor( int r, int g, int b )
|
||||||
{
|
{
|
||||||
r = bound( 0, r, 255 );
|
r = bound( 0, r, 255 );
|
||||||
g = bound( 0, g, 255 );
|
g = bound( 0, g, 255 );
|
||||||
|
|||||||
+6
-16
@@ -24,17 +24,6 @@ GNU General Public License for more details.
|
|||||||
#define SHRT_MAX 0x7FFF
|
#define SHRT_MAX 0x7FFF
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum engineAxis_e
|
|
||||||
{
|
|
||||||
JOY_AXIS_SIDE = 0,
|
|
||||||
JOY_AXIS_FWD,
|
|
||||||
JOY_AXIS_PITCH,
|
|
||||||
JOY_AXIS_YAW,
|
|
||||||
JOY_AXIS_RT,
|
|
||||||
JOY_AXIS_LT,
|
|
||||||
JOY_AXIS_NULL
|
|
||||||
} engineAxis_t;
|
|
||||||
|
|
||||||
#define MAX_AXES JOY_AXIS_NULL
|
#define MAX_AXES JOY_AXIS_NULL
|
||||||
|
|
||||||
// index - axis num come from event
|
// index - axis num come from event
|
||||||
@@ -246,8 +235,6 @@ Axis events
|
|||||||
*/
|
*/
|
||||||
void Joy_AxisMotionEvent( byte axis, short value )
|
void Joy_AxisMotionEvent( byte axis, short value )
|
||||||
{
|
{
|
||||||
byte engineAxis;
|
|
||||||
|
|
||||||
if( !joy_found->value )
|
if( !joy_found->value )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -257,8 +244,11 @@ void Joy_AxisMotionEvent( byte axis, short value )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
engineAxis = joyaxesmap[axis]; // convert to engine inner axis control
|
return Joy_KnownAxisMotionEvent( joyaxesmap[axis], value );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Joy_KnownAxisMotionEvent( engineAxis_t engineAxis, short value )
|
||||||
|
{
|
||||||
if( engineAxis == JOY_AXIS_NULL )
|
if( engineAxis == JOY_AXIS_NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -395,8 +385,8 @@ void Joy_Init( void )
|
|||||||
joy_side = Cvar_Get( "joy_side", "1.0", FCVAR_ARCHIVE, "joystick side sensitivity. Values from -1.0 to 1.0" );
|
joy_side = Cvar_Get( "joy_side", "1.0", FCVAR_ARCHIVE, "joystick side sensitivity. Values from -1.0 to 1.0" );
|
||||||
joy_forward = Cvar_Get( "joy_forward", "1.0", FCVAR_ARCHIVE, "joystick forward sensitivity. Values from -1.0 to 1.0" );
|
joy_forward = Cvar_Get( "joy_forward", "1.0", FCVAR_ARCHIVE, "joystick forward sensitivity. Values from -1.0 to 1.0" );
|
||||||
|
|
||||||
joy_lt_threshold = Cvar_Get( "joy_lt_threshold", "-16384", FCVAR_ARCHIVE, "left trigger threshold. Value from -32768 to 32767");
|
joy_lt_threshold = Cvar_Get( "joy_lt_threshold", "16384", FCVAR_ARCHIVE, "left trigger threshold. Value from 0 to 32767");
|
||||||
joy_rt_threshold = Cvar_Get( "joy_rt_threshold", "-16384", FCVAR_ARCHIVE, "right trigger threshold. Value from -32768 to 32767" );
|
joy_rt_threshold = Cvar_Get( "joy_rt_threshold", "16384", FCVAR_ARCHIVE, "right trigger threshold. Value from 0 to 32767" );
|
||||||
|
|
||||||
// emit a key event at 75% axis move
|
// emit a key event at 75% axis move
|
||||||
joy_side_key_threshold = Cvar_Get( "joy_side_key_threshold", "24576", FCVAR_ARCHIVE, "side axis key event emit threshold. Value from 0 to 32767" );
|
joy_side_key_threshold = Cvar_Get( "joy_side_key_threshold", "24576", FCVAR_ARCHIVE, "side axis key event emit threshold. Value from 0 to 32767" );
|
||||||
|
|||||||
+268
-190
@@ -25,8 +25,8 @@ typedef enum
|
|||||||
touch_move, // like a joystick stick
|
touch_move, // like a joystick stick
|
||||||
touch_joy, // like a joystick stick, centered
|
touch_joy, // like a joystick stick, centered
|
||||||
touch_dpad, // only two directions
|
touch_dpad, // only two directions
|
||||||
touch_look, // like a touchpad
|
touch_look, // like a touchpad
|
||||||
touch_wheel // scroll-like
|
touch_wheel // scroll-like
|
||||||
} touchButtonType;
|
} touchButtonType;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@@ -43,8 +43,6 @@ typedef enum
|
|||||||
round_aspect
|
round_aspect
|
||||||
} touchRound;
|
} touchRound;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct touch_button_s
|
typedef struct touch_button_s
|
||||||
{
|
{
|
||||||
// Touch button type: tap, stick or slider
|
// Touch button type: tap, stick or slider
|
||||||
@@ -69,7 +67,6 @@ typedef struct touch_button_s
|
|||||||
// Double-linked list
|
// Double-linked list
|
||||||
struct touch_button_s *next;
|
struct touch_button_s *next;
|
||||||
struct touch_button_s *prev;
|
struct touch_button_s *prev;
|
||||||
|
|
||||||
} touch_button_t;
|
} touch_button_t;
|
||||||
|
|
||||||
typedef struct touchdefaultbutton_s
|
typedef struct touchdefaultbutton_s
|
||||||
@@ -95,7 +92,7 @@ struct touch_s
|
|||||||
qboolean initialized;
|
qboolean initialized;
|
||||||
qboolean config_loaded;
|
qboolean config_loaded;
|
||||||
touchbuttonlist_t list_user, list_edit;
|
touchbuttonlist_t list_user, list_edit;
|
||||||
byte *mempool;
|
poolhandle_t mempool;
|
||||||
touchState state;
|
touchState state;
|
||||||
|
|
||||||
int look_finger;
|
int look_finger;
|
||||||
@@ -171,33 +168,76 @@ convar_t *touch_emulate;
|
|||||||
#define TO_SCRN_Y(x) (refState.height * (x))
|
#define TO_SCRN_Y(x) (refState.height * (x))
|
||||||
#define TO_SCRN_X(x) (refState.width * (x))
|
#define TO_SCRN_X(x) (refState.width * (x))
|
||||||
|
|
||||||
int pfnDrawCharacter( int x, int y, int number, int r, int g, int b );
|
|
||||||
static void IN_TouchCheckCoords( float *x1, float *y1, float *x2, float *y2 );
|
static void IN_TouchCheckCoords( float *x1, float *y1, float *x2, float *y2 );
|
||||||
static void IN_TouchEditClear( void );
|
static void IN_TouchEditClear( void );
|
||||||
static void Touch_InitConfig( void );
|
static void Touch_InitConfig( void );
|
||||||
|
|
||||||
|
/*
|
||||||
|
==========================
|
||||||
|
Touch_ExportButtonToConfig
|
||||||
|
|
||||||
|
writes button data to config
|
||||||
|
returns 0 on success, non-zero on error
|
||||||
|
==========================
|
||||||
|
*/
|
||||||
|
static inline int Touch_ExportButtonToConfig( file_t *f, touch_button_t *button, qboolean keepAspect )
|
||||||
|
{
|
||||||
|
string newCommand;
|
||||||
|
int flags = button->flags;
|
||||||
|
|
||||||
|
if( FBitSet( flags, TOUCH_FL_CLIENT ))
|
||||||
|
return 1; // skip temporary buttons
|
||||||
|
|
||||||
|
if( FBitSet( flags, TOUCH_FL_DEF_SHOW ))
|
||||||
|
ClearBits( flags, TOUCH_FL_HIDE );
|
||||||
|
|
||||||
|
if( FBitSet( flags, TOUCH_FL_DEF_HIDE ))
|
||||||
|
SetBits( flags, TOUCH_FL_HIDE );
|
||||||
|
|
||||||
|
FS_Printf( f, "touch_addbutton \"%s\" \"%s\" \"%s\" %f %f %f %f %d %d %d %d %d",
|
||||||
|
B(name), B(texturefile), newCommand,
|
||||||
|
B(x1), B(y1), B(x2), B(y2),
|
||||||
|
B(color[0]), B(color[1]), B(color[2]), B(color[3]), flags );
|
||||||
|
|
||||||
|
if( keepAspect )
|
||||||
|
{
|
||||||
|
float aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(SCR_H/SCR_W) );
|
||||||
|
FS_Printf( f, " %f\n", aspect );
|
||||||
|
}
|
||||||
|
else FS_Printf( f, "\n" );
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Touch_WriteConfig
|
||||||
|
|
||||||
|
save current touch configuration
|
||||||
|
=================
|
||||||
|
*/
|
||||||
void Touch_WriteConfig( void )
|
void Touch_WriteConfig( void )
|
||||||
{
|
{
|
||||||
file_t *f;
|
file_t *f;
|
||||||
char newconfigfile[64];
|
string newconfigfile, oldconfigfile;
|
||||||
char oldconfigfile[64];
|
|
||||||
|
|
||||||
if( !touch.list_user.first ) return;
|
if( !touch.list_user.first )
|
||||||
|
return;
|
||||||
|
|
||||||
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( "Touch_WriteConfig(): %s\n", touch_config_file->string );
|
||||||
|
|
||||||
Q_snprintf( newconfigfile, 64, "%s.new", touch_config_file->string );
|
Q_snprintf( newconfigfile, sizeof( newconfigfile ), "%s.new", touch_config_file->string );
|
||||||
Q_snprintf( oldconfigfile, 64, "%s.bak", touch_config_file->string );
|
Q_snprintf( oldconfigfile, sizeof( oldconfigfile ), "%s.bak", touch_config_file->string );
|
||||||
|
|
||||||
f = FS_Open( newconfigfile, "w", true );
|
f = FS_Open( newconfigfile, "w", true );
|
||||||
if( f )
|
if( f )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
FS_Printf( f, "//=======================================================================\n");
|
FS_Printf( f, "//=======================================================================\n");
|
||||||
FS_Printf( f, "//\tCopyright SDLash3D team & XashXT group %s ©\n", Q_timestamp( TIME_YEAR_ONLY ));
|
FS_Printf( f, "//\tCopyright FWGS & XashXT group %s (c)\n", Q_timestamp( TIME_YEAR_ONLY ));
|
||||||
FS_Printf( f, "//\t\t\ttouchscreen config\n" );
|
FS_Printf( f, "//\t\t\ttouchscreen config\n" );
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
FS_Printf( f, "\ntouch_config_file \"%s\"\n", touch_config_file->string );
|
FS_Printf( f, "\ntouch_config_file \"%s\"\n", touch_config_file->string );
|
||||||
@@ -210,7 +250,8 @@ void Touch_WriteConfig( void )
|
|||||||
FS_Printf( f, "touch_nonlinear_look \"%d\"\n", CVAR_TO_BOOL(touch_nonlinear_look));
|
FS_Printf( f, "touch_nonlinear_look \"%d\"\n", CVAR_TO_BOOL(touch_nonlinear_look));
|
||||||
FS_Printf( f, "touch_pow_factor \"%f\"\n", touch_pow_factor->value );
|
FS_Printf( f, "touch_pow_factor \"%f\"\n", touch_pow_factor->value );
|
||||||
FS_Printf( f, "touch_pow_mult \"%f\"\n", touch_pow_mult->value );
|
FS_Printf( f, "touch_pow_mult \"%f\"\n", touch_pow_mult->value );
|
||||||
FS_Printf( f, "touch_exp_mult \"%f\"\n", touch_exp_mult->value ); FS_Printf( f, "\n// grid settings\n" );
|
FS_Printf( f, "touch_exp_mult \"%f\"\n", touch_exp_mult->value );
|
||||||
|
FS_Printf( f, "\n// grid settings\n" );
|
||||||
FS_Printf( f, "touch_grid_count \"%d\"\n", (int)touch_grid_count->value );
|
FS_Printf( f, "touch_grid_count \"%d\"\n", (int)touch_grid_count->value );
|
||||||
FS_Printf( f, "touch_grid_enable \"%d\"\n", CVAR_TO_BOOL(touch_grid_enable));
|
FS_Printf( f, "touch_grid_enable \"%d\"\n", CVAR_TO_BOOL(touch_grid_enable));
|
||||||
FS_Printf( f, "\n// global overstroke (width, r, g, b, a)\n" );
|
FS_Printf( f, "\n// global overstroke (width, r, g, b, a)\n" );
|
||||||
@@ -235,27 +276,7 @@ void Touch_WriteConfig( void )
|
|||||||
|
|
||||||
for( button = touch.list_user.first; button; button = button->next )
|
for( button = touch.list_user.first; button; button = button->next )
|
||||||
{
|
{
|
||||||
string newCommand;
|
Touch_ExportButtonToConfig( f, button, false );
|
||||||
int flags = button->flags;
|
|
||||||
|
|
||||||
if( flags & TOUCH_FL_CLIENT )
|
|
||||||
continue; //skip temporary buttons
|
|
||||||
|
|
||||||
if( flags & TOUCH_FL_DEF_SHOW )
|
|
||||||
flags &= ~TOUCH_FL_HIDE;
|
|
||||||
|
|
||||||
if( flags & TOUCH_FL_DEF_HIDE )
|
|
||||||
flags |= TOUCH_FL_HIDE;
|
|
||||||
|
|
||||||
/// TODO: EscapeCommand
|
|
||||||
//Com_EscapeCommand( newCommand, B(command), MAX_STRING );
|
|
||||||
Q_strncpy( newCommand, B(command), MAX_STRING );
|
|
||||||
|
|
||||||
|
|
||||||
FS_Printf( f, "touch_addbutton \"%s\" \"%s\" \"%s\" %f %f %f %f %d %d %d %d %d\n",
|
|
||||||
B(name), B(texturefile), newCommand,
|
|
||||||
B(x1), B(y1), B(x2), B(y2),
|
|
||||||
B(color[0]), B(color[1]), B(color[2]), B(color[3]), flags );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FS_Close( f );
|
FS_Close( f );
|
||||||
@@ -268,14 +289,21 @@ void Touch_WriteConfig( void )
|
|||||||
else Con_Printf( S_ERROR "Couldn't write %s.\n", touch_config_file->string );
|
else Con_Printf( S_ERROR "Couldn't write %s.\n", touch_config_file->string );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_ExportConfig_f( void )
|
/*
|
||||||
|
=================
|
||||||
|
Touch_ExportConfig_f
|
||||||
|
|
||||||
|
export current touch configuration into profile
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
static void Touch_ExportConfig_f( void )
|
||||||
{
|
{
|
||||||
file_t *f;
|
file_t *f;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
if( Cmd_Argc() != 2 )
|
if( Cmd_Argc() != 2 )
|
||||||
{
|
{
|
||||||
Con_Printf( "Usage: touch_exportconfig <name>\n" );
|
Con_Printf( S_USAGE "touch_exportconfig <name>\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,17 +315,17 @@ void Touch_ExportConfig_f( void )
|
|||||||
f = FS_Open( name, "w", true );
|
f = FS_Open( name, "w", true );
|
||||||
if( f )
|
if( f )
|
||||||
{
|
{
|
||||||
char profilename[256];
|
string profilename, profilebase;
|
||||||
char profilebase[256];
|
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
|
|
||||||
if( Q_strstr( name, "touch_presets/" ) )
|
if( Q_strstr( name, "touch_presets/" ) )
|
||||||
{
|
{
|
||||||
COM_FileBase( name, profilebase );
|
COM_FileBase( name, profilebase );
|
||||||
Q_snprintf( profilename, 256, "touch_profiles/%s (copy).cfg", profilebase );
|
Q_snprintf( profilename, sizeof( profilebase ), "touch_profiles/%s (copy).cfg", profilebase );
|
||||||
}
|
}
|
||||||
else Q_strncpy( profilename, name, 256 );
|
else Q_strncpy( profilename, name, sizeof( profilename ));
|
||||||
FS_Printf( f, "//=======================================================================\n");
|
FS_Printf( f, "//=======================================================================\n");
|
||||||
FS_Printf( f, "//\tCopyright SDLash3D team & XashXT group %s ©\n", Q_timestamp( TIME_YEAR_ONLY ));
|
FS_Printf( f, "//\tCopyright FWGS & XashXT group %s (c)\n", Q_timestamp( TIME_YEAR_ONLY ));
|
||||||
FS_Printf( f, "//\t\t\ttouchscreen preset\n" );
|
FS_Printf( f, "//\t\t\ttouchscreen preset\n" );
|
||||||
FS_Printf( f, "//=======================================================================\n" );
|
FS_Printf( f, "//=======================================================================\n" );
|
||||||
FS_Printf( f, "\ntouch_config_file \"%s\"\n", profilename );
|
FS_Printf( f, "\ntouch_config_file \"%s\"\n", profilename );
|
||||||
@@ -312,7 +340,7 @@ void Touch_ExportConfig_f( void )
|
|||||||
FS_Printf( f, "touch_pow_mult \"%f\"\n", touch_pow_mult->value );
|
FS_Printf( f, "touch_pow_mult \"%f\"\n", touch_pow_mult->value );
|
||||||
FS_Printf( f, "touch_exp_mult \"%f\"\n", touch_exp_mult->value );
|
FS_Printf( f, "touch_exp_mult \"%f\"\n", touch_exp_mult->value );
|
||||||
FS_Printf( f, "\n// grid settings\n" );
|
FS_Printf( f, "\n// grid settings\n" );
|
||||||
FS_Printf( f, "touch_grid_count \"%d\"\n", (int)touch_grid_count );
|
FS_Printf( f, "touch_grid_count \"%d\"\n", (int)touch_grid_count->value );
|
||||||
FS_Printf( f, "touch_grid_enable \"%d\"\n", CVAR_TO_BOOL(touch_grid_enable) );
|
FS_Printf( f, "touch_grid_enable \"%d\"\n", CVAR_TO_BOOL(touch_grid_enable) );
|
||||||
FS_Printf( f, "\n// global overstroke (width, r, g, b, a)\n" );
|
FS_Printf( f, "\n// global overstroke (width, r, g, b, a)\n" );
|
||||||
FS_Printf( f, "touch_set_stroke %d %d %d %d %d\n", touch.swidth, touch.scolor[0], touch.scolor[1], touch.scolor[2], touch.scolor[3] );
|
FS_Printf( f, "touch_set_stroke %d %d %d %d %d\n", touch.swidth, touch.scolor[0], touch.scolor[1], touch.scolor[2], touch.scolor[3] );
|
||||||
@@ -335,26 +363,7 @@ void Touch_ExportConfig_f( void )
|
|||||||
FS_Printf( f, "touch_removeall\n" );
|
FS_Printf( f, "touch_removeall\n" );
|
||||||
for( button = touch.list_user.first; button; button = button->next )
|
for( button = touch.list_user.first; button; button = button->next )
|
||||||
{
|
{
|
||||||
string newCommand;
|
Touch_ExportButtonToConfig( f, button, true );
|
||||||
float aspect;
|
|
||||||
int flags = button->flags;
|
|
||||||
if( flags & TOUCH_FL_CLIENT )
|
|
||||||
continue; //skip temporary buttons
|
|
||||||
if( flags & TOUCH_FL_DEF_SHOW )
|
|
||||||
flags &= ~TOUCH_FL_HIDE;
|
|
||||||
if( flags & TOUCH_FL_DEF_HIDE )
|
|
||||||
flags |= TOUCH_FL_HIDE;
|
|
||||||
|
|
||||||
aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(SCR_H/SCR_W) );
|
|
||||||
|
|
||||||
/// TODO: EscapeCommand
|
|
||||||
//Com_EscapeCommand( newCommand, B(command), MAX_STRING );
|
|
||||||
Q_strncpy( newCommand, B(command), MAX_STRING );
|
|
||||||
|
|
||||||
FS_Printf( f, "touch_addbutton \"%s\" \"%s\" \"%s\" %f %f %f %f %d %d %d %d %d %f\n",
|
|
||||||
B(name), B(texturefile), newCommand,
|
|
||||||
B(x1), B(y1), B(x2), B(y2),
|
|
||||||
B(color[0]), B(color[1]), B(color[2]), B(color[3]), flags, aspect );
|
|
||||||
}
|
}
|
||||||
FS_Printf( f, "\n// round button coordinates to grid\n" );
|
FS_Printf( f, "\n// round button coordinates to grid\n" );
|
||||||
FS_Printf( f, "touch_roundall\n" );
|
FS_Printf( f, "touch_roundall\n" );
|
||||||
@@ -363,29 +372,33 @@ void Touch_ExportConfig_f( void )
|
|||||||
else Con_Printf( S_ERROR "Couldn't write %s.\n", name );
|
else Con_Printf( S_ERROR "Couldn't write %s.\n", name );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_GenetateCode_f( void )
|
/*
|
||||||
|
=================
|
||||||
|
Touch_GenerateCode_f
|
||||||
|
|
||||||
|
export current touch configuration into C code
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
static void Touch_GenerateCode_f( void )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
rgba_t c = {0,0,0,0};
|
rgba_t c = {0,0,0,0};
|
||||||
|
|
||||||
if( Cmd_Argc() != 1 )
|
|
||||||
{
|
|
||||||
Con_Printf( "Usage: touch_generate_code\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !touch.list_user.first ) return;
|
if( !touch.list_user.first ) return;
|
||||||
|
|
||||||
for( button = touch.list_user.first; button; button = button->next )
|
for( button = touch.list_user.first; button; button = button->next )
|
||||||
{
|
{
|
||||||
float aspect;
|
float aspect;
|
||||||
int flags = button->flags;
|
int flags = button->flags;
|
||||||
if( flags & TOUCH_FL_CLIENT )
|
|
||||||
continue; //skip temporary buttons
|
if( FBitSet( flags, TOUCH_FL_CLIENT ))
|
||||||
if( flags & TOUCH_FL_DEF_SHOW )
|
continue; // skip temporary buttons
|
||||||
flags &= ~TOUCH_FL_HIDE;
|
|
||||||
if( flags & TOUCH_FL_DEF_HIDE )
|
if( FBitSet( flags, TOUCH_FL_DEF_SHOW ))
|
||||||
flags |= TOUCH_FL_HIDE;
|
ClearBits( flags, TOUCH_FL_HIDE );
|
||||||
|
|
||||||
|
if( FBitSet( flags, TOUCH_FL_DEF_HIDE ))
|
||||||
|
SetBits( flags, TOUCH_FL_HIDE );
|
||||||
|
|
||||||
aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(SCR_H/SCR_W) );
|
aspect = ( B(y2) - B(y1) ) / ( ( B(x2) - B(x1) ) /(SCR_H/SCR_W) );
|
||||||
if( memcmp( &c, &B(color), sizeof( rgba_t ) ) )
|
if( memcmp( &c, &B(color), sizeof( rgba_t ) ) )
|
||||||
@@ -399,16 +412,18 @@ void Touch_GenetateCode_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_RoundAll_f( void )
|
static void Touch_RoundAll_f( void )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
|
|
||||||
if( !touch_grid_enable->value )
|
if( !touch_grid_enable->value )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( button = touch.list_user.first; button; button = button->next )
|
for( button = touch.list_user.first; button; button = button->next )
|
||||||
IN_TouchCheckCoords( &B(x1), &B(y1), &B(x2), &B(y2) );
|
IN_TouchCheckCoords( &B(x1), &B(y1), &B(x2), &B(y2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_ListButtons_f( void )
|
static void Touch_ListButtons_f( void )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
Touch_InitConfig();
|
Touch_InitConfig();
|
||||||
@@ -419,35 +434,44 @@ void Touch_ListButtons_f( void )
|
|||||||
B(name), B(texturefile), B(command),
|
B(name), B(texturefile), B(command),
|
||||||
B(x1), B(y1), B(x2), B(y2),
|
B(x1), B(y1), B(x2), B(y2),
|
||||||
B(color[0]), B(color[1]), B(color[2]), B(color[3]), B(flags) );
|
B(color[0]), B(color[1]), B(color[2]), B(color[3]), B(flags) );
|
||||||
|
|
||||||
if( B(flags) & TOUCH_FL_CLIENT)
|
if( B(flags) & TOUCH_FL_CLIENT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
UI_AddTouchButtonToList( B(name), B(texturefile), B(command),B(color), B(flags) );
|
UI_AddTouchButtonToList( B(name), B(texturefile), B(command),B(color), B(flags) );
|
||||||
}
|
}
|
||||||
touch.configchanged = true;
|
touch.configchanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_Stroke_f( void )
|
static void Touch_Stroke_f( void )
|
||||||
{
|
{
|
||||||
|
if( Cmd_Argc() != 6 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "touch_set_stroke <width> <r> <g> <b> <a>\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
touch.swidth = Q_atoi( Cmd_Argv( 1 ) );
|
touch.swidth = Q_atoi( Cmd_Argv( 1 ) );
|
||||||
MakeRGBA( touch.scolor, Q_atoi( Cmd_Argv( 2 ) ), Q_atoi( Cmd_Argv( 3 ) ), Q_atoi( Cmd_Argv( 4 ) ), Q_atoi( Cmd_Argv( 5 ) ) );
|
MakeRGBA( touch.scolor, Q_atoi( Cmd_Argv( 2 ) ), Q_atoi( Cmd_Argv( 3 ) ), Q_atoi( Cmd_Argv( 4 ) ), Q_atoi( Cmd_Argv( 5 ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
touch_button_t *Touch_FindButton( touchbuttonlist_t *list, const char *name )
|
static touch_button_t *Touch_FindButton( touchbuttonlist_t *list, const char *name )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
|
|
||||||
for ( button = list->first; button; button = button->next )
|
for( button = list->first; button; button = button->next )
|
||||||
if( !Q_strncmp( button->name, name, 32 ) )
|
if( !Q_strncmp( button->name, name, sizeof( button->name )))
|
||||||
return button;
|
return button;
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
touch_button_t *Touch_FindFirst( touchbuttonlist_t *list, const char *name )
|
static touch_button_t *Touch_FindFirst( touchbuttonlist_t *list, const char *name )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
|
|
||||||
for ( button = list->first; button; button = button->next )
|
for( button = list->first; button; button = button->next )
|
||||||
if( ( Q_strstr( name, "*" ) && Q_stricmpext( name, button->name ) ) || !Q_strncmp( name, button->name, 32 ) )
|
if(( Q_strchr( name, '*' ) && Q_stricmpext( name, button->name )) || !Q_strncmp( name, button->name, sizeof( button->name )))
|
||||||
return button;
|
return button;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -476,27 +500,35 @@ void Touch_SetClientOnly( qboolean state )
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_SetClientOnly_f( void )
|
static void Touch_SetClientOnly_f( void )
|
||||||
{
|
{
|
||||||
Touch_SetClientOnly( Q_atoi( Cmd_Argv( 1 ) ) );
|
if( Cmd_Argc() != 2 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "touch_setclientonly <state>\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Touch_SetClientOnly( Q_atoi( Cmd_Argv( 1 )));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_RemoveButtonFromList( touchbuttonlist_t *list, const char *name )
|
static void Touch_RemoveButtonFromList( touchbuttonlist_t *list, const char *name )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
|
|
||||||
IN_TouchEditClear();
|
IN_TouchEditClear();
|
||||||
|
|
||||||
while( ( button = Touch_FindFirst( &touch.list_user, name ) ) )
|
while(( button = Touch_FindFirst( &touch.list_user, name )))
|
||||||
{
|
{
|
||||||
if( button->prev )
|
if( button->prev )
|
||||||
button->prev->next = button->next;
|
button->prev->next = button->next;
|
||||||
else
|
else
|
||||||
list->first = button->next;
|
list->first = button->next;
|
||||||
|
|
||||||
if( button->next )
|
if( button->next )
|
||||||
button->next->prev = button->prev;
|
button->next->prev = button->prev;
|
||||||
else
|
else
|
||||||
list->last = button->prev;
|
list->last = button->prev;
|
||||||
|
|
||||||
Mem_Free( button );
|
Mem_Free( button );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,60 +539,69 @@ void Touch_RemoveButton( const char *name )
|
|||||||
Touch_RemoveButtonFromList( &touch.list_user, name );
|
Touch_RemoveButtonFromList( &touch.list_user, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
void IN_TouchRemoveButton_f( void )
|
static void IN_TouchRemoveButton_f( void )
|
||||||
{
|
{
|
||||||
Touch_RemoveButton( Cmd_Argv( 1 ) );
|
if( Cmd_Argc() != 2 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "touch_removebutton <button>\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Touch_RemoveButton( Cmd_Argv( 1 ));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_ClearList( touchbuttonlist_t *list )
|
static void Touch_ClearList( touchbuttonlist_t *list )
|
||||||
{
|
{
|
||||||
while( list->first )
|
while( list->first )
|
||||||
{
|
{
|
||||||
touch_button_t *remove = list->first;
|
touch_button_t *remove = list->first;
|
||||||
list->first = list->first->next;
|
list->first = list->first->next;
|
||||||
Mem_Free ( remove );
|
Mem_Free( remove );
|
||||||
}
|
}
|
||||||
list->first = list->last = NULL;
|
list->first = list->last = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_RemoveAll_f( void )
|
static void Touch_RemoveAll_f( void )
|
||||||
{
|
{
|
||||||
IN_TouchEditClear();
|
IN_TouchEditClear();
|
||||||
Touch_ClearList( &touch.list_user );
|
Touch_ClearList( &touch.list_user );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_SetColor( touchbuttonlist_t *list, const char *name, byte *color )
|
static void Touch_SetColor( touchbuttonlist_t *list, const char *name, byte *color )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
|
|
||||||
for( button = list->first; button; button = button->next )
|
for( button = list->first; button; button = button->next )
|
||||||
{
|
{
|
||||||
if( ( Q_strstr( name, "*" ) && Q_stricmpext( name, button->name ) ) || !Q_strncmp( name, button->name, 32 ) )
|
if(( Q_strchr( name, '*' ) && Q_stricmpext( name, button->name )) || !Q_strncmp( name, button->name, sizeof( button->name )))
|
||||||
MakeRGBA( button->color, color[0], color[1], color[2], color[3] );
|
MakeRGBA( button->color, color[0], color[1], color[2], color[3] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_SetTexture( touchbuttonlist_t *list, const char *name, const char *texture )
|
static void Touch_SetTexture( touchbuttonlist_t *list, const char *name, const char *texture )
|
||||||
{
|
{
|
||||||
touch_button_t *button = Touch_FindButton( list, name );
|
touch_button_t *button = Touch_FindButton( list, name );
|
||||||
|
|
||||||
if( !button )
|
if( !button )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
button->texture = -1; // mark for texture load
|
button->texture = -1; // mark for texture load
|
||||||
Q_strncpy( button->texturefile, texture, sizeof( button->texturefile ) );
|
Q_strncpy( button->texturefile, texture, sizeof( button->texturefile ));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_SetCommand( touch_button_t *button, const char *command )
|
static void Touch_SetCommand( touch_button_t *button, const char *command )
|
||||||
{
|
{
|
||||||
Q_strncpy( button->command, command, sizeof( button->command ) );
|
Q_strncpy( button->command, command, sizeof( button->command ));
|
||||||
|
|
||||||
if( !Q_strcmp( command, "_look" ) )
|
if( !Q_strcmp( command, "_look" ))
|
||||||
button->type = touch_look;
|
button->type = touch_look;
|
||||||
if( !Q_strcmp( command, "_move" ) )
|
else if( !Q_strcmp( command, "_move" ))
|
||||||
button->type = touch_move;
|
button->type = touch_move;
|
||||||
if( !Q_strcmp( command, "_joy" ) )
|
else if( !Q_strcmp( command, "_joy" ))
|
||||||
button->type = touch_joy;
|
button->type = touch_joy;
|
||||||
if( !Q_strcmp( command, "_dpad" ) )
|
else if( !Q_strcmp( command, "_dpad" ))
|
||||||
button->type = touch_dpad;
|
button->type = touch_dpad;
|
||||||
if( Q_stricmpext( "_wheel *", command ) || Q_stricmpext( "_hwheel *", command ) )
|
else if( Q_stricmpext( "_wheel *", command ) || Q_stricmpext( "_hwheel *", command ))
|
||||||
button->type = touch_wheel;
|
button->type = touch_wheel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -570,39 +611,50 @@ void Touch_HideButtons( const char *name, byte hide )
|
|||||||
|
|
||||||
for( button = touch.list_user.first; button; button = button->next)
|
for( button = touch.list_user.first; button; button = button->next)
|
||||||
{
|
{
|
||||||
if( ( Q_strstr( name, "*" ) && Q_stricmpext( name, button->name ) ) || !Q_strncmp( name, button->name, 32 ) )
|
if(( Q_strchr( name, '*' ) && Q_stricmpext( name, button->name )) || !Q_strncmp( name, button->name, sizeof( button->name )))
|
||||||
{
|
{
|
||||||
if( hide )
|
if( hide )
|
||||||
button->flags |= TOUCH_FL_HIDE;
|
SetBits( button->flags, TOUCH_FL_HIDE );
|
||||||
else
|
else
|
||||||
button->flags &= ~TOUCH_FL_HIDE;
|
ClearBits( button->flags, TOUCH_FL_HIDE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_ToggleSelection_f( void )
|
static void Touch_ToggleSelection_f( void )
|
||||||
{
|
{
|
||||||
if( touch.selection )
|
if( touch.selection )
|
||||||
touch.selection->flags ^= TOUCH_FL_HIDE;
|
touch.selection->flags ^= TOUCH_FL_HIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_Hide_f( void )
|
static void Touch_Hide_f( void )
|
||||||
{
|
{
|
||||||
|
if( Cmd_Argc() != 2 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "touch_hide <button>\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Touch_HideButtons( Cmd_Argv( 1 ), true );
|
Touch_HideButtons( Cmd_Argv( 1 ), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_Show_f( void )
|
static void Touch_Show_f( void )
|
||||||
{
|
{
|
||||||
|
if( Cmd_Argc() != 2 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "touch_show <button>\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Touch_HideButtons( Cmd_Argv( 1 ), false );
|
Touch_HideButtons( Cmd_Argv( 1 ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_FadeButtons( touchbuttonlist_t *list, const char *name, float speed, float end, float start )
|
static void Touch_FadeButtons( touchbuttonlist_t *list, const char *name, float speed, float end, float start )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
for( button = list->first; button; button = button->next)
|
for( button = list->first; button; button = button->next)
|
||||||
{
|
{
|
||||||
if( ( Q_strstr( name, "*" ) && Q_stricmpext( name, button->name ) ) || !Q_strncmp( name, button->name, 32 ) )
|
if(( Q_strchr( name, '*' ) && Q_stricmpext( name, button->name )) || !Q_strncmp( name, button->name, sizeof( button->name )))
|
||||||
{
|
{
|
||||||
if( start >= 0 )
|
if( start >= 0 )
|
||||||
button->fade = start;
|
button->fade = start;
|
||||||
@@ -611,17 +663,25 @@ void Touch_FadeButtons( touchbuttonlist_t *list, const char *name, float speed,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Touch_Fade_f( void )
|
|
||||||
|
static void Touch_Fade_f( void )
|
||||||
{
|
{
|
||||||
float start = -1;
|
float start = -1;
|
||||||
if( Cmd_Argc() < 4 )
|
|
||||||
return;
|
if( Cmd_Argc() == 5 )
|
||||||
if( Cmd_Argc() > 4 )
|
{
|
||||||
start = Q_atof( Cmd_Argv( 4 ) );
|
start = Q_atof( Cmd_Argv( 4 ) );
|
||||||
|
}
|
||||||
|
else if( Cmd_Argc() != 4 )
|
||||||
|
{
|
||||||
|
Con_Printf( S_USAGE "touch_fade <button> <speed> <end> [start]\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Touch_FadeButtons( &touch.list_user, Cmd_Argv( 1 ), Q_atof( Cmd_Argv( 2 )), Q_atof( Cmd_Argv( 3 )), start );
|
Touch_FadeButtons( &touch.list_user, Cmd_Argv( 1 ), Q_atof( Cmd_Argv( 2 )), Q_atof( Cmd_Argv( 3 )), start );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_SetColor_f( void )
|
static void Touch_SetColor_f( void )
|
||||||
{
|
{
|
||||||
rgba_t color;
|
rgba_t color;
|
||||||
if( Cmd_Argc() == 6 )
|
if( Cmd_Argc() == 6 )
|
||||||
@@ -630,20 +690,20 @@ void Touch_SetColor_f( void )
|
|||||||
Touch_SetColor( &touch.list_user, Cmd_Argv(1), color );
|
Touch_SetColor( &touch.list_user, Cmd_Argv(1), color );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Con_Printf( "Usage: touch_setcolor <pattern> <r> <g> <b> <a>\n" );
|
Con_Printf( S_USAGE "touch_setcolor <pattern> <r> <g> <b> <a>\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_SetTexture_f( void )
|
static void Touch_SetTexture_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 3 )
|
if( Cmd_Argc() == 3 )
|
||||||
{
|
{
|
||||||
Touch_SetTexture( &touch.list_user, Cmd_Argv( 1 ), Cmd_Argv( 2 ) );
|
Touch_SetTexture( &touch.list_user, Cmd_Argv( 1 ), Cmd_Argv( 2 ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Con_Printf( "Usage: touch_settexture <name> <file>\n" );
|
Con_Printf( S_USAGE "touch_settexture <name> <file>\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_SetFlags_f( void )
|
static void Touch_SetFlags_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 3 )
|
if( Cmd_Argc() == 3 )
|
||||||
{
|
{
|
||||||
@@ -652,10 +712,10 @@ void Touch_SetFlags_f( void )
|
|||||||
button->flags = Q_atoi( Cmd_Argv( 2 ) );
|
button->flags = Q_atoi( Cmd_Argv( 2 ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Con_Printf( "Usage: touch_setflags <name> <file>\n" );
|
Con_Printf( S_USAGE "touch_setflags <name> <file>\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_SetCommand_f( void )
|
static void Touch_SetCommand_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 3 )
|
if( Cmd_Argc() == 3 )
|
||||||
{
|
{
|
||||||
@@ -668,9 +728,10 @@ void Touch_SetCommand_f( void )
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Con_Printf( "Usage: touch_setcommand <name> <command>\n" );
|
Con_Printf( S_USAGE "touch_setcommand <name> <command>\n" );
|
||||||
}
|
}
|
||||||
void Touch_ReloadConfig_f( void )
|
|
||||||
|
static void Touch_ReloadConfig_f( void )
|
||||||
{
|
{
|
||||||
touch.state = state_none;
|
touch.state = state_none;
|
||||||
if( touch.edit )
|
if( touch.edit )
|
||||||
@@ -683,12 +744,13 @@ void Touch_ReloadConfig_f( void )
|
|||||||
Cbuf_AddText( va("exec %s\n", touch_config_file->string ) );
|
Cbuf_AddText( va("exec %s\n", touch_config_file->string ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
touch_button_t *Touch_AddButton( touchbuttonlist_t *list, const char *name, const char *texture, const char *command, float x1, float y1, float x2, float y2, byte *color )
|
static touch_button_t *Touch_AddButton( touchbuttonlist_t *list, const char *name, const char *texture, const char *command, float x1, float y1, float x2, float y2, byte *color )
|
||||||
{
|
{
|
||||||
touch_button_t *button = Mem_Calloc( touch.mempool, sizeof( touch_button_t ) );
|
touch_button_t *button = Mem_Calloc( touch.mempool, sizeof( touch_button_t ) );
|
||||||
|
|
||||||
button->texture = -1;
|
button->texture = -1;
|
||||||
Q_strncpy( button->texturefile, texture, sizeof( button->texturefile ) );
|
Q_strncpy( button->texturefile, texture, sizeof( B( texturefile )));
|
||||||
Q_strncpy( button->name, name, 32 );
|
Q_strncpy( button->name, name, sizeof( B( name )));
|
||||||
Touch_RemoveButtonFromList( list, name ); //replace if exist
|
Touch_RemoveButtonFromList( list, name ); //replace if exist
|
||||||
button->x1 = x1;
|
button->x1 = x1;
|
||||||
button->y1 = y1;
|
button->y1 = y1;
|
||||||
@@ -731,7 +793,7 @@ void Touch_AddClientButton( const char *name, const char *texture, const char *c
|
|||||||
button->aspect = aspect;
|
button->aspect = aspect;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_LoadDefaults_f( void )
|
static void Touch_LoadDefaults_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for( i = 0; i < g_LastDefaultButton; i++ )
|
for( i = 0; i < g_LastDefaultButton; i++ )
|
||||||
@@ -759,23 +821,27 @@ void Touch_LoadDefaults_f( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add default button from client
|
// Add default button from client
|
||||||
void Touch_AddDefaultButton( const char *name, const char *texturefile, const char *command, float x1, float y1, float x2, float y2, byte *color, int round, float aspect, int flags )
|
void Touch_AddDefaultButton( const char *name, const char *texturefile, const char *command, float x1, float y1, float x2, float y2, byte *color, int round, float aspect, int flags )
|
||||||
{
|
{
|
||||||
|
touchdefaultbutton_t *button;
|
||||||
|
|
||||||
if( g_LastDefaultButton >= 255 )
|
if( g_LastDefaultButton >= 255 )
|
||||||
return;
|
return;
|
||||||
Q_strncpy( g_DefaultButtons[g_LastDefaultButton].name, name, 32 );
|
|
||||||
Q_strncpy( g_DefaultButtons[g_LastDefaultButton].texturefile, texturefile, 256 );
|
button = g_DefaultButtons + g_LastDefaultButton;
|
||||||
Q_strncpy( g_DefaultButtons[g_LastDefaultButton].command, command, 256 );
|
|
||||||
g_DefaultButtons[g_LastDefaultButton].x1 = x1;
|
Q_strncpy( B( name ), name, sizeof( B( name )));
|
||||||
g_DefaultButtons[g_LastDefaultButton].y1 = y1;
|
Q_strncpy( B( texturefile ), texturefile, sizeof( B( texturefile )));
|
||||||
g_DefaultButtons[g_LastDefaultButton].x2 = x2;
|
Q_strncpy( B( command ), command, sizeof( B( command )));
|
||||||
g_DefaultButtons[g_LastDefaultButton].y2 = y2;
|
B( x1 ) = x1;
|
||||||
MakeRGBA( g_DefaultButtons[g_LastDefaultButton].color, color[0], color[1], color[2], color[3] );
|
B( y1 ) = y1;
|
||||||
g_DefaultButtons[g_LastDefaultButton].round = round;
|
B( x2 ) = x2;
|
||||||
g_DefaultButtons[g_LastDefaultButton].aspect = aspect;
|
B( y2 ) = y2;
|
||||||
g_DefaultButtons[g_LastDefaultButton].flags = flags;
|
MakeRGBA( B( color ), color[0], color[1], color[2], color[3] );
|
||||||
|
B( round ) = round;
|
||||||
|
B( aspect ) = aspect;
|
||||||
|
B( flags ) = flags;
|
||||||
g_LastDefaultButton++;
|
g_LastDefaultButton++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,7 +850,8 @@ void Touch_ResetDefaultButtons( void )
|
|||||||
{
|
{
|
||||||
g_LastDefaultButton = 0;
|
g_LastDefaultButton = 0;
|
||||||
}
|
}
|
||||||
void Touch_AddButton_f( void )
|
|
||||||
|
static void Touch_AddButton_f( void )
|
||||||
{
|
{
|
||||||
rgba_t color;
|
rgba_t color;
|
||||||
int argc = Cmd_Argc( );
|
int argc = Cmd_Argc( );
|
||||||
@@ -799,7 +866,9 @@ void Touch_AddButton_f( void )
|
|||||||
Q_atof( Cmd_Argv(6) ), Q_atof( Cmd_Argv(7) ) ,
|
Q_atof( Cmd_Argv(6) ), Q_atof( Cmd_Argv(7) ) ,
|
||||||
color );
|
color );
|
||||||
if( argc >= 13 )
|
if( argc >= 13 )
|
||||||
|
{
|
||||||
button->flags = Q_atoi( Cmd_Argv(12) );
|
button->flags = Q_atoi( Cmd_Argv(12) );
|
||||||
|
}
|
||||||
if( argc >= 14 )
|
if( argc >= 14 )
|
||||||
{
|
{
|
||||||
// Recalculate button coordinates aspect ratio
|
// Recalculate button coordinates aspect ratio
|
||||||
@@ -830,10 +899,10 @@ void Touch_AddButton_f( void )
|
|||||||
Touch_AddButton( &touch.list_user, Cmd_Argv(1), Cmd_Argv(2), Cmd_Argv(3), 0.4, 0.4, 0.6, 0.6, color );
|
Touch_AddButton( &touch.list_user, Cmd_Argv(1), Cmd_Argv(2), Cmd_Argv(3), 0.4, 0.4, 0.6, 0.6, color );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Con_Printf( "Usage: touch_addbutton <name> <texture> <command> [<x1> <y1> <x2> <y2> [ r g b a ] ]\n" );
|
Con_Printf( S_USAGE "touch_addbutton <name> <texture> <command> [<x1> <y1> <x2> <y2> [ r g b a ] ]\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_EnableEdit_f( void )
|
static void Touch_EnableEdit_f( void )
|
||||||
{
|
{
|
||||||
if( touch.state == state_none )
|
if( touch.state == state_none )
|
||||||
touch.state = state_edit;
|
touch.state = state_edit;
|
||||||
@@ -842,7 +911,7 @@ void Touch_EnableEdit_f( void )
|
|||||||
touch.configchanged = true;
|
touch.configchanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_DisableEdit_f( void )
|
static void Touch_DisableEdit_f( void )
|
||||||
{
|
{
|
||||||
touch.state = state_none;
|
touch.state = state_none;
|
||||||
if( touch.edit )
|
if( touch.edit )
|
||||||
@@ -852,7 +921,7 @@ void Touch_DisableEdit_f( void )
|
|||||||
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( CVAR_TO_BOOL(touch_in_menu) )
|
if( CVAR_TO_BOOL( touch_in_menu ))
|
||||||
{
|
{
|
||||||
Cvar_Set( "touch_in_menu", "0" );
|
Cvar_Set( "touch_in_menu", "0" );
|
||||||
}
|
}
|
||||||
@@ -860,11 +929,11 @@ void Touch_DisableEdit_f( void )
|
|||||||
Touch_WriteConfig();
|
Touch_WriteConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_DeleteProfile_f( void )
|
static void Touch_DeleteProfile_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() != 2 )
|
if( Cmd_Argc() != 2 )
|
||||||
{
|
{
|
||||||
Con_Printf( "Usage: touch_deleteprofile <name>\n" );
|
Con_Printf( S_USAGE "touch_deleteprofile <name>\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -872,21 +941,32 @@ void Touch_DeleteProfile_f( void )
|
|||||||
FS_Delete( va( "touch_profiles/%s.cfg", Cmd_Argv( 1 )));
|
FS_Delete( va( "touch_profiles/%s.cfg", Cmd_Argv( 1 )));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_InitEditor( void )
|
static void Touch_InitEditor( void )
|
||||||
{
|
{
|
||||||
float x = 0.1f * (SCR_H/SCR_W);
|
float x = 0.1f * (SCR_H/SCR_W);
|
||||||
float y = 0.05f;
|
float y = 0.05f;
|
||||||
|
touch_button_t *temp;
|
||||||
|
|
||||||
Touch_ClearList( &touch.list_edit );
|
Touch_ClearList( &touch.list_edit );
|
||||||
|
|
||||||
Touch_AddButton( &touch.list_edit, "close", "touch_default/edit_close.tga", "touch_disableedit", 0, y, x, y + 0.1f, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
temp = Touch_AddButton( &touch.list_edit, "close", "touch_default/edit_close.tga", "touch_disableedit", 0, y, x, y + 0.1f, (byte*)"\xff\xff\xff\xff" );
|
||||||
Touch_AddButton( &touch.list_edit, "close", "#Close and save", "", x, y, x + 0.2f, y + 0.1f, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
SetBits( temp->flags, TOUCH_FL_NOEDIT );
|
||||||
|
|
||||||
|
temp = Touch_AddButton( &touch.list_edit, "close", "#Close and save", "", x, y, x + 0.2f, y + 0.1f, (byte*)"\xff\xff\xff\xff" );
|
||||||
|
SetBits( temp->flags, TOUCH_FL_NOEDIT );
|
||||||
|
|
||||||
y += 0.2f;
|
y += 0.2f;
|
||||||
Touch_AddButton( &touch.list_edit, "cancel", "touch_default/edit_reset.tga", "touch_reloadconfig", 0, y, x, y + 0.1f, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
|
||||||
Touch_AddButton( &touch.list_edit, "close", "#Cancel and reset", "", x, y, x + 0.2f, y + 0.1f, (byte*)"\xff\xff\xff\xff" )->flags |= TOUCH_FL_NOEDIT;
|
temp = Touch_AddButton( &touch.list_edit, "cancel", "touch_default/edit_reset.tga", "touch_reloadconfig", 0, y, x, y + 0.1f, (byte*)"\xff\xff\xff\xff" );
|
||||||
|
SetBits( temp->flags, TOUCH_FL_NOEDIT );
|
||||||
|
|
||||||
|
temp = Touch_AddButton( &touch.list_edit, "close", "#Cancel and reset", "", x, y, x + 0.2f, y + 0.1f, (byte*)"\xff\xff\xff\xff" );
|
||||||
|
SetBits( temp->flags, TOUCH_FL_NOEDIT );
|
||||||
|
|
||||||
y += 0.2f;
|
y += 0.2f;
|
||||||
|
|
||||||
touch.hidebutton = Touch_AddButton( &touch.list_edit, "showhide", "touch_default/edit_hide.tga", "touch_toggleselection", 0, y, x, y + 0.1f, (byte*)"\xff\xff\xff\xff" );
|
touch.hidebutton = Touch_AddButton( &touch.list_edit, "showhide", "touch_default/edit_hide.tga", "touch_toggleselection", 0, y, x, y + 0.1f, (byte*)"\xff\xff\xff\xff" );
|
||||||
touch.hidebutton->flags |= TOUCH_FL_HIDE | TOUCH_FL_NOEDIT;
|
SetBits( touch.hidebutton->flags, TOUCH_FL_HIDE | TOUCH_FL_NOEDIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_Init( void )
|
void Touch_Init( void )
|
||||||
@@ -952,7 +1032,7 @@ void Touch_Init( void )
|
|||||||
Cmd_AddCommand( "touch_reloadconfig", Touch_ReloadConfig_f, "load config, not saving changes" );
|
Cmd_AddCommand( "touch_reloadconfig", Touch_ReloadConfig_f, "load config, not saving changes" );
|
||||||
Cmd_AddCommand( "touch_writeconfig", Touch_WriteConfig, "save current config" );
|
Cmd_AddCommand( "touch_writeconfig", Touch_WriteConfig, "save current config" );
|
||||||
Cmd_AddCommand( "touch_deleteprofile", Touch_DeleteProfile_f, "delete profile by name" );
|
Cmd_AddCommand( "touch_deleteprofile", Touch_DeleteProfile_f, "delete profile by name" );
|
||||||
Cmd_AddCommand( "touch_generate_code", Touch_GenetateCode_f, "create code sample for mobility API" );
|
Cmd_AddCommand( "touch_generate_code", Touch_GenerateCode_f, "create code sample for mobility API" );
|
||||||
Cmd_AddCommand( "touch_fade", Touch_Fade_f, "start fade animation for selected buttons" );
|
Cmd_AddCommand( "touch_fade", Touch_Fade_f, "start fade animation for selected buttons" );
|
||||||
Cmd_AddCommand( "touch_toggleselection", Touch_ToggleSelection_f, "toggle vidibility on selected button in editor" );
|
Cmd_AddCommand( "touch_toggleselection", Touch_ToggleSelection_f, "toggle vidibility on selected button in editor" );
|
||||||
|
|
||||||
@@ -992,6 +1072,7 @@ void Touch_Init( void )
|
|||||||
|
|
||||||
touch.initialized = true;
|
touch.initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//int pfnGetScreenInfo( SCREENINFO *pscrinfo );
|
//int pfnGetScreenInfo( SCREENINFO *pscrinfo );
|
||||||
static void Touch_InitConfig( void )
|
static void Touch_InitConfig( void )
|
||||||
{
|
{
|
||||||
@@ -1016,36 +1097,36 @@ static void Touch_InitConfig( void )
|
|||||||
touch.configchanged = false;
|
touch.configchanged = false;
|
||||||
touch.config_loaded = true;
|
touch.config_loaded = true;
|
||||||
}
|
}
|
||||||
qboolean Touch_IsVisible( touch_button_t *button )
|
|
||||||
|
/*
|
||||||
|
============================================================================
|
||||||
|
|
||||||
|
TOUCH CONTROLS RENDERING
|
||||||
|
|
||||||
|
============================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
static qboolean Touch_IsVisible( touch_button_t *button )
|
||||||
{
|
{
|
||||||
if( !(button->flags & TOUCH_FL_CLIENT) && touch.clientonly )
|
if( !FBitSet( button->flags, TOUCH_FL_CLIENT ) && touch.clientonly )
|
||||||
return false; // skip nonclient buttons in clientonly mode
|
return false; // skip nonclient buttons in clientonly mode
|
||||||
|
|
||||||
if( touch.state >= state_edit )
|
if( touch.state >= state_edit )
|
||||||
return true; //!!! Draw when editor is open
|
return true; //!!! Draw when editor is open
|
||||||
|
|
||||||
if( button->flags & TOUCH_FL_HIDE )
|
if( FBitSet( button->flags, TOUCH_FL_HIDE ))
|
||||||
return false; // skip hidden
|
return false; // skip hidden
|
||||||
|
|
||||||
if( button->flags & TOUCH_FL_SP && CL_GetMaxClients() != 1 )
|
if( FBitSet( button->flags, TOUCH_FL_SP ) && CL_GetMaxClients() != 1 )
|
||||||
return false; // skip singleplayer(load, save) buttons in multiplayer
|
return false; // skip singleplayer(load, save) buttons in multiplayer
|
||||||
|
|
||||||
if( button->flags & TOUCH_FL_MP && CL_GetMaxClients() == 1 )
|
if( FBitSet( button->flags, TOUCH_FL_MP ) && CL_GetMaxClients() == 1 )
|
||||||
return false; // skip multiplayer buttons in singleplayer
|
return false; // skip multiplayer buttons in singleplayer
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
/*
|
|
||||||
return ( !touch.clientonly || ( button->flags & TOUCH_FL_CLIENT) ) &&
|
|
||||||
(
|
|
||||||
( touch.state >= state_edit )
|
|
||||||
||( !( button->flags & TOUCH_FL_HIDE )
|
|
||||||
&& ( !(button->flags & TOUCH_FL_SP) || ( CL_GetMaxClients() == 1 ) )
|
|
||||||
&& ( !(button->flags & TOUCH_FL_MP) || ( CL_GetMaxClients() != 1 ) ) )
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_DrawTexture ( float x1, float y1, float x2, float y2, int texture, byte r, byte g, byte b, byte a )
|
static void Touch_DrawTexture ( float x1, float y1, float x2, float y2, int texture, byte r, byte g, byte b, byte a )
|
||||||
{
|
{
|
||||||
if( x1 >= x2 )
|
if( x1 >= x2 )
|
||||||
return;
|
return;
|
||||||
@@ -1083,7 +1164,7 @@ static void IN_TouchCheckCoords( float *x1, float *y1, float *x2, float *y2 )
|
|||||||
*y1 -= *y2 - 1, *y2 = 1;
|
*y1 -= *y2 - 1, *y2 = 1;
|
||||||
if( *x2 > 1 )
|
if( *x2 > 1 )
|
||||||
*x1 -= *x2 - 1, *x2 = 1;
|
*x1 -= *x2 - 1, *x2 = 1;
|
||||||
if ( CVAR_TO_BOOL(touch_grid_enable) )
|
if( CVAR_TO_BOOL( touch_grid_enable ))
|
||||||
{
|
{
|
||||||
*x1 = GRID_ROUND_X( *x1 );
|
*x1 = GRID_ROUND_X( *x1 );
|
||||||
*x2 = GRID_ROUND_X( *x2 );
|
*x2 = GRID_ROUND_X( *x2 );
|
||||||
@@ -1092,7 +1173,7 @@ static void IN_TouchCheckCoords( float *x1, float *y1, float *x2, float *y2 )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float Touch_DrawCharacter( float x, float y, int number, float size )
|
static float Touch_DrawCharacter( float x, float y, int number, float size )
|
||||||
{
|
{
|
||||||
float s1, s2, t1, t2, width, height;
|
float s1, s2, t1, t2, width, height;
|
||||||
int w, h;
|
int w, h;
|
||||||
@@ -1103,7 +1184,6 @@ float Touch_DrawCharacter( float x, float y, int number, float size )
|
|||||||
number &= 255;
|
number &= 255;
|
||||||
number = Con_UtfProcessChar( number );
|
number = Con_UtfProcessChar( number );
|
||||||
|
|
||||||
|
|
||||||
R_GetTextureParms( &w, &h, cls.creditsFont.hFontTexture );
|
R_GetTextureParms( &w, &h, cls.creditsFont.hFontTexture );
|
||||||
prc = &cls.creditsFont.fontRc[number];
|
prc = &cls.creditsFont.fontRc[number];
|
||||||
|
|
||||||
@@ -1119,7 +1199,7 @@ float Touch_DrawCharacter( float x, float y, int number, float size )
|
|||||||
return width;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Touch_DrawText( float x1, float y1, float x2, float y2, const char *s, byte *color, float size )
|
static float Touch_DrawText( float x1, float y1, float x2, float y2, const char *s, byte *color, float size )
|
||||||
{
|
{
|
||||||
float x = x1;
|
float x = x1;
|
||||||
float maxy = y2;
|
float maxy = y2;
|
||||||
@@ -1156,7 +1236,7 @@ float Touch_DrawText( float x1, float y1, float x2, float y2, const char *s, byt
|
|||||||
return x1;
|
return x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Touch_DrawButtons( touchbuttonlist_t *list )
|
static void Touch_DrawButtons( touchbuttonlist_t *list )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
|
|
||||||
@@ -1178,7 +1258,7 @@ void Touch_DrawButtons( touchbuttonlist_t *list )
|
|||||||
B( fadespeed ) = 0, B( fade ) = B( fadeend ) ;
|
B( fadespeed ) = 0, B( fade ) = B( fadeend ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( B( finger ) != -1 ) && !( B( flags ) & TOUCH_FL_CLIENT ) )
|
if( ( B( finger ) != -1 ) && !FBitSet( B( flags ), TOUCH_FL_CLIENT ) )
|
||||||
{
|
{
|
||||||
color[0] = bound( 0,(float) color[0] * touch_highlight_r->value, 255 );
|
color[0] = bound( 0,(float) color[0] * touch_highlight_r->value, 255 );
|
||||||
color[1] = bound( 0,(float) color[1] * touch_highlight_g->value, 255 );
|
color[1] = bound( 0,(float) color[1] * touch_highlight_g->value, 255 );
|
||||||
@@ -1196,14 +1276,14 @@ void Touch_DrawButtons( touchbuttonlist_t *list )
|
|||||||
button->texture = ref.dllFuncs.GL_LoadTexture( button->texturefile, NULL, 0, TF_NOMIPMAP );
|
button->texture = ref.dllFuncs.GL_LoadTexture( button->texturefile, NULL, 0, TF_NOMIPMAP );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( B(flags) & TOUCH_FL_DRAW_ADDITIVE )
|
if( FBitSet( B(flags), TOUCH_FL_DRAW_ADDITIVE ))
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||||
|
|
||||||
Touch_DrawTexture( B(x1), B(y1), B(x2), B(y2), B(texture), color[0], color[1], color[2], color[3] );
|
Touch_DrawTexture( B(x1), B(y1), B(x2), B(y2), B(texture), color[0], color[1], color[2], color[3] );
|
||||||
|
|
||||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||||
}
|
}
|
||||||
if( B(flags) & TOUCH_FL_STROKE )
|
if( FBitSet( B(flags), TOUCH_FL_STROKE ))
|
||||||
{
|
{
|
||||||
ref.dllFuncs.Color4ub( touch.scolor[0], touch.scolor[1], touch.scolor[2], touch.scolor[3] * B( fade ) );
|
ref.dllFuncs.Color4ub( touch.scolor[0], touch.scolor[1], touch.scolor[2], touch.scolor[3] * B( fade ) );
|
||||||
ref.dllFuncs.R_DrawStretchPic( TO_SCRN_X(B(x1)),
|
ref.dllFuncs.R_DrawStretchPic( TO_SCRN_X(B(x1)),
|
||||||
@@ -1232,7 +1312,7 @@ void Touch_DrawButtons( touchbuttonlist_t *list )
|
|||||||
if( touch.state >= state_edit && !( button->flags & TOUCH_FL_NOEDIT ) )
|
if( touch.state >= state_edit && !( button->flags & TOUCH_FL_NOEDIT ) )
|
||||||
{
|
{
|
||||||
rgba_t color;
|
rgba_t color;
|
||||||
if( !( button->flags & TOUCH_FL_HIDE ) )
|
if( !FBitSet( button->flags, TOUCH_FL_HIDE ) )
|
||||||
Touch_DrawTexture( B(x1), B(y1), B(x2), B(y2), touch.whitetexture, 255, 255, 0, 32 );
|
Touch_DrawTexture( B(x1), B(y1), B(x2), B(y2), touch.whitetexture, 255, 255, 0, 32 );
|
||||||
else
|
else
|
||||||
Touch_DrawTexture( B(x1), B(y1), B(x2), B(y2), touch.whitetexture, 128, 128, 128, 128 );
|
Touch_DrawTexture( B(x1), B(y1), B(x2), B(y2), touch.whitetexture, 128, 128, 128, 128 );
|
||||||
@@ -1265,13 +1345,13 @@ void Touch_Draw( void )
|
|||||||
else
|
else
|
||||||
Touch_DrawTexture( 0, 0, 1, 1, touch.whitetexture, 0, 0, 0, 112 );
|
Touch_DrawTexture( 0, 0, 1, 1, touch.whitetexture, 0, 0, 0, 112 );
|
||||||
ref.dllFuncs.Color4ub( 0, 224, 224, 112 );
|
ref.dllFuncs.Color4ub( 0, 224, 224, 112 );
|
||||||
for ( x = 0; x < 1 ; x += GRID_X )
|
for( x = 0; x < 1 ; x += GRID_X )
|
||||||
ref.dllFuncs.R_DrawStretchPic( TO_SCRN_X(x),
|
ref.dllFuncs.R_DrawStretchPic( TO_SCRN_X(x),
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
TO_SCRN_Y(1),
|
TO_SCRN_Y(1),
|
||||||
0, 0, 1, 1, touch.whitetexture );
|
0, 0, 1, 1, touch.whitetexture );
|
||||||
for ( x = 0; x < 1 ; x += GRID_Y )
|
for( x = 0; x < 1 ; x += GRID_Y )
|
||||||
ref.dllFuncs.R_DrawStretchPic( 0,
|
ref.dllFuncs.R_DrawStretchPic( 0,
|
||||||
TO_SCRN_Y(x),
|
TO_SCRN_Y(x),
|
||||||
TO_SCRN_X(1),
|
TO_SCRN_X(1),
|
||||||
@@ -1389,7 +1469,7 @@ static void Touch_EditMove( touchEventType type, int fingerID, float x, float y,
|
|||||||
touch.hidebutton->texture = -1;
|
touch.hidebutton->texture = -1;
|
||||||
touch.hidebutton->flags &= ~TOUCH_FL_HIDE;
|
touch.hidebutton->flags &= ~TOUCH_FL_HIDE;
|
||||||
|
|
||||||
if( button->flags & TOUCH_FL_HIDE )
|
if( FBitSet( button->flags, TOUCH_FL_HIDE ))
|
||||||
Q_strcpy( touch.hidebutton->texturefile, "touch_default/edit_show.tga" );
|
Q_strcpy( touch.hidebutton->texturefile, "touch_default/edit_show.tga" );
|
||||||
else
|
else
|
||||||
Q_strcpy( touch.hidebutton->texturefile, "touch_default/edit_hide.tga" );
|
Q_strcpy( touch.hidebutton->texturefile, "touch_default/edit_hide.tga" );
|
||||||
@@ -1522,7 +1602,6 @@ static void Touch_Motion( touchEventType type, int fingerID, float x, float y, f
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static qboolean Touch_ButtonPress( touchbuttonlist_t *list, touchEventType type, int fingerID, float x, float y, float dx, float dy )
|
static qboolean Touch_ButtonPress( touchbuttonlist_t *list, touchEventType type, int fingerID, float x, float y, float dx, float dy )
|
||||||
{
|
{
|
||||||
touch_button_t *button;
|
touch_button_t *button;
|
||||||
@@ -1531,7 +1610,6 @@ static qboolean Touch_ButtonPress( touchbuttonlist_t *list, touchEventType type,
|
|||||||
// run from end(front) to start(back)
|
// run from end(front) to start(back)
|
||||||
for( button = list->last; button; button = button->prev )
|
for( button = list->last; button; button = button->prev )
|
||||||
{
|
{
|
||||||
|
|
||||||
// skip invisible buttons
|
// skip invisible buttons
|
||||||
if( !Touch_IsVisible( button ) )
|
if( !Touch_IsVisible( button ) )
|
||||||
continue;
|
continue;
|
||||||
@@ -1555,7 +1633,7 @@ static qboolean Touch_ButtonPress( touchbuttonlist_t *list, touchEventType type,
|
|||||||
Cbuf_AddText( command );
|
Cbuf_AddText( command );
|
||||||
|
|
||||||
// increase precision
|
// increase precision
|
||||||
if( B(flags) & TOUCH_FL_PRECISION )
|
if( FBitSet( B(flags), TOUCH_FL_PRECISION ))
|
||||||
touch.precision = true;
|
touch.precision = true;
|
||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
@@ -1581,7 +1659,7 @@ static qboolean Touch_ButtonPress( touchbuttonlist_t *list, touchEventType type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// increase precision
|
// increase precision
|
||||||
if( B(flags) & TOUCH_FL_PRECISION )
|
if( FBitSet( B(flags), TOUCH_FL_PRECISION ))
|
||||||
touch.precision = true;
|
touch.precision = true;
|
||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
@@ -1703,7 +1781,7 @@ static qboolean Touch_ButtonPress( touchbuttonlist_t *list, touchEventType type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// disable precision mode
|
// disable precision mode
|
||||||
if( B(flags) & TOUCH_FL_PRECISION )
|
if( FBitSet( B(flags), TOUCH_FL_PRECISION ))
|
||||||
touch.precision = false;
|
touch.precision = false;
|
||||||
|
|
||||||
result = true;
|
result = true;
|
||||||
@@ -1774,7 +1852,7 @@ static qboolean Touch_ButtonEdit( touchEventType type, int fingerID, float x, fl
|
|||||||
button->finger = fingerID;
|
button->finger = fingerID;
|
||||||
|
|
||||||
// do not edit NOEDIT buttons
|
// do not edit NOEDIT buttons
|
||||||
if( button->flags & TOUCH_FL_NOEDIT )
|
if( FBitSet( button->flags, TOUCH_FL_NOEDIT ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
touch.edit = button;
|
touch.edit = button;
|
||||||
|
|||||||
+18
-24
@@ -46,6 +46,7 @@ convar_t *cl_forwardspeed;
|
|||||||
convar_t *cl_sidespeed;
|
convar_t *cl_sidespeed;
|
||||||
convar_t *cl_backspeed;
|
convar_t *cl_backspeed;
|
||||||
convar_t *look_filter;
|
convar_t *look_filter;
|
||||||
|
convar_t *m_rawinput;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
@@ -117,6 +118,7 @@ void IN_StartupMouse( void )
|
|||||||
m_pitch = Cvar_Get( "m_pitch", "0.022", FCVAR_ARCHIVE, "mouse pitch value" );
|
m_pitch = Cvar_Get( "m_pitch", "0.022", FCVAR_ARCHIVE, "mouse pitch value" );
|
||||||
m_yaw = Cvar_Get( "m_yaw", "0.022", FCVAR_ARCHIVE, "mouse yaw value" );
|
m_yaw = Cvar_Get( "m_yaw", "0.022", FCVAR_ARCHIVE, "mouse yaw value" );
|
||||||
look_filter = Cvar_Get( "look_filter", "0", FCVAR_ARCHIVE, "filter look events making it smoother" );
|
look_filter = Cvar_Get( "look_filter", "0", FCVAR_ARCHIVE, "filter look events making it smoother" );
|
||||||
|
m_rawinput = Cvar_Get( "m_rawinput", "1", FCVAR_ARCHIVE, "enable mouse raw input" );
|
||||||
|
|
||||||
// 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
|
||||||
@@ -135,7 +137,7 @@ static void IN_ActivateCursor( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IN_SetCursor( void *hCursor )
|
void GAME_EXPORT IN_SetCursor( void *hCursor )
|
||||||
{
|
{
|
||||||
in_mousecursor = hCursor;
|
in_mousecursor = hCursor;
|
||||||
|
|
||||||
@@ -207,8 +209,10 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
|||||||
#if XASH_SDL
|
#if XASH_SDL
|
||||||
SDL_SetWindowGrab( host.hWnd, SDL_TRUE );
|
SDL_SetWindowGrab( host.hWnd, SDL_TRUE );
|
||||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
if( clgame.dllFuncs.pfnLookEvent )
|
if ( clgame.dllFuncs.pfnLookEvent || ( clgame.client_dll_uses_sdl && CVAR_TO_BOOL( m_rawinput ) ) )
|
||||||
|
{
|
||||||
SDL_SetRelativeMouseMode( SDL_TRUE );
|
SDL_SetRelativeMouseMode( SDL_TRUE );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif // XASH_SDL
|
#endif // XASH_SDL
|
||||||
}
|
}
|
||||||
@@ -221,8 +225,10 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
|
|||||||
#ifdef XASH_SDL
|
#ifdef XASH_SDL
|
||||||
SDL_SetWindowGrab(host.hWnd, SDL_FALSE);
|
SDL_SetWindowGrab(host.hWnd, SDL_FALSE);
|
||||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||||
if( clgame.dllFuncs.pfnLookEvent )
|
if ( clgame.dllFuncs.pfnLookEvent || ( clgame.client_dll_uses_sdl && CVAR_TO_BOOL( m_rawinput ) ) )
|
||||||
|
{
|
||||||
SDL_SetRelativeMouseMode( SDL_FALSE );
|
SDL_SetRelativeMouseMode( SDL_FALSE );
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif // XASH_SDL
|
#endif // XASH_SDL
|
||||||
#if XASH_ANDROID
|
#if XASH_ANDROID
|
||||||
@@ -567,26 +573,16 @@ static void IN_JoyAppendMove( usercmd_t *cmd, float forwardmove, float sidemove
|
|||||||
|
|
||||||
void IN_CollectInput( float *forward, float *side, float *pitch, float *yaw, qboolean includeMouse, qboolean includeSdlMouse )
|
void IN_CollectInput( float *forward, float *side, float *pitch, float *yaw, qboolean includeMouse, qboolean includeSdlMouse )
|
||||||
{
|
{
|
||||||
if( includeMouse )
|
if( includeMouse
|
||||||
|
#if XASH_SDL
|
||||||
|
&& includeSdlMouse
|
||||||
|
#endif
|
||||||
|
)
|
||||||
{
|
{
|
||||||
#if XASH_INPUT == INPUT_SDL
|
float x, y;
|
||||||
if( includeSdlMouse )
|
Platform_MouseMove( &x, &y );
|
||||||
{
|
*pitch += y * m_pitch->value;
|
||||||
int x, y;
|
*yaw -= x * m_yaw->value;
|
||||||
SDL_GetRelativeMouseState( &x, &y );
|
|
||||||
*pitch += y * m_pitch->value;
|
|
||||||
*yaw -= x * m_yaw->value;
|
|
||||||
}
|
|
||||||
#endif // INPUT_SDL
|
|
||||||
|
|
||||||
#if XASH_INPUT == INPUT_ANDROID
|
|
||||||
{
|
|
||||||
float x, y;
|
|
||||||
Android_MouseMove( &x, &y );
|
|
||||||
*pitch += y * m_pitch->value;
|
|
||||||
*yaw -= x * m_yaw->value;
|
|
||||||
}
|
|
||||||
#endif // ANDROID
|
|
||||||
|
|
||||||
#ifdef XASH_USE_EVDEV
|
#ifdef XASH_USE_EVDEV
|
||||||
IN_EvdevMove( yaw, pitch );
|
IN_EvdevMove( yaw, pitch );
|
||||||
@@ -673,8 +669,6 @@ void Host_InputFrame( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cbuf_Execute ();
|
|
||||||
|
|
||||||
if( !in_mouseinitialized )
|
if( !in_mouseinitialized )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -93,9 +93,21 @@ enum
|
|||||||
JOY_HAT_LEFTDOWN = JOY_HAT_LEFT | JOY_HAT_DOWN
|
JOY_HAT_LEFTDOWN = JOY_HAT_LEFT | JOY_HAT_DOWN
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum engineAxis_e
|
||||||
|
{
|
||||||
|
JOY_AXIS_SIDE = 0,
|
||||||
|
JOY_AXIS_FWD,
|
||||||
|
JOY_AXIS_PITCH,
|
||||||
|
JOY_AXIS_YAW,
|
||||||
|
JOY_AXIS_RT,
|
||||||
|
JOY_AXIS_LT,
|
||||||
|
JOY_AXIS_NULL
|
||||||
|
} engineAxis_t;
|
||||||
|
|
||||||
qboolean Joy_IsActive( void );
|
qboolean Joy_IsActive( void );
|
||||||
void Joy_HatMotionEvent( byte hat, byte value );
|
void Joy_HatMotionEvent( byte hat, byte value );
|
||||||
void Joy_AxisMotionEvent( byte axis, short value );
|
void Joy_AxisMotionEvent( byte axis, short value );
|
||||||
|
void Joy_KnownAxisMotionEvent( engineAxis_t engineAxis, short value );
|
||||||
void Joy_BallMotionEvent( byte ball, short xrel, short yrel );
|
void Joy_BallMotionEvent( byte ball, short xrel, short yrel );
|
||||||
void Joy_ButtonEvent( byte button, byte down );
|
void Joy_ButtonEvent( byte button, byte down );
|
||||||
void Joy_AddEvent( void );
|
void Joy_AddEvent( void );
|
||||||
|
|||||||
+50
-44
@@ -29,7 +29,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct keyname_s
|
typedef struct keyname_s
|
||||||
{
|
{
|
||||||
char *name; // key name
|
const char *name; // key name
|
||||||
int keynum; // key number
|
int keynum; // key number
|
||||||
const char *binding; // default bind
|
const char *binding; // default bind
|
||||||
} keyname_t;
|
} keyname_t;
|
||||||
@@ -98,26 +98,32 @@ keyname_t keynames[] =
|
|||||||
{"KP_PLUS", K_KP_PLUS, "" },
|
{"KP_PLUS", K_KP_PLUS, "" },
|
||||||
{"PAUSE", K_PAUSE, "pause" },
|
{"PAUSE", K_PAUSE, "pause" },
|
||||||
|
|
||||||
{"A_BUTTON", K_A_BUTTON, ""}, // they match xbox controller
|
// Gamepad
|
||||||
{"B_BUTTON", K_B_BUTTON, ""},
|
// A/B X/Y names match the Xbox controller layout
|
||||||
{"X_BUTTON", K_X_BUTTON, ""},
|
{"A_BUTTON", K_A_BUTTON, "+jump"},
|
||||||
{"Y_BUTTON", K_Y_BUTTON, ""},
|
{"B_BUTTON", K_B_BUTTON, "+use"},
|
||||||
{"L1_BUTTON", K_L1_BUTTON, ""},
|
{"X_BUTTON", K_X_BUTTON, "+reload"},
|
||||||
{"R1_BUTTON", K_R1_BUTTON, ""},
|
{"Y_BUTTON", K_Y_BUTTON, "impulse 100"}, // Flashlight
|
||||||
{"BACK", K_BACK_BUTTON, ""},
|
{"BACK", K_BACK_BUTTON, "cancelselect"}, // Menu
|
||||||
{"MODE", K_MODE_BUTTON, ""},
|
{"MODE", K_MODE_BUTTON, ""},
|
||||||
{"START", K_START_BUTTON, ""},
|
{"START", K_START_BUTTON, "pause"},
|
||||||
{"STICK1", K_LSTICK, ""},
|
{"STICK1", K_LSTICK, "+speed"},
|
||||||
{"STICK2", K_RSTICK, ""},
|
{"STICK2", K_RSTICK, "+duck"},
|
||||||
{"L2_BUTTON", K_L2_BUTTON, ""}, // in case...
|
{"L1_BUTTON", K_L1_BUTTON, "+duck"},
|
||||||
{"R2_BUTTON", K_R2_BUTTON, ""},
|
{"R1_BUTTON", K_R1_BUTTON, "+attack"},
|
||||||
|
{"DPAD_UP", K_DPAD_UP, "impulse 201"}, // Spray
|
||||||
|
{"DPAD_DOWN", K_DPAD_DOWN, "lastinv"},
|
||||||
|
{"DPAD_LEFT", K_DPAD_LEFT, "invprev"},
|
||||||
|
{"DPAD_RIGHT", K_DPAD_RIGHT, "invnext"},
|
||||||
|
{"L2_BUTTON", K_L2_BUTTON, "+speed"},
|
||||||
|
{"R2_BUTTON", K_R2_BUTTON, "+attack2"},
|
||||||
|
{"LTRIGGER" , K_JOY1 , "+speed"}, // L2 in SDL2
|
||||||
|
{"RTRIGGER" , K_JOY2 , "+attack2"}, // R2 in SDL2
|
||||||
|
{"JOY3" , K_JOY3 , ""},
|
||||||
|
{"JOY4" , K_JOY4 , ""},
|
||||||
{"C_BUTTON", K_C_BUTTON, ""},
|
{"C_BUTTON", K_C_BUTTON, ""},
|
||||||
{"Z_BUTTON", K_Z_BUTTON, ""},
|
{"Z_BUTTON", K_Z_BUTTON, ""},
|
||||||
{"AUX16", K_AUX16, ""}, // generic
|
{"AUX20", K_AUX20, ""}, // generic
|
||||||
{"AUX17", K_AUX17, ""},
|
|
||||||
{"AUX18", K_AUX18, ""},
|
|
||||||
{"AUX19", K_AUX19, ""},
|
|
||||||
{"AUX20", K_AUX20, ""},
|
|
||||||
{"AUX21", K_AUX21, ""},
|
{"AUX21", K_AUX21, ""},
|
||||||
{"AUX22", K_AUX22, ""},
|
{"AUX22", K_AUX22, ""},
|
||||||
{"AUX23", K_AUX23, ""},
|
{"AUX23", K_AUX23, ""},
|
||||||
@@ -130,10 +136,6 @@ keyname_t keynames[] =
|
|||||||
{"AUX30", K_AUX30, ""},
|
{"AUX30", K_AUX30, ""},
|
||||||
{"AUX31", K_AUX31, ""},
|
{"AUX31", K_AUX31, ""},
|
||||||
{"AUX32", K_AUX32, ""},
|
{"AUX32", K_AUX32, ""},
|
||||||
{"LTRIGGER" , K_JOY1 , ""},
|
|
||||||
{"RTRIGGER" , K_JOY2 , ""},
|
|
||||||
{"JOY3" , K_JOY3 , ""},
|
|
||||||
{"JOY4" , K_JOY4 , ""},
|
|
||||||
|
|
||||||
// raw semicolon seperates commands
|
// raw semicolon seperates commands
|
||||||
{"SEMICOLON", ';', "" },
|
{"SEMICOLON", ';', "" },
|
||||||
@@ -150,7 +152,7 @@ static convar_t *key_rotate;
|
|||||||
Key_IsDown
|
Key_IsDown
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
int Key_IsDown( int keynum )
|
int GAME_EXPORT Key_IsDown( int keynum )
|
||||||
{
|
{
|
||||||
if( keynum == -1 )
|
if( keynum == -1 )
|
||||||
return false;
|
return false;
|
||||||
@@ -279,7 +281,7 @@ const char *Key_KeynumToString( int keynum )
|
|||||||
Key_SetBinding
|
Key_SetBinding
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_SetBinding( int keynum, const char *binding )
|
void GAME_EXPORT Key_SetBinding( int keynum, const char *binding )
|
||||||
{
|
{
|
||||||
if( keynum == -1 ) return;
|
if( keynum == -1 ) return;
|
||||||
|
|
||||||
@@ -313,25 +315,25 @@ Key_GetKey
|
|||||||
*/
|
*/
|
||||||
int Key_GetKey( const char *pBinding )
|
int Key_GetKey( const char *pBinding )
|
||||||
{
|
{
|
||||||
int i;
|
int i, len;
|
||||||
|
const char *p;
|
||||||
|
|
||||||
if( !pBinding ) return -1;
|
if( !pBinding ) return -1;
|
||||||
|
|
||||||
|
len = Q_strlen( pBinding );
|
||||||
|
|
||||||
for( i = 0; i < 256; i++ )
|
for( i = 0; i < 256; i++ )
|
||||||
{
|
{
|
||||||
if( !keys[i].binding )
|
if( !keys[i].binding )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( *keys[i].binding == '+' )
|
p = keys[i].binding;
|
||||||
{
|
|
||||||
if( !Q_strnicmp( keys[i].binding + 1, pBinding, Q_strlen( pBinding )))
|
if( *p == '+' )
|
||||||
return i;
|
p++;
|
||||||
}
|
|
||||||
else
|
if( !Q_strnicmp( p, pBinding, len ) )
|
||||||
{
|
return i;
|
||||||
if( !Q_strnicmp( keys[i].binding, pBinding, Q_strlen( pBinding )))
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -644,7 +646,7 @@ Key_Event
|
|||||||
Called by the system for both key up and key down events
|
Called by the system for both key up and key down events
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_Event( int key, int down )
|
void GAME_EXPORT Key_Event( int key, int down )
|
||||||
{
|
{
|
||||||
const char *kb;
|
const char *kb;
|
||||||
|
|
||||||
@@ -823,7 +825,7 @@ void Key_EnableTextInput( qboolean enable, qboolean force )
|
|||||||
Key_SetKeyDest
|
Key_SetKeyDest
|
||||||
=========
|
=========
|
||||||
*/
|
*/
|
||||||
void Key_SetKeyDest( int key_dest )
|
void GAME_EXPORT Key_SetKeyDest( int key_dest )
|
||||||
{
|
{
|
||||||
IN_ToggleClientMouse( key_dest, cls.key_dest );
|
IN_ToggleClientMouse( key_dest, cls.key_dest );
|
||||||
|
|
||||||
@@ -856,7 +858,7 @@ void Key_SetKeyDest( int key_dest )
|
|||||||
Key_ClearStates
|
Key_ClearStates
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void Key_ClearStates( void )
|
void GAME_EXPORT Key_ClearStates( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -915,13 +917,17 @@ A helper function if platform input doesn't support text mode properly
|
|||||||
*/
|
*/
|
||||||
int Key_ToUpper( int keynum )
|
int Key_ToUpper( int keynum )
|
||||||
{
|
{
|
||||||
keynum = Q_toupper( keynum );
|
keynum = Q_toupper( keynum );
|
||||||
if( keynum == '-' )
|
if( keynum == '-' )
|
||||||
keynum = '_';
|
keynum = '_';
|
||||||
if( keynum == '=' )
|
if( keynum == '=' )
|
||||||
keynum = '+';
|
keynum = '+';
|
||||||
|
if( keynum == ';' )
|
||||||
|
keynum = ':';
|
||||||
|
if( keynum == '\'' )
|
||||||
|
keynum = '"';
|
||||||
|
|
||||||
return keynum;
|
return keynum;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On-screen keyboard:
|
/* On-screen keyboard:
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ GNU General Public License for more details.
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "mod_local.h"
|
#include "mod_local.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
#include "eiface.h" // offsetof
|
||||||
|
|
||||||
#define MAX_CLIPNODE_DEPTH 256 // should never exceeds
|
#define MAX_CLIPNODE_DEPTH 256 // should never exceeds
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ _inline void list_del( hullnode_t *entry )
|
|||||||
|
|
||||||
static winding_t * winding_alloc( uint numpoints )
|
static winding_t * winding_alloc( uint numpoints )
|
||||||
{
|
{
|
||||||
return (winding_t *)malloc( (int)((winding_t *)0)->p[numpoints] );
|
return (winding_t *)malloc( offsetof( winding_t, p[numpoints] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_winding( winding_t *w )
|
static void free_winding( winding_t *w )
|
||||||
@@ -84,7 +84,7 @@ static winding_t *winding_copy( winding_t *w )
|
|||||||
winding_t *neww;
|
winding_t *neww;
|
||||||
|
|
||||||
neww = winding_alloc( w->numpoints );
|
neww = winding_alloc( w->numpoints );
|
||||||
memcpy( neww, w, (int)((winding_t *)0)->p[w->numpoints] );
|
memcpy( neww, w, offsetof( winding_t, p[w->numpoints] ) );
|
||||||
|
|
||||||
return neww;
|
return neww;
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ static void winding_reverse( winding_t *w )
|
|||||||
static winding_t *winding_shrink( winding_t *w )
|
static winding_t *winding_shrink( winding_t *w )
|
||||||
{
|
{
|
||||||
winding_t *neww = winding_alloc( w->numpoints );
|
winding_t *neww = winding_alloc( w->numpoints );
|
||||||
memcpy( neww, w, (int)((winding_t *)0)->p[w->numpoints] );
|
memcpy( neww, w, offsetof( winding_t, p[w->numpoints] ));
|
||||||
free_winding( w );
|
free_winding( w );
|
||||||
|
|
||||||
return neww;
|
return neww;
|
||||||
|
|||||||
+46
-30
@@ -30,7 +30,7 @@ GL_FreeImage
|
|||||||
Frees image by name
|
Frees image by name
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void GL_FreeImage( const char *name )
|
void GAME_EXPORT GL_FreeImage( const char *name )
|
||||||
{
|
{
|
||||||
int texnum;
|
int texnum;
|
||||||
|
|
||||||
@@ -41,12 +41,17 @@ void GL_FreeImage( const char *name )
|
|||||||
ref.dllFuncs.GL_FreeTexture( texnum );
|
ref.dllFuncs.GL_FreeTexture( texnum );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL_RenderFrame( const ref_viewpass_t *rvp )
|
void R_UpdateRefState( void )
|
||||||
{
|
{
|
||||||
refState.time = cl.time;
|
refState.time = cl.time;
|
||||||
refState.oldtime = cl.oldtime;
|
refState.oldtime = cl.oldtime;
|
||||||
refState.realtime = host.realtime;
|
refState.realtime = host.realtime;
|
||||||
refState.frametime = host.frametime;
|
refState.frametime = host.frametime;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 );
|
||||||
@@ -173,7 +178,7 @@ static int pfnGetStudioModelInterface( int version, struct r_studio_interface_s
|
|||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static byte *pfnImage_GetPool( void )
|
static poolhandle_t pfnImage_GetPool( void )
|
||||||
{
|
{
|
||||||
return host.imagepool;
|
return host.imagepool;
|
||||||
}
|
}
|
||||||
@@ -330,7 +335,6 @@ static ref_api_t gEngfuncs =
|
|||||||
COM_GetProcAddress,
|
COM_GetProcAddress,
|
||||||
|
|
||||||
FS_LoadFile,
|
FS_LoadFile,
|
||||||
COM_ParseFile,
|
|
||||||
FS_FileExists,
|
FS_FileExists,
|
||||||
FS_AllowDirectPaths,
|
FS_AllowDirectPaths,
|
||||||
|
|
||||||
@@ -503,7 +507,7 @@ void R_Shutdown( void )
|
|||||||
|
|
||||||
static void R_GetRendererName( char *dest, size_t size, const char *opt )
|
static void R_GetRendererName( char *dest, size_t size, const char *opt )
|
||||||
{
|
{
|
||||||
if( !Q_strstr( opt, va( ".%s", OS_LIB_EXT )))
|
if( !Q_strstr( opt, "." OS_LIB_EXT ))
|
||||||
{
|
{
|
||||||
const char *format;
|
const char *format;
|
||||||
|
|
||||||
@@ -581,10 +585,9 @@ static void SetFullscreenModeFromCommandLine( void )
|
|||||||
void R_CollectRendererNames( void )
|
void R_CollectRendererNames( void )
|
||||||
{
|
{
|
||||||
const char *renderers[] = DEFAULT_RENDERERS;
|
const char *renderers[] = DEFAULT_RENDERERS;
|
||||||
int i;
|
int i, cur;
|
||||||
|
|
||||||
ref.numRenderers = 0;
|
|
||||||
|
|
||||||
|
cur = 0;
|
||||||
for( i = 0; i < DEFAULT_RENDERERS_LEN; i++ )
|
for( i = 0; i < DEFAULT_RENDERERS_LEN; i++ )
|
||||||
{
|
{
|
||||||
string temp;
|
string temp;
|
||||||
@@ -607,32 +610,33 @@ void R_CollectRendererNames( void )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_strncpy( ref.shortNames[i], renderers[i], sizeof( ref.shortNames[i] ));
|
Q_strncpy( ref.shortNames[cur], renderers[i], sizeof( ref.shortNames[cur] ));
|
||||||
|
|
||||||
pfn = COM_GetProcAddress( dll, GET_REF_HUMANREADABLE_NAME );
|
pfn = COM_GetProcAddress( dll, GET_REF_HUMANREADABLE_NAME );
|
||||||
if( !pfn ) // just in case
|
if( !pfn ) // just in case
|
||||||
{
|
{
|
||||||
Con_Reportf( "R_CollectRendererNames: can't find GetHumanReadableName export in %s\n", temp );
|
Con_Reportf( "R_CollectRendererNames: can't find GetHumanReadableName export in %s\n", temp );
|
||||||
Q_strncpy( ref.readableNames[i], renderers[i], sizeof( ref.readableNames[i] ));
|
Q_strncpy( ref.readableNames[cur], renderers[i], sizeof( ref.readableNames[cur] ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
REF_HUMANREADABLE_NAME GetHumanReadableName = (REF_HUMANREADABLE_NAME)pfn;
|
REF_HUMANREADABLE_NAME GetHumanReadableName = (REF_HUMANREADABLE_NAME)pfn;
|
||||||
|
|
||||||
GetHumanReadableName( ref.readableNames[i], sizeof( ref.readableNames[i] ));
|
GetHumanReadableName( ref.readableNames[cur], sizeof( ref.readableNames[cur] ));
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Printf( "Found renderer %s: %s\n", ref.shortNames[i], ref.readableNames[i] );
|
Con_Printf( "Found renderer %s: %s\n", ref.shortNames[cur], ref.readableNames[cur] );
|
||||||
|
|
||||||
ref.numRenderers++;
|
cur++;
|
||||||
COM_FreeLibrary( dll );
|
COM_FreeLibrary( dll );
|
||||||
}
|
}
|
||||||
|
ref.numRenderers = cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean R_Init( void )
|
qboolean R_Init( void )
|
||||||
{
|
{
|
||||||
qboolean success = false;
|
qboolean success = false;
|
||||||
string refopt;
|
string requested;
|
||||||
|
|
||||||
gl_vsync = Cvar_Get( "gl_vsync", "0", FCVAR_ARCHIVE, "enable vertical syncronization" );
|
gl_vsync = Cvar_Get( "gl_vsync", "0", FCVAR_ARCHIVE, "enable vertical syncronization" );
|
||||||
gl_showtextures = Cvar_Get( "r_showtextures", "0", FCVAR_CHEAT, "show all uploaded textures" );
|
gl_showtextures = Cvar_Get( "r_showtextures", "0", FCVAR_CHEAT, "show all uploaded textures" );
|
||||||
@@ -643,6 +647,11 @@ qboolean R_Init( void )
|
|||||||
r_showtree = Cvar_Get( "r_showtree", "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
|
r_showtree = Cvar_Get( "r_showtree", "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
|
||||||
r_refdll = Cvar_Get( "r_refdll", "", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "choose renderer implementation, if supported" );
|
r_refdll = Cvar_Get( "r_refdll", "", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "choose renderer implementation, if supported" );
|
||||||
|
|
||||||
|
// cvars that are expected to exist by client.dll
|
||||||
|
// refdll should just get pointer to them
|
||||||
|
Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
||||||
|
Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
|
||||||
|
|
||||||
// cvars are created, execute video config
|
// cvars are created, execute video config
|
||||||
Cbuf_AddText( "exec video.cfg" );
|
Cbuf_AddText( "exec video.cfg" );
|
||||||
Cbuf_Execute();
|
Cbuf_Execute();
|
||||||
@@ -654,27 +663,34 @@ qboolean R_Init( void )
|
|||||||
|
|
||||||
R_CollectRendererNames();
|
R_CollectRendererNames();
|
||||||
|
|
||||||
// command line have priority
|
// Priority:
|
||||||
if( !Sys_GetParmFromCmdLine( "-ref", refopt ) )
|
// 1. Command line `-ref` argument.
|
||||||
{
|
// 2. `ref_dll` cvar.
|
||||||
|
// 3. Detected renderers in `DEFAULT_RENDERERS` order.
|
||||||
|
requested[0] = '\0';
|
||||||
|
if( !Sys_GetParmFromCmdLine( "-ref", requested ) && COM_CheckString( r_refdll->string ) )
|
||||||
// r_refdll is set to empty by default, so we can change hardcoded defaults just in case
|
// r_refdll is set to empty by default, so we can change hardcoded defaults just in case
|
||||||
Q_strncpy( refopt, COM_CheckString( r_refdll->string ) ?
|
Q_strncpy( requested, r_refdll->string, sizeof( requested ) );
|
||||||
r_refdll->string : DEFAULT_ACCELERATED_RENDERER, sizeof( refopt ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !(success = R_LoadRenderer( refopt )))
|
if ( requested[0] )
|
||||||
|
success = R_LoadRenderer( requested );
|
||||||
|
|
||||||
|
if( !success )
|
||||||
{
|
{
|
||||||
// check if we are tried to load default accelearated renderer already
|
int i;
|
||||||
// and if not, load it first
|
|
||||||
if( Q_strcmp( refopt, DEFAULT_ACCELERATED_RENDERER ) )
|
|
||||||
{
|
|
||||||
success = R_LoadRenderer( refopt );
|
|
||||||
}
|
|
||||||
|
|
||||||
// software renderer is the last chance...
|
// cycle through renderers that we collected in CollectRendererNames
|
||||||
if( !success )
|
for( i = 0; i < ref.numRenderers; i++ )
|
||||||
{
|
{
|
||||||
success = R_LoadRenderer( DEFAULT_SOFTWARE_RENDERER );
|
// skip renderer that was requested but failed to load
|
||||||
|
if( !Q_strcmp( requested, ref.shortNames[i] ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
success = R_LoadRenderer( ref.shortNames[i] );
|
||||||
|
|
||||||
|
// yay, found working one
|
||||||
|
if( success )
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,5 +51,8 @@ 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
|
||||||
|
|||||||
+85
-16
@@ -114,6 +114,45 @@ const sx_preset_t rgsxpre[MAXPRESETS] =
|
|||||||
{ 0.0, 0.0, 0.001, 0.999, 0.0, 0.2, 0.8, 2.0, 0.05 } // 28
|
{ 0.0, 0.0, 0.001, 0.999, 0.0, 0.2, 0.8, 2.0, 0.05 } // 28
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 0x0045dca8 enginegl.exe
|
||||||
|
// SHA256: 42383d32cd712e59ee2c1bd78b7ba48814e680e7026c4223e730111f34a60d66
|
||||||
|
const sx_preset_t rgsxpre_hlalpha052[MAXPRESETS] =
|
||||||
|
{
|
||||||
|
// -------reverb-------- -------delay--------
|
||||||
|
// lp mod size refl rvblp delay feedback dlylp left
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 2.0, 0.0 }, // 0 off
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.08, 0.8, 2.0, 0.0 }, // 1 generic
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.02, 0.75, 0.0, 0.001 }, // 2 metalic
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.03, 0.78, 0.0, 0.002 }, // 3
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.06, 0.77, 0.0, 0.003 }, // 4
|
||||||
|
{ 0.0, 0.0, 0.05, 0.85, 1.0, 0.008, 0.96, 2.0, 0.01 }, // 5 tunnel
|
||||||
|
{ 0.0, 0.0, 0.05, 0.88, 1.0, 0.01, 0.98, 2.0, 0.02 }, // 6
|
||||||
|
{ 0.0, 0.0, 0.05, 0.92, 1.0, 0.015, 0.995, 2.0, 0.04 }, // 7
|
||||||
|
{ 0.0, 0.0, 0.05, 0.84, 1.0, 0.0, 0.0, 2.0, 0.003 }, // 8 chamber
|
||||||
|
{ 0.0, 0.0, 0.05, 0.9, 1.0, 0.0, 0.0, 2.0, 0.002 }, // 9
|
||||||
|
{ 0.0, 0.0, 0.05, 0.95, 1.0, 0.0, 0.0, 2.0, 0.001 }, // 10
|
||||||
|
{ 0.0, 0.0, 0.05, 0.7, 0.0, 0.0, 0.0, 2.0, 0.003 }, // 11 brite
|
||||||
|
{ 0.0, 0.0, 0.055, 0.78, 0.0, 0.0, 0.0, 2.0, 0.002 }, // 12
|
||||||
|
{ 0.0, 0.0, 0.05, 0.86, 0.0, 0.0, 0.0, 2.0, 0.001 }, // 13
|
||||||
|
{ 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 2.0, 0.01 }, // 14 water
|
||||||
|
{ 1.0, 1.0, 0.0, 0.0, 1.0, 0.06, 0.85, 2.0, 0.02 }, // 15
|
||||||
|
{ 1.0, 1.0, 0.0, 0.0, 1.0, 0.2, 0.6, 2.0, 0.05 }, // 16
|
||||||
|
{ 0.0, 0.0, 0.05, 0.8, 1.0, 0.15, 0.48, 2.0, 0.008 }, // 17 concrete
|
||||||
|
{ 0.0, 0.0, 0.06, 0.9, 1.0, 0.22, 0.52, 2.0, 0.005 }, // 18
|
||||||
|
{ 0.0, 0.0, 0.07, 0.94, 1.0, 0.3, 0.6, 2.0, 0.001 }, // 19
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.3, 0.42, 2.0, 0.0 }, // 20 outside
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.35, 0.48, 2.0, 0.0 }, // 21
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.38, 0.6, 2.0, 0.0 }, // 22
|
||||||
|
{ 0.0, 0.0, 0.05, 0.9, 1.0, 0.2, 0.28, 0.0, 0.0 }, // 23 cavern
|
||||||
|
{ 0.0, 0.0, 0.07, 0.9, 1.0, 0.3, 0.4, 0.0, 0.0 }, // 24
|
||||||
|
{ 0.0, 0.0, 0.09, 0.9, 1.0, 0.35, 0.5, 0.0, 0.0 }, // 25
|
||||||
|
{ 0.0, 1.0, 0.01, 0.9, 0.0, 0.0, 0.0, 2.0, 0.05 }, // 26 weirdo
|
||||||
|
{ 0.0, 0.0, 0.0, 0.0, 1.0, 0.009, 0.999, 2.0, 0.04 }, // 27
|
||||||
|
{ 0.0, 0.0, 0.001, 0.999, 0.0, 0.2, 0.8, 2.0, 0.05 }, // 28
|
||||||
|
};
|
||||||
|
|
||||||
|
const sx_preset_t *ptable = rgsxpre;
|
||||||
|
|
||||||
// cvars
|
// cvars
|
||||||
convar_t *dsp_off; // disable dsp
|
convar_t *dsp_off; // disable dsp
|
||||||
convar_t *roomwater_type; // water room_type
|
convar_t *roomwater_type; // water room_type
|
||||||
@@ -138,6 +177,8 @@ convar_t *sxdly_feedback; // cycles
|
|||||||
convar_t *sxdly_delay; // current delay in seconds
|
convar_t *sxdly_delay; // current delay in seconds
|
||||||
|
|
||||||
convar_t *dsp_room; // for compability
|
convar_t *dsp_room; // for compability
|
||||||
|
|
||||||
|
convar_t *dsp_coeff_table; // use release or 0.52 style
|
||||||
int idsp_dma_speed;
|
int idsp_dma_speed;
|
||||||
int idsp_room;
|
int idsp_room;
|
||||||
int room_typeprev;
|
int room_typeprev;
|
||||||
@@ -194,6 +235,8 @@ void SX_Init( void )
|
|||||||
sxmod2cur = sxmod2 = 450 * ( idsp_dma_speed / SOUND_11k );
|
sxmod2cur = sxmod2 = 450 * ( idsp_dma_speed / SOUND_11k );
|
||||||
|
|
||||||
dsp_off = Cvar_Get( "dsp_off", "0", FCVAR_ARCHIVE, "disable DSP processing" );
|
dsp_off = Cvar_Get( "dsp_off", "0", FCVAR_ARCHIVE, "disable DSP processing" );
|
||||||
|
dsp_coeff_table = Cvar_Get( "dsp_coeff_table", "0", FCVAR_ARCHIVE, "select DSP coefficient table: 0 for release or 1 for alpha 0.52" );
|
||||||
|
|
||||||
roomwater_type = Cvar_Get( "waterroom_type", "14", 0, "water room type" );
|
roomwater_type = Cvar_Get( "waterroom_type", "14", 0, "water room type" );
|
||||||
room_type = Cvar_Get( "room_type", "0", 0, "current room type preset" );
|
room_type = Cvar_Get( "room_type", "0", 0, "current room type preset" );
|
||||||
|
|
||||||
@@ -352,8 +395,6 @@ void DLY_CheckNewStereoDelayVal( void )
|
|||||||
if( dly->delaysamples == 0 )
|
if( dly->delaysamples == 0 )
|
||||||
DLY_Free( STEREODLY );
|
DLY_Free( STEREODLY );
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearBits( sxste_delay->flags, FCVAR_CHANGED );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -463,7 +504,6 @@ void DLY_CheckNewDelayVal( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearBits( sxdly_delay->flags, FCVAR_CHANGED );
|
|
||||||
dly->lp = sxdly_lp->value;
|
dly->lp = sxdly_lp->value;
|
||||||
dly->delayfeedback = 255 * sxdly_feedback->value;
|
dly->delayfeedback = 255 * sxdly_feedback->value;
|
||||||
}
|
}
|
||||||
@@ -497,9 +537,9 @@ void DLY_DoDelay( int count )
|
|||||||
|
|
||||||
if( dly->lp ) // lowpass
|
if( dly->lp ) // lowpass
|
||||||
{
|
{
|
||||||
|
val = ( dly->lp0 + dly->lp1 + val ) / 3;
|
||||||
dly->lp0 = dly->lp1;
|
dly->lp0 = dly->lp1;
|
||||||
dly->lp1 = val;
|
dly->lp1 = val;
|
||||||
val = ( dly->lp0 + dly->lp1 + (val << 1) ) >> 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dly->lpdelayline[dly->idelayinput] = val;
|
dly->lpdelayline[dly->idelayinput] = val;
|
||||||
@@ -512,7 +552,7 @@ void DLY_DoDelay( int count )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
dly->lpdelayline[dly->idelayinput] = 0;
|
dly->lpdelayline[dly->idelayinput] = 0;
|
||||||
dly->lp0 = dly->lp1 = 0;
|
dly->lp0 = dly->lp1 = dly->lp2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DLY_MovePointer( dly );
|
DLY_MovePointer( dly );
|
||||||
@@ -547,7 +587,7 @@ void RVB_SetUpDly( int pos, float delay, int kmod )
|
|||||||
rgsxdly[pos].idelayoutputxf = rgsxdly[pos].idelayinput - samples;
|
rgsxdly[pos].idelayoutputxf = rgsxdly[pos].idelayinput - samples;
|
||||||
if( rgsxdly[pos].idelayoutputxf < 0 )
|
if( rgsxdly[pos].idelayoutputxf < 0 )
|
||||||
rgsxdly[pos].idelayoutputxf += rgsxdly[pos].cdelaysamplesmax;
|
rgsxdly[pos].idelayoutputxf += rgsxdly[pos].cdelaysamplesmax;
|
||||||
rgsxdly[pos].xfade = 32;
|
rgsxdly[pos].xfade = REVERB_XFADE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !rgsxdly[pos].delaysamples )
|
if( !rgsxdly[pos].delaysamples )
|
||||||
@@ -582,7 +622,6 @@ void RVB_CheckNewReverbVal( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearBits( sxrvb_size->flags, FCVAR_CHANGED );
|
|
||||||
dly1->lp = dly2->lp = sxrvb_lp->value;
|
dly1->lp = dly2->lp = sxrvb_lp->value;
|
||||||
dly1->delayfeedback = dly2->delayfeedback = (int)(255 * sxrvb_feedback->value);
|
dly1->delayfeedback = dly2->delayfeedback = (int)(255 * sxrvb_feedback->value);
|
||||||
}
|
}
|
||||||
@@ -609,14 +648,14 @@ int RVB_DoReverbForOneDly( dly_t *dly, const int vlr, const portable_samplepair_
|
|||||||
if( dly->xfade || delay || samplepair->left || samplepair->right )
|
if( dly->xfade || delay || samplepair->left || samplepair->right )
|
||||||
{
|
{
|
||||||
// modulate delay rate
|
// modulate delay rate
|
||||||
if( !dly->xfade && !dly->modcur && dly->mod )
|
if( !dly->mod )
|
||||||
{
|
{
|
||||||
dly->idelayoutputxf = dly->idelayoutput + ((COM_RandomLong( 0, 255 ) * delay) >> 9 );
|
dly->idelayoutputxf = dly->idelayoutput + ((COM_RandomLong( 0, 255 ) * delay) >> 9 );
|
||||||
|
|
||||||
//dly->xfade = 32;
|
dly->idelayoutputxf %= dly->cdelaysamplesmax;
|
||||||
}
|
|
||||||
|
|
||||||
dly->idelayoutputxf %= dly->cdelaysamplesmax;
|
dly->xfade = REVERB_XFADE;
|
||||||
|
}
|
||||||
|
|
||||||
if( dly->xfade )
|
if( dly->xfade )
|
||||||
{
|
{
|
||||||
@@ -685,7 +724,9 @@ void RVB_DoReverb( int count )
|
|||||||
voutm = RVB_DoReverbForOneDly( dly1, vlr, paint );
|
voutm = RVB_DoReverbForOneDly( dly1, vlr, paint );
|
||||||
voutm += RVB_DoReverbForOneDly( dly2, vlr, paint );
|
voutm += RVB_DoReverbForOneDly( dly2, vlr, paint );
|
||||||
|
|
||||||
voutm = (11 * voutm) >> 6;
|
if( dsp_coeff_table->value == 1.0f )
|
||||||
|
voutm /= 6; // alpha
|
||||||
|
else voutm = (11 * voutm) >> 6;
|
||||||
|
|
||||||
paint->left = CLIP( paint->left + voutm );
|
paint->left = CLIP( paint->left + voutm );
|
||||||
paint->right = CLIP( paint->right + voutm );
|
paint->right = CLIP( paint->right + voutm );
|
||||||
@@ -718,17 +759,18 @@ void RVB_DoAMod( int count )
|
|||||||
res.left >>= 2;
|
res.left >>= 2;
|
||||||
res.right >>= 2;
|
res.right >>= 2;
|
||||||
|
|
||||||
|
rgsxlp[4] = paint->left;
|
||||||
|
rgsxlp[9] = paint->right;
|
||||||
|
|
||||||
rgsxlp[0] = rgsxlp[1];
|
rgsxlp[0] = rgsxlp[1];
|
||||||
rgsxlp[1] = rgsxlp[2];
|
rgsxlp[1] = rgsxlp[2];
|
||||||
rgsxlp[2] = rgsxlp[3];
|
rgsxlp[2] = rgsxlp[3];
|
||||||
rgsxlp[3] = rgsxlp[4];
|
rgsxlp[3] = rgsxlp[4];
|
||||||
rgsxlp[4] = paint->left;
|
rgsxlp[4] = rgsxlp[5];
|
||||||
|
|
||||||
rgsxlp[5] = rgsxlp[6];
|
rgsxlp[5] = rgsxlp[6];
|
||||||
rgsxlp[6] = rgsxlp[7];
|
rgsxlp[6] = rgsxlp[7];
|
||||||
rgsxlp[7] = rgsxlp[8];
|
rgsxlp[7] = rgsxlp[8];
|
||||||
rgsxlp[8] = rgsxlp[9];
|
rgsxlp[8] = rgsxlp[9];
|
||||||
rgsxlp[9] = paint->right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sxmod_mod->value )
|
if( sxmod_mod->value )
|
||||||
@@ -814,6 +856,27 @@ void CheckNewDspPresets( void )
|
|||||||
if( dsp_off->value != 0.0f )
|
if( dsp_off->value != 0.0f )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if( FBitSet( dsp_coeff_table->flags, FCVAR_CHANGED ))
|
||||||
|
{
|
||||||
|
switch( (int)dsp_coeff_table->value )
|
||||||
|
{
|
||||||
|
case 0: // release
|
||||||
|
ptable = rgsxpre;
|
||||||
|
break;
|
||||||
|
case 1: // alpha
|
||||||
|
ptable = rgsxpre_hlalpha052;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ptable = rgsxpre;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SX_ReloadRoomFX();
|
||||||
|
room_typeprev = -1;
|
||||||
|
|
||||||
|
ClearBits( dsp_coeff_table->flags, FCVAR_CHANGED );
|
||||||
|
}
|
||||||
|
|
||||||
if( s_listener.waterlevel > 2 )
|
if( s_listener.waterlevel > 2 )
|
||||||
idsp_room = roomwater_type->value;
|
idsp_room = roomwater_type->value;
|
||||||
else idsp_room = room_type->value;
|
else idsp_room = room_type->value;
|
||||||
@@ -835,7 +898,9 @@ void CheckNewDspPresets( void )
|
|||||||
|
|
||||||
if( idsp_room != room_typeprev )
|
if( idsp_room != room_typeprev )
|
||||||
{
|
{
|
||||||
const sx_preset_t *cur = rgsxpre + idsp_room;
|
const sx_preset_t *cur;
|
||||||
|
|
||||||
|
cur = ptable + idsp_room;
|
||||||
|
|
||||||
Cvar_SetValue( "room_lp", cur->room_lp );
|
Cvar_SetValue( "room_lp", cur->room_lp );
|
||||||
Cvar_SetValue( "room_mod", cur->room_mod );
|
Cvar_SetValue( "room_mod", cur->room_mod );
|
||||||
@@ -853,6 +918,10 @@ void CheckNewDspPresets( void )
|
|||||||
RVB_CheckNewReverbVal( );
|
RVB_CheckNewReverbVal( );
|
||||||
DLY_CheckNewDelayVal( );
|
DLY_CheckNewDelayVal( );
|
||||||
DLY_CheckNewStereoDelayVal();
|
DLY_CheckNewStereoDelayVal();
|
||||||
|
|
||||||
|
ClearBits( sxrvb_size->flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( sxdly_delay->flags, FCVAR_CHANGED );
|
||||||
|
ClearBits( sxste_delay->flags, FCVAR_CHANGED );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SX_Profiling_f( void )
|
void SX_Profiling_f( void )
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ void S_SoundList_f( void )
|
|||||||
else Con_Printf( " " );
|
else Con_Printf( " " );
|
||||||
if( sfx->name[0] == '*' )
|
if( sfx->name[0] == '*' )
|
||||||
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 : %s%s\n", sc->width * 8, Q_memprint( sc->size ), DEFAULT_SOUNDPATH, sfx->name );
|
else Con_Printf( " (%2db) %s : " DEFAULT_SOUNDPATH "%s\n", sc->width * 8, Q_memprint( sc->size ), sfx->name );
|
||||||
totalSfx++;
|
totalSfx++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,6 +141,9 @@ 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() )
|
||||||
|
Con_Printf( S_WARN "S_LoadSound: late precache of %s\n", 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 );
|
||||||
else sc = FS_LoadSound( sfx->name, NULL, 0 );
|
else sc = FS_LoadSound( sfx->name, NULL, 0 );
|
||||||
|
|||||||
+98
-42
@@ -23,7 +23,7 @@ GNU General Public License for more details.
|
|||||||
#define SND_CLIP_DISTANCE 1000.0f
|
#define SND_CLIP_DISTANCE 1000.0f
|
||||||
|
|
||||||
dma_t dma;
|
dma_t dma;
|
||||||
byte *sndpool;
|
poolhandle_t sndpool;
|
||||||
static soundfade_t soundfade;
|
static soundfade_t soundfade;
|
||||||
channel_t channels[MAX_CHANNELS];
|
channel_t channels[MAX_CHANNELS];
|
||||||
sound_t ambient_sfx[NUM_AMBIENTS];
|
sound_t ambient_sfx[NUM_AMBIENTS];
|
||||||
@@ -35,17 +35,18 @@ int total_channels;
|
|||||||
int soundtime; // sample PAIRS
|
int soundtime; // sample PAIRS
|
||||||
int paintedtime; // sample PAIRS
|
int paintedtime; // sample PAIRS
|
||||||
|
|
||||||
convar_t *s_volume;
|
static CVAR_DEFINE( s_volume, "volume", "0.7", FCVAR_ARCHIVE, "sound volume" );
|
||||||
convar_t *s_musicvolume;
|
CVAR_DEFINE( s_musicvolume, "MP3Volume", "1.0", FCVAR_ARCHIVE, "background music volume" );
|
||||||
convar_t *s_show;
|
static CVAR_DEFINE( s_mixahead, "_snd_mixahead", "0.12", 0, "how much sound to mix ahead of time" );
|
||||||
convar_t *s_mixahead;
|
static CVAR_DEFINE_AUTO( s_show, "0", FCVAR_ARCHIVE, "show playing sounds" );
|
||||||
convar_t *s_lerping;
|
CVAR_DEFINE_AUTO( s_lerping, "0", FCVAR_ARCHIVE, "apply interpolation to sound output" );
|
||||||
convar_t *s_ambient_level;
|
static CVAR_DEFINE( s_ambient_level, "ambient_level", "0.3", FCVAR_ARCHIVE, "volume of environment noises (water and wind)" );
|
||||||
convar_t *s_ambient_fade;
|
static CVAR_DEFINE( s_ambient_fade, "ambient_fade", "1000", FCVAR_ARCHIVE, "rate of volume fading when client is moving" );
|
||||||
convar_t *s_combine_sounds;
|
static CVAR_DEFINE_AUTO( s_combine_sounds, "0", FCVAR_ARCHIVE, "combine channels with same sounds" );
|
||||||
convar_t *snd_mute_losefocus;
|
CVAR_DEFINE_AUTO( snd_mute_losefocus, "1", FCVAR_ARCHIVE, "silence the audio when game window loses focus" );
|
||||||
convar_t *s_test; // cvar for testing new effects
|
CVAR_DEFINE_AUTO( s_test, "0", 0, "engine developer cvar for quick testing new features" );
|
||||||
convar_t *s_samplecount;
|
CVAR_DEFINE_AUTO( s_samplecount, "0", FCVAR_ARCHIVE, "sample count (0 for default value)" );
|
||||||
|
CVAR_DEFINE_AUTO( s_warn_late_precache, "0", FCVAR_ARCHIVE, "warn about late precached sounds on client-side" );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
@@ -68,7 +69,7 @@ float S_GetMasterVolume( void )
|
|||||||
scale = bound( 0.0f, soundfade.percent / 100.0f, 1.0f );
|
scale = bound( 0.0f, soundfade.percent / 100.0f, 1.0f );
|
||||||
scale = 1.0f - scale;
|
scale = 1.0f - scale;
|
||||||
}
|
}
|
||||||
return s_volume->value * scale;
|
return s_volume.value * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -525,7 +526,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
|
|||||||
if( !target_chan )
|
if( !target_chan )
|
||||||
{
|
{
|
||||||
if( !bIgnore )
|
if( !bIgnore )
|
||||||
Con_DPrintf( S_ERROR "dropped sound \"%s%s\"\n", DEFAULT_SOUNDPATH, sfx->name );
|
Con_DPrintf( S_ERROR "dropped sound \"" DEFAULT_SOUNDPATH "%s\"\n", sfx->name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,7 +638,7 @@ void S_RestoreSound( const vec3_t pos, int ent, int chan, sound_t handle, float
|
|||||||
if( !target_chan )
|
if( !target_chan )
|
||||||
{
|
{
|
||||||
if( !bIgnore )
|
if( !bIgnore )
|
||||||
Con_DPrintf( S_ERROR "dropped sound \"%s%s\"\n", DEFAULT_SOUNDPATH, sfx->name );
|
Con_DPrintf( S_ERROR "dropped sound \"" DEFAULT_SOUNDPATH "%s\"\n", sfx->name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -945,7 +946,7 @@ void S_UpdateAmbientSounds( void )
|
|||||||
|
|
||||||
leaf = Mod_PointInLeaf( s_listener.origin, cl.worldmodel->nodes );
|
leaf = Mod_PointInLeaf( s_listener.origin, cl.worldmodel->nodes );
|
||||||
|
|
||||||
if( !leaf || !s_ambient_level->value )
|
if( !leaf || !s_ambient_level.value )
|
||||||
{
|
{
|
||||||
for( ambient_channel = 0; ambient_channel < NUM_AMBIENTS; ambient_channel++ )
|
for( ambient_channel = 0; ambient_channel < NUM_AMBIENTS; ambient_channel++ )
|
||||||
channels[ambient_channel].sfx = NULL;
|
channels[ambient_channel].sfx = NULL;
|
||||||
@@ -965,18 +966,18 @@ void S_UpdateAmbientSounds( void )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
vol = s_ambient_level->value * leaf->ambient_sound_level[ambient_channel];
|
vol = s_ambient_level.value * leaf->ambient_sound_level[ambient_channel];
|
||||||
if( vol < 0 ) vol = 0;
|
if( vol < 0 ) vol = 0;
|
||||||
|
|
||||||
// don't adjust volume too fast
|
// don't adjust volume too fast
|
||||||
if( chan->master_vol < vol )
|
if( chan->master_vol < vol )
|
||||||
{
|
{
|
||||||
chan->master_vol += s_listener.frametime * s_ambient_fade->value;
|
chan->master_vol += s_listener.frametime * s_ambient_fade.value;
|
||||||
if( chan->master_vol > vol ) chan->master_vol = vol;
|
if( chan->master_vol > vol ) chan->master_vol = vol;
|
||||||
}
|
}
|
||||||
else if( chan->master_vol > vol )
|
else if( chan->master_vol > vol )
|
||||||
{
|
{
|
||||||
chan->master_vol -= s_listener.frametime * s_ambient_fade->value;
|
chan->master_vol -= s_listener.frametime * s_ambient_fade.value;
|
||||||
if( chan->master_vol < vol ) chan->master_vol = vol;
|
if( chan->master_vol < vol ) chan->master_vol = vol;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1192,7 +1193,7 @@ void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float sy
|
|||||||
ch->s_rawend = soundtime;
|
ch->s_rawend = soundtime;
|
||||||
|
|
||||||
// position is changed, synchronization is lost etc
|
// position is changed, synchronization is lost etc
|
||||||
if( fabs( ch->oldtime - synctime ) > s_mixahead->value )
|
if( fabs( ch->oldtime - synctime ) > s_mixahead.value )
|
||||||
ch->sound_info.loopStart = AVI_TimeToSoundPosition( Avi, synctime * 1000 );
|
ch->sound_info.loopStart = AVI_TimeToSoundPosition( Avi, synctime * 1000 );
|
||||||
ch->oldtime = synctime; // keep actual time
|
ch->oldtime = synctime; // keep actual time
|
||||||
|
|
||||||
@@ -1409,7 +1410,7 @@ S_StopSound
|
|||||||
stop all sounds for entity on a channel.
|
stop all sounds for entity on a channel.
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void S_StopSound( int entnum, int channel, const char *soundname )
|
void GAME_EXPORT S_StopSound( int entnum, int channel, const char *soundname )
|
||||||
{
|
{
|
||||||
sfx_t *sfx;
|
sfx_t *sfx;
|
||||||
|
|
||||||
@@ -1450,6 +1451,45 @@ void S_StopAllSounds( qboolean ambient )
|
|||||||
memset( &soundfade, 0, sizeof( soundfade ));
|
memset( &soundfade, 0, sizeof( soundfade ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==============
|
||||||
|
S_GetSoundtime
|
||||||
|
|
||||||
|
update global soundtime
|
||||||
|
|
||||||
|
(was part of platform code)
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
static int S_GetSoundtime( void )
|
||||||
|
{
|
||||||
|
static int buffers, oldsamplepos;
|
||||||
|
int samplepos, fullsamples;
|
||||||
|
|
||||||
|
fullsamples = dma.samples / 2;
|
||||||
|
|
||||||
|
// it is possible to miscount buffers
|
||||||
|
// if it has wrapped twice between
|
||||||
|
// calls to S_Update. Oh well.
|
||||||
|
samplepos = dma.samplepos;
|
||||||
|
|
||||||
|
if( samplepos < oldsamplepos )
|
||||||
|
{
|
||||||
|
buffers++; // buffer wrapped
|
||||||
|
|
||||||
|
if( paintedtime > 0x40000000 )
|
||||||
|
{
|
||||||
|
// time to chop things off to avoid 32 bit limits
|
||||||
|
buffers = 0;
|
||||||
|
paintedtime = fullsamples;
|
||||||
|
S_StopAllSounds( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
oldsamplepos = samplepos;
|
||||||
|
|
||||||
|
return ( buffers * fullsamples + samplepos / 2 );
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
void S_UpdateChannels( void )
|
void S_UpdateChannels( void )
|
||||||
{
|
{
|
||||||
@@ -1461,12 +1501,12 @@ void S_UpdateChannels( void )
|
|||||||
if( !dma.buffer ) return;
|
if( !dma.buffer ) return;
|
||||||
|
|
||||||
// updates DMA time
|
// updates DMA time
|
||||||
soundtime = SNDDMA_GetSoundtime();
|
soundtime = S_GetSoundtime();
|
||||||
|
|
||||||
// soundtime - total samples that have been played out to hardware at dmaspeed
|
// soundtime - total samples that have been played out to hardware at dmaspeed
|
||||||
// paintedtime - total samples that have been mixed at speed
|
// paintedtime - total samples that have been mixed at speed
|
||||||
// endtime - target for samples in mixahead buffer at speed
|
// endtime - target for samples in mixahead buffer at speed
|
||||||
endtime = soundtime + s_mixahead->value * SOUND_DMA_SPEED;
|
endtime = soundtime + s_mixahead.value * SOUND_DMA_SPEED;
|
||||||
samps = dma.samples >> 1;
|
samps = dma.samples >> 1;
|
||||||
|
|
||||||
if((int)(endtime - soundtime) > samps )
|
if((int)(endtime - soundtime) > samps )
|
||||||
@@ -1562,7 +1602,7 @@ void SND_UpdateSound( void )
|
|||||||
// try to combine static sounds with a previous channel of the same
|
// try to combine static sounds with a previous channel of the same
|
||||||
// sound effect so we don't mix five torches every frame
|
// sound effect so we don't mix five torches every frame
|
||||||
// g-cont: perfomance option, probably kill stereo effect in most cases
|
// g-cont: perfomance option, probably kill stereo effect in most cases
|
||||||
if( i >= MAX_DYNAMIC_CHANNELS && s_combine_sounds->value )
|
if( i >= MAX_DYNAMIC_CHANNELS && s_combine_sounds.value )
|
||||||
{
|
{
|
||||||
// see if it can just use the last one
|
// see if it can just use the last one
|
||||||
if( combine && combine->sfx == ch->sfx )
|
if( combine && combine->sfx == ch->sfx )
|
||||||
@@ -1602,7 +1642,7 @@ void SND_UpdateSound( void )
|
|||||||
S_SpatializeRawChannels();
|
S_SpatializeRawChannels();
|
||||||
|
|
||||||
// debugging output
|
// debugging output
|
||||||
if( CVAR_TO_BOOL( s_show ))
|
if( s_show.value != 0.0f )
|
||||||
{
|
{
|
||||||
info.color[0] = 1.0f;
|
info.color[0] = 1.0f;
|
||||||
info.color[1] = 0.6f;
|
info.color[1] = 0.6f;
|
||||||
@@ -1623,7 +1663,7 @@ void SND_UpdateSound( void )
|
|||||||
VectorSet( info.color, 1.0f, 1.0f, 1.0f );
|
VectorSet( info.color, 1.0f, 1.0f, 1.0f );
|
||||||
info.index = 0;
|
info.index = 0;
|
||||||
|
|
||||||
Con_NXPrintf( &info, "room_type: %i ----(%i)---- painted: %i\n", idsp_room, total - 1, paintedtime );
|
Con_NXPrintf( &info, "room_type: %i (%s) ----(%i)---- painted: %i\n", idsp_room, Cvar_VariableString( "dsp_coeff_table" ), total - 1, paintedtime );
|
||||||
}
|
}
|
||||||
|
|
||||||
S_StreamBackgroundTrack ();
|
S_StreamBackgroundTrack ();
|
||||||
@@ -1679,26 +1719,41 @@ void S_PlayVol_f( void )
|
|||||||
S_StartLocalSound( Cmd_Argv( 1 ), Q_atof( Cmd_Argv( 2 )), false );
|
S_StartLocalSound( Cmd_Argv( 1 ), Q_atof( Cmd_Argv( 2 )), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void S_Say( const char *name, qboolean reliable )
|
||||||
|
{
|
||||||
|
char sentence[1024];
|
||||||
|
|
||||||
|
// predefined vox sentence
|
||||||
|
if( name[0] == '!' )
|
||||||
|
{
|
||||||
|
S_StartLocalSound( name, 1.0f, reliable );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_snprintf( sentence, sizeof( sentence ), "!#%s", name );
|
||||||
|
S_StartLocalSound( sentence, 1.0f, reliable );
|
||||||
|
}
|
||||||
|
|
||||||
void S_Say_f( void )
|
void S_Say_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
Con_Printf( S_USAGE "speak <soundfile>\n" );
|
Con_Printf( S_USAGE "speak <vox sentence>\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
S_StartLocalSound( Cmd_Argv( 1 ), 1.0f, false );
|
S_Say( Cmd_Argv( 1 ), false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_SayReliable_f( void )
|
void S_SayReliable_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 )
|
if( Cmd_Argc() == 1 )
|
||||||
{
|
{
|
||||||
Con_Printf( S_USAGE "spk <soundfile>\n" );
|
Con_Printf( S_USAGE "spk <vox sentence>\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
S_StartLocalSound( Cmd_Argv( 1 ), 1.0f, true );
|
S_Say( Cmd_Argv( 1 ), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1719,7 +1774,7 @@ void S_Music_f( void )
|
|||||||
else if( c == 2 )
|
else if( c == 2 )
|
||||||
{
|
{
|
||||||
string intro, main, track;
|
string intro, main, track;
|
||||||
char *ext[] = { "mp3", "wav" };
|
const char *ext[] = { "mp3", "wav" };
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
Q_strncpy( track, Cmd_Argv( 1 ), sizeof( track ));
|
Q_strncpy( track, Cmd_Argv( 1 ), sizeof( track ));
|
||||||
@@ -1815,17 +1870,18 @@ qboolean S_Init( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_volume = Cvar_Get( "volume", "0.7", FCVAR_ARCHIVE, "sound volume" );
|
Cvar_RegisterVariable( &s_volume );
|
||||||
s_musicvolume = Cvar_Get( "MP3Volume", "1.0", FCVAR_ARCHIVE, "background music volume" );
|
Cvar_RegisterVariable( &s_musicvolume );
|
||||||
s_mixahead = Cvar_Get( "_snd_mixahead", "0.12", 0, "how much sound to mix ahead of time" );
|
Cvar_RegisterVariable( &s_mixahead );
|
||||||
s_show = Cvar_Get( "s_show", "0", FCVAR_ARCHIVE, "show playing sounds" );
|
Cvar_RegisterVariable( &s_show );
|
||||||
s_lerping = Cvar_Get( "s_lerping", "0", FCVAR_ARCHIVE, "apply interpolation to sound output" );
|
Cvar_RegisterVariable( &s_lerping );
|
||||||
s_ambient_level = Cvar_Get( "ambient_level", "0.3", FCVAR_ARCHIVE, "volume of environment noises (water and wind)" );
|
Cvar_RegisterVariable( &s_ambient_level );
|
||||||
s_ambient_fade = Cvar_Get( "ambient_fade", "1000", FCVAR_ARCHIVE, "rate of volume fading when client is moving" );
|
Cvar_RegisterVariable( &s_ambient_fade );
|
||||||
s_combine_sounds = Cvar_Get( "s_combine_channels", "0", FCVAR_ARCHIVE, "combine channels with same sounds" );
|
Cvar_RegisterVariable( &s_combine_sounds );
|
||||||
snd_mute_losefocus = Cvar_Get( "snd_mute_losefocus", "1", FCVAR_ARCHIVE, "silence the audio when game window loses focus" );
|
Cvar_RegisterVariable( &snd_mute_losefocus );
|
||||||
s_test = Cvar_Get( "s_test", "0", 0, "engine developer cvar for quick testing new features" );
|
Cvar_RegisterVariable( &s_test );
|
||||||
s_samplecount = Cvar_Get( "s_samplecount", "0", FCVAR_ARCHIVE, "sample count (0 for default value)" );
|
Cvar_RegisterVariable( &s_samplecount );
|
||||||
|
Cvar_RegisterVariable( &s_warn_late_precache );
|
||||||
|
|
||||||
Cmd_AddCommand( "play", S_Play_f, "playing a specified sound file" );
|
Cmd_AddCommand( "play", S_Play_f, "playing a specified sound file" );
|
||||||
Cmd_AddCommand( "play2", S_Play2_f, "playing a group of specified sound files" ); // nehahra stuff
|
Cmd_AddCommand( "play2", S_Play2_f, "playing a group of specified sound files" ); // nehahra stuff
|
||||||
|
|||||||
@@ -408,13 +408,13 @@ void S_MixChannel( channel_t *pChannel, void *pData, int outputOffset, int input
|
|||||||
if( pSource->channels == 1 )
|
if( pSource->channels == 1 )
|
||||||
{
|
{
|
||||||
if( pSource->width == 1 )
|
if( pSource->width == 1 )
|
||||||
S_Mix8Mono( pbuf, pvol, (char *)pData, inputOffset, fracRate, outCount, timecompress );
|
S_Mix8Mono( pbuf, pvol, pData, inputOffset, fracRate, outCount, timecompress );
|
||||||
else S_Mix16Mono( pbuf, pvol, (short *)pData, inputOffset, fracRate, outCount );
|
else S_Mix16Mono( pbuf, pvol, (short *)pData, inputOffset, fracRate, outCount );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( pSource->width == 1 )
|
if( pSource->width == 1 )
|
||||||
S_Mix8Stereo( pbuf, pvol, (char *)pData, inputOffset, fracRate, outCount );
|
S_Mix8Stereo( pbuf, pvol, pData, inputOffset, fracRate, outCount );
|
||||||
else S_Mix16Stereo( pbuf, pvol, (short *)pData, inputOffset, fracRate, outCount );
|
else S_Mix16Stereo( pbuf, pvol, (short *)pData, inputOffset, fracRate, outCount );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -988,21 +988,25 @@ void MIX_UpsampleAllPaintbuffers( int end, int count )
|
|||||||
// mix 11khz sounds:
|
// mix 11khz sounds:
|
||||||
MIX_MixChannelsToPaintbuffer( end, SOUND_11k, SOUND_11k );
|
MIX_MixChannelsToPaintbuffer( end, SOUND_11k, SOUND_11k );
|
||||||
|
|
||||||
|
#if SOUND_DMA_SPEED >= SOUND_22k
|
||||||
// upsample all 11khz buffers by 2x
|
// upsample all 11khz buffers by 2x
|
||||||
// only upsample roombuffer if dsp fx are on KDB: perf
|
// only upsample roombuffer if dsp fx are on KDB: perf
|
||||||
MIX_SetCurrentPaintbuffer( IROOMBUFFER ); // operates on MixUpSample
|
MIX_SetCurrentPaintbuffer( IROOMBUFFER ); // operates on MixUpSample
|
||||||
S_MixUpsample( count / ( SOUND_DMA_SPEED / SOUND_11k ), s_lerping->value );
|
S_MixUpsample( count / ( SOUND_DMA_SPEED / SOUND_11k ), s_lerping.value );
|
||||||
|
|
||||||
// mix 22khz sounds:
|
// mix 22khz sounds:
|
||||||
MIX_MixChannelsToPaintbuffer( end, SOUND_22k, SOUND_22k );
|
MIX_MixChannelsToPaintbuffer( end, SOUND_22k, SOUND_22k );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SOUND_DMA_SPEED >= SOUND_44k
|
||||||
// upsample all 22khz buffers by 2x
|
// upsample all 22khz buffers by 2x
|
||||||
// only upsample roombuffer if dsp fx are on KDB: perf
|
// only upsample roombuffer if dsp fx are on KDB: perf
|
||||||
MIX_SetCurrentPaintbuffer( IROOMBUFFER );
|
MIX_SetCurrentPaintbuffer( IROOMBUFFER );
|
||||||
S_MixUpsample( count / ( SOUND_DMA_SPEED / SOUND_22k ), s_lerping->value );
|
S_MixUpsample( count / ( SOUND_DMA_SPEED / SOUND_22k ), s_lerping.value );
|
||||||
|
|
||||||
// mix all 44khz sounds to all active paintbuffers
|
// mix all 44khz sounds to all active paintbuffers
|
||||||
MIX_MixChannelsToPaintbuffer( end, SOUND_44k, SOUND_DMA_SPEED );
|
MIX_MixChannelsToPaintbuffer( end, SOUND_44k, SOUND_DMA_SPEED );
|
||||||
|
#endif
|
||||||
|
|
||||||
// mix raw samples from the video streams
|
// mix raw samples from the video streams
|
||||||
MIX_SetCurrentPaintbuffer( IROOMBUFFER );
|
MIX_SetCurrentPaintbuffer( IROOMBUFFER );
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ float S_GetMusicVolume( void )
|
|||||||
scale = 1.0f - scale;
|
scale = 1.0f - scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
return s_musicvolume->value * scale;
|
return s_musicvolume.value * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -183,7 +183,7 @@ void S_StreamBackgroundTrack( void )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// don't bother playing anything if musicvolume is 0
|
// don't bother playing anything if musicvolume is 0
|
||||||
if( !s_musicvolume->value || s_listener.paused || s_listener.stream_paused )
|
if( !s_musicvolume.value || s_listener.paused || s_listener.stream_paused )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !cl.background )
|
if( !cl.background )
|
||||||
|
|||||||
+10
-4
@@ -76,8 +76,11 @@ static char *ScanForwardUntil( char *string, const char scan )
|
|||||||
static char *VOX_GetDirectory( char *szpath, char *psz )
|
static char *VOX_GetDirectory( char *szpath, char *psz )
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
int cb = 0;
|
int cb = 0, len;
|
||||||
char *p = psz + Q_strlen( psz ) - 1;
|
char *p;
|
||||||
|
|
||||||
|
len = Q_strlen( psz );
|
||||||
|
p = psz + len - 1;
|
||||||
|
|
||||||
// scan backwards until first '/' or start of string
|
// scan backwards until first '/' or start of string
|
||||||
c = *p;
|
c = *p;
|
||||||
@@ -94,7 +97,7 @@ static char *VOX_GetDirectory( char *szpath, char *psz )
|
|||||||
return psz;
|
return psz;
|
||||||
}
|
}
|
||||||
|
|
||||||
cb = Q_strlen( psz ) - cb;
|
cb = len - cb;
|
||||||
memcpy( szpath, psz, cb );
|
memcpy( szpath, psz, cb );
|
||||||
szpath[cb] = 0;
|
szpath[cb] = 0;
|
||||||
|
|
||||||
@@ -466,7 +469,10 @@ void VOX_LoadSound( channel_t *pchan, const char *pszin )
|
|||||||
|
|
||||||
// lookup actual string in g_Sentences,
|
// lookup actual string in g_Sentences,
|
||||||
// set pointer to string data
|
// set pointer to string data
|
||||||
psz = VOX_LookupString( pszin, NULL );
|
if( pszin[0] == '#' )
|
||||||
|
psz = (char *)pszin + 1;
|
||||||
|
else
|
||||||
|
psz = VOX_LookupString( pszin, NULL );
|
||||||
|
|
||||||
if( !psz )
|
if( !psz )
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-11
@@ -16,9 +16,9 @@ GNU General Public License for more details.
|
|||||||
#ifndef SOUND_H
|
#ifndef SOUND_H
|
||||||
#define SOUND_H
|
#define SOUND_H
|
||||||
|
|
||||||
extern byte *sndpool;
|
extern poolhandle_t sndpool;
|
||||||
|
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
|
|
||||||
// sound engine rate defines
|
// sound engine rate defines
|
||||||
#define SOUND_DMA_SPEED 44100 // hardware playback rate
|
#define SOUND_DMA_SPEED 44100 // hardware playback rate
|
||||||
@@ -138,7 +138,6 @@ typedef struct rawchan_s
|
|||||||
int rightvol; // 0-255 right volume
|
int rightvol; // 0-255 right volume
|
||||||
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
|
||||||
float radius; // radius of this sound effect
|
|
||||||
volatile uint s_rawend;
|
volatile uint s_rawend;
|
||||||
wavdata_t sound_info; // advance play position
|
wavdata_t sound_info; // advance play position
|
||||||
float oldtime; // catch time jumps
|
float oldtime; // catch time jumps
|
||||||
@@ -217,15 +216,13 @@ extern listener_t s_listener;
|
|||||||
extern int idsp_room;
|
extern int idsp_room;
|
||||||
extern dma_t dma;
|
extern dma_t dma;
|
||||||
|
|
||||||
extern convar_t *s_volume;
|
extern convar_t s_musicvolume;
|
||||||
extern convar_t *s_musicvolume;
|
extern convar_t s_lerping;
|
||||||
extern convar_t *s_show;
|
|
||||||
extern convar_t *s_mixahead;
|
|
||||||
extern convar_t *s_lerping;
|
|
||||||
extern convar_t *dsp_off;
|
extern convar_t *dsp_off;
|
||||||
extern convar_t *s_test; // cvar to testify new effects
|
extern convar_t s_test; // cvar to testify new effects
|
||||||
extern convar_t *s_samplecount;
|
extern convar_t s_samplecount;
|
||||||
extern convar_t *snd_mute_losefocus;
|
extern convar_t snd_mute_losefocus;
|
||||||
|
extern convar_t s_warn_late_precache;
|
||||||
|
|
||||||
void S_InitScaletable( void );
|
void S_InitScaletable( void );
|
||||||
wavdata_t *S_LoadSound( sfx_t *sfx );
|
wavdata_t *S_LoadSound( sfx_t *sfx );
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
|
|||||||
// Save name/text on heap
|
// Save name/text on heap
|
||||||
textMessages[messageCount] = gMessageParms;
|
textMessages[messageCount] = gMessageParms;
|
||||||
textMessages[messageCount].pName = nameHeap + lastNamePos;
|
textMessages[messageCount].pName = nameHeap + lastNamePos;
|
||||||
lastNamePos += Q_strlen( currentName ) + 1;
|
lastNamePos += length + 1;
|
||||||
textMessages[messageCount].pMessage = pCurrentText;
|
textMessages[messageCount].pMessage = pCurrentText;
|
||||||
messageCount++;
|
messageCount++;
|
||||||
|
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ void GAME_EXPORT VGUI_CursorSelect(enum VGUI_DefaultCursor cursor )
|
|||||||
SDL_ShowCursor( false );
|
SDL_ShowCursor( false );
|
||||||
if( host.mouse_visible )
|
if( host.mouse_visible )
|
||||||
SDL_GetRelativeMouseState( NULL, NULL );
|
SDL_GetRelativeMouseState( NULL, NULL );
|
||||||
|
Key_EnableTextInput( false, true );
|
||||||
}
|
}
|
||||||
//SDL_SetRelativeMouseMode(false);
|
//SDL_SetRelativeMouseMode(false);
|
||||||
#endif
|
#endif
|
||||||
@@ -146,7 +147,7 @@ void GAME_EXPORT VGUI_SetVisible( qboolean state )
|
|||||||
if( !state )
|
if( !state )
|
||||||
SDL_GetRelativeMouseState( NULL, NULL );
|
SDL_GetRelativeMouseState( NULL, NULL );
|
||||||
#endif
|
#endif
|
||||||
Key_EnableTextInput( state, true );
|
Key_EnableTextInput( false, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GAME_EXPORT VGUI_UtfProcessChar( int in )
|
int GAME_EXPORT VGUI_UtfProcessChar( int in )
|
||||||
@@ -284,7 +285,7 @@ void VGui_Startup( const char *clientlib, int width, int height )
|
|||||||
if( !s_pVGuiSupport )
|
if( !s_pVGuiSupport )
|
||||||
{
|
{
|
||||||
if( FS_FileExists( vguiloader, false ) )
|
if( FS_FileExists( vguiloader, false ) )
|
||||||
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s", COM_GetLibraryError() );
|
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s\n", COM_GetLibraryError() );
|
||||||
else
|
else
|
||||||
Con_Reportf( "vgui_support: not found\n" );
|
Con_Reportf( "vgui_support: not found\n" );
|
||||||
}
|
}
|
||||||
@@ -318,7 +319,7 @@ void VGui_Startup( const char *clientlib, int width, int height )
|
|||||||
width = 1280;
|
width = 1280;
|
||||||
else if( width <= 1600 )
|
else if( width <= 1600 )
|
||||||
width = 1600;
|
width = 1600;
|
||||||
#ifdef DLL_LOADER
|
#ifdef XASH_DLL_LOADER
|
||||||
else if ( Q_strstr( vguiloader, ".dll" ) )
|
else if ( Q_strstr( vguiloader, ".dll" ) )
|
||||||
width = 1600;
|
width = 1600;
|
||||||
#endif
|
#endif
|
||||||
@@ -329,7 +330,10 @@ void VGui_Startup( const char *clientlib, int width, int height )
|
|||||||
//host.mouse_visible = true;
|
//host.mouse_visible = true;
|
||||||
vgui.Startup( width, height );
|
vgui.Startup( width, height );
|
||||||
}
|
}
|
||||||
else failed = true;
|
else if ( COM_CheckString( clientlib ) )
|
||||||
|
{
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -491,12 +495,11 @@ void VGui_KeyEvent( int key, int down )
|
|||||||
if( !vgui.initialized )
|
if( !vgui.initialized )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( host.mouse_visible )
|
|
||||||
Key_EnableTextInput( true, false );
|
|
||||||
|
|
||||||
switch( key )
|
switch( key )
|
||||||
{
|
{
|
||||||
case K_MOUSE1:
|
case K_MOUSE1:
|
||||||
|
if( down && host.mouse_visible )
|
||||||
|
Key_EnableTextInput( true, false );
|
||||||
vgui.Mouse( down ? MA_PRESSED : MA_RELEASED, MOUSE_LEFT );
|
vgui.Mouse( down ? MA_PRESSED : MA_RELEASED, MOUSE_LEFT );
|
||||||
return;
|
return;
|
||||||
case K_MOUSE2:
|
case K_MOUSE2:
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ GNU General Public License for more details.
|
|||||||
#define WINDOW_NAME XASH_ENGINE_NAME " Window" // Half-Life
|
#define WINDOW_NAME XASH_ENGINE_NAME " Window" // Half-Life
|
||||||
convar_t *vid_displayfrequency;
|
convar_t *vid_displayfrequency;
|
||||||
convar_t *vid_fullscreen;
|
convar_t *vid_fullscreen;
|
||||||
|
convar_t *vid_mode;
|
||||||
convar_t *vid_brightness;
|
convar_t *vid_brightness;
|
||||||
convar_t *vid_gamma;
|
convar_t *vid_gamma;
|
||||||
convar_t *vid_highdpi;
|
convar_t *vid_highdpi;
|
||||||
@@ -182,6 +183,7 @@ void VID_Init( void )
|
|||||||
vid_brightness = Cvar_Get( "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
vid_brightness = Cvar_Get( "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
||||||
vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "fullscreen refresh rate" );
|
vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "fullscreen refresh rate" );
|
||||||
vid_fullscreen = Cvar_Get( "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable fullscreen mode" );
|
vid_fullscreen = Cvar_Get( "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable fullscreen mode" );
|
||||||
|
vid_mode = Cvar_Get( "vid_mode", "0", FCVAR_RENDERINFO, "current video mode index (used just for storage)" );
|
||||||
vid_highdpi = Cvar_Get( "vid_highdpi", "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" );
|
vid_highdpi = Cvar_Get( "vid_highdpi", "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" );
|
||||||
vid_rotate = Cvar_Get( "vid_rotate", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" );
|
vid_rotate = Cvar_Get( "vid_rotate", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen rotation (0-3)" );
|
||||||
vid_scale = Cvar_Get( "vid_scale", "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
vid_scale = Cvar_Get( "vid_scale", "1.0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "pixel scale" );
|
||||||
|
|||||||
+37
-12
@@ -15,9 +15,9 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
static char *date = __DATE__ ;
|
static const char *date = __DATE__ ;
|
||||||
static char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
static const char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||||
static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
static const char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||||
|
|
||||||
// returns days since Apr 1 2015
|
// returns days since Apr 1 2015
|
||||||
int Q_buildnum( void )
|
int Q_buildnum( void )
|
||||||
@@ -91,6 +91,10 @@ const char *Q_buildos( void )
|
|||||||
osname = "openbsd";
|
osname = "openbsd";
|
||||||
#elif XASH_EMSCRIPTEN
|
#elif XASH_EMSCRIPTEN
|
||||||
osname = "emscripten";
|
osname = "emscripten";
|
||||||
|
#elif XASH_DOS4GW
|
||||||
|
osname = "DOS4GW";
|
||||||
|
#elif XASH_HAIKU
|
||||||
|
osname = "haiku";
|
||||||
#else
|
#else
|
||||||
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
|
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
|
||||||
#endif
|
#endif
|
||||||
@@ -100,9 +104,9 @@ const char *Q_buildos( void )
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Q_buildos
|
Q_buildarch
|
||||||
|
|
||||||
Returns current name of operating system. Without any spaces.
|
Returns current name of the architecture. Without any spaces.
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
const char *Q_buildarch( void )
|
const char *Q_buildarch( void )
|
||||||
@@ -113,11 +117,13 @@ const char *Q_buildarch( void )
|
|||||||
archname = "amd64";
|
archname = "amd64";
|
||||||
#elif XASH_X86
|
#elif XASH_X86
|
||||||
archname = "i386";
|
archname = "i386";
|
||||||
#elif XASH_ARM64
|
#elif XASH_ARM && XASH_64BIT
|
||||||
archname = "arm64";
|
archname = "arm64";
|
||||||
#elif XASH_ARM
|
#elif XASH_ARM
|
||||||
archname = "armv"
|
archname = "armv"
|
||||||
#if XASH_ARM == 7
|
#if XASH_ARM == 8
|
||||||
|
"8_32" // for those who (mis)using 32-bit OS on 64-bit CPU
|
||||||
|
#elif XASH_ARM == 7
|
||||||
"7"
|
"7"
|
||||||
#elif XASH_ARM == 6
|
#elif XASH_ARM == 6
|
||||||
"6"
|
"6"
|
||||||
@@ -128,14 +134,33 @@ const char *Q_buildarch( void )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if XASH_ARM_HARDFP
|
#if XASH_ARM_HARDFP
|
||||||
"hf";
|
"hf"
|
||||||
#else
|
#else
|
||||||
"l";
|
"l"
|
||||||
#endif
|
#endif
|
||||||
|
;
|
||||||
#elif XASH_MIPS && XASH_BIG_ENDIAN
|
#elif XASH_MIPS && XASH_BIG_ENDIAN
|
||||||
archname = "mips";
|
archname = "mips"
|
||||||
#elif XASH_MIPS && XASH_LITTLE_ENDIAN
|
#if XASH_64BIT
|
||||||
archname = "mipsel";
|
"64"
|
||||||
|
#endif
|
||||||
|
#if XASH_LITTLE_ENDIAN
|
||||||
|
"el"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
#elif XASH_RISCV
|
||||||
|
archname = "riscv"
|
||||||
|
#if XASH_64BIT
|
||||||
|
"64"
|
||||||
|
#else
|
||||||
|
"32"
|
||||||
|
#endif
|
||||||
|
#if XASH_RISCV_SINGLEFP
|
||||||
|
"d"
|
||||||
|
#elif XASH_RISCV_DOUBLEFP
|
||||||
|
"f"
|
||||||
|
#endif
|
||||||
|
;
|
||||||
#elif XASH_JS
|
#elif XASH_JS
|
||||||
archname = "javascript";
|
archname = "javascript";
|
||||||
#elif XASH_E2K
|
#elif XASH_E2K
|
||||||
|
|||||||
+62
-86
@@ -25,7 +25,7 @@ typedef enum
|
|||||||
T_COUNT
|
T_COUNT
|
||||||
} cvartype_t;
|
} cvartype_t;
|
||||||
|
|
||||||
char *cvartypes[] = { NULL, "BOOL" , "NUMBER", "LIST", "STRING" };
|
const char *cvartypes[] = { NULL, "BOOL", "NUMBER", "LIST", "STRING" };
|
||||||
|
|
||||||
typedef struct parserstate_s
|
typedef struct parserstate_s
|
||||||
{
|
{
|
||||||
@@ -54,7 +54,7 @@ Return true if next token is pExpext and skip it
|
|||||||
*/
|
*/
|
||||||
qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean skip, qboolean error )
|
qboolean CSCR_ExpectString( parserstate_t *ps, const char *pExpect, qboolean skip, qboolean error )
|
||||||
{
|
{
|
||||||
char *tmp = COM_ParseFile( ps->buf, ps->token );
|
char *tmp = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
|
||||||
|
|
||||||
if( !Q_stricmp( ps->token, pExpect ) )
|
if( !Q_stricmp( ps->token, pExpect ) )
|
||||||
{
|
{
|
||||||
@@ -99,13 +99,13 @@ CSCR_ParseSingleCvar
|
|||||||
qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
||||||
{
|
{
|
||||||
// read the name
|
// read the name
|
||||||
ps->buf = COM_ParseFile( ps->buf, result->name );
|
ps->buf = COM_ParseFile( ps->buf, result->name, sizeof( result->name ));
|
||||||
|
|
||||||
if( !CSCR_ExpectString( ps, "{", false, true ))
|
if( !CSCR_ExpectString( ps, "{", false, true ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// read description
|
// read description
|
||||||
ps->buf = COM_ParseFile( ps->buf, result->desc );
|
ps->buf = COM_ParseFile( ps->buf, result->desc, sizeof( result->desc ));
|
||||||
|
|
||||||
if( !CSCR_ExpectString( ps, "{", false, true ))
|
if( !CSCR_ExpectString( ps, "{", false, true ))
|
||||||
return false;
|
return false;
|
||||||
@@ -121,11 +121,11 @@ qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
|||||||
break;
|
break;
|
||||||
case T_NUMBER:
|
case T_NUMBER:
|
||||||
// min
|
// min
|
||||||
ps->buf = COM_ParseFile( ps->buf, ps->token );
|
ps->buf = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
|
||||||
result->fMin = Q_atof( ps->token );
|
result->fMin = Q_atof( ps->token );
|
||||||
|
|
||||||
// max
|
// max
|
||||||
ps->buf = COM_ParseFile( ps->buf, ps->token );
|
ps->buf = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
|
||||||
result->fMax = Q_atof( ps->token );
|
result->fMax = Q_atof( ps->token );
|
||||||
|
|
||||||
if( !CSCR_ExpectString( ps, "}", false, true ))
|
if( !CSCR_ExpectString( ps, "}", false, true ))
|
||||||
@@ -149,7 +149,7 @@ qboolean CSCR_ParseSingleCvar( parserstate_t *ps, scrvardef_t *result )
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// default value
|
// default value
|
||||||
ps->buf = COM_ParseFile( ps->buf, result->value );
|
ps->buf = COM_ParseFile( ps->buf, result->value, sizeof( result->value ));
|
||||||
|
|
||||||
if( !CSCR_ExpectString( ps, "}", false, true ))
|
if( !CSCR_ExpectString( ps, "}", false, true ))
|
||||||
return false;
|
return false;
|
||||||
@@ -177,7 +177,7 @@ qboolean CSCR_ParseHeader( parserstate_t *ps )
|
|||||||
|
|
||||||
// Parse in the version #
|
// Parse in the version #
|
||||||
// Get the first token.
|
// Get the first token.
|
||||||
ps->buf = COM_ParseFile( ps->buf, ps->token );
|
ps->buf = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
|
||||||
|
|
||||||
if( Q_atof( ps->token ) != 1 )
|
if( Q_atof( ps->token ) != 1 )
|
||||||
{
|
{
|
||||||
@@ -188,7 +188,7 @@ qboolean CSCR_ParseHeader( parserstate_t *ps )
|
|||||||
if( !CSCR_ExpectString( ps, "DESCRIPTION", false, true ))
|
if( !CSCR_ExpectString( ps, "DESCRIPTION", false, true ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ps->buf = COM_ParseFile( ps->buf, ps->token );
|
ps->buf = COM_ParseFile( ps->buf, ps->token, sizeof( ps->token ));
|
||||||
|
|
||||||
if( Q_stricmp( ps->token, "INFO_OPTIONS") && Q_stricmp( ps->token, "SERVER_OPTIONS" ))
|
if( Q_stricmp( ps->token, "INFO_OPTIONS") && Q_stricmp( ps->token, "SERVER_OPTIONS" ))
|
||||||
{
|
{
|
||||||
@@ -203,83 +203,15 @@ qboolean CSCR_ParseHeader( parserstate_t *ps )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
======================
|
==============
|
||||||
CSCR_WriteGameCVars
|
CSCR_ParseFile
|
||||||
|
|
||||||
Print all cvars declared in script to game.cfg file
|
generic scr parser
|
||||||
======================
|
will callback on each scrvardef_t
|
||||||
|
==============
|
||||||
*/
|
*/
|
||||||
int CSCR_WriteGameCVars( file_t *cfg, const char *scriptfilename )
|
static int CSCR_ParseFile( const char *scriptfilename,
|
||||||
{
|
void (*callback)( scrvardef_t *var, void * ), void *userdata )
|
||||||
parserstate_t state = { 0 };
|
|
||||||
qboolean success = false;
|
|
||||||
int count = 0;
|
|
||||||
fs_offset_t length = 0;
|
|
||||||
char *start;
|
|
||||||
|
|
||||||
state.filename = scriptfilename;
|
|
||||||
state.buf = start = (char *)FS_LoadFile( scriptfilename, &length, true );
|
|
||||||
|
|
||||||
if( !state.buf || !length )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
Con_DPrintf( "Reading config script file %s\n", scriptfilename );
|
|
||||||
|
|
||||||
if( !CSCR_ParseHeader( &state ))
|
|
||||||
goto finish;
|
|
||||||
|
|
||||||
while( !CSCR_ExpectString( &state, "}", false, false ))
|
|
||||||
{
|
|
||||||
scrvardef_t var = { 0 };
|
|
||||||
|
|
||||||
if( CSCR_ParseSingleCvar( &state, &var ) )
|
|
||||||
{
|
|
||||||
convar_t *cvar = Cvar_FindVar( var.name );
|
|
||||||
|
|
||||||
if( cvar && !FBitSet( cvar->flags, FCVAR_SERVER|FCVAR_ARCHIVE ))
|
|
||||||
{
|
|
||||||
// cvars will be placed in game.cfg and restored on map start
|
|
||||||
if( var.flags & FCVAR_USERINFO )
|
|
||||||
FS_Printf( cfg, "setinfo %s \"%s\"\n", var.name, cvar->string );
|
|
||||||
else FS_Printf( cfg, "%s \"%s\"\n", var.name, cvar->string );
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( count > 1024 )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( COM_ParseFile( state.buf, state.token ))
|
|
||||||
Con_DPrintf( S_ERROR "Got extra tokens!\n" );
|
|
||||||
else success = true;
|
|
||||||
finish:
|
|
||||||
if( !success )
|
|
||||||
{
|
|
||||||
state.token[sizeof( state.token ) - 1] = 0;
|
|
||||||
|
|
||||||
if( start && state.buf )
|
|
||||||
Con_DPrintf( S_ERROR "Parse error in %s, byte %d, token %s\n", scriptfilename, (int)( state.buf - start ), state.token );
|
|
||||||
else Con_DPrintf( S_ERROR "Parse error in %s, token %s\n", scriptfilename, state.token );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( start ) Mem_Free( start );
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
======================
|
|
||||||
CSCR_LoadDefaultCVars
|
|
||||||
|
|
||||||
Register all cvars declared in config file and set default values
|
|
||||||
======================
|
|
||||||
*/
|
|
||||||
int CSCR_LoadDefaultCVars( const char *scriptfilename )
|
|
||||||
{
|
{
|
||||||
parserstate_t state = { 0 };
|
parserstate_t state = { 0 };
|
||||||
qboolean success = false;
|
qboolean success = false;
|
||||||
@@ -305,7 +237,7 @@ int CSCR_LoadDefaultCVars( const char *scriptfilename )
|
|||||||
// Create a new object
|
// Create a new object
|
||||||
if( CSCR_ParseSingleCvar( &state, &var ) )
|
if( CSCR_ParseSingleCvar( &state, &var ) )
|
||||||
{
|
{
|
||||||
Cvar_Get( var.name, var.value, var.flags|FCVAR_TEMPORARY, var.desc );
|
callback( &var, userdata );
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -315,7 +247,7 @@ int CSCR_LoadDefaultCVars( const char *scriptfilename )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( COM_ParseFile( state.buf, state.token ))
|
if( COM_ParseFile( state.buf, state.token, sizeof( state.token )))
|
||||||
Con_DPrintf( S_ERROR "Got extra tokens!\n" );
|
Con_DPrintf( S_ERROR "Got extra tokens!\n" );
|
||||||
else success = true;
|
else success = true;
|
||||||
finish:
|
finish:
|
||||||
@@ -331,3 +263,47 @@ finish:
|
|||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void CSCR_WriteVariableToFile( scrvardef_t *var, void *file )
|
||||||
|
{
|
||||||
|
file_t *cfg = (file_t*)file;
|
||||||
|
convar_t *cvar = Cvar_FindVar( var->name );
|
||||||
|
|
||||||
|
if( cvar && !FBitSet( cvar->flags, FCVAR_SERVER|FCVAR_ARCHIVE ))
|
||||||
|
{
|
||||||
|
// cvars will be placed in game.cfg and restored on map start
|
||||||
|
if( var->flags & FCVAR_USERINFO )
|
||||||
|
FS_Printf( cfg, "setinfo %s \"%s\"\n", var->name, cvar->string );
|
||||||
|
else FS_Printf( cfg, "%s \"%s\"\n", var->name, cvar->string );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
======================
|
||||||
|
CSCR_WriteGameCVars
|
||||||
|
|
||||||
|
Print all cvars declared in script to game.cfg file
|
||||||
|
======================
|
||||||
|
*/
|
||||||
|
int CSCR_WriteGameCVars( file_t *cfg, const char *scriptfilename )
|
||||||
|
{
|
||||||
|
return CSCR_ParseFile( scriptfilename, CSCR_WriteVariableToFile, cfg );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void CSCR_RegisterVariable( scrvardef_t *var, void *unused )
|
||||||
|
{
|
||||||
|
if( !Cvar_FindVar( var->name ))
|
||||||
|
Cvar_Get( var->name, var->value, var->flags|FCVAR_TEMPORARY, var->desc );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
======================
|
||||||
|
CSCR_LoadDefaultCVars
|
||||||
|
|
||||||
|
Register all cvars declared in config file and set default values
|
||||||
|
======================
|
||||||
|
*/
|
||||||
|
int CSCR_LoadDefaultCVars( const char *scriptfilename )
|
||||||
|
{
|
||||||
|
return CSCR_ParseFile( scriptfilename, CSCR_RegisterVariable, NULL );
|
||||||
|
}
|
||||||
|
|||||||
+12
-14
@@ -463,7 +463,7 @@ typedef struct cmd_s
|
|||||||
} cmd_t;
|
} cmd_t;
|
||||||
|
|
||||||
static int cmd_argc;
|
static int cmd_argc;
|
||||||
static char *cmd_args = NULL;
|
static const char *cmd_args = NULL;
|
||||||
static char *cmd_argv[MAX_CMD_TOKENS];
|
static char *cmd_argv[MAX_CMD_TOKENS];
|
||||||
static char cmd_tokenized[MAX_CMD_BUFFER]; // will have 0 bytes inserted
|
static char cmd_tokenized[MAX_CMD_BUFFER]; // will have 0 bytes inserted
|
||||||
static cmd_t *cmd_functions; // possible commands to execute
|
static cmd_t *cmd_functions; // possible commands to execute
|
||||||
@@ -473,7 +473,7 @@ static cmd_t *cmd_functions; // possible commands to execute
|
|||||||
Cmd_Argc
|
Cmd_Argc
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
int Cmd_Argc( void )
|
int GAME_EXPORT Cmd_Argc( void )
|
||||||
{
|
{
|
||||||
return cmd_argc;
|
return cmd_argc;
|
||||||
}
|
}
|
||||||
@@ -545,7 +545,7 @@ cmd_t *GAME_EXPORT Cmd_GetNextFunctionHandle( cmd_t *cmd )
|
|||||||
Cmd_GetName
|
Cmd_GetName
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
char *GAME_EXPORT Cmd_GetName( cmd_t *cmd )
|
const char *GAME_EXPORT Cmd_GetName( cmd_t *cmd )
|
||||||
{
|
{
|
||||||
return cmd->name;
|
return cmd->name;
|
||||||
}
|
}
|
||||||
@@ -560,7 +560,7 @@ are inserted in the apropriate place, The argv array
|
|||||||
will point into this temporary buffer.
|
will point into this temporary buffer.
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_TokenizeString( char *text )
|
void Cmd_TokenizeString( const char *text )
|
||||||
{
|
{
|
||||||
char cmd_token[MAX_CMD_BUFFER];
|
char cmd_token[MAX_CMD_BUFFER];
|
||||||
int i;
|
int i;
|
||||||
@@ -577,7 +577,7 @@ void Cmd_TokenizeString( char *text )
|
|||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
// skip whitespace up to a /n
|
// skip whitespace up to a /n
|
||||||
while( *text && ((byte)*text) <= ' ' && *text != '\r' && *text != '\n' )
|
while( *text && *text <= ' ' && *text != '\r' && *text != '\n' )
|
||||||
text++;
|
text++;
|
||||||
|
|
||||||
if( *text == '\n' || *text == '\r' )
|
if( *text == '\n' || *text == '\r' )
|
||||||
@@ -595,9 +595,7 @@ void Cmd_TokenizeString( char *text )
|
|||||||
if( cmd_argc == 1 )
|
if( cmd_argc == 1 )
|
||||||
cmd_args = text;
|
cmd_args = text;
|
||||||
|
|
||||||
host.com_ignorebracket = true;
|
text = _COM_ParseFileSafe( (char*)text, cmd_token, sizeof( cmd_token ), PFILE_IGNOREBRACKET, NULL );
|
||||||
text = COM_ParseFile( text, cmd_token );
|
|
||||||
host.com_ignorebracket = false;
|
|
||||||
|
|
||||||
if( !text ) return;
|
if( !text ) return;
|
||||||
|
|
||||||
@@ -686,7 +684,7 @@ void Cmd_AddRestrictedCommand( const char *cmd_name, xcommand_t function, const
|
|||||||
Cmd_AddServerCommand
|
Cmd_AddServerCommand
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_AddServerCommand( const char *cmd_name, xcommand_t function )
|
void GAME_EXPORT Cmd_AddServerCommand( const char *cmd_name, xcommand_t function )
|
||||||
{
|
{
|
||||||
Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "server command", CMD_SERVERDLL );
|
Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "server command", CMD_SERVERDLL );
|
||||||
}
|
}
|
||||||
@@ -696,7 +694,7 @@ void Cmd_AddServerCommand( const char *cmd_name, xcommand_t function )
|
|||||||
Cmd_AddClientCommand
|
Cmd_AddClientCommand
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
int Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
int GAME_EXPORT Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
||||||
{
|
{
|
||||||
return Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "client command", CMD_CLIENTDLL );
|
return Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "client command", CMD_CLIENTDLL );
|
||||||
}
|
}
|
||||||
@@ -706,7 +704,7 @@ int Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
|||||||
Cmd_AddGameUICommand
|
Cmd_AddGameUICommand
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
int Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
int GAME_EXPORT Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function )
|
||||||
{
|
{
|
||||||
return Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "gameui command", CMD_GAMEUIDLL );
|
return Cmd_AddCommandEx( __FUNCTION__, cmd_name, function, "gameui command", CMD_GAMEUIDLL );
|
||||||
}
|
}
|
||||||
@@ -726,7 +724,7 @@ int Cmd_AddRefCommand( const char *cmd_name, xcommand_t function, const char *de
|
|||||||
Cmd_RemoveCommand
|
Cmd_RemoveCommand
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_RemoveCommand( const char *cmd_name )
|
void GAME_EXPORT Cmd_RemoveCommand( const char *cmd_name )
|
||||||
{
|
{
|
||||||
cmd_t *cmd, **back;
|
cmd_t *cmd, **back;
|
||||||
|
|
||||||
@@ -885,7 +883,7 @@ Cmd_ExecuteString
|
|||||||
A complete command line has been parsed, so try to execute it
|
A complete command line has been parsed, so try to execute it
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_ExecuteString( char *text )
|
void Cmd_ExecuteString( const char *text )
|
||||||
{
|
{
|
||||||
cmd_t *cmd = NULL;
|
cmd_t *cmd = NULL;
|
||||||
cmdalias_t *a = NULL;
|
cmdalias_t *a = NULL;
|
||||||
@@ -1158,7 +1156,7 @@ static void Cmd_Apropos_f( void )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ispattern = partial && ( Q_strchr( partial, '*' ) || Q_strchr( partial, '?' ));
|
ispattern = partial && Q_strpbrk( partial, "*?" );
|
||||||
if( !ispattern )
|
if( !ispattern )
|
||||||
partial = va( "*%s*", partial );
|
partial = va( "*%s*", partial );
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,8 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#define XASH_ENGINE_NAME "Xash3D FWGS"
|
#define XASH_ENGINE_NAME "Xash3D FWGS"
|
||||||
|
|
||||||
#define DEFAULT_RENDERERS { "gl", "gles1", "gles2", "soft" }
|
// renderers order is important, software is always a last chance fallback
|
||||||
#define DEFAULT_RENDERERS_LEN 4
|
#define DEFAULT_RENDERERS { "gl", "gles1", "gles2", "gl4es", "soft" }
|
||||||
|
#define DEFAULT_RENDERERS_LEN 5
|
||||||
|
|
||||||
#endif//COM_STRINGS_H
|
#endif//COM_STRINGS_H
|
||||||
|
|||||||
+57
-153
@@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
@@ -112,7 +112,7 @@ void COM_SetRandomSeed( int lSeed )
|
|||||||
idum -= 22261048;
|
idum -= 22261048;
|
||||||
}
|
}
|
||||||
|
|
||||||
float COM_RandomFloat( float flLow, float flHigh )
|
float GAME_EXPORT COM_RandomFloat( float flLow, float flHigh )
|
||||||
{
|
{
|
||||||
float fl;
|
float fl;
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ float COM_RandomFloat( float flLow, float flHigh )
|
|||||||
return (fl * (flHigh - flLow)) + flLow; // float in [low, high)
|
return (fl * (flHigh - flLow)) + flLow; // float in [low, high)
|
||||||
}
|
}
|
||||||
|
|
||||||
int COM_RandomLong( int lLow, int lHigh )
|
int GAME_EXPORT COM_RandomLong( int lLow, int lHigh )
|
||||||
{
|
{
|
||||||
dword maxAcceptable;
|
dword maxAcceptable;
|
||||||
dword n, x = lHigh - lLow + 1;
|
dword n, x = lHigh - lLow + 1;
|
||||||
@@ -429,31 +429,6 @@ uint LZSS_Decompress( const byte *pInput, byte *pOutput )
|
|||||||
return totalBytes;
|
return totalBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
==============
|
|
||||||
COM_IsSingleChar
|
|
||||||
|
|
||||||
interpert this character as single
|
|
||||||
==============
|
|
||||||
*/
|
|
||||||
static int COM_IsSingleChar( char c )
|
|
||||||
{
|
|
||||||
if( c == '{' || c == '}' || c == '\'' || c == ',' )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if( !host.com_ignorebracket && ( c == ')' || c == '(' ))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if( host.com_handlecolon && c == ':' )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
COM_IsWhiteSpace
|
COM_IsWhiteSpace
|
||||||
@@ -469,94 +444,6 @@ static int COM_IsWhiteSpace( char space )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
==============
|
|
||||||
COM_ParseFile
|
|
||||||
|
|
||||||
text parser
|
|
||||||
==============
|
|
||||||
*/
|
|
||||||
char *COM_ParseFile( char *data, char *token )
|
|
||||||
{
|
|
||||||
int c, len;
|
|
||||||
|
|
||||||
if( !token )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
len = 0;
|
|
||||||
token[0] = 0;
|
|
||||||
|
|
||||||
if( !data )
|
|
||||||
return NULL;
|
|
||||||
// skip whitespace
|
|
||||||
skipwhite:
|
|
||||||
while(( c = ((byte)*data)) <= ' ' )
|
|
||||||
{
|
|
||||||
if( c == 0 )
|
|
||||||
return NULL; // end of file;
|
|
||||||
data++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// skip // comments
|
|
||||||
if( c=='/' && data[1] == '/' )
|
|
||||||
{
|
|
||||||
while( *data && *data != '\n' )
|
|
||||||
data++;
|
|
||||||
goto skipwhite;
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle quoted strings specially
|
|
||||||
if( c == '\"' )
|
|
||||||
{
|
|
||||||
data++;
|
|
||||||
while( 1 )
|
|
||||||
{
|
|
||||||
c = (byte)*data;
|
|
||||||
|
|
||||||
// unexpected line end
|
|
||||||
if( !c )
|
|
||||||
{
|
|
||||||
token[len] = 0;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
data++;
|
|
||||||
|
|
||||||
if( c == '\"' )
|
|
||||||
{
|
|
||||||
token[len] = 0;
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
token[len] = c;
|
|
||||||
len++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse single characters
|
|
||||||
if( COM_IsSingleChar( c ))
|
|
||||||
{
|
|
||||||
token[len] = c;
|
|
||||||
len++;
|
|
||||||
token[len] = 0;
|
|
||||||
return data + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse a regular word
|
|
||||||
do
|
|
||||||
{
|
|
||||||
token[len] = c;
|
|
||||||
data++;
|
|
||||||
len++;
|
|
||||||
c = ((byte)*data);
|
|
||||||
|
|
||||||
if( COM_IsSingleChar( c ))
|
|
||||||
break;
|
|
||||||
} while( c > 32 );
|
|
||||||
|
|
||||||
token[len] = 0;
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
COM_ParseVector
|
COM_ParseVector
|
||||||
@@ -577,14 +464,14 @@ qboolean COM_ParseVector( char **pfile, float *v, size_t size )
|
|||||||
|
|
||||||
if( size == 1 )
|
if( size == 1 )
|
||||||
{
|
{
|
||||||
*pfile = COM_ParseFile( *pfile, token );
|
*pfile = COM_ParseFile( *pfile, token, sizeof( token ));
|
||||||
v[0] = Q_atof( token );
|
v[0] = Q_atof( token );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
saved = *pfile;
|
saved = *pfile;
|
||||||
|
|
||||||
if(( *pfile = COM_ParseFile( *pfile, token )) == NULL )
|
if(( *pfile = COM_ParseFile( *pfile, token, sizeof( token ))) == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( token[0] == '(' )
|
if( token[0] == '(' )
|
||||||
@@ -593,13 +480,13 @@ qboolean COM_ParseVector( char **pfile, float *v, size_t size )
|
|||||||
|
|
||||||
for( i = 0; i < size; i++ )
|
for( i = 0; i < size; i++ )
|
||||||
{
|
{
|
||||||
*pfile = COM_ParseFile( *pfile, token );
|
*pfile = COM_ParseFile( *pfile, token, sizeof( token ));
|
||||||
v[i] = Q_atof( token );
|
v[i] = Q_atof( token );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !bracket ) return true; // done
|
if( !bracket ) return true; // done
|
||||||
|
|
||||||
if(( *pfile = COM_ParseFile( *pfile, token )) == NULL )
|
if(( *pfile = COM_ParseFile( *pfile, token, sizeof( token ))) == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( token[0] == ')' )
|
if( token[0] == ')' )
|
||||||
@@ -607,28 +494,13 @@ qboolean COM_ParseVector( char **pfile, float *v, size_t size )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
COM_CheckString
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
int COM_CheckString( const char *string )
|
|
||||||
{
|
|
||||||
if( !string || !*string )
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
COM_FileSize
|
COM_FileSize
|
||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int COM_FileSize( const char *filename )
|
int GAME_EXPORT COM_FileSize( const char *filename )
|
||||||
{
|
{
|
||||||
return FS_FileSize( filename, false );
|
return FS_FileSize( filename, false );
|
||||||
}
|
}
|
||||||
@@ -639,7 +511,7 @@ COM_AddAppDirectoryToSearchPath
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName )
|
void GAME_EXPORT COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName )
|
||||||
{
|
{
|
||||||
FS_AddGameHierarchy( pszBaseDir, FS_NOWRITE_PATH );
|
FS_AddGameHierarchy( pszBaseDir, FS_NOWRITE_PATH );
|
||||||
}
|
}
|
||||||
@@ -652,7 +524,7 @@ Finds the file in the search path, copies over the name with the full path name.
|
|||||||
This doesn't search in the pak file.
|
This doesn't search in the pak file.
|
||||||
===========
|
===========
|
||||||
*/
|
*/
|
||||||
int COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize )
|
int GAME_EXPORT COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBufferSize )
|
||||||
{
|
{
|
||||||
const char *path;
|
const char *path;
|
||||||
char result[MAX_SYSPATH];
|
char result[MAX_SYSPATH];
|
||||||
@@ -836,7 +708,7 @@ Cache_Check
|
|||||||
consistency check
|
consistency check
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void *Cache_Check( byte *mempool, cache_user_t *c )
|
void *Cache_Check( poolhandle_t mempool, cache_user_t *c )
|
||||||
{
|
{
|
||||||
if( !c->data )
|
if( !c->data )
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -853,7 +725,7 @@ COM_LoadFileForMe
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
byte* COM_LoadFileForMe( const char *filename, int *pLength )
|
byte* GAME_EXPORT COM_LoadFileForMe( const char *filename, int *pLength )
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
byte *file, *pfile;
|
byte *file, *pfile;
|
||||||
@@ -904,7 +776,7 @@ COM_SaveFile
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int COM_SaveFile( const char *filename, const void *data, int len )
|
int GAME_EXPORT COM_SaveFile( const char *filename, const void *data, int len )
|
||||||
{
|
{
|
||||||
// check for empty filename
|
// check for empty filename
|
||||||
if( !COM_CheckString( filename ))
|
if( !COM_CheckString( filename ))
|
||||||
@@ -923,7 +795,7 @@ COM_FreeFile
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void COM_FreeFile( void *buffer )
|
void GAME_EXPORT COM_FreeFile( void *buffer )
|
||||||
{
|
{
|
||||||
free( buffer );
|
free( buffer );
|
||||||
}
|
}
|
||||||
@@ -953,7 +825,7 @@ pfnGetModelType
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int pfnGetModelType( model_t *mod )
|
int GAME_EXPORT pfnGetModelType( model_t *mod )
|
||||||
{
|
{
|
||||||
if( !mod ) return mod_bad;
|
if( !mod ) return mod_bad;
|
||||||
return mod->type;
|
return mod->type;
|
||||||
@@ -965,7 +837,7 @@ pfnGetModelBounds
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs )
|
void GAME_EXPORT pfnGetModelBounds( model_t *mod, float *mins, float *maxs )
|
||||||
{
|
{
|
||||||
if( mod )
|
if( mod )
|
||||||
{
|
{
|
||||||
@@ -986,7 +858,7 @@ pfnCvar_RegisterServerVariable
|
|||||||
standard path to register game variable
|
standard path to register game variable
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnCvar_RegisterServerVariable( cvar_t *variable )
|
void GAME_EXPORT pfnCvar_RegisterServerVariable( cvar_t *variable )
|
||||||
{
|
{
|
||||||
if( variable != NULL )
|
if( variable != NULL )
|
||||||
SetBits( variable->flags, FCVAR_EXTDLL );
|
SetBits( variable->flags, FCVAR_EXTDLL );
|
||||||
@@ -1001,7 +873,7 @@ use with precaution: this cvar will NOT unlinked
|
|||||||
after game.dll is unloaded
|
after game.dll is unloaded
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnCvar_RegisterEngineVariable( cvar_t *variable )
|
void GAME_EXPORT pfnCvar_RegisterEngineVariable( cvar_t *variable )
|
||||||
{
|
{
|
||||||
Cvar_RegisterVariable( (convar_t *)variable );
|
Cvar_RegisterVariable( (convar_t *)variable );
|
||||||
}
|
}
|
||||||
@@ -1051,7 +923,7 @@ pfnCVarDirectSet
|
|||||||
allow to set cvar directly
|
allow to set cvar directly
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnCVarDirectSet( cvar_t *var, const char *szValue )
|
void GAME_EXPORT pfnCVarDirectSet( cvar_t *var, const char *szValue )
|
||||||
{
|
{
|
||||||
Cvar_DirectSet( (convar_t *)var, szValue );
|
Cvar_DirectSet( (convar_t *)var, szValue );
|
||||||
}
|
}
|
||||||
@@ -1062,7 +934,7 @@ COM_CompareFileTime
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare )
|
int GAME_EXPORT COM_CompareFileTime( const char *filename1, const char *filename2, int *iCompare )
|
||||||
{
|
{
|
||||||
int bRet = 0;
|
int bRet = 0;
|
||||||
|
|
||||||
@@ -1090,7 +962,7 @@ COM_CheckParm
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
int COM_CheckParm( char *parm, char **ppnext )
|
int GAME_EXPORT COM_CheckParm( char *parm, char **ppnext )
|
||||||
{
|
{
|
||||||
int i = Sys_CheckParm( parm );
|
int i = Sys_CheckParm( parm );
|
||||||
|
|
||||||
@@ -1110,7 +982,7 @@ pfnTime
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
float pfnTime( void )
|
float GAME_EXPORT pfnTime( void )
|
||||||
{
|
{
|
||||||
return (float)Sys_DoubleTime();
|
return (float)Sys_DoubleTime();
|
||||||
}
|
}
|
||||||
@@ -1121,7 +993,7 @@ pfnGetGameDir
|
|||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
void pfnGetGameDir( char *szGetGameDir )
|
void GAME_EXPORT pfnGetGameDir( char *szGetGameDir )
|
||||||
{
|
{
|
||||||
if( !szGetGameDir ) return;
|
if( !szGetGameDir ) return;
|
||||||
Q_strcpy( szGetGameDir, GI->gamefolder );
|
Q_strcpy( szGetGameDir, GI->gamefolder );
|
||||||
@@ -1142,7 +1014,7 @@ qboolean COM_IsSafeFileToDownload( const char *filename )
|
|||||||
|
|
||||||
Q_strnlwr( filename, lwrfilename, sizeof( lwrfilename ));
|
Q_strnlwr( filename, lwrfilename, sizeof( lwrfilename ));
|
||||||
|
|
||||||
if( Q_strstr( lwrfilename, "\\" ) || Q_strstr( lwrfilename, ":" ) || Q_strstr( lwrfilename, ".." ) || Q_strstr( lwrfilename, "~" ))
|
if( Q_strpbrk( lwrfilename, "\\:~" ) || Q_strstr( lwrfilename, ".." ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( lwrfilename[0] == '/' )
|
if( lwrfilename[0] == '/' )
|
||||||
@@ -1171,7 +1043,7 @@ qboolean COM_IsSafeFileToDownload( const char *filename )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *_copystring( byte *mempool, const char *s, const char *filename, int fileline )
|
char *_copystring( poolhandle_t mempool, const char *s, const char *filename, int fileline )
|
||||||
{
|
{
|
||||||
char *b;
|
char *b;
|
||||||
|
|
||||||
@@ -1290,3 +1162,35 @@ only exists in PlayStation version
|
|||||||
void GAME_EXPORT pfnResetTutorMessageDecayData( void )
|
void GAME_EXPORT pfnResetTutorMessageDecayData( void )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
|
void Test_RunCommon( void )
|
||||||
|
{
|
||||||
|
char *file = (char *)"q asdf \"qwerty\" \"f \\\"f\" meowmeow\n// comment \"stuff ignored\"\nbark";
|
||||||
|
int len;
|
||||||
|
char buf[5];
|
||||||
|
|
||||||
|
Msg( "Checking COM_ParseFile...\n" );
|
||||||
|
|
||||||
|
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||||
|
TASSERT( !Q_strcmp( buf, "q" ) && len == 1);
|
||||||
|
|
||||||
|
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||||
|
TASSERT( !Q_strcmp( buf, "asdf" ) && len == 4);
|
||||||
|
|
||||||
|
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||||
|
TASSERT( !Q_strcmp( buf, "qwer" ) && len == -1);
|
||||||
|
|
||||||
|
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||||
|
TASSERT( !Q_strcmp( buf, "f \"f" ) && len == 4);
|
||||||
|
|
||||||
|
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||||
|
TASSERT( !Q_strcmp( buf, "meow" ) && len == -1);
|
||||||
|
|
||||||
|
file = _COM_ParseFileSafe( file, buf, sizeof( buf ), 0, &len );
|
||||||
|
TASSERT( !Q_strcmp( buf, "bark" ) && len == 4);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
+33
-28
@@ -138,16 +138,16 @@ typedef enum
|
|||||||
|
|
||||||
#define CIN_MAIN 0
|
#define CIN_MAIN 0
|
||||||
#define CIN_LOGO 1
|
#define CIN_LOGO 1
|
||||||
|
|
||||||
#if XASH_LOW_MEMORY == 0
|
#if XASH_LOW_MEMORY == 0
|
||||||
#define MAX_DECALS 512 // touching TE_DECAL messages, etc
|
#define MAX_DECALS 512 // touching TE_DECAL messages, etc
|
||||||
#define MAX_STATIC_ENTITIES 3096 // static entities that moved on the client when level is spawn
|
#define MAX_STATIC_ENTITIES 3096 // static entities that moved on the client when level is spawn
|
||||||
|
|
||||||
#elif XASH_LOW_MEMORY == 2
|
|
||||||
#define MAX_DECALS 256 // touching TE_DECAL messages, etc
|
|
||||||
#define MAX_STATIC_ENTITIES 32 // static entities that moved on the client when level is spawn
|
|
||||||
#elif XASH_LOW_MEMORY == 1
|
#elif XASH_LOW_MEMORY == 1
|
||||||
#define MAX_DECALS 512 // touching TE_DECAL messages, etc
|
#define MAX_DECALS 512 // touching TE_DECAL messages, etc
|
||||||
#define MAX_STATIC_ENTITIES 128 // static entities that moved on the client when level is spawn
|
#define MAX_STATIC_ENTITIES 128 // static entities that moved on the client when level is spawn
|
||||||
|
#elif XASH_LOW_MEMORY == 2
|
||||||
|
#define MAX_DECALS 256 // touching TE_DECAL messages, etc
|
||||||
|
#define MAX_STATIC_ENTITIES 32 // static entities that moved on the client when level is spawn
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// filesystem flags
|
// filesystem flags
|
||||||
@@ -325,11 +325,12 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct host_redirect_s
|
typedef struct host_redirect_s
|
||||||
{
|
{
|
||||||
rdtype_t target;
|
rdtype_t target;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int buffersize;
|
size_t buffersize;
|
||||||
netadr_t address;
|
netadr_t address;
|
||||||
void (*flush)( netadr_t adr, rdtype_t target, char *buffer );
|
void (*flush)( netadr_t adr, rdtype_t target, char *buffer );
|
||||||
|
int lines;
|
||||||
} host_redirect_t;
|
} host_redirect_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@@ -391,7 +392,7 @@ typedef struct host_parm_s
|
|||||||
uint type; // running at
|
uint type; // running at
|
||||||
jmp_buf abortframe; // abort current frame
|
jmp_buf abortframe; // abort current frame
|
||||||
dword errorframe; // to prevent multiple host error
|
dword errorframe; // to prevent multiple host error
|
||||||
byte *mempool; // static mempool for misc allocations
|
poolhandle_t mempool; // static mempool for misc allocations
|
||||||
string finalmsg; // server shutdown final message
|
string finalmsg; // server shutdown final message
|
||||||
string downloadfile; // filename to be downloading
|
string downloadfile; // filename to be downloading
|
||||||
int downloadcount; // how many files remain to downloading
|
int downloadcount; // how many files remain to downloading
|
||||||
@@ -421,8 +422,6 @@ typedef struct host_parm_s
|
|||||||
qboolean stuffcmds_pending; // should execute stuff commands
|
qboolean stuffcmds_pending; // should execute stuff commands
|
||||||
qboolean allow_cheats; // this host will allow cheating
|
qboolean allow_cheats; // this host will allow cheating
|
||||||
qboolean con_showalways; // show console always (developer and dedicated)
|
qboolean con_showalways; // show console always (developer and dedicated)
|
||||||
qboolean com_handlecolon; // allow COM_ParseFile to handle colon as single char
|
|
||||||
qboolean com_ignorebracket; // allow COM_ParseFile to ignore () as single char
|
|
||||||
qboolean change_game; // initialize when game is changed
|
qboolean change_game; // initialize when game is changed
|
||||||
qboolean mouse_visible; // vgui override cursor control
|
qboolean mouse_visible; // vgui override cursor control
|
||||||
qboolean shutdown_issued; // engine is shutting down
|
qboolean shutdown_issued; // engine is shutting down
|
||||||
@@ -445,8 +444,8 @@ typedef struct host_parm_s
|
|||||||
char rootdir[MAX_OSPATH]; // member root directory
|
char rootdir[MAX_OSPATH]; // member root directory
|
||||||
char rodir[MAX_OSPATH]; // readonly root
|
char rodir[MAX_OSPATH]; // readonly root
|
||||||
char gamefolder[MAX_QPATH]; // it's a default gamefolder
|
char gamefolder[MAX_QPATH]; // it's a default gamefolder
|
||||||
byte *imagepool; // imagelib mempool
|
poolhandle_t imagepool; // imagelib mempool
|
||||||
byte *soundpool; // soundlib mempool
|
poolhandle_t soundpool; // soundlib mempool
|
||||||
|
|
||||||
uint features; // custom features that enables by mod-maker request
|
uint features; // custom features that enables by mod-maker request
|
||||||
|
|
||||||
@@ -493,25 +492,26 @@ int Cmd_AddRefCommand( const char *cmd_name, xcommand_t function, const char *de
|
|||||||
void Cmd_RemoveCommand( const char *cmd_name );
|
void Cmd_RemoveCommand( const char *cmd_name );
|
||||||
qboolean Cmd_Exists( const char *cmd_name );
|
qboolean Cmd_Exists( const char *cmd_name );
|
||||||
void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback );
|
void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback );
|
||||||
|
int Cmd_ListMaps( search_t *t , char *lastmapname, size_t len );
|
||||||
qboolean Cmd_GetMapList( const char *s, char *completedname, int length );
|
qboolean Cmd_GetMapList( const char *s, char *completedname, int length );
|
||||||
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length );
|
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length );
|
||||||
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
|
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
|
||||||
void Cmd_TokenizeString( char *text );
|
void Cmd_TokenizeString( const char *text );
|
||||||
void Cmd_ExecuteString( char *text );
|
void Cmd_ExecuteString( const char *text );
|
||||||
void Cmd_ForwardToServer( void );
|
void Cmd_ForwardToServer( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// zone.c
|
// zone.c
|
||||||
//
|
//
|
||||||
void Memory_Init( void );
|
void Memory_Init( void );
|
||||||
void *_Mem_Realloc( byte *poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline );
|
void *_Mem_Realloc( poolhandle_t poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline );
|
||||||
void *_Mem_Alloc( byte *poolptr, size_t size, qboolean clear, const char *filename, int fileline );
|
void *_Mem_Alloc( poolhandle_t poolptr, size_t size, qboolean clear, const char *filename, int fileline );
|
||||||
byte *_Mem_AllocPool( const char *name, const char *filename, int fileline );
|
poolhandle_t _Mem_AllocPool( const char *name, const char *filename, int fileline );
|
||||||
void _Mem_FreePool( byte **poolptr, const char *filename, int fileline );
|
void _Mem_FreePool( poolhandle_t *poolptr, const char *filename, int fileline );
|
||||||
void _Mem_EmptyPool( byte *poolptr, const char *filename, int fileline );
|
void _Mem_EmptyPool( poolhandle_t poolptr, const char *filename, int fileline );
|
||||||
void _Mem_Free( void *data, const char *filename, int fileline );
|
void _Mem_Free( void *data, const char *filename, int fileline );
|
||||||
void _Mem_Check( const char *filename, int fileline );
|
void _Mem_Check( const char *filename, int fileline );
|
||||||
qboolean Mem_IsAllocatedExt( byte *poolptr, void *data );
|
qboolean Mem_IsAllocatedExt( poolhandle_t poolptr, void *data );
|
||||||
void Mem_PrintList( size_t minallocationsize );
|
void Mem_PrintList( size_t minallocationsize );
|
||||||
void Mem_PrintStats( void );
|
void Mem_PrintStats( void );
|
||||||
|
|
||||||
@@ -564,6 +564,7 @@ int FS_FileTime( const char *filename, qboolean gamedironly );
|
|||||||
int FS_Print( file_t *file, const char *msg );
|
int FS_Print( file_t *file, const char *msg );
|
||||||
qboolean FS_Rename( const char *oldname, const char *newname );
|
qboolean FS_Rename( const char *oldname, const char *newname );
|
||||||
int FS_FileExists( const char *filename, int gamedironly );
|
int FS_FileExists( const char *filename, int gamedironly );
|
||||||
|
int FS_SetCurrentDirectory( const char *path );
|
||||||
qboolean FS_SysFileExists( const char *path, qboolean casesensitive );
|
qboolean FS_SysFileExists( const char *path, qboolean casesensitive );
|
||||||
qboolean FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize );
|
qboolean FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize );
|
||||||
qboolean FS_Delete( const char *path );
|
qboolean FS_Delete( const char *path );
|
||||||
@@ -579,6 +580,7 @@ fs_offset_t FS_FileLength( file_t *f );
|
|||||||
//
|
//
|
||||||
#include "com_image.h"
|
#include "com_image.h"
|
||||||
|
|
||||||
|
void Image_Setup( void );
|
||||||
void Image_Init( void );
|
void Image_Init( void );
|
||||||
void Image_Shutdown( void );
|
void Image_Shutdown( void );
|
||||||
void Image_AddCmdFlags( uint flags );
|
void Image_AddCmdFlags( uint flags );
|
||||||
@@ -674,8 +676,11 @@ const char *Q_buildcommit( void );
|
|||||||
//
|
//
|
||||||
// host.c
|
// host.c
|
||||||
//
|
//
|
||||||
|
typedef void( *pfnChangeGame )( const char *progname );
|
||||||
|
|
||||||
qboolean Host_IsQuakeCompatible( void );
|
qboolean Host_IsQuakeCompatible( void );
|
||||||
void EXPORT Host_Shutdown( void );
|
void EXPORT Host_Shutdown( void );
|
||||||
|
int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGame, pfnChangeGame func );
|
||||||
int Host_CompareFileTime( int ft1, int ft2 );
|
int Host_CompareFileTime( int ft1, int ft2 );
|
||||||
void Host_NewInstance( const char *name, const char *finalmsg );
|
void Host_NewInstance( const char *name, const char *finalmsg );
|
||||||
void Host_EndGame( qboolean abort, const char *message, ... ) _format( 2 );
|
void Host_EndGame( qboolean abort, const char *message, ... ) _format( 2 );
|
||||||
@@ -742,7 +747,7 @@ cvar_t *pfnCVarGetPointer( const char *szVarName );
|
|||||||
int pfnDrawConsoleString( int x, int y, char *string );
|
int pfnDrawConsoleString( int x, int y, char *string );
|
||||||
void pfnDrawSetTextColor( float r, float g, float b );
|
void pfnDrawSetTextColor( float r, float g, float b );
|
||||||
void pfnDrawConsoleStringLen( const char *pText, int *length, int *height );
|
void pfnDrawConsoleStringLen( const char *pText, int *length, int *height );
|
||||||
void *Cache_Check( byte *mempool, struct cache_user_s *c );
|
void *Cache_Check( poolhandle_t mempool, struct cache_user_s *c );
|
||||||
void COM_TrimSpace( const char *source, char *dest );
|
void COM_TrimSpace( const char *source, char *dest );
|
||||||
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
|
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
|
||||||
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
||||||
@@ -761,7 +766,7 @@ float pfnTime( void );
|
|||||||
#define copystring( s ) _copystring( host.mempool, s, __FILE__, __LINE__ )
|
#define copystring( s ) _copystring( host.mempool, s, __FILE__, __LINE__ )
|
||||||
#define SV_CopyString( s ) _copystring( svgame.stringspool, s, __FILE__, __LINE__ )
|
#define SV_CopyString( s ) _copystring( svgame.stringspool, s, __FILE__, __LINE__ )
|
||||||
#define freestring( s ) if( s != NULL ) { Mem_Free( s ); s = NULL; }
|
#define freestring( s ) if( s != NULL ) { Mem_Free( s ); s = NULL; }
|
||||||
char *_copystring( byte *mempool, const char *s, const char *filename, int fileline );
|
char *_copystring( poolhandle_t mempool, const char *s, const char *filename, int fileline );
|
||||||
|
|
||||||
// CS:CS engfuncs (stubs)
|
// CS:CS engfuncs (stubs)
|
||||||
void *pfnSequenceGet( const char *fileName, const char *entryName );
|
void *pfnSequenceGet( const char *fileName, const char *entryName );
|
||||||
@@ -847,7 +852,6 @@ void CL_LegacyUpdateInfo( void );
|
|||||||
void CL_CharEvent( int key );
|
void CL_CharEvent( int key );
|
||||||
qboolean CL_DisableVisibility( void );
|
qboolean CL_DisableVisibility( void );
|
||||||
int CL_PointContents( const vec3_t point );
|
int CL_PointContents( const vec3_t point );
|
||||||
char *COM_ParseFile( char *data, char *token );
|
|
||||||
byte *COM_LoadFile( const char *filename, int usehunk, int *pLength );
|
byte *COM_LoadFile( const char *filename, int usehunk, int *pLength );
|
||||||
int CL_GetDemoComment( const char *demoname, char *comment );
|
int CL_GetDemoComment( const char *demoname, char *comment );
|
||||||
void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName );
|
void COM_AddAppDirectoryToSearchPath( const char *pszBaseDir, const char *appName );
|
||||||
@@ -855,7 +859,7 @@ int COM_ExpandFilename( const char *fileName, char *nameOutBuffer, int nameOutBu
|
|||||||
struct cmd_s *Cmd_GetFirstFunctionHandle( void );
|
struct cmd_s *Cmd_GetFirstFunctionHandle( void );
|
||||||
struct cmd_s *Cmd_GetNextFunctionHandle( struct cmd_s *cmd );
|
struct cmd_s *Cmd_GetNextFunctionHandle( struct cmd_s *cmd );
|
||||||
struct cmdalias_s *Cmd_AliasGetList( void );
|
struct cmdalias_s *Cmd_AliasGetList( void );
|
||||||
char *Cmd_GetName( struct cmd_s *cmd );
|
const char *Cmd_GetName( struct cmd_s *cmd );
|
||||||
struct pmtrace_s *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
struct pmtrace_s *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||||
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
|
||||||
void SV_StartMusic( const char *curtrack, const char *looptrack, int position );
|
void SV_StartMusic( const char *curtrack, const char *looptrack, int position );
|
||||||
@@ -863,14 +867,14 @@ void SV_CreateDecal( sizebuf_t *msg, const float *origin, int decalIndex, int en
|
|||||||
void Log_Printf( const char *fmt, ... ) _format( 1 );
|
void Log_Printf( const char *fmt, ... ) _format( 1 );
|
||||||
void SV_BroadcastCommand( const char *fmt, ... ) _format( 1 );
|
void SV_BroadcastCommand( const char *fmt, ... ) _format( 1 );
|
||||||
qboolean SV_RestoreCustomDecal( struct decallist_s *entry, edict_t *pEdict, qboolean adjacent );
|
qboolean SV_RestoreCustomDecal( struct decallist_s *entry, edict_t *pEdict, qboolean adjacent );
|
||||||
void SV_BroadcastPrintf( struct sv_client_s *ignore, char *fmt, ... ) _format( 2 );
|
void SV_BroadcastPrintf( struct sv_client_s *ignore, const char *fmt, ... ) _format( 2 );
|
||||||
int R_CreateDecalList( struct decallist_s *pList );
|
int R_CreateDecalList( struct decallist_s *pList );
|
||||||
void R_ClearAllDecals( void );
|
void R_ClearAllDecals( void );
|
||||||
void CL_ClearStaticEntities( void );
|
void CL_ClearStaticEntities( void );
|
||||||
qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *position );
|
qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *position );
|
||||||
struct cl_entity_s *CL_GetEntityByIndex( int index );
|
struct cl_entity_s *CL_GetEntityByIndex( int index );
|
||||||
struct player_info_s *CL_GetPlayerInfo( int playerIndex );
|
struct player_info_s *CL_GetPlayerInfo( int playerIndex );
|
||||||
void CL_ServerCommand( qboolean reliable, char *fmt, ... ) _format( 2 );
|
void CL_ServerCommand( qboolean reliable, const char *fmt, ... ) _format( 2 );
|
||||||
void CL_HudMessage( const char *pMessage );
|
void CL_HudMessage( const char *pMessage );
|
||||||
const char *CL_MsgInfo( int cmd );
|
const char *CL_MsgInfo( int cmd );
|
||||||
void SV_DrawDebugTriangles( void );
|
void SV_DrawDebugTriangles( void );
|
||||||
@@ -944,6 +948,7 @@ void VID_Init( void );
|
|||||||
void UI_SetActiveMenu( qboolean fActive );
|
void UI_SetActiveMenu( qboolean fActive );
|
||||||
void UI_ShowConnectionWarning( void );
|
void UI_ShowConnectionWarning( void );
|
||||||
void Cmd_Null_f( void );
|
void Cmd_Null_f( void );
|
||||||
|
void Rcon_Print( const char *pMsg );
|
||||||
|
|
||||||
// soundlib shared exports
|
// soundlib shared exports
|
||||||
qboolean S_Init( void );
|
qboolean S_Init( void );
|
||||||
|
|||||||
+72
-44
@@ -51,26 +51,16 @@ static con_autocomplete_t con;
|
|||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
=====================================
|
=====================================
|
||||||
Cmd_GetMapList
|
Cmd_ListMaps
|
||||||
|
|
||||||
Prints or complete map filename
|
|
||||||
=====================================
|
=====================================
|
||||||
*/
|
*/
|
||||||
qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
int Cmd_ListMaps( search_t *t, char *lastmapname, size_t len )
|
||||||
{
|
{
|
||||||
search_t *t;
|
byte buf[MAX_SYSPATH]; // 1 kb
|
||||||
file_t *f;
|
file_t *f;
|
||||||
string message, compiler, generator, matchbuf;
|
int i, nummaps;
|
||||||
byte buf[MAX_SYSPATH]; // 1 kb
|
string mapname, message, compiler, generator;
|
||||||
int i, nummaps;
|
|
||||||
|
|
||||||
t = FS_Search( va( "maps/%s*.bsp", s ), true, con_gamemaps->value );
|
|
||||||
if( !t ) return false;
|
|
||||||
|
|
||||||
COM_FileBase( t->filenames[0], matchbuf );
|
|
||||||
if( completedname && length )
|
|
||||||
Q_strncpy( completedname, matchbuf, length );
|
|
||||||
if( t->numfilenames == 1 ) return true;
|
|
||||||
|
|
||||||
for( i = 0, nummaps = 0; i < t->numfilenames; i++ )
|
for( i = 0, nummaps = 0; i < t->numfilenames; i++ )
|
||||||
{
|
{
|
||||||
@@ -78,15 +68,14 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
|||||||
const char *ext = COM_FileExtension( t->filenames[i] );
|
const char *ext = COM_FileExtension( t->filenames[i] );
|
||||||
int ver = -1, lumpofs = 0, lumplen = 0;
|
int ver = -1, lumpofs = 0, lumplen = 0;
|
||||||
char *ents = NULL, *pfile;
|
char *ents = NULL, *pfile;
|
||||||
qboolean validmap = false;
|
|
||||||
int version = 0;
|
int version = 0;
|
||||||
char *szBuf;
|
|
||||||
string version_description;
|
string version_description;
|
||||||
|
|
||||||
if( Q_stricmp( ext, "bsp" )) continue;
|
if( Q_stricmp( ext, "bsp" )) continue;
|
||||||
Q_strncpy( message, "^1error^7", sizeof( message ));
|
Q_strncpy( message, "^1error^7", sizeof( message ));
|
||||||
Q_strncpy( compiler, "", sizeof( compiler ));
|
compiler[0] = '\0';
|
||||||
Q_strncpy( generator, "", sizeof( generator ));
|
generator[0] = '\0';
|
||||||
|
|
||||||
f = FS_Open( t->filenames[i], "rb", con_gamemaps->value );
|
f = FS_Open( t->filenames[i], "rb", con_gamemaps->value );
|
||||||
|
|
||||||
if( f )
|
if( f )
|
||||||
@@ -131,24 +120,24 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
|||||||
message[0] = 0; // remove 'error'
|
message[0] = 0; // remove 'error'
|
||||||
pfile = ents;
|
pfile = ents;
|
||||||
|
|
||||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
||||||
{
|
{
|
||||||
if( !Q_strcmp( token, "{" )) continue;
|
if( !Q_strcmp( token, "{" )) continue;
|
||||||
else if( !Q_strcmp( token, "}" )) break;
|
else if( !Q_strcmp( token, "}" )) break;
|
||||||
else if( !Q_strcmp( token, "message" ))
|
else if( !Q_strcmp( token, "message" ))
|
||||||
{
|
{
|
||||||
// get the message contents
|
// get the message contents
|
||||||
pfile = COM_ParseFile( pfile, message );
|
pfile = COM_ParseFile( pfile, message, sizeof( message ));
|
||||||
}
|
}
|
||||||
else if( !Q_strcmp( token, "compiler" ) || !Q_strcmp( token, "_compiler" ))
|
else if( !Q_strcmp( token, "compiler" ) || !Q_strcmp( token, "_compiler" ))
|
||||||
{
|
{
|
||||||
// get the message contents
|
// get the message contents
|
||||||
pfile = COM_ParseFile( pfile, compiler );
|
pfile = COM_ParseFile( pfile, compiler, sizeof( compiler ));
|
||||||
}
|
}
|
||||||
else if( !Q_strcmp( token, "generator" ) || !Q_strcmp( token, "_generator" ))
|
else if( !Q_strcmp( token, "generator" ) || !Q_strcmp( token, "_generator" ))
|
||||||
{
|
{
|
||||||
// get the message contents
|
// get the message contents
|
||||||
pfile = COM_ParseFile( pfile, generator );
|
pfile = COM_ParseFile( pfile, generator, sizeof( generator ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Mem_Free( ents );
|
Mem_Free( ents );
|
||||||
@@ -156,7 +145,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( f ) FS_Close(f);
|
if( f ) FS_Close(f);
|
||||||
COM_FileBase( t->filenames[i], matchbuf );
|
COM_FileBase( t->filenames[i], mapname );
|
||||||
|
|
||||||
switch( ver )
|
switch( ver )
|
||||||
{
|
{
|
||||||
@@ -178,11 +167,41 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
|||||||
default: Q_strncpy( version_description, "??", sizeof( version_description )); break;
|
default: Q_strncpy( version_description, "??", sizeof( version_description )); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Printf( "%16s (%s) ^3%s^7 ^2%s %s^7\n", matchbuf, version_description, message, compiler, generator );
|
Con_Printf( "%16s (%s) ^3%s^7 ^2%s %s^7\n", mapname, version_description, message, compiler, generator );
|
||||||
nummaps++;
|
nummaps++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Printf( "\n^3 %i maps found.\n", nummaps );
|
if( lastmapname && len )
|
||||||
|
Q_strncpy( lastmapname, mapname, len );
|
||||||
|
|
||||||
|
return nummaps;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=====================================
|
||||||
|
Cmd_GetMapList
|
||||||
|
|
||||||
|
Prints or complete map filename
|
||||||
|
=====================================
|
||||||
|
*/
|
||||||
|
qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
|
||||||
|
{
|
||||||
|
search_t *t;
|
||||||
|
string matchbuf;
|
||||||
|
int i, nummaps;
|
||||||
|
|
||||||
|
t = FS_Search( va( "maps/%s*.bsp", s ), true, con_gamemaps->value );
|
||||||
|
if( !t ) return false;
|
||||||
|
|
||||||
|
COM_FileBase( t->filenames[0], matchbuf );
|
||||||
|
if( completedname && length )
|
||||||
|
Q_strncpy( completedname, matchbuf, length );
|
||||||
|
if( t->numfilenames == 1 ) return true;
|
||||||
|
|
||||||
|
nummaps = Cmd_ListMaps( t, matchbuf, sizeof( matchbuf ));
|
||||||
|
|
||||||
|
Con_Printf( "\n^3 %d maps found.\n", nummaps );
|
||||||
|
|
||||||
Mem_Free( t );
|
Mem_Free( t );
|
||||||
|
|
||||||
// cut shortestMatch to the amount common with s
|
// cut shortestMatch to the amount common with s
|
||||||
@@ -446,7 +465,7 @@ qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
|
|||||||
t = FS_Search( va( "%s%s*.*", DEFAULT_SOUNDPATH, s ), true, false );
|
t = FS_Search( va( "%s%s*.*", DEFAULT_SOUNDPATH, s ), true, false );
|
||||||
if( !t ) return false;
|
if( !t ) return false;
|
||||||
|
|
||||||
Q_strncpy( matchbuf, t->filenames[0] + Q_strlen( DEFAULT_SOUNDPATH ), MAX_STRING );
|
Q_strncpy( matchbuf, t->filenames[0] + sizeof( DEFAULT_SOUNDPATH ) - 1, MAX_STRING );
|
||||||
COM_StripExtension( matchbuf );
|
COM_StripExtension( matchbuf );
|
||||||
if( completedname && length )
|
if( completedname && length )
|
||||||
Q_strncpy( completedname, matchbuf, length );
|
Q_strncpy( completedname, matchbuf, length );
|
||||||
@@ -459,7 +478,7 @@ qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
|
|||||||
if( Q_stricmp( ext, "wav" ) && Q_stricmp( ext, "mp3" ))
|
if( Q_stricmp( ext, "wav" ) && Q_stricmp( ext, "mp3" ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Q_strncpy( matchbuf, t->filenames[i] + Q_strlen( DEFAULT_SOUNDPATH ), MAX_STRING );
|
Q_strncpy( matchbuf, t->filenames[i] + sizeof( DEFAULT_SOUNDPATH ) - 1, MAX_STRING );
|
||||||
COM_StripExtension( matchbuf );
|
COM_StripExtension( matchbuf );
|
||||||
Con_Printf( "%16s\n", matchbuf );
|
Con_Printf( "%16s\n", matchbuf );
|
||||||
numsounds++;
|
numsounds++;
|
||||||
@@ -541,13 +560,16 @@ qboolean Cmd_GetKeysList( const char *s, char *completedname, int length )
|
|||||||
size_t i, numkeys;
|
size_t i, numkeys;
|
||||||
string keys[256];
|
string keys[256];
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
|
int len;
|
||||||
|
|
||||||
// compare keys list with current keyword
|
// compare keys list with current keyword
|
||||||
|
len = Q_strlen( s );
|
||||||
|
|
||||||
for( i = 0, numkeys = 0; i < 255; i++ )
|
for( i = 0, numkeys = 0; i < 255; i++ )
|
||||||
{
|
{
|
||||||
const char *keyname = Key_KeynumToString( i );
|
const char *keyname = Key_KeynumToString( i );
|
||||||
|
|
||||||
if(( *s == '*' ) || !Q_strnicmp( keyname, s, Q_strlen( s )))
|
if(( *s == '*' ) || !Q_strnicmp( keyname, s, len))
|
||||||
Q_strcpy( keys[numkeys++], keyname );
|
Q_strcpy( keys[numkeys++], keyname );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,7 +650,7 @@ qboolean Cmd_GetCommandsList( const char *s, char *completedname, int length )
|
|||||||
while( *list.completionString && (*list.completionString == '\\' || *list.completionString == '/') )
|
while( *list.completionString && (*list.completionString == '\\' || *list.completionString == '/') )
|
||||||
list.completionString++;
|
list.completionString++;
|
||||||
|
|
||||||
if( !Q_strlen( list.completionString ) )
|
if( !COM_CheckStringEmpty( list.completionString ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// find matching commands and variables
|
// find matching commands and variables
|
||||||
@@ -730,15 +752,18 @@ qboolean Cmd_GetGamesList( const char *s, char *completedname, int length )
|
|||||||
int i, numgamedirs;
|
int i, numgamedirs;
|
||||||
string gamedirs[MAX_MODS];
|
string gamedirs[MAX_MODS];
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
|
int len;
|
||||||
|
|
||||||
// stand-alone games doesn't have cmd "game"
|
// stand-alone games doesn't have cmd "game"
|
||||||
if( !Cmd_Exists( "game" ))
|
if( !Cmd_Exists( "game" ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// compare gamelist with current keyword
|
// compare gamelist with current keyword
|
||||||
|
len = Q_strlen( s );
|
||||||
|
|
||||||
for( i = 0, numgamedirs = 0; i < SI.numgames; i++ )
|
for( i = 0, numgamedirs = 0; i < SI.numgames; i++ )
|
||||||
{
|
{
|
||||||
if(( *s == '*' ) || !Q_strnicmp( SI.games[i]->gamefolder, s, Q_strlen( s )))
|
if(( *s == '*' ) || !Q_strnicmp( SI.games[i]->gamefolder, s, len))
|
||||||
Q_strcpy( gamedirs[numgamedirs++], SI.games[i]->gamefolder );
|
Q_strcpy( gamedirs[numgamedirs++], SI.games[i]->gamefolder );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -780,6 +805,7 @@ qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
|
|||||||
int i, numcdcommands;
|
int i, numcdcommands;
|
||||||
string cdcommands[8];
|
string cdcommands[8];
|
||||||
string matchbuf;
|
string matchbuf;
|
||||||
|
int len;
|
||||||
|
|
||||||
const char *cd_command[] =
|
const char *cd_command[] =
|
||||||
{
|
{
|
||||||
@@ -794,9 +820,11 @@ qboolean Cmd_GetCDList( const char *s, char *completedname, int length )
|
|||||||
};
|
};
|
||||||
|
|
||||||
// compare CD command list with current keyword
|
// compare CD command list with current keyword
|
||||||
|
len = Q_strlen( s );
|
||||||
|
|
||||||
for( i = 0, numcdcommands = 0; i < 8; i++ )
|
for( i = 0, numcdcommands = 0; i < 8; i++ )
|
||||||
{
|
{
|
||||||
if(( *s == '*' ) || !Q_strnicmp( cd_command[i], s, Q_strlen( s )))
|
if(( *s == '*' ) || !Q_strnicmp( cd_command[i], s, len))
|
||||||
Q_strcpy( cdcommands[numcdcommands++], cd_command[i] );
|
Q_strcpy( cdcommands[numcdcommands++], cd_command[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -841,7 +869,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||||||
return true; // exist
|
return true; // exist
|
||||||
|
|
||||||
// setup mpfilter
|
// setup mpfilter
|
||||||
Q_snprintf( mpfilter, sizeof( mpfilter ), "maps/%s", GI->mp_filter );
|
size = Q_snprintf( mpfilter, sizeof( mpfilter ), "maps/%s", GI->mp_filter );
|
||||||
t = FS_Search( "maps/*.bsp", false, onlyingamedir );
|
t = FS_Search( "maps/*.bsp", false, onlyingamedir );
|
||||||
|
|
||||||
if( !t )
|
if( !t )
|
||||||
@@ -855,7 +883,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||||||
}
|
}
|
||||||
|
|
||||||
buffer = Mem_Calloc( host.mempool, t->numfilenames * 2 * sizeof( result ));
|
buffer = Mem_Calloc( host.mempool, t->numfilenames * 2 * sizeof( result ));
|
||||||
use_filter = Q_strlen( GI->mp_filter ) ? true : false;
|
use_filter = COM_CheckStringEmpty( GI->mp_filter ) ? true : false;
|
||||||
|
|
||||||
for( i = 0; i < t->numfilenames; i++ )
|
for( i = 0; i < t->numfilenames; i++ )
|
||||||
{
|
{
|
||||||
@@ -866,7 +894,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||||||
if( Q_stricmp( COM_FileExtension( t->filenames[i] ), "bsp" ))
|
if( Q_stricmp( COM_FileExtension( t->filenames[i] ), "bsp" ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( use_filter && !Q_strnicmp( t->filenames[i], mpfilter, Q_strlen( mpfilter )))
|
if( use_filter && Q_stristr( t->filenames[i], mpfilter ))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
f = FS_Open( t->filenames[i], "rb", onlyingamedir );
|
f = FS_Open( t->filenames[i], "rb", onlyingamedir );
|
||||||
@@ -914,18 +942,18 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||||||
Q_strncpy( message, "No Title", MAX_STRING );
|
Q_strncpy( message, "No Title", MAX_STRING );
|
||||||
pfile = ents;
|
pfile = ents;
|
||||||
|
|
||||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
||||||
{
|
{
|
||||||
if( token[0] == '}' && worldspawn )
|
if( token[0] == '}' && worldspawn )
|
||||||
worldspawn = false;
|
worldspawn = false;
|
||||||
else if( !Q_strcmp( token, "message" ) && worldspawn )
|
else if( !Q_strcmp( token, "message" ) && worldspawn )
|
||||||
{
|
{
|
||||||
// get the message contents
|
// get the message contents
|
||||||
pfile = COM_ParseFile( pfile, message );
|
pfile = COM_ParseFile( pfile, message, sizeof( message ));
|
||||||
}
|
}
|
||||||
else if( !Q_strcmp( token, "classname" ))
|
else if( !Q_strcmp( token, "classname" ))
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ));
|
||||||
if( !Q_strcmp( token, GI->mp_entity ) || use_filter )
|
if( !Q_strcmp( token, GI->mp_entity ) || use_filter )
|
||||||
num_spawnpoints++;
|
num_spawnpoints++;
|
||||||
}
|
}
|
||||||
@@ -958,7 +986,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write generated maps.lst
|
// write generated maps.lst
|
||||||
if( FS_WriteFile( "maps.lst", buffer, Q_strlen( buffer )))
|
if( FS_WriteFile( "maps.lst", buffer, size))
|
||||||
{
|
{
|
||||||
if( buffer ) Mem_Free( buffer );
|
if( buffer ) Mem_Free( buffer );
|
||||||
return true;
|
return true;
|
||||||
@@ -966,7 +994,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Cmd_CheckMapsList( int fRefresh )
|
int GAME_EXPORT Cmd_CheckMapsList( int fRefresh )
|
||||||
{
|
{
|
||||||
return Cmd_CheckMapsList_R( fRefresh, true );
|
return Cmd_CheckMapsList_R( fRefresh, true );
|
||||||
}
|
}
|
||||||
@@ -1133,7 +1161,7 @@ void Con_CompleteCommand( field_t *field )
|
|||||||
while( *con.completionString && (*con.completionString == '\\' || *con.completionString == '/') )
|
while( *con.completionString && (*con.completionString == '\\' || *con.completionString == '/') )
|
||||||
con.completionString++;
|
con.completionString++;
|
||||||
|
|
||||||
if( !Q_strlen( con.completionString ) )
|
if( !COM_CheckStringEmpty( con.completionString ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// free the old autocomplete list
|
// free the old autocomplete list
|
||||||
@@ -1166,7 +1194,7 @@ void Con_CompleteCommand( field_t *field )
|
|||||||
while( *con.completionBuffer && (*con.completionBuffer == '\\' || *con.completionBuffer == '/') )
|
while( *con.completionBuffer && (*con.completionBuffer == '\\' || *con.completionBuffer == '/') )
|
||||||
con.completionBuffer++;
|
con.completionBuffer++;
|
||||||
|
|
||||||
if( !Q_strlen( con.completionBuffer ) )
|
if( !COM_CheckStringEmpty( con.completionBuffer ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( Cmd_AutocompleteName( con.completionBuffer, Cmd_Argc() - 1, filename, sizeof( filename ) ) )
|
if( Cmd_AutocompleteName( con.completionBuffer, Cmd_Argc() - 1, filename, sizeof( filename ) ) )
|
||||||
@@ -1386,7 +1414,7 @@ Host_WriteServerConfig
|
|||||||
save serverinfo variables into server.cfg (using for dedicated server too)
|
save serverinfo variables into server.cfg (using for dedicated server too)
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
void Host_WriteServerConfig( const char *name )
|
void GAME_EXPORT Host_WriteServerConfig( const char *name )
|
||||||
{
|
{
|
||||||
file_t *f;
|
file_t *f;
|
||||||
string newconfigfile;
|
string newconfigfile;
|
||||||
|
|||||||
@@ -243,6 +243,24 @@ void Sys_RestoreCrashHandler( void )
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
#ifdef XASH_DYNAMIC_DLADDR
|
||||||
|
static int d_dladdr( void *sym, Dl_info *info )
|
||||||
|
{
|
||||||
|
static int (*dladdr_real) ( void *sym, Dl_info *info );
|
||||||
|
|
||||||
|
if( !dladdr_real )
|
||||||
|
dladdr_real = dlsym( (void*)(size_t)(-1), "dladdr" );
|
||||||
|
|
||||||
|
memset( info, 0, sizeof( *info ) );
|
||||||
|
|
||||||
|
if( !dladdr_real )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return dladdr_real( sym, info );
|
||||||
|
}
|
||||||
|
#define dladdr d_dladdr
|
||||||
|
#endif
|
||||||
|
|
||||||
int printframe( char *buf, int len, int i, void *addr )
|
int printframe( char *buf, int len, int i, void *addr )
|
||||||
{
|
{
|
||||||
Dl_info dlinfo;
|
Dl_info dlinfo;
|
||||||
@@ -267,11 +285,11 @@ struct sigaction oldFilter;
|
|||||||
#define STACK_BACKTRACE_STR "Stack backtrace:\n"
|
#define STACK_BACKTRACE_STR "Stack backtrace:\n"
|
||||||
#define STACK_DUMP_STR_LEN 12
|
#define STACK_DUMP_STR_LEN 12
|
||||||
#define STACK_DUMP_STR "Stack dump:\n"
|
#define STACK_DUMP_STR "Stack dump:\n"
|
||||||
#define ALIGN( x, y ) (((int) (x) + ((y)-1)) & ~((y)-1))
|
#define ALIGN( x, y ) (((uintptr_t) (x) + ((y)-1)) & ~((y)-1))
|
||||||
|
|
||||||
static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
||||||
{
|
{
|
||||||
void *pc, **bp, **sp; // this must be set for every OS!
|
void *pc = NULL, **bp = NULL, **sp = NULL; // this must be set for every OS!
|
||||||
char message[8192];
|
char message[8192];
|
||||||
int len, logfd, i = 0;
|
int len, logfd, i = 0;
|
||||||
size_t pagesize;
|
size_t pagesize;
|
||||||
@@ -318,7 +336,7 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
|||||||
bp = (void**)ucontext->uc_mcontext.gregs[REG_EBP];
|
bp = (void**)ucontext->uc_mcontext.gregs[REG_EBP];
|
||||||
sp = (void**)ucontext->uc_mcontext.gregs[REG_ESP];
|
sp = (void**)ucontext->uc_mcontext.gregs[REG_ESP];
|
||||||
#endif
|
#endif
|
||||||
#elif XASH_ARM64
|
#elif XASH_ARM && XASH_64BIT
|
||||||
pc = (void*)ucontext->uc_mcontext.pc;
|
pc = (void*)ucontext->uc_mcontext.pc;
|
||||||
bp = (void*)ucontext->uc_mcontext.regs[29];
|
bp = (void*)ucontext->uc_mcontext.regs[29];
|
||||||
sp = (void*)ucontext->uc_mcontext.sp;
|
sp = (void*)ucontext->uc_mcontext.sp;
|
||||||
@@ -326,8 +344,6 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
|||||||
pc = (void*)ucontext->uc_mcontext.arm_pc;
|
pc = (void*)ucontext->uc_mcontext.arm_pc;
|
||||||
bp = (void*)ucontext->uc_mcontext.arm_fp;
|
bp = (void*)ucontext->uc_mcontext.arm_fp;
|
||||||
sp = (void*)ucontext->uc_mcontext.arm_sp;
|
sp = (void*)ucontext->uc_mcontext.arm_sp;
|
||||||
#else
|
|
||||||
#error "Unknown arch!!!"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// safe actions first, stack and memory may be corrupted
|
// safe actions first, stack and memory may be corrupted
|
||||||
@@ -350,54 +366,56 @@ static void Sys_Crash( int signal, siginfo_t *si, void *context)
|
|||||||
logfd = Sys_LogFileNo();
|
logfd = Sys_LogFileNo();
|
||||||
write( logfd, message, len );
|
write( logfd, message, len );
|
||||||
|
|
||||||
// try to print backtrace
|
if( pc && bp && sp )
|
||||||
write( 2, STACK_BACKTRACE_STR, STACK_BACKTRACE_STR_LEN );
|
|
||||||
write( logfd, STACK_BACKTRACE_STR, STACK_BACKTRACE_STR_LEN );
|
|
||||||
strncpy( message + len, STACK_BACKTRACE_STR, sizeof( message ) - len );
|
|
||||||
len += STACK_BACKTRACE_STR_LEN;
|
|
||||||
|
|
||||||
pagesize = sysconf( _SC_PAGESIZE );
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
int line = printframe( message + len, sizeof( message ) - len, ++i, pc);
|
size_t pagesize = sysconf( _SC_PAGESIZE );
|
||||||
write( 2, message + len, line );
|
// try to print backtrace
|
||||||
write( logfd, message + len, line );
|
write( 2, STACK_BACKTRACE_STR, STACK_BACKTRACE_STR_LEN );
|
||||||
len += line;
|
write( logfd, STACK_BACKTRACE_STR, STACK_BACKTRACE_STR_LEN );
|
||||||
//if( !dladdr(bp,0) ) break; // only when bp is in module
|
strncpy( message + len, STACK_BACKTRACE_STR, sizeof( message ) - len );
|
||||||
if( ( mprotect( (char *)ALIGN( bp, pagesize ), pagesize, PROT_READ | PROT_WRITE | PROT_EXEC ) == -1) &&
|
len += STACK_BACKTRACE_STR_LEN;
|
||||||
( mprotect( (char *)ALIGN( bp, pagesize ), pagesize, PROT_READ | PROT_EXEC ) == -1) &&
|
|
||||||
( mprotect( (char *)ALIGN( bp, pagesize ), pagesize, PROT_READ | PROT_WRITE ) == -1) &&
|
|
||||||
( mprotect( (char *)ALIGN( bp, pagesize ), pagesize, PROT_READ ) == -1) )
|
|
||||||
break;
|
|
||||||
if( ( mprotect( (char *)ALIGN( bp[0], pagesize ), pagesize, PROT_READ | PROT_WRITE | PROT_EXEC ) == -1) &&
|
|
||||||
( mprotect( (char *)ALIGN( bp[0], pagesize ), pagesize, PROT_READ | PROT_EXEC ) == -1) &&
|
|
||||||
( mprotect( (char *)ALIGN( bp[0], pagesize ), pagesize, PROT_READ | PROT_WRITE ) == -1) &&
|
|
||||||
( mprotect( (char *)ALIGN( bp[0], pagesize ), pagesize, PROT_READ ) == -1) )
|
|
||||||
break;
|
|
||||||
pc = bp[1];
|
|
||||||
bp = (void**)bp[0];
|
|
||||||
}
|
|
||||||
while( bp && i < 128 );
|
|
||||||
|
|
||||||
// try to print stack
|
// false on success, true on failure
|
||||||
write( 2, STACK_DUMP_STR, STACK_DUMP_STR_LEN );
|
#define try_allow_read(pointer, pagesize) \
|
||||||
write( logfd, STACK_DUMP_STR, STACK_DUMP_STR_LEN );
|
((mprotect( (char *)ALIGN( (pointer), (pagesize) ), (pagesize), PROT_READ | PROT_WRITE | PROT_EXEC ) == -1) && \
|
||||||
strncpy( message + len, STACK_DUMP_STR, sizeof( message ) - len );
|
( mprotect( (char *)ALIGN( (pointer), (pagesize) ), (pagesize), PROT_READ | PROT_EXEC ) == -1) && \
|
||||||
len += STACK_DUMP_STR_LEN;
|
( mprotect( (char *)ALIGN( (pointer), (pagesize) ), (pagesize), PROT_READ | PROT_WRITE ) == -1) && \
|
||||||
|
( mprotect( (char *)ALIGN( (pointer), (pagesize) ), (pagesize), PROT_READ ) == -1))
|
||||||
|
|
||||||
if( ( mprotect((char *)ALIGN( sp, pagesize ), pagesize, PROT_READ | PROT_WRITE | PROT_EXEC ) != -1) ||
|
do
|
||||||
( mprotect((char *)ALIGN( sp, pagesize ), pagesize, PROT_READ | PROT_EXEC ) != -1) ||
|
|
||||||
( mprotect((char *)ALIGN( sp, pagesize ), pagesize, PROT_READ | PROT_WRITE ) != -1) ||
|
|
||||||
( mprotect((char *)ALIGN( sp, pagesize ), pagesize, PROT_READ ) != -1) )
|
|
||||||
{
|
|
||||||
for( i = 0; i < 32; i++ )
|
|
||||||
{
|
{
|
||||||
int line = printframe( message + len, sizeof( message ) - len, i, sp[i] );
|
int line = printframe( message + len, sizeof( message ) - len, ++i, pc);
|
||||||
write( 2, message + len, line );
|
write( 2, message + len, line );
|
||||||
write( logfd, message + len, line );
|
write( logfd, message + len, line );
|
||||||
len += line;
|
len += line;
|
||||||
|
//if( !dladdr(bp,0) ) break; // only when bp is in module
|
||||||
|
if( try_allow_read( bp, pagesize ) )
|
||||||
|
break;
|
||||||
|
if( try_allow_read( bp[0], pagesize ) )
|
||||||
|
break;
|
||||||
|
pc = bp[1];
|
||||||
|
bp = (void**)bp[0];
|
||||||
}
|
}
|
||||||
|
while( bp && i < 128 );
|
||||||
|
|
||||||
|
// try to print stack
|
||||||
|
write( 2, STACK_DUMP_STR, STACK_DUMP_STR_LEN );
|
||||||
|
write( logfd, STACK_DUMP_STR, STACK_DUMP_STR_LEN );
|
||||||
|
strncpy( message + len, STACK_DUMP_STR, sizeof( message ) - len );
|
||||||
|
len += STACK_DUMP_STR_LEN;
|
||||||
|
|
||||||
|
if( !try_allow_read( sp, pagesize ) )
|
||||||
|
{
|
||||||
|
for( i = 0; i < 32; i++ )
|
||||||
|
{
|
||||||
|
int line = printframe( message + len, sizeof( message ) - len, i, sp[i] );
|
||||||
|
write( 2, message + len, line );
|
||||||
|
write( logfd, message + len, line );
|
||||||
|
len += line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef try_allow_read
|
||||||
}
|
}
|
||||||
|
|
||||||
// put MessageBox as Sys_Error
|
// put MessageBox as Sys_Error
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ const char *Cvar_ValidateString( convar_t *var, const char *value )
|
|||||||
pszValue = szNew;
|
pszValue = szNew;
|
||||||
|
|
||||||
// g-cont. is this even need?
|
// g-cont. is this even need?
|
||||||
if( !Q_strlen( szNew )) Q_strncpy( szNew, "empty", sizeof( szNew ));
|
if( !COM_CheckStringEmpty( szNew ) ) Q_strncpy( szNew, "empty", sizeof( szNew ));
|
||||||
}
|
}
|
||||||
|
|
||||||
if( FBitSet( var->flags, FCVAR_NOEXTRAWHITEPACE ))
|
if( FBitSet( var->flags, FCVAR_NOEXTRAWHITEPACE ))
|
||||||
@@ -588,7 +588,7 @@ void Cvar_FullSet( const char *var_name, const char *value, int flags )
|
|||||||
Cvar_Set
|
Cvar_Set
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cvar_Set( const char *var_name, const char *value )
|
void GAME_EXPORT Cvar_Set( const char *var_name, const char *value )
|
||||||
{
|
{
|
||||||
convar_t *var;
|
convar_t *var;
|
||||||
|
|
||||||
@@ -616,7 +616,7 @@ void Cvar_Set( const char *var_name, const char *value )
|
|||||||
Cvar_SetValue
|
Cvar_SetValue
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cvar_SetValue( const char *var_name, float value )
|
void GAME_EXPORT Cvar_SetValue( const char *var_name, float value )
|
||||||
{
|
{
|
||||||
char val[32];
|
char val[32];
|
||||||
|
|
||||||
@@ -642,7 +642,7 @@ void Cvar_Reset( const char *var_name )
|
|||||||
Cvar_VariableValue
|
Cvar_VariableValue
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
float Cvar_VariableValue( const char *var_name )
|
float GAME_EXPORT Cvar_VariableValue( const char *var_name )
|
||||||
{
|
{
|
||||||
convar_t *var;
|
convar_t *var;
|
||||||
|
|
||||||
|
|||||||
+11
-3
@@ -18,8 +18,12 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "cvardef.h"
|
#include "cvardef.h"
|
||||||
|
|
||||||
|
#ifdef XASH_64BIT
|
||||||
|
#define CVAR_SENTINEL 0xDEADBEEFDEADBEEF
|
||||||
|
#else
|
||||||
#define CVAR_SENTINEL 0xDEADBEEF
|
#define CVAR_SENTINEL 0xDEADBEEF
|
||||||
#define CVAR_CHECK_SENTINEL( cv ) ((uint)(cv)->next == CVAR_SENTINEL)
|
#endif
|
||||||
|
#define CVAR_CHECK_SENTINEL( cv ) ((uintptr_t)(cv)->next == CVAR_SENTINEL)
|
||||||
|
|
||||||
// NOTE: if this is changed, it must be changed in cvardef.h too
|
// NOTE: if this is changed, it must be changed in cvardef.h too
|
||||||
typedef struct convar_s
|
typedef struct convar_s
|
||||||
@@ -45,8 +49,12 @@ typedef struct convar_s
|
|||||||
#define FCVAR_TEMPORARY (1<<21) // these cvars holds their values and can be unlink in any time
|
#define FCVAR_TEMPORARY (1<<21) // these cvars holds their values and can be unlink in any time
|
||||||
#define FCVAR_LOCALONLY (1<<22) // can be set only from local buffers
|
#define FCVAR_LOCALONLY (1<<22) // can be set only from local buffers
|
||||||
|
|
||||||
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) convar_t cv = { cvname, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
|
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) \
|
||||||
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) convar_t cv = { #cv, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, 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 )
|
||||||
|
|
||||||
#define CVAR_TO_BOOL( x ) ((x) && ((x)->value != 0.0f) ? true : false )
|
#define CVAR_TO_BOOL( x ) ((x) && ((x)->value != 0.0f) ? true : false )
|
||||||
|
|
||||||
cvar_t *Cvar_GetList( void );
|
cvar_t *Cvar_GetList( void );
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
#if XASH_DEDICATED
|
#if XASH_DEDICATED
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "ref_api.h"
|
#include "ref_api.h"
|
||||||
|
|
||||||
ref_globals_t refState;
|
ref_globals_t refState;
|
||||||
@@ -80,7 +80,7 @@ const char *svc_strings[256] =
|
|||||||
"svc_unused56",
|
"svc_unused56",
|
||||||
"svc_querycvarvalue",
|
"svc_querycvarvalue",
|
||||||
"svc_querycvarvalue2",
|
"svc_querycvarvalue2",
|
||||||
"svc_unused59",
|
"svc_exec",
|
||||||
"svc_unused60",
|
"svc_unused60",
|
||||||
"svc_unused61",
|
"svc_unused61",
|
||||||
"svc_unused62",
|
"svc_unused62",
|
||||||
@@ -92,7 +92,7 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_Active( void )
|
int GAME_EXPORT CL_Active( void )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -173,7 +173,7 @@ void CL_ClearEdicts( void )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Key_SetKeyDest(int key_dest)
|
void GAME_EXPORT Key_SetKeyDest(int key_dest)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -190,7 +190,7 @@ void CL_WriteMessageHistory( void )
|
|||||||
|
|
||||||
void Host_ClientBegin( void )
|
void Host_ClientBegin( void )
|
||||||
{
|
{
|
||||||
|
Cbuf_Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_ClientFrame( void )
|
void Host_ClientFrame( void )
|
||||||
@@ -200,7 +200,6 @@ void Host_ClientFrame( void )
|
|||||||
|
|
||||||
void Host_InputFrame( void )
|
void Host_InputFrame( void )
|
||||||
{
|
{
|
||||||
Cbuf_Execute( );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VID_InitDefaultResolution( void )
|
void VID_InitDefaultResolution( void )
|
||||||
@@ -222,7 +221,7 @@ int R_CreateDecalList( struct decallist_s *pList )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void S_StopSound(int entnum, int channel, const char *soundname)
|
void GAME_EXPORT S_StopSound(int entnum, int channel, const char *soundname)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -232,7 +231,7 @@ int S_GetCurrentStaticSounds( soundlist_t *pout, int size )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CL_GetMaxClients( void )
|
int GAME_EXPORT CL_GetMaxClients( void )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -287,12 +286,12 @@ void S_StopAllSounds( qboolean ambient )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Con_NPrintf( int idx, const char *fmt, ... )
|
void GAME_EXPORT Con_NPrintf( int idx, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Con_NXPrintf( struct con_nprint_s *info, const char *fmt, ... )
|
void GAME_EXPORT Con_NXPrintf( struct con_nprint_s *info, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+476
-205
File diff suppressed because it is too large
Load Diff
@@ -14,10 +14,7 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#if HAVE_TGMATH_H
|
|
||||||
#include <tgmath.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Gamma conversion support
|
// Gamma conversion support
|
||||||
|
|||||||
+238
-132
@@ -36,18 +36,20 @@ GNU General Public License for more details.
|
|||||||
#include "netchan.h"
|
#include "netchan.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "mod_local.h"
|
#include "mod_local.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "enginefeatures.h"
|
#include "enginefeatures.h"
|
||||||
#include "render_api.h" // decallist_t
|
#include "render_api.h" // decallist_t
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
typedef void (*pfnChangeGame)( const char *progname );
|
|
||||||
|
|
||||||
pfnChangeGame pChangeGame = NULL;
|
pfnChangeGame pChangeGame = NULL;
|
||||||
host_parm_t host; // host parms
|
host_parm_t host; // host parms
|
||||||
sysinfo_t SI;
|
sysinfo_t SI;
|
||||||
|
|
||||||
|
#ifdef XASH_ENGINE_TESTS
|
||||||
|
struct tests_stats_s tests_stats;
|
||||||
|
#endif
|
||||||
|
|
||||||
CVAR_DEFINE( host_developer, "developer", "0", 0, "engine is in development-mode" );
|
CVAR_DEFINE( host_developer, "developer", "0", 0, "engine is in development-mode" );
|
||||||
CVAR_DEFINE_AUTO( sys_ticrate, "100", 0, "framerate in dedicated mode" );
|
CVAR_DEFINE_AUTO( sys_ticrate, "100", 0, "framerate in dedicated mode" );
|
||||||
|
|
||||||
@@ -61,6 +63,101 @@ convar_t *host_sleeptime;
|
|||||||
convar_t *con_gamemaps;
|
convar_t *con_gamemaps;
|
||||||
convar_t *build, *ver;
|
convar_t *build, *ver;
|
||||||
|
|
||||||
|
void Sys_PrintUsage( void )
|
||||||
|
{
|
||||||
|
const char *usage_str;
|
||||||
|
|
||||||
|
#define O(x,y) " "x" "y"\n"
|
||||||
|
|
||||||
|
usage_str = ""
|
||||||
|
#if XASH_MESSAGEBOX == MSGBOX_STDERR
|
||||||
|
"\n" // dirty hack to not have Xash Error: Usage: on same line
|
||||||
|
#endif // XASH_MESSAGEBOX == MSGBOX_STDERR
|
||||||
|
"Usage:\n"
|
||||||
|
#if !XASH_MOBILE_PLATFORM
|
||||||
|
#if XASH_WIN32
|
||||||
|
O("<xash>.exe [options] [+command1] [+command2 arg]","")
|
||||||
|
#else // XASH_WIN32
|
||||||
|
O("<xash> [options] [+command1] [+command2 arg]","")
|
||||||
|
#endif // !XASH_WIN32
|
||||||
|
#endif // !XASH_MOBILE_PLATFORM
|
||||||
|
"Options:\n"
|
||||||
|
O("-dev [level] ","set log verbosity 0-2")
|
||||||
|
O("-log ","write log to \"engine.log\"")
|
||||||
|
O("-nowriteconfig ","disable config save")
|
||||||
|
#if !XASH_WIN32
|
||||||
|
O("-casesensitive ","disable case-insensitive FS emulation")
|
||||||
|
#endif // !XASH_WIN32
|
||||||
|
#if !XASH_MOBILE_PLATFORM
|
||||||
|
O("-daemonize ","run engine in background, dedicated only")
|
||||||
|
#endif // !XASH_MOBILE_PLATFORM
|
||||||
|
|
||||||
|
#if !XASH_DEDICATED
|
||||||
|
O("-toconsole ","run engine witn console open")
|
||||||
|
O("-width <n> ","set window width")
|
||||||
|
O("-height <n> ","set window height")
|
||||||
|
O("-oldfont ","enable unused Quake font in Half-Life")
|
||||||
|
|
||||||
|
#if !XASH_MOBILE_PLATFORM
|
||||||
|
O("-fullscreen ","run engine in fullscreen mode")
|
||||||
|
O("-windowed ","run engine in windowed mode")
|
||||||
|
O("-dedicated ","run engine in dedicated server mode")
|
||||||
|
#endif // XASH_MOBILE_PLATFORM
|
||||||
|
|
||||||
|
#if XASH_ANDROID
|
||||||
|
O("-nativeegl ","use native egl implementation. Use if screen does not update or black")
|
||||||
|
#endif // XASH_ANDROID
|
||||||
|
|
||||||
|
#if XASH_WIN32
|
||||||
|
O("-noavi ","disable AVI support")
|
||||||
|
O("-nointro ","disable intro video")
|
||||||
|
#endif // XASH_WIN32
|
||||||
|
|
||||||
|
#if XASH_DOS
|
||||||
|
O("-novesa ","disable vesa")
|
||||||
|
#endif // XASH_DOS
|
||||||
|
|
||||||
|
#if XASH_VIDEO == VIDEO_FBDEV
|
||||||
|
O("-fbdev <path> ","open selected framebuffer")
|
||||||
|
O("-ttygfx ","set graphics mode in tty")
|
||||||
|
O("-doublebuffer ","enable doublebuffering")
|
||||||
|
#endif // XASH_VIDEO == VIDEO_FBDEV
|
||||||
|
|
||||||
|
#if XASH_SOUND == SOUND_ALSA
|
||||||
|
O("-alsadev <dev> ","open selected ALSA device")
|
||||||
|
#endif // XASH_SOUND == SOUND_ALSA
|
||||||
|
|
||||||
|
O("-nojoy ","disable joystick support")
|
||||||
|
#ifdef XASH_SDL
|
||||||
|
O("-sdl_joy_old_api ","use SDL legacy joystick API")
|
||||||
|
O("-sdl_renderer <n>","use alternative SDL_Renderer for software")
|
||||||
|
#endif // XASH_SDL
|
||||||
|
O("-nosound ","disable sound")
|
||||||
|
O("-noenginemouse ","disable mouse completely")
|
||||||
|
|
||||||
|
O("-ref <name> ","use selected renderer dll")
|
||||||
|
O("-gldebug ","enable OpenGL debug log")
|
||||||
|
|
||||||
|
#endif // XASH_DEDICATED
|
||||||
|
|
||||||
|
O("-noip ","disable TCP/IP")
|
||||||
|
O("-noch ","disable crashhandler")
|
||||||
|
O("-disablehelp ","disable this message")
|
||||||
|
O("-dll <path> ","override server DLL path")
|
||||||
|
#ifndef XASH_DEDICATED
|
||||||
|
O("-clientlib <path>","override client DLL path")
|
||||||
|
#endif
|
||||||
|
O("-rodir <path> ","set read-only base directory, experimental")
|
||||||
|
|
||||||
|
O("-ip <ip> ","set custom ip")
|
||||||
|
O("-port <port> ","set custom host port")
|
||||||
|
O("-clockwindow <cw>","adjust clockwindow")
|
||||||
|
;
|
||||||
|
#undef O
|
||||||
|
|
||||||
|
Sys_Error( "%s", usage_str );
|
||||||
|
}
|
||||||
|
|
||||||
int Host_CompareFileTime( int ft1, int ft2 )
|
int Host_CompareFileTime( int ft1, int ft2 )
|
||||||
{
|
{
|
||||||
if( ft1 < ft2 )
|
if( ft1 < ft2 )
|
||||||
@@ -557,7 +654,7 @@ void Host_Frame( float time )
|
|||||||
Host_Error
|
Host_Error
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
void Host_Error( const char *error, ... )
|
void GAME_EXPORT Host_Error( const char *error, ... )
|
||||||
{
|
{
|
||||||
static char hosterror1[MAX_SYSPATH];
|
static char hosterror1[MAX_SYSPATH];
|
||||||
static char hosterror2[MAX_SYSPATH];
|
static char hosterror2[MAX_SYSPATH];
|
||||||
@@ -657,6 +754,45 @@ static void Host_Crash_f( void )
|
|||||||
*(volatile int *)0 = 0xffffffff;
|
*(volatile int *)0 = 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Host_Userconfigd_f
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void Host_Userconfigd_f( void )
|
||||||
|
{
|
||||||
|
search_t *t;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
t = FS_Search( "userconfig.d/*.cfg", true, false );
|
||||||
|
if( !t ) return;
|
||||||
|
|
||||||
|
for( i = 0; i < t->numfilenames; i++ )
|
||||||
|
{
|
||||||
|
Cbuf_AddText( va("exec %s\n", t->filenames[i] ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
Mem_Free( t );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
static void Host_RunTests( int stage )
|
||||||
|
{
|
||||||
|
switch( stage )
|
||||||
|
{
|
||||||
|
case 0: // early engine load
|
||||||
|
memset( &tests_stats, 0, sizeof( tests_stats ));
|
||||||
|
Test_RunLibCommon();
|
||||||
|
Test_RunCommon();
|
||||||
|
break;
|
||||||
|
case 1: // after FS load
|
||||||
|
Test_RunImagelib();
|
||||||
|
Msg( "Done! %d passed, %d failed\n", tests_stats.passed, tests_stats.failed );
|
||||||
|
Sys_Quit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
Host_InitCommon
|
Host_InitCommon
|
||||||
@@ -668,112 +804,26 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
int developer = DEFAULT_DEV;
|
int developer = DEFAULT_DEV;
|
||||||
const char *baseDir;
|
const char *baseDir;
|
||||||
char ticrate[16];
|
char ticrate[16];
|
||||||
|
int len;
|
||||||
|
|
||||||
// some commands may turn engine into infinite loop,
|
// some commands may turn engine into infinite loop,
|
||||||
// e.g. xash.exe +game xash -game xash
|
// e.g. xash.exe +game xash -game xash
|
||||||
// so we clear all cmd_args, but leave dbg states as well
|
// so we clear all cmd_args, but leave dbg states as well
|
||||||
Sys_ParseCommandLine( argc, argv );
|
Sys_ParseCommandLine( argc, argv );
|
||||||
|
|
||||||
|
if( !Sys_CheckParm( "-disablehelp" ) )
|
||||||
|
{
|
||||||
|
if( Sys_CheckParm( "-help" ) || Sys_CheckParm( "-h" ) || Sys_CheckParm( "--help" ) )
|
||||||
|
{
|
||||||
|
Sys_PrintUsage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( !Sys_CheckParm( "-noch" ) )
|
if( !Sys_CheckParm( "-noch" ) )
|
||||||
Sys_SetupCrashHandler();
|
Sys_SetupCrashHandler();
|
||||||
|
|
||||||
// to be accessed later
|
|
||||||
if( ( host.daemonized = Sys_CheckParm( "-daemonize" ) ) )
|
|
||||||
{
|
|
||||||
#if defined(_POSIX_VERSION) && !defined(XASH_MOBILE_PLATFORM)
|
|
||||||
pid_t daemon;
|
|
||||||
|
|
||||||
daemon = fork();
|
|
||||||
|
|
||||||
if( daemon < 0 )
|
|
||||||
{
|
|
||||||
Host_Error( "fork() failed: %s\n", strerror( errno ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( daemon > 0 )
|
|
||||||
{
|
|
||||||
// parent
|
|
||||||
Con_Reportf( "Child pid: %i\n", daemon );
|
|
||||||
exit( 0 );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// don't be closed by parent
|
|
||||||
if( setsid() < 0 )
|
|
||||||
{
|
|
||||||
Host_Error( "setsid() failed: %s\n", strerror( errno ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// set permissions
|
|
||||||
umask( 0 );
|
|
||||||
|
|
||||||
// engine will still use stdin/stdout,
|
|
||||||
// so just redirect them to /dev/null
|
|
||||||
close( STDIN_FILENO );
|
|
||||||
close( STDOUT_FILENO );
|
|
||||||
close( STDERR_FILENO );
|
|
||||||
open("/dev/null", O_RDONLY); // becomes stdin
|
|
||||||
open("/dev/null", O_RDWR); // stdout
|
|
||||||
open("/dev/null", O_RDWR); // stderr
|
|
||||||
|
|
||||||
// fallthrough
|
|
||||||
}
|
|
||||||
#elif defined(XASH_MOBILE_PLATFORM)
|
|
||||||
Sys_Error( "Can't run in background on mobile platforms!" );
|
|
||||||
#else
|
|
||||||
Sys_Error( "Daemonize not supported on this platform!" );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( baseDir = getenv( "XASH3D_BASEDIR" ) ) )
|
|
||||||
{
|
|
||||||
Q_strncpy( host.rootdir, baseDir, sizeof(host.rootdir) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if TARGET_OS_IOS
|
|
||||||
const char *IOS_GetDocsDir();
|
|
||||||
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof(host.rootdir) );
|
|
||||||
#elif XASH_SDL == 2
|
|
||||||
char *szBasePath;
|
|
||||||
|
|
||||||
if( !( szBasePath = SDL_GetBasePath() ) )
|
|
||||||
Sys_Error( "couldn't determine current directory: %s", SDL_GetError() );
|
|
||||||
Q_strncpy( host.rootdir, szBasePath, sizeof( host.rootdir ) );
|
|
||||||
SDL_free( szBasePath );
|
|
||||||
#else
|
|
||||||
if( !getcwd( host.rootdir, sizeof(host.rootdir) ) )
|
|
||||||
{
|
|
||||||
Sys_Error( "couldn't determine current directory: %s", strerror( errno ) );
|
|
||||||
host.rootdir[0] = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if( host.rootdir[Q_strlen( host.rootdir ) - 1] == '/' )
|
|
||||||
host.rootdir[Q_strlen( host.rootdir ) - 1] = 0;
|
|
||||||
|
|
||||||
// get readonly root. The order is: check for arg, then env.
|
|
||||||
// if still not got it, rodir is disabled.
|
|
||||||
host.rodir[0] = 0;
|
|
||||||
if( !Sys_GetParmFromCmdLine( "-rodir", host.rodir ))
|
|
||||||
{
|
|
||||||
char *roDir;
|
|
||||||
|
|
||||||
if(( roDir = getenv( "XASH3D_RODIR" )))
|
|
||||||
Q_strncpy( host.rodir, roDir, sizeof( host.rodir ));
|
|
||||||
}
|
|
||||||
|
|
||||||
if( host.rodir[0] && host.rodir[Q_strlen( host.rodir ) - 1] == '/' )
|
|
||||||
host.rodir[Q_strlen( host.rodir ) - 1] = 0;
|
|
||||||
|
|
||||||
host.enabledll = !Sys_CheckParm( "-nodll" );
|
host.enabledll = !Sys_CheckParm( "-nodll" );
|
||||||
|
|
||||||
#ifdef DLL_LOADER
|
|
||||||
if( host.enabledll )
|
|
||||||
Setup_LDT_Keeper( ); // Must call before creating any thread
|
|
||||||
#endif
|
|
||||||
|
|
||||||
host.change_game = bChangeGame;
|
host.change_game = bChangeGame;
|
||||||
host.config_executed = false;
|
host.config_executed = false;
|
||||||
host.status = HOST_INIT; // initialzation started
|
host.status = HOST_INIT; // initialzation started
|
||||||
@@ -799,6 +849,14 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
if( Sys_CheckParm( "-runtests" ))
|
||||||
|
{
|
||||||
|
host.allow_console = true;
|
||||||
|
developer = DEV_EXTENDED;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
host.con_showalways = true;
|
host.con_showalways = true;
|
||||||
|
|
||||||
#if XASH_DEDICATED
|
#if XASH_DEDICATED
|
||||||
@@ -814,30 +872,6 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef XASH_SDL
|
|
||||||
#ifndef SDL_INIT_EVENTS
|
|
||||||
#define SDL_INIT_EVENTS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( SDL_Init( SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_EVENTS ) )
|
|
||||||
{
|
|
||||||
Sys_Warn( "SDL_Init failed: %s", SDL_GetError() );
|
|
||||||
host.type = HOST_DEDICATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if XASH_SDL == 2
|
|
||||||
SDL_SetHint(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, "0");
|
|
||||||
SDL_StopTextInput();
|
|
||||||
#endif // XASH_SDL == 2
|
|
||||||
#endif // XASH_SDL
|
|
||||||
|
|
||||||
if ( !host.rootdir[0] || SetCurrentDirectory( host.rootdir ) != 0)
|
|
||||||
Con_Reportf( "%s is working directory now\n", host.rootdir );
|
|
||||||
else
|
|
||||||
Sys_Error( "Changing working directory to %s failed.\n", host.rootdir );
|
|
||||||
|
|
||||||
Sys_InitLog();
|
|
||||||
|
|
||||||
// set default gamedir
|
// set default gamedir
|
||||||
if( progname[0] == '#' )
|
if( progname[0] == '#' )
|
||||||
progname++;
|
progname++;
|
||||||
@@ -861,13 +895,10 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
// member console allowing
|
// member console allowing
|
||||||
host.allow_console_init = host.allow_console;
|
host.allow_console_init = host.allow_console;
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
Wcon_CreateConsole(); // system console used by dedicated server or show fatal errors
|
|
||||||
#endif
|
|
||||||
// timeBeginPeriod( 1 ); // a1ba: Do we need this?
|
// timeBeginPeriod( 1 ); // a1ba: Do we need this?
|
||||||
|
|
||||||
// NOTE: this message couldn't be passed into game console but it doesn't matter
|
// NOTE: this message couldn't be passed into game console but it doesn't matter
|
||||||
Con_Reportf( "Sys_LoadLibrary: Loading xash.dll - ok\n" );
|
// Con_Reportf( "Sys_LoadLibrary: Loading xash.dll - ok\n" );
|
||||||
|
|
||||||
// get default screen res
|
// get default screen res
|
||||||
VID_InitDefaultResolution();
|
VID_InitDefaultResolution();
|
||||||
@@ -894,13 +925,82 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
}
|
}
|
||||||
|
|
||||||
Con_Init(); // early console running to catch all the messages
|
Con_Init(); // early console running to catch all the messages
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
if( Sys_CheckParm( "-runtests" ))
|
||||||
|
Host_RunTests( 0 );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Platform_Init();
|
||||||
|
|
||||||
|
baseDir = getenv( "XASH3D_BASEDIR" );
|
||||||
|
|
||||||
|
if( COM_CheckString( baseDir ) )
|
||||||
|
{
|
||||||
|
Q_strncpy( host.rootdir, baseDir, sizeof(host.rootdir) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if TARGET_OS_IOS
|
||||||
|
const char *IOS_GetDocsDir();
|
||||||
|
Q_strncpy( host.rootdir, IOS_GetDocsDir(), sizeof(host.rootdir) );
|
||||||
|
#elif XASH_SDL == 2
|
||||||
|
char *szBasePath;
|
||||||
|
|
||||||
|
if( !( szBasePath = SDL_GetBasePath() ) )
|
||||||
|
Sys_Error( "couldn't determine current directory: %s", SDL_GetError() );
|
||||||
|
Q_strncpy( host.rootdir, szBasePath, sizeof( host.rootdir ) );
|
||||||
|
SDL_free( szBasePath );
|
||||||
|
#else
|
||||||
|
if( !getcwd( host.rootdir, sizeof(host.rootdir) ) )
|
||||||
|
{
|
||||||
|
Sys_Error( "couldn't determine current directory: %s", strerror( errno ) );
|
||||||
|
host.rootdir[0] = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
len = Q_strlen( host.rootdir );
|
||||||
|
|
||||||
|
if( host.rootdir[len - 1] == '/' )
|
||||||
|
host.rootdir[len - 1] = 0;
|
||||||
|
|
||||||
|
// get readonly root. The order is: check for arg, then env.
|
||||||
|
// if still not got it, rodir is disabled.
|
||||||
|
host.rodir[0] = '\0';
|
||||||
|
if( !Sys_GetParmFromCmdLine( "-rodir", host.rodir ))
|
||||||
|
{
|
||||||
|
char *roDir = getenv( "XASH3D_RODIR" );
|
||||||
|
|
||||||
|
if( COM_CheckString( roDir ))
|
||||||
|
Q_strncpy( host.rodir, roDir, sizeof( host.rodir ));
|
||||||
|
}
|
||||||
|
|
||||||
|
len = Q_strlen( host.rodir );
|
||||||
|
|
||||||
|
if( len && host.rodir[len - 1] == '/' )
|
||||||
|
host.rodir[len - 1] = 0;
|
||||||
|
|
||||||
|
if( !COM_CheckStringEmpty( host.rootdir ) || FS_SetCurrentDirectory( host.rootdir ) != 0 )
|
||||||
|
Con_Reportf( "%s is working directory now\n", host.rootdir );
|
||||||
|
else
|
||||||
|
Sys_Error( "Changing working directory to %s failed.\n", host.rootdir );
|
||||||
|
|
||||||
|
Sys_InitLog();
|
||||||
|
|
||||||
Cmd_AddCommand( "exec", Host_Exec_f, "execute a script file" );
|
Cmd_AddCommand( "exec", Host_Exec_f, "execute a script file" );
|
||||||
Cmd_AddCommand( "memlist", Host_MemStats_f, "prints memory pool information" );
|
Cmd_AddCommand( "memlist", Host_MemStats_f, "prints memory pool information" );
|
||||||
|
Cmd_AddCommand( "userconfigd", Host_Userconfigd_f, "execute all scripts from userconfig.d" );
|
||||||
|
|
||||||
FS_Init();
|
FS_Init();
|
||||||
Image_Init();
|
Image_Init();
|
||||||
Sound_Init();
|
Sound_Init();
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
if( Sys_CheckParm( "-runtests" ))
|
||||||
|
Host_RunTests( 1 );
|
||||||
|
#endif
|
||||||
|
|
||||||
FS_LoadGameInfo( NULL );
|
FS_LoadGameInfo( NULL );
|
||||||
Q_strncpy( host.gamefolder, GI->gamefolder, sizeof( host.gamefolder ));
|
Q_strncpy( host.gamefolder, GI->gamefolder, sizeof( host.gamefolder ));
|
||||||
|
|
||||||
@@ -1014,6 +1114,8 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
Cbuf_AddText( "exec config.cfg\n" );
|
Cbuf_AddText( "exec config.cfg\n" );
|
||||||
Cbuf_Execute();
|
Cbuf_Execute();
|
||||||
}
|
}
|
||||||
|
// exec all files from userconfig.d
|
||||||
|
Host_Userconfigd_f();
|
||||||
break;
|
break;
|
||||||
case HOST_DEDICATED:
|
case HOST_DEDICATED:
|
||||||
// allways parse commandline in dedicated-mode
|
// allways parse commandline in dedicated-mode
|
||||||
@@ -1029,7 +1131,13 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
|
|||||||
oldtime = Sys_DoubleTime() - 0.1;
|
oldtime = Sys_DoubleTime() - 0.1;
|
||||||
|
|
||||||
if( Host_IsDedicated() && GameState->nextstate == STATE_RUNFRAME )
|
if( Host_IsDedicated() && GameState->nextstate == STATE_RUNFRAME )
|
||||||
Con_Printf( "type 'map <mapname>' to run server... (TAB-autocomplete is working too)\n" );
|
{
|
||||||
|
// execute server.cfg after commandline
|
||||||
|
// so we have a chance to set servercfgfile
|
||||||
|
Con_Printf( "Type 'map <mapname>' to start game... (TAB-autocomplete is working too)\n" );
|
||||||
|
Cbuf_AddText( va( "exec %s\n", Cvar_VariableString( "servercfgfile" )));
|
||||||
|
Cbuf_Execute();
|
||||||
|
}
|
||||||
|
|
||||||
// main window message loop
|
// main window message loop
|
||||||
while( !host.crashed )
|
while( !host.crashed )
|
||||||
@@ -1069,9 +1177,7 @@ void EXPORT Host_Shutdown( void )
|
|||||||
NET_Shutdown();
|
NET_Shutdown();
|
||||||
HTTP_Shutdown();
|
HTTP_Shutdown();
|
||||||
Host_FreeCommon();
|
Host_FreeCommon();
|
||||||
#ifdef _WIN32
|
Platform_Shutdown();
|
||||||
Wcon_DestroyConsole();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// must be last, console uses this
|
// must be last, console uses this
|
||||||
Mem_FreePool( &host.mempool );
|
Mem_FreePool( &host.mempool );
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
|
|||||||
if( quiet ) HPAK_FlushHostQueue();
|
if( quiet ) HPAK_FlushHostQueue();
|
||||||
|
|
||||||
// not an error - just flush queue
|
// not an error - just flush queue
|
||||||
if( !filename || !*filename )
|
if( !COM_CheckString( filename ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
Q_strncpy( pakname, filename, sizeof( pakname ));
|
Q_strncpy( pakname, filename, sizeof( pakname ));
|
||||||
@@ -476,7 +476,7 @@ void HPAK_CheckIntegrity( const char *filename )
|
|||||||
{
|
{
|
||||||
string pakname;
|
string pakname;
|
||||||
|
|
||||||
if( !filename || !filename[0] )
|
if( !COM_CheckString( filename ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Q_strncpy( pakname, filename, sizeof( pakname ));
|
Q_strncpy( pakname, filename, sizeof( pakname ));
|
||||||
@@ -493,7 +493,7 @@ void HPAK_CheckSize( const char *filename )
|
|||||||
maxsize = hpk_maxsize->value;
|
maxsize = hpk_maxsize->value;
|
||||||
if( maxsize <= 0 ) return;
|
if( maxsize <= 0 ) return;
|
||||||
|
|
||||||
if( !filename || !filename[0] )
|
if( !COM_CheckString( filename ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Q_strncpy( pakname, filename, sizeof( pakname ));
|
Q_strncpy( pakname, filename, sizeof( pakname ));
|
||||||
@@ -574,7 +574,7 @@ static qboolean HPAK_ResourceForIndex( const char *filename, int index, resource
|
|||||||
string pakname;
|
string pakname;
|
||||||
file_t *f;
|
file_t *f;
|
||||||
|
|
||||||
if( !filename || !filename[0] )
|
if( !COM_CheckString( filename ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Q_strncpy( pakname, filename, sizeof( pakname ));
|
Q_strncpy( pakname, filename, sizeof( pakname ));
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ should be enough to determine if device exist in identifier
|
|||||||
|
|
||||||
==========================================================
|
==========================================================
|
||||||
*/
|
*/
|
||||||
typedef integer64 bloomfilter_t;
|
typedef uint64_t bloomfilter_t;
|
||||||
|
|
||||||
static bloomfilter_t id;
|
static bloomfilter_t id;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ bloomfilter_t BloomFilter_Process( const char *buffer, int size )
|
|||||||
|
|
||||||
while( crc32 )
|
while( crc32 )
|
||||||
{
|
{
|
||||||
value |= ((integer64)1) << ( crc32 & bf64_mask );
|
value |= ((uint64_t)1) << ( crc32 & bf64_mask );
|
||||||
crc32 = crc32 >> 6;
|
crc32 = crc32 >> 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,8 +445,8 @@ int ID_ProcessWMIC( bloomfilter_t *value, const char *cmdline )
|
|||||||
|
|
||||||
if( !ID_RunWMIC( buffer, cmdline ) )
|
if( !ID_RunWMIC( buffer, cmdline ) )
|
||||||
return 0;
|
return 0;
|
||||||
pbuf = COM_ParseFile( buffer, token ); // Header
|
pbuf = COM_ParseFile( buffer, token, sizeof( token )); // Header
|
||||||
while( pbuf = COM_ParseFile( pbuf, token ) )
|
while( pbuf = COM_ParseFile( pbuf, token, sizeof( token ) ) )
|
||||||
{
|
{
|
||||||
if( !ID_VerifyHEX( token ) )
|
if( !ID_VerifyHEX( token ) )
|
||||||
continue;
|
continue;
|
||||||
@@ -465,8 +465,8 @@ int ID_CheckWMIC( bloomfilter_t value, const char *cmdline )
|
|||||||
|
|
||||||
if( !ID_RunWMIC( buffer, cmdline ) )
|
if( !ID_RunWMIC( buffer, cmdline ) )
|
||||||
return 0;
|
return 0;
|
||||||
pbuf = COM_ParseFile( buffer, token ); // Header
|
pbuf = COM_ParseFile( buffer, token, sizeof( token )); // Header
|
||||||
while( pbuf = COM_ParseFile( pbuf, token ) )
|
while( pbuf = COM_ParseFile( pbuf, token, sizeof( token ) ) )
|
||||||
{
|
{
|
||||||
bloomfilter_t filter;
|
bloomfilter_t filter;
|
||||||
|
|
||||||
@@ -640,7 +640,7 @@ void ID_Init( void )
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
const char *home = getenv( "HOME" );
|
const char *home = getenv( "HOME" );
|
||||||
if( home )
|
if( COM_CheckString( home ) )
|
||||||
{
|
{
|
||||||
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "r" );
|
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "r" );
|
||||||
if( !cfg )
|
if( !cfg )
|
||||||
@@ -690,7 +690,7 @@ void ID_Init( void )
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
const char *home = getenv( "HOME" );
|
const char *home = getenv( "HOME" );
|
||||||
if( home )
|
if( COM_CheckString( home ) )
|
||||||
{
|
{
|
||||||
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "w" );
|
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "w" );
|
||||||
if( !cfg )
|
if( !cfg )
|
||||||
|
|||||||
@@ -98,214 +98,6 @@ typedef struct imglib_s
|
|||||||
qboolean custom_palette; // custom palette was installed
|
qboolean custom_palette; // custom palette was installed
|
||||||
} imglib_t;
|
} imglib_t;
|
||||||
|
|
||||||
/*
|
|
||||||
========================================================================
|
|
||||||
|
|
||||||
.BMP image format
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
*/
|
|
||||||
#pragma pack( 1 )
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
char id[2]; // bmfh.bfType
|
|
||||||
dword fileSize; // bmfh.bfSize
|
|
||||||
dword reserved0; // bmfh.bfReserved1 + bmfh.bfReserved2
|
|
||||||
dword bitmapDataOffset; // bmfh.bfOffBits
|
|
||||||
dword bitmapHeaderSize; // bmih.biSize
|
|
||||||
int width; // bmih.biWidth
|
|
||||||
int height; // bmih.biHeight
|
|
||||||
word planes; // bmih.biPlanes
|
|
||||||
word bitsPerPixel; // bmih.biBitCount
|
|
||||||
dword compression; // bmih.biCompression
|
|
||||||
dword bitmapDataSize; // bmih.biSizeImage
|
|
||||||
dword hRes; // bmih.biXPelsPerMeter
|
|
||||||
dword vRes; // bmih.biYPelsPerMeter
|
|
||||||
dword colors; // bmih.biClrUsed
|
|
||||||
dword importantColors; // bmih.biClrImportant
|
|
||||||
} bmp_t;
|
|
||||||
#pragma pack( )
|
|
||||||
|
|
||||||
/*
|
|
||||||
========================================================================
|
|
||||||
|
|
||||||
.TGA image format (Truevision Targa)
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
*/
|
|
||||||
#pragma pack( 1 )
|
|
||||||
typedef struct tga_s
|
|
||||||
{
|
|
||||||
byte id_length;
|
|
||||||
byte colormap_type;
|
|
||||||
byte image_type;
|
|
||||||
word colormap_index;
|
|
||||||
word colormap_length;
|
|
||||||
byte colormap_size;
|
|
||||||
word x_origin;
|
|
||||||
word y_origin;
|
|
||||||
word width;
|
|
||||||
word height;
|
|
||||||
byte pixel_size;
|
|
||||||
byte attributes;
|
|
||||||
} tga_t;
|
|
||||||
#pragma pack( )
|
|
||||||
|
|
||||||
/*
|
|
||||||
========================================================================
|
|
||||||
|
|
||||||
.PNG image format (Portable Network Graphics)
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
PNG_CT_GREY,
|
|
||||||
PNG_CT_PALLETE = BIT(0),
|
|
||||||
PNG_CT_RGB = BIT(1),
|
|
||||||
PNG_CT_ALPHA = BIT(2),
|
|
||||||
PNG_CT_RGBA = (PNG_CT_RGB|PNG_CT_ALPHA)
|
|
||||||
} png_colortype;
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
PNG_F_NONE,
|
|
||||||
PNG_F_SUB,
|
|
||||||
PNG_F_UP,
|
|
||||||
PNG_F_AVERAGE,
|
|
||||||
PNG_F_PAETH
|
|
||||||
} png_filter;
|
|
||||||
|
|
||||||
#pragma pack( push, 1 )
|
|
||||||
typedef struct png_ihdr_s
|
|
||||||
{
|
|
||||||
uint width;
|
|
||||||
uint height;
|
|
||||||
byte bitdepth;
|
|
||||||
byte colortype;
|
|
||||||
byte compression;
|
|
||||||
byte filter;
|
|
||||||
byte interlace;
|
|
||||||
} png_ihdr_t;
|
|
||||||
|
|
||||||
typedef struct png_s
|
|
||||||
{
|
|
||||||
byte sign[8];
|
|
||||||
uint ihdr_len;
|
|
||||||
byte ihdr_sign[4];
|
|
||||||
png_ihdr_t ihdr_chunk;
|
|
||||||
uint ihdr_crc32;
|
|
||||||
} png_t;
|
|
||||||
#pragma pack( pop )
|
|
||||||
|
|
||||||
typedef struct png_footer_s
|
|
||||||
{
|
|
||||||
uint idat_crc32;
|
|
||||||
uint iend_len;
|
|
||||||
byte iend_sign[4];
|
|
||||||
uint iend_crc32;
|
|
||||||
} png_footer_t;
|
|
||||||
|
|
||||||
/*
|
|
||||||
========================================================================
|
|
||||||
|
|
||||||
.DDS image format
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
*/
|
|
||||||
#define DDSHEADER ((' '<<24)+('S'<<16)+('D'<<8)+'D') // little-endian "DDS "
|
|
||||||
|
|
||||||
// various four-cc types
|
|
||||||
#define TYPE_DXT1 (('1'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT1"
|
|
||||||
#define TYPE_DXT2 (('2'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT2"
|
|
||||||
#define TYPE_DXT3 (('3'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT3"
|
|
||||||
#define TYPE_DXT4 (('4'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT4"
|
|
||||||
#define TYPE_DXT5 (('5'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT5"
|
|
||||||
#define TYPE_ATI1 (('1'<<24)+('I'<<16)+('T'<<8)+'A') // little-endian "ATI1"
|
|
||||||
#define TYPE_ATI2 (('2'<<24)+('I'<<16)+('T'<<8)+'A') // little-endian "ATI2"
|
|
||||||
#define TYPE_RXGB (('B'<<24)+('G'<<16)+('X'<<8)+'R') // little-endian "RXGB" doom3 normalmaps
|
|
||||||
#define TYPE_$ (('\0'<<24)+('\0'<<16)+('\0'<<8)+'$') // little-endian "$"
|
|
||||||
#define TYPE_o (('\0'<<24)+('\0'<<16)+('\0'<<8)+'o') // little-endian "o"
|
|
||||||
#define TYPE_p (('\0'<<24)+('\0'<<16)+('\0'<<8)+'p') // little-endian "p"
|
|
||||||
#define TYPE_q (('\0'<<24)+('\0'<<16)+('\0'<<8)+'q') // little-endian "q"
|
|
||||||
#define TYPE_r (('\0'<<24)+('\0'<<16)+('\0'<<8)+'r') // little-endian "r"
|
|
||||||
#define TYPE_s (('\0'<<24)+('\0'<<16)+('\0'<<8)+'s') // little-endian "s"
|
|
||||||
#define TYPE_t (('\0'<<24)+('\0'<<16)+('\0'<<8)+'t') // little-endian "t"
|
|
||||||
|
|
||||||
// dwFlags1
|
|
||||||
#define DDS_CAPS 0x00000001L
|
|
||||||
#define DDS_HEIGHT 0x00000002L
|
|
||||||
#define DDS_WIDTH 0x00000004L
|
|
||||||
#define DDS_PITCH 0x00000008L
|
|
||||||
#define DDS_PIXELFORMAT 0x00001000L
|
|
||||||
#define DDS_MIPMAPCOUNT 0x00020000L
|
|
||||||
#define DDS_LINEARSIZE 0x00080000L
|
|
||||||
#define DDS_DEPTH 0x00800000L
|
|
||||||
|
|
||||||
// dwFlags2
|
|
||||||
#define DDS_ALPHAPIXELS 0x00000001L
|
|
||||||
#define DDS_ALPHA 0x00000002L
|
|
||||||
#define DDS_FOURCC 0x00000004L
|
|
||||||
#define DDS_RGB 0x00000040L
|
|
||||||
#define DDS_RGBA 0x00000041L // (DDS_RGB|DDS_ALPHAPIXELS)
|
|
||||||
#define DDS_LUMINANCE 0x00020000L
|
|
||||||
#define DDS_DUDV 0x00080000L
|
|
||||||
|
|
||||||
// dwCaps1
|
|
||||||
#define DDS_COMPLEX 0x00000008L
|
|
||||||
#define DDS_TEXTURE 0x00001000L
|
|
||||||
#define DDS_MIPMAP 0x00400000L
|
|
||||||
|
|
||||||
// dwCaps2
|
|
||||||
#define DDS_CUBEMAP 0x00000200L
|
|
||||||
#define DDS_CUBEMAP_POSITIVEX 0x00000400L
|
|
||||||
#define DDS_CUBEMAP_NEGATIVEX 0x00000800L
|
|
||||||
#define DDS_CUBEMAP_POSITIVEY 0x00001000L
|
|
||||||
#define DDS_CUBEMAP_NEGATIVEY 0x00002000L
|
|
||||||
#define DDS_CUBEMAP_POSITIVEZ 0x00004000L
|
|
||||||
#define DDS_CUBEMAP_NEGATIVEZ 0x00008000L
|
|
||||||
#define DDS_CUBEMAP_ALL_SIDES 0x0000FC00L
|
|
||||||
#define DDS_VOLUME 0x00200000L
|
|
||||||
|
|
||||||
typedef struct dds_pf_s
|
|
||||||
{
|
|
||||||
uint dwSize;
|
|
||||||
uint dwFlags;
|
|
||||||
uint dwFourCC;
|
|
||||||
uint dwRGBBitCount;
|
|
||||||
uint dwRBitMask;
|
|
||||||
uint dwGBitMask;
|
|
||||||
uint dwBBitMask;
|
|
||||||
uint dwABitMask;
|
|
||||||
} dds_pixf_t;
|
|
||||||
|
|
||||||
// DDCAPS2
|
|
||||||
typedef struct dds_caps_s
|
|
||||||
{
|
|
||||||
uint dwCaps1;
|
|
||||||
uint dwCaps2;
|
|
||||||
uint dwCaps3; // currently unused
|
|
||||||
uint dwCaps4; // currently unused
|
|
||||||
} dds_caps_t;
|
|
||||||
|
|
||||||
typedef struct dds_s
|
|
||||||
{
|
|
||||||
uint dwIdent; // must matched with DDSHEADER
|
|
||||||
uint dwSize;
|
|
||||||
uint dwFlags; // determines what fields are valid
|
|
||||||
uint dwHeight;
|
|
||||||
uint dwWidth;
|
|
||||||
uint dwLinearSize; // Formless late-allocated optimized surface size
|
|
||||||
uint dwDepth; // depth if a volume texture
|
|
||||||
uint dwMipMapCount; // number of mip-map levels requested
|
|
||||||
uint dwAlphaBitDepth; // depth of alpha buffer requested
|
|
||||||
uint dwReserved1[10]; // reserved for future expansions
|
|
||||||
dds_pixf_t dsPixelFormat;
|
|
||||||
dds_caps_t dsCaps;
|
|
||||||
uint dwTextureStage;
|
|
||||||
} dds_t;
|
|
||||||
|
|
||||||
// imagelib definitions
|
// imagelib definitions
|
||||||
#define IMAGE_MAXWIDTH 8192
|
#define IMAGE_MAXWIDTH 8192
|
||||||
#define IMAGE_MAXHEIGHT 8192
|
#define IMAGE_MAXHEIGHT 8192
|
||||||
|
|||||||
@@ -14,19 +14,8 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "imagelib.h"
|
#include "imagelib.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
|
#include "img_bmp.h"
|
||||||
#define BI_SIZE 40 //size of bitmap info header.
|
|
||||||
#if !XASH_WIN32
|
|
||||||
#define BI_RGB 0
|
|
||||||
|
|
||||||
typedef struct tagRGBQUAD {
|
|
||||||
BYTE rgbBlue;
|
|
||||||
BYTE rgbGreen;
|
|
||||||
BYTE rgbRed;
|
|
||||||
BYTE rgbReserved;
|
|
||||||
} RGBQUAD;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
@@ -36,14 +25,19 @@ Image_LoadBMP
|
|||||||
qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesize )
|
qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesize )
|
||||||
{
|
{
|
||||||
byte *buf_p, *pixbuf;
|
byte *buf_p, *pixbuf;
|
||||||
byte palette[256][4];
|
rgba_t palette[256];
|
||||||
int i, columns, column, rows, row, bpp = 1;
|
int i, columns, column, rows, row, bpp = 1;
|
||||||
int cbPalBytes = 0, padSize = 0, bps = 0;
|
int cbPalBytes = 0, padSize = 0, bps = 0;
|
||||||
int reflectivity[3] = { 0, 0, 0 };
|
int reflectivity[3] = { 0, 0, 0 };
|
||||||
qboolean load_qfont = false;
|
qboolean load_qfont = false;
|
||||||
bmp_t bhdr;
|
bmp_t bhdr;
|
||||||
|
fs_offset_t estimatedSize;
|
||||||
|
|
||||||
if( filesize < sizeof( bhdr )) return false;
|
if( filesize < sizeof( bhdr ))
|
||||||
|
{
|
||||||
|
Con_Reportf( S_ERROR "Image_LoadBMP: %s have incorrect file size %li should be greater than %li (header)\n", name, filesize, sizeof( bhdr ) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
buf_p = (byte *)buffer;
|
buf_p = (byte *)buffer;
|
||||||
memcpy( &bhdr, buf_p, sizeof( bmp_t ));
|
memcpy( &bhdr, buf_p, sizeof( bmp_t ));
|
||||||
@@ -103,9 +97,16 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
if( bhdr.colors == 0 )
|
if( bhdr.colors == 0 )
|
||||||
{
|
{
|
||||||
bhdr.colors = 256;
|
bhdr.colors = 256;
|
||||||
cbPalBytes = ( 1 << bhdr.bitsPerPixel ) * sizeof( RGBQUAD );
|
cbPalBytes = ( 1 << bhdr.bitsPerPixel ) * sizeof( rgba_t );
|
||||||
}
|
}
|
||||||
else cbPalBytes = bhdr.colors * sizeof( RGBQUAD );
|
else cbPalBytes = bhdr.colors * sizeof( rgba_t );
|
||||||
|
}
|
||||||
|
|
||||||
|
estimatedSize = ( buf_p - buffer ) + cbPalBytes;
|
||||||
|
if( filesize < estimatedSize )
|
||||||
|
{
|
||||||
|
Con_Reportf( S_ERROR "Image_LoadBMP: %s have incorrect file size %li should be greater than %li (palette)\n", name, filesize, estimatedSize );
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy( palette, buf_p, cbPalBytes );
|
memcpy( palette, buf_p, cbPalBytes );
|
||||||
@@ -154,8 +155,6 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf_p += cbPalBytes;
|
buf_p += cbPalBytes;
|
||||||
image.size = image.width * image.height * bpp;
|
|
||||||
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
|
||||||
bps = image.width * (bhdr.bitsPerPixel >> 3);
|
bps = image.width * (bhdr.bitsPerPixel >> 3);
|
||||||
|
|
||||||
switch( bhdr.bitsPerPixel )
|
switch( bhdr.bitsPerPixel )
|
||||||
@@ -175,6 +174,22 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
estimatedSize = ( buf_p - buffer ) + ( image.width + padSize ) * image.height * ( bhdr.bitsPerPixel >> 3 );
|
||||||
|
if( filesize < estimatedSize )
|
||||||
|
{
|
||||||
|
if( image.palette )
|
||||||
|
{
|
||||||
|
Mem_Free( image.palette );
|
||||||
|
image.palette = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Con_Reportf( S_ERROR "Image_LoadBMP: %s have incorrect file size %li should be greater than %li (pixels)\n", name, filesize, estimatedSize );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
image.size = image.width * image.height * bpp;
|
||||||
|
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
||||||
|
|
||||||
for( row = rows - 1; row >= 0; row-- )
|
for( row = rows - 1; row >= 0; row-- )
|
||||||
{
|
{
|
||||||
pixbuf = image.rgba + (row * columns * bpp);
|
pixbuf = image.rgba + (row * columns * bpp);
|
||||||
@@ -308,7 +323,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
|
|||||||
{
|
{
|
||||||
file_t *pfile = NULL;
|
file_t *pfile = NULL;
|
||||||
size_t total_size, cur_size;
|
size_t total_size, cur_size;
|
||||||
RGBQUAD rgrgbPalette[256];
|
rgba_t rgrgbPalette[256];
|
||||||
dword cbBmpBits;
|
dword cbBmpBits;
|
||||||
byte *clipbuf = NULL;
|
byte *clipbuf = NULL;
|
||||||
byte *pb, *pbBmpBits;
|
byte *pb, *pbBmpBits;
|
||||||
@@ -349,12 +364,13 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
|
|||||||
// after create sprite or lump image, it's just standard requiriments
|
// after create sprite or lump image, it's just standard requiriments
|
||||||
biTrueWidth = ((pix->width + 3) & ~3);
|
biTrueWidth = ((pix->width + 3) & ~3);
|
||||||
cbBmpBits = biTrueWidth * pix->height * pixel_size;
|
cbBmpBits = biTrueWidth * pix->height * pixel_size;
|
||||||
cbPalBytes = ( pixel_size == 1 ) ? 256 * sizeof( RGBQUAD ) : 0;
|
cbPalBytes = ( pixel_size == 1 ) ? 256 * sizeof( rgba_t ) : 0;
|
||||||
|
|
||||||
// Bogus file header check
|
// Bogus file header check
|
||||||
hdr.id[0] = 'B';
|
hdr.id[0] = 'B';
|
||||||
hdr.id[1] = 'M';
|
hdr.id[1] = 'M';
|
||||||
hdr.fileSize = sizeof( hdr ) + cbBmpBits + cbPalBytes;
|
hdr.fileSize = sizeof( hdr ) + cbBmpBits + cbPalBytes;
|
||||||
|
hdr.reserved0 = 0;
|
||||||
hdr.bitmapDataOffset = sizeof( hdr ) + cbPalBytes;
|
hdr.bitmapDataOffset = sizeof( hdr ) + cbPalBytes;
|
||||||
hdr.bitmapHeaderSize = BI_SIZE;
|
hdr.bitmapHeaderSize = BI_SIZE;
|
||||||
hdr.width = biTrueWidth;
|
hdr.width = biTrueWidth;
|
||||||
@@ -379,15 +395,15 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
|
|||||||
// copy over used entries
|
// copy over used entries
|
||||||
for( i = 0; i < (int)hdr.colors; i++ )
|
for( i = 0; i < (int)hdr.colors; i++ )
|
||||||
{
|
{
|
||||||
rgrgbPalette[i].rgbRed = *pb++;
|
rgrgbPalette[i][2] = *pb++;
|
||||||
rgrgbPalette[i].rgbGreen = *pb++;
|
rgrgbPalette[i][1] = *pb++;
|
||||||
rgrgbPalette[i].rgbBlue = *pb++;
|
rgrgbPalette[i][0] = *pb++;
|
||||||
|
|
||||||
// bmp feature - can store 32-bit palette if present
|
// bmp feature - can store 32-bit palette if present
|
||||||
// some viewers e.g. fimg.exe can show alpha-chanell for it
|
// some viewers e.g. fimg.exe can show alpha-chanell for it
|
||||||
if( pix->type == PF_INDEXED_32 )
|
if( pix->type == PF_INDEXED_32 )
|
||||||
rgrgbPalette[i].rgbReserved = *pb++;
|
rgrgbPalette[i][3] = *pb++;
|
||||||
else rgrgbPalette[i].rgbReserved = 0;
|
else rgrgbPalette[i][3] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// write palette
|
// write palette
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
img_bmp.h - bmp format reference
|
||||||
|
Copyright (C) 2007 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 IMG_BMP_H
|
||||||
|
#define IMG_BMP_H
|
||||||
|
/*
|
||||||
|
========================================================================
|
||||||
|
|
||||||
|
.BMP image format
|
||||||
|
|
||||||
|
========================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BI_SIZE 40 // size of bitmap info header.
|
||||||
|
#if !defined(BI_RGB)
|
||||||
|
#define BI_RGB 0 // uncompressed RGB bitmap(defined in wingdi.h)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#pragma pack( push, 1 )
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int8_t id[2]; // bmfh.bfType
|
||||||
|
uint32_t fileSize; // bmfh.bfSize
|
||||||
|
uint32_t reserved0; // bmfh.bfReserved1 + bmfh.bfReserved2
|
||||||
|
uint32_t bitmapDataOffset; // bmfh.bfOffBits
|
||||||
|
uint32_t bitmapHeaderSize; // bmih.biSize
|
||||||
|
int32_t width; // bmih.biWidth
|
||||||
|
int32_t height; // bmih.biHeight
|
||||||
|
uint16_t planes; // bmih.biPlanes
|
||||||
|
uint16_t bitsPerPixel; // bmih.biBitCount
|
||||||
|
uint32_t compression; // bmih.biCompression
|
||||||
|
uint32_t bitmapDataSize; // bmih.biSizeImage
|
||||||
|
uint32_t hRes; // bmih.biXPelsPerMeter
|
||||||
|
uint32_t vRes; // bmih.biYPelsPerMeter
|
||||||
|
uint32_t colors; // bmih.biClrUsed
|
||||||
|
uint32_t importantColors; // bmih.biClrImportant
|
||||||
|
} bmp_t;
|
||||||
|
#pragma pack( pop )
|
||||||
|
#endif // IMG_BMP_H
|
||||||
|
|
||||||
@@ -14,7 +14,8 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "imagelib.h"
|
#include "imagelib.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
|
#include "img_dds.h"
|
||||||
|
|
||||||
qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
|
||||||
{
|
{
|
||||||
@@ -106,11 +107,13 @@ void Image_DXTGetPixelFormat( dds_t *hdr )
|
|||||||
break;
|
break;
|
||||||
case TYPE_DXT2:
|
case TYPE_DXT2:
|
||||||
image.flags &= ~IMAGE_HAS_ALPHA; // alpha is already premultiplied by color
|
image.flags &= ~IMAGE_HAS_ALPHA; // alpha is already premultiplied by color
|
||||||
|
// intentionally fallthrough
|
||||||
case TYPE_DXT3:
|
case TYPE_DXT3:
|
||||||
image.type = PF_DXT3;
|
image.type = PF_DXT3;
|
||||||
break;
|
break;
|
||||||
case TYPE_DXT4:
|
case TYPE_DXT4:
|
||||||
image.flags &= ~IMAGE_HAS_ALPHA; // alpha is already premultiplied by color
|
image.flags &= ~IMAGE_HAS_ALPHA; // alpha is already premultiplied by color
|
||||||
|
// intentionally fallthrough
|
||||||
case TYPE_DXT5:
|
case TYPE_DXT5:
|
||||||
image.type = PF_DXT5;
|
image.type = PF_DXT5;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
img_dds.h - dds format reference
|
||||||
|
Copyright (C) 2015 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 IMG_DDS_H
|
||||||
|
#define IMG_DDS_H
|
||||||
|
/*
|
||||||
|
========================================================================
|
||||||
|
|
||||||
|
.DDS image format
|
||||||
|
|
||||||
|
========================================================================
|
||||||
|
*/
|
||||||
|
#define DDSHEADER ((' '<<24)+('S'<<16)+('D'<<8)+'D') // little-endian "DDS "
|
||||||
|
|
||||||
|
// various four-cc types
|
||||||
|
#define TYPE_DXT1 (('1'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT1"
|
||||||
|
#define TYPE_DXT2 (('2'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT2"
|
||||||
|
#define TYPE_DXT3 (('3'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT3"
|
||||||
|
#define TYPE_DXT4 (('4'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT4"
|
||||||
|
#define TYPE_DXT5 (('5'<<24)+('T'<<16)+('X'<<8)+'D') // little-endian "DXT5"
|
||||||
|
#define TYPE_ATI1 (('1'<<24)+('I'<<16)+('T'<<8)+'A') // little-endian "ATI1"
|
||||||
|
#define TYPE_ATI2 (('2'<<24)+('I'<<16)+('T'<<8)+'A') // little-endian "ATI2"
|
||||||
|
#define TYPE_RXGB (('B'<<24)+('G'<<16)+('X'<<8)+'R') // little-endian "RXGB" doom3 normalmaps
|
||||||
|
#define TYPE_$ (('\0'<<24)+('\0'<<16)+('\0'<<8)+'$') // little-endian "$"
|
||||||
|
#define TYPE_o (('\0'<<24)+('\0'<<16)+('\0'<<8)+'o') // little-endian "o"
|
||||||
|
#define TYPE_p (('\0'<<24)+('\0'<<16)+('\0'<<8)+'p') // little-endian "p"
|
||||||
|
#define TYPE_q (('\0'<<24)+('\0'<<16)+('\0'<<8)+'q') // little-endian "q"
|
||||||
|
#define TYPE_r (('\0'<<24)+('\0'<<16)+('\0'<<8)+'r') // little-endian "r"
|
||||||
|
#define TYPE_s (('\0'<<24)+('\0'<<16)+('\0'<<8)+'s') // little-endian "s"
|
||||||
|
#define TYPE_t (('\0'<<24)+('\0'<<16)+('\0'<<8)+'t') // little-endian "t"
|
||||||
|
|
||||||
|
// dwFlags1
|
||||||
|
#define DDS_CAPS 0x00000001L
|
||||||
|
#define DDS_HEIGHT 0x00000002L
|
||||||
|
#define DDS_WIDTH 0x00000004L
|
||||||
|
#define DDS_PITCH 0x00000008L
|
||||||
|
#define DDS_PIXELFORMAT 0x00001000L
|
||||||
|
#define DDS_MIPMAPCOUNT 0x00020000L
|
||||||
|
#define DDS_LINEARSIZE 0x00080000L
|
||||||
|
#define DDS_DEPTH 0x00800000L
|
||||||
|
|
||||||
|
// dwFlags2
|
||||||
|
#define DDS_ALPHAPIXELS 0x00000001L
|
||||||
|
#define DDS_ALPHA 0x00000002L
|
||||||
|
#define DDS_FOURCC 0x00000004L
|
||||||
|
#define DDS_RGB 0x00000040L
|
||||||
|
#define DDS_RGBA 0x00000041L // (DDS_RGB|DDS_ALPHAPIXELS)
|
||||||
|
#define DDS_LUMINANCE 0x00020000L
|
||||||
|
#define DDS_DUDV 0x00080000L
|
||||||
|
|
||||||
|
// dwCaps1
|
||||||
|
#define DDS_COMPLEX 0x00000008L
|
||||||
|
#define DDS_TEXTURE 0x00001000L
|
||||||
|
#define DDS_MIPMAP 0x00400000L
|
||||||
|
|
||||||
|
// dwCaps2
|
||||||
|
#define DDS_CUBEMAP 0x00000200L
|
||||||
|
#define DDS_CUBEMAP_POSITIVEX 0x00000400L
|
||||||
|
#define DDS_CUBEMAP_NEGATIVEX 0x00000800L
|
||||||
|
#define DDS_CUBEMAP_POSITIVEY 0x00001000L
|
||||||
|
#define DDS_CUBEMAP_NEGATIVEY 0x00002000L
|
||||||
|
#define DDS_CUBEMAP_POSITIVEZ 0x00004000L
|
||||||
|
#define DDS_CUBEMAP_NEGATIVEZ 0x00008000L
|
||||||
|
#define DDS_CUBEMAP_ALL_SIDES 0x0000FC00L
|
||||||
|
#define DDS_VOLUME 0x00200000L
|
||||||
|
|
||||||
|
typedef struct dds_pf_s
|
||||||
|
{
|
||||||
|
uint32_t dwSize;
|
||||||
|
uint32_t dwFlags;
|
||||||
|
uint32_t dwFourCC;
|
||||||
|
uint32_t dwRGBBitCount;
|
||||||
|
uint32_t dwRBitMask;
|
||||||
|
uint32_t dwGBitMask;
|
||||||
|
uint32_t dwBBitMask;
|
||||||
|
uint32_t dwABitMask;
|
||||||
|
} dds_pixf_t;
|
||||||
|
|
||||||
|
// DDCAPS2
|
||||||
|
typedef struct dds_caps_s
|
||||||
|
{
|
||||||
|
uint32_t dwCaps1;
|
||||||
|
uint32_t dwCaps2;
|
||||||
|
uint32_t dwCaps3; // currently unused
|
||||||
|
uint32_t dwCaps4; // currently unused
|
||||||
|
} dds_caps_t;
|
||||||
|
|
||||||
|
typedef struct dds_s
|
||||||
|
{
|
||||||
|
uint32_t dwIdent; // must matched with DDSHEADER
|
||||||
|
uint32_t dwSize;
|
||||||
|
uint32_t dwFlags; // determines what fields are valid
|
||||||
|
uint32_t dwHeight;
|
||||||
|
uint32_t dwWidth;
|
||||||
|
uint32_t dwLinearSize; // Formless late-allocated optimized surface size
|
||||||
|
uint32_t dwDepth; // depth if a volume texture
|
||||||
|
uint32_t dwMipMapCount; // number of mip-map levels requested
|
||||||
|
uint32_t dwAlphaBitDepth; // depth of alpha buffer requested
|
||||||
|
uint32_t dwReserved1[10]; // reserved for future expansions
|
||||||
|
dds_pixf_t dsPixelFormat;
|
||||||
|
dds_caps_t dsCaps;
|
||||||
|
uint32_t dwTextureStage;
|
||||||
|
} dds_t;
|
||||||
|
#endif // IMG_DDS_H
|
||||||
|
|
||||||
@@ -13,6 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
#include "imagelib.h"
|
#include "imagelib.h"
|
||||||
|
|
||||||
// global image variables
|
// global image variables
|
||||||
@@ -70,7 +71,7 @@ static const cubepack_t load_cubemap[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
// soul of ImageLib - table of image format constants
|
// soul of ImageLib - table of image format constants
|
||||||
const bpc_desc_t PFDesc[] =
|
const bpc_desc_t PFDesc[PF_TOTALCOUNT] =
|
||||||
{
|
{
|
||||||
{ PF_UNKNOWN, "raw", 0x1908, 0 },
|
{ PF_UNKNOWN, "raw", 0x1908, 0 },
|
||||||
{ PF_INDEXED_24, "pal 24", 0x1908, 1 },
|
{ PF_INDEXED_24, "pal 24", 0x1908, 1 },
|
||||||
@@ -84,6 +85,8 @@ const bpc_desc_t PFDesc[] =
|
|||||||
{ PF_DXT3, "DXT 3", 0x83F2, 4 },
|
{ PF_DXT3, "DXT 3", 0x83F2, 4 },
|
||||||
{ PF_DXT5, "DXT 5", 0x83F3, 4 },
|
{ PF_DXT5, "DXT 5", 0x83F3, 4 },
|
||||||
{ PF_ATI2, "ATI 2", 0x8837, 4 },
|
{ PF_ATI2, "ATI 2", 0x8837, 4 },
|
||||||
|
{ PF_RGBA_64, "RGBA 64", 0x1908, 8 },
|
||||||
|
{ PF_RGB_48, "RGB 48", 0x1908, 6 },
|
||||||
};
|
};
|
||||||
|
|
||||||
void Image_Reset( void )
|
void Image_Reset( void )
|
||||||
@@ -275,7 +278,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
|
|||||||
if( anyformat || !Q_stricmp( ext, format->ext ))
|
if( anyformat || !Q_stricmp( ext, format->ext ))
|
||||||
{
|
{
|
||||||
Q_sprintf( path, format->formatstring, loadname, cmap->type[i].suf, format->ext );
|
Q_sprintf( path, format->formatstring, loadname, cmap->type[i].suf, format->ext );
|
||||||
image.hint = cmap->type[i].hint; // side hint
|
image.hint = (image_hint_t)cmap->type[i].hint; // side hint
|
||||||
|
|
||||||
f = FS_LoadFile( path, &filesize, false );
|
f = FS_LoadFile( path, &filesize, false );
|
||||||
if( f && filesize > 0 )
|
if( f && filesize > 0 )
|
||||||
@@ -491,3 +494,78 @@ rgbdata_t *FS_CopyImage( rgbdata_t *in )
|
|||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
|
static void GeneratePixel( byte *pix, uint i, uint j, uint w, uint h, qboolean genAlpha )
|
||||||
|
{
|
||||||
|
double x = ( j / (double)w ) - 0.5;
|
||||||
|
double y = ( i / (double)h ) - 0.5;
|
||||||
|
double d = sqrt( x * x + y * y );
|
||||||
|
pix[0] = (byte)(( sin( d * 30.0 ) + 1.0 ) * 126 );
|
||||||
|
pix[1] = (byte)(( sin( d * 27.723 ) + 1.0 ) * 126 );
|
||||||
|
pix[2] = (byte)(( sin( d * 42.41 ) + 1.0 ) * 126 );
|
||||||
|
pix[3] = genAlpha ? (byte)(( cos( d * 2.0 ) + 1.0 ) * 126 ) : 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Test_CheckImage( const char *name, rgbdata_t *rgb )
|
||||||
|
{
|
||||||
|
rgbdata_t *load;
|
||||||
|
|
||||||
|
// test reading
|
||||||
|
load = FS_LoadImage( name, NULL, 0 );
|
||||||
|
TASSERT( load->width == rgb->width )
|
||||||
|
TASSERT( load->height == rgb->height )
|
||||||
|
TASSERT( load->type == rgb->type )
|
||||||
|
TASSERT( ( load->flags & rgb->flags ) != 0 )
|
||||||
|
TASSERT( load->size == rgb->size )
|
||||||
|
TASSERT( memcmp(load->buffer, rgb->buffer, rgb->size ) == 0 )
|
||||||
|
|
||||||
|
Mem_Free( load );
|
||||||
|
}
|
||||||
|
|
||||||
|
void Test_RunImagelib( void )
|
||||||
|
{
|
||||||
|
rgbdata_t rgb = { 0 };
|
||||||
|
byte *buf;
|
||||||
|
const char *extensions[] = { "tga", "png", "bmp" };
|
||||||
|
uint i, j;
|
||||||
|
|
||||||
|
Image_Setup();
|
||||||
|
|
||||||
|
// generate image
|
||||||
|
rgb.width = 256;
|
||||||
|
rgb.height = 512;
|
||||||
|
rgb.type = PF_RGBA_32;
|
||||||
|
rgb.flags = IMAGE_HAS_ALPHA;
|
||||||
|
rgb.size = rgb.width * rgb.height * 4;
|
||||||
|
buf = rgb.buffer = Z_Malloc( rgb.size );
|
||||||
|
|
||||||
|
for( i = 0; i < rgb.height; i++ )
|
||||||
|
{
|
||||||
|
for( j = 0; j < rgb.width; j++ )
|
||||||
|
{
|
||||||
|
GeneratePixel( buf, i, j, rgb.width, rgb.height, true );
|
||||||
|
buf += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < sizeof(extensions) / sizeof(extensions[0]); i++ )
|
||||||
|
{
|
||||||
|
const char *name = va( "test_gen.%s", extensions[i] );
|
||||||
|
|
||||||
|
// test saving
|
||||||
|
qboolean ret = FS_SaveImage( name, &rgb );
|
||||||
|
Con_Printf( "Checking if we can save images in '%s' format...\n", extensions[i] );
|
||||||
|
ASSERT(ret == true);
|
||||||
|
|
||||||
|
// test reading
|
||||||
|
Con_Printf( "Checking if we can read images in '%s' format...\n", extensions[i] );
|
||||||
|
Test_CheckImage( name, &rgb );
|
||||||
|
}
|
||||||
|
|
||||||
|
Z_Free( rgb.buffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* XASH_ENGINE_TESTS */
|
||||||
|
|||||||
@@ -16,9 +16,13 @@ GNU General Public License for more details.
|
|||||||
#define MINIZ_HEADER_FILE_ONLY
|
#define MINIZ_HEADER_FILE_ONLY
|
||||||
#include "miniz.h"
|
#include "miniz.h"
|
||||||
#include "imagelib.h"
|
#include "imagelib.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#if !XASH_WIN32
|
#include "img_png.h"
|
||||||
#include <netinet/in.h>
|
|
||||||
|
#if defined(XASH_NO_NETWORK)
|
||||||
|
#include "platform/stub/net_stub.h"
|
||||||
|
#elif !XASH_WIN32
|
||||||
|
#include <netinet/in.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char png_sign[] = {0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n'};
|
static const char png_sign[] = {0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n'};
|
||||||
@@ -36,9 +40,9 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
short p, a, b, c, pa, pb, pc;
|
short p, a, b, c, pa, pb, pc;
|
||||||
byte *buf_p, *pixbuf, *raw, *prior, *idat_buf = NULL, *uncompressed_buffer = NULL, *rowend;
|
byte *buf_p, *pixbuf, *raw, *prior, *idat_buf = NULL, *uncompressed_buffer = NULL;
|
||||||
uint chunk_len, crc32, crc32_check, oldsize = 0, newsize, rowsize;
|
uint chunk_len, crc32, crc32_check, oldsize = 0, newsize = 0, rowsize;
|
||||||
uint uncompressed_size, pixel_size, i, y, filter_type, chunk_sign;
|
uint uncompressed_size, pixel_size, i, y, filter_type, chunk_sign, channel_size;
|
||||||
qboolean has_iend_chunk = false;
|
qboolean has_iend_chunk = false;
|
||||||
z_stream stream = {0};
|
z_stream stream = {0};
|
||||||
png_t png_hdr;
|
png_t png_hdr;
|
||||||
@@ -85,9 +89,9 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( png_hdr.ihdr_chunk.bitdepth != 8 )
|
if( png_hdr.ihdr_chunk.bitdepth != 8 && png_hdr.ihdr_chunk.bitdepth != 16 )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_WARN "Image_LoadPNG: Only 8-bit images is supported (%s)\n", name );
|
Con_DPrintf( S_WARN "Image_LoadPNG: Only 8-bit or 16-bit images is supported (%s)\n", name );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,6 +205,7 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "Image_LoadPNG: IEND chunk has wrong size (%s)\n", name );
|
Con_DPrintf( S_ERROR "Image_LoadPNG: IEND chunk has wrong size (%s)\n", name );
|
||||||
Mem_Free( idat_buf );
|
Mem_Free( idat_buf );
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( oldsize == 0 )
|
if( oldsize == 0 )
|
||||||
@@ -217,18 +222,35 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
case PNG_CT_RGBA:
|
case PNG_CT_RGBA:
|
||||||
pixel_size = 4;
|
pixel_size = 4;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
pixel_size = 0; // make compiler happy
|
||||||
|
ASSERT( false );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
image.type = PF_RGBA_32; // always exctracted to 32-bit buffer
|
if( png_hdr.ihdr_chunk.bitdepth == 8 )
|
||||||
|
{
|
||||||
|
image.type = PF_RGBA_32; // always exctracted to 32-bit buffer
|
||||||
|
channel_size = 1;
|
||||||
|
}
|
||||||
|
else // if( png_hdr.ihdr_chunk.bitdepth == 16 )
|
||||||
|
{
|
||||||
|
image.type = PF_RGBA_64;
|
||||||
|
channel_size = 2;
|
||||||
|
}
|
||||||
image.width = png_hdr.ihdr_chunk.width;
|
image.width = png_hdr.ihdr_chunk.width;
|
||||||
image.height = png_hdr.ihdr_chunk.height;
|
image.height = png_hdr.ihdr_chunk.height;
|
||||||
image.size = image.height * image.width * 4;
|
image.size = image.height * image.width * channel_size * 4;
|
||||||
image.flags |= IMAGE_HAS_ALPHA | IMAGE_HAS_COLOR;
|
image.flags |= IMAGE_HAS_COLOR;
|
||||||
|
|
||||||
|
if( png_hdr.ihdr_chunk.colortype == PNG_CT_RGBA )
|
||||||
|
image.flags |= IMAGE_HAS_ALPHA;
|
||||||
|
|
||||||
image.depth = 1;
|
image.depth = 1;
|
||||||
|
|
||||||
rowsize = pixel_size * image.width;
|
rowsize = pixel_size * image.width;
|
||||||
|
|
||||||
uncompressed_size = image.height * ( rowsize + 1 ); // +1 for filter
|
uncompressed_size = image.height * ( rowsize * channel_size + 1 ); // +1 for filter
|
||||||
uncompressed_buffer = Mem_Malloc( host.imagepool, uncompressed_size );
|
uncompressed_buffer = Mem_Malloc( host.imagepool, uncompressed_size );
|
||||||
|
|
||||||
stream.next_in = idat_buf;
|
stream.next_in = idat_buf;
|
||||||
@@ -266,6 +288,9 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
if( png_hdr.ihdr_chunk.colortype == PNG_CT_RGB )
|
if( png_hdr.ihdr_chunk.colortype == PNG_CT_RGB )
|
||||||
prior = pixbuf = raw;
|
prior = pixbuf = raw;
|
||||||
|
|
||||||
|
rowsize *= channel_size;
|
||||||
|
pixel_size *= channel_size;
|
||||||
|
|
||||||
filter_type = *raw++;
|
filter_type = *raw++;
|
||||||
|
|
||||||
// decode adaptive filter
|
// decode adaptive filter
|
||||||
@@ -371,19 +396,38 @@ qboolean Image_LoadPNG( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
pixbuf = image.rgba;
|
pixbuf = image.rgba;
|
||||||
raw = uncompressed_buffer;
|
raw = uncompressed_buffer;
|
||||||
|
|
||||||
for( y = 0; y < image.height; y++ )
|
for( y = 0; y < image.height * image.width; y++, raw += pixel_size )
|
||||||
{
|
{
|
||||||
rowend = raw + rowsize;
|
*pixbuf++ = raw[0];
|
||||||
for( ; raw < rowend; raw += pixel_size )
|
*pixbuf++ = raw[1];
|
||||||
|
*pixbuf++ = raw[2];
|
||||||
|
if( channel_size == 1 )
|
||||||
{
|
{
|
||||||
*pixbuf++ = raw[0];
|
*pixbuf++ = 0xFF;
|
||||||
*pixbuf++ = raw[1];
|
}
|
||||||
*pixbuf++ = raw[2];
|
else
|
||||||
|
{
|
||||||
|
*pixbuf++ = raw[3];
|
||||||
|
*pixbuf++ = raw[4];
|
||||||
|
*pixbuf++ = raw[5];
|
||||||
|
*pixbuf++ = 0xFF;
|
||||||
*pixbuf++ = 0xFF;
|
*pixbuf++ = 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if XASH_LITTLE_ENDIAN
|
||||||
|
if( channel_size == 2 )
|
||||||
|
{
|
||||||
|
pixbuf = image.rgba;
|
||||||
|
for( y = 0; y < image.height * image.width * 4; y++, pixbuf += 2 )
|
||||||
|
{
|
||||||
|
uint16_t val = *(uint16_t*)pixbuf;
|
||||||
|
*(uint16_t*)pixbuf = ntohs( val );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* XASH_LITTLE_ENDIAN */
|
||||||
|
|
||||||
Mem_Free( uncompressed_buffer );
|
Mem_Free( uncompressed_buffer );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -407,17 +451,17 @@ qboolean Image_SavePNG( const char *name, rgbdata_t *pix )
|
|||||||
if( FS_FileExists( name, false ) && !Image_CheckFlag( IL_ALLOW_OVERWRITE ))
|
if( FS_FileExists( name, false ) && !Image_CheckFlag( IL_ALLOW_OVERWRITE ))
|
||||||
return false; // already existed
|
return false; // already existed
|
||||||
|
|
||||||
|
// bogus parameter check
|
||||||
if( !pix->buffer )
|
if( !pix->buffer )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// get image description
|
||||||
switch( pix->type )
|
switch( pix->type )
|
||||||
{
|
{
|
||||||
case PF_RGB_24:
|
case PF_BGR_24:
|
||||||
pixel_size = 3;
|
case PF_RGB_24: pixel_size = 3; break;
|
||||||
break;
|
case PF_BGRA_32:
|
||||||
case PF_RGBA_32:
|
case PF_RGBA_32: pixel_size = 4; break;
|
||||||
pixel_size = 4;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -428,19 +472,48 @@ qboolean Image_SavePNG( const char *name, rgbdata_t *pix )
|
|||||||
filtered_size = ( rowsize + 1 ) * pix->height;
|
filtered_size = ( rowsize + 1 ) * pix->height;
|
||||||
|
|
||||||
out = filtered_buffer = Mem_Malloc( host.imagepool, filtered_size );
|
out = filtered_buffer = Mem_Malloc( host.imagepool, filtered_size );
|
||||||
in = pix->buffer;
|
|
||||||
|
|
||||||
// apply adaptive filter to image
|
// apply adaptive filter to image
|
||||||
for( y = 0; y < pix->height; y++ )
|
switch( pix->type )
|
||||||
{
|
{
|
||||||
*out++ = PNG_F_NONE;
|
case PF_RGB_24:
|
||||||
rowend = in + rowsize;
|
case PF_RGBA_32:
|
||||||
for( ; in < rowend; )
|
for( y = 0; y < pix->height; y++ )
|
||||||
{
|
{
|
||||||
*out++ = *in++;
|
in = pix->buffer + y * pix->width * pixel_size;
|
||||||
|
*out++ = PNG_F_NONE;
|
||||||
|
rowend = in + rowsize;
|
||||||
|
for( ; in < rowend; in += pixel_size )
|
||||||
|
{
|
||||||
|
*out++ = in[0];
|
||||||
|
*out++ = in[1];
|
||||||
|
*out++ = in[2];
|
||||||
|
if( pix->flags & IMAGE_HAS_ALPHA )
|
||||||
|
*out++ = in[3];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case PF_BGR_24:
|
||||||
|
case PF_BGRA_32:
|
||||||
|
for( y = 0; y < pix->height; y++ )
|
||||||
|
{
|
||||||
|
in = pix->buffer + y * pix->width * pixel_size;
|
||||||
|
*out++ = PNG_F_NONE;
|
||||||
|
rowend = in + rowsize;
|
||||||
|
for( ; in < rowend; in += pixel_size )
|
||||||
|
{
|
||||||
|
*out++ = in[2];
|
||||||
|
*out++ = in[1];
|
||||||
|
*out++ = in[0];
|
||||||
|
if( pix->flags & IMAGE_HAS_ALPHA )
|
||||||
|
*out++ = in[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// get IHDR chunk length
|
// get IHDR chunk length
|
||||||
ihdr_len = sizeof( png_ihdr_t );
|
ihdr_len = sizeof( png_ihdr_t );
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
img_png.h - png format reference
|
||||||
|
Copyright (C) 2019 Andrey Akhmichin
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
#ifndef IMG_PNG_H
|
||||||
|
#define IMG_PNG_H
|
||||||
|
/*
|
||||||
|
========================================================================
|
||||||
|
|
||||||
|
.PNG image format (Portable Network Graphics)
|
||||||
|
|
||||||
|
========================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum png_colortype
|
||||||
|
{
|
||||||
|
PNG_CT_GREY,
|
||||||
|
PNG_CT_PALLETE = BIT(0),
|
||||||
|
PNG_CT_RGB = BIT(1),
|
||||||
|
PNG_CT_ALPHA = BIT(2),
|
||||||
|
PNG_CT_RGBA = (PNG_CT_RGB|PNG_CT_ALPHA)
|
||||||
|
};
|
||||||
|
|
||||||
|
enum png_filter
|
||||||
|
{
|
||||||
|
PNG_F_NONE,
|
||||||
|
PNG_F_SUB,
|
||||||
|
PNG_F_UP,
|
||||||
|
PNG_F_AVERAGE,
|
||||||
|
PNG_F_PAETH
|
||||||
|
};
|
||||||
|
|
||||||
|
#pragma pack( push, 1 )
|
||||||
|
typedef struct png_ihdr_s
|
||||||
|
{
|
||||||
|
uint32_t width;
|
||||||
|
uint32_t height;
|
||||||
|
uint8_t bitdepth;
|
||||||
|
uint8_t colortype;
|
||||||
|
uint8_t compression;
|
||||||
|
uint8_t filter;
|
||||||
|
uint8_t interlace;
|
||||||
|
} png_ihdr_t;
|
||||||
|
|
||||||
|
typedef struct png_s
|
||||||
|
{
|
||||||
|
uint8_t sign[8];
|
||||||
|
uint32_t ihdr_len;
|
||||||
|
uint8_t ihdr_sign[4];
|
||||||
|
png_ihdr_t ihdr_chunk;
|
||||||
|
uint32_t ihdr_crc32;
|
||||||
|
} png_t;
|
||||||
|
|
||||||
|
typedef struct png_footer_s
|
||||||
|
{
|
||||||
|
uint32_t idat_crc32;
|
||||||
|
uint32_t iend_len;
|
||||||
|
uint8_t iend_sign[4];
|
||||||
|
uint32_t iend_crc32;
|
||||||
|
} png_footer_t;
|
||||||
|
#pragma pack( pop )
|
||||||
|
#endif // IMG_PNG_H
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ int contest( int r, int g, int b )
|
|||||||
// finds best neuron (min dist-bias) and returns position
|
// finds best neuron (min dist-bias) and returns position
|
||||||
// for frequently chosen neurons, freq[i] is high and bias[i] is negative
|
// for frequently chosen neurons, freq[i] is high and bias[i] is negative
|
||||||
// bias[i] = gamma * ((1 / netsize) - freq[i])
|
// bias[i] = gamma * ((1 / netsize) - freq[i])
|
||||||
bestd = ~(1<<31);
|
bestd = INT_MAX;
|
||||||
bestbiasd = bestd;
|
bestbiasd = bestd;
|
||||||
bestpos = -1;
|
bestpos = -1;
|
||||||
bestbiaspos = bestpos;
|
bestbiaspos = bestpos;
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "imagelib.h"
|
#include "imagelib.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
|
#include "img_tga.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
@@ -25,7 +26,8 @@ qboolean Image_LoadTGA( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
{
|
{
|
||||||
int i, columns, rows, row_inc, row, col;
|
int i, columns, rows, row_inc, row, col;
|
||||||
byte *buf_p, *pixbuf, *targa_rgba;
|
byte *buf_p, *pixbuf, *targa_rgba;
|
||||||
byte palette[256][4], red = 0, green = 0, blue = 0, alpha = 0;
|
rgba_t palette[256];
|
||||||
|
byte red = 0, green = 0, blue = 0, alpha = 0;
|
||||||
int readpixelcount, pixelcount;
|
int readpixelcount, pixelcount;
|
||||||
int reflectivity[3] = { 0, 0, 0 };
|
int reflectivity[3] = { 0, 0, 0 };
|
||||||
qboolean compressed;
|
qboolean compressed;
|
||||||
@@ -234,30 +236,17 @@ Image_SaveTGA
|
|||||||
qboolean Image_SaveTGA( const char *name, rgbdata_t *pix )
|
qboolean Image_SaveTGA( const char *name, rgbdata_t *pix )
|
||||||
{
|
{
|
||||||
int y, outsize, pixel_size;
|
int y, outsize, pixel_size;
|
||||||
const byte *bufend, *in;
|
const uint8_t *bufend, *in;
|
||||||
byte *buffer, *out;
|
uint8_t *buffer, *out;
|
||||||
const char *comment = "Generated by Xash ImageLib\0";
|
tga_t targa_header = {0};
|
||||||
|
const char comment[] = "Generated by Xash ImageLib";
|
||||||
|
|
||||||
if( FS_FileExists( name, false ) && !Image_CheckFlag( IL_ALLOW_OVERWRITE ))
|
if( FS_FileExists( name, false ) && !Image_CheckFlag( IL_ALLOW_OVERWRITE ))
|
||||||
return false; // already existed
|
return false; // already existed
|
||||||
|
|
||||||
if( pix->flags & IMAGE_HAS_ALPHA )
|
// bogus parameter check
|
||||||
outsize = pix->width * pix->height * 4 + 18 + Q_strlen( comment );
|
if( !pix->buffer )
|
||||||
else outsize = pix->width * pix->height * 3 + 18 + Q_strlen( comment );
|
return false;
|
||||||
|
|
||||||
buffer = (byte *)Mem_Calloc( host.imagepool, outsize );
|
|
||||||
|
|
||||||
// prepare header
|
|
||||||
buffer[0] = Q_strlen( comment ); // tga comment length
|
|
||||||
buffer[2] = 2; // uncompressed type
|
|
||||||
buffer[12] = (pix->width >> 0) & 0xFF;
|
|
||||||
buffer[13] = (pix->width >> 8) & 0xFF;
|
|
||||||
buffer[14] = (pix->height >> 0) & 0xFF;
|
|
||||||
buffer[15] = (pix->height >> 8) & 0xFF;
|
|
||||||
buffer[16] = ( pix->flags & IMAGE_HAS_ALPHA ) ? 32 : 24;
|
|
||||||
buffer[17] = ( pix->flags & IMAGE_HAS_ALPHA ) ? 8 : 0; // 8 bits of alpha
|
|
||||||
Q_strncpy( buffer + 18, comment, Q_strlen( comment ));
|
|
||||||
out = buffer + 18 + Q_strlen( comment );
|
|
||||||
|
|
||||||
// get image description
|
// get image description
|
||||||
switch( pix->type )
|
switch( pix->type )
|
||||||
@@ -267,10 +256,40 @@ qboolean Image_SaveTGA( const char *name, rgbdata_t *pix )
|
|||||||
case PF_RGBA_32:
|
case PF_RGBA_32:
|
||||||
case PF_BGRA_32: pixel_size = 4; break;
|
case PF_BGRA_32: pixel_size = 4; break;
|
||||||
default:
|
default:
|
||||||
Mem_Free( buffer );
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
outsize = pix->width * pix->height * pixel_size;
|
||||||
|
outsize += sizeof( tga_t );
|
||||||
|
outsize += sizeof( comment ) - 1;
|
||||||
|
|
||||||
|
buffer = (uint8_t *)Mem_Malloc( host.imagepool, outsize );
|
||||||
|
|
||||||
|
// prepare header
|
||||||
|
targa_header.id_length = sizeof( comment ) - 1; // tga comment length
|
||||||
|
targa_header.image_type = 2; // uncompressed type
|
||||||
|
targa_header.width = pix->width;
|
||||||
|
targa_header.height = pix->height;
|
||||||
|
|
||||||
|
if( pix->flags & IMAGE_HAS_ALPHA )
|
||||||
|
{
|
||||||
|
targa_header.pixel_size = 32;
|
||||||
|
targa_header.attributes = 8; // 8 bits of alpha
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
targa_header.pixel_size = 24;
|
||||||
|
targa_header.attributes = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
out = buffer;
|
||||||
|
|
||||||
|
memcpy( out, &targa_header, sizeof( tga_t ) );
|
||||||
|
out += sizeof( tga_t );
|
||||||
|
|
||||||
|
memcpy( out, comment, sizeof( comment ) - 1 );
|
||||||
|
out += sizeof( comment ) - 1;
|
||||||
|
|
||||||
switch( pix->type )
|
switch( pix->type )
|
||||||
{
|
{
|
||||||
case PF_RGB_24:
|
case PF_RGB_24:
|
||||||
@@ -308,6 +327,7 @@ qboolean Image_SaveTGA( const char *name, rgbdata_t *pix )
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FS_WriteFile( name, buffer, outsize );
|
FS_WriteFile( name, buffer, outsize );
|
||||||
|
|
||||||
Mem_Free( buffer );
|
Mem_Free( buffer );
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
img_tga.h - tga format reference
|
||||||
|
Copyright (C) 2007 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 IMG_TGA_H
|
||||||
|
#define IMG_TGA_H
|
||||||
|
/*
|
||||||
|
========================================================================
|
||||||
|
|
||||||
|
.TGA image format (Truevision Targa)
|
||||||
|
|
||||||
|
========================================================================
|
||||||
|
*/
|
||||||
|
#pragma pack( push, 1 )
|
||||||
|
typedef struct tga_s
|
||||||
|
{
|
||||||
|
uint8_t id_length;
|
||||||
|
uint8_t colormap_type;
|
||||||
|
uint8_t image_type;
|
||||||
|
uint16_t colormap_index;
|
||||||
|
uint16_t colormap_length;
|
||||||
|
uint8_t colormap_size;
|
||||||
|
uint16_t x_origin;
|
||||||
|
uint16_t y_origin;
|
||||||
|
uint16_t width;
|
||||||
|
uint16_t height;
|
||||||
|
uint8_t pixel_size;
|
||||||
|
uint8_t attributes;
|
||||||
|
} tga_t;
|
||||||
|
#pragma pack( pop )
|
||||||
|
#endif // IMG_TGA_H
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "imagelib.h"
|
#include "imagelib.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "mod_local.h"
|
#include "mod_local.h"
|
||||||
|
|
||||||
#define LERPBYTE( i ) r = resamplerow1[i]; out[i] = (byte)(((( resamplerow2[i] - r ) * lerp)>>16 ) + r )
|
#define LERPBYTE( i ) r = resamplerow1[i]; out[i] = (byte)(((( resamplerow2[i] - r ) * lerp)>>16 ) + r )
|
||||||
@@ -139,6 +139,13 @@ static const savepixformat_t save_game[] =
|
|||||||
{ NULL, NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void Image_Setup( void )
|
||||||
|
{
|
||||||
|
image.cmd_flags = IL_USE_LERPING|IL_ALLOW_OVERWRITE;
|
||||||
|
image.loadformats = load_game;
|
||||||
|
image.saveformats = save_game;
|
||||||
|
}
|
||||||
|
|
||||||
void Image_Init( void )
|
void Image_Init( void )
|
||||||
{
|
{
|
||||||
// init pools
|
// init pools
|
||||||
@@ -148,9 +155,7 @@ void Image_Init( void )
|
|||||||
switch( host.type )
|
switch( host.type )
|
||||||
{
|
{
|
||||||
case HOST_NORMAL:
|
case HOST_NORMAL:
|
||||||
image.cmd_flags = IL_USE_LERPING|IL_ALLOW_OVERWRITE;
|
Image_Setup( );
|
||||||
image.loadformats = load_game;
|
|
||||||
image.saveformats = save_game;
|
|
||||||
break;
|
break;
|
||||||
case HOST_DEDICATED:
|
case HOST_DEDICATED:
|
||||||
image.cmd_flags = 0;
|
image.cmd_flags = 0;
|
||||||
@@ -1246,7 +1251,7 @@ qboolean Image_Decompress( const byte *data )
|
|||||||
else Image_GetPaletteLMP( image.palette, LUMP_MASKED );
|
else Image_GetPaletteLMP( image.palette, LUMP_MASKED );
|
||||||
}
|
}
|
||||||
else Image_GetPaletteLMP( image.palette, LUMP_NORMAL );
|
else Image_GetPaletteLMP( image.palette, LUMP_NORMAL );
|
||||||
// intentional falltrough
|
// intentionally fallthrough
|
||||||
case PF_INDEXED_32:
|
case PF_INDEXED_32:
|
||||||
if( !image.d_currentpal ) image.d_currentpal = (uint *)image.palette;
|
if( !image.d_currentpal ) image.d_currentpal = (uint *)image.palette;
|
||||||
if( !Image_Copy8bitRGBA( fin, fout, image.width * image.height ))
|
if( !Image_Copy8bitRGBA( fin, fout, image.width * image.height ))
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "imagelib.h"
|
#include "imagelib.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "wadfile.h"
|
#include "wadfile.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
@@ -199,8 +199,9 @@ Image_LoadSPR
|
|||||||
*/
|
*/
|
||||||
qboolean Image_LoadSPR( const char *name, const byte *buffer, fs_offset_t filesize )
|
qboolean Image_LoadSPR( const char *name, const byte *buffer, fs_offset_t filesize )
|
||||||
{
|
{
|
||||||
dspriteframe_t *pin; // identical for q1\hl sprites
|
dspriteframe_t pin; // identical for q1\hl sprites
|
||||||
qboolean truecolor = false;
|
qboolean truecolor = false;
|
||||||
|
byte *fin;
|
||||||
|
|
||||||
if( image.hint == IL_HINT_HL )
|
if( image.hint == IL_HINT_HL )
|
||||||
{
|
{
|
||||||
@@ -217,9 +218,9 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pin = (dspriteframe_t *)buffer;
|
memcpy( &pin, buffer, sizeof(dspriteframe_t) );
|
||||||
image.width = pin->width;
|
image.width = pin.width;
|
||||||
image.height = pin->height;
|
image.height = pin.height;
|
||||||
|
|
||||||
if( filesize < image.width * image.height )
|
if( filesize < image.width * image.height )
|
||||||
return false;
|
return false;
|
||||||
@@ -237,23 +238,25 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
{
|
{
|
||||||
case LUMP_MASKED:
|
case LUMP_MASKED:
|
||||||
SetBits( image.flags, IMAGE_ONEBIT_ALPHA );
|
SetBits( image.flags, IMAGE_ONEBIT_ALPHA );
|
||||||
|
// intentionally fallthrough
|
||||||
case LUMP_GRADIENT:
|
case LUMP_GRADIENT:
|
||||||
case LUMP_QUAKE1:
|
case LUMP_QUAKE1:
|
||||||
SetBits( image.flags, IMAGE_HAS_ALPHA );
|
SetBits( image.flags, IMAGE_HAS_ALPHA );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fin = (byte *)(buffer + sizeof(dspriteframe_t));
|
||||||
|
|
||||||
if( truecolor )
|
if( truecolor )
|
||||||
{
|
{
|
||||||
// spr32 support
|
// spr32 support
|
||||||
image.size = image.width * image.height * 4;
|
image.size = image.width * image.height * 4;
|
||||||
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
||||||
memcpy( image.rgba, (byte *)(pin + 1), image.size );
|
memcpy( image.rgba, fin, image.size );
|
||||||
SetBits( image.flags, IMAGE_HAS_COLOR ); // Color. True Color!
|
SetBits( image.flags, IMAGE_HAS_COLOR ); // Color. True Color!
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return Image_AddIndexedImageToPack( fin, image.width, image.height );
|
||||||
return Image_AddIndexedImageToPack( (byte *)(pin + 1), image.width, image.height );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ qboolean Info_IsValid( const char *s )
|
|||||||
}
|
}
|
||||||
*o = 0;
|
*o = 0;
|
||||||
|
|
||||||
if( !Q_strlen( value ))
|
if( !COM_CheckStringEmpty( value ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( *s ) s++;
|
if( *s ) s++;
|
||||||
@@ -233,7 +233,7 @@ const char *Info_ValueForKey( const char *s, const char *key )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean Info_RemoveKey( char *s, const char *key )
|
qboolean GAME_EXPORT Info_RemoveKey( char *s, const char *key )
|
||||||
{
|
{
|
||||||
char *start;
|
char *start;
|
||||||
char pkey[MAX_KV_SIZE];
|
char pkey[MAX_KV_SIZE];
|
||||||
@@ -245,7 +245,7 @@ qboolean Info_RemoveKey( char *s, const char *key )
|
|||||||
if( cmpsize > ( MAX_KV_SIZE - 1 ))
|
if( cmpsize > ( MAX_KV_SIZE - 1 ))
|
||||||
cmpsize = MAX_KV_SIZE - 1;
|
cmpsize = MAX_KV_SIZE - 1;
|
||||||
|
|
||||||
if( Q_strstr( key, "\\" ))
|
if( Q_strchr( key, '\\' ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
@@ -417,7 +417,7 @@ qboolean Info_SetValueForStarKey( char *s, const char *key, const char *value, i
|
|||||||
char new[1024], *v;
|
char new[1024], *v;
|
||||||
int c, team;
|
int c, team;
|
||||||
|
|
||||||
if( Q_strstr( key, "\\" ) || Q_strstr( value, "\\" ))
|
if( Q_strchr( key, '\\' ) || Q_strchr( value, '\\' ))
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "SetValueForKey: can't use keys or values with a \\\n" );
|
Con_Printf( S_ERROR "SetValueForKey: can't use keys or values with a \\\n" );
|
||||||
return false;
|
return false;
|
||||||
@@ -426,7 +426,7 @@ qboolean Info_SetValueForStarKey( char *s, const char *key, const char *value, i
|
|||||||
if( Q_strstr( key, ".." ) || Q_strstr( value, ".." ))
|
if( Q_strstr( key, ".." ) || Q_strstr( value, ".." ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( Q_strstr( key, "\"" ) || Q_strstr( value, "\"" ))
|
if( Q_strchr( key, '\"' ) || Q_strchr( value, '\"' ))
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "SetValueForKey: can't use keys or values with a \"\n" );
|
Con_Printf( S_ERROR "SetValueForKey: can't use keys or values with a \"\n" );
|
||||||
return false;
|
return false;
|
||||||
@@ -437,7 +437,7 @@ qboolean Info_SetValueForStarKey( char *s, const char *key, const char *value, i
|
|||||||
|
|
||||||
Info_RemoveKey( s, key );
|
Info_RemoveKey( s, key );
|
||||||
|
|
||||||
if( !value || !Q_strlen( value ))
|
if( !COM_CheckString( value ) )
|
||||||
return true; // just clear variable
|
return true; // just clear variable
|
||||||
|
|
||||||
Q_snprintf( new, sizeof( new ), "\\%s\\%s", key, value );
|
Q_snprintf( new, sizeof( new ), "\\%s\\%s", key, value );
|
||||||
|
|||||||
+23
-16
@@ -18,6 +18,7 @@ GNU General Public License for more details.
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
|
#include "common.h"
|
||||||
#ifdef XASH_SDLMAIN
|
#ifdef XASH_SDLMAIN
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -25,17 +26,14 @@ GNU General Public License for more details.
|
|||||||
#if XASH_EMSCRIPTEN
|
#if XASH_EMSCRIPTEN
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
typedef void (*pfnChangeGame)( const char *progname );
|
|
||||||
|
|
||||||
char szGameDir[128]; // safe place to keep gamedir
|
#if XASH_WIN32
|
||||||
int g_iArgc;
|
#define XASH_NOCONHOST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
void Host_Shutdown( void );
|
static char szGameDir[128]; // safe place to keep gamedir
|
||||||
void Launcher_ChangeGame( const char *progname );
|
static int g_iArgc;
|
||||||
void *Com_LoadLibrary( char *, int );
|
static char **g_pszArgv;
|
||||||
int Host_Main( int szArgc, char **szArgv, const char *szGameDir, int chg, pfnChangeGame callback );
|
|
||||||
|
|
||||||
char **g_pszArgv;
|
|
||||||
|
|
||||||
void Launcher_ChangeGame( const char *progname )
|
void Launcher_ChangeGame( const char *progname )
|
||||||
{
|
{
|
||||||
@@ -44,23 +42,32 @@ void Launcher_ChangeGame( const char *progname )
|
|||||||
exit( Host_Main( g_iArgc, g_pszArgv, szGameDir, 1, &Launcher_ChangeGame ) );
|
exit( Host_Main( g_iArgc, g_pszArgv, szGameDir, 1, &Launcher_ChangeGame ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XASH_NOCONHOST
|
#if XASH_NOCONHOST
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <shellapi.h> // CommandLineToArgvW
|
||||||
int __stdcall WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int nShow)
|
int __stdcall WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int nShow)
|
||||||
{
|
{
|
||||||
int szArgc;
|
int szArgc;
|
||||||
char **szArgv;
|
char **szArgv;
|
||||||
LPWSTR* lpArgv = CommandLineToArgvW(GetCommandLineW(), &szArgc);
|
LPWSTR* lpArgv = CommandLineToArgvW(GetCommandLineW(), &szArgc);
|
||||||
int size, i = 0;
|
int i = 0;
|
||||||
|
|
||||||
szArgv = (char**)malloc(szArgc*sizeof(char*));
|
szArgv = (char**)malloc(szArgc*sizeof(char*));
|
||||||
for (; i < szArgc; ++i)
|
for (; i < szArgc; ++i)
|
||||||
{
|
{
|
||||||
size = wcslen(lpArgv[i]) + 1;
|
size_t size = wcslen(lpArgv[i]) + 1;
|
||||||
szArgv[i] = (char*)malloc(size);
|
szArgv[i] = (char*)malloc(size);
|
||||||
wcstombs(szArgv[i], lpArgv[i], size);
|
wcstombs(szArgv[i], lpArgv[i], size);
|
||||||
}
|
}
|
||||||
|
szArgv[i] = NULL;
|
||||||
|
|
||||||
LocalFree(lpArgv);
|
LocalFree(lpArgv);
|
||||||
|
|
||||||
main( szArgc, szArgv );
|
main( szArgc, szArgv );
|
||||||
|
|
||||||
|
for( i = 0; i < szArgc; ++i )
|
||||||
|
free( szArgv[i] );
|
||||||
|
free( szArgv );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
int main( int argc, char** argv )
|
int main( int argc, char** argv )
|
||||||
@@ -68,7 +75,7 @@ int main( int argc, char** argv )
|
|||||||
char gamedir_buf[32] = "";
|
char gamedir_buf[32] = "";
|
||||||
const char *gamedir = getenv( "XASH3D_GAMEDIR" );
|
const char *gamedir = getenv( "XASH3D_GAMEDIR" );
|
||||||
|
|
||||||
if( !gamedir )
|
if( !COM_CheckString( gamedir ) )
|
||||||
{
|
{
|
||||||
gamedir = "valve";
|
gamedir = "valve";
|
||||||
}
|
}
|
||||||
@@ -81,9 +88,9 @@ int main( int argc, char** argv )
|
|||||||
#if XASH_EMSCRIPTEN
|
#if XASH_EMSCRIPTEN
|
||||||
#ifdef EMSCRIPTEN_LIB_FS
|
#ifdef EMSCRIPTEN_LIB_FS
|
||||||
// For some unknown reason emscripten refusing to load libraries later
|
// For some unknown reason emscripten refusing to load libraries later
|
||||||
Com_LoadLibrary("menu", 0 );
|
COM_LoadLibrary("menu", 0 );
|
||||||
Com_LoadLibrary("server", 0 );
|
COM_LoadLibrary("server", 0 );
|
||||||
Com_LoadLibrary("client", 0 );
|
COM_LoadLibrary("client", 0 );
|
||||||
#endif
|
#endif
|
||||||
#if XASH_DEDICATED
|
#if XASH_DEDICATED
|
||||||
// NodeJS support for debug
|
// NodeJS support for debug
|
||||||
|
|||||||
+355
-3
@@ -17,6 +17,7 @@ GNU General Public License for more details.
|
|||||||
#include "library.h"
|
#include "library.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
static char s_szLastError[1024] = "";
|
static char s_szLastError[1024] = "";
|
||||||
|
|
||||||
@@ -32,16 +33,48 @@ void COM_ResetLibraryError( void )
|
|||||||
|
|
||||||
void COM_PushLibraryError( const char *error )
|
void COM_PushLibraryError( const char *error )
|
||||||
{
|
{
|
||||||
|
if( s_szLastError[0] )
|
||||||
|
Q_strncat( s_szLastError, "\n", sizeof( s_szLastError ) );
|
||||||
Q_strncat( s_szLastError, error, sizeof( s_szLastError ) );
|
Q_strncat( s_szLastError, error, sizeof( s_szLastError ) );
|
||||||
Q_strncat( s_szLastError, "\n", sizeof( s_szLastError ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *COM_FunctionFromName_SR( void *hInstance, const char *pName )
|
void *COM_FunctionFromName_SR( void *hInstance, const char *pName )
|
||||||
{
|
{
|
||||||
|
char **funcs = NULL;
|
||||||
|
size_t numfuncs, i;
|
||||||
|
void *f = NULL;
|
||||||
|
const char *func = NULL;
|
||||||
|
|
||||||
#ifdef XASH_ALLOW_SAVERESTORE_OFFSETS
|
#ifdef XASH_ALLOW_SAVERESTORE_OFFSETS
|
||||||
if( !Q_memcmp( pName, "ofs:",4 ) )
|
if( !memcmp( pName, "ofs:", 4 ))
|
||||||
return svgame.dllFuncs.pfnGameInit + Q_atoi(pName + 4);
|
return (byte*)svgame.dllFuncs.pfnGameInit + Q_atoi( pName + 4 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if XASH_POSIX
|
||||||
|
funcs = COM_ConvertToLocalPlatform( MANGLE_ITANIUM, pName, &numfuncs );
|
||||||
|
|
||||||
|
if( funcs )
|
||||||
|
{
|
||||||
|
for( i = 0; i < numfuncs; i++ )
|
||||||
|
{
|
||||||
|
if( !f )
|
||||||
|
f = COM_FunctionFromName( hInstance, funcs[i] );
|
||||||
|
Z_Free( funcs[i] );
|
||||||
|
}
|
||||||
|
Z_Free( funcs );
|
||||||
|
|
||||||
|
if( f ) return f;
|
||||||
|
}
|
||||||
|
#elif XASH_MSVC
|
||||||
|
// TODO: COM_ConvertToLocalPlatform doesn't support MSVC yet
|
||||||
|
// also custom loader strips always MSVC mangling, so Win32
|
||||||
|
// platforms already use platform-neutral names
|
||||||
|
func = COM_GetPlatformNeutralName( pName );
|
||||||
|
|
||||||
|
if( func )
|
||||||
|
return COM_FunctionFromName( hInstance, func );
|
||||||
|
#endif
|
||||||
|
|
||||||
return COM_FunctionFromName( hInstance, pName );
|
return COM_FunctionFromName( hInstance, pName );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,3 +207,322 @@ void COM_GetCommonLibraryPath( ECommonLibraryType eLibType, char *out, size_t si
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============================================================================
|
||||||
|
|
||||||
|
C++ MANGLE CONVERSION
|
||||||
|
|
||||||
|
=============================================================================
|
||||||
|
*/
|
||||||
|
#define MAX_NESTED_NAMESPACES 16 /* MSVC limit */
|
||||||
|
|
||||||
|
static EFunctionMangleType COM_DetectMangleType( const char *str )
|
||||||
|
{
|
||||||
|
// Itanium C++ ABI mangling always start with _Z
|
||||||
|
// namespaces start with N, therefore _ZN
|
||||||
|
if( !Q_strncmp( str, "_ZN", 3 ) )
|
||||||
|
return MANGLE_ITANIUM;
|
||||||
|
|
||||||
|
// MSVC C++ mangling always start with ? and have
|
||||||
|
if( str[0] == '?' && Q_strstr( str, "@@" ))
|
||||||
|
return MANGLE_MSVC;
|
||||||
|
|
||||||
|
// allow offsets, we just silently ignore them on conversion
|
||||||
|
if( !Q_strncmp( str, "ofs:", 4 ))
|
||||||
|
return MANGLE_OFFSET;
|
||||||
|
|
||||||
|
// don't get confused by MSVC C mangling
|
||||||
|
if( str[0] != '@' && Q_strchr( str, '@' ))
|
||||||
|
return MANGLE_VALVE;
|
||||||
|
|
||||||
|
// not technically an error
|
||||||
|
return MANGLE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *COM_GetMSVCName( const char *in_name )
|
||||||
|
{
|
||||||
|
static string out_name;
|
||||||
|
char *pos;
|
||||||
|
|
||||||
|
if( in_name[0] == '?' ) // is this a MSVC C++ mangled name?
|
||||||
|
{
|
||||||
|
if(( pos = Q_strstr( in_name, "@@" )) != NULL )
|
||||||
|
{
|
||||||
|
ptrdiff_t len = pos - in_name;
|
||||||
|
|
||||||
|
// strip off the leading '?'
|
||||||
|
Q_strncpy( out_name, in_name + 1, sizeof( out_name ));
|
||||||
|
out_name[len-1] = 0; // terminate string at the "@@"
|
||||||
|
return out_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strncpy( out_name, in_name, sizeof( out_name ));
|
||||||
|
|
||||||
|
return out_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *COM_GetItaniumName( const char * const in_name )
|
||||||
|
{
|
||||||
|
static string out_name;
|
||||||
|
const char *f = in_name;
|
||||||
|
string symbols[16];
|
||||||
|
uint len = 0;
|
||||||
|
int i;
|
||||||
|
int remaining;
|
||||||
|
|
||||||
|
remaining = Q_strlen( f );
|
||||||
|
|
||||||
|
if( remaining < 3 )
|
||||||
|
goto invalid_format;
|
||||||
|
|
||||||
|
out_name[0] = 0;
|
||||||
|
|
||||||
|
// skip _ZN
|
||||||
|
f += 3;
|
||||||
|
remaining -= 3;
|
||||||
|
|
||||||
|
for( i = 0; i < MAX_NESTED_NAMESPACES; i++ )
|
||||||
|
{
|
||||||
|
// parse symbol length marker
|
||||||
|
len = 0;
|
||||||
|
for( ; isdigit( *f ) && remaining > 0; f++, remaining-- )
|
||||||
|
len = len * 10 + ( *f - '0' );
|
||||||
|
|
||||||
|
// sane value
|
||||||
|
len = min( remaining, len );
|
||||||
|
|
||||||
|
if( len == 0 )
|
||||||
|
goto invalid_format;
|
||||||
|
|
||||||
|
Q_strncpy( symbols[i], f, min( len + 1, sizeof( out_name )));
|
||||||
|
f += len;
|
||||||
|
remaining -= len;
|
||||||
|
|
||||||
|
// end marker
|
||||||
|
if( *f == 'E' )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( !isdigit( *f ) || remaining <= 0 )
|
||||||
|
goto invalid_format;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i == MAX_NESTED_NAMESPACES )
|
||||||
|
{
|
||||||
|
Con_DPrintf( "%s: too much nested namespaces: %s\n", __FUNCTION__, in_name );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( ; i >= 0; i-- )
|
||||||
|
{
|
||||||
|
Q_strncat( out_name, symbols[i], sizeof( out_name ));
|
||||||
|
if( i > 0 )
|
||||||
|
Q_strncat( out_name, "@", sizeof( out_name ));
|
||||||
|
}
|
||||||
|
|
||||||
|
return out_name;
|
||||||
|
|
||||||
|
invalid_format:
|
||||||
|
Con_DPrintf( "%s: invalid format: %s\n", __FUNCTION__, in_name );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
char **COM_ConvertToLocalPlatform( EFunctionMangleType to, const char *from, size_t *numfuncs )
|
||||||
|
{
|
||||||
|
string symbols[MAX_NESTED_NAMESPACES], temp, temp2;
|
||||||
|
const char *prev;
|
||||||
|
const char *postfix[3];
|
||||||
|
int i = 0;
|
||||||
|
char **ret;
|
||||||
|
|
||||||
|
// TODO:
|
||||||
|
if( to == MANGLE_MSVC )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
switch( to )
|
||||||
|
{
|
||||||
|
case MANGLE_ITANIUM:
|
||||||
|
postfix[0] = "Ev";
|
||||||
|
postfix[1] = "EP11CBaseEntity";
|
||||||
|
postfix[2] = "EP11CBaseEntityS1_8USE_TYPEf";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ASSERT( 0 );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
prev = from;
|
||||||
|
|
||||||
|
for( i = 0; i < MAX_NESTED_NAMESPACES; i++ )
|
||||||
|
{
|
||||||
|
const char *at = Q_strchr( prev, '@' );
|
||||||
|
uint len;
|
||||||
|
|
||||||
|
if( at ) len = (uint)( at - prev );
|
||||||
|
else len = (uint)Q_strlen( prev );
|
||||||
|
Q_strncpy( symbols[i], prev, min( len + 1, sizeof( symbols[i] )));
|
||||||
|
prev = at + 1;
|
||||||
|
|
||||||
|
if( !at )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i == MAX_NESTED_NAMESPACES )
|
||||||
|
{
|
||||||
|
Con_DPrintf( "%s: too much nested namespaces: %s\n", __FUNCTION__, from );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// only three possible variations
|
||||||
|
*numfuncs = ARRAYSIZE( postfix );
|
||||||
|
ret = Z_Malloc( sizeof( char * ) * ARRAYSIZE( postfix ) );
|
||||||
|
|
||||||
|
Q_strncpy( temp, "_ZN", sizeof( temp ));
|
||||||
|
|
||||||
|
for( ; i >= 0; i-- )
|
||||||
|
{
|
||||||
|
Q_snprintf( temp2, sizeof( temp2 ), "%u%s", (uint)Q_strlen( symbols[i] ), symbols[i] );
|
||||||
|
Q_strncat( temp, temp2, sizeof( temp ));
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i = 0; i < ARRAYSIZE( postfix ); i++ )
|
||||||
|
{
|
||||||
|
Q_snprintf( temp2, sizeof( temp2 ), "%s%s", temp, postfix[i] );
|
||||||
|
ret[i] = copystring( temp2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *COM_GetPlatformNeutralName( const char *in_name )
|
||||||
|
{
|
||||||
|
EFunctionMangleType type = COM_DetectMangleType( in_name );
|
||||||
|
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
case MANGLE_ITANIUM: return COM_GetItaniumName( in_name );
|
||||||
|
case MANGLE_MSVC: return COM_GetMSVCName( in_name );
|
||||||
|
default: return in_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if XASH_ENGINE_TESTS
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
|
static void Test_DetectMangleType( void )
|
||||||
|
{
|
||||||
|
TASSERT(COM_DetectMangleType( "asdf" ) == MANGLE_UNKNOWN );
|
||||||
|
TASSERT(COM_DetectMangleType( "012345" ) == MANGLE_UNKNOWN );
|
||||||
|
TASSERT(COM_DetectMangleType( "?asdf" ) == MANGLE_UNKNOWN );
|
||||||
|
TASSERT(COM_DetectMangleType( "_Zasdf" ) == MANGLE_UNKNOWN );
|
||||||
|
|
||||||
|
TASSERT(COM_DetectMangleType( "ofs:1234" ) == MANGLE_OFFSET );
|
||||||
|
TASSERT(COM_DetectMangleType( "ofs:asdf" ) == MANGLE_OFFSET );
|
||||||
|
TASSERT(COM_DetectMangleType( "ofs:" ) == MANGLE_OFFSET );
|
||||||
|
|
||||||
|
TASSERT(COM_DetectMangleType( "_ZN1f1fEv" ) == MANGLE_ITANIUM );
|
||||||
|
TASSERT(COM_DetectMangleType( "_ZN3foo3barEv" ) == MANGLE_ITANIUM );
|
||||||
|
|
||||||
|
TASSERT(COM_DetectMangleType( "?f@f@@msvcsucks" ) == MANGLE_MSVC );
|
||||||
|
TASSERT(COM_DetectMangleType( "?foo@bar@@IHATEMSVC" ) == MANGLE_MSVC );
|
||||||
|
|
||||||
|
TASSERT(COM_DetectMangleType( "f@f" ) == MANGLE_VALVE );
|
||||||
|
TASSERT(COM_DetectMangleType( "foo@bar" ) == MANGLE_VALVE );
|
||||||
|
|
||||||
|
// Xash3D FWGS extensions test
|
||||||
|
TASSERT(COM_DetectMangleType( "_ZN1f1f1fEv" ) == MANGLE_ITANIUM );
|
||||||
|
TASSERT(COM_DetectMangleType( "_ZN3foo3bar3bazEv" ) == MANGLE_ITANIUM );
|
||||||
|
|
||||||
|
TASSERT(COM_DetectMangleType( "?f@f@f@@msvcsucks" ) == MANGLE_MSVC );
|
||||||
|
TASSERT(COM_DetectMangleType( "?foo@bar@@IHATEMSVC" ) == MANGLE_MSVC );
|
||||||
|
|
||||||
|
TASSERT(COM_DetectMangleType( "f@f@f" ) == MANGLE_VALVE );
|
||||||
|
TASSERT(COM_DetectMangleType( "foo@bar@baz" ) == MANGLE_VALVE );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Test_GetMSVCName( void )
|
||||||
|
{
|
||||||
|
const char *symbols[] =
|
||||||
|
{
|
||||||
|
"", "",
|
||||||
|
"?f@f@@XYZA", "f@f",
|
||||||
|
"?foo@bar@@QAEXXZ", "foo@bar",
|
||||||
|
"foo", "foo",
|
||||||
|
"?foo", "?foo",
|
||||||
|
"?foo@@", "foo", // not an error?
|
||||||
|
"?foo@bar@baz@@gotstrippedanyway","foo@bar@baz"
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < ARRAYSIZE( symbols ); i += 2 )
|
||||||
|
{
|
||||||
|
Msg( "Checking if MSVC '%s' converts to '%s'...\n", symbols[i], symbols[i+1] );
|
||||||
|
|
||||||
|
TASSERT( !Q_strcmp( COM_GetMSVCName( symbols[i] ), symbols[i+1] ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Test_GetItaniumName( void )
|
||||||
|
{
|
||||||
|
const char *symbols[] =
|
||||||
|
{
|
||||||
|
"", NULL,
|
||||||
|
"_", NULL,
|
||||||
|
"_Z", NULL,
|
||||||
|
"_ZN", NULL,
|
||||||
|
"_ZNv", NULL,
|
||||||
|
"_ZN4barr3foo", NULL,
|
||||||
|
"_ZN3bar3foov", NULL,
|
||||||
|
"_ZN4bar3fooEv", NULL,
|
||||||
|
"_ZN3bar3fooEv", "foo@bar",
|
||||||
|
"_Z3foov", NULL,
|
||||||
|
"_ZN3fooEv", "foo", // not possible?
|
||||||
|
"_ZN3baz3bar3fooEdontcare", "foo@bar@baz",
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < ARRAYSIZE( symbols ); i += 2 )
|
||||||
|
{
|
||||||
|
Msg( "Checking if Itanium '%s' converts to '%s'...\n", symbols[i], symbols[i+1] );
|
||||||
|
|
||||||
|
TASSERT( !Q_strcmp( COM_GetItaniumName( symbols[i] ), symbols[i+1] ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Test_ConvertFromValveToLocal( void )
|
||||||
|
{
|
||||||
|
const char *symbols[] =
|
||||||
|
{
|
||||||
|
"", "_ZN",
|
||||||
|
"foo", "_ZN3foo",
|
||||||
|
"xash3d@fwgs", "_ZN4fwgs6xash3d",
|
||||||
|
"foo@bar@bazz", "_ZN4bazz3bar3foo"
|
||||||
|
};
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for( i = 0; i < ARRAYSIZE( symbols ); i += 2 )
|
||||||
|
{
|
||||||
|
char **ret;
|
||||||
|
size_t numfuncs;
|
||||||
|
size_t symlen = Q_strlen( symbols[i + 1] );
|
||||||
|
|
||||||
|
Msg( "Checking if Valve '%s' converts to Itanium '%s'...\n", symbols[i], symbols[i+1] );
|
||||||
|
|
||||||
|
ret = COM_ConvertToLocalPlatform( MANGLE_ITANIUM, symbols[i], &numfuncs );
|
||||||
|
|
||||||
|
TASSERT( numfuncs == 3 );
|
||||||
|
TASSERT( !Q_strncmp( ret[0], symbols[i+1], symlen ));
|
||||||
|
TASSERT( !Q_strncmp( ret[1], symbols[i+1], symlen ));
|
||||||
|
TASSERT( !Q_strncmp( ret[2], symbols[i+1], symlen ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Test_RunLibCommon( void )
|
||||||
|
{
|
||||||
|
TRUN( Test_DetectMangleType() );
|
||||||
|
TRUN( Test_GetMSVCName() );
|
||||||
|
TRUN( Test_GetItaniumName() );
|
||||||
|
TRUN( Test_ConvertFromValveToLocal() );
|
||||||
|
}
|
||||||
|
#endif /* XASH_ENGINE_TESTS */
|
||||||
|
|||||||
+28
-1
@@ -31,7 +31,7 @@ typedef struct dll_user_s
|
|||||||
dword *funcs;
|
dword *funcs;
|
||||||
char *names[MAX_LIBRARY_EXPORTS]; // max 4096 exports supported
|
char *names[MAX_LIBRARY_EXPORTS]; // max 4096 exports supported
|
||||||
int num_ordinals; // actual exports count
|
int num_ordinals; // actual exports count
|
||||||
dword funcBase; // base offset
|
uintptr_t funcBase; // base offset
|
||||||
} dll_user_t;
|
} dll_user_t;
|
||||||
|
|
||||||
dll_user_t *FS_FindLibrary( const char *dllname, qboolean directpath );
|
dll_user_t *FS_FindLibrary( const char *dllname, qboolean directpath );
|
||||||
@@ -58,4 +58,31 @@ typedef enum
|
|||||||
|
|
||||||
void COM_GetCommonLibraryPath( ECommonLibraryType eLibType, char *out, size_t size );
|
void COM_GetCommonLibraryPath( ECommonLibraryType eLibType, char *out, size_t size );
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
MANGLE_UNKNOWN = 0,
|
||||||
|
|
||||||
|
/* binary offset, when NameForFunction isn't implemented */
|
||||||
|
MANGLE_OFFSET,
|
||||||
|
|
||||||
|
/* Itanium C++ ABI mangling, native for most operating systems */
|
||||||
|
MANGLE_ITANIUM,
|
||||||
|
|
||||||
|
/* MSVC "decoration" */
|
||||||
|
MANGLE_MSVC,
|
||||||
|
|
||||||
|
/* Valve's silly mangle for crossplatform saves */
|
||||||
|
MANGLE_VALVE,
|
||||||
|
} EFunctionMangleType;
|
||||||
|
|
||||||
|
// converts to MANGLE_VALVE if possible
|
||||||
|
const char *COM_GetPlatformNeutralName( const char *in_name );
|
||||||
|
|
||||||
|
// converts to native mangling, result must be freed
|
||||||
|
char **COM_ConvertToLocalPlatform( EFunctionMangleType to, const char *from, size_t *numfuncs );
|
||||||
|
|
||||||
|
// used by lib_win.c
|
||||||
|
char *COM_GetMSVCName( const char *in_name );
|
||||||
|
|
||||||
|
|
||||||
#endif//LIBRARY_H
|
#endif//LIBRARY_H
|
||||||
|
|||||||
@@ -189,11 +189,11 @@ static void NET_LoadMasters( void )
|
|||||||
pfile = (char*)afile;
|
pfile = (char*)afile;
|
||||||
|
|
||||||
// format: master <addr>\n
|
// format: master <addr>\n
|
||||||
while( ( pfile = COM_ParseFile( pfile, token ) ) )
|
while( ( pfile = COM_ParseFile( pfile, token, sizeof( token ) ) ) )
|
||||||
{
|
{
|
||||||
if( !Q_strcmp( token, "master" ) ) // load addr
|
if( !Q_strcmp( token, "master" ) ) // load addr
|
||||||
{
|
{
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = COM_ParseFile( pfile, token, sizeof( token ) );
|
||||||
|
|
||||||
NET_AddMaster( token, true );
|
NET_AddMaster( token, true );
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-11
@@ -15,7 +15,7 @@ GNU General Public License for more details.
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "mod_local.h"
|
#include "mod_local.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "mathlib.h"
|
#include "xash3d_mathlib.h"
|
||||||
#include "alias.h"
|
#include "alias.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
#include "wadfile.h"
|
#include "wadfile.h"
|
||||||
@@ -785,7 +785,7 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve
|
|||||||
|
|
||||||
pfile = (char *)entities;
|
pfile = (char *)entities;
|
||||||
|
|
||||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
||||||
{
|
{
|
||||||
if( token[0] != '{' )
|
if( token[0] != '{' )
|
||||||
Host_Error( "Mod_FindModelOrigin: found %s when expecting {\n", token );
|
Host_Error( "Mod_FindModelOrigin: found %s when expecting {\n", token );
|
||||||
@@ -796,14 +796,14 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve
|
|||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
// parse key
|
// parse key
|
||||||
if(( pfile = COM_ParseFile( pfile, token )) == NULL )
|
if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
|
||||||
Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" );
|
Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" );
|
||||||
if( token[0] == '}' ) break; // end of desc
|
if( token[0] == '}' ) break; // end of desc
|
||||||
|
|
||||||
Q_strncpy( keyname, token, sizeof( keyname ));
|
Q_strncpy( keyname, token, sizeof( keyname ));
|
||||||
|
|
||||||
// parse value
|
// parse value
|
||||||
if(( pfile = COM_ParseFile( pfile, token )) == NULL )
|
if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
|
||||||
Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" );
|
Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" );
|
||||||
|
|
||||||
if( token[0] == '}' )
|
if( token[0] == '}' )
|
||||||
@@ -1305,7 +1305,7 @@ static void Mod_MakeHull0( void )
|
|||||||
Mod_SetupHull
|
Mod_SetupHull
|
||||||
=================
|
=================
|
||||||
*/
|
*/
|
||||||
static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, byte *mempool, int headnode, int hullnum )
|
static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, poolhandle_t mempool, int headnode, int hullnum )
|
||||||
{
|
{
|
||||||
hull_t *hull = &mod->hulls[hullnum];
|
hull_t *hull = &mod->hulls[hullnum];
|
||||||
int count;
|
int count;
|
||||||
@@ -1469,7 +1469,7 @@ for embedded submodels
|
|||||||
static void Mod_SetupSubmodels( dbspmodel_t *bmod )
|
static void Mod_SetupSubmodels( dbspmodel_t *bmod )
|
||||||
{
|
{
|
||||||
qboolean colored = false;
|
qboolean colored = false;
|
||||||
byte *mempool;
|
poolhandle_t mempool;
|
||||||
char *ents;
|
char *ents;
|
||||||
model_t *mod;
|
model_t *mod;
|
||||||
dmodel_t *bm;
|
dmodel_t *bm;
|
||||||
@@ -1550,7 +1550,7 @@ static void Mod_SetupSubmodels( dbspmodel_t *bmod )
|
|||||||
loadmodel = Mod_FindName( name, true );
|
loadmodel = Mod_FindName( name, true );
|
||||||
*loadmodel = *mod;
|
*loadmodel = *mod;
|
||||||
Q_strncpy( loadmodel->name, name, sizeof( loadmodel->name ));
|
Q_strncpy( loadmodel->name, name, sizeof( loadmodel->name ));
|
||||||
loadmodel->mempool = NULL;
|
loadmodel->mempool = 0;
|
||||||
mod = loadmodel;
|
mod = loadmodel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1679,7 +1679,7 @@ static void Mod_LoadEntities( dbspmodel_t *bmod )
|
|||||||
bmod->wadlist.count = 0;
|
bmod->wadlist.count = 0;
|
||||||
|
|
||||||
// parse all the wads for loading textures in right ordering
|
// parse all the wads for loading textures in right ordering
|
||||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
while(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) != NULL )
|
||||||
{
|
{
|
||||||
if( token[0] != '{' )
|
if( token[0] != '{' )
|
||||||
Host_Error( "Mod_LoadEntities: found %s when expecting {\n", token );
|
Host_Error( "Mod_LoadEntities: found %s when expecting {\n", token );
|
||||||
@@ -1687,14 +1687,14 @@ static void Mod_LoadEntities( dbspmodel_t *bmod )
|
|||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
// parse key
|
// parse key
|
||||||
if(( pfile = COM_ParseFile( pfile, token )) == NULL )
|
if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
|
||||||
Host_Error( "Mod_LoadEntities: EOF without closing brace\n" );
|
Host_Error( "Mod_LoadEntities: EOF without closing brace\n" );
|
||||||
if( token[0] == '}' ) break; // end of desc
|
if( token[0] == '}' ) break; // end of desc
|
||||||
|
|
||||||
Q_strncpy( keyname, token, sizeof( keyname ));
|
Q_strncpy( keyname, token, sizeof( keyname ));
|
||||||
|
|
||||||
// parse value
|
// parse value
|
||||||
if(( pfile = COM_ParseFile( pfile, token )) == NULL )
|
if(( pfile = COM_ParseFile( pfile, token, sizeof( token ))) == NULL )
|
||||||
Host_Error( "Mod_LoadEntities: EOF without closing brace\n" );
|
Host_Error( "Mod_LoadEntities: EOF without closing brace\n" );
|
||||||
|
|
||||||
if( token[0] == '}' )
|
if( token[0] == '}' )
|
||||||
@@ -1975,7 +1975,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
|
|||||||
if( mt->offsets[0] > 0 )
|
if( mt->offsets[0] > 0 )
|
||||||
{
|
{
|
||||||
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
|
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
|
||||||
int next_dataofs, remaining;
|
int next_dataofs = 0, remaining;
|
||||||
|
|
||||||
// compute next dataofset to determine allocated miptex space
|
// compute next dataofset to determine allocated miptex space
|
||||||
for( j = i + 1; j < loadmodel->numtextures; j++ )
|
for( j = i + 1; j < loadmodel->numtextures; j++ )
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user