mirror of
https://github.com/bearstonem/openmohaa-vr.git
synced 2026-10-26 22:00:45 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a9075748e | ||
|
|
3733761696 | ||
|
|
cde7cbc3a3 | ||
|
|
e927da56cf | ||
|
|
3b8bffe39c | ||
|
|
19da377064 | ||
|
|
4d1380b5c4 | ||
|
|
25c2904d66 | ||
|
|
53565663d9 | ||
|
|
76f0e17987 | ||
|
|
5052449e38 | ||
|
|
a539da3200 | ||
|
|
fb875501f0 | ||
|
|
89d805ab92 | ||
|
|
7852929da3 | ||
|
|
595e6fcb8b | ||
|
|
a9792bd4c3 | ||
|
|
c19bc7e7a2 | ||
|
|
3e980ed371 | ||
|
|
a9a7c7fdb8 | ||
|
|
5baf5bccf2 | ||
|
|
981d72ac5a | ||
|
|
a9b8cdce64 | ||
|
|
f3222fc36a | ||
|
|
e5aee8d206 | ||
|
|
96d16bcbc1 | ||
|
|
010a5ffc74 | ||
|
|
bed9bbbd05 | ||
|
|
5cc168111c | ||
|
|
bdec6aab07 | ||
|
|
56cbab8661 | ||
|
|
29c3bece4e | ||
|
|
dc24a4a067 | ||
|
|
c4683e2417 | ||
|
|
11f5870a8b | ||
|
|
9de71e3529 | ||
|
|
81866d96e0 | ||
|
|
70fcc70348 | ||
|
|
1911f04079 | ||
|
|
b7288ba3f4 | ||
|
|
be655e2b9c | ||
|
|
915269e017 | ||
|
|
6071b5303c | ||
|
|
e59a24ded3 | ||
|
|
2239efa439 | ||
|
|
99fcec9f26 | ||
|
|
2fe4e85543 | ||
|
|
68f2635c06 | ||
|
|
0147677412 | ||
|
|
89133bf05d | ||
|
|
7a0a671f18 | ||
|
|
c7d1f42edb | ||
|
|
2b9d31fe7f | ||
|
|
1f71bb714d | ||
|
|
6b21f7e92e | ||
|
|
8b5074b6ac | ||
|
|
7f7d797fce | ||
|
|
0b3aad5ad2 | ||
|
|
ad88215b85 | ||
|
|
ccb1465e17 | ||
|
|
fde4d8d54f | ||
|
|
37db2e8acc | ||
|
|
9413eb0d58 | ||
|
|
06d2eaf409 | ||
|
|
444ce284ae | ||
|
|
a150c1b18b | ||
|
|
194e898d90 | ||
|
|
0b1a20dcff | ||
|
|
93e7561cb3 | ||
|
|
6ab654264b | ||
|
|
7023184892 | ||
|
|
07f13d1ae9 | ||
|
|
ac22b1cfbf | ||
|
|
e70cdfb898 | ||
|
|
022181fcfd | ||
|
|
e021289d36 | ||
|
|
91b80a8e21 | ||
|
|
322ca2b42e | ||
|
|
d399ffd609 | ||
|
|
bf2626f804 | ||
|
|
00f27ac02d | ||
|
|
5134aed352 | ||
|
|
b457a84ed9 | ||
|
|
8188d46ee7 | ||
|
|
d64e88451f | ||
|
|
c70c578194 | ||
|
|
54ceff5107 | ||
|
|
3b94904ea8 | ||
|
|
1c8b4a1922 | ||
|
|
32b0b2dfac | ||
|
|
6506577787 | ||
|
|
56775399d3 | ||
|
|
d6d40975e5 | ||
|
|
e3936f52a2 | ||
|
|
53d5dd1e40 | ||
|
|
b2ef0fd6e3 | ||
|
|
8832fbe55d | ||
|
|
b5ffe756d6 | ||
|
|
01a0173a2f | ||
|
|
7bebb2adab | ||
|
|
8c41576daa | ||
|
|
a529b37f25 | ||
|
|
f84ed6b794 | ||
|
|
9526a92fc1 | ||
|
|
5e60b89a0d | ||
|
|
e46625a52c | ||
|
|
037cb0f5cb | ||
|
|
f67a7c6621 | ||
|
|
4839a2026b | ||
|
|
219dbbb5b7 | ||
|
|
d78de51bc2 | ||
|
|
faa50352e0 | ||
|
|
f2b49f7ccb | ||
|
|
13911b051a | ||
|
|
694167d352 | ||
|
|
3b2e4ff9c1 | ||
|
|
16e0dc17a8 | ||
|
|
1f4b7718e8 | ||
|
|
8c59d6020e | ||
|
|
377b0896c2 | ||
|
|
a399fdf6cf | ||
|
|
783c24d6f7 | ||
|
|
1254146223 | ||
|
|
f776d842d1 | ||
|
|
74acf35a89 | ||
|
|
81b8fe3f61 | ||
|
|
679bfb90ea | ||
|
|
deb18c53b7 | ||
|
|
bbb7aa3771 | ||
|
|
eb04e26823 | ||
|
|
3af24ee0ea | ||
|
|
513fe7773f | ||
|
|
9150d1cc44 | ||
|
|
e19b72647e | ||
|
|
d809975882 | ||
|
|
7b92d99afa | ||
|
|
b463c905cf | ||
|
|
7f8a0c9931 | ||
|
|
53d812666c | ||
|
|
7b59f07181 | ||
|
|
d22dea5e8e | ||
|
|
8817467216 | ||
|
|
236afa7c3f | ||
|
|
cd6ec5e3a7 | ||
|
|
434aaf3eaf | ||
|
|
5b80ea20c7 | ||
|
|
1d60405eaa | ||
|
|
64f4f59165 | ||
|
|
192f9ac514 | ||
|
|
279b1413ec | ||
|
|
9c5297882c | ||
|
|
a6d508d791 | ||
|
|
6b3402c631 | ||
|
|
d5da32b8a9 | ||
|
|
39b3ed3d44 | ||
|
|
f8b97405ff | ||
|
|
1d4fe357c8 | ||
|
|
c7900b6048 | ||
|
|
6e3f959684 | ||
|
|
eb9a3b1bbf | ||
|
|
391450f090 | ||
|
|
f804476fbc | ||
|
|
60e4fa7005 | ||
|
|
c13f9dc9a8 | ||
|
|
f213943b2d | ||
|
|
5159a534bb | ||
|
|
c7a4e705cb | ||
|
|
864ea08393 | ||
|
|
ebfb6d1846 | ||
|
|
6b89ec615a | ||
|
|
af432e6d3f | ||
|
|
44c17409a7 | ||
|
|
0f48c39bc1 | ||
|
|
572e6652cc | ||
|
|
fecb601fc4 | ||
|
|
7b238e9d34 | ||
|
|
73c8ff11b3 | ||
|
|
682dc89067 | ||
|
|
ee514710c5 | ||
|
|
2d15696a5e | ||
|
|
769d06b0f0 | ||
|
|
dcb0369e10 | ||
|
|
1b35d3ce05 | ||
|
|
31d254cb9f | ||
|
|
bf4780bbdb | ||
|
|
5af8e127f8 | ||
|
|
016e062fef | ||
|
|
c093122764 | ||
|
|
11ec6270da | ||
|
|
81df55310b | ||
|
|
e5fb85ad08 | ||
|
|
c5ef60040a | ||
|
|
757b4849f8 | ||
|
|
2198bdec21 | ||
|
|
8bd377ce85 | ||
|
|
89eae68318 | ||
|
|
d1e94f3934 | ||
|
|
fc0a995c66 | ||
|
|
eee0eaac4a | ||
|
|
535da856a4 | ||
|
|
422bf647a7 | ||
|
|
93cd470659 | ||
|
|
81b86d61da | ||
|
|
eac8580f64 | ||
|
|
d56498e622 | ||
|
|
551fccb761 | ||
|
|
5317b8424f | ||
|
|
5816391e9b | ||
|
|
543c00037a | ||
|
|
d5f435ee90 | ||
|
|
02e2e92d36 | ||
|
|
040f8db0ef | ||
|
|
14927df9fa | ||
|
|
dca9709b12 | ||
|
|
d6571820fe | ||
|
|
a0d3333ebb | ||
|
|
9615fafc1e | ||
|
|
5fc2425f3a | ||
|
|
63445c4fc1 | ||
|
|
eefe8ee2d1 | ||
|
|
edb1cb0ebe | ||
|
|
140242a761 | ||
|
|
ae13be0c37 | ||
|
|
74ff3b920e | ||
|
|
2cd6b981f1 | ||
|
|
f866dcbcfc | ||
|
|
0d394a7e67 | ||
|
|
7059f32ecc | ||
|
|
87baa69d7c | ||
|
|
408c901342 | ||
|
|
d709dda87a | ||
|
|
cda6225659 | ||
|
|
563182c14c | ||
|
|
303ed30a38 | ||
|
|
0a6c745ffb | ||
|
|
9d654faa3d | ||
|
|
9407b64fe3 | ||
|
|
1f0f5764a8 | ||
|
|
13197acb3a | ||
|
|
2f48ca6adb | ||
|
|
01d938b5ba | ||
|
|
186d7a12e5 | ||
|
|
5192d36f81 | ||
|
|
dfb6c37c9e | ||
|
|
cb208b9ad2 | ||
|
|
e4d20c3fa1 | ||
|
|
0b747bf1c5 | ||
|
|
e207715b5e | ||
|
|
bef1b456e1 | ||
|
|
11349f9ad5 | ||
|
|
2a485a6b69 | ||
|
|
f41e92de6e | ||
|
|
835c0b0d9a | ||
|
|
d9dc34f06d | ||
|
|
907ff36018 | ||
|
|
64626a767c | ||
|
|
a7df73073d | ||
|
|
40492daecd | ||
|
|
a5691d7779 | ||
|
|
d1ecd4a3c8 | ||
|
|
5482b31c66 | ||
|
|
15f2f6c798 | ||
|
|
46b3f4eb5e | ||
|
|
f5aadbb788 | ||
|
|
bbb54ea36d | ||
|
|
d7a5eb5d2f | ||
|
|
cc716c3fa4 | ||
|
|
141574a0d7 | ||
|
|
2df8ed10d0 | ||
|
|
40e3977664 | ||
|
|
7ddee0100e | ||
|
|
6b869c4c0d | ||
|
|
91497d8fa7 | ||
|
|
85bf56ae03 | ||
|
|
84d702838d | ||
|
|
fd3a36f162 | ||
|
|
10e3192f85 | ||
|
|
de874874e4 | ||
|
|
72e315bce1 | ||
|
|
02ef85e390 | ||
|
|
aeba0e0f6f | ||
|
|
f8fa944054 | ||
|
|
1d50fa088a | ||
|
|
546ded324e | ||
|
|
332a635031 | ||
|
|
de02c868a2 | ||
|
|
a74b966b7c | ||
|
|
ca4b1ebdee | ||
|
|
42c20ac008 | ||
|
|
a26e5b74c2 | ||
|
|
ee5faedaf9 | ||
|
|
874b034698 | ||
|
|
dfb2cb6bbf | ||
|
|
fb15f0f2b3 | ||
|
|
4d231fbc50 | ||
|
|
dd85118a9c | ||
|
|
531340627d | ||
|
|
6b6e5291dd | ||
|
|
79b0e6998d | ||
|
|
445814b144 | ||
|
|
ebb3173322 | ||
|
|
c16f2029b1 | ||
|
|
abefdd772c | ||
|
|
e550d244df | ||
|
|
84cc66ad48 | ||
|
|
fa5a97031d | ||
|
|
6e454cdfb3 | ||
|
|
52f43a3aa6 | ||
|
|
907aa21ba8 | ||
|
|
ac01ad6751 | ||
|
|
c84702b490 | ||
|
|
edd2a9d8f6 | ||
|
|
a19c7afce0 | ||
|
|
849f1ee7d1 | ||
|
|
c60c2c09e1 | ||
|
|
3254b3f044 | ||
|
|
9a35d34fc3 | ||
|
|
4da5e26cdc | ||
|
|
8a28ad0c36 | ||
|
|
e08b2fe382 | ||
|
|
8b16e94829 | ||
|
|
618223f01b | ||
|
|
13c63d3e1f | ||
|
|
8e0aa5185b | ||
|
|
2b01f092b3 | ||
|
|
1fd238567e | ||
|
|
cb59edc963 | ||
|
|
0ce70b9f8f | ||
|
|
57175cfa5c | ||
|
|
8aacdcefb8 | ||
|
|
69766ae87a | ||
|
|
d3d2082e41 | ||
|
|
de621f6acb | ||
|
|
a7c5067475 | ||
|
|
7282426736 | ||
|
|
0333fd86f8 | ||
|
|
ab91ade685 | ||
|
|
005afcd53d | ||
|
|
c1604c0c8c | ||
|
|
5155c10136 | ||
|
|
28c6e3b398 | ||
|
|
41244095b1 | ||
|
|
a5535fa789 | ||
|
|
6796a8b3fe | ||
|
|
819dffcb86 | ||
|
|
b54db17069 | ||
|
|
e27f2443e8 | ||
|
|
a1e0bc5d7c | ||
|
|
28ea95b9ff | ||
|
|
e3b9e48d8c | ||
|
|
026b6b2562 | ||
|
|
0fa380ecff | ||
|
|
ebd885f053 | ||
|
|
74ccb03e54 | ||
|
|
50264c4968 | ||
|
|
be222b64a1 | ||
|
|
db7ae4ffef | ||
|
|
884a76db4c | ||
|
|
18e5c6e714 | ||
|
|
468341b7d0 | ||
|
|
e03b976ffd | ||
|
|
34ea099d87 | ||
|
|
5f2827e2ab | ||
|
|
1d887b4655 | ||
|
|
6250380f61 | ||
|
|
6bb475abe7 | ||
|
|
31ea951357 | ||
|
|
091c8b4d12 | ||
|
|
c4523db991 | ||
|
|
2b66672d2d | ||
|
|
77de0b78ba | ||
|
|
0181fbcfa0 | ||
|
|
e1f2433c36 | ||
|
|
c753dcafd8 | ||
|
|
57ac7d8c19 | ||
|
|
d64ef13b79 | ||
|
|
911e87c6ec | ||
|
|
b75c7b64f1 | ||
|
|
135b519dd8 | ||
|
|
b7a0607d52 | ||
|
|
2ee1a2099d | ||
|
|
7fe7e74fe2 | ||
|
|
0a3a23af41 | ||
|
|
e89262ed3b | ||
|
|
21fda4cabd | ||
|
|
a85694b548 | ||
|
|
16464c5a68 | ||
|
|
85c8769512 | ||
|
|
c3abbd9014 | ||
|
|
98239050d8 | ||
|
|
dc7caf04a8 | ||
|
|
db01f72adc | ||
|
|
170b4b0972 | ||
|
|
ff6e81d44f | ||
|
|
88bc0e1e85 | ||
|
|
c5b46529b0 | ||
|
|
e5dbfba55e | ||
|
|
daa7aceecf | ||
|
|
35681e7a1f | ||
|
|
d4dfde3340 | ||
|
|
05a6b43e08 | ||
|
|
16f775c78c | ||
|
|
af919dadca | ||
|
|
41c322ec81 | ||
|
|
ac8c18250d | ||
|
|
4b05c400b2 | ||
|
|
cc85d0c100 | ||
|
|
56dce21538 | ||
|
|
3cd5acf3aa | ||
|
|
48fc5a72b8 | ||
|
|
26c3375112 | ||
|
|
e89543710c | ||
|
|
ee48193f15 | ||
|
|
6d10ed27c5 | ||
|
|
19c68aa25d | ||
|
|
5ee7cb16bb | ||
|
|
4630a1f386 | ||
|
|
06dab5d8b0 | ||
|
|
054201bea9 | ||
|
|
f39a4c0bc7 | ||
|
|
0e20d7e880 | ||
|
|
927f4bb4bd | ||
|
|
f9901787b5 | ||
|
|
6731f56aea | ||
|
|
d6870ecbee | ||
|
|
eea8c42268 | ||
|
|
99647e677a | ||
|
|
a5d637dbb3 | ||
|
|
048a973290 | ||
|
|
fa80e0bd75 | ||
|
|
a23de7b361 | ||
|
|
dc60cb45b2 | ||
|
|
2bf1144a14 | ||
|
|
ab5efa5a64 | ||
|
|
ccc98e4c62 | ||
|
|
52424f63f0 | ||
|
|
881df7193b | ||
|
|
e859bba61d | ||
|
|
e3beec985e | ||
|
|
9eec50d69f | ||
|
|
5a8cc83e6e | ||
|
|
724aeb22ed | ||
|
|
6fdc756b59 | ||
|
|
25418b7857 | ||
|
|
b4de0b53e4 | ||
|
|
cacf1ca1b7 | ||
|
|
98c61529b9 | ||
|
|
6675a491be | ||
|
|
b6485ad7db | ||
|
|
9f5df368d1 | ||
|
|
e970e29953 | ||
|
|
9fb559bdb1 | ||
|
|
61e9146385 | ||
|
|
897c2322b9 | ||
|
|
7b8be9fed1 | ||
|
|
cebb351505 | ||
|
|
b4bce3431b | ||
|
|
c6e3dfdbe6 | ||
|
|
22d2790735 | ||
|
|
5d3b76b249 | ||
|
|
7b07be1502 | ||
|
|
3acb796b59 | ||
|
|
25bbc1793d | ||
|
|
63456beeb0 | ||
|
|
2e32395cf2 | ||
|
|
d04ed0aace | ||
|
|
302f06f8d2 | ||
|
|
4cf4ca2943 | ||
|
|
fe35e02ed4 | ||
|
|
5fa1b98d34 | ||
|
|
bebe117487 | ||
|
|
26495fe0f8 | ||
|
|
4c4ac9f90e | ||
|
|
bf5fdb8f06 | ||
|
|
01e68fd5ee | ||
|
|
e930b5481a | ||
|
|
9bd4d40f09 | ||
|
|
40035f4df3 | ||
|
|
a7b3fdd70b | ||
|
|
b77af7fced | ||
|
|
52c89f1de3 | ||
|
|
e7cd70b8ee | ||
|
|
e06ee0f26a | ||
|
|
76c9e4e048 | ||
|
|
06d8ddbfc7 | ||
|
|
8b9840d37f | ||
|
|
960469be77 | ||
|
|
77ef0f3579 | ||
|
|
07c840a4a9 | ||
|
|
35a8c4edfa | ||
|
|
36af9e6589 | ||
|
|
ea14ab5664 | ||
|
|
1ed8538745 | ||
|
|
12e36b987a | ||
|
|
8324c599de | ||
|
|
d972c85fba | ||
|
|
d8b9abe7f5 | ||
|
|
4f868d9585 | ||
|
|
e27ac45f44 | ||
|
|
58d0e43f78 | ||
|
|
a6c1cbfd50 | ||
|
|
e32222884d | ||
|
|
49a7a1f8ff | ||
|
|
e5275c0f05 | ||
|
|
c391605f61 | ||
|
|
73c9e6f1d8 | ||
|
|
2d6ac6f0be | ||
|
|
57870103a6 | ||
|
|
64604b5c44 | ||
|
|
9960884e3c | ||
|
|
593982d586 | ||
|
|
f229c1c5a8 | ||
|
|
35e9f9982c | ||
|
|
a0cb46d4a1 | ||
|
|
e8a48184b9 | ||
|
|
d2aa26248f | ||
|
|
0f1de72ae6 | ||
|
|
efaea69c09 | ||
|
|
a67dbff603 | ||
|
|
35e6435382 | ||
|
|
7a2735885f | ||
|
|
cc721a3db6 | ||
|
|
1a5cac2c6a | ||
|
|
ef08f1c8f3 | ||
|
|
8919890dbe | ||
|
|
cf6335d180 | ||
|
|
a86a707e4a | ||
|
|
9d61993878 | ||
|
|
6eb20a3524 | ||
|
|
7314543c88 | ||
|
|
bb4b10d752 | ||
|
|
416c568c51 | ||
|
|
65d3a51a17 | ||
|
|
e55f5902d5 | ||
|
|
b0180383df | ||
|
|
61f0fc665f | ||
|
|
b0c1d79132 | ||
|
|
7945c2ca66 | ||
|
|
8b2b1a9a47 | ||
|
|
b76f9a9a6c | ||
|
|
8af5da5fca | ||
|
|
cbe6d85bcd | ||
|
|
6b6e2c947c | ||
|
|
66fcc2cd14 | ||
|
|
af829772f9 | ||
|
|
7b6a558fe5 | ||
|
|
4122ee4168 | ||
|
|
b77f62ab58 | ||
|
|
783bf1b63c | ||
|
|
a0728b4a8a | ||
|
|
ea6e865cc8 | ||
|
|
1da4113110 | ||
|
|
7956746b65 | ||
|
|
10a8d13ade | ||
|
|
65b47a2b3a | ||
|
|
46cc00d669 | ||
|
|
5521cf9ab3 | ||
|
|
a770df1e0b | ||
|
|
03943a23ac | ||
|
|
685dc0336a | ||
|
|
776012fedf | ||
|
|
6ba9f2655c | ||
|
|
8a3b62e93f | ||
|
|
bd999a6d9c | ||
|
|
f46078965d | ||
|
|
60f6bb17e3 | ||
|
|
fdf1dac618 | ||
|
|
373a35acf0 | ||
|
|
abfdac59ba | ||
|
|
efc1354dcb | ||
|
|
c9f2603692 | ||
|
|
aab24260e2 | ||
|
|
e450156bf7 | ||
|
|
1533c02a41 | ||
|
|
c4855029a9 | ||
|
|
4fa457118f | ||
|
|
33b403d6eb | ||
|
|
a5c6654dcb | ||
|
|
07ec6adecb | ||
|
|
ceb901e9ca | ||
|
|
651b86b066 | ||
|
|
a4003dd61c | ||
|
|
5e461786f9 | ||
|
|
45108c6f4b | ||
|
|
bc0d373dcd | ||
|
|
0f37a8f6ea | ||
|
|
03ceaf82ce | ||
|
|
1e5e5e24f6 | ||
|
|
eb993dbd43 | ||
|
|
4f5abb3412 | ||
|
|
6418d79d76 | ||
|
|
796a3a711f | ||
|
|
0ef743d945 | ||
|
|
7c33f98ae9 | ||
|
|
51ba1e2951 | ||
|
|
0b16d599d5 | ||
|
|
3b2223ad22 | ||
|
|
186583148a | ||
|
|
5475624b7f | ||
|
|
d5be69239a | ||
|
|
304645d720 | ||
|
|
0591152f99 | ||
|
|
74e8a38c00 | ||
|
|
5cadab46ab | ||
|
|
1577927d99 | ||
|
|
5a0aeb2f88 | ||
|
|
7a1f7773bf | ||
|
|
b0e597cf55 | ||
|
|
c40d073d7a | ||
|
|
dd8b3f607a | ||
|
|
5cc599984d | ||
|
|
b95b8c4c20 | ||
|
|
3e190ca4b3 | ||
|
|
3853d1ef39 | ||
|
|
bf700186d0 | ||
|
|
ca7cacfdcc | ||
|
|
b893f4f89f | ||
|
|
109686aca2 | ||
|
|
6840df4eca | ||
|
|
ed3f212bd8 | ||
|
|
e1f2a51f2b | ||
|
|
d3870309fb | ||
|
|
1fa2031f11 | ||
|
|
1d765125c7 | ||
|
|
5aa70d91f3 | ||
|
|
f018c2c15a | ||
|
|
1b8ad12b25 | ||
|
|
078aa01895 | ||
|
|
f0aad4bb21 | ||
|
|
8fe054b063 | ||
|
|
ac63e6c627 | ||
|
|
434a48af7d | ||
|
|
c5dcf96717 | ||
|
|
84791c42bc | ||
|
|
e032a1a627 | ||
|
|
1f2b5dcc86 | ||
|
|
8bd30ffb22 | ||
|
|
fbf67fccc3 | ||
|
|
b848ee0fac | ||
|
|
4a39e5411f | ||
|
|
336ba6181e | ||
|
|
c9aedf242d | ||
|
|
500c70016f | ||
|
|
cf1dbf07c7 | ||
|
|
13ec3435b4 | ||
|
|
fce0f7b357 | ||
|
|
0fabdc8c44 | ||
|
|
2174f2ff85 | ||
|
|
ac40373c09 | ||
|
|
d5908bd75c | ||
|
|
8cf3be3526 | ||
|
|
0290fa3351 | ||
|
|
937f3993ec | ||
|
|
d501285057 | ||
|
|
0ed92943de | ||
|
|
56044dd8f8 | ||
|
|
e8109076f4 | ||
|
|
0a31ab7558 | ||
|
|
e73be7ef5c | ||
|
|
aa209e0aaf | ||
|
|
570dddddd8 | ||
|
|
534176423e | ||
|
|
ca2c2fb8fe | ||
|
|
4388b7b187 | ||
|
|
368f94ce3b | ||
|
|
e7fd0f7419 | ||
|
|
92f7c3633f | ||
|
|
bf27caa61e | ||
|
|
808916029e | ||
|
|
5f3ee10bc0 | ||
|
|
45f50cfe25 | ||
|
|
42c0605abf | ||
|
|
f83839e01b | ||
|
|
24dbc1ce4e | ||
|
|
d8505eff2b | ||
|
|
bca71ade85 | ||
|
|
7518d7b418 | ||
|
|
3f8aeac7e6 | ||
|
|
c4a9a87929 | ||
|
|
7eca455795 | ||
|
|
cb9ac23b23 | ||
|
|
4a66a41f91 | ||
|
|
665c35d089 | ||
|
|
0a634c633b | ||
|
|
eb70b30e7a | ||
|
|
8d188073b4 | ||
|
|
ceea855c6f | ||
|
|
9b7f192dce | ||
|
|
23a866f6f8 | ||
|
|
946a7a406c | ||
|
|
e209290073 | ||
|
|
2c441ee541 | ||
|
|
dd768ec9ef | ||
|
|
adaeaea596 | ||
|
|
5a44740592 | ||
|
|
97a0bd90ec | ||
|
|
92ee1d9caf | ||
|
|
9ab28dc7da | ||
|
|
840501c8dd | ||
|
|
ef4b79b1f5 | ||
|
|
b6b35079ef | ||
|
|
b8e8aead93 | ||
|
|
dd378db4d0 | ||
|
|
cc048f5099 | ||
|
|
ac02afaae6 | ||
|
|
bff58ae615 | ||
|
|
748934edcd | ||
|
|
d9fb375812 | ||
|
|
55582a85ab | ||
|
|
9255c5259d | ||
|
|
f1e2a45520 | ||
|
|
cb9e69238c | ||
|
|
56b2971dee | ||
|
|
ad917d96c8 | ||
|
|
1fd7bd3fa5 | ||
|
|
1234bd89c7 | ||
|
|
187ee87f10 | ||
|
|
5ae88b816d | ||
|
|
3418691f88 | ||
|
|
4e8a51db81 | ||
|
|
2629ef17c3 | ||
|
|
9b63625c2b | ||
|
|
970d72cf07 | ||
|
|
d88870bc04 | ||
|
|
9b35e13923 | ||
|
|
032eb11cfb | ||
|
|
9ea7b77231 | ||
|
|
318dc18891 | ||
|
|
8d327cd0a0 | ||
|
|
d3de937ee0 | ||
|
|
3be1673eb9 | ||
|
|
13f23ace76 | ||
|
|
26c50f15dc | ||
|
|
46aa58d0cd | ||
|
|
aac9dd40de | ||
|
|
71dba1b7dc | ||
|
|
8b85e4e075 | ||
|
|
028489d673 | ||
|
|
5c4c14a17d | ||
|
|
2e10a96d11 | ||
|
|
09ad42ba47 | ||
|
|
88ccaee5cc | ||
|
|
e936a0b995 | ||
|
|
ff5b0b7607 | ||
|
|
edd2fd5e63 | ||
|
|
08d97e0277 | ||
|
|
21d0675035 | ||
|
|
1dfb81917c | ||
|
|
af8c92f090 | ||
|
|
04e0242422 | ||
|
|
110ffc3a01 | ||
|
|
6b4a8bd627 | ||
|
|
0d851fdb68 | ||
|
|
5064f2c16d | ||
|
|
ac46d0eef0 | ||
|
|
70c71b69ee | ||
|
|
4487113c58 | ||
|
|
983f5b9ca4 | ||
|
|
13612d3de9 | ||
|
|
6317ca7183 | ||
|
|
2b96aac1c8 | ||
|
|
a6b75aefa4 | ||
|
|
7dc72b435e | ||
|
|
5a586f4700 | ||
|
|
ef50a5f2cd | ||
|
|
c2c3f6aa1b | ||
|
|
9c8ca98e68 | ||
|
|
3a18c9f327 | ||
|
|
9438f6497d | ||
|
|
5c3c3f8e70 | ||
|
|
3d3c99cd22 | ||
|
|
b3464e620e | ||
|
|
72a38b0b68 | ||
|
|
46e7f29820 | ||
|
|
cb36015a38 | ||
|
|
66cb10a3bf | ||
|
|
bfdd99a028 | ||
|
|
63ef75222e | ||
|
|
072ba0a38f | ||
|
|
576869bda0 | ||
|
|
0d556b1b40 | ||
|
|
0cd217b484 | ||
|
|
907255837e | ||
|
|
ebf33349a3 | ||
|
|
ea6920b711 | ||
|
|
53a47d470a | ||
|
|
7fe7b6ce79 | ||
|
|
0110704abd | ||
|
|
aca23fc62f | ||
|
|
c0a284927e | ||
|
|
2d911c37a4 | ||
|
|
1e7af27227 | ||
|
|
06678a8b0a | ||
|
|
e1706610c4 | ||
|
|
7bb940d819 | ||
|
|
b4e0120428 | ||
|
|
db1013d926 | ||
|
|
759dacd345 | ||
|
|
903fd28953 | ||
|
|
6c520babf0 | ||
|
|
9bb2fda6df | ||
|
|
d48b37ece1 | ||
|
|
f4164e84e1 | ||
|
|
33aabadaf5 | ||
|
|
e815fda908 | ||
|
|
fe04adee1d | ||
|
|
115647a8c0 | ||
|
|
ddd70eadf6 | ||
|
|
319e00214e | ||
|
|
6bdcfc2b6f | ||
|
|
ae0a2238da | ||
|
|
a69f9fe88b | ||
|
|
696b57f990 | ||
|
|
998c1b78c7 | ||
|
|
8c207f094d | ||
|
|
09c9c0ef51 | ||
|
|
8cd571c96c | ||
|
|
979af2925d | ||
|
|
f092eab842 | ||
|
|
3d4832ca85 | ||
|
|
b120fc6f2f | ||
|
|
c299ad92aa | ||
|
|
956cd59385 | ||
|
|
acbd802790 | ||
|
|
c4bcecf5e0 | ||
|
|
09949251ac | ||
|
|
43218f1685 | ||
|
|
eb7d01b3e7 | ||
|
|
c58e6d58b4 | ||
|
|
3a892e1a47 | ||
|
|
5bb487e1fa | ||
|
|
4ae091be4b | ||
|
|
7654ab6be6 | ||
|
|
193cc9dc10 | ||
|
|
a6d268e1a1 | ||
|
|
7822e94e61 | ||
|
|
eb663fdbc1 | ||
|
|
c738a40c05 | ||
|
|
2ca3443b7f | ||
|
|
06be4c03fa | ||
|
|
32d77f4a7d | ||
|
|
d217b1d561 | ||
|
|
0167f0a3a4 | ||
|
|
4304ad0faa | ||
|
|
3be17376e4 | ||
|
|
0b4fd4c17e | ||
|
|
66c4499b2e | ||
|
|
cde13177a4 | ||
|
|
9fce2575ab | ||
|
|
8f8e92c8c3 | ||
|
|
8683d317fe | ||
|
|
1178c619bc | ||
|
|
2fa568eb01 | ||
|
|
d62242d653 | ||
|
|
991bf2f1f5 | ||
|
|
2f241343ff | ||
|
|
035de09c15 | ||
|
|
d3a4407391 | ||
|
|
395c16ce24 | ||
|
|
f7accc01ad | ||
|
|
3733154e63 | ||
|
|
2ef95ddba9 | ||
|
|
043f8cba22 | ||
|
|
09ab172630 | ||
|
|
c23a182bec | ||
|
|
c321470382 | ||
|
|
932bdd402c | ||
|
|
3692671f49 | ||
|
|
1cd4c35a79 | ||
|
|
c0f7a48649 | ||
|
|
c1258f160b | ||
|
|
bdb9feb7c5 | ||
|
|
830cbe7af2 | ||
|
|
4eb83c0766 | ||
|
|
210f2fef77 | ||
|
|
d19a6160d2 | ||
|
|
cd773cf73f | ||
|
|
f3b9a10f7a | ||
|
|
709283ff33 | ||
|
|
fae261d7da | ||
|
|
6b5e527b6b | ||
|
|
b7005a310e | ||
|
|
edd25b9264 | ||
|
|
65a8b03ee4 | ||
|
|
0044ec0ac0 | ||
|
|
73111d854d | ||
|
|
065ab98175 | ||
|
|
cbeaeba828 | ||
|
|
7af2a9444e | ||
|
|
f476f3690a | ||
|
|
fae02da4b1 | ||
|
|
b0e4e29ce3 | ||
|
|
11f7728b9d | ||
|
|
7510b05d25 | ||
|
|
e467f91262 | ||
|
|
b03afb899d | ||
|
|
ec71ff3c3c | ||
|
|
02ce50ace2 | ||
|
|
4a4a552a05 | ||
|
|
5b3615d262 | ||
|
|
2821488c93 | ||
|
|
9814887b10 | ||
|
|
3f86381541 | ||
|
|
7736966dc1 | ||
|
|
60faa9dd9b | ||
|
|
75f8f86f86 | ||
|
|
0ee1307e75 | ||
|
|
f0c38305b5 | ||
|
|
e07dda6991 | ||
|
|
b10ce9a426 | ||
|
|
2ac2800ecb | ||
|
|
e59200a7de | ||
|
|
a7902a8837 | ||
|
|
615726cc75 | ||
|
|
839abf6076 | ||
|
|
c7c8d4580d | ||
|
|
2cc47e10f9 | ||
|
|
8fc5dacebf | ||
|
|
cb23f3bb70 | ||
|
|
d7350d8629 | ||
|
|
ac6b5ef1f7 | ||
|
|
7fdd26c59e | ||
|
|
fad555308b | ||
|
|
969255c48e | ||
|
|
433305617c | ||
|
|
5418d84c7e | ||
|
|
cca37e3dfe | ||
|
|
0e9d83ee14 | ||
|
|
ecbf7f6caa | ||
|
|
5a3638fa68 | ||
|
|
111088b540 | ||
|
|
ba1703ebf0 | ||
|
|
825df20a72 | ||
|
|
0a42fd79d2 | ||
|
|
e50a041c12 | ||
|
|
ce0e9fe77e | ||
|
|
5105dcce04 | ||
|
|
58b4a9a676 | ||
|
|
1146c834fb | ||
|
|
9068264132 | ||
|
|
59ac8ea437 | ||
|
|
afafacaeec | ||
|
|
baf451d2a2 | ||
|
|
d588012168 | ||
|
|
a3ed25cb2e | ||
|
|
c399f45841 | ||
|
|
6a6eeae4ee | ||
|
|
65f36505d1 | ||
|
|
b852980842 | ||
|
|
d351ced78b | ||
|
|
4cd45c63c4 | ||
|
|
de16a72aed | ||
|
|
4b29c63fc9 | ||
|
|
770e832592 | ||
|
|
14f9acdb57 | ||
|
|
573a6f5bd5 | ||
|
|
8c64b7aa89 | ||
|
|
8d49f8935c | ||
|
|
ff8ec63e95 | ||
|
|
771ee1b5a9 | ||
|
|
096692fec8 | ||
|
|
d29454b44d | ||
|
|
30a1ccb2e2 | ||
|
|
ea1b411cc0 | ||
|
|
7794ee8aea | ||
|
|
99a9022b53 | ||
|
|
1255964e6b | ||
|
|
37de859bee | ||
|
|
990aa5cdb2 | ||
|
|
befcedcf58 | ||
|
|
eeb697570d | ||
|
|
6410567e9a | ||
|
|
bde7242cc7 | ||
|
|
e8aad97975 | ||
|
|
0662359776 | ||
|
|
5568d160ab | ||
|
|
defa297a56 | ||
|
|
782c37c4fe | ||
|
|
6f03c88ad5 | ||
|
|
3ec980c8ec | ||
|
|
c0a50eb2ff | ||
|
|
f73e4b6f22 | ||
|
|
096972827e | ||
|
|
08c040d4ea | ||
|
|
6d8b6b5f29 | ||
|
|
410f1c0ed8 | ||
|
|
cb73cfd57b | ||
|
|
8cb8a7f370 | ||
|
|
8c893acfff | ||
|
|
e453d1fa17 | ||
|
|
a7301ed7b6 | ||
|
|
42ebfd5394 | ||
|
|
cdf2f84b14 | ||
|
|
2592aeab8b | ||
|
|
34d4225ea0 | ||
|
|
17dcb4b00e | ||
|
|
eb1d096539 | ||
|
|
05c74655be | ||
|
|
3e0e0ba3b1 | ||
|
|
f90b6cd18c | ||
|
|
f0ecfcb708 | ||
|
|
177702d027 | ||
|
|
64429232f8 | ||
|
|
d6b7fecb69 | ||
|
|
51a0ee56aa | ||
|
|
2ed369568c | ||
|
|
e5b7e16d1a | ||
|
|
4a9f676d5d | ||
|
|
0e0da3d767 | ||
|
|
343ce4a6a7 | ||
|
|
df8b854cb7 | ||
|
|
831dc770d8 | ||
|
|
8a9285c64f | ||
|
|
7e4e06b09d | ||
|
|
96748b3fbc | ||
|
|
f1325048e9 | ||
|
|
deee21eb68 | ||
|
|
2f43e5c5ea | ||
|
|
4766067edb | ||
|
|
bc54f22639 | ||
|
|
20c8c87e79 | ||
|
|
3a5dcd6a3c | ||
|
|
a5ba02c2bb | ||
|
|
e1554efc08 | ||
|
|
9d652dd41b | ||
|
|
22eadf2c08 | ||
|
|
d3f1b62208 | ||
|
|
affc28ab79 | ||
|
|
41be7f44ab | ||
|
|
646c1f0f16 | ||
|
|
3cea097b48 | ||
|
|
786d72575e | ||
|
|
6d9a794aaf | ||
|
|
9e69df1e94 | ||
|
|
72d4bb0206 | ||
|
|
f68e06a949 | ||
|
|
f4da539d95 | ||
|
|
17af75a9bb | ||
|
|
dcbb39d640 | ||
|
|
d0ba1df4e0 | ||
|
|
2b92869683 | ||
|
|
379a4b0ce4 | ||
|
|
d4c7d4a7e1 | ||
|
|
dcac24c9e2 | ||
|
|
753589d840 | ||
|
|
382903c9e1 | ||
|
|
f29fec0b31 | ||
|
|
f9dc37d60a | ||
|
|
c5e48c67bb | ||
|
|
cc62ebcffc | ||
|
|
0f36504959 | ||
|
|
1fb8e25209 | ||
|
|
260876b1a2 | ||
|
|
e4fc074f09 | ||
|
|
7899e5161e | ||
|
|
95603b1142 | ||
|
|
bf8e0eb812 | ||
|
|
0c04ffc1e8 | ||
|
|
bd86acf118 | ||
|
|
6caa16444e | ||
|
|
94d4cbeb82 | ||
|
|
b31f4bc00c | ||
|
|
cf0808e119 | ||
|
|
92333909fd | ||
|
|
9c68af92be | ||
|
|
bc5d7f5e93 | ||
|
|
f2ba9a88be | ||
|
|
81b711364e | ||
|
|
554e0c7fac | ||
|
|
bd2c1c387b | ||
|
|
f19edac9ca | ||
|
|
1698f6d1bf | ||
|
|
2c3180813a | ||
|
|
a262fe5d9d | ||
|
|
a69249ee22 | ||
|
|
393c2a81d1 | ||
|
|
3a6be342ce | ||
|
|
6616bfe53e | ||
|
|
bafe60f48f | ||
|
|
e306c415f0 | ||
|
|
56a8c8d48d | ||
|
|
421f1d39a4 | ||
|
|
7c655944a5 | ||
|
|
0a27f37dc0 | ||
|
|
4695932ea1 | ||
|
|
7fe7a12167 | ||
|
|
f9487b0ba3 | ||
|
|
7c5c34741c | ||
|
|
d09459f4bf | ||
|
|
c0c6598151 | ||
|
|
f52fcc6f0e | ||
|
|
2e9ef64bd2 | ||
|
|
ff3ee39830 | ||
|
|
abd757f3bc | ||
|
|
c741591a36 | ||
|
|
78c481d725 | ||
|
|
b2ece37819 | ||
|
|
a557b29ecf | ||
|
|
1184843318 | ||
|
|
dd1f8bd92a | ||
|
|
220c82954c | ||
|
|
8879bacb1d | ||
|
|
5824022745 | ||
|
|
3ecb5bd06a | ||
|
|
7de31a776b | ||
|
|
503320d13f | ||
|
|
bd263c5d22 | ||
|
|
b0201aef5d | ||
|
|
31014808c8 | ||
|
|
0906124867 | ||
|
|
43bb5ce653 | ||
|
|
7e66483b1a | ||
|
|
f96b606a1a | ||
|
|
30d26c3e44 | ||
|
|
57e450a745 | ||
|
|
24297bf396 | ||
|
|
481cd760a9 | ||
|
|
6d6043775e | ||
|
|
bb97ec8933 | ||
|
|
dc028b87e4 | ||
|
|
0d1b7a9c8a | ||
|
|
a6e602af1d | ||
|
|
04a6012e5d | ||
|
|
0f7691c722 | ||
|
|
f01a0a17c1 | ||
|
|
b291ab92b6 | ||
|
|
fb4bf4fcaa | ||
|
|
98816156d7 | ||
|
|
92bfb4c426 | ||
|
|
cac883c4a0 | ||
|
|
5a4fb90c96 | ||
|
|
c4f9eb65ae | ||
|
|
9f5557b33c | ||
|
|
4d876fdf5d | ||
|
|
978666c946 | ||
|
|
9b9fa696e8 | ||
|
|
088b22073c | ||
|
|
4f9831faa4 | ||
|
|
3373caa939 | ||
|
|
dc1be17b2a | ||
|
|
64a3b04181 | ||
|
|
57e1920b9c | ||
|
|
ddb6236eb9 | ||
|
|
4e4af590e5 | ||
|
|
a249f6b29b | ||
|
|
7787729b24 | ||
|
|
45c8c704af | ||
|
|
31fde1ad94 | ||
|
|
bfb0fbd656 | ||
|
|
8afb7457c2 | ||
|
|
0ae1c8f771 | ||
|
|
6ff046ae29 | ||
|
|
6f9f845bb2 | ||
|
|
00033c3a70 | ||
|
|
acf71610df | ||
|
|
86e9ae343a | ||
|
|
9bbd546d4c | ||
|
|
31f2573b28 | ||
|
|
4d7fcb77c2 | ||
|
|
da02a8c73a | ||
|
|
dd0b4505a6 | ||
|
|
eaff26216a | ||
|
|
e850dd1963 | ||
|
|
cf61ae0332 | ||
|
|
5cffe3fb05 | ||
|
|
b996918d3b | ||
|
|
4a9f9a45c2 | ||
|
|
3a75772005 | ||
|
|
c196e31c6c | ||
|
|
60ceff5ae0 | ||
|
|
34a4a0c892 | ||
|
|
2a3c42d47b | ||
|
|
0b1f796e0a | ||
|
|
766d4d23bf | ||
|
|
6860a1e992 | ||
|
|
70c628d759 | ||
|
|
6eff8bc273 | ||
|
|
0b1e8cdbf3 | ||
|
|
6f58b34f87 | ||
|
|
adf081ba3c | ||
|
|
6d4a9fde3f | ||
|
|
5a5cc4ea17 | ||
|
|
69df583508 | ||
|
|
18506d9932 | ||
|
|
f076e7609e | ||
|
|
0b0d053044 | ||
|
|
ce7dfdd986 | ||
|
|
50e589f27c | ||
|
|
e904dafa38 | ||
|
|
6a210fa212 | ||
|
|
ae33155ed3 | ||
|
|
d3d44001ef | ||
|
|
c2aec1ff57 | ||
|
|
d5f08fe950 | ||
|
|
bdf4df9fd0 | ||
|
|
7481b0939e | ||
|
|
346e59f18a | ||
|
|
4725aad3e9 | ||
|
|
59fd1bfdb2 | ||
|
|
7546d91580 | ||
|
|
c81df27470 | ||
|
|
bd6232d913 | ||
|
|
7f6b73e60f | ||
|
|
e3562f9e56 | ||
|
|
40141c55de | ||
|
|
a6f6cbd9b5 | ||
|
|
e9ffb4b9b5 | ||
|
|
1f0418a9cd | ||
|
|
e76837b42c | ||
|
|
87be7068c9 | ||
|
|
49cb5af265 | ||
|
|
f0fe93429f | ||
|
|
c2461f1219 | ||
|
|
f82b6b75ff | ||
|
|
3486b590eb | ||
|
|
5730af672c | ||
|
|
4daff05142 | ||
|
|
e930768c67 | ||
|
|
6f03e388bf | ||
|
|
9b340e03c5 | ||
|
|
d5b61fe5cc | ||
|
|
5b46e48a17 | ||
|
|
585221f7cc | ||
|
|
77eb7a5259 | ||
|
|
77bfc4b599 | ||
|
|
95bbfba1b8 | ||
|
|
844a50dfd8 | ||
|
|
cd2fea5262 | ||
|
|
79d8b4bb0b | ||
|
|
531825545d | ||
|
|
daab5b9238 | ||
|
|
ce59e5e6a7 | ||
|
|
ea0c4b5060 | ||
|
|
9b9908b660 | ||
|
|
101894be37 | ||
|
|
3e314251f2 | ||
|
|
1995c75006 | ||
|
|
ff85986c44 | ||
|
|
9131297d43 | ||
|
|
301f3091d1 | ||
|
|
b59bd449d4 | ||
|
|
5e510ef0e2 | ||
|
|
c7c3fcd0e0 | ||
|
|
a5532ad67b | ||
|
|
290cd5501c | ||
|
|
8d1b1410cd | ||
|
|
df9aead324 | ||
|
|
851fd240d3 | ||
|
|
2da03c89d1 | ||
|
|
89cd12d2c1 | ||
|
|
e21d2a0adb | ||
|
|
2fad64b08a | ||
|
|
97fd147fbe | ||
|
|
0f01f6af11 | ||
|
|
a9892c88be | ||
|
|
f1d76a042d | ||
|
|
77d4e5d051 | ||
|
|
7041acfd51 | ||
|
|
b27bfbe189 | ||
|
|
1c10e7a63d | ||
|
|
0a7c324d48 | ||
|
|
c81d247fbb | ||
|
|
82294b7b2e | ||
|
|
d80f55d5bf | ||
|
|
7930cda277 | ||
|
|
7870db7202 | ||
|
|
407538fd85 | ||
|
|
1a293420c0 | ||
|
|
1e94cdd8ca | ||
|
|
7a2311d6e6 | ||
|
|
e686937ae9 | ||
|
|
8dca8988fe | ||
|
|
c890ac5944 | ||
|
|
56e52fda80 | ||
|
|
e7786b3192 | ||
|
|
4cc3a84e98 | ||
|
|
6e0b048ae7 | ||
|
|
115786798d | ||
|
|
376db9e9e6 | ||
|
|
8abdb80e85 | ||
|
|
656f212608 | ||
|
|
60e07cc4ff | ||
|
|
e132c0a015 | ||
|
|
8e63526f2a | ||
|
|
a5b7c774c1 | ||
|
|
130a5bb8c4 | ||
|
|
3802dd9984 | ||
|
|
7d37397222 | ||
|
|
932454d7b2 | ||
|
|
5d2e6c46aa | ||
|
|
38089195be | ||
|
|
85a6c1d145 | ||
|
|
85d034b7fb | ||
|
|
82b5468fb4 | ||
|
|
89759c44af | ||
|
|
6f66a1d1c3 | ||
|
|
d4bac185f6 | ||
|
|
658bba576e | ||
|
|
31f3c25b18 | ||
|
|
4a1f149051 | ||
|
|
c55a78b8b4 | ||
|
|
3dbf957304 | ||
|
|
8f98f49f1b | ||
|
|
0a8322960b | ||
|
|
63d73c6f86 | ||
|
|
f8cbbe78a2 | ||
|
|
2bb09503c6 | ||
|
|
ba313decd1 | ||
|
|
0d6847c76c | ||
|
|
7b721c7849 | ||
|
|
1fb073fd6a | ||
|
|
484272aed4 | ||
|
|
57422ce793 | ||
|
|
ba855cd064 | ||
|
|
39ac9f7de6 | ||
|
|
4368035da4 | ||
|
|
4391912ee3 | ||
|
|
fc17536f55 | ||
|
|
3bae4338c3 | ||
|
|
f59bdd6b9f | ||
|
|
03f3676b00 | ||
|
|
e0d7079745 | ||
|
|
b7f421481f | ||
|
|
3506cb3f94 | ||
|
|
7280acee42 | ||
|
|
d757fa6306 | ||
|
|
475fc92629 | ||
|
|
f24303dd78 | ||
|
|
180a20f561 | ||
|
|
2e5ca5b9dc | ||
|
|
decee20fd8 | ||
|
|
3d9a60c415 | ||
|
|
a4a7002867 | ||
|
|
96c9a014e6 | ||
|
|
11b4471be9 | ||
|
|
17aea205f7 | ||
|
|
739f54ed87 | ||
|
|
01be5bee72 | ||
|
|
dfcf0da710 | ||
|
|
f47fb87d1b | ||
|
|
bd639ba936 | ||
|
|
e784e62a4e | ||
|
|
e4425dcbf8 | ||
|
|
0dcffe8771 | ||
|
|
2b27f6c452 | ||
|
|
3ba3c728bc | ||
|
|
7193198af2 | ||
|
|
6691afd160 | ||
|
|
59fb220197 | ||
|
|
ff7651d4c8 | ||
|
|
b02abb1f18 | ||
|
|
9f42da4686 | ||
|
|
58e3056374 | ||
|
|
3142865fef | ||
|
|
06e3497a57 | ||
|
|
e49833737d | ||
|
|
7eedc5fef8 | ||
|
|
c442942022 | ||
|
|
2c2652ed1d | ||
|
|
97bcc07aab | ||
|
|
001704b22e | ||
|
|
f1d9cd93ce | ||
|
|
49aa2aa858 | ||
|
|
6274d9a1e9 | ||
|
|
5fa9d91401 | ||
|
|
9acb803ffe | ||
|
|
105924bca3 | ||
|
|
5f12be2037 | ||
|
|
13931c40cb | ||
|
|
ada5d614c5 | ||
|
|
7323d51219 | ||
|
|
f5071f2667 | ||
|
|
0ca0a81644 | ||
|
|
e1bd69b467 | ||
|
|
b17494519e | ||
|
|
13555f505c | ||
|
|
2a65f53084 | ||
|
|
71fe83083e | ||
|
|
0ddb5c859f | ||
|
|
f7b12d5108 | ||
|
|
baa8f4334b | ||
|
|
24a211b190 | ||
|
|
6e82f254b7 | ||
|
|
fbfedcf8d6 | ||
|
|
5b06a0c2a4 | ||
|
|
f3204b0845 | ||
|
|
334314a137 | ||
|
|
8ecc8122b8 | ||
|
|
eb9a119dfe | ||
|
|
313ece62f7 | ||
|
|
5799bcceb2 | ||
|
|
61e7571388 | ||
|
|
6cfd99e40a | ||
|
|
b3bdd9d563 | ||
|
|
5bec3d8471 | ||
|
|
711e46ecfb | ||
|
|
ddd127352f | ||
|
|
784fd825bb | ||
|
|
673a42242d | ||
|
|
3317345d92 | ||
|
|
7958ba38d8 | ||
|
|
2dd7e0c03f | ||
|
|
b94f021567 | ||
|
|
cf50c5b535 | ||
|
|
1b71169565 | ||
|
|
30f2b9d5ed | ||
|
|
999d6a449b | ||
|
|
a65aa2a0d0 | ||
|
|
36fc0b6e8a | ||
|
|
f97362cdb1 | ||
|
|
6398484459 | ||
|
|
07e8c6feaa | ||
|
|
faf351a496 | ||
|
|
cd9315852e | ||
|
|
8c8487231a | ||
|
|
65ebdf0862 | ||
|
|
9704362501 | ||
|
|
f0e87cd85a | ||
|
|
f6e6bf1d6b | ||
|
|
4b4e8f806b | ||
|
|
4141cee13f | ||
|
|
b2ee346f68 | ||
|
|
2220f1ff05 | ||
|
|
7ba48dd666 | ||
|
|
2a48e2fd27 | ||
|
|
63a24c4448 | ||
|
|
787df3362b | ||
|
|
5ad0f60ee3 | ||
|
|
d42f92361a | ||
|
|
0693db3ef5 | ||
|
|
fafb0e2793 | ||
|
|
0a4819d172 | ||
|
|
ee03f32a3e | ||
|
|
f4e01917a2 | ||
|
|
eed9b36c9f | ||
|
|
055192c2a8 | ||
|
|
cca39108dc | ||
|
|
b1bbd5e366 | ||
|
|
afb718f01f | ||
|
|
653b4e0ab7 | ||
|
|
c3d228a9f5 | ||
|
|
15e10caca0 | ||
|
|
46efa85441 | ||
|
|
bb42456653 | ||
|
|
38bf80aa52 | ||
|
|
c5c2aa5348 | ||
|
|
1e67aeb667 | ||
|
|
9ac7bccba5 | ||
|
|
610b82cfb7 | ||
|
|
c8144539d0 | ||
|
|
60f83597ee | ||
|
|
46c0c6085d | ||
|
|
36d4c4af61 | ||
|
|
7406c3dc23 | ||
|
|
24bb15ce29 | ||
|
|
f3ad05dc85 | ||
|
|
bbae3223cb | ||
|
|
8cedb24d31 | ||
|
|
528414dfef | ||
|
|
6e1c58e343 | ||
|
|
002e935193 | ||
|
|
e26d7d346a | ||
|
|
5d917f2578 | ||
|
|
8aecff1879 | ||
|
|
718672119e | ||
|
|
6ec7482662 | ||
|
|
5f3ea7c634 | ||
|
|
1c813a59d0 | ||
|
|
a66236fc3d | ||
|
|
ef9b7022df | ||
|
|
ad7efce855 | ||
|
|
78a9990c3a | ||
|
|
422b9eb6c0 | ||
|
|
703eb271f9 | ||
|
|
2aca32c44a | ||
|
|
56c30bddb1 | ||
|
|
1179b50ad1 | ||
|
|
6ad44441a6 | ||
|
|
2455c09475 | ||
|
|
7a1e07e72a | ||
|
|
aa8e95885a | ||
|
|
54bae94ad9 | ||
|
|
98b7e01069 | ||
|
|
12c7707bc3 | ||
|
|
a8a2c7e345 | ||
|
|
6c7542ec0c | ||
|
|
5ec56cbe77 | ||
|
|
6b79770783 | ||
|
|
e125a83625 | ||
|
|
d05b47e996 | ||
|
|
e1093d0c0c | ||
|
|
25690648d6 | ||
|
|
5c3c4f6288 | ||
|
|
9dec5e9e54 | ||
|
|
ae1fa808da | ||
|
|
ed6839dc99 | ||
|
|
e95d71da0d | ||
|
|
128c8f3c06 | ||
|
|
04f61a1af7 | ||
|
|
974e86b698 | ||
|
|
12c03384b2 | ||
|
|
99ba912d7b | ||
|
|
7607932216 | ||
|
|
acc9c241a3 | ||
|
|
5f5055f4fc | ||
|
|
fc3749e008 | ||
|
|
155734370c | ||
|
|
1095e3d509 | ||
|
|
f7bfa47f2e | ||
|
|
9f6ef14ea1 | ||
|
|
15de08556e | ||
|
|
e7dfa8fcfe | ||
|
|
7a67dc5dfd | ||
|
|
7eb8ef42b7 | ||
|
|
c9c7a4beed | ||
|
|
bcf3aad1b2 | ||
|
|
ad75363028 | ||
|
|
f4ec3939a5 | ||
|
|
aead97d29d | ||
|
|
f468305a2c | ||
|
|
a962f469eb | ||
|
|
63e025cc02 | ||
|
|
b2d332f152 | ||
|
|
e160cf240c | ||
|
|
19a4f70c44 | ||
|
|
dcca3901d5 | ||
|
|
0ee4ffbfbc | ||
|
|
776bc781cd | ||
|
|
b1bb79e19f | ||
|
|
76c69b7bd1 | ||
|
|
15a25a412f | ||
|
|
b511d89dcc | ||
|
|
9512ae7aeb | ||
|
|
5db086e470 | ||
|
|
d63f668291 | ||
|
|
35c72a9570 | ||
|
|
b29f62ddd4 | ||
|
|
525dc17573 | ||
|
|
4d8ed24833 | ||
|
|
aa15d996e0 | ||
|
|
0ec846945d | ||
|
|
03ff158e76 | ||
|
|
b3371b2d63 | ||
|
|
ed64d03bf5 | ||
|
|
3d936dede1 | ||
|
|
33e9c5b1ea | ||
|
|
078c90bbc9 | ||
|
|
2caf2cad5a | ||
|
|
5dec21dd43 | ||
|
|
36aa9bd802 | ||
|
|
bed2f15a72 | ||
|
|
f949f1e88d | ||
|
|
8af202bd5f | ||
|
|
67556a88f1 | ||
|
|
4f8573784d | ||
|
|
c5a46be23e | ||
|
|
47a3c0bf55 | ||
|
|
e8d2a2a461 | ||
|
|
7b72a3fba4 | ||
|
|
dda79e7f27 | ||
|
|
9a104566ba | ||
|
|
b4d8982341 | ||
|
|
5ea3fc28f7 | ||
|
|
0bbf39660e | ||
|
|
791f38762b | ||
|
|
c296b909c7 | ||
|
|
9c7a54f8fc | ||
|
|
4289eab72b | ||
|
|
7b0dbc7445 | ||
|
|
02db904336 | ||
|
|
55140fee3a | ||
|
|
96d881a1f1 | ||
|
|
260a95c05e | ||
|
|
99d633587f | ||
|
|
cf2f0256a2 | ||
|
|
dae8e8dfbd | ||
|
|
6d2d35e82d | ||
|
|
5e23a6b640 | ||
|
|
f2ec502dc2 | ||
|
|
be04f31256 | ||
|
|
85dd881c97 | ||
|
|
0ef2dccd90 | ||
|
|
000ec39c81 | ||
|
|
3160c6ee0b | ||
|
|
9da403e534 | ||
|
|
f19c3408e1 | ||
|
|
38c0e09e8a | ||
|
|
2be4f7cdaf | ||
|
|
cd48272fbb | ||
|
|
a5a146bb02 | ||
|
|
c901bcf321 | ||
|
|
8f3142e532 | ||
|
|
88438d6db4 | ||
|
|
7348734070 | ||
|
|
a99a4a3a2b | ||
|
|
7bc8c3ab5b | ||
|
|
2a58fbdd22 | ||
|
|
d102f5a88a | ||
|
|
8227f7125b | ||
|
|
673535dc08 | ||
|
|
9750489d07 | ||
|
|
53c6224ed0 | ||
|
|
f84794acbe | ||
|
|
9e535e509a | ||
|
|
489210424f | ||
|
|
394abbdb6f | ||
|
|
5fdeb92429 | ||
|
|
11cc39e41b | ||
|
|
b3d5851fdc | ||
|
|
5c25839bab | ||
|
|
fbd314b447 | ||
|
|
86888a32d4 | ||
|
|
37c2d22b10 | ||
|
|
19758ef75d | ||
|
|
519ccc90f7 | ||
|
|
b592d15d1f | ||
|
|
78d70a892c | ||
|
|
dbcf4c1800 | ||
|
|
cbd4630b3c | ||
|
|
92fdfe3f35 | ||
|
|
8b563e5232 | ||
|
|
aeb4875fa5 | ||
|
|
5ebb9c61f9 | ||
|
|
c0e5b8fe15 | ||
|
|
f852efea7d | ||
|
|
664ae905bb | ||
|
|
243b0fd109 | ||
|
|
43b0944403 | ||
|
|
ecc3c9f7b4 | ||
|
|
296249b203 | ||
|
|
8c1145bb9f | ||
|
|
7ad18a68f8 | ||
|
|
99ba396c24 | ||
|
|
f88e9960f2 | ||
|
|
b53466ea0d | ||
|
|
2afda6a470 | ||
|
|
acc8081ef2 | ||
|
|
7433677ead | ||
|
|
4132f7efe6 | ||
|
|
56e0f5797e | ||
|
|
54c142ce78 | ||
|
|
c106aeef2b | ||
|
|
66bde85807 | ||
|
|
08363511a7 | ||
|
|
d6b93b712c | ||
|
|
a85d6d0f4c | ||
|
|
2c1f341099 | ||
|
|
52bb709ca5 | ||
|
|
24ea958748 | ||
|
|
b6143ce54c | ||
|
|
463ea7d34b | ||
|
|
1015302a7f | ||
|
|
c73f5917f8 | ||
|
|
9315cfa488 | ||
|
|
0f58b5780a | ||
|
|
edd5f07d48 | ||
|
|
a7f258f2b1 | ||
|
|
65dcb72cba | ||
|
|
4885c536c8 | ||
|
|
b6204dab78 | ||
|
|
5b5951483a | ||
|
|
194d53569f | ||
|
|
5e8b54be7e | ||
|
|
8dc91e413e | ||
|
|
57cf513b39 | ||
|
|
bb1326860b | ||
|
|
136838e40b | ||
|
|
30d9483504 | ||
|
|
05d3c50866 | ||
|
|
d5e93d863a | ||
|
|
d3f93aae15 | ||
|
|
963e4aa7ec | ||
|
|
5a250ea247 | ||
|
|
bc8d8aafc0 | ||
|
|
f67ab4ec7f | ||
|
|
cf9af20fbd | ||
|
|
3be2a3eb79 | ||
|
|
7dfd18f4fb | ||
|
|
05fc960338 | ||
|
|
21d41ce14b | ||
|
|
1562ba3f97 | ||
|
|
2798e73707 | ||
|
|
89aeee4269 | ||
|
|
d50302fa41 | ||
|
|
8efae54450 | ||
|
|
2785a72789 | ||
|
|
ac55a44761 | ||
|
|
42f1a286a8 | ||
|
|
241fa5d485 | ||
|
|
e87f9c5710 | ||
|
|
c95a6ee3fd | ||
|
|
10b954cb1a | ||
|
|
cf7914b6f8 | ||
|
|
e58e048f00 | ||
|
|
b92cd8a64f | ||
|
|
317aead26d | ||
|
|
e93780c66c | ||
|
|
af8990acf0 | ||
|
|
e41dcf03ad | ||
|
|
0209e8f782 | ||
|
|
50d935171e | ||
|
|
86ee9089e9 | ||
|
|
ba6fe112bb | ||
|
|
15860a7795 | ||
|
|
78b3ad8075 | ||
|
|
f61bda330e | ||
|
|
5c9fceea2c | ||
|
|
32cceebc47 | ||
|
|
9d921df733 | ||
|
|
428f8c183d | ||
|
|
45aae54b32 | ||
|
|
d9ca73bc4c | ||
|
|
c2e24da9bd | ||
|
|
c6ae5ed551 | ||
|
|
0f86a5ee8a | ||
|
|
803e53869b | ||
|
|
a4fc25cca8 | ||
|
|
28fbcf5628 | ||
|
|
3ea73febe4 | ||
|
|
9eb3b3e1c3 | ||
|
|
48e1c39320 | ||
|
|
fe38c7650f | ||
|
|
5e2f5010f8 | ||
|
|
efce4703ca | ||
|
|
94ab4a5ac5 | ||
|
|
58321be1ce |
No files matched your search
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots (OPTIONAL)**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Logs**
|
||||
- Paste the output of the console window in a text file, and attach the text file.
|
||||
- If applicable (`logfile` set to 2), attach the `qconsole.log` file. On Windows, it can be found in **%APPDATA%\...\qconsole.log** and on Linux, it can be found on the home directory **~/.openmohaa/.../qconsole.log**.
|
||||
|
||||
**Version information (please complete the following information):**
|
||||
- OS: [e.g. `Debian`]
|
||||
- OS Version [e.g `12`]
|
||||
- OpenMoHAA Version: [e.g `0.70.0-alpha+0.0b1a20dcf win_msvc64-x86_64-debug`, can be found below **Common Initialization** in the console, or by typing `version`]
|
||||
|
||||
**Dump (OPTIONAL)**
|
||||
You can include a core dump generated by the OS (`.dmp` file). If you compiled OpenMoHAA yourself, also add all output openmohaa binaries (except libopenal and libSDL).
|
||||
|
||||
**Additional context (OPTIONAL)**
|
||||
Add any other context about the problem here.
|
||||
@@ -2,6 +2,8 @@ name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
pull_request:
|
||||
workflow_call:
|
||||
|
||||
@@ -18,10 +20,13 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
architecture: [
|
||||
{name: 'amd64', triple: 'x86_64-linux-gnu'},
|
||||
{name: 'i686', triple: 'i686-linux-gnu'},
|
||||
{name: 'aarch64', triple: 'aarch64-linux-gnu'},
|
||||
{name: 'armhf', triple: 'arm-linux-gnueabihf'}
|
||||
{name: 'amd64', triple: 'x86_64-linux-gnu'},
|
||||
{name: 'i686', triple: 'i686-linux-gnu'},
|
||||
{name: 'arm64', triple: 'aarch64-linux-gnu'},
|
||||
{name: 'armhf', triple: 'arm-linux-gnueabihf'},
|
||||
{name: 'powerpc', triple: 'powerpc-linux-gnu'},
|
||||
{name: 'ppc64', triple: 'powerpc64-linux-gnu'},
|
||||
{name: 'ppc64el', triple: 'powerpc64le-linux-gnu'}
|
||||
]
|
||||
|
||||
name: "Building for platform linux-${{matrix.architecture.name}}"
|
||||
@@ -36,7 +41,8 @@ jobs:
|
||||
|
||||
- name: Install required packages
|
||||
run: |
|
||||
sudo apt update && sudo apt install -y flex bison
|
||||
sudo apt update && sudo apt install -y flex bison \
|
||||
libpulse-dev portaudio19-dev libasound2-dev libjack-dev libpipewire-0.3-dev qtbase5-dev libdbus-1-dev
|
||||
|
||||
- name: Install required cross-platform packages (${{ matrix.architecture.triple }})
|
||||
if: matrix.architecture.name != 'amd64'
|
||||
@@ -54,7 +60,27 @@ jobs:
|
||||
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }}
|
||||
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }}"
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
# soft-oal setup
|
||||
# Use GCC instead of Clang because of missing SSE intrinsics
|
||||
# It also doesn't enable altivec support on PowerPC by default
|
||||
- name: Checkout soft-oal
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'kcat/openal-soft'
|
||||
path: 'thirdparties/soft-oal'
|
||||
ref: '1.23.1'
|
||||
|
||||
- name: Configure and install soft-oal
|
||||
working-directory: ${{github.workspace}}/thirdparties/soft-oal
|
||||
run: |
|
||||
cmake -B ./build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
|
||||
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' \
|
||||
-DCMAKE_C_COMPILER=${{ matrix.architecture.triple }}-gcc-12 \
|
||||
-DCMAKE_CXX_COMPILER=${{ matrix.architecture.triple }}-g++-12
|
||||
cmake --build ./build --config ${{env.BUILD_TYPE}}
|
||||
cmake --install ./build --config ${{env.BUILD_TYPE}}
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'source'
|
||||
|
||||
@@ -67,6 +93,8 @@ jobs:
|
||||
-DCMAKE_CXX_COMPILER=clang++ \
|
||||
-DCMAKE_C_FLAGS=--target=${{ matrix.architecture.triple }} \
|
||||
-DCMAKE_CXX_FLAGS=--target=${{ matrix.architecture.triple }} \
|
||||
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' \
|
||||
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' \
|
||||
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure CMake
|
||||
@@ -92,9 +120,11 @@ jobs:
|
||||
# Install to the directory defined in CMAKE_INSTALL_PREFIX
|
||||
run: |
|
||||
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
cp '${{steps.sdl.outputs.prefix}}/lib/libSDL2.so' '${{github.workspace}}/install'
|
||||
# Create hard-link and copy symbolic links
|
||||
cp -l ${{steps.sdl.outputs.prefix}}/lib/libSDL2-2.0.so.0 '${{github.workspace}}/install/'
|
||||
cp -l ${{github.workspace}}/thirdparties/soft-oal/install/lib/libopenal.so.1 '${{github.workspace}}/install/'
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: out-linux-${{matrix.architecture.name}}
|
||||
if-no-files-found: error
|
||||
@@ -119,7 +149,7 @@ jobs:
|
||||
run: |
|
||||
echo "CMAKE_BUILD_PARALLEL_LEVEL=$((Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors * 16)" >> $GITHUB_ENV
|
||||
|
||||
# Setup SDL
|
||||
# Setup SDL
|
||||
- name: Set up SDL
|
||||
id: sdl
|
||||
uses: libsdl-org/setup-sdl@main
|
||||
@@ -137,7 +167,38 @@ jobs:
|
||||
cmake --build winflexbison-build --config Release --parallel
|
||||
cmake --install winflexbison-build
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
# soft-oal setup
|
||||
- name: Checkout soft-oal
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: 'kcat/openal-soft'
|
||||
path: 'thirdparties/soft-oal'
|
||||
ref: '1.23.1'
|
||||
|
||||
# soft-oal build
|
||||
# Statically link the CRT runtime into OAL as a workaround to prevent crashes
|
||||
- name: Configure and install soft-oal
|
||||
working-directory: ${{github.workspace}}/thirdparties/soft-oal
|
||||
run: |
|
||||
cmake -B ./build -A ${{ matrix.architecture.config }} `
|
||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} `
|
||||
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/thirdparties/soft-oal/install' `
|
||||
-DALSOFT_BUILD_ROUTER=OFF `
|
||||
-DALSOFT_REQUIRE_WINMM=ON `
|
||||
-DALSOFT_REQUIRE_DSOUND=ON `
|
||||
-DALSOFT_REQUIRE_WASAPI=ON `
|
||||
-DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
|
||||
-DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG" `
|
||||
-DCMAKE_C_FLAGS_MINSIZEREL="/MT /O2 /Ob2 /DNDEBUG" `
|
||||
-DCMAKE_CXX_FLAGS_MINSIZEREL="/MT /O1 /Ob1 /DNDEBUG" `
|
||||
-DCMAKE_C_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG" `
|
||||
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="/MT /Zi /O2 /Ob1 /DNDEBUG"
|
||||
cmake --build ./build --config ${{env.BUILD_TYPE}}
|
||||
cmake --install ./build --config ${{env.BUILD_TYPE}}
|
||||
# Unfortunately soft-oal produces a binary called OpenAL32 even in 64-bit
|
||||
if (("x64", "ARM64") -icontains "${{ matrix.architecture.config }}") { Rename-Item -Path '.\install\bin\OpenAL32.dll' -NewName 'OpenAL64.dll' }
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: 'source'
|
||||
|
||||
@@ -149,6 +210,8 @@ jobs:
|
||||
-DCMAKE_INSTALL_PREFIX='${{github.workspace}}/install' `
|
||||
-DGIT_REVISION_BUILD_NUMBER=${{ github.run_number }} `
|
||||
-DBISON_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_bison.exe' `
|
||||
-DOPENAL_LIBRARY='${{github.workspace}}/thirdparties/soft-oal' `
|
||||
-DOPENAL_INCLUDE_DIR='${{github.workspace}}/thirdparties/soft-oal/include' `
|
||||
-DFLEX_EXECUTABLE='${{github.workspace}}/thirdparties/winflexbison-install/win_flex.exe'".Replace("`r", "").Replace("`n", "") >> $env:GITHUB_ENV
|
||||
|
||||
- name: Configure CMake
|
||||
@@ -175,8 +238,9 @@ jobs:
|
||||
run: |
|
||||
cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
Copy-Item '${{steps.sdl.outputs.prefix}}/bin/*.dll' -Destination '${{github.workspace}}/install'
|
||||
Copy-Item '${{github.workspace}}/thirdparties/soft-oal/install/bin/*.dll' -Destination '${{github.workspace}}/install'
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: out-windows-${{matrix.architecture.name}}
|
||||
if-no-files-found: error
|
||||
@@ -184,7 +248,7 @@ jobs:
|
||||
${{github.workspace}}/install
|
||||
!${{github.workspace}}/install/**/*.pdb
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: out-windows-${{matrix.architecture.name}}-pdb
|
||||
if-no-files-found: error
|
||||
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Setup SDL
|
||||
- name: Set up SDL
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
@@ -79,6 +79,6 @@ jobs:
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
@@ -25,8 +25,11 @@ jobs:
|
||||
target_os: [
|
||||
'linux-amd64',
|
||||
'linux-i686',
|
||||
'linux-aarch64',
|
||||
'linux-arm64',
|
||||
'linux-armhf',
|
||||
'linux-powerpc',
|
||||
'linux-ppc64',
|
||||
'linux-ppc64el',
|
||||
'windows-x64',
|
||||
'windows-x86',
|
||||
'windows-x64-pdb',
|
||||
@@ -43,7 +46,7 @@ jobs:
|
||||
RELEASE_NAME: ${{ github.event.repository.name }}-${{github.ref_name}}-${{matrix.target_os}}
|
||||
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: 'out-${{matrix.target_os}}'
|
||||
path: ${{github.workspace}}/${{matrix.target_os}}
|
||||
@@ -53,7 +56,7 @@ jobs:
|
||||
run: zip -r ../${{ env.RELEASE_NAME }}.zip ./
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
name: '${{github.ref_name}}-${{env.RELEASE_TYPE}}'
|
||||
prerelease: ${{env.RELEASE_IS_PRERELEASE}}
|
||||
|
||||
+4
-1
@@ -5,6 +5,8 @@ Makefile.local
|
||||
*.swp
|
||||
*tags
|
||||
*~
|
||||
/.vscode/
|
||||
/baseq3
|
||||
|
||||
# OS X
|
||||
####################
|
||||
@@ -44,5 +46,6 @@ profile
|
||||
*.suo
|
||||
|
||||
.vs
|
||||
out
|
||||
code_unfinished/*
|
||||
thirdparties/
|
||||
code/parser/generated/*
|
||||
+22
-13
@@ -11,17 +11,33 @@ if(TARGET_GAME_TYPE)
|
||||
endif()
|
||||
|
||||
|
||||
set(TARGET_BASE_GAME "main")
|
||||
set(TARGET_BASE_GAME "./")
|
||||
set(CMAKE_DEBUG_POSTFIX "-dbg")
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# Treat no return type as error
|
||||
add_compile_options(/we4715)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
add_compile_options(-Wno-comment)
|
||||
# Treat no return type as error
|
||||
add_compile_options(-Werror=return-type)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# Ignore warnings for code like 'assert("Assert string")'
|
||||
add_compile_options(-Wno-pointer-bool-conversion)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# Add this option on gcc to prevent functions from having the STB_GNU_UNIQUE binding
|
||||
# Otherwise, it would prevent libraries from being unloaded
|
||||
# which will cause undefined behavior and crashes due to memory corruption
|
||||
add_compile_options(-fno-gnu-unique)
|
||||
endif()
|
||||
|
||||
if(DEBUG_MEMORY)
|
||||
add_definitions(-D_DEBUG_MEM)
|
||||
endif()
|
||||
@@ -47,6 +63,7 @@ ENDIF()
|
||||
IF(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_definitions(-D_DEBUG)
|
||||
|
||||
# NOTE: The following may mess up function importation
|
||||
#if(UNIX)
|
||||
# # Enable all exports so all functions name can be seen during executable crash
|
||||
# set(CMAKE_ENABLE_EXPORTS ON)
|
||||
@@ -73,6 +90,7 @@ target_compile_features(omohaaded PUBLIC c_variadic_macros)
|
||||
target_link_libraries(omohaaded PRIVATE omohserver)
|
||||
target_link_libraries(omohaaded PRIVATE syslib)
|
||||
target_link_libraries(omohaaded PRIVATE qcommon qcommon_standalone)
|
||||
|
||||
# Gamespy dependency
|
||||
target_include_directories(omohaaded PUBLIC "code/qcommon" "code/script" "code/gamespy" "code/server")
|
||||
set_target_properties(omohaaded PROPERTIES OUTPUT_NAME "omohaaded${TARGET_BASE_SUFFIX}${TARGET_ARCH_SUFFIX}")
|
||||
@@ -87,10 +105,10 @@ INSTALL(TARGETS omohaaded DESTINATION "./")
|
||||
|
||||
if (NOT BUILD_NO_CLIENT)
|
||||
## Client app
|
||||
|
||||
|
||||
add_subdirectory("code/client")
|
||||
add_subdirectory("code/renderer")
|
||||
add_subdirectory("code/sdl")
|
||||
add_subdirectory("code/client")
|
||||
|
||||
#include("code/renderergl2/glsl/shaders.cmake")
|
||||
#file(GLOB_RECURSE SOURCES_RENDERER "code/sdl/*.c" "code/renderercommon/*.c" "code/renderergl2/*.c" "code/renderergl2/*.cpp")
|
||||
@@ -110,15 +128,6 @@ if (NOT BUILD_NO_CLIENT)
|
||||
set_target_properties(openmohaa PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
||||
|
||||
target_link_libraries(openmohaa PRIVATE jpeg8)
|
||||
if (USE_OPENAL)
|
||||
# Try to use OpenAL
|
||||
find_package(OpenAL)
|
||||
if (OPENAL_FOUND)
|
||||
target_compile_definitions(openmohaa PRIVATE USE_OPENAL=1)
|
||||
target_include_directories(openmohaa PRIVATE ${OPENAL_INCLUDE_DIR})
|
||||
target_link_libraries(openmohaa PRIVATE ${OPENAL_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
target_link_options(openmohaa PRIVATE "/MANIFEST:NO")
|
||||
|
||||
@@ -15,116 +15,48 @@
|
||||
|_|
|
||||
```
|
||||
|
||||
## Current State
|
||||
## Intro
|
||||
|
||||
OpenMoHAA is still under development. The single-player campaign is not yet functional due to AI not being fully implemented, and due to the script engine having a few issues. But the `training` map can be played from start to end. The current focus is on multiplayer.
|
||||
The main goal of OpenMoHAA is to ensure the future and continuity of **Medal of Honor: Allied Assault**. It has always been a dream in the community to provide patches and security fixes for the game. Thanks to the ioquake3 project, F.A.K.K SDK and other quality tools, OpenMoHAA has already reached more than half of its goal: to create an open-source version of MoH:AA (based on version 2.40) that is fully compatible with the original game (in terms of protocol, assets, and scripts).
|
||||
|
||||
## Running
|
||||
## Getting started
|
||||
|
||||
Backup existing mohaa files, **cgamex86.dll** and **gamex86.dll** (set their extension to **.bak**)
|
||||
- [Installing OpenMoHAA](docs/getting_started_installation.md)
|
||||
- [Running OpenMoHAA and using expansion assets](docs/getting_started_running.md)
|
||||
|
||||
a) extract archive to your MOHAA installation directory.
|
||||
## Current state
|
||||
|
||||
-or-
|
||||
### Single-player
|
||||
|
||||
b) Copy all pak*.pk3 files and the sound/ directory from your **MOHAA/main** directory into openmohaa's 'main' directory.
|
||||
The entire single-player campaign can be played from start to end. There may be occasional bugs though; if you encounter any, please create a new [GitHub issue](https://github.com/openmoh/openmohaa/issues) describing them.
|
||||
|
||||
If you have problems running the game :
|
||||
### Multiplayer
|
||||
|
||||
You may need to install Microsoft Visual C++ 2015/2017/2019/2022 Redistributable from
|
||||
The Multiplayer part is almost fully stable.
|
||||
|
||||
https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170
|
||||
Server admins can use OpenMoHAA to [host](docs/getting_started_installation.md#server) a mohaa/mohaas/mohaab server. Bugs must be reported by creating a new [issue](https://github.com/openmoh/openmohaa/issues) on the OpenMoHAA GitHub project. Players can use OpenMoHAA to [play](docs/getting_started_installation.md#client) on a mohaa/mohaas/mohaab server.
|
||||
|
||||
You can now start a local OpenMOHAA server or play on a server.
|
||||
All game modes including `Tug-of-War` from Medal of Honor: Spearhead, and `Liberation` from Medal of Honor: Breakthrough are implemented and are working as intended. Mods like `Freeze-Tag` are working as well.
|
||||
|
||||
**Medal of Honor: Allied Assault Spearhead** and **Medal of Honor: Allied Assault Breakthrough** are supported in OpenMoHAA using the `com_target_game` variable. To play an expansion, append the following command-line arguments to the executable:
|
||||
## Features
|
||||
|
||||
- `+set com_target_game 1` for Spearhead (mohaas/mohta)
|
||||
- `+set com_target_game 2` for Breakthrough (mohaab/mohtt)
|
||||
|
||||
On Windows, you can create a shortcut to OpenMoHAA with these command-line arguments.
|
||||
The default value of `com_target_game` is 0 for the base game.
|
||||
|
||||
With `com_target_game`, OpenMoHAA will support the network protocol accordingly
|
||||
|
||||
### Playing with bots
|
||||
|
||||
OpenMoHAA has a basic bot system that emulates real players. The maximum number of bots is defined by the `sv_maxbots` variable, and the number of initial bots is defined by the `sv_numbots` variable. Bots can also be added or removed using the `addbot` and `removebot` commands.
|
||||
|
||||
This feature is a great way to test the gameplay and mods.
|
||||
|
||||
## Builds
|
||||
|
||||
### Server
|
||||
|
||||
The server version can be built successfully, but some features are not functional. For example, the Actor and Vehicle systems are almost fully implemented, but they are not yet stable. This means that they may not work as expected and could cause crashes.
|
||||
|
||||
Overall, the server and the fgame components are almost fully implemented, but they may not be completely stable. There could be some minor bugs (and rare crashes), but the game should be playable.
|
||||
|
||||
### Client
|
||||
|
||||
The client version of OpenMoHAA has undergone partial implementation, with the cgame module being nearly completed. Credits to the SDK of **Heavy Metal: F.A.K.K. 2** both the cgame and fgame modules.
|
||||
|
||||
The current operational status for each component is as follow:
|
||||
|
||||
| Component | Full | Almost | Half | Early | Bad | Not working | Comment |
|
||||
|-------------------------|------|--------|------|-------|-----|-------------|-------------------------------------------------------------------|
|
||||
| Audio | | | | | x | | Very basic implementation from Quake III |
|
||||
| CG Module | | x | | | | | Missing FX, Marks and decals |
|
||||
| Client | | x | | | | | Missing GameSpy, server list, binds, map picker, ... |
|
||||
| Collision | x | | | | | | |
|
||||
| Model/TIKI/Skeletor | x | | | | | | |
|
||||
| Renderer | | x | | | | | Missing ghost, marks, sphere lights, sky portal, sun flare, swipe |
|
||||
| Server | | x | | | | | Probably a few bugs remaining |
|
||||
| Server module (fgame) | | x | | | | | Actor, vehicle, and few gameplay bugs |
|
||||
| UI | | | x | | | | Has core features only (menu, widgets, console, hud, urc loading) |
|
||||
- [What's working](docs/features_implementation.md)
|
||||
- [New features](docs/features.md)
|
||||
- [Scripting commands](https://htmlpreview.github.io/?https://github.com/openmoh/openmohaa/blob/main/docs/features_g_allclasses.html)
|
||||
|
||||
## Compiling
|
||||
|
||||
OpenMoHAA supports any architecture, thanks to the CMake build system and cross-platform code/libraries. While the most common little-Endian architectures (arm, aarch64, x86, x86_64) have been tested and confirmed to work, big-Endian architectures should be supported as well; however, they remain untested.
|
||||
|
||||
The following tools are required for all platforms:
|
||||
- CMake >= 3.5
|
||||
- Flex and Bison
|
||||
- A C++11 compiler is also required.
|
||||
|
||||
The installation directory can be set to the MOHAA directory.
|
||||
|
||||
By default, the build will produce both the client and dedicated server versions. The client build can be excluded by appending `-DBUILD_NO_CLIENT=1` to the CMake command-line arguments. Using this parameter will result in only the server portion being built.
|
||||
|
||||
### Linux
|
||||
|
||||
These are the tools required on Linux :
|
||||
- Clang >= 3.3 or GCC >= 4.8.1
|
||||
|
||||
**clang-3.5** and **gcc-4.8.5** should work (tested on Ubuntu 16.04). Use the latest possible version of those compilers.
|
||||
|
||||
SDL2 library is required (libsdl2-dev).
|
||||
|
||||
1 line install command with latest clang version : `sudo apt-get install -y ninja-build cmake make clang-15 lld-15 flex bison libsdl2-dev`
|
||||
|
||||
Example with **CMake**, **clang-15** and **ninja-build** installed:
|
||||
```sh
|
||||
mkdir .cmake && cd .cmake
|
||||
cmake -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15 -G Ninja
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
Visual Studio (2019 or 2022) is generally preferred.
|
||||
|
||||
Flex and Bison can be downloaded from here: https://github.com/lexxmark/winflexbison/releases/tag/v2.5.25
|
||||
|
||||
Append `-DFLEX_EXECUTABLE=...\win_flex.exe -DBISON_EXECUTABLE=...\win_bison.exe` to the CMake command-line to use the package from the link above.
|
||||
- See [Compiling OpenMoHAA](docs/compiling.md)
|
||||
|
||||
## Screenshots
|
||||
|
||||
| | |
|
||||
|-------------------------------------------------------------------------------|----------------------------------------------------------------------|
|
||||
|  |  |
|
||||
|  |  |
|
||||
|  |  |
|
||||
| | |
|
||||
|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------|
|
||||
|  |  |
|
||||
|  |  |
|
||||
|  |  |
|
||||
|
||||
*More screenshots [here](docs/images)*
|
||||
|
||||
## Third party
|
||||
|
||||
|
||||
+13
-5
@@ -3,8 +3,12 @@ set(archdetect_c_code "
|
||||
# error cmake_ARCH x86
|
||||
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
|
||||
# error cmake_ARCH x86_64
|
||||
#elif defined(__ppc64__) || defined(__powerpc64__)
|
||||
# error cmake_ARCH ppc64
|
||||
#elif defined(__PPC64__) || defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_PPC64)
|
||||
# if __BIG_ENDIAN__
|
||||
# error cmake_ARCH ppc64
|
||||
# else
|
||||
# error cmake_ARCH ppc64el
|
||||
# endif
|
||||
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__)
|
||||
# error cmake_ARCH ppc
|
||||
#elif defined __s390__
|
||||
@@ -19,10 +23,14 @@ set(archdetect_c_code "
|
||||
# error cmake_ARCH alpha
|
||||
#elif defined __sparc__
|
||||
# error cmake_ARCH sparc
|
||||
#elif defined __arm__ || defined (_M_ARM)
|
||||
# error cmake_ARCH arm
|
||||
#elif defined(__aarch64__) || defined(__ARM64__) || defined(_M_ARM64)
|
||||
# error cmake_ARCH aarch64
|
||||
# error cmake_ARCH arm64
|
||||
#elif defined __arm__ || defined (_M_ARM)
|
||||
# if defined(__ARM_PCS_VFP) && (__ARM_PCS_VFP)
|
||||
# error cmake_ARCH armhf
|
||||
# else
|
||||
# error cmake_ARCH armel
|
||||
# endif
|
||||
#elif defined __cris__
|
||||
# error cmake_ARCH cris
|
||||
#elif defined __hppa__
|
||||
|
||||
@@ -933,10 +933,13 @@ static void waitToApplyUpdates(void)
|
||||
OS forcibly closes the pipe), we will unblock. Then we can loop on
|
||||
kill() until the process is truly gone. */
|
||||
int x = 0;
|
||||
struct timespec req;
|
||||
req.tv_sec = 0;
|
||||
req.tv_nsec = 100000000;
|
||||
read(3, &x, sizeof (x));
|
||||
info("Pipe has closed, waiting for process to fully go away now.");
|
||||
while (kill(options.waitforprocess, 0) == 0) {
|
||||
usleep(100000);
|
||||
nanosleep(&req, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ set(SOURCES_SHARED
|
||||
"../script/scriptvariable.cpp"
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE SOURCES_BG "../fgame/bg_misc.cpp" "../fgame/bg_pmove.cpp" "../fgame/bg_slidemove.cpp")
|
||||
file(GLOB_RECURSE SOURCES_BG "../fgame/bg_misc.cpp" "../fgame/bg_pmove.cpp" "../fgame/bg_slidemove.cpp" "../fgame/bg_voteoptions.cpp")
|
||||
file(GLOB_RECURSE SOURCES_CGAME "./*.c" "./*.cpp")
|
||||
|
||||
add_library(cgame SHARED ${SOURCES_CGAME} ${SOURCES_BG})
|
||||
|
||||
+142
-10
@@ -22,43 +22,175 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "cg_local.h"
|
||||
#include "cg_archive.h"
|
||||
#include "cg_commands.h"
|
||||
#include "memarchiver.h"
|
||||
#include "../qcommon/tiki.h"
|
||||
|
||||
void CG_ArchiveStuff(MemArchiver& archiver, int svsTime)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
archiver.SetBaseTime(svsTime);
|
||||
commandManager.ArchiveToMemory(archiver);
|
||||
CG_ArchiveVSSGlobals(archiver);
|
||||
}
|
||||
|
||||
void CG_SaveStateToBuffer(void** out, int svsTime)
|
||||
size_t CG_SaveStateToBuffer(void** out, int svsTime)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
MemArchiver archiver;
|
||||
size_t size;
|
||||
|
||||
archiver.SetupForWriting(0x200000);
|
||||
CG_ArchiveStuff(archiver, svsTime);
|
||||
size = archiver.BufferSize();
|
||||
if (size && out) {
|
||||
*out = archiver.ConfiscateBuffer();
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
void CG_LoadStateToBuffer(void* state, int size, int svsTime)
|
||||
qboolean CG_LoadStateToBuffer(void* state, size_t size, int svsTime)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
MemArchiver archiver;
|
||||
|
||||
archiver.SetupForReading((byte*)state, size);
|
||||
CG_ArchiveStuff(archiver, svsTime);
|
||||
|
||||
return archiver.FinishedReading();
|
||||
}
|
||||
|
||||
void CG_ArchiveStringContainer(MemArchiver& archiver, Container<str>* container)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
int num;
|
||||
int i;
|
||||
|
||||
if (archiver.IsReading()) {
|
||||
str tmp;
|
||||
|
||||
archiver.ArchiveInteger(&num);
|
||||
container->ClearObjectList();
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
archiver.ArchiveString(&tmp);
|
||||
container->AddObject(tmp);
|
||||
}
|
||||
} else {
|
||||
num = container->NumObjects();
|
||||
archiver.ArchiveInteger(&num);
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
str& tmp = container->ObjectAt(i + 1);
|
||||
archiver.ArchiveString(&tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CG_ArchiveTikiPointer(MemArchiver& archiver, dtiki_t** pTiki)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
str tmp;
|
||||
|
||||
if (archiver.IsReading()) {
|
||||
archiver.ArchiveString(&tmp);
|
||||
if (tmp.length()) {
|
||||
*pTiki = cgi.R_Model_GetHandle(cgi.R_RegisterModel(tmp.c_str()));
|
||||
} else {
|
||||
*pTiki = NULL;
|
||||
}
|
||||
} else {
|
||||
if (*pTiki) {
|
||||
tmp = (*pTiki)->name;
|
||||
}
|
||||
|
||||
archiver.ArchiveString(&tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void CG_ArchiveModelHandle(MemArchiver& archiver, qhandle_t* handle)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
str tmp;
|
||||
|
||||
if (archiver.IsReading()) {
|
||||
archiver.ArchiveString(&tmp);
|
||||
if (tmp.length()) {
|
||||
*handle = cgi.R_RegisterModel(tmp.c_str());
|
||||
} else {
|
||||
*handle = (qhandle_t)0;
|
||||
}
|
||||
} else {
|
||||
if (*handle) {
|
||||
tmp = cgi.R_GetModelName(*handle);
|
||||
} else {
|
||||
tmp = "";
|
||||
}
|
||||
|
||||
archiver.ArchiveString(&tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void CG_ArchiveShaderHandle(MemArchiver& archiver, qhandle_t* handle)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
str tmp;
|
||||
|
||||
if (archiver.IsReading()) {
|
||||
archiver.ArchiveString(&tmp);
|
||||
if (tmp.length()) {
|
||||
*handle = cgi.R_RegisterShader(tmp.c_str());
|
||||
} else {
|
||||
*handle = (qhandle_t)0;
|
||||
}
|
||||
} else {
|
||||
if (*handle) {
|
||||
tmp = cgi.R_GetShaderName(*handle);
|
||||
} else {
|
||||
tmp = "";
|
||||
}
|
||||
|
||||
archiver.ArchiveString(&tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void CG_ArchiveRefEntity(MemArchiver& archiver, refEntity_t* ref)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
archiver.ArchiveRaw(&ref->reType, sizeof(ref->reType));
|
||||
archiver.ArchiveInteger(&ref->renderfx);
|
||||
|
||||
CG_ArchiveModelHandle(archiver, &ref->hModel);
|
||||
CG_ArchiveModelHandle(archiver, &ref->hOldModel);
|
||||
|
||||
archiver.ArchiveVec3(ref->lightingOrigin);
|
||||
archiver.ArchiveInteger(&ref->parentEntity);
|
||||
archiver.ArchiveVec3(ref->axis[0]);
|
||||
archiver.ArchiveVec3(ref->axis[1]);
|
||||
archiver.ArchiveVec3(ref->axis[2]);
|
||||
archiver.ArchiveBoolean(&ref->nonNormalizedAxes);
|
||||
archiver.ArchiveVec3(ref->origin);
|
||||
archiver.ArchiveRaw(ref->frameInfo, sizeof(ref->frameInfo));
|
||||
archiver.ArchiveFloat(&ref->actionWeight);
|
||||
archiver.ArchiveShort(&ref->wasframe);
|
||||
archiver.ArchiveFloat(&ref->scale);
|
||||
archiver.ArchiveVec3(ref->oldorigin);
|
||||
archiver.ArchiveInteger(&ref->skinNum);
|
||||
|
||||
CG_ArchiveShaderHandle(archiver, &ref->customShader);
|
||||
archiver.ArchiveRaw(ref->shaderRGBA, sizeof(ref->shaderRGBA));
|
||||
archiver.ArchiveFloat(ref->shaderTexCoord);
|
||||
archiver.ArchiveFloat(&ref->shaderTexCoord[1]);
|
||||
archiver.ArchiveFloat(&ref->shaderTime);
|
||||
|
||||
archiver.ArchiveInteger(&ref->entityNumber);
|
||||
archiver.ArchiveRaw(ref->surfaces, 32);
|
||||
archiver.ArchiveFloat(ref->shader_data);
|
||||
archiver.ArchiveFloat(&ref->shader_data[1]);
|
||||
|
||||
ref->bone_tag = NULL;
|
||||
ref->bone_quat = NULL;
|
||||
ref->of = NULL;
|
||||
ref->nf = NULL;
|
||||
|
||||
CG_ArchiveTikiPointer(archiver, &ref->tiki);
|
||||
|
||||
archiver.ArchiveInteger(&ref->bonestart);
|
||||
archiver.ArchiveInteger(&ref->morphstart);
|
||||
archiver.ArchiveBoolean(&ref->hasMorph);
|
||||
archiver.ArchiveFloat(&ref->radius);
|
||||
archiver.ArchiveFloat(&ref->rotation);
|
||||
}
|
||||
@@ -30,15 +30,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "../qcommon/container.h"
|
||||
#include "../qcommon/str.h"
|
||||
|
||||
class MemArchiver {
|
||||
|
||||
};
|
||||
class MemArchiver;
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void CG_SaveStateToBuffer(void** out, int svsTime);
|
||||
void CG_LoadStateToBuffer(void* state, int size, int svsTime);
|
||||
size_t CG_SaveStateToBuffer(void** out, int svsTime);
|
||||
qboolean CG_LoadStateToBuffer(void* state, size_t size, int svsTime);
|
||||
|
||||
#ifdef __cplusplus
|
||||
void CG_ArchiveStuff(MemArchiver& archiver, int svsTime);
|
||||
|
||||
+1168
-309
File diff suppressed because it is too large.
Load diff
+96
-19
@@ -113,9 +113,11 @@ TIKI file, similar to ScriptMaster in the server game dll.
|
||||
#define T2_VARYCOLOR (1 << 20)
|
||||
#define T2_SPIN (1 << 21)
|
||||
#define T2_RELATIVEANGLES (1 << 22)
|
||||
#define T2_NOTAGAXIS (1 << 23)
|
||||
|
||||
class spawnthing_t;
|
||||
class specialeffect_t;
|
||||
class MemArchiver;
|
||||
|
||||
typedef enum {
|
||||
NOT_RANDOM,
|
||||
@@ -181,6 +183,9 @@ public:
|
||||
float decal_orientation;
|
||||
float decal_radius;
|
||||
float spin_rotation;
|
||||
|
||||
public:
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
inline cg_common_data::cg_common_data()
|
||||
@@ -249,6 +254,9 @@ public:
|
||||
spawnthing_t *m_spawnthing;
|
||||
|
||||
void (*touchfcn)(ctempmodel_t *ct, trace_t *trace);
|
||||
|
||||
public:
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
inline ctempmodel_t::ctempmodel_t()
|
||||
@@ -315,8 +323,44 @@ public:
|
||||
int lastPhysicsTime;
|
||||
int lastLightingTime;
|
||||
qboolean lastValid;
|
||||
|
||||
public:
|
||||
cvssource_t();
|
||||
|
||||
public:
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
inline cvssource_t::cvssource_t()
|
||||
: next(NULL)
|
||||
, prev(NULL)
|
||||
, stnext(NULL)
|
||||
, stindex(0)
|
||||
, lastRadius(0)
|
||||
, lastDensity(0)
|
||||
, lastColor {0}
|
||||
, lastLighting {0}
|
||||
, newRadius(0)
|
||||
, newDensity(0)
|
||||
, newColor {0}
|
||||
, newLighting {0}
|
||||
, ooRadius(0)
|
||||
, startAlpha(0)
|
||||
, roll(0)
|
||||
, lifeTime(0)
|
||||
, collisionmask(0)
|
||||
, parent(0)
|
||||
, flags(0)
|
||||
, flags2(0)
|
||||
, smokeType(0)
|
||||
, typeInfo(0)
|
||||
, fadeMult(0)
|
||||
, scaleMult(0)
|
||||
, lastPhysicsTime(0)
|
||||
, lastLightingTime(0)
|
||||
, lastValid(qfalse)
|
||||
{}
|
||||
|
||||
class cvssourcestate_t
|
||||
{
|
||||
public:
|
||||
@@ -387,6 +431,9 @@ public:
|
||||
protected:
|
||||
qboolean usedNumbers[256];
|
||||
virtual void RemoveEntity(int entnum);
|
||||
|
||||
public:
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
inline enttracker_t::enttracker_t()
|
||||
@@ -437,6 +484,9 @@ public:
|
||||
Vector oldorigin;
|
||||
qboolean active;
|
||||
qboolean lerp_emitter;
|
||||
|
||||
public:
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
// emitterthing_t is used to keep track of the last time and emitter was updated
|
||||
@@ -452,6 +502,9 @@ public:
|
||||
emittertime_t *GetEmitTime(int entnum);
|
||||
virtual void RemoveEntity(int entnum);
|
||||
qboolean startoff;
|
||||
|
||||
public:
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
inline void emitterthing_t::RemoveEntity(int entnum)
|
||||
@@ -510,18 +563,23 @@ public:
|
||||
int entity_number;
|
||||
int command_number;
|
||||
int last_command_time;
|
||||
|
||||
public:
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
// This class is used for keeping track of the last time an entity executed a
|
||||
// particular command. A command number must be assigned externally by the user
|
||||
class commandthing_t : public enttracker_t
|
||||
{
|
||||
Container<commandtime_t *> m_commandtimes; // A list of entity numbers and the last time they
|
||||
// executed a command
|
||||
Container<commandtime_t> m_commandtimes; // A list of entity numbers and the last time they
|
||||
// executed a command
|
||||
|
||||
public:
|
||||
commandtime_t *GetLastCommandTime(int entnum, int commandnum);
|
||||
virtual void RemoveEntity(int entnum);
|
||||
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
inline void commandthing_t::RemoveEntity(int entnum)
|
||||
@@ -532,7 +590,7 @@ inline void commandthing_t::RemoveEntity(int entnum)
|
||||
count = m_commandtimes.NumObjects();
|
||||
|
||||
for (num = count; num >= 1; num--) {
|
||||
ct = m_commandtimes.ObjectAt(num);
|
||||
ct = &m_commandtimes.ObjectAt(num);
|
||||
if (ct->entity_number == entnum) {
|
||||
m_commandtimes.RemoveObjectAt(num);
|
||||
}
|
||||
@@ -543,28 +601,27 @@ inline void commandthing_t::RemoveEntity(int entnum)
|
||||
|
||||
inline commandtime_t *commandthing_t::GetLastCommandTime(int entnum, int commandnum)
|
||||
{
|
||||
int num, count;
|
||||
commandtime_t *ct;
|
||||
int num, count;
|
||||
|
||||
// Search for this entity number
|
||||
count = m_commandtimes.NumObjects();
|
||||
|
||||
for (num = 1; num <= count; num++) {
|
||||
ct = m_commandtimes.ObjectAt(num);
|
||||
commandtime_t *ct = &m_commandtimes.ObjectAt(num);
|
||||
if ((ct->entity_number == entnum) && (ct->command_number == commandnum)) {
|
||||
return ct;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a new entry if we didn't find it
|
||||
ct = new commandtime_t;
|
||||
ct->entity_number = entnum;
|
||||
ct->command_number = commandnum;
|
||||
ct->last_command_time = 0;
|
||||
commandtime_t ct;
|
||||
ct.entity_number = entnum;
|
||||
ct.command_number = commandnum;
|
||||
ct.last_command_time = 0;
|
||||
|
||||
m_commandtimes.AddObject(ct);
|
||||
|
||||
return ct;
|
||||
return &m_commandtimes.ObjectAt(m_commandtimes.NumObjects());
|
||||
}
|
||||
|
||||
class spawnthing_t : public emitterthing_t
|
||||
@@ -625,6 +682,9 @@ public:
|
||||
void (*touchfcn)(ctempmodel_t *ct, trace_t *trace);
|
||||
str GetModel(void);
|
||||
void SetModel(str model);
|
||||
|
||||
public:
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
inline void spawnthing_t::SetModel(str model)
|
||||
@@ -729,6 +789,7 @@ private:
|
||||
void SetScaleRate(Event *ev);
|
||||
void SetRandomVelocity(Event *ev);
|
||||
void SetRandomVelocityAlongAxis(Event *ev);
|
||||
void SetNoTagAxis(Event *ev); // Added in 2.0
|
||||
void SetAccel(Event *ev);
|
||||
void SetFriction(Event *ev);
|
||||
void SetSpin(Event *ev);
|
||||
@@ -824,8 +885,8 @@ private:
|
||||
void SetClampVel(Event *ev);
|
||||
void SetClampVelAxis(Event *ev);
|
||||
ctempmodel_t *AllocateTempModel(void);
|
||||
qboolean TempModelPhysics(ctempmodel_t *p, float ftime, float time2, float scale);
|
||||
qboolean TempModelRealtimeEffects(ctempmodel_t *p, float ftime, float time2, float scale);
|
||||
qboolean TempModelPhysics(ctempmodel_t *p, float ftime, float scale);
|
||||
qboolean TempModelRealtimeEffects(ctempmodel_t *p, float ftime, float scale);
|
||||
qboolean LerpTempModel(refEntity_t *newEnt, ctempmodel_t *p, float frac);
|
||||
void SpawnEffect(int count, int timealive);
|
||||
void SpawnTempModel(int count);
|
||||
@@ -871,13 +932,13 @@ public:
|
||||
void UpdateEmitter(dtiki_t *tiki, vec3_t axis[3], int entity_number, int parent_number, Vector entity_origin);
|
||||
void UpdateBeam(dtiki_t *tiki, int entity_number, spawnthing_t *beamthing);
|
||||
void PlaySound(
|
||||
str sound_name,
|
||||
str sound_name,
|
||||
const vec3_t origin = NULL,
|
||||
int channel = CHAN_AUTO,
|
||||
float volume = -1,
|
||||
float min_distance = -1,
|
||||
float pitch = -1,
|
||||
int argstype = 0
|
||||
int channel = CHAN_AUTO,
|
||||
float volume = -1,
|
||||
float min_distance = -1,
|
||||
float pitch = -1,
|
||||
int argstype = 0
|
||||
);
|
||||
|
||||
spawnthing_t *InitializeSpawnthing(spawnthing_t *ep);
|
||||
@@ -891,6 +952,7 @@ public:
|
||||
void InitializeEmitters(void);
|
||||
void RemoveClientEntity(int number, dtiki_t *tiki, centity_t *cent, ctempmodel_t *p = NULL);
|
||||
void ClearSwipes(void);
|
||||
void FreeSpawnthing(spawnthing_t *sp);
|
||||
void ResetTempModels(void);
|
||||
void SpawnTempModel(int count, spawnthing_t *sp);
|
||||
|
||||
@@ -921,6 +983,21 @@ public:
|
||||
void ResetTreadMarkSources(Event *ev);
|
||||
void InitializeRainCvars();
|
||||
void InitializeBeams();
|
||||
|
||||
//
|
||||
// archive stuff
|
||||
//
|
||||
int IdForTempModel(const ctempmodel_t *model);
|
||||
ctempmodel_t *TempModelForId(int id);
|
||||
int IdForSpawnThing(const spawnthing_t *sp);
|
||||
spawnthing_t *SpawnThingForId(int id);
|
||||
int IdForVssSource(const cvssource_t *source);
|
||||
cvssource_t *VssSourceForId(int id);
|
||||
|
||||
void ArchiveTempModelPointerToMemory(MemArchiver& archiver, ctempmodel_t **model);
|
||||
void ArchiveSpawnThingPointerToMemory(MemArchiver& archiver, spawnthing_t **sp);
|
||||
void ArchiveVssSourcePointerToMemory(MemArchiver& archiver, cvssource_t **source);
|
||||
void ArchiveToMemory(MemArchiver& archiver);
|
||||
};
|
||||
|
||||
class EmitterLoader : public Listener
|
||||
|
||||
+60
-50
@@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
// text commands typed in at the local console, or executed by a key binding
|
||||
|
||||
#include "cg_local.h"
|
||||
#include "../fgame/bg_voteoptions.h"
|
||||
|
||||
void CG_TargetCommand_f(void);
|
||||
|
||||
@@ -339,56 +340,65 @@ typedef struct {
|
||||
} consoleCommand_t;
|
||||
|
||||
static consoleCommand_t commands[] = {
|
||||
{"useweaponclass", &CG_UseWeaponClass_f },
|
||||
{"weapnext", &CG_NextWeapon_f },
|
||||
{"weapprev", &CG_PrevWeapon_f },
|
||||
{"uselast", &CG_UseLastWeapon_f },
|
||||
{"holster", &CG_HolsterWeapon_f },
|
||||
{"weapdrop", &CG_DropWeapon_f },
|
||||
{"toggleitem", &CG_ToggleItem_f },
|
||||
{"+scores", &CG_ScoresDown_f },
|
||||
{"-scores", &CG_ScoresUp_f },
|
||||
{"viewpos", &CG_Viewpos_f },
|
||||
{"sizeup", &CG_SizeUp_f },
|
||||
{"sizedown", &CG_SizeDown_f },
|
||||
{"cg_eventlist", &CG_EventList_f },
|
||||
{"cg_eventhelp", &CG_EventHelp_f },
|
||||
{"cg_dumpevents", &CG_DumpEventHelp_f },
|
||||
{"cg_pendingevents", &CG_PendingEvents_f },
|
||||
{"cg_classlist", &CG_ClassList_f },
|
||||
{"cg_classtree", &CG_ClassTree_f },
|
||||
{"cg_classevents", &CG_ClassEvents_f },
|
||||
{"cg_dumpclassevents", &CG_DumpClassEvents_f },
|
||||
{"cg_dumpallclasses", &CG_DumpAllClasses_f },
|
||||
{"testemitter", &CG_TestEmitter_f },
|
||||
{"triggertestemitter", &CG_TriggerTestEmitter_f },
|
||||
{"prevemittercommand", &CG_PrevEmitterCommand_f },
|
||||
{"nextemittercommand", &CG_NextEmitterCommand_f },
|
||||
{"newemittercommand", &CG_NewEmitterCommand_f },
|
||||
{"deleteemittercommand", &CG_DeleteEmitterCommand_f},
|
||||
{"dumpemitter", &CG_DumpEmitter_f },
|
||||
{"loademitter", &CG_LoadEmitter_f },
|
||||
{"resetvss", &CG_ResetVSSSources },
|
||||
{"getchshader", &CG_GetCHShader },
|
||||
{"editchshader", &CG_EditCHShader },
|
||||
{"messagemode", &CG_MessageMode_f },
|
||||
{"messagemode_all", &CG_MessageMode_All_f },
|
||||
{"messagemode_team", &CG_MessageMode_Team_f },
|
||||
{"messagemode_private", &CG_MessageMode_Private_f },
|
||||
{"say", &CG_MessageSingleAll_f },
|
||||
{"sayteam", &CG_MessageSingleTeam_f },
|
||||
{"teamsay", &CG_MessageSingleTeam_f },
|
||||
{"sayprivate", &CG_MessageSingleClient_f },
|
||||
{"sayone", &CG_MessageSingleClient_f },
|
||||
{"wisper", &CG_MessageSingleClient_f },
|
||||
{"instamsg_main", &CG_InstaMessageMain_f },
|
||||
{"instamsg_group_a", &CG_InstaMessageGroupA_f },
|
||||
{"instamsg_group_b", &CG_InstaMessageGroupB_f },
|
||||
{"instamsg_group_c", &CG_InstaMessageGroupC_f },
|
||||
{"instamsg_group_d", &CG_InstaMessageGroupD_f },
|
||||
{"instamsg_group_e", &CG_InstaMessageGroupE_f },
|
||||
{"pushmenu_teamselect", &CG_PushMenuTeamSelect_f },
|
||||
{"pushmenu_weaponselect", &CG_PushMenuWeaponSelect_f},
|
||||
{"useweaponclass", &CG_UseWeaponClass_f },
|
||||
{"weapnext", &CG_NextWeapon_f },
|
||||
{"weapprev", &CG_PrevWeapon_f },
|
||||
{"uselast", &CG_UseLastWeapon_f },
|
||||
{"holster", &CG_HolsterWeapon_f },
|
||||
{"weapdrop", &CG_DropWeapon_f },
|
||||
{"toggleitem", &CG_ToggleItem_f },
|
||||
{"+scores", &CG_ScoresDown_f },
|
||||
{"-scores", &CG_ScoresUp_f },
|
||||
{"viewpos", &CG_Viewpos_f },
|
||||
{"sizeup", &CG_SizeUp_f },
|
||||
{"sizedown", &CG_SizeDown_f },
|
||||
{"cg_eventlist", &CG_EventList_f },
|
||||
{"cg_eventhelp", &CG_EventHelp_f },
|
||||
{"cg_dumpevents", &CG_DumpEventHelp_f },
|
||||
{"cg_pendingevents", &CG_PendingEvents_f },
|
||||
{"cg_classlist", &CG_ClassList_f },
|
||||
{"cg_classtree", &CG_ClassTree_f },
|
||||
{"cg_classevents", &CG_ClassEvents_f },
|
||||
{"cg_dumpclassevents", &CG_DumpClassEvents_f },
|
||||
{"cg_dumpallclasses", &CG_DumpAllClasses_f },
|
||||
{"testemitter", &CG_TestEmitter_f },
|
||||
{"triggertestemitter", &CG_TriggerTestEmitter_f },
|
||||
{"prevemittercommand", &CG_PrevEmitterCommand_f },
|
||||
{"nextemittercommand", &CG_NextEmitterCommand_f },
|
||||
{"newemittercommand", &CG_NewEmitterCommand_f },
|
||||
{"deleteemittercommand", &CG_DeleteEmitterCommand_f },
|
||||
{"dumpemitter", &CG_DumpEmitter_f },
|
||||
{"loademitter", &CG_LoadEmitter_f },
|
||||
{"resetvss", &CG_ResetVSSSources },
|
||||
{"getchshader", &CG_GetCHShader },
|
||||
{"editchshader", &CG_EditCHShader },
|
||||
{"messagemode", &CG_MessageMode_f },
|
||||
{"messagemode_all", &CG_MessageMode_All_f },
|
||||
{"messagemode_team", &CG_MessageMode_Team_f },
|
||||
{"messagemode_private", &CG_MessageMode_Private_f },
|
||||
{"say", &CG_MessageSingleAll_f },
|
||||
{"sayteam", &CG_MessageSingleTeam_f },
|
||||
{"teamsay", &CG_MessageSingleTeam_f },
|
||||
{"sayprivate", &CG_MessageSingleClient_f },
|
||||
{"sayone", &CG_MessageSingleClient_f },
|
||||
{"wisper", &CG_MessageSingleClient_f },
|
||||
{"instamsg_main", &CG_InstaMessageMain_f },
|
||||
{"instamsg_group_a", &CG_InstaMessageGroupA_f },
|
||||
{"instamsg_group_b", &CG_InstaMessageGroupB_f },
|
||||
{"instamsg_group_c", &CG_InstaMessageGroupC_f },
|
||||
{"instamsg_group_d", &CG_InstaMessageGroupD_f },
|
||||
{"instamsg_group_e", &CG_InstaMessageGroupE_f },
|
||||
{"pushmenu_teamselect", &CG_PushMenuTeamSelect_f },
|
||||
{"pushmenu_weaponselect", &CG_PushMenuWeaponSelect_f },
|
||||
// Added in 2.0
|
||||
{"pushcallvote", &CG_PushCallVote_f },
|
||||
{"pushcallvotesublist", &CG_PushCallVoteSubList_f },
|
||||
{"pushcallvotesubtext", &CG_PushCallVoteSubText_f },
|
||||
{"pushcallvotesubinteger",&CG_PushCallVoteSubInteger_f },
|
||||
{"pushcallvotesubfloat", &CG_PushCallVoteSubFloat_f },
|
||||
{"pushcallvotesubclient", &CG_PushCallVoteSubClient_f },
|
||||
{"pushvote", &CG_PushVote_f },
|
||||
{"callentryvote", &CG_CallEntryVote_f },
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
+169
-6
@@ -323,8 +323,12 @@ static void CG_DrawPauseIcon()
|
||||
}
|
||||
w = cgi.R_GetShaderWidth(handle);
|
||||
h = cgi.R_GetShaderHeight(handle);
|
||||
x = w / 4;
|
||||
y = cgs.glconfig.vidHeight - (1.25f * h);
|
||||
if (cg.snap && cg.snap->ps.blend[3] > 0) {
|
||||
y = cgs.glconfig.vidHeight * 0.45f - h / 2.f;
|
||||
} else {
|
||||
y = cgs.glconfig.vidHeight * 0.75f - h / 2.f;
|
||||
}
|
||||
x = (cgs.glconfig.vidWidth - w) / 2.f;
|
||||
|
||||
cgi.R_SetColor(colorWhite);
|
||||
cgi.R_DrawStretchPic(x, y, w, h, 0, 0, 1, 1, handle);
|
||||
@@ -682,11 +686,11 @@ void CG_DrawObjectives()
|
||||
|
||||
iTotalNumLines = 0;
|
||||
for (i = CS_OBJECTIVES; i < CS_OBJECTIVES + MAX_OBJECTIVES; ++i) {
|
||||
CG_ProcessConfigString(i);
|
||||
CG_ProcessConfigString(i, qfalse);
|
||||
}
|
||||
|
||||
iCurrentObjective = atoi(CG_ConfigString(CS_CURRENT_OBJECTIVE));
|
||||
fTimeDelta = cg.ObjectivesAlphaTime - cg.time;
|
||||
iCurrentObjective = atoi(CG_ConfigString(CS_CURRENT_OBJECTIVE));
|
||||
fTimeDelta = cg.ObjectivesAlphaTime - cg.time;
|
||||
cg.ObjectivesCurrentAlpha = cg.ObjectivesDesiredAlpha;
|
||||
if (fTimeDelta > 0) {
|
||||
cg.ObjectivesCurrentAlpha =
|
||||
@@ -1083,7 +1087,7 @@ void CG_DrawSpectatorView_ver_15()
|
||||
iClientNum = cg.snap->ps.stats[STAT_INFOCLIENT];
|
||||
sprintf(buf, "%s : %i", cg.clientinfo[iClientNum].name, cg.snap->ps.stats[STAT_INFOCLIENT_HEALTH]);
|
||||
|
||||
hShader = 0;
|
||||
hShader = 0;
|
||||
color[0] = 0.5;
|
||||
color[1] = 1.0;
|
||||
color[2] = 0.5;
|
||||
@@ -1165,6 +1169,163 @@ void CG_DrawSpectatorView()
|
||||
}
|
||||
}
|
||||
|
||||
void CG_DrawCrosshair()
|
||||
{
|
||||
centity_t *friendEnt;
|
||||
qhandle_t shader;
|
||||
vec3_t forward;
|
||||
vec3_t end;
|
||||
vec3_t mins, maxs;
|
||||
trace_t trace;
|
||||
float x, y;
|
||||
float width, height;
|
||||
|
||||
shader = (qhandle_t)0;
|
||||
|
||||
if (!cg_hud->integer || !ui_crosshair->integer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cg.snap) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((cg.snap->ps.pm_flags & PMF_NO_LEAN) || (cg.snap->ps.pm_flags & PMF_INTERMISSION)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cg.snap->ps.stats[STAT_CROSSHAIR]
|
||||
&& (!cg.snap->ps.stats[STAT_INZOOM] || cg.snap->ps.stats[STAT_INZOOM] > 30)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cgs.gametype != GT_FFA) {
|
||||
AngleVectorsLeft(cg.refdefViewAngles, forward, NULL, NULL);
|
||||
|
||||
VectorMA(cg.refdef.vieworg, 8192, forward, end);
|
||||
VectorClear(mins);
|
||||
VectorClear(maxs);
|
||||
|
||||
CG_Trace(&trace, cg.refdef.vieworg, mins, maxs, end, 9999, MASK_SOLID, qfalse, qtrue, "CG_DrawCrosshair");
|
||||
|
||||
// ENTITYNUM_WORLD check added in OPM
|
||||
if ((trace.entityNum != ENTITYNUM_NONE && trace.entityNum != ENTITYNUM_WORLD)
|
||||
&& trace.entityNum != cg.snap->ps.clientNum) {
|
||||
int myFlags;
|
||||
|
||||
friendEnt = &cg_entities[trace.entityNum];
|
||||
if (cgs.gametype != GT_SINGLE_PLAYER) {
|
||||
myFlags = cg_entities[cg.snap->ps.clientNum].currentState.eFlags & EF_ANY_TEAM;
|
||||
} else {
|
||||
// the player will always be considered as an allied
|
||||
// in single-player
|
||||
myFlags = EF_ALLIES;
|
||||
}
|
||||
|
||||
if (((myFlags & EF_ALLIES) && (friendEnt->currentState.eFlags & EF_ALLIES))
|
||||
|| ((myFlags & EF_AXIS) && (friendEnt->currentState.eFlags & EF_AXIS))) {
|
||||
// friend
|
||||
if (cg.snap->ps.stats[STAT_CROSSHAIR]) {
|
||||
shader = cgi.R_RegisterShader(cg_crosshair_friend->string);
|
||||
}
|
||||
} else {
|
||||
// enemy
|
||||
if (cg.snap->ps.stats[STAT_CROSSHAIR]) {
|
||||
shader = cgi.R_RegisterShader(cg_crosshair->string);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (cg.snap->ps.stats[STAT_CROSSHAIR]) {
|
||||
shader = cgi.R_RegisterShader(cg_crosshair->string);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// FFA
|
||||
if (cg.snap->ps.stats[STAT_CROSSHAIR]) {
|
||||
shader = cgi.R_RegisterShader(cg_crosshair->string);
|
||||
}
|
||||
}
|
||||
|
||||
if (shader) {
|
||||
width = cgi.R_GetShaderWidth(shader);
|
||||
height = cgi.R_GetShaderHeight(shader);
|
||||
x = (cgs.glconfig.vidWidth - width) * 0.5f;
|
||||
y = (cgs.glconfig.vidHeight - height) * 0.5f;
|
||||
|
||||
cgi.R_SetColor(NULL);
|
||||
cgi.R_DrawStretchPic(x, y, width, height, 0, 0, 1, 1, shader);
|
||||
}
|
||||
}
|
||||
|
||||
void CG_DrawVote()
|
||||
{
|
||||
const char *text;
|
||||
int seconds;
|
||||
int percentYes;
|
||||
int percentNo;
|
||||
int percentUndecided;
|
||||
float x, y;
|
||||
vec4_t col;
|
||||
|
||||
if (!cgs.voteTime) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cgs.voteRefreshed) {
|
||||
cgs.voteRefreshed = qfalse;
|
||||
}
|
||||
|
||||
seconds = (30000 - (cg.time - cgs.voteTime)) / 1000 + 1;
|
||||
if (seconds < 0) {
|
||||
seconds = 0;
|
||||
}
|
||||
|
||||
percentYes = cgs.numVotesYes * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes);
|
||||
percentNo = cgs.numVotesNo * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes);
|
||||
percentUndecided = cgs.numUndecidedVotes * 100 / (cgs.numUndecidedVotes + cgs.numVotesNo + cgs.numVotesYes);
|
||||
|
||||
x = 8;
|
||||
y = (cgs.glconfig.vidHeight > 480) ? (cgs.glconfig.vidHeight * 0.725f) : (cgs.glconfig.vidHeight * 0.75f);
|
||||
|
||||
cgi.R_SetColor(NULL);
|
||||
|
||||
text = va("%s: %s", cgi.LV_ConvertString("Vote Running"), cgs.voteString);
|
||||
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
|
||||
|
||||
y += 12;
|
||||
|
||||
text =
|
||||
va("%s: %isec %s: %i%% %s: %i%% %s: %i%%",
|
||||
cgi.LV_ConvertString("Time"),
|
||||
seconds,
|
||||
cgi.LV_ConvertString("Yes"),
|
||||
percentYes,
|
||||
cgi.LV_ConvertString("No"),
|
||||
percentNo,
|
||||
cgi.LV_ConvertString("Undecided"),
|
||||
percentUndecided);
|
||||
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
|
||||
|
||||
if (cg.snap && !cg.snap->ps.voted) {
|
||||
col[0] = 0.5;
|
||||
col[1] = 1.0;
|
||||
col[2] = 0.5;
|
||||
col[3] = 1.0;
|
||||
cgi.R_SetColor(col);
|
||||
|
||||
y += 12;
|
||||
|
||||
text = cgi.LV_ConvertString("Vote now, it's your patriotic duty!");
|
||||
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
|
||||
|
||||
y += 12;
|
||||
|
||||
text = cgi.LV_ConvertString("To vote Yes, press F1. To vote No, press F2.");
|
||||
cgi.R_DrawString(cgs.media.attackerFont, text, x, y, -1, qfalse);
|
||||
cgi.R_SetColor(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CG_Draw2D
|
||||
@@ -1183,5 +1344,7 @@ void CG_Draw2D(void)
|
||||
CG_DrawPlayerTeam();
|
||||
CG_DrawPlayerEntInfo();
|
||||
CG_UpdateAttackerDisplay();
|
||||
CG_DrawVote();
|
||||
CG_DrawInstantMessageMenu();
|
||||
CG_DrawCrosshair();
|
||||
}
|
||||
@@ -59,7 +59,7 @@ qboolean CG_LightStyleColor(int style, int realtime, vec4_t color, qboolean clam
|
||||
|
||||
time = realtime / 50;
|
||||
frac = (realtime - (time * 50.0f)) / 50.0f;
|
||||
memset(color, 0, sizeof(color));
|
||||
VectorClear4(color);
|
||||
if ((style < 0) || (style >= (MAX_LIGHTSTYLES * 2))) {
|
||||
cgi.DPrintf("CG_LightStyleColor: style out of range.\n");
|
||||
return qtrue;
|
||||
|
||||
+25
-1
@@ -35,6 +35,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "cg_public.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
class MemArchiver;
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
@@ -185,6 +187,7 @@ extern "C" {
|
||||
float min_dist;
|
||||
float width;
|
||||
char shader[MAX_RAIN_SHADERS][MAX_STRING_CHARS];
|
||||
char currentShader[MAX_STRING_CHARS];
|
||||
int numshaders;
|
||||
} crain_t;
|
||||
|
||||
@@ -338,6 +341,7 @@ extern "C" {
|
||||
float ObjectivesBaseAlpha;
|
||||
float ObjectivesDesiredAlpha;
|
||||
float ObjectivesCurrentAlpha;
|
||||
int ObjectivesCurrentIndex;
|
||||
|
||||
// misc
|
||||
crain_t rain;
|
||||
@@ -394,8 +398,19 @@ extern "C" {
|
||||
int maxclients;
|
||||
int cinematic;
|
||||
int mapChecksum;
|
||||
qboolean useMapChecksum;
|
||||
char mapname[MAX_QPATH];
|
||||
|
||||
//
|
||||
// vote
|
||||
//
|
||||
int voteTime;
|
||||
int numVotesYes;
|
||||
int numVotesNo;
|
||||
int numUndecidedVotes;
|
||||
qboolean voteRefreshed;
|
||||
char voteString[1024];
|
||||
|
||||
//
|
||||
// locally derived information from gamestate
|
||||
//
|
||||
@@ -416,6 +431,7 @@ extern "C" {
|
||||
extern cgs_t cgs;
|
||||
extern cg_t cg;
|
||||
extern clientGameImport_t cgi;
|
||||
extern target_game_e cg_target_game;
|
||||
extern int cg_protocol;
|
||||
extern centity_t cg_entities[MAX_GENTITIES];
|
||||
extern markPoly_t *cg_markPolys;
|
||||
@@ -458,6 +474,9 @@ extern "C" {
|
||||
extern cvar_t *cg_hud;
|
||||
extern cvar_t *cg_huddraw_force;
|
||||
extern cvar_t *cg_drawsvlag;
|
||||
extern cvar_t *cg_crosshair;
|
||||
extern cvar_t *cg_crosshair_friend;
|
||||
extern cvar_t *ui_crosshair;
|
||||
extern cvar_t *vm_offset_max;
|
||||
extern cvar_t *vm_offset_speed;
|
||||
extern cvar_t *vm_sway_front;
|
||||
@@ -488,7 +507,7 @@ extern "C" {
|
||||
//
|
||||
// cg_main.c
|
||||
//
|
||||
void CG_ProcessConfigString(int num);
|
||||
void CG_ProcessConfigString(int num, qboolean modelOnly);
|
||||
const char *CG_ConfigString(int index);
|
||||
void CG_AddToTeamChat(const char *str);
|
||||
void CG_NewClientinfo(int clientNum);
|
||||
@@ -530,6 +549,8 @@ extern "C" {
|
||||
// cg_tempmodels.cpp
|
||||
//
|
||||
extern cvar_t *cg_showtempmodels;
|
||||
extern cvar_t *cg_max_tempmodels;
|
||||
extern cvar_t *cg_reserve_tempmodels;
|
||||
extern cvar_t *cg_detail;
|
||||
extern cvar_t *cg_effectdetail;
|
||||
extern cvar_t *cg_effect_physicsrate;
|
||||
@@ -911,6 +932,9 @@ qboolean CG_LightStyleColor(int style, int realtime, vec4_t color, qboolean clam
|
||||
//
|
||||
// cg_volumetricsmoke.cpp
|
||||
void CG_ResetVSSSources(void);
|
||||
#ifdef __cplusplus
|
||||
void CG_ArchiveVSSGlobals(MemArchiver& archiver);
|
||||
#endif
|
||||
void CG_AddVSSSources(void);
|
||||
|
||||
extern cvar_t *vss_draw;
|
||||
|
||||
+218
-130
@@ -35,12 +35,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
clientGameImport_t cgi;
|
||||
static clientGameExport_t cge;
|
||||
|
||||
cvar_t *paused;
|
||||
cvar_t *developer;
|
||||
cg_t cg;
|
||||
cgs_t cgs;
|
||||
int cg_protocol;
|
||||
centity_t cg_entities[MAX_GENTITIES];
|
||||
cvar_t *paused;
|
||||
cvar_t *developer;
|
||||
cg_t cg;
|
||||
cgs_t cgs;
|
||||
target_game_e cg_target_game = TG_INVALID;
|
||||
int cg_protocol;
|
||||
centity_t cg_entities[MAX_GENTITIES];
|
||||
|
||||
cvar_t *cg_animSpeed;
|
||||
cvar_t *cg_debugAnim;
|
||||
@@ -80,6 +81,9 @@ cvar_t *cg_acidtrip;
|
||||
cvar_t *cg_hud;
|
||||
cvar_t *cg_huddraw_force;
|
||||
cvar_t *cg_drawsvlag;
|
||||
cvar_t *cg_crosshair;
|
||||
cvar_t *cg_crosshair_friend;
|
||||
cvar_t *ui_crosshair;
|
||||
cvar_t *vm_offset_max;
|
||||
cvar_t *vm_offset_speed;
|
||||
cvar_t *vm_sway_front;
|
||||
@@ -151,14 +155,23 @@ void CG_RegisterCvars(void)
|
||||
cg_shadowdebug = cgi.Cvar_Get("cg_shadowdebug", "0", 0);
|
||||
developer = cgi.Cvar_Get("developer", "0", 0);
|
||||
dm_playermodel = cgi.Cvar_Get("dm_playermodel", "american_army", 3);
|
||||
dm_playergermanmodel = cgi.Cvar_Get("dm_playergermanmodel", "german_wehrmacht_soldier", 3);
|
||||
dm_playergermanmodel = cgi.Cvar_Get("dm_playergermanmodel", "german_wehrmacht_soldier", CVAR_ARCHIVE | CVAR_USERINFO);
|
||||
cg_forceModel = cgi.Cvar_Get("cg_forceModel", "0", CVAR_ARCHIVE);
|
||||
cg_animationviewmodel = cgi.Cvar_Get("cg_animationviewmodel", "0", 8);
|
||||
cg_animationviewmodel = cgi.Cvar_Get("cg_animationviewmodel", "0", CVAR_SYSTEMINFO);
|
||||
cg_hitmessages = cgi.Cvar_Get("cg_hitmessages", "1", CVAR_ARCHIVE);
|
||||
cg_acidtrip = cgi.Cvar_Get("cg_acidtrip", "0", CVAR_CHEAT);
|
||||
cg_hud = cgi.Cvar_Get("cg_hud", "0", 0);
|
||||
cg_huddraw_force = cgi.Cvar_Get("cg_huddraw_force", "0", CVAR_SAVEGAME);
|
||||
cg_drawsvlag = cgi.Cvar_Get("cg_drawsvlag", "1", CVAR_ARCHIVE);
|
||||
cg_crosshair = cgi.Cvar_Get("cg_crosshair", "textures/hud/crosshair", CVAR_ARCHIVE);
|
||||
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
|
||||
cg_crosshair_friend = cgi.Cvar_Get("cg_crosshair_friend", "textures/hud/crosshair_friend", CVAR_ARCHIVE);
|
||||
} else {
|
||||
// on 1.11 and below, fallback to standard crosshair
|
||||
// as it doesn't have crosshair_friend texture
|
||||
cg_crosshair_friend = cgi.Cvar_Get("cg_crosshair_friend", "textures/hud/crosshair", CVAR_ARCHIVE);
|
||||
}
|
||||
ui_crosshair = cgi.Cvar_Get("ui_crosshair", "1", CVAR_ARCHIVE);
|
||||
vm_offset_max = cgi.Cvar_Get("vm_offset_max", "8.0", 0);
|
||||
vm_offset_speed = cgi.Cvar_Get("vm_offset_speed", "8.0", 0);
|
||||
vm_sway_front = cgi.Cvar_Get("vm_sway_front", "0.1", 0);
|
||||
@@ -233,91 +246,46 @@ void CG_RegisterSounds(void)
|
||||
Com_Printf("-------------UBERDIALOG DONE---------------\n\n");
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CG_IsHandleUnique
|
||||
|
||||
Check if the model handle is unique
|
||||
================
|
||||
*/
|
||||
static qboolean CG_IsHandleUnique(qhandle_t handle) {
|
||||
int i;
|
||||
int numRef;
|
||||
|
||||
numRef = 0;
|
||||
for (i = 0; i < MAX_MODELS; i++) {
|
||||
if (cgs.model_draw[i] == handle) {
|
||||
numRef++;
|
||||
if (numRef >= 2) {
|
||||
return qfalse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CG_ProcessConfigString
|
||||
================
|
||||
*/
|
||||
void CG_ProcessConfigString(int num)
|
||||
void CG_ProcessConfigString(int num, qboolean modelOnly)
|
||||
{
|
||||
const char *str = CG_ConfigString(num);
|
||||
int i;
|
||||
const char* str;
|
||||
int i;
|
||||
|
||||
switch (num) {
|
||||
case CS_RAIN_DENSITY:
|
||||
cg.rain.density = atof(str);
|
||||
return;
|
||||
case CS_RAIN_SPEED:
|
||||
cg.rain.speed = atof(str);
|
||||
return;
|
||||
case CS_RAIN_SPEEDVARY:
|
||||
cg.rain.speed_vary = atoi(str);
|
||||
return;
|
||||
case CS_RAIN_SLANT:
|
||||
cg.rain.slant = atoi(str);
|
||||
return;
|
||||
case CS_RAIN_LENGTH:
|
||||
cg.rain.length = atof(str);
|
||||
return;
|
||||
case CS_RAIN_MINDIST:
|
||||
cg.rain.min_dist = atof(str);
|
||||
return;
|
||||
case CS_RAIN_WIDTH:
|
||||
cg.rain.width = atof(str);
|
||||
return;
|
||||
case CS_RAIN_SHADER:
|
||||
if (cg.rain.numshaders) {
|
||||
for (i = 0; i < cg.rain.numshaders; i++) {
|
||||
sprintf(cg.rain.shader[i], "%s%i", str, i);
|
||||
}
|
||||
} else {
|
||||
strcpy(cg.rain.shader[0], str);
|
||||
}
|
||||
return;
|
||||
case CS_RAIN_NUMSHADERS:
|
||||
cg.rain.numshaders = atoi(str);
|
||||
if (cg.rain.numshaders) {
|
||||
for (i = 0; i < cg.rain.numshaders; i++) {
|
||||
sprintf(cg.rain.shader[i], "%s%i", str, i);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (num >= CS_OBJECTIVES && num < CS_OBJECTIVES + MAX_OBJECTIVES) {
|
||||
cobjective_t *objective = &cg.Objectives[num - CS_OBJECTIVES];
|
||||
objective->flags = atoi(Info_ValueForKey(str, "flags"));
|
||||
strcpy(objective->text, Info_ValueForKey(str, "text"));
|
||||
}
|
||||
|
||||
switch (num) {
|
||||
case CS_MUSIC:
|
||||
cgi.MUSIC_NewSoundtrack(str);
|
||||
return;
|
||||
case CS_WARMUP:
|
||||
cg.matchStartTime = atoi(str);
|
||||
return;
|
||||
case CS_FOGINFO:
|
||||
CG_ParseFogInfo(str);
|
||||
return;
|
||||
case CS_SKYINFO:
|
||||
sscanf(str, "%f %d", &cg.sky_alpha, &cg.sky_portal);
|
||||
return;
|
||||
case CS_SERVERINFO:
|
||||
CG_ParseServerinfo();
|
||||
return;
|
||||
case CS_LEVEL_START_TIME:
|
||||
cgs.levelStartTime = atoi(str);
|
||||
return;
|
||||
case CS_MATCHEND:
|
||||
cgs.matchEndTime = atoi(str);
|
||||
return;
|
||||
}
|
||||
str = CG_ConfigString(num);
|
||||
|
||||
if (num >= CS_MODELS && num < CS_MODELS + MAX_MODELS) {
|
||||
qhandle_t hOldModel = cgs.model_draw[num - CS_MODELS];
|
||||
|
||||
if (str && str[0]) {
|
||||
if (str && str[0] && !modelOnly) {
|
||||
qhandle_t hModel = cgi.R_RegisterServerModel(str);
|
||||
dtiki_t *tiki;
|
||||
|
||||
@@ -334,43 +302,153 @@ void CG_ProcessConfigString(int num)
|
||||
}
|
||||
} else {
|
||||
// clear out the model
|
||||
if (hOldModel) {
|
||||
if (hOldModel && CG_IsHandleUnique(hOldModel)) {
|
||||
// Handle uniqueness added in OPM
|
||||
cgi.R_UnregisterServerModel(hOldModel);
|
||||
}
|
||||
cgs.model_draw[num - CS_MODELS] = 0;
|
||||
}
|
||||
} else if (num >= CS_SOUNDS && num < CS_SOUNDS + MAX_SOUNDS) {
|
||||
size_t len = strlen(str);
|
||||
if (len) {
|
||||
qboolean streamed;
|
||||
char buf[1024];
|
||||
strcpy(buf, str);
|
||||
}
|
||||
|
||||
streamed = buf[len - 1] != '0';
|
||||
buf[len - 1] = 0;
|
||||
if (buf[0] != '*') {
|
||||
cgs.sound_precache[num - CS_SOUNDS] = cgi.S_RegisterSound(buf, streamed);
|
||||
if (!modelOnly) {
|
||||
switch (num) {
|
||||
case CS_RAIN_DENSITY:
|
||||
cg.rain.density = atof(str);
|
||||
return;
|
||||
case CS_RAIN_SPEED:
|
||||
cg.rain.speed = atof(str);
|
||||
return;
|
||||
case CS_RAIN_SPEEDVARY:
|
||||
cg.rain.speed_vary = atoi(str);
|
||||
return;
|
||||
case CS_RAIN_SLANT:
|
||||
cg.rain.slant = atoi(str);
|
||||
return;
|
||||
case CS_RAIN_LENGTH:
|
||||
cg.rain.length = atof(str);
|
||||
return;
|
||||
case CS_RAIN_MINDIST:
|
||||
cg.rain.min_dist = atof(str);
|
||||
return;
|
||||
case CS_RAIN_WIDTH:
|
||||
cg.rain.width = atof(str);
|
||||
return;
|
||||
case CS_RAIN_SHADER:
|
||||
Q_strncpyz(cg.rain.currentShader, str, sizeof(cg.rain.currentShader));
|
||||
if (cg.rain.numshaders) {
|
||||
// Fixed in OPM
|
||||
// not sure why some maps set a digit at the end...
|
||||
int len = strlen(cg.rain.currentShader);
|
||||
if (isdigit(cg.rain.currentShader[len - 1])) {
|
||||
cg.rain.currentShader[len - 1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (num >= CS_LIGHTSTYLES && num < CS_LIGHTSTYLES + MAX_LIGHTSTYLES) {
|
||||
CG_SetLightStyle(num - CS_LIGHTSTYLES, str);
|
||||
} else if (num >= CS_PLAYERS && num < CS_PLAYERS + MAX_CLIENTS) {
|
||||
const char *value;
|
||||
|
||||
value = Info_ValueForKey(str, "name");
|
||||
if (value) {
|
||||
strncpy(cg.clientinfo[num - CS_PLAYERS].name, value, sizeof(cg.clientinfo[num - CS_PLAYERS].name));
|
||||
} else {
|
||||
strncpy(
|
||||
cg.clientinfo[num - CS_PLAYERS].name, "UnnamedSoldier", sizeof(cg.clientinfo[num - CS_PLAYERS].name)
|
||||
);
|
||||
for (i = 0; i < cg.rain.numshaders; ++i) {
|
||||
Com_sprintf(cg.rain.shader[i], sizeof(cg.rain.shader[i]), "%s%i", cg.rain.currentShader, i);
|
||||
}
|
||||
if (!cg.rain.numshaders) {
|
||||
Q_strncpyz(cg.rain.shader[0], cg.rain.currentShader, sizeof(cg.rain.shader[0]));
|
||||
}
|
||||
return;
|
||||
case CS_RAIN_NUMSHADERS:
|
||||
cg.rain.numshaders = atoi(str);
|
||||
if (cg.rain.numshaders) {
|
||||
for (i = 0; i < cg.rain.numshaders; i++) {
|
||||
Com_sprintf(cg.rain.shader[i], sizeof(cg.rain.shader[i]), "%s%i", cg.rain.currentShader, i);
|
||||
}
|
||||
}
|
||||
return;
|
||||
case CS_CURRENT_OBJECTIVE:
|
||||
cg.ObjectivesCurrentIndex = atoi(str);
|
||||
return;
|
||||
}
|
||||
|
||||
value = Info_ValueForKey(str, "team");
|
||||
if (value) {
|
||||
cg.clientinfo[num - CS_PLAYERS].team = atoi(value);
|
||||
} else {
|
||||
cg.clientinfo[num - CS_PLAYERS].team = TEAM_NONE;
|
||||
if (num >= CS_OBJECTIVES && num < CS_OBJECTIVES + MAX_OBJECTIVES) {
|
||||
cobjective_t *objective = &cg.Objectives[num - CS_OBJECTIVES];
|
||||
objective->flags = atoi(Info_ValueForKey(str, "flags"));
|
||||
strcpy(objective->text, Info_ValueForKey(str, "text"));
|
||||
}
|
||||
|
||||
switch (num) {
|
||||
case CS_MUSIC:
|
||||
cgi.MUSIC_NewSoundtrack(str);
|
||||
return;
|
||||
case CS_WARMUP:
|
||||
cg.matchStartTime = atoi(str);
|
||||
return;
|
||||
case CS_FOGINFO:
|
||||
cg.farclipOverride = 0;
|
||||
cg.farplaneColorOverride[0] = -1;
|
||||
cg.farplaneColorOverride[1] = -1;
|
||||
cg.farplaneColorOverride[2] = -1;
|
||||
CG_ParseFogInfo(str);
|
||||
return;
|
||||
case CS_SKYINFO:
|
||||
sscanf(str, "%f %d", &cg.sky_alpha, &cg.sky_portal);
|
||||
return;
|
||||
case CS_SERVERINFO:
|
||||
CG_ParseServerinfo();
|
||||
return;
|
||||
case CS_LEVEL_START_TIME:
|
||||
cgs.levelStartTime = atoi(str);
|
||||
return;
|
||||
case CS_VOTE_TIME:
|
||||
cgs.voteTime = atoi(str);
|
||||
cgs.voteRefreshed = qtrue;
|
||||
break;
|
||||
case CS_VOTE_STRING:
|
||||
Q_strncpyz(cgs.voteString, str, sizeof(cgs.voteString));
|
||||
break;
|
||||
case CS_VOTE_YES:
|
||||
cgs.numVotesYes = atoi(str);
|
||||
cgs.voteRefreshed = qtrue;
|
||||
break;
|
||||
case CS_VOTE_NO:
|
||||
cgs.numVotesNo = atoi(str);
|
||||
cgs.voteRefreshed = qtrue;
|
||||
break;
|
||||
case CS_VOTE_UNDECIDED:
|
||||
cgs.numUndecidedVotes = atoi(str);
|
||||
cgs.voteRefreshed = qtrue;
|
||||
break;
|
||||
case CS_MATCHEND:
|
||||
cgs.matchEndTime = atoi(str);
|
||||
return;
|
||||
}
|
||||
|
||||
if (num >= CS_SOUNDS && num < CS_SOUNDS + MAX_SOUNDS) {
|
||||
size_t len = strlen(str);
|
||||
if (len) {
|
||||
qboolean streamed;
|
||||
char buf[1024];
|
||||
strcpy(buf, str);
|
||||
|
||||
streamed = buf[len - 1] != '0';
|
||||
buf[len - 1] = 0;
|
||||
if (buf[0] != '*') {
|
||||
cgs.sound_precache[num - CS_SOUNDS] = cgi.S_RegisterSound(buf, streamed);
|
||||
}
|
||||
}
|
||||
} else if (num >= CS_LIGHTSTYLES && num < CS_LIGHTSTYLES + MAX_LIGHTSTYLES) {
|
||||
CG_SetLightStyle(num - CS_LIGHTSTYLES, str);
|
||||
} else if (num >= CS_PLAYERS && num < CS_PLAYERS + MAX_CLIENTS) {
|
||||
const char *value;
|
||||
|
||||
value = Info_ValueForKey(str, "name");
|
||||
if (value) {
|
||||
strncpy(cg.clientinfo[num - CS_PLAYERS].name, value, sizeof(cg.clientinfo[num - CS_PLAYERS].name));
|
||||
} else {
|
||||
strncpy(
|
||||
cg.clientinfo[num - CS_PLAYERS].name, "UnnamedSoldier", sizeof(cg.clientinfo[num - CS_PLAYERS].name)
|
||||
);
|
||||
}
|
||||
|
||||
value = Info_ValueForKey(str, "team");
|
||||
if (value) {
|
||||
cg.clientinfo[num - CS_PLAYERS].team = atoi(value);
|
||||
} else {
|
||||
cg.clientinfo[num - CS_PLAYERS].team = TEAM_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,14 +501,14 @@ void CG_PrepRefresh(void)
|
||||
cgs.media.binocularsOverlayShader = cgi.R_RegisterShaderNoMip("textures/hud/binocularsoverlay");
|
||||
cgs.media.hudDrawFont = cgi.R_LoadFont("verdana-14");
|
||||
cgs.media.attackerFont = cgi.R_LoadFont("facfont-20");
|
||||
cgs.media.objectiveFont = cgi.R_LoadFont("courier-16");
|
||||
cgs.media.objectiveFont = cgi.R_LoadFont("facfont-20"); // was courier-16 before 2.0
|
||||
cgs.media.objectivesBackShader = cgi.R_RegisterShaderNoMip("textures/hud/objectives_backdrop");
|
||||
cgs.media.checkedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/filledbox");
|
||||
cgs.media.uncheckedBoxShader = cgi.R_RegisterShaderNoMip("textures/objectives/emptybox");
|
||||
|
||||
// go through all the configstrings and process them
|
||||
for (i = CS_SYSTEMINFO + 1; i < MAX_CONFIGSTRINGS; i++) {
|
||||
CG_ProcessConfigString(i);
|
||||
CG_ProcessConfigString(i, qfalse);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,6 +547,7 @@ Displays the info screen while loading media
|
||||
void CG_GameStateReceived(void)
|
||||
{
|
||||
const char *s;
|
||||
int checksum;
|
||||
|
||||
// clear everything
|
||||
memset(&cg, 0, sizeof(cg));
|
||||
@@ -495,7 +574,10 @@ void CG_GameStateReceived(void)
|
||||
CG_ParseServerinfo();
|
||||
|
||||
// load the new map
|
||||
cgi.CM_LoadMap(cgs.mapname);
|
||||
cgi.CM_LoadMap(cgs.mapname, &checksum);
|
||||
if (cgs.useMapChecksum && checksum != cgs.mapChecksum && cgs.gametype != GT_SINGLE_PLAYER) {
|
||||
cgi.Error(ERR_DROP, "Client/Server map checksum mismatch: %x/%x", checksum, cgs.mapChecksum);
|
||||
}
|
||||
|
||||
CG_InitMarks();
|
||||
|
||||
@@ -539,16 +621,6 @@ void CG_ServerRestarted(void)
|
||||
CG_InitializeObjectives();
|
||||
}
|
||||
|
||||
void *CG_Malloc(int size)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
void CG_Free(void *ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CG_Init
|
||||
@@ -559,17 +631,20 @@ Called after every level change or subsystem restart
|
||||
void CG_Init(clientGameImport_t *imported, int serverMessageNum, int serverCommandSequence, int clientNum)
|
||||
{
|
||||
cgi = *imported;
|
||||
#if _DEBUG
|
||||
cgi.Malloc = &CG_Malloc;
|
||||
cgi.Free = &CG_Free;
|
||||
#endif
|
||||
|
||||
cg_protocol = cgi.Cvar_Get("com_protocol", "", 0)->integer;
|
||||
cg_target_game = (target_game_e)cgi.Cvar_Get("com_target_game", "0", 0)->integer;
|
||||
|
||||
CG_InitCGMessageAPI(&cge);
|
||||
CG_InitScoresAPI(&cge);
|
||||
|
||||
memset(&cg, 0, sizeof(cg));
|
||||
memset(&cgs, 0, sizeof(cgs));
|
||||
// clear fog values
|
||||
cg.farclipOverride = 0;
|
||||
cg.farplaneColorOverride[0] = -1;
|
||||
cg.farplaneColorOverride[1] = -1;
|
||||
cg.farplaneColorOverride[2] = -1;
|
||||
|
||||
cg.clientNum = clientNum;
|
||||
cgs.processedSnapshotNum = serverMessageNum;
|
||||
@@ -626,11 +701,14 @@ Called before every level change or subsystem restart
|
||||
void CG_Shutdown(void)
|
||||
{
|
||||
L_ShutdownEvents();
|
||||
// Shutdown radar
|
||||
cgi.CL_InitRadar(NULL, NULL, -1);
|
||||
|
||||
// some mods may need to do cleanup work here,
|
||||
// like closing files or archiving session data
|
||||
|
||||
// hide the stats screen
|
||||
cgi.UI_HideMenu("StatsScreen", 1);
|
||||
cgi.UI_HideMenu("StatsScreen", qtrue);
|
||||
|
||||
// reset the scoreboard
|
||||
CG_PrepScoreBoardInfo();
|
||||
@@ -788,10 +866,20 @@ void CG_ParseFogInfo_ver_15(const char *str)
|
||||
|
||||
void CG_ParseFogInfo_ver_6(const char *str)
|
||||
{
|
||||
cg.farclipOverride = 0.0;
|
||||
//
|
||||
// clear all unsupported fields in protocol below version 15
|
||||
//
|
||||
|
||||
// don't set the farplane_bias 0, otherwise the renderer will set a minimum value
|
||||
cg.farplane_bias = 0.001f;
|
||||
cg.skyboxFarplane = 0;
|
||||
cg.skyboxSpeed = 0;
|
||||
cg.renderTerrain = qtrue;
|
||||
cg.farclipOverride = -1.0;
|
||||
cg.farplaneColorOverride[0] = -1.0;
|
||||
cg.farplaneColorOverride[1] = -1.0;
|
||||
cg.farplaneColorOverride[2] = -1.0;
|
||||
|
||||
sscanf(
|
||||
str,
|
||||
"%d %f %f %f %f",
|
||||
|
||||
@@ -191,7 +191,7 @@ int CG_GetMarkFragments(
|
||||
}
|
||||
|
||||
iNewPoints = 0;
|
||||
for (j = 0, pFragment = pCurrFragment; j < iNewPoints; j++, pFragment++) {
|
||||
for (j = 0, pFragment = pCurrFragment; j < iNewFragments; j++, pFragment++) {
|
||||
pFragment->firstPoint += iCurrPoints;
|
||||
pFragment->iIndex = -pEnt->number;
|
||||
iNewPoints += pFragment->numPoints;
|
||||
@@ -219,10 +219,11 @@ static qboolean CG_GetMarkInlineModelOrientation(int iIndex) {
|
||||
}
|
||||
|
||||
pCEnt = &cg_entities[-iIndex];
|
||||
if (pCEnt->currentValid && pCEnt->currentState.modelindex < cgs.inlineDrawModel[ENTITYNUM_NONE])
|
||||
if (pCEnt->currentValid && pCEnt->currentState.modelindex < cgs.numInlineModels)
|
||||
{
|
||||
VectorCopy(pCEnt->lerpAngles, cg_vEntAngles);
|
||||
VectorCopy(pCEnt->lerpOrigin, cg_vEntOrigin);
|
||||
cg_bLastEntValid = qtrue;
|
||||
|
||||
if (cg_vEntAngles[0] || cg_vEntAngles[1] || cg_vEntAngles[2]) {
|
||||
AngleVectorsLeft(cg_vEntAngles, cg_fEntAxis[0], cg_fEntAxis[1], cg_fEntAxis[2]);
|
||||
@@ -685,9 +686,9 @@ void CG_ImpactMark(
|
||||
// create the full polygon
|
||||
for (i = 0; i < 3; i++) {
|
||||
originalPoints[0][i] = origin[i] - fSScale2 * info.axis[1][i] - fTScale2 * info.axis[2][i];
|
||||
originalPoints[1][i] = origin[i] + fSScale3 * info.axis[1][i] - fTScale3 * info.axis[2][i];
|
||||
originalPoints[1][i] = origin[i] + fSScale3 * info.axis[1][i] - fTScale2 * info.axis[2][i];
|
||||
originalPoints[2][i] = origin[i] + fSScale3 * info.axis[1][i] + fTScale3 * info.axis[2][i];
|
||||
originalPoints[3][i] = origin[i] - fSScale2 * info.axis[1][i] + fTScale2 * info.axis[2][i];
|
||||
originalPoints[3][i] = origin[i] - fSScale2 * info.axis[1][i] + fTScale3 * info.axis[2][i];
|
||||
}
|
||||
|
||||
// get the fragments
|
||||
@@ -937,15 +938,15 @@ void CG_AddMarks(void)
|
||||
}
|
||||
|
||||
if (pMark->markPolys->iIndex < 0) {
|
||||
if (CG_FrustumCullSphere(pMark->pos, pMark->radius)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
vec3_t vWorldPos;
|
||||
CG_FragmentPosToWorldPos(pMark->pos, vWorldPos);
|
||||
if (CG_FrustumCullSphere(vWorldPos, pMark->radius)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (CG_FrustumCullSphere(pMark->pos, pMark->radius)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
pMark->lastVisTime = cg.time;
|
||||
|
||||
+292
-21
@@ -180,6 +180,226 @@ void CG_PlayerTeamIcon(refEntity_t *pModel, entityState_t *pPlayerState)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CG_CastFootShadow
|
||||
|
||||
Cast complex foot shadow using lights
|
||||
===============
|
||||
*/
|
||||
void CG_CastFootShadow(const vec_t* vLightPos, vec_t* vLightIntensity, int iTag, refEntity_t* model)
|
||||
{
|
||||
int i;
|
||||
float fAlpha;
|
||||
float fLength;
|
||||
float fWidth;
|
||||
float fAlphaOfs;
|
||||
float fOfs;
|
||||
float fPitchCos;
|
||||
vec3_t vPos;
|
||||
vec3_t vEnd;
|
||||
vec3_t vDelta;
|
||||
vec3_t vLightAngles;
|
||||
trace_t trace;
|
||||
orientation_t oFoot;
|
||||
|
||||
VectorCopy(model->origin, vPos);
|
||||
oFoot = cgi.TIKI_Orientation(model, iTag);
|
||||
VectorMA(oFoot.origin, 2, oFoot.axis[1], vEnd);
|
||||
for (i = 0; i < 3; i++) {
|
||||
VectorMA(vPos, vEnd[i], model->axis[i], vPos);
|
||||
}
|
||||
|
||||
if (cg_shadowdebug->integer)
|
||||
{
|
||||
vec3_t vDir;
|
||||
|
||||
//
|
||||
// show debug lines
|
||||
//
|
||||
memset(vDir, 0, sizeof(vDir));
|
||||
for (i = 0; i < 3; ++i) {
|
||||
VectorMA(vDir, oFoot.axis[0][i], model->axis[i], vDir);
|
||||
}
|
||||
VectorMA(vPos, 32.0, vDir, vEnd);
|
||||
cgi.R_DebugLine(vPos, vEnd, 1.0, 0.0, 0.0, 1.0);
|
||||
|
||||
memset(vDir, 0, sizeof(vDir));
|
||||
for (i = 0; i < 3; ++i) {
|
||||
VectorMA(vDir, oFoot.axis[1][i], model->axis[i], vDir);
|
||||
}
|
||||
VectorMA(vPos, 32.0, vDir, vEnd);
|
||||
cgi.R_DebugLine(vPos, vEnd, 0.0, 1.0, 0.0, 1.0);
|
||||
|
||||
memset(vDir, 0, sizeof(vDir));
|
||||
for (i = 0; i < 3; ++i) {
|
||||
VectorMA(vDir, oFoot.axis[2][i], model->axis[i], vDir);
|
||||
}
|
||||
VectorMA(vPos, 32.0, vDir, vEnd);
|
||||
cgi.R_DebugLine(vPos, vEnd, 0.0, 0.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
// calculate the direction
|
||||
VectorSubtract(vLightPos, vPos, vDelta);
|
||||
VectorNormalizeFast(vDelta);
|
||||
vectoangles(vDelta, vLightAngles);
|
||||
|
||||
// normalize to 180 degrees
|
||||
if (vLightAngles[0] > 180) {
|
||||
vLightAngles[0] -= 360;
|
||||
}
|
||||
|
||||
if (vLightAngles[0] > -5.7319679) {
|
||||
// FIXME: what is -5.7319679?
|
||||
return;
|
||||
}
|
||||
|
||||
fPitchCos = cos(DEG2RAD(vLightAngles[0]));
|
||||
if (fPitchCos > 0.955) {
|
||||
fAlpha = 1.0 - (fPitchCos - 0.955) * 25;
|
||||
} else {
|
||||
fAlpha = 1.0;
|
||||
}
|
||||
|
||||
fLength = fPitchCos * fPitchCos * 32.0 + fPitchCos * 8.0 + 10.0;
|
||||
fOfs = 0.5 - (-4.1 / tan(DEG2RAD(vLightAngles[0])) + 4.0 - fLength) / fLength * 0.5;
|
||||
VectorMA(vPos, -96.0, vDelta, vEnd);
|
||||
CG_Trace(&trace, vPos, vec3_origin, vec3_origin, vEnd, 0, MASK_FOOTSHADOW, qfalse, qtrue, "CG_CastFootShadow");
|
||||
|
||||
if (cg_shadowdebug->integer)
|
||||
{
|
||||
cgi.R_DebugLine(vPos, vLightPos, 0.75, 0.75, 0.5, 1.0);
|
||||
cgi.R_DebugLine(vPos, vEnd, 1.0, 1.0, 1.0, 1.0);
|
||||
}
|
||||
|
||||
if (trace.fraction == 1.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
trace.fraction -= 0.0427f;
|
||||
if (trace.fraction < 0) {
|
||||
trace.fraction = 0;
|
||||
}
|
||||
|
||||
fWidth = 10.f - (1.f - trace.fraction) * 6.f;
|
||||
fAlphaOfs = (1.f - trace.fraction) * fAlpha;
|
||||
|
||||
fAlpha = Q_max(vLightIntensity[0], Q_max(vLightIntensity[1], vLightIntensity[2]));
|
||||
|
||||
if (fAlpha < 0.1) {
|
||||
vLightIntensity[0] *= 0.1 / fAlpha * fAlphaOfs;
|
||||
vLightIntensity[1] *= 0.1 / fAlpha * fAlphaOfs;
|
||||
vLightIntensity[2] *= 0.1 / fAlpha * fAlphaOfs;
|
||||
} else {
|
||||
vLightIntensity[0] *= fAlphaOfs;
|
||||
vLightIntensity[1] *= fAlphaOfs;
|
||||
vLightIntensity[2] *= fAlphaOfs;
|
||||
}
|
||||
|
||||
fAlpha = Q_max(vLightIntensity[0], Q_max(vLightIntensity[1], vLightIntensity[2]));
|
||||
if (fAlpha > 0.6) {
|
||||
vLightIntensity[0] *= 0.6 / fAlpha;
|
||||
vLightIntensity[1] *= 0.6 / fAlpha;
|
||||
vLightIntensity[2] *= 0.6 / fAlpha;
|
||||
}
|
||||
|
||||
if (vLightIntensity[0] <= 0.01 && vLightIntensity[1] <= 0.01 && vLightIntensity[2] <= 0.01) {
|
||||
return;
|
||||
}
|
||||
|
||||
CG_ImpactMark(
|
||||
cgs.media.footShadowMarkShader,
|
||||
trace.endpos,
|
||||
trace.plane.normal,
|
||||
vLightAngles[1],
|
||||
fWidth,
|
||||
fLength,
|
||||
vLightIntensity[0],
|
||||
vLightIntensity[1],
|
||||
vLightIntensity[2],
|
||||
1.0,
|
||||
qfalse,
|
||||
qtrue,
|
||||
qfalse,
|
||||
qfalse,
|
||||
0.5,
|
||||
fOfs
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CG_CastSimpleFeetShadow
|
||||
|
||||
Cast basic feet shadow
|
||||
===============
|
||||
*/
|
||||
void CG_CastSimpleFeetShadow(const trace_t* pTrace, float fWidth, float fAlpha, int iRightTag, int iLeftTag, const dtiki_t* tiki, refEntity_t* model)
|
||||
{
|
||||
int i;
|
||||
float fShadowYaw;
|
||||
float fLength;
|
||||
vec3_t vPos, vRightPos, vLeftPos;
|
||||
vec3_t vDelta;
|
||||
orientation_t oFoot;
|
||||
|
||||
//
|
||||
// right foot
|
||||
//
|
||||
VectorCopy(pTrace->endpos, vRightPos);
|
||||
oFoot = cgi.TIKI_Orientation(model, iRightTag);
|
||||
VectorMA(oFoot.origin, 3, oFoot.axis[1], vPos);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
VectorMA(vRightPos, vPos[i], model->axis[i], vRightPos);
|
||||
}
|
||||
|
||||
VectorMA(vRightPos, -2, oFoot.axis[1], vRightPos);
|
||||
|
||||
//
|
||||
// left foot
|
||||
//
|
||||
VectorCopy(pTrace->endpos, vLeftPos);
|
||||
oFoot = cgi.TIKI_Orientation(model, iLeftTag);
|
||||
VectorMA(oFoot.origin, 3, oFoot.axis[1], vPos);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
VectorMA(vLeftPos, vPos[i], model->axis[i], vLeftPos);
|
||||
}
|
||||
|
||||
VectorAdd(vRightPos, vLeftPos, vPos);
|
||||
VectorScale(vPos, 0.5, vPos);
|
||||
VectorSubtract(vRightPos, vLeftPos, vDelta);
|
||||
VectorMA(vLeftPos, 0.5, vDelta, vPos);
|
||||
|
||||
// get the facing yaw
|
||||
fShadowYaw = vectoyaw(vDelta);
|
||||
fLength = VectorNormalize(vDelta) * 0.5 + 12;
|
||||
if (fLength < fWidth * 0.7) {
|
||||
fLength = fWidth * 0.7;
|
||||
}
|
||||
|
||||
// add the mark
|
||||
CG_ImpactMark(
|
||||
cgs.media.shadowMarkShader,
|
||||
vPos,
|
||||
pTrace->plane.normal,
|
||||
fShadowYaw,
|
||||
fWidth * 0.7,
|
||||
fLength,
|
||||
fAlpha,
|
||||
fAlpha,
|
||||
fAlpha,
|
||||
1.0,
|
||||
qfalse,
|
||||
qtrue,
|
||||
qfalse,
|
||||
qfalse,
|
||||
0.5,
|
||||
0.5
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CG_EntityShadow
|
||||
@@ -193,9 +413,15 @@ Returns the Z component of the surface being shadowed
|
||||
|
||||
qboolean CG_EntityShadow(centity_t *cent, refEntity_t *model)
|
||||
{
|
||||
int iTagL, iTagR;
|
||||
float alpha;
|
||||
float fWidth;
|
||||
vec3_t end;
|
||||
vec3_t vMins, vMaxs;
|
||||
vec3_t vSize;
|
||||
trace_t trace;
|
||||
float alpha, radius;
|
||||
|
||||
iTagR = -1;
|
||||
|
||||
if (cg_shadows->integer == 0) {
|
||||
return qfalse;
|
||||
@@ -206,10 +432,31 @@ qboolean CG_EntityShadow(centity_t *cent, refEntity_t *model)
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
// no shadows when invisible
|
||||
// if ( cent->currentState.powerups & ( 1 << PW_INVIS ) ) {
|
||||
// return qfalse;
|
||||
// }
|
||||
if (cg_shadows->integer == 2 && (model->renderfx & RF_SHADOW_PRECISE)) {
|
||||
iTagL = cgi.Tag_NumForName(model->tiki, "Bip01 L Foot");
|
||||
if (iTagL != -1) {
|
||||
iTagR = cgi.Tag_NumForName(model->tiki, "Bip01 R Foot");
|
||||
}
|
||||
|
||||
if (iTagR != -1) {
|
||||
int iNumLights, iCurrLight;
|
||||
vec3_t avLightPos[16], avLightIntensity[16];
|
||||
|
||||
iNumLights = Q_clamp(cg_shadowscount->integer, 1, 8);
|
||||
iNumLights = cgi.R_GatherLightSources(model->origin, avLightPos, avLightIntensity, iNumLights);
|
||||
if (iNumLights)
|
||||
{
|
||||
for (iCurrLight = 0; iCurrLight < iNumLights; iCurrLight++)
|
||||
{
|
||||
CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagL, model);
|
||||
CG_CastFootShadow(avLightPos[iCurrLight], avLightIntensity[iCurrLight], iTagR, model);
|
||||
}
|
||||
|
||||
// shadow was casted properly
|
||||
return qtrue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// send a trace down from the player to the ground
|
||||
VectorCopy(model->origin, end);
|
||||
@@ -222,29 +469,46 @@ qboolean CG_EntityShadow(centity_t *cent, refEntity_t *model)
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ((cg_shadows->integer == 2) && (model->renderfx & RF_SHADOW_PRECISE)) {
|
||||
// since 2.0: no shadow if solid
|
||||
if (trace.startsolid || trace.allsolid) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if ((cg_shadows->integer == 3) && (model->renderfx & RF_SHADOW_PRECISE)) {
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
//
|
||||
// get the bounds of the current frame
|
||||
//
|
||||
radius = model->scale * cgi.R_ModelRadius(model->hModel);
|
||||
|
||||
if (radius < 1) {
|
||||
fWidth = model->scale * cgi.R_ModelRadius(model->hModel);
|
||||
if (fWidth < 1) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
// fade the shadow out with height
|
||||
alpha = (1.0 - trace.fraction) * 0.8f;
|
||||
alpha = (1.0 - trace.fraction) * 0.65f;
|
||||
|
||||
if ((cg_shadows->integer == 3) && (model->renderfx & RF_SHADOW_PRECISE)) {
|
||||
if (model->shaderRGBA[3] == 255) {
|
||||
model->shaderRGBA[3] = alpha * 255;
|
||||
if (model->renderfx & RF_SHADOW_PRECISE) {
|
||||
iTagL = cgi.Tag_NumForName(model->tiki, "Bip01 L Foot");
|
||||
if (iTagL != -1) {
|
||||
iTagR = cgi.Tag_NumForName(model->tiki, "Bip01 R Foot");
|
||||
}
|
||||
|
||||
if (iTagR != -1) {
|
||||
if (cg_shadows->integer == 2) {
|
||||
alpha *= 0.6f;
|
||||
}
|
||||
|
||||
CG_CastSimpleFeetShadow(&trace, fWidth, alpha, iTagR, iTagL, model->tiki, model);
|
||||
return qtrue;
|
||||
}
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
cgi.R_ModelBounds(model->hModel, vMins, vMaxs);
|
||||
VectorSubtract(vMaxs, vMins, vSize);
|
||||
VectorScale(vSize, 0.6f, vSize);
|
||||
|
||||
// add the mark as a temporary, so it goes directly to the renderer
|
||||
// without taking a spot in the cg_marks array
|
||||
CG_ImpactMark(
|
||||
@@ -252,15 +516,15 @@ qboolean CG_EntityShadow(centity_t *cent, refEntity_t *model)
|
||||
trace.endpos,
|
||||
trace.plane.normal,
|
||||
cent->lerpAngles[YAW],
|
||||
radius,
|
||||
radius,
|
||||
vSize[1],
|
||||
vSize[0],
|
||||
alpha,
|
||||
alpha,
|
||||
alpha,
|
||||
1,
|
||||
qfalse,
|
||||
qtrue,
|
||||
qtrue,
|
||||
qfalse,
|
||||
qfalse,
|
||||
0.5f,
|
||||
0.5f
|
||||
@@ -316,10 +580,12 @@ void CG_AttachEntity(
|
||||
orientation_t or ;
|
||||
vec3_t tempAxis[3];
|
||||
vec3_t vOrigin;
|
||||
vec3_t vDeltaLightOrg;
|
||||
|
||||
or = cgi.TIKI_Orientation(parent, tagnum);
|
||||
//cgi.Printf( "th = %d %.2f %.2f %.2f\n", tikihandle, or.origin[ 0 ], or.origin[ 1 ], or.origin[ 2 ] );
|
||||
|
||||
VectorSubtract(entity->lightingOrigin, entity->origin, vDeltaLightOrg);
|
||||
VectorCopy(parent->origin, entity->origin);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
@@ -337,14 +603,14 @@ void CG_AttachEntity(
|
||||
VectorCopy(entity->origin, entity->oldorigin);
|
||||
|
||||
if (use_angles) {
|
||||
MatrixMultiply(entity->axis, parent->axis, tempAxis);
|
||||
MatrixMultiply(or.axis, tempAxis, entity->axis);
|
||||
MatrixMultiply(entity->axis, or.axis, tempAxis);
|
||||
MatrixMultiply(tempAxis, parent->axis, entity->axis);
|
||||
}
|
||||
|
||||
entity->scale *= parent->scale;
|
||||
entity->renderfx |= (parent->renderfx & ~(RF_FLAGS_NOT_INHERITED | RF_LIGHTING_ORIGIN));
|
||||
|
||||
MatrixTransformVectorRight(entity->axis, entity->lightingOrigin, vOrigin);
|
||||
MatrixTransformVectorRight(entity->axis, vDeltaLightOrg, vOrigin);
|
||||
VectorAdd(entity->origin, vOrigin, entity->lightingOrigin);
|
||||
}
|
||||
|
||||
@@ -1057,7 +1323,12 @@ void CG_ModelAnim(centity_t *cent, qboolean bDoShaderTime)
|
||||
if (model.frameInfo[i].weight) {
|
||||
if (!((cent->animLastWeight >> i) & 1) || model.frameInfo[i].index != cent->animLast[i]) {
|
||||
CG_ProcessEntityCommands(TIKI_FRAME_ENTRY, model.frameInfo[i].index, s1->number, &model, cent);
|
||||
cent->animLastTimes[i] = 0.0;
|
||||
if (cent->animLastTimes[i] == -1) {
|
||||
cent->animLast[i] = model.frameInfo[i].index;
|
||||
cent->animLastTimes[i] = model.frameInfo[i].time;
|
||||
} else {
|
||||
cent->animLastTimes[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CG_ClientCommands(&model, cent, i);
|
||||
|
||||
@@ -58,7 +58,7 @@ void ClientGameCommandManager::InitializeRainCvars()
|
||||
{
|
||||
int i;
|
||||
|
||||
cg_rain = cgi.Cvar_Get("cg_rain", "0", CVAR_ARCHIVE);
|
||||
cg_rain = cgi.Cvar_Get("cg_rain", "1", CVAR_ARCHIVE);
|
||||
cg_rain_drawcoverage =
|
||||
cgi.Cvar_Get("cg_rain_drawcoverage", "0", CVAR_SAVEGAME | CVAR_SERVER_CREATED | CVAR_SYSTEMINFO);
|
||||
|
||||
|
||||
+402
-388
File diff suppressed because it is too large.
Load diff
@@ -25,6 +25,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
// interpolating between snapshots from the server or locally predicting
|
||||
// ahead the client's movement. It also handles local physics interaction,
|
||||
// like fragments bouncing off walls
|
||||
//
|
||||
// ADDITIONS:
|
||||
// - CG_InterpolatePlayerState() footer: Interpolate the lean angles
|
||||
|
||||
#include "cg_local.h"
|
||||
|
||||
@@ -405,6 +408,9 @@ static void CG_InterpolatePlayerState(qboolean grabAngles)
|
||||
}
|
||||
out->velocity[i] = prev->ps.velocity[i] + f * (next->ps.velocity[i] - prev->ps.velocity[i]);
|
||||
}
|
||||
|
||||
// interpolate the lean angle
|
||||
out->fLeanAngle = LerpAngle(prev->ps.fLeanAngle, next->ps.fLeanAngle, f);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -137,6 +137,8 @@ functions exported to the main executable
|
||||
void (*FS_FreeFile)(void *buf);
|
||||
int (*FS_WriteFile)(const char *qpath, const void *buffer, int size);
|
||||
void (*FS_WriteTextFile)(const char *qpath, const void *buffer, int size);
|
||||
char** (*FS_ListFilteredFiles)(const char* path, const char* extension, const char* filter, qboolean wantSubs, int* numfiles, qboolean allowNonPureFilesOnDisk);
|
||||
void (*FS_FreeFileList)(char **list);
|
||||
// add commands to the local console as if they were typed in
|
||||
// for map changing, etc. The command is not executed immediately,
|
||||
// but will be executed in order the next time console commands
|
||||
@@ -163,7 +165,7 @@ functions exported to the main executable
|
||||
void (*SendClientCommand)(const char *s);
|
||||
|
||||
// CM functions
|
||||
void (*CM_LoadMap)(const char *name);
|
||||
void (*CM_LoadMap)(const char *name, int* checksum);
|
||||
clipHandle_t (*CM_InlineModel)(int index); // 0 = world, 1+ = bmodels
|
||||
int (*CM_NumInlineModels)(void);
|
||||
int (*CM_PointContents)(const vec3_t p, int headnode);
|
||||
@@ -283,9 +285,11 @@ functions exported to the main executable
|
||||
qhandle_t (*R_RegisterModel)(const char *name);
|
||||
qhandle_t (*R_SpawnEffectModel)(const char *name, vec3_t pos, vec3_t axis[3]);
|
||||
qhandle_t (*R_RegisterServerModel)(const char *name);
|
||||
const char * (*R_GetModelName)(qhandle_t hModel);
|
||||
void (*R_UnregisterServerModel)(qhandle_t hModel);
|
||||
qhandle_t (*R_RegisterShader)(const char *name);
|
||||
qhandle_t (*R_RegisterShaderNoMip)(const char *name);
|
||||
const char* (*R_GetShaderName)(qhandle_t hShader);
|
||||
void (*R_AddRefEntityToScene)(const refEntity_t *ent, int parentEntityNumber);
|
||||
void (*R_AddRefSpriteToScene)(const refEntity_t *ent);
|
||||
void (*R_AddLightToScene)(const vec3_t origin, float intensity, float r, float g, float b, int type);
|
||||
@@ -426,6 +430,8 @@ functions exported to the main executable
|
||||
void (*CL_RestoreSavedCgameState)();
|
||||
void (*CL_ClearSavedCgameState)();
|
||||
|
||||
size_t (*getConfigStringIdNormalized)(size_t num);
|
||||
|
||||
cvar_t *fsDebug;
|
||||
hdelement_t *HudDrawElements;
|
||||
clientAnim_t *anim;
|
||||
@@ -499,8 +505,8 @@ functions exported to the main executable
|
||||
//
|
||||
void (*CG_ReadNonPVSClient)(radarUnpacked_t* radarUnpacked);
|
||||
void (*CG_UpdateRadar)();
|
||||
void (*CG_SaveStateToBuffer)(void** out, int svsTime);
|
||||
void (*CG_LoadStateToBuffer)(void** state, int size, int svsTime);
|
||||
size_t (*CG_SaveStateToBuffer)(void** out, int svsTime);
|
||||
qboolean (*CG_LoadStateToBuffer)(void* state, size_t size, int svsTime);
|
||||
void (*CG_CleanUpTempModels)();
|
||||
|
||||
// FIXME
|
||||
|
||||
+59
-13
@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
// cg_servercmds.c -- text commands sent by the server
|
||||
|
||||
#include "cg_local.h"
|
||||
#include "../fgame/bg_voteoptions.h"
|
||||
|
||||
static const char *IsWeaponAllowed(int dmFlags, int flags)
|
||||
{
|
||||
@@ -112,6 +113,7 @@ void CG_ParseServerinfo(void)
|
||||
char map[MAX_QPATH];
|
||||
char *spawnpos;
|
||||
const char *version;
|
||||
const char *mapChecksumStr;
|
||||
|
||||
info = CG_ConfigString(CS_SERVERINFO);
|
||||
cgs.gametype = atoi(Info_ValueForKey(info, "g_gametype"));
|
||||
@@ -135,12 +137,23 @@ void CG_ParseServerinfo(void)
|
||||
cgi.Cvar_Set("cg_obj_alliedtext1", Info_ValueForKey(info, "g_obj_alliedtext1"));
|
||||
cgi.Cvar_Set("cg_obj_alliedtext2", Info_ValueForKey(info, "g_obj_alliedtext2"));
|
||||
cgi.Cvar_Set("cg_obj_alliedtext3", Info_ValueForKey(info, "g_obj_alliedtext3"));
|
||||
cgi.Cvar_Set("cg_obj_axistext1", Info_ValueForKey(info, "cg_obj_axistext1"));
|
||||
cgi.Cvar_Set("cg_obj_axistext2", Info_ValueForKey(info, "cg_obj_axistext2"));
|
||||
cgi.Cvar_Set("cg_obj_axistext3", Info_ValueForKey(info, "cg_obj_axistext3"));
|
||||
cgi.Cvar_Set("cg_obj_alliedtext4", Info_ValueForKey(info, "g_obj_alliedtext4"));
|
||||
cgi.Cvar_Set("cg_obj_alliedtext5", Info_ValueForKey(info, "g_obj_alliedtext5"));
|
||||
cgi.Cvar_Set("cg_obj_axistext1", Info_ValueForKey(info, "g_obj_axistext1"));
|
||||
cgi.Cvar_Set("cg_obj_axistext2", Info_ValueForKey(info, "g_obj_axistext2"));
|
||||
cgi.Cvar_Set("cg_obj_axistext3", Info_ValueForKey(info, "g_obj_axistext3"));
|
||||
cgi.Cvar_Set("cg_obj_axistext4", Info_ValueForKey(info, "g_obj_axistext4"));
|
||||
cgi.Cvar_Set("cg_obj_axistext5", Info_ValueForKey(info, "g_obj_axistext5"));
|
||||
cgi.Cvar_Set("cg_scoreboardpic", Info_ValueForKey(info, "g_scoreboardpic"));
|
||||
cgi.Cvar_Set("cg_scoreboardpicover", Info_ValueForKey(info, "g_scoreboardpicover"));
|
||||
cgs.mapChecksum = atoi(Info_ValueForKey(info, "sv_mapChecksum"));
|
||||
mapChecksumStr = Info_ValueForKey(info, "sv_mapChecksum");
|
||||
if (mapChecksumStr && mapChecksumStr[0]) {
|
||||
cgs.mapChecksum = atoi(mapChecksumStr);
|
||||
cgs.useMapChecksum = qtrue;
|
||||
} else {
|
||||
cgs.mapChecksum = 0;
|
||||
cgs.useMapChecksum = qfalse;
|
||||
}
|
||||
|
||||
mapname = Info_ValueForKey(info, "mapname");
|
||||
|
||||
@@ -184,17 +197,13 @@ CG_ConfigStringModified
|
||||
|
||||
================
|
||||
*/
|
||||
static void CG_ConfigStringModified(void)
|
||||
static void CG_ConfigStringModified(int num, qboolean modelOnly)
|
||||
{
|
||||
int num;
|
||||
|
||||
num = atoi(cgi.Argv(1));
|
||||
|
||||
// get the gamestate from the client system, which will have the
|
||||
// new configstring already integrated
|
||||
cgi.GetGameState(&cgs.gameState);
|
||||
|
||||
CG_ProcessConfigString(num);
|
||||
CG_ProcessConfigString(num, modelOnly);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -275,7 +284,7 @@ The string has been tokenized and can be retrieved with
|
||||
Cmd_Argc() / Cmd_Argv()
|
||||
=================
|
||||
*/
|
||||
static void CG_ServerCommand(void)
|
||||
static void CG_ServerCommand(qboolean modelOnly)
|
||||
{
|
||||
const char *cmd;
|
||||
|
||||
@@ -287,7 +296,11 @@ static void CG_ServerCommand(void)
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "cs")) {
|
||||
CG_ConfigStringModified();
|
||||
CG_ConfigStringModified(cgi.getConfigStringIdNormalized(atoi(cgi.Argv(1))), modelOnly);
|
||||
return;
|
||||
}
|
||||
|
||||
if (modelOnly) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -364,6 +377,28 @@ static void CG_ServerCommand(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "voteresult")) {
|
||||
cmd = cgi.Argv(1);
|
||||
if (*cmd) {
|
||||
strcmp(cmd, "passed");
|
||||
}
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "vo0")) {
|
||||
CG_VoteOptions_StartReadFromServer(cgi.Argv(1));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "vo1")) {
|
||||
CG_VoteOptions_ContinueReadFromServer(cgi.Argv(1));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "vo2")) {
|
||||
CG_VoteOptions_FinishReadFromServer(cgi.Argv(1));
|
||||
return;
|
||||
}
|
||||
|
||||
cgi.Printf("Unknown client game command: %s\n", cmd);
|
||||
}
|
||||
|
||||
@@ -377,9 +412,20 @@ with this this snapshot.
|
||||
*/
|
||||
void CG_ExecuteNewServerCommands(int latestSequence, qboolean differentServer)
|
||||
{
|
||||
int lastServerCommandSequence;
|
||||
|
||||
lastServerCommandSequence = cgs.serverCommandSequence;
|
||||
|
||||
while (cgs.serverCommandSequence < latestSequence) {
|
||||
if (cgi.GetServerCommand(++cgs.serverCommandSequence, differentServer)) {
|
||||
CG_ServerCommand();
|
||||
CG_ServerCommand(qtrue);
|
||||
}
|
||||
}
|
||||
|
||||
cgs.serverCommandSequence = lastServerCommandSequence;
|
||||
while (cgs.serverCommandSequence < latestSequence) {
|
||||
if (cgi.GetServerCommand(++cgs.serverCommandSequence, differentServer)) {
|
||||
CG_ServerCommand(qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,8 +23,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
// DESCRIPTION:
|
||||
// things that happen on snapshot transition, not necessarily every
|
||||
// single frame
|
||||
//
|
||||
// ADDITIONS:
|
||||
// - CG_TransitionSnapshot() footer: set ps.walking to true if the ps has a ground entity
|
||||
|
||||
#include "cg_local.h"
|
||||
#include "cg_radar.h"
|
||||
#include "tiki.h"
|
||||
|
||||
/*
|
||||
@@ -206,6 +210,9 @@ static void CG_TransitionSnapshot(qboolean differentServer)
|
||||
cent->teleported = qfalse;
|
||||
}
|
||||
CG_TransitionEntity(cent);
|
||||
|
||||
// remember time of snapshot this entity was last updated in
|
||||
cent->snapShotTime = cg.snap->serverTime;
|
||||
}
|
||||
|
||||
for (i = 0; i < cg.snap->number_of_sounds; i++) {
|
||||
@@ -243,6 +250,15 @@ static void CG_TransitionSnapshot(qboolean differentServer)
|
||||
CG_TransitionPlayerState(ps, ops);
|
||||
}
|
||||
}
|
||||
|
||||
if (differentServer) {
|
||||
cgi.CL_RestoreSavedCgameState();
|
||||
} else {
|
||||
cgi.CL_ClearSavedCgameState();
|
||||
}
|
||||
|
||||
// this allows the view model to still look normal when the player is on ground
|
||||
cg.snap->ps.walking = cg.snap->ps.groundEntityNum != ENTITYNUM_NONE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+175
-4
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
Copyright (C) 2024 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -38,7 +38,8 @@ static vec3_t g_vLadderstepMaxs;
|
||||
|
||||
ClientSpecialEffectsManager sfxManager;
|
||||
|
||||
Event EV_SFX_EffectDelay(
|
||||
Event EV_SFX_EffectDelay
|
||||
(
|
||||
"effectdelay",
|
||||
EV_DEFAULT,
|
||||
"iivvvvv",
|
||||
@@ -234,9 +235,15 @@ void ClientSpecialEffectsManager::LoadEffects()
|
||||
szEffectModel = "models/fx/bazookaexp_base.tik";
|
||||
break;
|
||||
case SFX_EXP_HEAVYSHELL_BASE:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/heavyshellexp_base.tik";
|
||||
break;
|
||||
case SFX_EXP_TANK_BASE:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/tankexp_base.tik";
|
||||
break;
|
||||
case SFX_EXP_GREN_PAPER:
|
||||
@@ -285,30 +292,57 @@ void ClientSpecialEffectsManager::LoadEffects()
|
||||
szEffectModel = "models/fx/grenexp_carpet.tik";
|
||||
break;
|
||||
case SFX_EXP_HEAVYSHELL_DIRT:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/heavyshellexp_dirt.tik";
|
||||
break;
|
||||
case SFX_EXP_HEAVYSHELL_STONE:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/heavyshellexp_stone.tik";
|
||||
break;
|
||||
case SFX_EXP_HEAVYSHELL_SNOW:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/heavyshellexp_snow.tik";
|
||||
break;
|
||||
case SFX_EXP_TANK_DIRT:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/tankexp_dirt.tik";
|
||||
break;
|
||||
case SFX_EXP_TANK_STONE:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/tankexp_stone.tik";
|
||||
break;
|
||||
case SFX_EXP_TANK_SNOW:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/tankexp_snow.tik";
|
||||
break;
|
||||
case SFX_EXP_BAZOOKA_DIRT:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/bazookaexp_dirt.tik";
|
||||
break;
|
||||
case SFX_EXP_BAZOOKA_STONE:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/bazookaexp_stone.tik";
|
||||
break;
|
||||
case SFX_EXP_BAZOOKA_SNOW:
|
||||
if (cg_protocol < protocol_e::PROTOCOL_MOHTA_MIN) {
|
||||
continue;
|
||||
}
|
||||
szEffectModel = "models/fx/bazookaexp_snow.tik";
|
||||
break;
|
||||
case SFX_WATER_RIPPLE_STILL:
|
||||
@@ -486,7 +520,7 @@ void ClientSpecialEffectsManager::ExecuteEffect(
|
||||
AxisCopy(axis, pCommand->emitter->tag_axis);
|
||||
pCommand->emitter->cgd.createTime = cg.time;
|
||||
commandManager.SetSpawnthing(pCommand->emitter);
|
||||
|
||||
|
||||
(commandManager.*pCommand->endfcn)();
|
||||
}
|
||||
}
|
||||
@@ -904,7 +938,144 @@ void CG_LandingSound(centity_t *ent, refEntity_t *pREnt, float volume, int iEqui
|
||||
|
||||
void CG_BodyFallSound(centity_t *ent, refEntity_t *pREnt, float volume)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
int contents;
|
||||
int surftype;
|
||||
int iEffectNum = -1;
|
||||
vec3_t vStart, vEnd;
|
||||
vec3_t midlegs;
|
||||
str sSoundName;
|
||||
trace_t trace;
|
||||
|
||||
VectorCopy(ent->lerpOrigin, vStart);
|
||||
vStart[2] += 8;
|
||||
|
||||
VectorCopy(vStart, vEnd);
|
||||
vEnd[2] -= 64;
|
||||
|
||||
if (ent->currentState.eType == ET_PLAYER) {
|
||||
CG_Trace(
|
||||
&trace,
|
||||
vStart,
|
||||
g_vFootstepMins,
|
||||
g_vFootstepMaxs,
|
||||
vEnd,
|
||||
ent->currentState.number,
|
||||
MASK_PLAYERSOLID,
|
||||
qtrue,
|
||||
qtrue,
|
||||
"Player Landing"
|
||||
);
|
||||
} else {
|
||||
CG_Trace(
|
||||
&trace,
|
||||
vStart,
|
||||
g_vFootstepMins,
|
||||
g_vFootstepMaxs,
|
||||
vEnd,
|
||||
ent->currentState.number,
|
||||
MASK_MONSTERSOLID,
|
||||
qfalse,
|
||||
qfalse,
|
||||
"Monster Landing"
|
||||
);
|
||||
}
|
||||
|
||||
if (trace.fraction == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
sSoundName = "snd_bodyfall_";
|
||||
contents = CG_PointContents(trace.endpos, -1);
|
||||
if (contents & MASK_WATER) {
|
||||
// take our ground position and trace upwards
|
||||
VectorCopy(trace.endpos, midlegs);
|
||||
midlegs[2] += WATER_NO_SPLASH_HEIGHT;
|
||||
contents = CG_PointContents(midlegs, -1);
|
||||
if (contents & MASK_WATER) {
|
||||
sSoundName += "wade";
|
||||
} else {
|
||||
sSoundName += "puddle";
|
||||
iEffectNum = SFX_FOOT_PUDDLE;
|
||||
}
|
||||
} else {
|
||||
surftype = trace.surfaceFlags & MASK_SURF_TYPE;
|
||||
switch (surftype) {
|
||||
case SURF_FOLIAGE:
|
||||
sSoundName += "foliage";
|
||||
iEffectNum = SFX_FOOT_GRASS;
|
||||
break;
|
||||
case SURF_SNOW:
|
||||
sSoundName += "snow";
|
||||
iEffectNum = SFX_FOOT_SNOW;
|
||||
break;
|
||||
case SURF_CARPET:
|
||||
sSoundName += "carpet";
|
||||
iEffectNum = SFX_FOOT_LIGHT_DUST;
|
||||
break;
|
||||
case SURF_SAND:
|
||||
sSoundName += "sand";
|
||||
iEffectNum = SFX_FOOT_SAND;
|
||||
break;
|
||||
case SURF_PUDDLE:
|
||||
sSoundName += "puddle";
|
||||
iEffectNum = SFX_FOOT_PUDDLE;
|
||||
break;
|
||||
case SURF_GLASS:
|
||||
sSoundName += "glass";
|
||||
iEffectNum = SFX_FOOT_LIGHT_DUST;
|
||||
break;
|
||||
case SURF_GRAVEL:
|
||||
sSoundName += "gravel";
|
||||
iEffectNum = SFX_FOOT_HEAVY_DUST;
|
||||
break;
|
||||
case SURF_MUD:
|
||||
sSoundName += "mud";
|
||||
iEffectNum = SFX_FOOT_MUD;
|
||||
break;
|
||||
case SURF_DIRT:
|
||||
sSoundName += "dirt";
|
||||
iEffectNum = SFX_FOOT_DIRT;
|
||||
break;
|
||||
case SURF_GRILL:
|
||||
sSoundName += "grill";
|
||||
iEffectNum = SFX_FOOT_LIGHT_DUST;
|
||||
break;
|
||||
case SURF_GRASS:
|
||||
sSoundName += "grass";
|
||||
iEffectNum = SFX_FOOT_GRASS;
|
||||
break;
|
||||
case SURF_ROCK:
|
||||
sSoundName += "stone";
|
||||
iEffectNum = SFX_FOOT_HEAVY_DUST;
|
||||
break;
|
||||
case SURF_PAPER:
|
||||
sSoundName += "paper";
|
||||
iEffectNum = SFX_FOOT_LIGHT_DUST;
|
||||
break;
|
||||
case SURF_WOOD:
|
||||
sSoundName += "wood";
|
||||
iEffectNum = SFX_FOOT_LIGHT_DUST;
|
||||
break;
|
||||
case SURF_METAL:
|
||||
sSoundName += "metal";
|
||||
iEffectNum = SFX_FOOT_LIGHT_DUST;
|
||||
break;
|
||||
default:
|
||||
sSoundName += "stone";
|
||||
iEffectNum = SFX_FOOT_HEAVY_DUST;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cg_debugFootsteps->integer) {
|
||||
cgi.DPrintf("BodyFall: %s volume: %.2f effect = %i\n", sSoundName.c_str(), volume, iEffectNum);
|
||||
}
|
||||
|
||||
commandManager.PlaySound(sSoundName, trace.endpos, -1, volume, -1, -1, 1);
|
||||
|
||||
if (iEffectNum != -1) {
|
||||
sfxManager.MakeEffect_Angles(iEffectNum, trace.endpos, Vector(270, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+222
-119
@@ -28,6 +28,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "tiki.h"
|
||||
|
||||
cvar_t *cg_showtempmodels;
|
||||
cvar_t *cg_max_tempmodels;
|
||||
cvar_t *cg_reserve_tempmodels;
|
||||
cvar_t *cg_detail;
|
||||
cvar_t *cg_effectdetail;
|
||||
cvar_t *cg_effect_physicsrate;
|
||||
@@ -86,6 +88,83 @@ void ClientGameCommandManager::FreeTempModel(ctempmodel_t *p)
|
||||
m_free_tempmodels = p;
|
||||
}
|
||||
|
||||
//===============
|
||||
// FreeAllTempModels
|
||||
//===============
|
||||
void ClientGameCommandManager::FreeAllTempModels(void)
|
||||
{
|
||||
ctempmodel_t *p, *next;
|
||||
|
||||
// Go through all the temp models and run the physics if necessary,
|
||||
// then add them to the ref
|
||||
p = m_active_tempmodels.prev;
|
||||
for (; p != &m_active_tempmodels; p = next) {
|
||||
// grab next now, so if the local entity is freed we still have it
|
||||
next = p->prev;
|
||||
FreeTempModel(p);
|
||||
}
|
||||
}
|
||||
|
||||
//===============
|
||||
// FreeSomeTempModels
|
||||
//===============
|
||||
void ClientGameCommandManager::FreeSomeTempModels(void)
|
||||
{
|
||||
ctempmodel_t* model;
|
||||
int count = 0;
|
||||
unsigned int i;
|
||||
unsigned int numToFree;
|
||||
|
||||
if (!m_free_tempmodels) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (model = m_active_tempmodels.prev; model != &m_active_tempmodels; model = model->prev) {
|
||||
count++;
|
||||
}
|
||||
|
||||
if (cg_reserve_tempmodels->integer <= (cg_max_tempmodels->integer - count)) {
|
||||
// nothing to free
|
||||
return;
|
||||
}
|
||||
|
||||
numToFree = cg_reserve_tempmodels->integer - (cg_max_tempmodels->integer - count);
|
||||
|
||||
for (i = 0; i < numToFree; i++) {
|
||||
FreeTempModel(m_active_tempmodels.prev);
|
||||
}
|
||||
}
|
||||
|
||||
//===============
|
||||
// FreeSpawnthing
|
||||
//===============
|
||||
void ClientGameCommandManager::FreeSpawnthing(spawnthing_t* sp)
|
||||
{
|
||||
ctempmodel_t* model;
|
||||
ctempmodel_t* prev;
|
||||
|
||||
if (sp->numtempmodels) {
|
||||
for (model = m_active_tempmodels.prev; model != &m_active_tempmodels; model = prev) {
|
||||
prev = model->prev;
|
||||
|
||||
if (model->m_spawnthing == sp) {
|
||||
FreeTempModel(model);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m_emitters.RemoveObject(sp);
|
||||
|
||||
if (sp == m_spawnthing) {
|
||||
m_spawnthing = NULL;
|
||||
}
|
||||
|
||||
delete sp;
|
||||
}
|
||||
}
|
||||
|
||||
//===============
|
||||
// ResetTempModels
|
||||
//===============
|
||||
void ClientGameCommandManager::ResetTempModels(void)
|
||||
{
|
||||
// Go through all the active tempmodels and free them
|
||||
@@ -99,6 +178,7 @@ void ClientGameCommandManager::ResetTempModels(void)
|
||||
}
|
||||
|
||||
static int lastTempModelFrameTime = 0;
|
||||
int next_tempmodel_warning = 0;
|
||||
|
||||
void CG_ResetTempModels(void)
|
||||
{
|
||||
@@ -128,9 +208,23 @@ void ClientGameCommandManager::InitializeTempModels(void)
|
||||
void ClientGameCommandManager::InitializeTempModelCvars(void)
|
||||
{
|
||||
cg_showtempmodels = cgi.Cvar_Get("cg_showtempmodels", "0", 0);
|
||||
cg_detail = cgi.Cvar_Get("detail", "1", 1);
|
||||
cg_effectdetail = cgi.Cvar_Get("cg_effectdetail", "0.2", 1);
|
||||
cg_effect_physicsrate = cgi.Cvar_Get("cg_effect_physicsrate", "10", 1);
|
||||
cg_detail = cgi.Cvar_Get("detail", "1", CVAR_ARCHIVE);
|
||||
cg_effectdetail = cgi.Cvar_Get("cg_effectdetail", "0.2", CVAR_ARCHIVE);
|
||||
cg_effect_physicsrate = cgi.Cvar_Get("cg_effect_physicsrate", "10", CVAR_ARCHIVE);
|
||||
cg_max_tempmodels = cgi.Cvar_Get("cg_max_tempmodels", "1100", CVAR_ARCHIVE);
|
||||
cg_reserve_tempmodels = cgi.Cvar_Get("cg_reserve_tempmodels", "200", CVAR_ARCHIVE);
|
||||
|
||||
if (cg_max_tempmodels->integer > MAX_TEMPMODELS) {
|
||||
// 2.40 sets the integer value directly rather than calling Cvar_Set()
|
||||
//cg_max_tempmodels->integer = MAX_TEMPMODELS
|
||||
cgi.Cvar_Set("cg_max_tempmodels", va("%i", MAX_TEMPMODELS));
|
||||
}
|
||||
|
||||
if (cg_reserve_tempmodels->integer * 5 > cg_max_tempmodels->integer) {
|
||||
// 2.40 sets the integer value directly rather than calling Cvar_Set()
|
||||
//cg_reserve_tempmodels->integer = cg_max_tempmodels->integer / 5;
|
||||
cgi.Cvar_Set("cg_reserve_tempmodels", va("%i", cg_max_tempmodels->integer / 5));
|
||||
}
|
||||
}
|
||||
|
||||
//===============
|
||||
@@ -141,6 +235,7 @@ void ClientGameCommandManager::AnimateTempModel(ctempmodel_t *p, Vector origin,
|
||||
int numframes;
|
||||
int deltatime;
|
||||
int frametime;
|
||||
float prev;
|
||||
|
||||
// This code is for animating tempmodels that are spawned from the client
|
||||
// side
|
||||
@@ -165,10 +260,18 @@ void ClientGameCommandManager::AnimateTempModel(ctempmodel_t *p, Vector origin,
|
||||
|
||||
// Go through all the frames, and process any commands associated with the
|
||||
// tempmodel as well
|
||||
prev = deltatime;
|
||||
while (deltatime >= frametime) {
|
||||
deltatime -= frametime;
|
||||
p->lastAnimTime += frametime;
|
||||
p->ent.wasframe = (p->ent.wasframe + 1) % numframes;
|
||||
CG_ProcessEntityCommands(p->ent.wasframe, p->ent.frameInfo[0].index, -1, &p->ent, NULL);
|
||||
|
||||
if (deltatime == prev) {
|
||||
break;
|
||||
}
|
||||
|
||||
prev = deltatime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,9 +311,10 @@ void ClientGameCommandManager::UpdateSwarm(ctempmodel_t *p)
|
||||
}
|
||||
}
|
||||
|
||||
qboolean ClientGameCommandManager::TempModelRealtimeEffects(ctempmodel_t *p, float ftime, float dtime, float scale)
|
||||
qboolean ClientGameCommandManager::TempModelRealtimeEffects(ctempmodel_t *p, float ftime, float scale)
|
||||
{
|
||||
float fade, fadein;
|
||||
float dtime;
|
||||
byte tempColor[4];
|
||||
|
||||
if (p->cgd.flags & (T_FADE | T_SCALEUPDOWN)) {
|
||||
@@ -362,9 +466,19 @@ void ClientGameCommandManager::OtherTempModelEffects(ctempmodel_t *p, Vector ori
|
||||
vec3_t axis[3];
|
||||
|
||||
if (p->number != -1) {
|
||||
refEntity_t *old_entity;
|
||||
dtiki_t *old_tiki;
|
||||
int oldnum;
|
||||
float oldscale;
|
||||
|
||||
// Set the axis
|
||||
AnglesToAxis(p->cgd.angles, axis);
|
||||
|
||||
old_entity = current_entity;
|
||||
old_tiki = current_tiki;
|
||||
oldnum = current_entity_number;
|
||||
oldscale = current_scale;
|
||||
|
||||
current_scale = newEnt->scale;
|
||||
current_entity = newEnt;
|
||||
current_tiki = p->cgd.tiki;
|
||||
@@ -380,14 +494,23 @@ void ClientGameCommandManager::OtherTempModelEffects(ctempmodel_t *p, Vector ori
|
||||
commandManager.ProcessEvent(ev);
|
||||
}
|
||||
|
||||
current_entity_number = -1;
|
||||
current_tiki = NULL;
|
||||
current_entity = NULL;
|
||||
current_scale = -1;
|
||||
current_entity_number = oldnum;
|
||||
current_tiki = old_tiki;
|
||||
current_entity = old_entity;
|
||||
current_scale = oldscale;
|
||||
}
|
||||
|
||||
if (p->cgd.flags2 & T2_ALIGNSTRETCH) {
|
||||
Vector vDelta;
|
||||
float fScale;
|
||||
|
||||
vDelta = p->cgd.origin - p->cgd.oldorigin;
|
||||
fScale = vDelta.length() * p->cgd.scale2;
|
||||
VectorScale(newEnt->axis[0], fScale, newEnt->axis[0]);
|
||||
}
|
||||
}
|
||||
|
||||
qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime, float time2, float scale)
|
||||
qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime, float scale)
|
||||
{
|
||||
int dtime;
|
||||
Vector parentOrigin(0, 0, 0);
|
||||
@@ -406,37 +529,41 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
|
||||
|
||||
// Update based on swarm
|
||||
if (p->cgd.flags & T_SWARM) {
|
||||
p->cgd.origin += ftime * p->cgd.velocity * scale;
|
||||
p->cgd.origin += p->cgd.velocity * ftime * scale;
|
||||
}
|
||||
|
||||
// Update the orign and the angles based on velocities first
|
||||
if (p->cgd.flags2 & (T2_MOVE | T2_ACCEL)) {
|
||||
p->cgd.origin = p->cgd.origin + (p->cgd.velocity * ftime * scale) + (time2 * p->cgd.accel);
|
||||
else if (p->cgd.flags2 & (T2_MOVE | T2_ACCEL)) {
|
||||
p->cgd.origin += p->cgd.velocity * ftime * scale;
|
||||
}
|
||||
|
||||
// If linked to the parent or hardlinked, get the parent's origin
|
||||
if ((p->cgd.flags & (T_PARENTLINK | T_HARDLINK)) && (p->cgd.parent != ENTITYNUM_NONE)) {
|
||||
centity_t *pc;
|
||||
centity_t* pc;
|
||||
refEntity_t* e;
|
||||
|
||||
pc = &cg_entities[p->cgd.parent];
|
||||
|
||||
if (pc->currentValid) {
|
||||
refEntity_t *e;
|
||||
|
||||
e = cgi.R_GetRenderEntity(p->cgd.parent);
|
||||
|
||||
if (!e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
parentOrigin = e->origin;
|
||||
vectoangles(e->axis[0], parentAngles);
|
||||
} else {
|
||||
if (!pc->currentValid) {
|
||||
return false;
|
||||
}
|
||||
} else if (p->cgd.flags & T_SWARM) {
|
||||
|
||||
e = cgi.R_GetRenderEntity(p->cgd.parent);
|
||||
if (!e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
parentOrigin = e->origin;
|
||||
vectoangles(e->axis[0], parentAngles);
|
||||
}
|
||||
else if (p->cgd.flags & T_SWARM) {
|
||||
p->cgd.parentOrigin = p->cgd.velocity + p->cgd.accel * ftime * scale;
|
||||
}
|
||||
|
||||
if (p->cgd.flags2 & T2_WATERONLY) {
|
||||
if (!(cgi.CM_PointContents(p->cgd.origin, 0) & (CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Align the object along it's traveling vector
|
||||
if (p->cgd.flags & T_ALIGN) {
|
||||
p->cgd.angles = p->cgd.velocity.toAngles();
|
||||
@@ -457,12 +584,12 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
|
||||
p->cgd.angles[1] = AngleMod(p->cgd.angles[1]);
|
||||
p->cgd.angles[2] = AngleMod(p->cgd.angles[2]);
|
||||
|
||||
// Add in parent angles
|
||||
tempangles = p->cgd.angles + parentAngles;
|
||||
|
||||
// Convert to axis
|
||||
if ((p->cgd.flags & (T_ALIGN | T_RANDOMROLL | T_PARENTLINK | T_HARDLINK | T_ANGLES))
|
||||
|| (p->cgd.flags2 & T2_AMOVE)) {
|
||||
// Add in parent angles
|
||||
tempangles = p->cgd.angles + parentAngles;
|
||||
|
||||
AnglesToAxis(tempangles, p->ent.axis);
|
||||
}
|
||||
|
||||
@@ -503,25 +630,9 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
|
||||
}
|
||||
|
||||
if (p->cgd.flags2 & T2_CLAMP_VEL) {
|
||||
if (p->cgd.velocity.x < p->cgd.minVel.x) {
|
||||
p->cgd.velocity.x = p->cgd.minVel.x;
|
||||
}
|
||||
if (p->cgd.velocity.y < p->cgd.minVel.y) {
|
||||
p->cgd.velocity.y = p->cgd.minVel.y;
|
||||
}
|
||||
if (p->cgd.velocity.z < p->cgd.minVel.z) {
|
||||
p->cgd.velocity.z = p->cgd.minVel.z;
|
||||
}
|
||||
|
||||
if (p->cgd.velocity.x > p->cgd.maxVel.x) {
|
||||
p->cgd.velocity.x = p->cgd.maxVel.x;
|
||||
}
|
||||
if (p->cgd.velocity.y > p->cgd.maxVel.y) {
|
||||
p->cgd.velocity.y = p->cgd.maxVel.y;
|
||||
}
|
||||
if (p->cgd.velocity.z > p->cgd.maxVel.z) {
|
||||
p->cgd.velocity.z = p->cgd.maxVel.z;
|
||||
}
|
||||
p->cgd.velocity.x = Q_clamp_float(p->cgd.velocity.x, p->cgd.minVel.x, p->cgd.maxVel.x);
|
||||
p->cgd.velocity.y = Q_clamp_float(p->cgd.velocity.y, p->cgd.minVel.y, p->cgd.maxVel.y);
|
||||
p->cgd.velocity.z = Q_clamp_float(p->cgd.velocity.z, p->cgd.minVel.z, p->cgd.maxVel.z);
|
||||
}
|
||||
|
||||
if (p->cgd.flags2 & T2_CLAMP_VEL_AXIS) {
|
||||
@@ -530,25 +641,9 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
|
||||
localVelocity.y = DotProduct(p->cgd.velocity, p->ent.axis[1]);
|
||||
localVelocity.z = DotProduct(p->cgd.velocity, p->ent.axis[2]);
|
||||
|
||||
if (localVelocity.x < p->cgd.minVel.x) {
|
||||
localVelocity.x = p->cgd.minVel.x;
|
||||
}
|
||||
if (localVelocity.y < p->cgd.minVel.y) {
|
||||
localVelocity.y = p->cgd.minVel.y;
|
||||
}
|
||||
if (localVelocity.z < p->cgd.minVel.z) {
|
||||
localVelocity.z = p->cgd.minVel.z;
|
||||
}
|
||||
|
||||
if (localVelocity.x > p->cgd.maxVel.x) {
|
||||
localVelocity.x = p->cgd.maxVel.x;
|
||||
}
|
||||
if (localVelocity.y > p->cgd.maxVel.y) {
|
||||
localVelocity.y = p->cgd.maxVel.y;
|
||||
}
|
||||
if (localVelocity.z > p->cgd.maxVel.z) {
|
||||
localVelocity.z = p->cgd.maxVel.z;
|
||||
}
|
||||
localVelocity.x = Q_clamp_float(localVelocity.x, p->cgd.minVel.x, p->cgd.maxVel.x);
|
||||
localVelocity.y = Q_clamp_float(localVelocity.y, p->cgd.minVel.y, p->cgd.maxVel.y);
|
||||
localVelocity.z = Q_clamp_float(localVelocity.z, p->cgd.minVel.z, p->cgd.maxVel.z);
|
||||
|
||||
p->cgd.velocity.x = DotProduct(localVelocity, p->ent.axis[0]);
|
||||
p->cgd.velocity.y = DotProduct(localVelocity, p->ent.axis[1]);
|
||||
@@ -559,14 +654,6 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
|
||||
// FIXME: vss wind
|
||||
}
|
||||
} else {
|
||||
if (p->touchfcn) {
|
||||
p->touchfcn(p, &trace);
|
||||
}
|
||||
|
||||
if (p->cgd.flags & T_DIETOUCH) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector normal;
|
||||
|
||||
// Set the origin
|
||||
@@ -581,14 +668,14 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
|
||||
trace.endpos,
|
||||
trace.plane.normal,
|
||||
p->cgd.decal_orientation,
|
||||
p->cgd.decal_radius,
|
||||
p->cgd.color[0],
|
||||
p->cgd.color[1],
|
||||
p->cgd.color[2],
|
||||
p->cgd.alpha,
|
||||
p->cgd.flags & T_FADE,
|
||||
p->cgd.decal_radius,
|
||||
p->cgd.flags2 & T2_TEMPORARY_DECAL,
|
||||
p->cgd.lightstyle,
|
||||
qtrue,
|
||||
p->cgd.flags & T_FADEIN
|
||||
);
|
||||
|
||||
@@ -610,9 +697,10 @@ qboolean ClientGameCommandManager::TempModelPhysics(ctempmodel_t *p, float ftime
|
||||
dot = p->cgd.velocity * normal;
|
||||
p->cgd.velocity = p->cgd.velocity + ((-2 * dot) * normal);
|
||||
p->cgd.velocity *= p->cgd.bouncefactor;
|
||||
p->cgd.avelocity *= -p->cgd.bouncefactor;
|
||||
|
||||
// check for stop
|
||||
if (trace.plane.normal[2] > 0 && p->cgd.velocity[2] < 40) {
|
||||
if (trace.plane.normal[2] > 0 && p->cgd.velocity[2] < 45) {
|
||||
p->cgd.velocity = Vector(0, 0, 0);
|
||||
p->cgd.avelocity = Vector(0, 0, 0);
|
||||
p->cgd.flags &= ~T_WAVE;
|
||||
@@ -685,7 +773,7 @@ qboolean ClientGameCommandManager::LerpTempModel(refEntity_t *newEnt, ctempmodel
|
||||
// Add the parent ent's origin to the local origin
|
||||
VectorAdd(newEnt->origin, parentOrigin, newEnt->origin);
|
||||
} else {
|
||||
if (p->cgd.flags2 & (T2_MOVE | T2_ACCEL)) {
|
||||
if (p->cgd.flags2 & (T2_MOVE | T2_ACCEL) || (p->cgd.flags & T_SWARM)) {
|
||||
// Lerp the ent's origin
|
||||
for (i = 0; i < 3; i++) {
|
||||
newEnt->origin[i] = p->lastEnt.origin[i] + frac * (p->ent.origin[i] - p->lastEnt.origin[i]);
|
||||
@@ -741,16 +829,17 @@ void ClientGameCommandManager::AddTempModels(void)
|
||||
refEntity_t *old_ent;
|
||||
|
||||
// To counteract cg.time going backwards
|
||||
if (lastTempModelFrameTime) {
|
||||
if ((cg.time < lastTempModelFrameTime) || (cg.time - lastTempModelFrameTime > TOO_MUCH_TIME_PASSED)) {
|
||||
p = m_active_tempmodels.prev;
|
||||
for (; p != &m_active_tempmodels; p = next) {
|
||||
next = p->prev;
|
||||
p->lastPhysicsTime = cg.time;
|
||||
}
|
||||
lastTempModelFrameTime = cg.time;
|
||||
return;
|
||||
if (lastTempModelFrameTime && ((cg.time < lastTempModelFrameTime) || (cg.time - lastTempModelFrameTime > TOO_MUCH_TIME_PASSED))) {
|
||||
p = m_active_tempmodels.prev;
|
||||
for (; p != &m_active_tempmodels; p = next) {
|
||||
next = p->prev;
|
||||
p->lastPhysicsTime = cg.time;
|
||||
}
|
||||
lastTempModelFrameTime = cg.time;
|
||||
return;
|
||||
}
|
||||
|
||||
if (lastTempModelFrameTime) {
|
||||
frameTime = cg.time - lastTempModelFrameTime;
|
||||
} else {
|
||||
frameTime = 0;
|
||||
@@ -763,6 +852,7 @@ void ClientGameCommandManager::AddTempModels(void)
|
||||
}
|
||||
|
||||
memset(&newEnt, 0, sizeof(newEnt));
|
||||
newEnt.parentEntity = ENTITYNUM_NONE;
|
||||
// Set this frame time for the next one
|
||||
effectTime = (float)frameTime / 1000.0f;
|
||||
effectTime2 = effectTime * effectTime;
|
||||
@@ -793,7 +883,7 @@ void ClientGameCommandManager::AddTempModels(void)
|
||||
current_tiki = p->cgd.tiki;
|
||||
current_entity_number = p->number;
|
||||
|
||||
TempModelRealtimeEffects(p, effectTime, effectTime2, scale);
|
||||
TempModelRealtimeEffects(p, effectTime, scale);
|
||||
|
||||
if (p->lastPhysicsTime) {
|
||||
mstime = cg.time - p->lastPhysicsTime;
|
||||
@@ -808,8 +898,7 @@ void ClientGameCommandManager::AddTempModels(void)
|
||||
|
||||
if ((mstime >= physics_rate) || (p->cgd.flags2 & T2_PHYSICS_EVERYFRAME)) {
|
||||
ftime = mstime / 1000.0f;
|
||||
time2 = ftime * ftime;
|
||||
ret = TempModelPhysics(p, ftime, time2, scale);
|
||||
ret = TempModelPhysics(p, ftime, scale);
|
||||
|
||||
if (!ret) {
|
||||
FreeTempModel(p);
|
||||
@@ -823,14 +912,8 @@ void ClientGameCommandManager::AddTempModels(void)
|
||||
// Calculate the lerp value based on the time passed since last physics
|
||||
// time of this tempmodel
|
||||
lerpfrac = (float)(cg.time - p->lastPhysicsTime) / (float)physics_rate;
|
||||
|
||||
// Clamp
|
||||
if (lerpfrac > 1) {
|
||||
lerpfrac = 1;
|
||||
}
|
||||
if (lerpfrac < 0) {
|
||||
lerpfrac = 0;
|
||||
}
|
||||
lerpfrac = Q_clamp_float(lerpfrac, 0, 1);
|
||||
|
||||
// Increment the time this tempmodel has been alive
|
||||
p->aliveTime += frameTime;
|
||||
@@ -843,11 +926,10 @@ void ClientGameCommandManager::AddTempModels(void)
|
||||
|
||||
// Run physics if the lastEnt is not valid to get a valid lerp
|
||||
if (!p->lastEntValid) {
|
||||
float t, t2;
|
||||
float t;
|
||||
t = physics_rate / 1000.0f;
|
||||
t2 = t * t;
|
||||
|
||||
ret = TempModelPhysics(p, t, t2, scale);
|
||||
ret = TempModelPhysics(p, t, scale);
|
||||
if (!ret) {
|
||||
FreeTempModel(p);
|
||||
continue;
|
||||
@@ -872,12 +954,12 @@ void ClientGameCommandManager::AddTempModels(void)
|
||||
}
|
||||
|
||||
if (p->cgd.flags & T_WAVE) {
|
||||
Vector origin;
|
||||
vec3_t origin;
|
||||
float axis[3][3];
|
||||
|
||||
origin = Vector(p->m_spawnthing->linked_origin) + Vector(p->m_spawnthing->linked_axis[0]) * newEnt.origin[0]
|
||||
+ Vector(p->m_spawnthing->linked_axis[1]) * newEnt.origin[1]
|
||||
+ Vector(p->m_spawnthing->linked_axis[2]) * newEnt.origin[2];
|
||||
VectorMA(p->m_spawnthing->linked_origin, newEnt.origin[0], p->m_spawnthing->linked_axis[0], origin);
|
||||
VectorMA(origin, newEnt.origin[1], p->m_spawnthing->linked_axis[1], origin);
|
||||
VectorMA(origin, newEnt.origin[2], p->m_spawnthing->linked_axis[2], origin);
|
||||
|
||||
VectorCopy(origin, newEnt.origin);
|
||||
|
||||
@@ -891,7 +973,10 @@ void ClientGameCommandManager::AddTempModels(void)
|
||||
newEnt.reType = p->ent.reType;
|
||||
newEnt.shaderTime = p->ent.shaderTime;
|
||||
|
||||
newEnt.frameInfo[0] = p->ent.frameInfo[0];
|
||||
newEnt.frameInfo[0].index = p->ent.frameInfo[0].index;
|
||||
newEnt.frameInfo[0].weight = 1.0;
|
||||
newEnt.frameInfo[0].time = 0.0;
|
||||
|
||||
newEnt.wasframe = p->ent.wasframe;
|
||||
newEnt.actionWeight = 1.0;
|
||||
newEnt.entityNumber = ENTITYNUM_NONE;
|
||||
@@ -901,6 +986,9 @@ void ClientGameCommandManager::AddTempModels(void)
|
||||
|
||||
OtherTempModelEffects(p, newEnt.origin, &newEnt);
|
||||
|
||||
VectorCopy(newEnt.origin, newEnt.lightingOrigin);
|
||||
newEnt.radius = 4.0;
|
||||
|
||||
// Add to the ref
|
||||
if (p->cgd.flags & T_DLIGHT) {
|
||||
// Tempmodel is a Dynamic Light
|
||||
@@ -960,6 +1048,14 @@ void ClientGameCommandManager::SpawnTempModel(int mcount)
|
||||
Vector delta;
|
||||
Vector start;
|
||||
Vector vForward, vLeft, vUp;
|
||||
float fDist;
|
||||
|
||||
delta = m_spawnthing->cgd.origin - cg.refdef.vieworg;
|
||||
fDist = delta * delta * (cg.refdef.fov_x * cg.refdef.fov_x / 6400.0);
|
||||
if (fDist >= m_spawnthing->fMaxRangeSquared || fDist < m_spawnthing->fMinRangeSquared) {
|
||||
// don't draw above the distance
|
||||
return;
|
||||
}
|
||||
|
||||
if (current_entity) {
|
||||
current_entity_scale = current_entity->scale;
|
||||
@@ -1003,7 +1099,11 @@ void ClientGameCommandManager::SpawnTempModel(int mcount)
|
||||
p = AllocateTempModel();
|
||||
|
||||
if (!p) {
|
||||
cgi.DPrintf("Out of tempmodels\n");
|
||||
if (cgi.Milliseconds() >= next_tempmodel_warning) {
|
||||
// make sure to not spam the console with this message
|
||||
cgi.DPrintf("Out of tempmodels\n");
|
||||
next_tempmodel_warning = cgi.Milliseconds() + 1000;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1027,9 +1127,11 @@ void ClientGameCommandManager::SpawnTempModel(int mcount)
|
||||
|
||||
// Set up the origin of the tempmodel
|
||||
if (m_spawnthing->cgd.flags & T_SPHERE) {
|
||||
// Create a random forward vector so the particles burst out in a
|
||||
// sphere
|
||||
newForward = Vector(crandom(), crandom(), crandom());
|
||||
do {
|
||||
// Create a random forward vector so the particles burst out in a
|
||||
// sphere
|
||||
newForward = Vector(crandom(), crandom(), crandom());
|
||||
} while (newForward * newForward > 1.0);
|
||||
} else if (m_spawnthing->cgd.flags & T_CIRCLE) {
|
||||
if (m_spawnthing->sphereRadius != 0) // Offset by the radius
|
||||
{
|
||||
@@ -1044,12 +1146,14 @@ void ClientGameCommandManager::SpawnTempModel(int mcount)
|
||||
newForward = p->cgd.origin - m_spawnthing->cgd.origin;
|
||||
newForward.normalize();
|
||||
}
|
||||
} else if (m_spawnthing->cgd.flags & T_SPHERE) {
|
||||
} else if (m_spawnthing->cgd.flags & T_INWARDSPHERE) {
|
||||
// Project the origin along a random ray, and set the forward
|
||||
// vector pointing back to the origin
|
||||
Vector dir, end;
|
||||
|
||||
dir = Vector(crandom(), crandom(), crandom());
|
||||
do {
|
||||
dir = Vector(crandom(), crandom(), crandom());
|
||||
} while (dir * dir > 1.0);
|
||||
|
||||
end = m_spawnthing->cgd.origin + dir * m_spawnthing->sphereRadius * current_entity_scale;
|
||||
VectorCopy(end, p->cgd.origin);
|
||||
@@ -1078,10 +1182,9 @@ void ClientGameCommandManager::SpawnTempModel(int mcount)
|
||||
cosa = cos(fAngle);
|
||||
|
||||
p->cgd.origin = start + vForward * fHeight;
|
||||
p->cgd.origin += start + vLeft * (cosa * fRadius);
|
||||
p->cgd.origin += start + vUp * (sina * fRadius);
|
||||
} else if (m_spawnthing->sphereRadius != 0) // Offset in a spherical pattern
|
||||
{
|
||||
p->cgd.origin += vLeft * (cosa * fRadius);
|
||||
p->cgd.origin += vUp * (sina * fRadius);
|
||||
} else if (m_spawnthing->sphereRadius != 0) { // Offset in a spherical pattern
|
||||
Vector dir, end;
|
||||
|
||||
dir = Vector(crandom(), crandom(), crandom());
|
||||
@@ -1092,7 +1195,7 @@ void ClientGameCommandManager::SpawnTempModel(int mcount)
|
||||
VectorCopy(end, p->cgd.origin);
|
||||
newForward = dir;
|
||||
} else {
|
||||
VectorCopy(m_spawnthing->cgd.origin, p->cgd.origin);
|
||||
VectorCopy(start, p->cgd.origin);
|
||||
}
|
||||
|
||||
if (m_spawnthing->cgd.flags & T_SWARM && !(m_spawnthing->cgd.flags & (T_HARDLINK | T_PARENTLINK))) {
|
||||
|
||||
@@ -189,7 +189,7 @@ void CG_InstaMessageGroupE_f(void)
|
||||
|
||||
void CG_HudPrint_f(void)
|
||||
{
|
||||
cgi.Printf("\x1%s", cgi.Argv(0));
|
||||
cgi.Printf("\x1%s", cgi.Argv(1));
|
||||
}
|
||||
|
||||
int CG_CheckCaptureKey(int key, qboolean down, unsigned int time)
|
||||
|
||||
+127
-18
@@ -504,6 +504,44 @@ static int CG_CalcFov(void)
|
||||
return inwater;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CG_SetupFog
|
||||
|
||||
Prepares fog values for rendering
|
||||
===============
|
||||
*/
|
||||
void CG_SetupFog() {
|
||||
cg.refdef.farplane_distance = cg.farplane_distance;
|
||||
cg.refdef.farplane_bias = cg.farplane_bias;
|
||||
cg.refdef.farplane_color[0] = cg.farplane_color[0];
|
||||
cg.refdef.farplane_color[1] = cg.farplane_color[1];
|
||||
cg.refdef.farplane_color[2] = cg.farplane_color[2];
|
||||
cg.refdef.farplane_cull = cg.farplane_cull;
|
||||
cg.refdef.skybox_farplane = cg.skyboxFarplane;
|
||||
cg.refdef.renderTerrain = cg.renderTerrain;
|
||||
cg.refdef.farclipOverride = cg.farclipOverride;
|
||||
cg.refdef.farplaneColorOverride[0] = cg.farplaneColorOverride[0];
|
||||
cg.refdef.farplaneColorOverride[1] = cg.farplaneColorOverride[1];
|
||||
cg.refdef.farplaneColorOverride[2] = cg.farplaneColorOverride[2];
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CG_SetupPortalSky
|
||||
|
||||
Sets portalsky values for rendering
|
||||
===============
|
||||
*/
|
||||
void CG_SetupPortalSky() {
|
||||
cg.refdef.sky_alpha = cg.sky_alpha;
|
||||
cg.refdef.sky_portal = cg.sky_portal;
|
||||
VectorCopy(cg.sky_axis[0], cg.refdef.sky_axis[0]);
|
||||
VectorCopy(cg.sky_axis[1], cg.refdef.sky_axis[1]);
|
||||
VectorCopy(cg.sky_axis[2], cg.refdef.sky_axis[2]);
|
||||
VectorMA(cg.sky_origin, cg.skyboxSpeed, cg.refdef.vieworg, cg.refdef.sky_origin);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CG_CalcViewValues
|
||||
@@ -520,17 +558,7 @@ static int CG_CalcViewValues(void)
|
||||
|
||||
// calculate size of 3D view
|
||||
CG_CalcVrect();
|
||||
|
||||
// setup fog and far clipping plane
|
||||
cg.refdef.farplane_distance = cg.farplane_distance;
|
||||
VectorCopy(cg.farplane_color, cg.refdef.farplane_color);
|
||||
cg.refdef.farplane_cull = cg.farplane_cull;
|
||||
|
||||
// setup portal sky
|
||||
cg.refdef.sky_alpha = cg.sky_alpha;
|
||||
cg.refdef.sky_portal = cg.sky_portal;
|
||||
memcpy(cg.refdef.sky_axis, cg.sky_axis, sizeof(cg.sky_axis));
|
||||
VectorCopy(cg.sky_origin, cg.refdef.sky_origin);
|
||||
CG_SetupFog();
|
||||
|
||||
ps = &cg.predicted_player_state;
|
||||
|
||||
@@ -604,7 +632,9 @@ static int CG_CalcViewValues(void)
|
||||
// Set the aural axis of the player
|
||||
VectorCopy(cg.refdefViewAngles, SoundAngles);
|
||||
// yaw is purposely inverted because of the miles sound system
|
||||
SoundAngles[YAW] = -SoundAngles[YAW];
|
||||
// Commented out in OPM
|
||||
// Useless as SDL audio/AL is used
|
||||
//SoundAngles[YAW] = -SoundAngles[YAW];
|
||||
AnglesToAxis(SoundAngles, cg.SoundAxis);
|
||||
|
||||
// decide on third person view
|
||||
@@ -623,6 +653,11 @@ static int CG_CalcViewValues(void)
|
||||
// Set the aural axis to the camera's angles
|
||||
VectorCopy(cg.camera_angles, cg.refdefViewAngles);
|
||||
|
||||
if (cg_protocol >= PROTOCOL_MOHTA_MIN && (ps->pm_flags & PMF_DAMAGE_ANGLES)) {
|
||||
// Handle camera shake
|
||||
VectorSubtract(cg.refdefViewAngles, cg.predicted_player_state.damage_angles, cg.refdefViewAngles);
|
||||
}
|
||||
|
||||
if (ps->camera_posofs[0] || ps->camera_posofs[1] || ps->camera_posofs[2]) {
|
||||
vec3_t vAxis[3], vOrg;
|
||||
AnglesToAxis(cg.refdefViewAngles, vAxis);
|
||||
@@ -633,6 +668,9 @@ static int CG_CalcViewValues(void)
|
||||
// copy view values
|
||||
VectorCopy(cg.refdef.vieworg, cg.currentViewPos);
|
||||
VectorCopy(cg.refdefViewAngles, cg.currentViewAngles);
|
||||
// since 2.0: also copy location data for sound
|
||||
VectorCopy(cg.refdef.vieworg, cg.SoundOrg);
|
||||
AnglesToAxis(cg.refdefViewAngles, cg.SoundAxis);
|
||||
}
|
||||
|
||||
// position eye reletive to origin
|
||||
@@ -774,10 +812,46 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
|
||||
CG_ScoresDown_f();
|
||||
} else if (cg.bIntermissionDisplay) {
|
||||
if (cg.nextSnap) {
|
||||
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
|
||||
cgi.UI_ShowMenu("StatsScreen_Success", qfalse);
|
||||
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
|
||||
cvar_t* pMission = cgi.Cvar_Get("g_mission", "", CVAR_ARCHIVE);
|
||||
|
||||
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
|
||||
switch (pMission->integer)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
cgi.UI_ShowMenu("mission_success_1", 0);
|
||||
cgi.Cvar_Set("g_t2l1", "1");
|
||||
break;
|
||||
case 2:
|
||||
cgi.UI_ShowMenu("mission_success_2", 0);
|
||||
cgi.Cvar_Set("g_t3l1", "1");
|
||||
break;
|
||||
case 3:
|
||||
cgi.UI_ShowMenu("mission_success_3", 0);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (pMission->integer)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
cgi.UI_ShowMenu("mission_failed_1", 0);
|
||||
break;
|
||||
case 2:
|
||||
cgi.UI_ShowMenu("mission_failed_2", 0);
|
||||
break;
|
||||
case 3:
|
||||
cgi.UI_ShowMenu("mission_failed_3", 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cgi.UI_ShowMenu("StatsScreen_Failed", qfalse);
|
||||
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
|
||||
cgi.UI_ShowMenu("StatsScreen_Success", qfalse);
|
||||
} else {
|
||||
cgi.UI_ShowMenu("StatsScreen_Failed", qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -789,10 +863,44 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
|
||||
if (cgs.gametype != GT_SINGLE_PLAYER) {
|
||||
CG_ScoresUp_f();
|
||||
} else {
|
||||
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
|
||||
cgi.UI_ShowMenu("StatsScreen_Success", qfalse);
|
||||
if (cg_protocol >= PROTOCOL_MOHTA_MIN) {
|
||||
cvar_t* pMission = cgi.Cvar_Get("g_mission", "", CVAR_ARCHIVE);
|
||||
|
||||
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
|
||||
switch (pMission->integer)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
cgi.UI_HideMenu("mission_success_1", CVAR_ARCHIVE);
|
||||
break;
|
||||
case 2:
|
||||
cgi.UI_HideMenu("mission_success_2", CVAR_ARCHIVE);
|
||||
break;
|
||||
case 3:
|
||||
cgi.UI_HideMenu("mission_success_3", CVAR_ARCHIVE);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch (pMission->integer)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
cgi.UI_HideMenu("mission_failed_1", CVAR_ARCHIVE);
|
||||
break;
|
||||
case 2:
|
||||
cgi.UI_HideMenu("mission_failed_2", CVAR_ARCHIVE);
|
||||
break;
|
||||
case 3:
|
||||
cgi.UI_HideMenu("mission_failed_3", CVAR_ARCHIVE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cgi.UI_ShowMenu("StatsScreen_Failed", qfalse);
|
||||
if (cgi.Cvar_Get("g_success", "", 0)->integer) {
|
||||
cgi.UI_HideMenu("StatsScreen_Success", qfalse);
|
||||
} else {
|
||||
cgi.UI_HideMenu("StatsScreen_Failed", qfalse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -806,6 +914,7 @@ void CG_DrawActiveFrame(int serverTime, int frameTime, stereoFrame_t stereoView,
|
||||
}
|
||||
|
||||
// finish up the rest of the refdef
|
||||
CG_SetupPortalSky();
|
||||
|
||||
cg.refdef.time = cg.time;
|
||||
memcpy(cg.refdef.areamask, cg.snap->areamask, sizeof(cg.refdef.areamask));
|
||||
|
||||
@@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
static const char *AnimPrefixList[] = {
|
||||
"",
|
||||
"unarmed",
|
||||
"papers",
|
||||
"colt45",
|
||||
"p38",
|
||||
@@ -45,7 +46,6 @@ static const char *AnimPrefixList[] = {
|
||||
"bazooka",
|
||||
"panzerschreck",
|
||||
"shotgun",
|
||||
"unarmed",
|
||||
//
|
||||
// Team Assault and Team Tactics weapons
|
||||
"mg42portable",
|
||||
@@ -82,6 +82,7 @@ static const char *AnimPrefixList[] = {
|
||||
|
||||
enum animPrefix_e {
|
||||
WPREFIX_NONE,
|
||||
WPREFIX_UNARMED,
|
||||
WPREFIX_PAPERS,
|
||||
WPREFIX_COLT45,
|
||||
WPREFIX_P38,
|
||||
@@ -99,7 +100,6 @@ enum animPrefix_e {
|
||||
WPREFIX_BAZOOKA,
|
||||
WPREFIX_PANZERSCHRECK,
|
||||
WPREFIX_SHOTGUN,
|
||||
WPREFIX_UNARMED,
|
||||
//
|
||||
// Team Assault and Team Tactics weapons
|
||||
WPREFIX_MG42_PORTABLE,
|
||||
@@ -308,6 +308,9 @@ int CG_GetVMAnimPrefixIndex()
|
||||
if (!Q_stricmp(szWeaponName, "Panzerschreck")) {
|
||||
return WPREFIX_PANZERSCHRECK;
|
||||
}
|
||||
if (!Q_stricmp(szWeaponName, "Gewehrgranate")) {
|
||||
return WPREFIX_KAR98_MORTAR;
|
||||
}
|
||||
if (!Q_stricmp(szWeaponName, "Shotgun")) {
|
||||
return WPREFIX_SHOTGUN;
|
||||
}
|
||||
@@ -335,9 +338,11 @@ void CG_ViewModelAnimation(refEntity_t *pModel)
|
||||
char szAnimName[MAX_QPATH];
|
||||
dtiki_t *pTiki;
|
||||
qboolean bAnimChanged;
|
||||
qboolean bWeaponChanged;
|
||||
|
||||
fCrossblendFrac = 0.0;
|
||||
bAnimChanged = 0;
|
||||
bAnimChanged = qfalse;
|
||||
bWeaponChanged = qfalse; // Added in OPM
|
||||
pTiki = pModel->tiki;
|
||||
|
||||
if (cgi.anim->g_iLastEquippedWeaponStat == cg.snap->ps.stats[STAT_EQUIPPED_WEAPON]
|
||||
@@ -348,7 +353,9 @@ void CG_ViewModelAnimation(refEntity_t *pModel)
|
||||
cgi.anim->g_iLastEquippedWeaponStat = cg.snap->ps.stats[STAT_EQUIPPED_WEAPON];
|
||||
strcpy(cgi.anim->g_szLastActiveItem, CG_ConfigString(CS_WEAPONS + cg.snap->ps.activeItems[1]));
|
||||
cgi.anim->g_iLastAnimPrefixIndex = iAnimPrefixIndex;
|
||||
bAnimChanged = qtrue;
|
||||
|
||||
bAnimChanged = qtrue;
|
||||
bWeaponChanged = qtrue;
|
||||
}
|
||||
|
||||
if (cgi.anim->g_iLastVMAnim == -1) {
|
||||
@@ -422,20 +429,27 @@ void CG_ViewModelAnimation(refEntity_t *pModel)
|
||||
}
|
||||
|
||||
sprintf(szAnimName, "%s_%s", AnimPrefixList[iAnimPrefixIndex], pszAnimSuffix);
|
||||
fCrossblendTime = cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
|
||||
fCrossblendAmount = cgi.anim->g_iCurrentVMDuration / 1000.0;
|
||||
if (!bWeaponChanged) {
|
||||
fCrossblendTime =
|
||||
cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
|
||||
fCrossblendAmount = cgi.anim->g_iCurrentVMDuration / 1000.0;
|
||||
|
||||
if (fCrossblendAmount < fCrossblendTime && fCrossblendAmount > 0.0) {
|
||||
fCrossblendFrac = fCrossblendAmount / fCrossblendTime;
|
||||
for (i = 0; i < MAX_FRAMEINFOS; ++i) {
|
||||
if (cgi.anim->g_VMFrameInfo[i].weight) {
|
||||
if (i == cgi.anim->g_iCurrentVMAnimSlot) {
|
||||
cgi.anim->g_VMFrameInfo[i].weight = fCrossblendFrac;
|
||||
} else {
|
||||
cgi.anim->g_VMFrameInfo[i].weight *= (1.0 - fCrossblendFrac);
|
||||
if (fCrossblendAmount < fCrossblendTime && fCrossblendAmount > 0.0) {
|
||||
fCrossblendFrac = fCrossblendAmount / fCrossblendTime;
|
||||
for (i = 0; i < MAX_FRAMEINFOS; ++i) {
|
||||
if (cgi.anim->g_VMFrameInfo[i].weight) {
|
||||
if (i == cgi.anim->g_iCurrentVMAnimSlot) {
|
||||
cgi.anim->g_VMFrameInfo[i].weight = fCrossblendFrac;
|
||||
} else {
|
||||
cgi.anim->g_VMFrameInfo[i].weight *= (1.0 - fCrossblendFrac);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fCrossblendTime = 0;
|
||||
fCrossblendAmount = 0;
|
||||
fCrossblendFrac = 0;
|
||||
}
|
||||
|
||||
cgi.anim->g_iCurrentVMAnimSlot = (cgi.anim->g_iCurrentVMAnimSlot + 1) % MAX_FRAMEINFOS;
|
||||
@@ -450,17 +464,31 @@ void CG_ViewModelAnimation(refEntity_t *pModel)
|
||||
cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].weight = 1.0;
|
||||
cgi.anim->g_iCurrentVMDuration = 0;
|
||||
|
||||
fCrossblendTime = cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
|
||||
if (!fCrossblendTime) {
|
||||
if (!bWeaponChanged) {
|
||||
fCrossblendTime =
|
||||
cgi.Anim_CrossblendTime(pTiki, cgi.anim->g_VMFrameInfo[cgi.anim->g_iCurrentVMAnimSlot].index);
|
||||
if (!fCrossblendTime) {
|
||||
for (i = 0; i < MAX_FRAMEINFOS; ++i) {
|
||||
if (i != cgi.anim->g_iCurrentVMAnimSlot) {
|
||||
cgi.anim->g_VMFrameInfo[i].weight = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
cgi.anim->g_bCrossblending = qfalse;
|
||||
} else {
|
||||
cgi.anim->g_bCrossblending = qtrue;
|
||||
}
|
||||
} else {
|
||||
// Added in OPM
|
||||
// If there is a new weapon, don't do any crossblend
|
||||
cgi.anim->g_bCrossblending = qfalse;
|
||||
|
||||
// clear crossblend values
|
||||
for (i = 0; i < MAX_FRAMEINFOS; ++i) {
|
||||
if (i != cgi.anim->g_iCurrentVMAnimSlot) {
|
||||
cgi.anim->g_VMFrameInfo[i].weight = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
cgi.anim->g_bCrossblending = qfalse;
|
||||
} else {
|
||||
cgi.anim->g_bCrossblending = qtrue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+289
-280
@@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "cg_local.h"
|
||||
#include "cg_commands.h"
|
||||
#include "memarchiver.h"
|
||||
|
||||
const char *cg_vsstypes[] = {
|
||||
"default",
|
||||
@@ -41,7 +42,9 @@ const char *cg_vsstypes[] = {
|
||||
"debris"
|
||||
};
|
||||
|
||||
cvssource_t *vss_sorttable[16384];
|
||||
#define MAX_VSS_SORTS 16384
|
||||
|
||||
cvssource_t *vss_sorttable[MAX_VSS_SORTS];
|
||||
|
||||
static int lastVSSFrameTime;
|
||||
static constexpr float MAX_VSS_COORDS = 8096.0;
|
||||
@@ -77,56 +80,57 @@ void VSS_AddRepulsion(cvssource_t *pA, cvssource_t *pB)
|
||||
|
||||
VectorSubtract(pA->newOrigin, pB->newOrigin, vPush);
|
||||
|
||||
if (vPush[0] || vPush[1] || vPush[2]) {
|
||||
fDist = VectorNormalize(vPush);
|
||||
f = fDist - pB->newRadius;
|
||||
|
||||
if (f > 0.0) {
|
||||
f *= pA->ooRadius;
|
||||
if (f > 1.49) {
|
||||
f = 0.0;
|
||||
} else {
|
||||
f = f * (f * 0.0161 + -0.3104) + 1.2887;
|
||||
}
|
||||
|
||||
if (f < 0.0) {
|
||||
f = f * 1.1;
|
||||
}
|
||||
|
||||
fForce = f;
|
||||
} else {
|
||||
fForce = 1.0;
|
||||
}
|
||||
|
||||
f = fDist - pA->newRadius;
|
||||
if (f > 0.0) {
|
||||
f *= pB->ooRadius;
|
||||
if (f > 1.49) {
|
||||
f = 0.0;
|
||||
} else {
|
||||
f = f * (f * 0.0161 + -0.3104) + 1.2887;
|
||||
}
|
||||
|
||||
if (f < 0.0) {
|
||||
f = f * 1.1;
|
||||
}
|
||||
|
||||
fForce += f;
|
||||
} else {
|
||||
fForce += 1.0;
|
||||
}
|
||||
|
||||
if (fForce <= -0.05 && fForce >= 0.05) {
|
||||
fForce = (pA->newRadius + pB->newRadius) * 0.03 * fForce;
|
||||
VectorScale(vPush, fForce, vPush);
|
||||
|
||||
VectorAdd(pA->repulsion, vPush, pA->repulsion);
|
||||
VectorSubtract(pB->repulsion, vPush, pB->repulsion);
|
||||
}
|
||||
} else {
|
||||
if (!vPush[0] && !vPush[1] && !vPush[2]) {
|
||||
VectorSet(vPush, crandom(), crandom(), crandom());
|
||||
VectorAdd(pA->repulsion, vPush, pA->repulsion);
|
||||
VectorSubtract(pB->repulsion, vPush, pB->repulsion);
|
||||
return;
|
||||
}
|
||||
|
||||
fDist = VectorNormalize(vPush);
|
||||
f = fDist - pB->newRadius;
|
||||
|
||||
if (f > 0.0f) {
|
||||
f *= pA->ooRadius;
|
||||
if (f > 1.49f) {
|
||||
f = 0.0f;
|
||||
} else {
|
||||
f = f * (f * 0.0161f + -0.3104f) + 1.2887f;
|
||||
}
|
||||
|
||||
if (f < 0.0) {
|
||||
f *= 1.1f;
|
||||
}
|
||||
|
||||
fForce = f;
|
||||
} else {
|
||||
fForce = 1.0;
|
||||
}
|
||||
|
||||
f = fDist - pA->newRadius;
|
||||
if (f > 0.0) {
|
||||
f *= pB->ooRadius;
|
||||
if (f > 1.49f) {
|
||||
f = 0.0f;
|
||||
} else {
|
||||
f = f * (f * 0.0161f + -0.3104f) + 1.2887f;
|
||||
}
|
||||
|
||||
if (f < 0.0) {
|
||||
f *= 1.1f;
|
||||
}
|
||||
|
||||
fForce += f;
|
||||
} else {
|
||||
fForce += 1.0f;
|
||||
}
|
||||
|
||||
if (fForce <= -0.05f || fForce >= 0.05f) {
|
||||
fForce = (pA->newRadius + pB->newRadius) * 0.03f * fForce;
|
||||
VectorScale(vPush, fForce, vPush);
|
||||
|
||||
VectorAdd(pA->repulsion, vPush, pA->repulsion);
|
||||
VectorSubtract(pB->repulsion, vPush, pB->repulsion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,6 +218,11 @@ void CG_ResetVSSSources()
|
||||
lastVSSFrameTime = cg.time;
|
||||
}
|
||||
|
||||
void CG_ArchiveVSSGlobals(MemArchiver& archiver)
|
||||
{
|
||||
archiver.ArchiveTime(&lastVSSFrameTime);
|
||||
}
|
||||
|
||||
void ClientGameCommandManager::InitializeVSSSources()
|
||||
{
|
||||
int i;
|
||||
@@ -328,6 +337,8 @@ qboolean VSS_SourcePhysics(cvssource_t *pSource, float ftime)
|
||||
float fDot;
|
||||
vec3_t vNorm;
|
||||
|
||||
VectorCopy(trace.plane.normal, vNorm);
|
||||
|
||||
VectorAdd(trace.endpos, trace.plane.normal, pSource->newOrigin);
|
||||
fDot = DotProduct(vNorm, pSource->velocity);
|
||||
VectorMA(pSource->velocity, fDot, vNorm, pSource->velocity);
|
||||
@@ -884,251 +895,249 @@ void VSS_CalcRepulsionForces(cvssource_t *pActiveSources)
|
||||
{
|
||||
cvssource_t *pCurrent;
|
||||
cvssource_t *pComp;
|
||||
qboolean bXUp, bXDown;
|
||||
qboolean bYUp, bYDown;
|
||||
qboolean bZDown;
|
||||
int i;
|
||||
int iIndex;
|
||||
int iX, iY, iZ;
|
||||
int iMinX, iMinY, iMinZ;
|
||||
int iMaxX, iMaxY, iMaxZ;
|
||||
float fOfs;
|
||||
cvssource_t *pSTLatch;
|
||||
|
||||
pCurrent = pActiveSources->prev;
|
||||
if (pCurrent != pActiveSources) {
|
||||
qboolean bXUp, bXDown;
|
||||
qboolean bYUp, bYDown;
|
||||
qboolean bZDown;
|
||||
int i;
|
||||
int iIndex;
|
||||
int iX, iY, iZ;
|
||||
int iMinX, iMinY, iMinZ;
|
||||
int iMaxX, iMaxY, iMaxZ;
|
||||
float fOfs;
|
||||
cvssource_t *pSTLatch;
|
||||
if (pCurrent == pActiveSources) {
|
||||
return;
|
||||
}
|
||||
|
||||
memset(vss_sorttable, 0, sizeof(vss_sorttable));
|
||||
memset(vss_sorttable, 0, sizeof(vss_sorttable));
|
||||
|
||||
while (pCurrent != pActiveSources) {
|
||||
VectorClear(pCurrent->repulsion);
|
||||
for (pCurrent = pActiveSources->prev; pCurrent != pActiveSources; pCurrent = pCurrent->prev) {
|
||||
VectorClear(pCurrent->repulsion);
|
||||
|
||||
iIndex = ((int)floor(pCurrent->newOrigin[0] + 8192.0 + 0.5) / 96) % 32;
|
||||
iIndex |= ((int)floor(pCurrent->newOrigin[1] + 8192.0 + 0.5) / 96) % 32;
|
||||
iIndex |= (((int)floor(pCurrent->newOrigin[2] + 8192.0 + 0.5) / 96) % 16) << 10;
|
||||
iIndex = ((int)floor(pCurrent->newOrigin[0] + 8192.0 + 0.5) / 96) % 32;
|
||||
iIndex |= (((int)floor(pCurrent->newOrigin[1] + 8192.0 + 0.5) / 96) % 32) << 5;
|
||||
iIndex |= (((int)floor(pCurrent->newOrigin[2] + 8192.0 + 0.5) / 96) % 16) << 10;
|
||||
|
||||
pCurrent->stnext = vss_sorttable[iIndex];
|
||||
vss_sorttable[iIndex] = pCurrent;
|
||||
pCurrent->stindex = iIndex;
|
||||
pCurrent = pCurrent->prev;
|
||||
pCurrent->stnext = vss_sorttable[iIndex];
|
||||
vss_sorttable[iIndex] = pCurrent;
|
||||
pCurrent->stindex = iIndex;
|
||||
}
|
||||
|
||||
for (pCurrent = pActiveSources->prev; pCurrent != pActiveSources; pCurrent = pCurrent->prev) {
|
||||
if (vss_sorttable[pCurrent->stindex] == pCurrent) {
|
||||
pSTLatch = (cvssource_t *)-1;
|
||||
pComp = pCurrent->stnext;
|
||||
} else {
|
||||
pSTLatch = 0;
|
||||
pComp = vss_sorttable[pCurrent->stindex];
|
||||
}
|
||||
|
||||
for (pCurrent = pActiveSources->prev; pCurrent != pActiveSources; pCurrent = pCurrent->prev) {
|
||||
if (vss_sorttable[pCurrent->stindex] == pCurrent) {
|
||||
pSTLatch = (cvssource_t *)-1;
|
||||
pComp = pCurrent->stnext;
|
||||
} else {
|
||||
pSTLatch = 0;
|
||||
pComp = vss_sorttable[pCurrent->stindex];
|
||||
for(; pComp; pComp = pComp->stnext) {
|
||||
VSS_AddRepulsion(pCurrent, pComp);
|
||||
if (!pSTLatch && pComp->stnext == pCurrent) {
|
||||
pSTLatch = pComp;
|
||||
// skip current
|
||||
pComp = pComp->stnext;
|
||||
}
|
||||
}
|
||||
|
||||
iX = ((int)floor(pCurrent->newOrigin[0] + 8192.0 + 0.5) / 96) % 32;
|
||||
iY = (((int)floor(pCurrent->newOrigin[1] + 8192.0 + 0.5) / 96) % 32) << 5;
|
||||
iZ = (((int)floor(pCurrent->newOrigin[2] + 8192.0 + 0.5) / 96) % 16) << 10;
|
||||
|
||||
fOfs = pCurrent->newRadius + 1.49 + 48.0;
|
||||
iMaxX = ((int)floor(pCurrent->newOrigin[0] + fOfs + 8192.0 + 0.5) / 96) % 32;
|
||||
iMaxY = (((int)floor(pCurrent->newOrigin[1] + fOfs + 8192.0 + 0.5) / 96) % 32) << 5;
|
||||
iMaxZ = (((int)floor(pCurrent->newOrigin[2] + fOfs + 8192.0 + 0.5) / 96) % 16) << 10;
|
||||
|
||||
iMinX = ((int)floor(pCurrent->newOrigin[0] - fOfs + 8192.0 + 0.5) / 96) % 32;
|
||||
iMinY = (((int)floor(pCurrent->newOrigin[1] - fOfs + 8192.0 + 0.5) / 96) % 32) << 5;
|
||||
iMinZ = (((int)floor(pCurrent->newOrigin[2] - fOfs + 8192.0 + 0.5) / 96) % 16) << 10;
|
||||
|
||||
bXUp = (iMaxX | (pCurrent->stindex & 0xFFFFFFE0)) != pCurrent->stindex;
|
||||
bXDown = (iMinX | (pCurrent->stindex & 0xFFFFFFE0)) != pCurrent->stindex;
|
||||
bYUp = (iMaxY | (pCurrent->stindex & 0xFFFFFC1F)) != pCurrent->stindex;
|
||||
bYDown = (iMinY | (pCurrent->stindex & 0xFFFFFC1F)) != pCurrent->stindex;
|
||||
|
||||
iIndex = iMinZ | (pCurrent->stindex & 0xFFFFC3FF);
|
||||
bZDown = iIndex != pCurrent->stindex;
|
||||
|
||||
if (iIndex == pCurrent->stindex) {
|
||||
iIndex = iMaxY | (pCurrent->stindex & 0xFFFFFC1F);
|
||||
|
||||
i = 9;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
for (; i < (bZDown ? 26 : 17); i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
iIndex = iMaxZ | (pCurrent->stindex & 0xFFFFC3FF);
|
||||
break;
|
||||
case 1:
|
||||
iIndex = iMaxX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 2:
|
||||
iIndex = iMaxY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 3:
|
||||
iIndex = iMinY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 4:
|
||||
iIndex = iMinY | (iIndex & 0xFFFFFFE0);
|
||||
if (bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 5:
|
||||
iIndex = iMinX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXDown && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 6:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 7:
|
||||
iIndex = iMaxY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 8:
|
||||
iIndex = iX | (iIndex & 0xFFFFFFE0);
|
||||
if (bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 9:
|
||||
iIndex = iZ | (iIndex & 0xFFFFFFC3);
|
||||
if (bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 10:
|
||||
iIndex = iMaxX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXUp && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 11:
|
||||
iIndex = iMinX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXDown && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 12:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 13:
|
||||
iIndex = iMinY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 14:
|
||||
iIndex = iX | (iIndex & 0xFFFFFFE0);
|
||||
if (bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 15:
|
||||
iIndex = iMaxX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXUp && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 16:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 17:
|
||||
iIndex = iMinZ | (iIndex & 0xFFFFFCC3);
|
||||
if (bXUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 18:
|
||||
iIndex = iMaxY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 19:
|
||||
iIndex = iMinY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 20:
|
||||
iIndex = iX | (iIndex & 0xFFFFFFE0);
|
||||
if (bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 21:
|
||||
iIndex = iMinX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXDown && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 22:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 23:
|
||||
iIndex = iMaxY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 24:
|
||||
iIndex = iX | (iIndex & 0xFFFFFFE0);
|
||||
if (bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 25:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
break;
|
||||
default:
|
||||
assert(0); // This can't happen
|
||||
break;
|
||||
}
|
||||
|
||||
while (pComp) {
|
||||
for (pComp = vss_sorttable[iIndex]; pComp; pComp = pComp->stnext) {
|
||||
VSS_AddRepulsion(pCurrent, pComp);
|
||||
if (!pSTLatch && pComp->stnext == pCurrent) {
|
||||
pSTLatch = pComp;
|
||||
pComp = pComp->stnext;
|
||||
}
|
||||
|
||||
pComp = pComp->stnext;
|
||||
}
|
||||
iX = ((int)floor(pCurrent->newOrigin[0] + 8192.0 + 0.5) / 96) % 32;
|
||||
iY = ((int)floor(pCurrent->newOrigin[1] + 8192.0 + 0.5) / 96) % 32;
|
||||
iY *= 2;
|
||||
iZ = ((int)floor(pCurrent->newOrigin[2] + 8192.0 + 0.5) / 96) % 16;
|
||||
iZ <<= 10;
|
||||
}
|
||||
|
||||
fOfs = pCurrent->newRadius + 1.49 + 48.0;
|
||||
iMaxX = ((int)floor(pCurrent->newOrigin[0] + 8192.0 + 0.5 + fOfs) / 96) % 32;
|
||||
iMaxY = ((int)floor(pCurrent->newOrigin[1] + 8192.0 + 0.5 + fOfs) / 96) % 32;
|
||||
iMaxY *= 2;
|
||||
iMaxZ = ((int)floor(pCurrent->newOrigin[2] + 8192.0 + 0.5 + fOfs) / 96) % 16;
|
||||
iMaxZ <<= 10;
|
||||
|
||||
iMinX = ((int)floor(pCurrent->newOrigin[0] + 8192.0 + 0.5 - fOfs) / 96) % 32;
|
||||
iMinY = ((int)floor(pCurrent->newOrigin[1] + 8192.0 + 0.5 - fOfs) / 96) % 32;
|
||||
iMinY *= 2;
|
||||
iMinZ = ((int)floor(pCurrent->newOrigin[2] + 8192.0 + 0.5 - fOfs) / 96) % 16;
|
||||
iMinZ <<= 10;
|
||||
|
||||
bXUp = (iMaxX | (pCurrent->stindex & 0xFFFFFFE0)) != pCurrent->stindex;
|
||||
bXDown = (iMinX | (pCurrent->stindex & 0xFFFFFFE0)) != pCurrent->stindex;
|
||||
bYUp = (iMaxY | (pCurrent->stindex & 0xFFFFFC1F)) != pCurrent->stindex;
|
||||
bYDown = (iMinY | (pCurrent->stindex & 0xFFFFFC1F)) != pCurrent->stindex;
|
||||
|
||||
iIndex = iMinZ | (pCurrent->stindex & 0xFFFFFCC3);
|
||||
bZDown = iIndex != pCurrent->stindex;
|
||||
|
||||
if (iIndex == pCurrent->stindex) {
|
||||
iIndex = iMaxY | pCurrent->stindex & 0xFFFFFC1F;
|
||||
i = 9;
|
||||
} else {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
for(; i < (bZDown ? 26 : 17); i++) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
iIndex = iMaxZ | (pCurrent->stindex & 0xFFFFFCC3);
|
||||
break;
|
||||
case 1:
|
||||
iIndex = iMaxX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 2:
|
||||
iIndex = iMaxY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 3:
|
||||
iIndex = iMinY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 4:
|
||||
iIndex = iMinY | (iIndex & 0xFFFFFFE0);
|
||||
if (bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 5:
|
||||
iIndex = iMinX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXDown && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 6:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 7:
|
||||
iIndex = iMaxY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 8:
|
||||
iIndex = iX | (iIndex & 0xFFFFFFE0);
|
||||
if (bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 9:
|
||||
iIndex = iZ | (iIndex & 0xFFFFFFC3);
|
||||
if (bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 10:
|
||||
iIndex = iMaxX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXUp && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 11:
|
||||
iIndex = iMinX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXDown && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 12:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 13:
|
||||
iIndex = iMinY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 14:
|
||||
iIndex = iX | (iIndex & 0xFFFFFFE0);
|
||||
if (bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 15:
|
||||
iIndex = iMaxX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXUp && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 16:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 17:
|
||||
iIndex = iMinZ | (iIndex & 0xFFFFFCC3);
|
||||
if (bXUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 18:
|
||||
iIndex = iMaxY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 19:
|
||||
iIndex = iMinY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXUp && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 20:
|
||||
iIndex = iX | (iIndex & 0xFFFFFFE0);
|
||||
if (bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 21:
|
||||
iIndex = iMinX | (iIndex & 0xFFFFFFE0);
|
||||
if (bXDown && bYDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 22:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 23:
|
||||
iIndex = iMaxY | (iIndex & 0xFFFFFC1F);
|
||||
if (bXDown && bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 24:
|
||||
iIndex = iX | (iIndex & 0xFFFFFFE0);
|
||||
if (bYUp) {
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
case 25:
|
||||
iIndex = iY | (iIndex & 0xFFFFFC1F);
|
||||
break;
|
||||
}
|
||||
|
||||
for (pComp = vss_sorttable[iIndex]; pComp; pComp = pComp->stnext) {
|
||||
VSS_AddRepulsion(pCurrent, pComp);
|
||||
}
|
||||
}
|
||||
|
||||
if (pSTLatch == (cvssource_t *)-1) {
|
||||
vss_sorttable[pCurrent->stindex] = pCurrent->stnext;
|
||||
} else {
|
||||
pSTLatch->stnext = pCurrent->stnext;
|
||||
}
|
||||
if (pSTLatch == (cvssource_t *)-1) {
|
||||
vss_sorttable[pCurrent->stindex] = pCurrent->stnext;
|
||||
} else {
|
||||
pSTLatch->stnext = pCurrent->stnext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "cg_local.h"
|
||||
#include "memarchiver.h"
|
||||
#include "../qcommon/vector.h"
|
||||
#include "../qcommon/str.h"
|
||||
|
||||
MemArchiver::MemArchiver()
|
||||
{
|
||||
state = MEMARC_WRITING;
|
||||
buffer = 0;
|
||||
allocatedSize = 0;
|
||||
bufferSize = 0;
|
||||
}
|
||||
|
||||
MemArchiver::~MemArchiver()
|
||||
{
|
||||
if (state == MEMARC_WRITING && buffer) {
|
||||
cgi.Free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
void MemArchiver::SetupForWriting(size_t initialSize)
|
||||
{
|
||||
this->state = MEMARC_WRITING;
|
||||
this->buffer = (byte*)cgi.Malloc(initialSize);
|
||||
this->allocatedSize = initialSize;
|
||||
this->bufferSize = 0;
|
||||
}
|
||||
|
||||
void MemArchiver::SetupForReading(byte* buffer, size_t size)
|
||||
{
|
||||
this->state = MEMARC_READING;
|
||||
this->buffer = buffer;
|
||||
this->allocatedSize = size;
|
||||
this->bufferSize = 0;
|
||||
}
|
||||
|
||||
void MemArchiver::SetBaseTime(unsigned int time)
|
||||
{
|
||||
this->svsTime = time;
|
||||
}
|
||||
|
||||
size_t MemArchiver::BufferSize() const
|
||||
{
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
byte* MemArchiver::ConfiscateBuffer()
|
||||
{
|
||||
byte* confiscatedBuffer = buffer;
|
||||
|
||||
buffer = NULL;
|
||||
allocatedSize = 0;
|
||||
bufferSize = 0;
|
||||
|
||||
return confiscatedBuffer;
|
||||
}
|
||||
|
||||
bool MemArchiver::IsReading() const
|
||||
{
|
||||
return !IsWriting();
|
||||
}
|
||||
|
||||
bool MemArchiver::IsWriting() const
|
||||
{
|
||||
return state == MEMARC_WRITING;
|
||||
}
|
||||
|
||||
bool MemArchiver::FinishedReading() const
|
||||
{
|
||||
return bufferSize == allocatedSize;
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveByte(byte* value)
|
||||
{
|
||||
ArchiveRaw(value, sizeof(byte));
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveBoolean(qboolean* value)
|
||||
{
|
||||
ArchiveRaw(value, sizeof(qboolean));
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveChar(char* value)
|
||||
{
|
||||
ArchiveRaw(value, sizeof(char));
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveUChar(unsigned char* value)
|
||||
{
|
||||
ArchiveRaw(value, sizeof(unsigned char));
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveShort(short* value)
|
||||
{
|
||||
ArchiveRaw(value, sizeof(short));
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveInteger(int* value)
|
||||
{
|
||||
ArchiveRaw(value, sizeof(int));
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveSize(size_t* value)
|
||||
{
|
||||
ArchiveRaw(value, sizeof(size_t));
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveFloat(float* value)
|
||||
{
|
||||
ArchiveRaw(value, sizeof(float));
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveVec3(vec3_t value)
|
||||
{
|
||||
ArchiveRaw(value, sizeof(vec3_t));
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveVector(Vector* value)
|
||||
{
|
||||
ArchiveFloat(&value->x);
|
||||
ArchiveFloat(&value->y);
|
||||
ArchiveFloat(&value->z);
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveString(str* value)
|
||||
{
|
||||
char tmp[4096];
|
||||
int current = 0;
|
||||
|
||||
if (IsReading()) {
|
||||
for (current = 0; current < 4096; current++) {
|
||||
ArchiveReadRaw(&tmp[current], sizeof(char));
|
||||
if (!tmp[current]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (current == 4096) {
|
||||
tmp[current - 1] = 0;
|
||||
}
|
||||
|
||||
*value = tmp;
|
||||
} else {
|
||||
ArchiveWriteRaw(value->c_str(), value->length() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveTime(int* value)
|
||||
{
|
||||
int time;
|
||||
|
||||
if (IsReading()) {
|
||||
ArchiveReadRaw(&time, sizeof(time));
|
||||
|
||||
if (time) {
|
||||
time += svsTime;
|
||||
}
|
||||
|
||||
*value = time;
|
||||
} else {
|
||||
time = *value;
|
||||
if (time) {
|
||||
time -= svsTime;
|
||||
}
|
||||
|
||||
ArchiveWriteRaw(&time, sizeof(time));
|
||||
}
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveRaw(void* buffer, size_t size)
|
||||
{
|
||||
if (IsReading()) {
|
||||
ArchiveReadRaw(buffer, size);
|
||||
} else {
|
||||
ArchiveWriteRaw(buffer, size);
|
||||
}
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveReadRaw(void* buffer, size_t size)
|
||||
{
|
||||
if (!size) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (size + this->bufferSize > this->allocatedSize) {
|
||||
Com_Error(ERR_DROP, "MemArchiver: tried to read past end of buffer");
|
||||
}
|
||||
|
||||
memcpy(buffer, this->buffer + this->bufferSize, size);
|
||||
this->bufferSize += size;
|
||||
}
|
||||
|
||||
void MemArchiver::ArchiveWriteRaw(const void* buffer, size_t size)
|
||||
{
|
||||
if (!size) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (size + this->bufferSize > this->allocatedSize) {
|
||||
if (!this->allocatedSize) {
|
||||
this->allocatedSize = 1024;
|
||||
this->buffer = (byte*)cgi.Malloc(this->allocatedSize);
|
||||
} else {
|
||||
byte* newBuffer;
|
||||
|
||||
do {
|
||||
this->allocatedSize *= 2;
|
||||
} while (size + this->bufferSize > this->allocatedSize);
|
||||
|
||||
newBuffer = (byte*)cgi.Malloc(this->allocatedSize);
|
||||
memcpy(newBuffer, this->buffer, this->bufferSize);
|
||||
cgi.Free(this->buffer);
|
||||
this->buffer = newBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(this->buffer + this->bufferSize, buffer, size);
|
||||
this->bufferSize += size;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
// DESCRIPTION:
|
||||
// In-memory archiver
|
||||
|
||||
#include "cg_local.h"
|
||||
|
||||
class Vector;
|
||||
class str;
|
||||
|
||||
typedef enum {
|
||||
MEMARC_WRITING,
|
||||
MEMARC_READING
|
||||
} archiverState_e;
|
||||
|
||||
class MemArchiver {
|
||||
public:
|
||||
MemArchiver();
|
||||
~MemArchiver();
|
||||
|
||||
void SetupForWriting(size_t initialSize);
|
||||
void SetupForReading(byte* buffer, size_t size);
|
||||
void SetBaseTime(unsigned int time);
|
||||
size_t BufferSize() const;
|
||||
byte* ConfiscateBuffer();
|
||||
bool IsReading() const;
|
||||
bool IsWriting() const;
|
||||
bool FinishedReading() const;
|
||||
|
||||
void ArchiveByte(byte* value);
|
||||
void ArchiveBoolean(qboolean* value);
|
||||
void ArchiveChar(char* value);
|
||||
void ArchiveUChar(unsigned char* value);
|
||||
void ArchiveShort(short* value);
|
||||
void ArchiveInteger(int* value);
|
||||
void ArchiveSize(size_t* value);
|
||||
void ArchiveFloat(float* value);
|
||||
void ArchiveVec3(vec3_t value);
|
||||
void ArchiveVector(Vector* value);
|
||||
void ArchiveString(str* value);
|
||||
void ArchiveTime(int* value);
|
||||
void ArchiveRaw(void* buffer, size_t size);
|
||||
void ArchiveReadRaw(void* buffer, size_t size);
|
||||
void ArchiveWriteRaw(const void* buffer, size_t size);
|
||||
|
||||
private:
|
||||
archiverState_e state;
|
||||
byte* buffer;
|
||||
size_t bufferSize;
|
||||
size_t allocatedSize;
|
||||
int svsTime;
|
||||
};
|
||||
@@ -1,15 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(omohclient)
|
||||
|
||||
option(NO_OPENAL "Use older sound-system" FALSE)
|
||||
|
||||
add_subdirectory("../cgame" "./cgame")
|
||||
|
||||
file(GLOB_RECURSE SOURCES_CLIENT "./*.c*")
|
||||
file(GLOB SOURCES_CLIENT "./*.c*")
|
||||
file(GLOB_RECURSE SOURCES_UILIB "../uilib/*.c*")
|
||||
|
||||
# Made as an interface and not static, as static only links used methods
|
||||
add_library(omohclient INTERFACE)
|
||||
target_sources(omohclient INTERFACE ${SOURCES_CLIENT} ${SOURCES_UILIB})
|
||||
target_compile_definitions(omohclient INTERFACE APP_MODULE)
|
||||
target_compile_definitions(omohclient INTERFACE USE_OPENAL_DLOPEN=1)
|
||||
target_compile_features(omohclient INTERFACE cxx_nullptr)
|
||||
target_compile_features(omohclient INTERFACE c_variadic_macros)
|
||||
target_link_libraries(omohclient INTERFACE omohsdl)
|
||||
@@ -18,5 +20,50 @@ target_link_libraries(omohclient INTERFACE gcd)
|
||||
# Sound stuff
|
||||
target_compile_definitions(omohclient INTERFACE USE_CODEC_MP3)
|
||||
|
||||
add_subdirectory("../libmad-0.15.1b" "./libmad")
|
||||
target_link_libraries(omohclient INTERFACE libmad)
|
||||
if (NOT NO_OPENAL)
|
||||
# Use OpenAL
|
||||
find_package(OpenAL REQUIRED)
|
||||
|
||||
if (OPENAL_FOUND)
|
||||
target_compile_definitions(omohclient INTERFACE USE_OPENAL=1 NO_MODERN_DMA=0)
|
||||
if (MSVC)
|
||||
target_include_directories(omohclient INTERFACE ${OPENAL_INCLUDE_DIR}/AL)
|
||||
else()
|
||||
target_include_directories(omohclient INTERFACE ${OPENAL_INCLUDE_DIR})
|
||||
endif()
|
||||
target_link_libraries(omohclient INTERFACE ${OPENAL_LIBRARY})
|
||||
endif()
|
||||
|
||||
list(FILTER SOURCES_CLIENT EXCLUDE REGEX "./snd_([a-zA-Z0-9_]+)\.c$")
|
||||
file(GLOB SOURCES_CLIENT_SND "./snd_*_new.c*" "./snd_codec*.c*")
|
||||
list(APPEND SOURCES_CLIENT ${SOURCES_CLIENT_SND})
|
||||
else()
|
||||
#
|
||||
# Fallback to old DMA sound system
|
||||
#
|
||||
message(NOTICE "OpenAL was explicitly disabled - fallback to old SDL sound system")
|
||||
target_compile_definitions(omohclient INTERFACE NO_MODERN_DMA=1)
|
||||
set(NO_MODERN_DMA TRUE)
|
||||
|
||||
list(FILTER SOURCES_CLIENT EXCLUDE REGEX "./snd_([a-zA-Z0-9_]+)\.cpp$")
|
||||
file(GLOB_RECURSE SOURCES_CLIENT_SND "./new/*.c*")
|
||||
list(APPEND SOURCES_CLIENT ${SOURCES_CLIENT_SND})
|
||||
endif()
|
||||
|
||||
set(OLD_VALUE ${BUILD_SHARED_LIBS})
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory("../libmad" "./libmad" EXCLUDE_FROM_ALL)
|
||||
target_link_libraries(omohclient INTERFACE mad)
|
||||
set(BUILD_SHARED_LIBS ${OLD_VALUE} CACHE BOOL "" FORCE)
|
||||
|
||||
if (USE_OPENAL)
|
||||
# Try to use OpenAL
|
||||
find_package(OpenAL)
|
||||
if (OPENAL_FOUND)
|
||||
target_compile_definitions(omohclient INTERFACE USE_OPENAL=1)
|
||||
target_include_directories(omohclient INTERFACE ${OPENAL_INCLUDE_DIR}/AL)
|
||||
target_link_libraries(omohclient INTERFACE ${OPENAL_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_sources(omohclient INTERFACE ${SOURCES_CLIENT} ${SOURCES_UILIB})
|
||||
@@ -334,6 +334,9 @@ writing the actual data can begin
|
||||
*/
|
||||
qboolean CL_OpenAVIForWriting( const char *fileName )
|
||||
{
|
||||
return qfalse;
|
||||
// Removed in OPM
|
||||
#if 0
|
||||
if( afd.fileOpen )
|
||||
return qfalse;
|
||||
|
||||
@@ -425,6 +428,7 @@ qboolean CL_OpenAVIForWriting( const char *fileName )
|
||||
afd.fileOpen = qtrue;
|
||||
|
||||
return qtrue;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+63
-22
@@ -211,20 +211,20 @@ qboolean CL_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
|
||||
}
|
||||
|
||||
snapshot->numEntities = 0;
|
||||
for ( i = 0 ; i < count ; i++ ) {
|
||||
for(i = 0; i < MAX_ENTITIES_IN_SNAPSHOT; i++) {
|
||||
parents[i] = -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
s1 = &cl.parseEntities[(clSnap->parseEntitiesNum + i) & (MAX_PARSE_ENTITIES - 1)];
|
||||
pnum = s1->parent;
|
||||
|
||||
if (pnum == ENTITYNUM_NONE) {
|
||||
parents[s1->number] = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (parents[pnum] == -2) {
|
||||
parents[s1->number] = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// add it later
|
||||
parents[s1->number] = pnum;
|
||||
continue;
|
||||
@@ -234,20 +234,20 @@ qboolean CL_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
|
||||
snapshot->entities[snapshot->numEntities++] = *s1;
|
||||
}
|
||||
|
||||
for(pcount = 0; pcount < 8 && snapshot->numEntities != count; pcount++)
|
||||
{
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
for(pcount = 0; pcount < 8 && snapshot->numEntities != count; pcount++) {
|
||||
for (i = 0; i < count; i++) {
|
||||
s1 = &cl.parseEntities[(clSnap->parseEntitiesNum + i) & (MAX_PARSE_ENTITIES - 1)];
|
||||
pnum = parents[s1->number];
|
||||
if (pnum >= 0 && parents[pnum] == -2) {
|
||||
parents[s1->number] = -2;
|
||||
snapshot->entities[snapshot->numEntities++] = *s1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pcount >= 8)
|
||||
{
|
||||
if (snapshot->numEntities != count) {
|
||||
Com_DPrintf("CL_GetSnapshot: Not all children could find their parents.\n");
|
||||
|
||||
for (i = count; i < snapshot->numEntities; i++)
|
||||
{
|
||||
s1 = &cl.parseEntities[(clSnap->parseEntitiesNum + i) & (MAX_PARSE_ENTITIES - 1)];
|
||||
@@ -261,6 +261,8 @@ qboolean CL_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
|
||||
s1->origin[1],
|
||||
s1->origin[2]
|
||||
);
|
||||
|
||||
parents[s1->number] = -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -358,7 +360,9 @@ qboolean CL_ProcessServerCommand(const char* origString, const char* cmd, qboole
|
||||
// because this function might be called from a module that would be unloaded
|
||||
// inside Com_Error
|
||||
UI_ForceMenuOff(1);
|
||||
Cbuf_AddText("disconnect;pushmenu disconnected");
|
||||
// Fixed in OPM
|
||||
// Added a newline for next commands
|
||||
Cbuf_AddText("disconnect;pushmenu disconnected\n");
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
@@ -395,8 +399,8 @@ Set up argc/argv for the given command
|
||||
===================
|
||||
*/
|
||||
qboolean CL_GetServerCommand( int serverCommandNumber, qboolean differentServer ) {
|
||||
char *s;
|
||||
char *cmd;
|
||||
char *s;
|
||||
char *cmd;
|
||||
static char bigConfigString[BIG_INFO_STRING];
|
||||
|
||||
// if we have irretrievably lost a reliable command, drop the connection
|
||||
@@ -421,9 +425,39 @@ qboolean CL_GetServerCommand( int serverCommandNumber, qboolean differentServer
|
||||
Com_DPrintf( "serverCommand: %i : %s\n", serverCommandNumber, s );
|
||||
}
|
||||
|
||||
Cmd_TokenizeString( s );
|
||||
Cmd_TokenizeString(s);
|
||||
cmd = Cmd_Argv(0);
|
||||
|
||||
// Readded in OPM (from ioquake)
|
||||
// Configstring big buffer
|
||||
if (!strcmp(cmd, "bcs0")) {
|
||||
Com_sprintf(bigConfigString, BIG_INFO_STRING, "cs %s \"%s", Cmd_Argv(1), Cmd_Argv(2));
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "bcs1")) {
|
||||
s = Cmd_Argv(2);
|
||||
if (strlen(bigConfigString) + strlen(s) >= BIG_INFO_STRING) {
|
||||
Com_Error(ERR_DROP, "bcs exceeded BIG_INFO_STRING");
|
||||
}
|
||||
strcat(bigConfigString, s);
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if (!strcmp(cmd, "bcs2")) {
|
||||
s = Cmd_Argv(2);
|
||||
if (strlen(bigConfigString) + strlen(s) + 1 >= BIG_INFO_STRING) {
|
||||
Com_Error(ERR_DROP, "bcs exceeded BIG_INFO_STRING");
|
||||
}
|
||||
strcat(bigConfigString, s);
|
||||
strcat(bigConfigString, "\"");
|
||||
s = bigConfigString;
|
||||
|
||||
// reparse
|
||||
Cmd_TokenizeString(s);
|
||||
cmd = Cmd_Argv(0);
|
||||
}
|
||||
|
||||
return CL_ProcessServerCommand(s, cmd, differentServer);
|
||||
}
|
||||
|
||||
@@ -435,10 +469,10 @@ CL_CM_LoadMap
|
||||
Just adds default parameters that cgame doesn't need to know about
|
||||
====================
|
||||
*/
|
||||
void CL_CM_LoadMap( const char *mapname ) {
|
||||
int checksum;
|
||||
|
||||
CM_LoadMap( mapname, qtrue, &checksum );
|
||||
void CL_CM_LoadMap( const char *mapname, int *checksum ) {
|
||||
CM_LoadMap( mapname, qtrue, checksum );
|
||||
// prepare world vis data
|
||||
re.SetWorldVisData(CM_VisibilityPointer());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -548,7 +582,7 @@ CL_RestoreSavedCgameState
|
||||
*/
|
||||
void CL_RestoreSavedCgameState() {
|
||||
if (cls.savedCgameState) {
|
||||
cge->CG_LoadStateToBuffer(&cls.savedCgameState, cls.savedCgameStateSize, cl.snap.serverTime);
|
||||
cge->CG_LoadStateToBuffer(cls.savedCgameState, cls.savedCgameStateSize, cl.snap.serverTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -580,6 +614,7 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
|
||||
|
||||
cgi->Printf = Com_Printf;
|
||||
cgi->DPrintf = Com_DPrintf;
|
||||
cgi->DebugPrintf = Com_DebugPrintf;
|
||||
|
||||
cgi->Malloc = CL_CG_Malloc;
|
||||
cgi->Free = CL_CG_Free;
|
||||
@@ -605,6 +640,8 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
|
||||
cgi->FS_FreeFile = FS_FreeFile;
|
||||
cgi->FS_WriteFile = FS_WriteFile;
|
||||
cgi->FS_WriteTextFile = FS_WriteTextFile;
|
||||
cgi->FS_ListFilteredFiles = FS_ListFilteredFiles;
|
||||
cgi->FS_FreeFileList = FS_FreeFileList;
|
||||
|
||||
cgi->SendConsoleCommand = Cbuf_AddText;
|
||||
|
||||
@@ -676,9 +713,11 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
|
||||
cgi->R_RegisterModel = re.RegisterModel;
|
||||
cgi->R_SpawnEffectModel = re.SpawnEffectModel;
|
||||
cgi->R_RegisterServerModel = re.RegisterServerModel;
|
||||
cgi->R_GetModelName = re.GetModelName;
|
||||
cgi->R_UnregisterServerModel = re.UnregisterServerModel;
|
||||
cgi->R_RegisterShader = re.RegisterShader;
|
||||
cgi->R_RegisterShaderNoMip = re.RegisterShaderNoMip;
|
||||
cgi->R_GetShaderName = re.GetShaderName;
|
||||
|
||||
cgi->R_AddRefEntityToScene = re.AddRefEntityToScene;
|
||||
cgi->R_AddRefSpriteToScene = re.AddRefSpriteToScene;
|
||||
@@ -778,6 +817,8 @@ void CL_InitCGameDLL( clientGameImport_t *cgi, clientGameExport_t **cge ) {
|
||||
cgi->CL_RestoreSavedCgameState = CL_RestoreSavedCgameState;
|
||||
cgi->CL_ClearSavedCgameState = CL_ClearSavedCgameState;
|
||||
|
||||
cgi->getConfigStringIdNormalized = CPT_NormalizeConfigstring;
|
||||
|
||||
cgi->fsDebug = fs_debug;
|
||||
cgi->HudDrawElements = cls.HudDrawElements;
|
||||
cgi->anim = &cls.anim;
|
||||
|
||||
@@ -1091,6 +1091,8 @@ static void RoQReset( void ) {
|
||||
|
||||
static void RoQInterrupt(void)
|
||||
{
|
||||
// Removed in OPM
|
||||
#if 0
|
||||
byte *framedata;
|
||||
short sbuf[32768];
|
||||
int ssize;
|
||||
@@ -1214,6 +1216,7 @@ redump:
|
||||
// assert(cinTable[currentHandle].RoQFrameSize <= 65536);
|
||||
// r = FS_Read( cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile );
|
||||
cinTable[currentHandle].RoQPlayed += cinTable[currentHandle].RoQFrameSize+8;
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -1397,6 +1400,9 @@ CIN_PlayCinematic
|
||||
==================
|
||||
*/
|
||||
int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBits ) {
|
||||
return 0;
|
||||
// Removed in OPM
|
||||
#if 0
|
||||
unsigned short RoQID;
|
||||
char name[MAX_OSPATH];
|
||||
int i;
|
||||
@@ -1478,6 +1484,7 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
|
||||
|
||||
RoQShutdown();
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CIN_SetExtents (int handle, int x, int y, int w, int h) {
|
||||
@@ -1612,7 +1619,7 @@ void CL_PlayCinematic_f(void) {
|
||||
bits |= CIN_loop;
|
||||
}
|
||||
|
||||
S_StopAllSounds( qtrue );
|
||||
S_StopAllSounds2( qtrue );
|
||||
|
||||
CL_handle = CIN_PlayCinematic( arg, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, bits );
|
||||
if (CL_handle >= 0) {
|
||||
@@ -1639,7 +1646,7 @@ void SCR_RunCinematic (void)
|
||||
void SCR_StopCinematic(void) {
|
||||
if (CL_handle >= 0 && CL_handle < MAX_VIDEO_HANDLES) {
|
||||
CIN_StopCinematic(CL_handle);
|
||||
S_StopAllSounds( qtrue );
|
||||
S_StopAllSounds2( qtrue );
|
||||
CL_handle = -1;
|
||||
}
|
||||
}
|
||||
@@ -432,7 +432,7 @@ void CL_MouseEvent( int dx, int dy, int time ) {
|
||||
if( cl.mousey > cls.glconfig.vidHeight )
|
||||
cl.mousey = cls.glconfig.vidHeight;
|
||||
}
|
||||
else
|
||||
else if ( !paused->integer )
|
||||
{
|
||||
cl.mouseDx[cl.mouseIndex] += dx;
|
||||
cl.mouseDy[cl.mouseIndex] += dy;
|
||||
@@ -575,6 +575,14 @@ void CL_MouseMove( usercmd_t *cmd ) {
|
||||
cl.viewangles[PITCH] += m_pitch->value * my;
|
||||
else
|
||||
cmd->forwardmove = ClampChar(cmd->forwardmove - m_forward->value * my);
|
||||
|
||||
if (!isfinite(cl.viewangles[PITCH]) || !isfinite(cl.viewangles[YAW])) {
|
||||
Com_DPrintf("Invalid client viewangles encountered (view pitch: %f, view yaw: %f)!\n", cl.viewangles[PITCH], cl.viewangles[YAW]);
|
||||
Com_DPrintf("cgameSensitivity: %f | mx: %f | my: %f | m_pitch: %f | m_yaw: %f\n", cgameSensitivity, mx, my, m_pitch->value, m_yaw->value);
|
||||
Com_DPrintf("Resetting client viewangles\n");
|
||||
cl.viewangles[PITCH] = 0;
|
||||
cl.viewangles[YAW] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -991,7 +999,7 @@ void CL_SendCmd( void ) {
|
||||
}
|
||||
|
||||
// don't send commands if paused
|
||||
if ( com_sv_running->integer && paused->integer && paused->integer ) {
|
||||
if ( com_sv_running->integer && paused->integer ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+973
-130
File diff suppressed because it is too large.
Load diff
+173
-150
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,175 +20,198 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_INV_H__
|
||||
#define __CL_INV_H__
|
||||
#pragma once
|
||||
|
||||
typedef enum { INV_MOVE_NONE, INV_MOVE_BOB, INV_MOVE_SPIN } inv_move_type;
|
||||
typedef enum { INV_CASCADE_LEFT, INV_CASCADE_RIGHT } inv_cascade_type;
|
||||
typedef enum { INV_HUDANGLES_BASE, INV_HUDANGLES_COMPASS, INV_HUDANGLES_COMPASS_NEEDLE } inv_hudangles_type;
|
||||
typedef enum {
|
||||
INV_MOVE_NONE,
|
||||
INV_MOVE_BOB,
|
||||
INV_MOVE_SPIN
|
||||
} inv_move_type;
|
||||
|
||||
class item_properties_t : public Class {
|
||||
public:
|
||||
float scale;
|
||||
Vector angles;
|
||||
Vector angledeltas;
|
||||
Vector rotateoffset;
|
||||
Vector offset;
|
||||
inv_move_type move;
|
||||
str model;
|
||||
str anim;
|
||||
};
|
||||
typedef enum {
|
||||
INV_ALIGN_NONE,
|
||||
INV_ALIGN_LEFT,
|
||||
INV_ALIGN_RIGHT
|
||||
} inv_align_type;
|
||||
|
||||
class inventory_item_t : public Class {
|
||||
public:
|
||||
str name;
|
||||
str ammoname;
|
||||
int equip;
|
||||
int width;
|
||||
int height;
|
||||
int barwidth;
|
||||
int barheight;
|
||||
int baroffsetY;
|
||||
int baroffsetX;
|
||||
float modelWindowX;
|
||||
float modelWindowY;
|
||||
float modelWindowWidth;
|
||||
float modelWindowHeight;
|
||||
bool selShaderOnTop;
|
||||
bool checkammo;
|
||||
str command;
|
||||
inv_hudangles_type anglesType;
|
||||
item_properties_t hudprops;
|
||||
item_properties_t invprops;
|
||||
UIReggedMaterial *bgshader;
|
||||
UIReggedMaterial *barshader;
|
||||
UIReggedMaterial *selshader;
|
||||
};
|
||||
typedef enum {
|
||||
INV_CASCADE_LEFT,
|
||||
INV_CASCADE_RIGHT
|
||||
} inv_cascade_type;
|
||||
|
||||
class inventory_type_t {
|
||||
public:
|
||||
str name;
|
||||
bool bg_tile;
|
||||
UIReggedMaterial *texture;
|
||||
UIReggedMaterial *bg;
|
||||
UIReggedMaterial *hoverTexture;
|
||||
UIReggedMaterial *selTexture;
|
||||
Container<inventory_item_t *> items;
|
||||
typedef enum {
|
||||
INV_HUDANGLES_BASE,
|
||||
INV_HUDANGLES_COMPASS,
|
||||
INV_HUDANGLES_COMPASS_NEEDLE
|
||||
} inv_hudangles_type;
|
||||
|
||||
int IndexOfItemPtr( inventory_item_t *item );
|
||||
};
|
||||
|
||||
inline
|
||||
int inventory_type_t::IndexOfItemPtr( inventory_item_t *item )
|
||||
class item_properties_t : public Class
|
||||
{
|
||||
for( int i = items.NumObjects(); i > 0; i-- )
|
||||
{
|
||||
if( items.ObjectAt( i ) == item )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
public:
|
||||
float scale;
|
||||
Vector angles;
|
||||
Vector angledeltas;
|
||||
Vector rotateoffset;
|
||||
Vector offset;
|
||||
inv_move_type move;
|
||||
str model;
|
||||
str anim;
|
||||
};
|
||||
|
||||
return 0;
|
||||
class inventory_item_t : public Class
|
||||
{
|
||||
public:
|
||||
str name;
|
||||
str ammoname;
|
||||
int equip;
|
||||
int width;
|
||||
int height;
|
||||
int barwidth;
|
||||
int barheight;
|
||||
int baroffsetY;
|
||||
int baroffsetX;
|
||||
float modelWindowX;
|
||||
float modelWindowY;
|
||||
float modelWindowWidth;
|
||||
float modelWindowHeight;
|
||||
bool selShaderOnTop;
|
||||
bool checkammo;
|
||||
str command;
|
||||
inv_hudangles_type anglesType;
|
||||
item_properties_t hudprops;
|
||||
item_properties_t invprops;
|
||||
UIReggedMaterial *bgshader;
|
||||
UIReggedMaterial *barshader;
|
||||
UIReggedMaterial *selshader;
|
||||
};
|
||||
|
||||
class inventory_type_t
|
||||
{
|
||||
public:
|
||||
str name;
|
||||
bool bg_tile;
|
||||
UIReggedMaterial *texture;
|
||||
UIReggedMaterial *bg;
|
||||
UIReggedMaterial *hoverTexture;
|
||||
UIReggedMaterial *selTexture;
|
||||
Container<inventory_item_t *> items;
|
||||
|
||||
int IndexOfItemPtr(inventory_item_t *item);
|
||||
};
|
||||
|
||||
inline int inventory_type_t::IndexOfItemPtr(inventory_item_t *item)
|
||||
{
|
||||
for (int i = items.NumObjects(); i > 0; i--) {
|
||||
if (items.ObjectAt(i) == item) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
class inventory_t {
|
||||
class inventory_t
|
||||
{
|
||||
public:
|
||||
int typewidth;
|
||||
int typeheight;
|
||||
int horizoffset;
|
||||
int vertoffset;
|
||||
int align;
|
||||
inv_cascade_type cascade;
|
||||
str selectsound;
|
||||
str rejectsound;
|
||||
str changesound;
|
||||
Container<inventory_type_t *> types;
|
||||
int typewidth;
|
||||
int typeheight;
|
||||
int horizoffset;
|
||||
int vertoffset;
|
||||
inv_align_type align;
|
||||
inv_cascade_type cascade;
|
||||
str selectsound;
|
||||
str rejectsound;
|
||||
str changesound;
|
||||
Container<inventory_type_t *> types;
|
||||
|
||||
void Clear() { types.ClearObjectList(); }
|
||||
public:
|
||||
inventory_t();
|
||||
~inventory_t();
|
||||
inventory_t(const inventory_t& other);
|
||||
inventory_t& operator=(const inventory_t& other);
|
||||
void Clear();
|
||||
};
|
||||
|
||||
class invlistener : public Listener {
|
||||
class invlistener : public Listener
|
||||
{
|
||||
protected:
|
||||
inventory_t *inv;
|
||||
inventory_type_t *curtype;
|
||||
inventory_item_t *curitem;
|
||||
int defaultWidth;
|
||||
int defaultHeight;
|
||||
int defaultBarWidth;
|
||||
int defaultBarHeight;
|
||||
int defaultBarOffsetX;
|
||||
int defaultBarOffsetY;
|
||||
inventory_t *inv;
|
||||
inventory_type_t *curtype;
|
||||
inventory_item_t *curitem;
|
||||
int defaultWidth;
|
||||
int defaultHeight;
|
||||
int defaultBarWidth;
|
||||
int defaultBarHeight;
|
||||
int defaultBarOffsetX;
|
||||
int defaultBarOffsetY;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( invlistener );
|
||||
CLASS_PROTOTYPE(invlistener);
|
||||
|
||||
protected:
|
||||
void verify_curitem( void );
|
||||
void verify_curtype( void );
|
||||
void verify_one_arg( Event *ev );
|
||||
void verify_curitem(void);
|
||||
void verify_curtype(void);
|
||||
void verify_one_arg(Event *ev);
|
||||
|
||||
public:
|
||||
invlistener( inventory_t *i );
|
||||
invlistener();
|
||||
invlistener(inventory_t *i);
|
||||
invlistener();
|
||||
|
||||
bool Load( Script& script );
|
||||
void InvSelectSound( Event *ev );
|
||||
void InvRejectSound( Event *ev );
|
||||
void InvChangeSound( Event *ev );
|
||||
void InvWidth( Event *ev );
|
||||
void InvHeight( Event *ev );
|
||||
void InvHorizOffset( Event *ev );
|
||||
void InvVertOffset( Event *ev );
|
||||
void InvAlign( Event *ev );
|
||||
void InvCascade( Event *ev );
|
||||
void Typedef( Event *ev );
|
||||
void OpenBrace( Event *ev );
|
||||
void CloseBrace( Event *ev );
|
||||
void ButtonShader( Event *ev );
|
||||
void HoverShader( Event *ev );
|
||||
void SelShader( Event *ev );
|
||||
void Background( Event *ev );
|
||||
void BackgroundTile( Event *ev );
|
||||
void Width( Event *ev );
|
||||
void Height( Event *ev );
|
||||
void BarWidth( Event *ev );
|
||||
void BarHeight( Event *ev );
|
||||
void BarOffsetX( Event *ev );
|
||||
void BarOffsetY( Event *ev );
|
||||
void Item( Event *ev );
|
||||
void Ammo( Event *ev );
|
||||
void Equip( Event *ev );
|
||||
void CheckAmmo( Event *ev );
|
||||
void Command( Event *ev );
|
||||
void BGShader( Event *ev );
|
||||
void BarShader( Event *ev );
|
||||
void SelItemShader( Event *ev );
|
||||
void SelItemShaderOnTop( Event *ev );
|
||||
void RotateOffset( Event *ev );
|
||||
void Offset( Event *ev );
|
||||
void Model( Event *ev );
|
||||
void Anim( Event *ev );
|
||||
void Scale( Event *ev );
|
||||
void Angles( Event *ev );
|
||||
void AngleDeltas( Event *ev );
|
||||
void Move( Event *ev );
|
||||
void ModelWindow( Event *ev );
|
||||
void HudRotateOffset( Event *ev );
|
||||
void HudOffset( Event *ev );
|
||||
void HudModel( Event *ev );
|
||||
void HudAnim( Event *ev );
|
||||
void HudScale( Event *ev );
|
||||
void HudAngles( Event *ev );
|
||||
void HudAngleDeltas( Event *ev );
|
||||
void HudMove( Event *ev );
|
||||
void HudCompassAngles( Event *ev );
|
||||
void HudCompassNeedleAngles( Event *ev );
|
||||
bool Load(Script& script);
|
||||
void InvSelectSound(Event *ev);
|
||||
void InvRejectSound(Event *ev);
|
||||
void InvChangeSound(Event *ev);
|
||||
void InvWidth(Event *ev);
|
||||
void InvHeight(Event *ev);
|
||||
void InvHorizOffset(Event *ev);
|
||||
void InvVertOffset(Event *ev);
|
||||
void InvAlign(Event *ev);
|
||||
void InvCascade(Event *ev);
|
||||
void Typedef(Event *ev);
|
||||
void OpenBrace(Event *ev);
|
||||
void CloseBrace(Event *ev);
|
||||
void ButtonShader(Event *ev);
|
||||
void HoverShader(Event *ev);
|
||||
void SelShader(Event *ev);
|
||||
void Background(Event *ev);
|
||||
void BackgroundTile(Event *ev);
|
||||
void Width(Event *ev);
|
||||
void Height(Event *ev);
|
||||
void BarWidth(Event *ev);
|
||||
void BarHeight(Event *ev);
|
||||
void BarOffsetX(Event *ev);
|
||||
void BarOffsetY(Event *ev);
|
||||
void Item(Event *ev);
|
||||
void Ammo(Event *ev);
|
||||
void Equip(Event *ev);
|
||||
void CheckAmmo(Event *ev);
|
||||
void Command(Event *ev);
|
||||
void BGShader(Event *ev);
|
||||
void BarShader(Event *ev);
|
||||
void SelItemShader(Event *ev);
|
||||
void SelItemShaderOnTop(Event *ev);
|
||||
void RotateOffset(Event *ev);
|
||||
void Offset(Event *ev);
|
||||
void Model(Event *ev);
|
||||
void Anim(Event *ev);
|
||||
void Scale(Event *ev);
|
||||
void Angles(Event *ev);
|
||||
void AngleDeltas(Event *ev);
|
||||
void Move(Event *ev);
|
||||
void ModelWindow(Event *ev);
|
||||
void HudRotateOffset(Event *ev);
|
||||
void HudOffset(Event *ev);
|
||||
void HudModel(Event *ev);
|
||||
void HudAnim(Event *ev);
|
||||
void HudScale(Event *ev);
|
||||
void HudAngles(Event *ev);
|
||||
void HudAngleDeltas(Event *ev);
|
||||
void HudMove(Event *ev);
|
||||
void HudCompassAngles(Event *ev);
|
||||
void HudCompassNeedleAngles(Event *ev);
|
||||
};
|
||||
|
||||
bool CL_LoadInventory( const char *filename, inventory_t *inv );
|
||||
inventory_item_t *CL_GetInvItemByName( inventory_t *inv, const char *name );
|
||||
qboolean CL_HasInventoryItem( const char *name );
|
||||
void CL_AmmoCount( const char *name, int *ammo_count, int *max_ammo_count );
|
||||
|
||||
#endif // __CL_INV_H__
|
||||
bool CL_LoadInventory(const char *filename, inventory_t *inv);
|
||||
inventory_item_t *CL_GetInvItemByName(inventory_t *inv, const char *name);
|
||||
qboolean CL_HasInventoryItem(const char *name);
|
||||
void CL_AmmoCount(const char *name, int *ammo_count, int *max_ammo_count);
|
||||
+965
-132
File diff suppressed because it is too large.
Load diff
+81
-58
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,79 +20,102 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_INVRENDER_H__
|
||||
#define __CL_INVRENDER_H__
|
||||
#pragma once
|
||||
|
||||
class FakkInventory;
|
||||
|
||||
typedef enum { selectsound, rejectsound, changesound } invsound_t;
|
||||
class FakkItemList : public UIWidget {
|
||||
typedef enum {
|
||||
selectsound,
|
||||
rejectsound,
|
||||
changesound
|
||||
} invsound_t;
|
||||
|
||||
class FakkItemList : public UIWidget
|
||||
{
|
||||
protected:
|
||||
inventory_type_t *type;
|
||||
uipopup_describe m_describe[ 10 ];
|
||||
inventory_item_t *m_hoveritem;
|
||||
inventory_item_t *m_lastmenuitem;
|
||||
FakkInventory *m_parent;
|
||||
float m_hovertop;
|
||||
inventory_type_t *type;
|
||||
uipopup_describe m_describe[10];
|
||||
inventory_item_t *m_hoveritem;
|
||||
inventory_item_t *m_lastmenuitem;
|
||||
FakkInventory *m_parent;
|
||||
float m_hovertop;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( FakkItemList );
|
||||
CLASS_PROTOTYPE(FakkItemList);
|
||||
|
||||
FakkItemList();
|
||||
~FakkItemList();
|
||||
FakkItemList();
|
||||
~FakkItemList();
|
||||
|
||||
void VerifyItemUp( inventory_item_t *item, qboolean warpmouse );
|
||||
void setType( inventory_type_t *t );
|
||||
void Create( float x, float y, FakkInventory *parent );
|
||||
bool HasAnyItems( void );
|
||||
void Draw( void ) override;
|
||||
void OnLeftMouseDown( Event *ev );
|
||||
void OnRightMouseDown( Event *ev );
|
||||
void OnLeftMouseUp( Event *ev );
|
||||
void OnRightMouseUp( Event *ev );
|
||||
void OnMouseMove( Event *ev );
|
||||
void OnMouseEnter( Event *ev );
|
||||
void OnMouseLeave( Event *ev );
|
||||
void OnMenuKilled( Event *ev );
|
||||
void EquipItem( Event *ev );
|
||||
void VerifyItemUp(inventory_item_t *item, qboolean warpmouse);
|
||||
void setType(inventory_type_t *t);
|
||||
void Create(float x, float y, FakkInventory *parent);
|
||||
bool HasAnyItems(void);
|
||||
void Draw(void) override;
|
||||
void OnLeftMouseDown(Event *ev);
|
||||
void OnRightMouseDown(Event *ev);
|
||||
void OnLeftMouseUp(Event *ev);
|
||||
void OnRightMouseUp(Event *ev);
|
||||
void OnMouseMove(Event *ev);
|
||||
void OnMouseEnter(Event *ev);
|
||||
void OnMouseLeave(Event *ev);
|
||||
void OnMenuKilled(Event *ev);
|
||||
void EquipItem(Event *ev);
|
||||
|
||||
inventory_item_t *getHoverItem() const;
|
||||
};
|
||||
|
||||
class FakkInventory : public UIWidget {
|
||||
class FakkInventory : public UIWidget
|
||||
{
|
||||
protected:
|
||||
inventory_t *m_inv;
|
||||
SafePtr<FakkItemList> m_currentlist;
|
||||
inventory_type_t *m_currenttype;
|
||||
int m_currentitemnum;
|
||||
inventory_t *m_inv;
|
||||
SafePtr<FakkItemList> m_currentlist;
|
||||
inventory_type_t *m_currenttype;
|
||||
int m_currentitemnum;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( FakkInventory );
|
||||
|
||||
protected:
|
||||
void VerifyItemUp( inventory_item_t *item, qboolean warpmouse );
|
||||
CLASS_PROTOTYPE(FakkInventory);
|
||||
|
||||
public:
|
||||
FakkInventory();
|
||||
~FakkInventory();
|
||||
qboolean m_mouse_active;
|
||||
|
||||
void setInventory( inventory_t *i );
|
||||
void Draw( void ) override;
|
||||
void OnMouseMove( Event *ev );
|
||||
void OnMouseLeave( Event *ev );
|
||||
void OnMouseEnter( Event *ev );
|
||||
void OnMouseDown( Event *ev );
|
||||
void WarpTo( const char *name );
|
||||
void WarpTo( int slotnum );
|
||||
void NextItem( void );
|
||||
void PrevItem( void );
|
||||
qboolean isDying( void );
|
||||
qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
void PlaySound( invsound_t type );
|
||||
void Timeout( Event *ev );
|
||||
void ChangeItem( int sign );
|
||||
int FindFirstItem( int itemindex, int sign );
|
||||
protected:
|
||||
void VerifyTypeUp(inventory_type_t *t, qboolean warpmouse);
|
||||
|
||||
public:
|
||||
FakkInventory();
|
||||
~FakkInventory();
|
||||
|
||||
void setInventory(inventory_t *i);
|
||||
void Draw(void) override;
|
||||
void OnMouseMove(Event *ev);
|
||||
void OnMouseLeave(Event *ev);
|
||||
void OnMouseEnter(Event *ev);
|
||||
void OnMouseDown(Event *ev);
|
||||
void WarpTo(const char *name);
|
||||
void WarpTo(int slotnum);
|
||||
void NextItem(void);
|
||||
void PrevItem(void);
|
||||
qboolean isDying(void);
|
||||
qboolean KeyEvent(int key, unsigned int time) override;
|
||||
void PlaySound(invsound_t type);
|
||||
void Timeout(Event *ev);
|
||||
void ChangeItem(int sign);
|
||||
int FindFirstItem(int itemindex, int sign);
|
||||
};
|
||||
|
||||
void CL_Draw3DModel( float x, float y, float w, float h, qhandle_t model, vec3_t origin, vec3_t rotateoffset, vec3_t offset, vec3_t angle, vec3_t color, str anim );
|
||||
qboolean UI_CloseInventory( void );
|
||||
void CL_Draw3DModel(
|
||||
float x,
|
||||
float y,
|
||||
float w,
|
||||
float h,
|
||||
qhandle_t model,
|
||||
vec3_t origin,
|
||||
vec3_t rotateoffset,
|
||||
vec3_t offset,
|
||||
vec3_t angle,
|
||||
vec3_t color,
|
||||
str anim
|
||||
);
|
||||
|
||||
#endif // __CL_INVRENDER_H__
|
||||
void UI_DoInventory(qboolean activate_mouse);
|
||||
qboolean UI_CloseInventory(void);
|
||||
+927
-915
File diff suppressed because it is too large.
Load diff
+484
-221
File diff suppressed because it is too large.
Load diff
@@ -514,40 +514,6 @@ static void CL_ParseServerInfo(void)
|
||||
sizeof(clc.sv_dlURL));
|
||||
}
|
||||
|
||||
char* MSG_ReadGameStateChar_ver_15(msg_t* msg) {
|
||||
return MSG_ReadScrambledBigString(msg);
|
||||
}
|
||||
|
||||
float MSG_ReadServerFrameTime_ver_15(msg_t* msg) {
|
||||
return MSG_ReadFloat(msg);
|
||||
}
|
||||
|
||||
char* MSG_ReadGameStateChar_ver_6(msg_t* msg) {
|
||||
return MSG_ReadString(msg);
|
||||
}
|
||||
|
||||
float MSG_ReadServerFrameTime_ver_6(msg_t* msg) {
|
||||
return 1.f / atof(Info_ValueForKey(cl.gameState.stringData + cl.gameState.stringOffsets[CS_SYSTEMINFO], "sv_fps"));
|
||||
}
|
||||
|
||||
char* MSG_ReadGameStateChar(msg_t* msg) {
|
||||
if (MSG_IsProtocolVersion15()) {
|
||||
return MSG_ReadGameStateChar_ver_15(msg);
|
||||
} else {
|
||||
// smaller below version 15
|
||||
return MSG_ReadGameStateChar_ver_6(msg);
|
||||
}
|
||||
}
|
||||
|
||||
float MSG_ReadServerFrameTime(msg_t* msg) {
|
||||
if (MSG_IsProtocolVersion15()) {
|
||||
return MSG_ReadServerFrameTime_ver_15(msg);
|
||||
} else {
|
||||
// smaller below version 15
|
||||
return MSG_ReadServerFrameTime_ver_6(msg);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_ParseGamestate
|
||||
@@ -591,7 +557,7 @@ void CL_ParseGamestate( msg_t *msg ) {
|
||||
if (csNum < 0 || csNum >= MAX_CONFIGSTRINGS) {
|
||||
Com_Error(ERR_DROP, "configstring > MAX_CONFIGSTRINGS");
|
||||
}
|
||||
s = MSG_ReadGameStateChar(msg);
|
||||
s = MSG_ReadScrambledBigString(msg);
|
||||
len = strlen(s);
|
||||
|
||||
if (len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS) {
|
||||
@@ -620,7 +586,7 @@ void CL_ParseGamestate( msg_t *msg ) {
|
||||
clc.clientNum = MSG_ReadLong(msg);
|
||||
// read the checksum feed
|
||||
clc.checksumFeed = MSG_ReadLong( msg );
|
||||
cls.serverFrameTime = MSG_ReadServerFrameTime(msg);
|
||||
cls.serverFrameTime = MSG_ReadServerFrameTime(msg, &cl.gameState);
|
||||
|
||||
// parse serverId and other cvars
|
||||
CL_SystemInfoChanged();
|
||||
|
||||
+3932
-4030
File diff suppressed because it is too large.
Load diff
+86
-68
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,112 +20,130 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UI_H__
|
||||
#define __CL_UI_H__
|
||||
#pragma once
|
||||
|
||||
#include "../uilib/ui_extern.h"
|
||||
#include "../uilib/uiwidget.h"
|
||||
|
||||
typedef struct {
|
||||
UIReggedMaterial *loading;
|
||||
UIReggedMaterial *loading;
|
||||
} static_media_t;
|
||||
|
||||
//
|
||||
// cvars
|
||||
//
|
||||
extern cvar_t* ui_health_start;
|
||||
extern cvar_t* ui_health_end;
|
||||
extern cvar_t* sound_overlay;
|
||||
extern cvar_t *ui_health_start;
|
||||
extern cvar_t *ui_health_end;
|
||||
extern cvar_t *sound_overlay;
|
||||
|
||||
//
|
||||
// initialization
|
||||
//
|
||||
void CL_FillUIDef( void );
|
||||
void CL_InitializeUI( void );
|
||||
void CL_ShutdownUI( void );
|
||||
void CL_FillUIDef(void);
|
||||
void CL_InitializeUI(void);
|
||||
void CL_ShutdownUI(void);
|
||||
|
||||
//
|
||||
// general ui stuff
|
||||
//
|
||||
extern inventory_t client_inv;
|
||||
extern bind_t client_bind;
|
||||
extern cvar_t* cl_greenfps;
|
||||
extern bind_t client_bind;
|
||||
extern cvar_t *cl_greenfps;
|
||||
extern qboolean server_loading;
|
||||
|
||||
const char *CvarGetForUI( const char *name, const char *defval );
|
||||
void UI_ClearState( void );
|
||||
void CL_BeginRegistration( void );
|
||||
void CL_EndRegistration(void);
|
||||
const char *CvarGetForUI(const char *name, const char *defval);
|
||||
void UI_ClearState(void);
|
||||
void CL_BeginRegistration(void);
|
||||
void CL_EndRegistration(void);
|
||||
|
||||
//
|
||||
// menu
|
||||
//
|
||||
extern Menu *ui_pLoadingMenu;
|
||||
|
||||
void UI_ShowMenu( const char *name, qboolean bForce );
|
||||
void UI_HideMenu( const char *name, qboolean bForce );
|
||||
void UI_ForceMenuOff( bool force );
|
||||
void UI_PushMenu( const char *name );
|
||||
void UI_ForceMenu( const char *name );
|
||||
qboolean UI_BindActive( void );
|
||||
void UI_SetReturnMenuToCurrent(void);
|
||||
void UI_ActivateView3D( void );
|
||||
void UI_MenuEscape( const char *name );
|
||||
void UI_CreateScoreboard( void );
|
||||
qboolean UI_MenuActive( void );
|
||||
qboolean UI_MenuUp( void );
|
||||
void UI_FocusMenuIfExists(void);
|
||||
void UI_DrawConnect( void );
|
||||
void UI_CreateDialog( const char *title, char *cvarname, const char *command, const char *cancelCommand, int width, int height, const char *shader, const char *okshader, const char *cancelshader );
|
||||
void UI_ToggleDMConsole( int iMode );
|
||||
void UI_ShowScoreboard_f( const char *pszMenuName );
|
||||
void UI_HideScoreboard_f( void );
|
||||
void UI_SetScoreBoardItem( int iItemNumber,
|
||||
const char *pszData1, const char *pszData2, const char *pszData3, const char *pszData4,
|
||||
const char *pszData5, const char *pszData6, const char *pszData7, const char *pszData8,
|
||||
const vec4_t pTextColor, const vec4_t pBackColor, qboolean bIsHeader );
|
||||
void UI_DeleteScoreBoardItems( int iMaxIndex );
|
||||
void UI_ShowMenu(const char *name, qboolean bForce);
|
||||
void UI_HideMenu(const char *name, qboolean bForce);
|
||||
void UI_ForceMenuOff(bool force);
|
||||
void UI_PushMenu(const char *name);
|
||||
void UI_ForceMenu(const char *name);
|
||||
qboolean UI_BindActive(void);
|
||||
void UI_SetReturnMenuToCurrent(void);
|
||||
void UI_ActivateView3D(void);
|
||||
void UI_MenuEscape(const char *name);
|
||||
void UI_CreateScoreboard(void);
|
||||
qboolean UI_MenuActive(void);
|
||||
qboolean UI_MenuUp(void);
|
||||
void UI_FocusMenuIfExists(void);
|
||||
void UI_DrawConnect(void);
|
||||
void UI_CreateDialog(
|
||||
const char *title,
|
||||
char *cvarname,
|
||||
const char *command,
|
||||
const char *cancelCommand,
|
||||
int width,
|
||||
int height,
|
||||
const char *shader,
|
||||
const char *okshader,
|
||||
const char *cancelshader
|
||||
);
|
||||
void UI_ToggleDMConsole(int iMode);
|
||||
void UI_ShowScoreboard_f(const char *pszMenuName);
|
||||
void UI_HideScoreboard_f(void);
|
||||
void UI_SetScoreBoardItem(
|
||||
int iItemNumber,
|
||||
const char *pszData1,
|
||||
const char *pszData2,
|
||||
const char *pszData3,
|
||||
const char *pszData4,
|
||||
const char *pszData5,
|
||||
const char *pszData6,
|
||||
const char *pszData7,
|
||||
const char *pszData8,
|
||||
const vec4_t pTextColor,
|
||||
const vec4_t pBackColor,
|
||||
qboolean bIsHeader
|
||||
);
|
||||
void UI_DeleteScoreBoardItems(int iMaxIndex);
|
||||
|
||||
//
|
||||
// ressources
|
||||
//
|
||||
void UI_BeginLoad( const char *pszMapName );
|
||||
void UI_EndLoad( void );
|
||||
void UI_AbortLoad( void );
|
||||
void UI_BeginLoadResource( void );
|
||||
void UI_EndLoadResource( void );
|
||||
void UI_EndLoadResource( const char *name );
|
||||
qboolean UI_IsResourceLoaded( const char *name );
|
||||
void UI_RegisterLoadResource( const char *name );
|
||||
void UI_ClearResource( void );
|
||||
void UI_LoadResource( const char *name );
|
||||
void UI_BeginLoad(const char *pszMapName);
|
||||
void UI_EndLoad(void);
|
||||
void UI_AbortLoad(void);
|
||||
void UI_BeginLoadResource(void);
|
||||
void UI_EndLoadResource(void);
|
||||
void UI_EndLoadResource(const char *name);
|
||||
qboolean UI_IsResourceLoaded(const char *name);
|
||||
void UI_RegisterLoadResource(const char *name);
|
||||
void UI_ClearResource(void);
|
||||
void UI_LoadResource(const char *name);
|
||||
|
||||
//
|
||||
// windows
|
||||
//
|
||||
void UI_DeactiveFloatingWindows( void );
|
||||
void UI_DeactiveFloatingWindows(void);
|
||||
|
||||
//
|
||||
// console
|
||||
//
|
||||
void UI_OpenConsole( void );
|
||||
qboolean UI_ConsoleIsVisible( void );
|
||||
qboolean UI_ConsoleIsOpen( void );
|
||||
void UI_CloseConsole( void );
|
||||
void UI_ToggleConsole( void );
|
||||
void UI_OpenDMConsole( int iMode );
|
||||
void UI_CloseDMConsole( void );
|
||||
void UI_ToggleDMConsole( int iMode );
|
||||
void UI_OpenDeveloperConsole( void );
|
||||
void UI_CloseDeveloperConsole( void );
|
||||
void UI_PrintConsole(const char* msg);
|
||||
void UI_OpenConsole(void);
|
||||
qboolean UI_ConsoleIsVisible(void);
|
||||
qboolean UI_ConsoleIsOpen(void);
|
||||
void UI_CloseConsole(void);
|
||||
void UI_ToggleConsole(void);
|
||||
void UI_OpenDMConsole(int iMode);
|
||||
void UI_CloseDMConsole(void);
|
||||
void UI_ToggleDMConsole(int iMode);
|
||||
void UI_OpenDeveloperConsole(void);
|
||||
void UI_CloseDeveloperConsole(void);
|
||||
void UI_PrintConsole(const char *msg);
|
||||
|
||||
//
|
||||
// callbacks
|
||||
//
|
||||
void UI_Update( void );
|
||||
void UI_ServerLoaded( void );
|
||||
void UI_ResolutionChange( void );
|
||||
void UI_KeyEvent( int key, unsigned int time );
|
||||
void UI_CharEvent( int ch );
|
||||
|
||||
#endif /* __CL_UI_H__ */
|
||||
void UI_Update(void);
|
||||
void UI_ServerLoaded(void);
|
||||
void UI_ResolutionChange(void);
|
||||
void UI_KeyEvent(int key, unsigned int time);
|
||||
void UI_CharEvent(int ch);
|
||||
+430
-182
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -24,281 +24,529 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
bind_t::bind_t()
|
||||
{
|
||||
// FIXME: stub
|
||||
int i;
|
||||
|
||||
commandwidth = 100;
|
||||
commandheight = 20;
|
||||
primarykeywidth = 100;
|
||||
primarykeyheight = 20;
|
||||
alternatekeywidth = 100;
|
||||
alternatekeyheight = 20;
|
||||
fillwidth = 16;
|
||||
fillmaterial = NULL;
|
||||
|
||||
for (i = 0; i < ARRAY_LEN(headermats); i++) {
|
||||
headermats[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bind_t::~bind_t()
|
||||
{
|
||||
Clear();
|
||||
Clear();
|
||||
}
|
||||
|
||||
void bind_t::Clear
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
void bind_t::Clear(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
for (int i = binds.NumObjects(); i > 0; i--) {
|
||||
bind_item_t *bi;
|
||||
|
||||
bi = binds.ObjectAt(i);
|
||||
binds.RemoveObjectAt(i);
|
||||
|
||||
if (bi) {
|
||||
delete bi;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CLASS_DECLARATION( Listener, bindlistener, NULL )
|
||||
{
|
||||
{ NULL, NULL }
|
||||
Event EV_Bind_Header
|
||||
(
|
||||
"header",
|
||||
EV_DEFAULT,
|
||||
"iss",
|
||||
"column_num name material",
|
||||
"Set the header of each column"
|
||||
);
|
||||
Event EV_Bind_Width
|
||||
(
|
||||
"bind_width",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"width",
|
||||
"Width of the bind menu"
|
||||
);
|
||||
Event EV_Bind_Height
|
||||
(
|
||||
"bind_height",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"height",
|
||||
"Height of the bind menu"
|
||||
);
|
||||
Event EV_Bind_FillWidth
|
||||
(
|
||||
"bind_fillwidth",
|
||||
EV_DEFAULT,
|
||||
"iS",
|
||||
"width material",
|
||||
"Width of the filling between widgets"
|
||||
);
|
||||
Event EV_Bind_CommandWidth
|
||||
(
|
||||
"bind_commandwidth",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"width",
|
||||
"Width of the command item"
|
||||
);
|
||||
Event EV_Bind_CommandHeight
|
||||
(
|
||||
"bind_commandheight",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"height",
|
||||
"Height of the command item"
|
||||
);
|
||||
Event EV_Bind_PrimaryKeyWidth
|
||||
(
|
||||
"bind_primarykeywidth",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"width",
|
||||
"Width of the primary key item"
|
||||
);
|
||||
Event EV_Bind_PrimaryKeyHeight
|
||||
(
|
||||
"bind_primarykeyheight",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"height",
|
||||
"Height of the primary key item"
|
||||
);
|
||||
Event EV_Bind_AlternateKeyWidth
|
||||
(
|
||||
"bind_alternatekeywidth",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"width",
|
||||
"Width of the alternate key item"
|
||||
);
|
||||
Event EV_Bind_AlternateKeyHeight
|
||||
(
|
||||
"bind_alternatekeyheight",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"height",
|
||||
"Height of the alternate key item"
|
||||
);
|
||||
Event EV_Bind_NewItem
|
||||
(
|
||||
"binditem",
|
||||
EV_DEFAULT,
|
||||
"ss",
|
||||
"name command",
|
||||
"Create a new bind item in the interface"
|
||||
);
|
||||
Event EV_Bind_Align
|
||||
(
|
||||
"align",
|
||||
EV_DEFAULT,
|
||||
"sSSSSS",
|
||||
"arg1 arg2 arg3 arg4 arg5 arg6",
|
||||
"Set the alignment on the bind menu"
|
||||
);
|
||||
Event EV_Bind_TitleForegroundColor
|
||||
(
|
||||
"titleforegroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the title foreground"
|
||||
);
|
||||
Event EV_Bind_TitleBackgroundColor
|
||||
(
|
||||
"titlebackgroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the title background"
|
||||
);
|
||||
Event EV_Bind_InactiveForegroundColor
|
||||
(
|
||||
"inactiveforegroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the inactive button foreground"
|
||||
);
|
||||
Event EV_Bind_InactiveBackgroundColor
|
||||
(
|
||||
"inactivebackgroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the inactive button background"
|
||||
);
|
||||
Event EV_Bind_ActiveForegroundColor
|
||||
(
|
||||
"activeforegroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the active button foreground"
|
||||
);
|
||||
Event EV_Bind_ActiveBackgroundColor
|
||||
(
|
||||
"activebackgroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the active button background"
|
||||
);
|
||||
Event EV_Bind_ActiveBorderColor
|
||||
(
|
||||
"activebordercolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the active button border"
|
||||
);
|
||||
Event EV_Bind_HighlightForegroundColor
|
||||
(
|
||||
"highlightforegroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the highlighted button foreground"
|
||||
);
|
||||
Event EV_Bind_HighlightBackgroundColor
|
||||
(
|
||||
"highlightbackgroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the highlighted button background"
|
||||
);
|
||||
Event EV_Bind_SelectForegroundColor
|
||||
(
|
||||
"selectforegroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the selected button foreground"
|
||||
);
|
||||
Event EV_Bind_SelectBackgroundColor
|
||||
(
|
||||
"selectbackgroundcolor",
|
||||
EV_DEFAULT,
|
||||
"ffff",
|
||||
"r g b a",
|
||||
"Set the color for the selected button background"
|
||||
);
|
||||
Event EV_Bind_ChangeSound
|
||||
(
|
||||
"changesound",
|
||||
EV_DEFAULT,
|
||||
"s",
|
||||
"soundname",
|
||||
"Set the name of the sound to play when the highlighted item changes"
|
||||
);
|
||||
Event EV_Bind_ActiveSound
|
||||
(
|
||||
"activesound",
|
||||
EV_DEFAULT,
|
||||
"s",
|
||||
"soundname",
|
||||
"Set the name of the sound to play when the item is made active"
|
||||
);
|
||||
Event EV_Bind_EnterSound
|
||||
(
|
||||
"entersound",
|
||||
EV_DEFAULT,
|
||||
"s",
|
||||
"soundname",
|
||||
"Set the name of the sound to play when the key is entered"
|
||||
);
|
||||
|
||||
CLASS_DECLARATION(Listener, bindlistener, NULL) {
|
||||
{&EV_Bind_Width, &bindlistener::Width },
|
||||
{&EV_Bind_Height, &bindlistener::Height },
|
||||
{&EV_Bind_FillWidth, &bindlistener::FillWidth },
|
||||
{&EV_Bind_CommandWidth, &bindlistener::CommandWidth },
|
||||
{&EV_Bind_CommandHeight, &bindlistener::CommandHeight },
|
||||
{&EV_Bind_PrimaryKeyWidth, &bindlistener::PrimaryKeyWidth },
|
||||
{&EV_Bind_PrimaryKeyHeight, &bindlistener::PrimaryKeyHeight },
|
||||
{&EV_Bind_AlternateKeyWidth, &bindlistener::AlternateKeyWidth },
|
||||
{&EV_Bind_AlternateKeyHeight, &bindlistener::AlternateKeyHeight },
|
||||
{&EV_Bind_Header, &bindlistener::Header },
|
||||
{&EV_Bind_NewItem, &bindlistener::NewItem },
|
||||
{&EV_Bind_Align, &bindlistener::Align },
|
||||
{&EV_Bind_TitleForegroundColor, &bindlistener::TitleForegroundColor },
|
||||
{&EV_Bind_TitleBackgroundColor, &bindlistener::TitleBackgroundColor },
|
||||
{&EV_Bind_InactiveForegroundColor, &bindlistener::InactiveForegroundColor },
|
||||
{&EV_Bind_InactiveBackgroundColor, &bindlistener::InactiveBackgroundColor },
|
||||
{&EV_Bind_ActiveForegroundColor, &bindlistener::ActiveForegroundColor },
|
||||
{&EV_Bind_ActiveBackgroundColor, &bindlistener::ActiveBackgroundColor },
|
||||
{&EV_Bind_ActiveBorderColor, &bindlistener::ActiveBorderColor },
|
||||
{&EV_Bind_HighlightForegroundColor, &bindlistener::HighlightForegroundColor},
|
||||
{&EV_Bind_HighlightBackgroundColor, &bindlistener::HighlightBackgroundColor},
|
||||
{&EV_Bind_SelectForegroundColor, &bindlistener::SelectForegroundColor },
|
||||
{&EV_Bind_SelectBackgroundColor, &bindlistener::SelectBackgroundColor },
|
||||
{&EV_Bind_ChangeSound, &bindlistener::ChangeSound },
|
||||
{&EV_Bind_ActiveSound, &bindlistener::ActiveSound },
|
||||
{&EV_Bind_EnterSound, &bindlistener::EnterSound },
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
bindlistener::bindlistener()
|
||||
bindlistener::bindlistener() {}
|
||||
|
||||
bindlistener::bindlistener(bind_t *b)
|
||||
{
|
||||
bind = b;
|
||||
}
|
||||
|
||||
bindlistener::bindlistener
|
||||
(
|
||||
bind_t *b
|
||||
)
|
||||
|
||||
void bindlistener::Header(Event *ev)
|
||||
{
|
||||
bind = b;
|
||||
int num;
|
||||
|
||||
num = ev->GetInteger(1) - 1;
|
||||
if (num > ARRAY_LEN(bind_t::headers)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bind->headers[num] = ev->GetString(2);
|
||||
if (ev->NumArgs() > 2) {
|
||||
bind->headermats[num] = uWinMan.RegisterShader(ev->GetString(3));
|
||||
}
|
||||
}
|
||||
|
||||
bool bindlistener::Load
|
||||
(
|
||||
Script& script
|
||||
)
|
||||
|
||||
void bindlistener::ChangeSound(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
return false;
|
||||
bind->changesound = ev->GetString(1);
|
||||
}
|
||||
|
||||
void bindlistener::Header
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::ActiveSound(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->activesound = ev->GetString(1);
|
||||
}
|
||||
|
||||
void bindlistener::Width
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::EnterSound(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->entersound = ev->GetString(1);
|
||||
}
|
||||
|
||||
void bindlistener::FillWidth
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::SelectForegroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->selectfgcolor.r = ev->GetFloat(1);
|
||||
bind->selectfgcolor.g = ev->GetFloat(2);
|
||||
bind->selectfgcolor.b = ev->GetFloat(3);
|
||||
bind->selectfgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::Height
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::SelectBackgroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->selectbgcolor.r = ev->GetFloat(1);
|
||||
bind->selectbgcolor.g = ev->GetFloat(2);
|
||||
bind->selectbgcolor.b = ev->GetFloat(3);
|
||||
bind->selectbgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::CommandWidth
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::TitleForegroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->titlefgcolor.r = ev->GetFloat(1);
|
||||
bind->titlefgcolor.g = ev->GetFloat(2);
|
||||
bind->titlefgcolor.b = ev->GetFloat(3);
|
||||
bind->titlefgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::CommandHeight
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::TitleBackgroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->titlebgcolor.r = ev->GetFloat(1);
|
||||
bind->titlebgcolor.g = ev->GetFloat(2);
|
||||
bind->titlebgcolor.b = ev->GetFloat(3);
|
||||
bind->titlebgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::PrimaryKeyWidth
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::ActiveBorderColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->activebordercolor.r = ev->GetFloat(1);
|
||||
bind->activebordercolor.g = ev->GetFloat(2);
|
||||
bind->activebordercolor.b = ev->GetFloat(3);
|
||||
bind->activebordercolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::PrimaryKeyHeight
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::ActiveForegroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->activefgcolor.r = ev->GetFloat(1);
|
||||
bind->activefgcolor.g = ev->GetFloat(2);
|
||||
bind->activefgcolor.b = ev->GetFloat(3);
|
||||
bind->activefgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::AlternateKeyWidth
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::ActiveBackgroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->activebgcolor.r = ev->GetFloat(1);
|
||||
bind->activebgcolor.g = ev->GetFloat(2);
|
||||
bind->activebgcolor.b = ev->GetFloat(3);
|
||||
bind->activebgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::AlternateKeyHeight
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::InactiveForegroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->inactivefgcolor.r = ev->GetFloat(1);
|
||||
bind->inactivefgcolor.g = ev->GetFloat(2);
|
||||
bind->inactivefgcolor.b = ev->GetFloat(3);
|
||||
bind->inactivefgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::NewItem
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::InactiveBackgroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->inactivebgcolor.r = ev->GetFloat(1);
|
||||
bind->inactivebgcolor.g = ev->GetFloat(2);
|
||||
bind->inactivebgcolor.b = ev->GetFloat(3);
|
||||
bind->inactivebgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::Align
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::HighlightForegroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->highlightfgcolor.r = ev->GetFloat(1);
|
||||
bind->highlightfgcolor.g = ev->GetFloat(2);
|
||||
bind->highlightfgcolor.b = ev->GetFloat(3);
|
||||
bind->highlightfgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::TitleForegroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::HighlightBackgroundColor(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->highlightbgcolor.r = ev->GetFloat(1);
|
||||
bind->highlightbgcolor.g = ev->GetFloat(2);
|
||||
bind->highlightbgcolor.b = ev->GetFloat(3);
|
||||
bind->highlightbgcolor.a = ev->GetFloat(4);
|
||||
}
|
||||
|
||||
void bindlistener::TitleBackgroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::Align(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
int i;
|
||||
|
||||
for (i = 1; i <= ev->NumArgs(); i++) {
|
||||
str align = ev->GetString(i);
|
||||
|
||||
if (!str::icmp(align, "left")) {
|
||||
bind->align |= WA_LEFT;
|
||||
} else if (!str::icmp(align, "right")) {
|
||||
bind->align |= WA_RIGHT;
|
||||
} else if (!str::icmp(align, "top")) {
|
||||
bind->align |= WA_TOP;
|
||||
} else if (!str::icmp(align, "bottom")) {
|
||||
bind->align |= WA_BOTTOM;
|
||||
} else if (!str::icmp(align, "centerx")) {
|
||||
bind->align |= WA_CENTERX;
|
||||
} else if (!str::icmp(align, "centery")) {
|
||||
bind->align |= WA_CENTERY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bindlistener::InactiveForegroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::NewItem(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind_item_t *bt;
|
||||
UIReggedMaterial *mat = NULL;
|
||||
|
||||
if (ev->NumArgs() > 2) {
|
||||
mat = uWinMan.RegisterShader(ev->GetString(3));
|
||||
}
|
||||
|
||||
str n = ev->GetString(1);
|
||||
str c = ev->GetString(2);
|
||||
|
||||
bt = new bind_item_t;
|
||||
bt->name = n;
|
||||
bt->command = c;
|
||||
bt->nameMaterial = mat;
|
||||
|
||||
bind->binds.AddObject(bt);
|
||||
}
|
||||
|
||||
void bindlistener::InactiveBackgroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::Width(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->width = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
void bindlistener::ActiveForegroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::Height(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->height = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
void bindlistener::ActiveBackgroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::FillWidth(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->fillwidth = ev->GetInteger(1);
|
||||
|
||||
if (ev->NumArgs() > 1) {
|
||||
bind->fillmaterial = uWinMan.RegisterShader(ev->GetString(2));
|
||||
}
|
||||
}
|
||||
|
||||
void bindlistener::ActiveBorderColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::CommandWidth(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->commandwidth = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
void bindlistener::HighlightForegroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::CommandHeight(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->commandheight = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
void bindlistener::HighlightBackgroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::PrimaryKeyWidth(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->primarykeywidth = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
void bindlistener::SelectForegroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::PrimaryKeyHeight(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->primarykeyheight = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
void bindlistener::SelectBackgroundColor
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::AlternateKeyWidth(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->alternatekeywidth = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
void bindlistener::ChangeSound
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void bindlistener::AlternateKeyHeight(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
bind->alternatekeyheight = ev->GetInteger(1);
|
||||
}
|
||||
|
||||
void bindlistener::ActiveSound
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
bool bindlistener::Load(Script& script)
|
||||
{
|
||||
// FIXME: stub
|
||||
str token;
|
||||
str errortext;
|
||||
|
||||
while (script.TokenAvailable(true)) {
|
||||
token = script.GetToken(true);
|
||||
|
||||
if (!token.length() || !ValidEvent(token)) {
|
||||
throw "invalid token";
|
||||
}
|
||||
|
||||
Event *event = new Event(token);
|
||||
|
||||
while (script.TokenAvailable(false)) {
|
||||
event->AddToken(script.GetToken(false));
|
||||
}
|
||||
|
||||
ProcessEvent(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void bindlistener::EnterSound
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
bool CL_LoadBind(const char *filename, bind_t *bind)
|
||||
{
|
||||
// FIXME: stub
|
||||
Script script;
|
||||
|
||||
bind->Clear();
|
||||
|
||||
bindlistener listener(bind);
|
||||
script.LoadFile(filename);
|
||||
// Load the bind file
|
||||
return listener.Load(script);
|
||||
}
|
||||
+82
-88
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,115 +20,109 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UIBIND_H__
|
||||
#define __CL_UIBIND_H__
|
||||
#pragma once
|
||||
|
||||
class bind_item_t {
|
||||
class bind_item_t
|
||||
{
|
||||
public:
|
||||
str name;
|
||||
str command;
|
||||
UIReggedMaterial *nameMaterial;
|
||||
str name;
|
||||
str command;
|
||||
UIReggedMaterial *nameMaterial;
|
||||
|
||||
bind_item_t();
|
||||
bind_item_t( str name, str command, UIReggedMaterial *nameMaterial );
|
||||
bind_item_t();
|
||||
bind_item_t(str name, str command, UIReggedMaterial *nameMaterial);
|
||||
};
|
||||
|
||||
inline
|
||||
bind_item_t::bind_item_t()
|
||||
inline bind_item_t::bind_item_t()
|
||||
{
|
||||
nameMaterial = NULL;
|
||||
nameMaterial = NULL;
|
||||
}
|
||||
|
||||
inline
|
||||
bind_item_t::bind_item_t
|
||||
(
|
||||
str name,
|
||||
str command,
|
||||
UIReggedMaterial *nameMaterial
|
||||
)
|
||||
|
||||
inline bind_item_t::bind_item_t(str name, str command, UIReggedMaterial *nameMaterial)
|
||||
{
|
||||
this->name = name;
|
||||
this->command = command;
|
||||
this->nameMaterial = nameMaterial;
|
||||
this->name = name;
|
||||
this->command = command;
|
||||
this->nameMaterial = nameMaterial;
|
||||
}
|
||||
|
||||
class bind_t {
|
||||
class bind_t
|
||||
{
|
||||
public:
|
||||
int width;
|
||||
int height;
|
||||
int fillwidth;
|
||||
int commandwidth;
|
||||
int commandheight;
|
||||
int primarykeywidth;
|
||||
int primarykeyheight;
|
||||
int alternatekeywidth;
|
||||
int alternatekeyheight;
|
||||
int align;
|
||||
UColor titlebgcolor;
|
||||
UColor titlefgcolor;
|
||||
UColor activefgcolor;
|
||||
UColor activebgcolor;
|
||||
UColor activebordercolor;
|
||||
UColor inactivefgcolor;
|
||||
UColor inactivebgcolor;
|
||||
UColor highlightfgcolor;
|
||||
UColor highlightbgcolor;
|
||||
UColor selectfgcolor;
|
||||
UColor selectbgcolor;
|
||||
str changesound;
|
||||
str activesound;
|
||||
str entersound;
|
||||
str headers[ 3 ];
|
||||
UIReggedMaterial *headermats[ 3 ];
|
||||
UIReggedMaterial *fillmaterial;
|
||||
Container<bind_item_t *> binds;
|
||||
int width;
|
||||
int height;
|
||||
int fillwidth;
|
||||
int commandwidth;
|
||||
int commandheight;
|
||||
int primarykeywidth;
|
||||
int primarykeyheight;
|
||||
int alternatekeywidth;
|
||||
int alternatekeyheight;
|
||||
int align;
|
||||
UColor titlebgcolor;
|
||||
UColor titlefgcolor;
|
||||
UColor activefgcolor;
|
||||
UColor activebgcolor;
|
||||
UColor activebordercolor;
|
||||
UColor inactivefgcolor;
|
||||
UColor inactivebgcolor;
|
||||
UColor highlightfgcolor;
|
||||
UColor highlightbgcolor;
|
||||
UColor selectfgcolor;
|
||||
UColor selectbgcolor;
|
||||
str changesound;
|
||||
str activesound;
|
||||
str entersound;
|
||||
str headers[3];
|
||||
UIReggedMaterial *headermats[3];
|
||||
UIReggedMaterial *fillmaterial;
|
||||
Container<bind_item_t *> binds;
|
||||
|
||||
public:
|
||||
bind_t();
|
||||
~bind_t();
|
||||
bind_t();
|
||||
~bind_t();
|
||||
|
||||
void Clear( void );
|
||||
void Clear(void);
|
||||
};
|
||||
|
||||
class bindlistener : public Listener {
|
||||
class bindlistener : public Listener
|
||||
{
|
||||
protected:
|
||||
bind_t *bind;
|
||||
bind_t *bind;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( bindlistener );
|
||||
CLASS_PROTOTYPE(bindlistener);
|
||||
|
||||
public:
|
||||
bindlistener();
|
||||
bindlistener( bind_t *b );
|
||||
bindlistener();
|
||||
bindlistener(bind_t *b);
|
||||
|
||||
bool Load( Script& script );
|
||||
void Header( Event *ev );
|
||||
void Width( Event *ev );
|
||||
void FillWidth( Event *ev );
|
||||
void Height( Event *ev );
|
||||
void CommandWidth( Event *ev );
|
||||
void CommandHeight( Event *ev );
|
||||
void PrimaryKeyWidth( Event *ev );
|
||||
void PrimaryKeyHeight( Event *ev );
|
||||
void AlternateKeyWidth( Event *ev );
|
||||
void AlternateKeyHeight( Event *ev );
|
||||
void NewItem( Event *ev );
|
||||
void Align( Event *ev );
|
||||
void TitleForegroundColor( Event *ev );
|
||||
void TitleBackgroundColor( Event *ev );
|
||||
void InactiveForegroundColor( Event *ev );
|
||||
void InactiveBackgroundColor( Event *ev );
|
||||
void ActiveForegroundColor( Event *ev );
|
||||
void ActiveBackgroundColor( Event *ev );
|
||||
void ActiveBorderColor( Event *ev );
|
||||
void HighlightForegroundColor( Event *ev );
|
||||
void HighlightBackgroundColor( Event *ev );
|
||||
void SelectForegroundColor( Event *ev );
|
||||
void SelectBackgroundColor( Event *ev );
|
||||
void ChangeSound( Event *ev );
|
||||
void ActiveSound( Event *ev );
|
||||
void EnterSound( Event *ev );
|
||||
bool Load(Script& script);
|
||||
void Header(Event *ev);
|
||||
void Width(Event *ev);
|
||||
void FillWidth(Event *ev);
|
||||
void Height(Event *ev);
|
||||
void CommandWidth(Event *ev);
|
||||
void CommandHeight(Event *ev);
|
||||
void PrimaryKeyWidth(Event *ev);
|
||||
void PrimaryKeyHeight(Event *ev);
|
||||
void AlternateKeyWidth(Event *ev);
|
||||
void AlternateKeyHeight(Event *ev);
|
||||
void NewItem(Event *ev);
|
||||
void Align(Event *ev);
|
||||
void TitleForegroundColor(Event *ev);
|
||||
void TitleBackgroundColor(Event *ev);
|
||||
void InactiveForegroundColor(Event *ev);
|
||||
void InactiveBackgroundColor(Event *ev);
|
||||
void ActiveForegroundColor(Event *ev);
|
||||
void ActiveBackgroundColor(Event *ev);
|
||||
void ActiveBorderColor(Event *ev);
|
||||
void HighlightForegroundColor(Event *ev);
|
||||
void HighlightBackgroundColor(Event *ev);
|
||||
void SelectForegroundColor(Event *ev);
|
||||
void SelectBackgroundColor(Event *ev);
|
||||
void ChangeSound(Event *ev);
|
||||
void ActiveSound(Event *ev);
|
||||
void EnterSound(Event *ev);
|
||||
};
|
||||
|
||||
#endif
|
||||
bool CL_LoadBind(const char* filename, bind_t* bind);
|
||||
+209
-27
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -22,72 +22,254 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "cl_ui.h"
|
||||
|
||||
CLASS_DECLARATION( USignal, FilePickerClass, NULL )
|
||||
class FilePickerItem : public UIListCtrlItem
|
||||
{
|
||||
{ NULL, NULL }
|
||||
str strings[3];
|
||||
|
||||
public:
|
||||
FilePickerItem(const str& fileName, const str& date, const str& size);
|
||||
int getListItemValue(int which) const override;
|
||||
griditemtype_t getListItemType(int which) const override;
|
||||
str getListItemString(int which) const override;
|
||||
void DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) override;
|
||||
qboolean IsHeaderEntry() const override;
|
||||
};
|
||||
|
||||
CLASS_DECLARATION(USignal, FilePickerClass, NULL) {
|
||||
{&EV_UIListBase_ItemSelected, &FilePickerClass::FileSelected },
|
||||
{&EV_UIListBase_ItemDoubleClicked, &FilePickerClass::FileChosen },
|
||||
{&W_Deactivated, &FilePickerClass::OnDeactivated},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
FilePickerClass::FilePickerClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
window = new UIFloatingWindow();
|
||||
window->Create(
|
||||
NULL,
|
||||
UIRect2D((cls.glconfig.vidWidth - 400) / 2, (cls.glconfig.vidHeight - 300) / 2, 400, 300),
|
||||
"File Picker",
|
||||
UColor(0.15f, 0.195f, 0.278f),
|
||||
UHudColor
|
||||
);
|
||||
window->Connect(this, W_Deactivated, W_Deactivated);
|
||||
listbox = new UIListCtrl();
|
||||
listbox->InitFrame(window->getChildSpace(), window->getChildSpace()->getClientFrame(), 0);
|
||||
listbox->setBackgroundColor(UColor(0.02f, 0.07f, 0.005f), true);
|
||||
listbox->setForegroundColor(UHudColor);
|
||||
listbox->AddColumn("File Name", 0, 175, false, false);
|
||||
listbox->AddColumn("Date", 1, 125, false, false);
|
||||
listbox->AddColumn("Size", 2, 100, true, false);
|
||||
|
||||
listbox->Connect(this, EV_UIListBase_ItemDoubleClicked, EV_UIListBase_ItemDoubleClicked);
|
||||
listbox->Connect(this, EV_UIListBase_ItemSelected, EV_UIListBase_ItemSelected);
|
||||
listbox->AllowActivate(true);
|
||||
|
||||
// Added in 2.0
|
||||
// Don't localize elements
|
||||
listbox->SetDontLocalize();
|
||||
}
|
||||
|
||||
FilePickerClass::~FilePickerClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
if (listbox) {
|
||||
delete listbox;
|
||||
listbox = NULL;
|
||||
}
|
||||
|
||||
if (window) {
|
||||
delete window;
|
||||
window = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void FilePickerClass::SetupFiles( void )
|
||||
void FilePickerClass::Setup(
|
||||
const char *root_directory, const char *current_directory, const char *ext, const char *ignore_files
|
||||
)
|
||||
{
|
||||
// FIXME: stub
|
||||
Initialize(root_directory, current_directory, ext, ignore_files);
|
||||
}
|
||||
|
||||
void FilePickerClass::GotoParentDirectory( void )
|
||||
void FilePickerClass::Initialize(
|
||||
const char *root_directory, const char *current_directory, const char *ext, const char *ignore_files
|
||||
)
|
||||
{
|
||||
// FIXME: stub
|
||||
rootDirectory = root_directory;
|
||||
if (rootDirectory.length() > 1 && rootDirectory[rootDirectory.length() - 1] != '/') {
|
||||
rootDirectory += "/";
|
||||
}
|
||||
|
||||
currentDirectory = current_directory;
|
||||
if (currentDirectory.length() > 1 && currentDirectory[currentDirectory.length() - 1] != '/') {
|
||||
currentDirectory += "/";
|
||||
}
|
||||
|
||||
extension = ext;
|
||||
ignoredFiles = ignore_files;
|
||||
|
||||
SetupFiles();
|
||||
}
|
||||
|
||||
void FilePickerClass::GotoSubDirectory( str subdir )
|
||||
void FilePickerClass::GotoParentDirectory(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
int i;
|
||||
|
||||
if (currentDirectory == rootDirectory) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = currentDirectory.length() - 2; i > 0; i--) {
|
||||
if (currentDirectory[i] == '/') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentDirectory[i] == '/') {
|
||||
i++;
|
||||
}
|
||||
|
||||
currentDirectory = str(currentDirectory, 0, i);
|
||||
|
||||
// refresh files
|
||||
SetupFiles();
|
||||
}
|
||||
|
||||
void FilePickerClass::Initialize( const char *root_directory, const char *current_directory, const char *ext )
|
||||
void FilePickerClass::GotoSubDirectory(str subdir)
|
||||
{
|
||||
// FIXME: stub
|
||||
currentDirectory += subdir + "/";
|
||||
|
||||
// refresh files
|
||||
SetupFiles();
|
||||
}
|
||||
|
||||
void FilePickerClass::CloseWindow( void )
|
||||
void FilePickerClass::SetupFiles(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
str mappath;
|
||||
str work;
|
||||
char **filenames;
|
||||
int numfiles;
|
||||
int i;
|
||||
char date[128];
|
||||
char size[128];
|
||||
|
||||
listbox->DeleteAllItems();
|
||||
|
||||
if (currentDirectory != rootDirectory) {
|
||||
// create the parent directory item
|
||||
listbox->AddItem(new FilePickerItem("..", "", ""));
|
||||
}
|
||||
|
||||
// retrieve directories
|
||||
filenames = FS_ListFiles(currentDirectory, "/", qfalse, &numfiles);
|
||||
|
||||
for (i = 0; i < numfiles; i++) {
|
||||
const char *filename = filenames[i];
|
||||
|
||||
if (filename[0] == '.' || !strlen(filename)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
work = "[";
|
||||
work += filename;
|
||||
work += "]";
|
||||
|
||||
FS_FileTime(currentDirectory + filename, date, size);
|
||||
|
||||
listbox->AddItem(new FilePickerItem(work, date, size));
|
||||
}
|
||||
|
||||
FS_FreeFileList(filenames);
|
||||
|
||||
filenames = FS_ListFiles(currentDirectory, extension, qfalse, &numfiles);
|
||||
|
||||
for (i = 0; i < numfiles; i++) {
|
||||
const char *filename = filenames[i];
|
||||
|
||||
if (ignoredFiles.length() && strstr(filename, ignoredFiles)) {
|
||||
// Added in 2.0
|
||||
// Check for ignored files
|
||||
continue;
|
||||
}
|
||||
|
||||
work = filename;
|
||||
|
||||
FS_FileTime(currentDirectory + work, date, size);
|
||||
|
||||
listbox->AddItem(new FilePickerItem(work, date, size));
|
||||
}
|
||||
|
||||
FS_FreeFileList(filenames);
|
||||
|
||||
window->setTitle(currentDirectory);
|
||||
}
|
||||
|
||||
void FilePickerClass::FileSelected( Event *ev )
|
||||
void FilePickerClass::FileSelected(const str& currentDirectory, const str& partialName, const str& fullname) {}
|
||||
|
||||
void FilePickerClass::FileSelected(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
str name = listbox->GetItem(listbox->getCurrentItem())->getListItemString(0);
|
||||
|
||||
if (*name != '[' && *name != '.') {
|
||||
FileSelected(currentDirectory, name, currentDirectory + name);
|
||||
}
|
||||
|
||||
uii.Snd_PlaySound("sound/menu/scroll.wav");
|
||||
}
|
||||
|
||||
void FilePickerClass::FileSelected( str ¤tDirectory, str &partialName, str &fullname )
|
||||
void FilePickerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) {}
|
||||
|
||||
void FilePickerClass::FileChosen(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
str filename = listbox->GetItem(listbox->getCurrentItem())->getListItemString(0);
|
||||
|
||||
if (*filename == '[') {
|
||||
uii.Snd_PlaySound("sound/menu/scroll.wav");
|
||||
|
||||
GotoSubDirectory(str(filename, 1, filename.length() - 1));
|
||||
} else if (*filename == '.') {
|
||||
GotoParentDirectory();
|
||||
} else {
|
||||
uii.Snd_PlaySound("sound/menu/apply.wav");
|
||||
|
||||
FileChosen(currentDirectory, filename, currentDirectory + filename);
|
||||
}
|
||||
}
|
||||
|
||||
void FilePickerClass::FileChosen( Event *ev )
|
||||
void FilePickerClass::CloseWindow(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
PostEvent(EV_Remove, 0);
|
||||
}
|
||||
|
||||
void FilePickerClass::FileChosen( str ¤tDirectory, str &partialName, str &fullname )
|
||||
void FilePickerClass::OnDeactivated(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
void FilePickerClass::OnDeactivated( Event *ev )
|
||||
FilePickerItem::FilePickerItem(const str& fileName, const str& date, const str& size)
|
||||
{
|
||||
// FIXME: stub
|
||||
strings[0] = fileName;
|
||||
strings[1] = date;
|
||||
strings[2] = size;
|
||||
}
|
||||
|
||||
void FilePickerClass::Setup( const char *root_directory, const char *current_directory, const char *ext )
|
||||
int FilePickerItem::getListItemValue(int which) const
|
||||
{
|
||||
// FIXME: stub
|
||||
return atoi(strings[which]);
|
||||
}
|
||||
|
||||
griditemtype_t FilePickerItem::getListItemType(int which) const
|
||||
{
|
||||
return griditemtype_t::TYPE_STRING;
|
||||
}
|
||||
|
||||
str FilePickerItem::getListItemString(int which) const
|
||||
{
|
||||
return strings[which];
|
||||
}
|
||||
|
||||
void FilePickerItem::DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) {}
|
||||
|
||||
qboolean FilePickerItem::IsHeaderEntry() const
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,40 +20,41 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UIFILEPICKER_H__
|
||||
#define __CL_UIFILEPICKER_H__
|
||||
#pragma once
|
||||
|
||||
class UIListCtrl;
|
||||
|
||||
class FilePickerClass : public USignal {
|
||||
UIFloatingWindow *window;
|
||||
UIListCtrl *listbox;
|
||||
str currentDirectory;
|
||||
str rootDirectory;
|
||||
str extension;
|
||||
class FilePickerClass : public USignal
|
||||
{
|
||||
UIFloatingWindow *window;
|
||||
UIListCtrl *listbox;
|
||||
str currentDirectory;
|
||||
str rootDirectory;
|
||||
str extension;
|
||||
// Added in 2.0
|
||||
str ignoredFiles;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( FilePickerClass );
|
||||
CLASS_PROTOTYPE(FilePickerClass);
|
||||
|
||||
private:
|
||||
void SetupFiles( void );
|
||||
void GotoParentDirectory( void );
|
||||
void GotoSubDirectory( str subdir );
|
||||
void Initialize( const char *root_directory, const char *current_directory, const char *ext );
|
||||
void SetupFiles(void);
|
||||
void GotoParentDirectory(void);
|
||||
void GotoSubDirectory(str subdir);
|
||||
// ignore_files parameter, added in 2.0
|
||||
void Initialize(const char *root_directory, const char *current_directory, const char *ext, const char* ignore_files);
|
||||
|
||||
protected:
|
||||
void CloseWindow( void );
|
||||
void FileSelected( Event *ev );
|
||||
virtual void FileSelected( str ¤tDirectory, str &partialName, str &fullname );
|
||||
void FileChosen( Event *ev );
|
||||
virtual void FileChosen( str ¤tDirectory, str &partialName, str &fullname );
|
||||
void OnDeactivated( Event *ev );
|
||||
void CloseWindow(void);
|
||||
void FileSelected(Event *ev);
|
||||
virtual void FileSelected(const str& currentDirectory, const str& partialName, const str& fullname);
|
||||
void FileChosen(Event *ev);
|
||||
virtual void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname);
|
||||
void OnDeactivated(Event *ev);
|
||||
|
||||
public:
|
||||
FilePickerClass();
|
||||
~FilePickerClass();
|
||||
FilePickerClass();
|
||||
~FilePickerClass();
|
||||
|
||||
void Setup( const char *root_directory, const char *current_directory, const char *ext );
|
||||
void Setup(const char *root_directory, const char *current_directory, const char *ext, const char* ignore_files = NULL);
|
||||
};
|
||||
|
||||
#endif /* __CL_UIFILEPICKER_H__ */
|
||||
+183
-17
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -21,44 +21,210 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "cl_ui.h"
|
||||
#include "../qcommon/localization.h"
|
||||
|
||||
CLASS_DECLARATION( UIListCtrl, UILANGameClass, NULL )
|
||||
class LANGameItem : public UIListCtrlItem
|
||||
{
|
||||
{ NULL, NULL }
|
||||
str strings[5];
|
||||
|
||||
public:
|
||||
LANGameItem();
|
||||
LANGameItem(
|
||||
const str& hostName, const str& mapName, const str& players, const str& gameTypeString, const str& ping
|
||||
);
|
||||
|
||||
int getListItemValue(int which) const override;
|
||||
griditemtype_t getListItemType(int which) const override;
|
||||
str getListItemString(int which) const override;
|
||||
void DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) override;
|
||||
qboolean IsHeaderEntry() const override;
|
||||
};
|
||||
|
||||
Event EV_LANGame_JoinGame
|
||||
(
|
||||
"joingame",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
"Join the currently selected server"
|
||||
);
|
||||
|
||||
CLASS_DECLARATION(UIListCtrl, UILANGameClass, NULL) {
|
||||
{&EV_UIListBase_ItemSelected, &UILANGameClass::SelectServer},
|
||||
{&EV_UIListBase_ItemDoubleClicked, &UILANGameClass::JoinServer },
|
||||
{&EV_LANGame_JoinGame, &UILANGameClass::JoinServer },
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
UILANGameClass::UILANGameClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
Connect(this, EV_UIListBase_ItemDoubleClicked, EV_UIListBase_ItemDoubleClicked);
|
||||
Connect(this, EV_UIListBase_ItemSelected, EV_UIListBase_ItemSelected);
|
||||
AllowActivate(true);
|
||||
setHeaderFont("facfont-20");
|
||||
|
||||
m_iLastUpdateTime = 0;
|
||||
m_noservers_mat = uWinMan.RegisterShader("textures/menu/noservers");
|
||||
}
|
||||
|
||||
void UILANGameClass::SetupServers( void )
|
||||
void UILANGameClass::Draw(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
if (cls.bNewLocalServerInfo) {
|
||||
SetupServers();
|
||||
}
|
||||
|
||||
UIListCtrl::Draw();
|
||||
|
||||
if (!getNumItems() && m_noservers_mat) {
|
||||
float x, y, w, h;
|
||||
|
||||
w = re.GetShaderWidth(m_noservers_mat->GetMaterial()) * m_vVirtualScale[0];
|
||||
h = re.GetShaderHeight(m_noservers_mat->GetMaterial()) * m_vVirtualScale[1];
|
||||
|
||||
UIRect2D frame = getClientFrame();
|
||||
x = (frame.size.width - w) * 0.5f;
|
||||
y = (frame.size.height - h) * 0.5f;
|
||||
|
||||
re.DrawStretchPic(x, y, w, h, 0, 0, 1, 1, m_noservers_mat->GetMaterial());
|
||||
}
|
||||
|
||||
if (m_iLastUpdateTime && m_iLastUpdateTime < cls.realtime) {
|
||||
Cvar_Set("cl_langamerefreshstatus", "Ready");
|
||||
m_iLastUpdateTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void UILANGameClass::Draw( void )
|
||||
void UILANGameClass::UpdateUIElement(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
float width;
|
||||
|
||||
RemoveAllColumns();
|
||||
|
||||
width = getClientFrame().size.width - 16.f;
|
||||
|
||||
AddColumn(Sys_LV_CL_ConvertString("Server Name"), 0, width * 0.4f, false, false);
|
||||
AddColumn(Sys_LV_CL_ConvertString("Map"), 1, width * 0.15f, false, false);
|
||||
AddColumn(Sys_LV_CL_ConvertString("Players"), 2, width * 0.165f, true, true);
|
||||
AddColumn(Sys_LV_CL_ConvertString("GameType"), 3, width * 0.22f, false, false);
|
||||
AddColumn(Sys_LV_CL_ConvertString("Ping"), 4, width * 0.065f, true, false);
|
||||
|
||||
uWinMan.ActivateControl(this);
|
||||
|
||||
SetupServers();
|
||||
}
|
||||
|
||||
void UILANGameClass::SelectServer( Event *ev )
|
||||
void UILANGameClass::SetupServers(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
int i;
|
||||
LANGameItem *pItem;
|
||||
const serverInfo_t *pServerInfo;
|
||||
|
||||
for (i = 1; i <= cls.numlocalservers; i++) {
|
||||
pServerInfo = &cls.localServers[i - 1];
|
||||
|
||||
if (i > getNumItems()) {
|
||||
pItem = new LANGameItem();
|
||||
AddItem(pItem);
|
||||
} else {
|
||||
pItem = static_cast<LANGameItem *>(GetItem(i));
|
||||
}
|
||||
|
||||
*pItem = LANGameItem(
|
||||
pServerInfo->hostName,
|
||||
pServerInfo->mapName,
|
||||
va("%02i/%02i", pServerInfo->clients, pServerInfo->maxClients),
|
||||
pServerInfo->gameTypeString,
|
||||
str(pServerInfo->ping)
|
||||
);
|
||||
}
|
||||
|
||||
while (cls.numlocalservers < getNumItems()) {
|
||||
DeleteItem(getNumItems());
|
||||
}
|
||||
|
||||
cls.bNewLocalServerInfo = false;
|
||||
m_iLastUpdateTime = 0;
|
||||
}
|
||||
|
||||
void UILANGameClass::JoinServer( Event *ev )
|
||||
void UILANGameClass::SelectServer(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
const serverInfo_t& serverInfo = cls.localServers[getCurrentItem() - 1];
|
||||
static const char info[] = "\xFF\xFF\xFF\xFF\x02getinfo xxx";
|
||||
|
||||
Com_Printf("Requesting updated info from server...\n");
|
||||
Cvar_Set("cl_langamerefreshstatus", "Requesting updated info from server...");
|
||||
|
||||
NET_SendPacket(NS_CLIENT, sizeof(info), info, serverInfo.adr);
|
||||
m_iLastUpdateTime = cls.realtime + 3000;
|
||||
}
|
||||
|
||||
qboolean UILANGameClass::KeyEvent( int key, unsigned int time )
|
||||
void UILANGameClass::JoinServer(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
return qfalse;
|
||||
if (!getCurrentItem()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const serverInfo_t& serverInfo = cls.localServers[getCurrentItem() - 1];
|
||||
|
||||
UI_SetReturnMenuToCurrent();
|
||||
CL_Connect(NET_AdrToString(serverInfo.adr), netadrtype_t::NA_UNSPEC);
|
||||
}
|
||||
|
||||
void UILANGameClass::UpdateUIElement( void )
|
||||
qboolean UILANGameClass::KeyEvent(int key, unsigned int time)
|
||||
{
|
||||
// FIXME: stub
|
||||
switch (key) {
|
||||
case K_ENTER:
|
||||
case K_KP_ENTER:
|
||||
JoinServer(NULL);
|
||||
return true;
|
||||
case K_UPARROW:
|
||||
if (getCurrentItem() > 1) {
|
||||
TrySelectItem(getCurrentItem() - 1);
|
||||
SelectServer(NULL);
|
||||
}
|
||||
return false;
|
||||
case K_DOWNARROW:
|
||||
if (getCurrentItem() < getNumItems()) {
|
||||
TrySelectItem(getCurrentItem() + 1);
|
||||
SelectServer(NULL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return UIListBase::KeyEvent(key, time);
|
||||
}
|
||||
|
||||
LANGameItem::LANGameItem() {}
|
||||
|
||||
LANGameItem::LANGameItem(
|
||||
const str& hostName, const str& mapName, const str& players, const str& gameTypeString, const str& ping
|
||||
)
|
||||
{
|
||||
strings[0] = hostName;
|
||||
strings[1] = mapName;
|
||||
strings[2] = players;
|
||||
strings[3] = gameTypeString;
|
||||
strings[4] = ping;
|
||||
}
|
||||
|
||||
int LANGameItem::getListItemValue(int which) const
|
||||
{
|
||||
return atoi(strings[which]);
|
||||
}
|
||||
|
||||
griditemtype_t LANGameItem::getListItemType(int which) const
|
||||
{
|
||||
return griditemtype_t::TYPE_STRING;
|
||||
}
|
||||
|
||||
str LANGameItem::getListItemString(int which) const
|
||||
{
|
||||
return strings[which];
|
||||
}
|
||||
|
||||
void LANGameItem::DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) {}
|
||||
|
||||
qboolean LANGameItem::IsHeaderEntry() const
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
+14
-16
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,29 +20,27 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UILANGAME_H__
|
||||
#define __CL_UILANGAME_H__
|
||||
#pragma once
|
||||
|
||||
class UILANGameClass : public UIListCtrl {
|
||||
class UILANGameClass : public UIListCtrl
|
||||
{
|
||||
protected:
|
||||
int m_iLastUpdateTime;
|
||||
UIReggedMaterial *m_noservers_mat;
|
||||
int m_iLastUpdateTime;
|
||||
UIReggedMaterial *m_noservers_mat;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( UILANGameClass );
|
||||
CLASS_PROTOTYPE(UILANGameClass);
|
||||
|
||||
private:
|
||||
void SetupServers( void );
|
||||
void SetupServers(void);
|
||||
|
||||
protected:
|
||||
void Draw( void ) override;
|
||||
void SelectServer( Event *ev );
|
||||
void JoinServer( Event *ev );
|
||||
qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
void UpdateUIElement( void ) override;
|
||||
void Draw(void) override;
|
||||
void SelectServer(Event *ev);
|
||||
void JoinServer(Event *ev);
|
||||
qboolean KeyEvent(int key, unsigned int time) override;
|
||||
void UpdateUIElement(void) override;
|
||||
|
||||
public:
|
||||
UILANGameClass();
|
||||
UILANGameClass();
|
||||
};
|
||||
|
||||
#endif /* __CL_UILANGAME_H__ */
|
||||
+319
-25
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -21,63 +21,357 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "cl_ui.h"
|
||||
#include "../qcommon/localization.h"
|
||||
|
||||
CLASS_DECLARATION( UIListCtrl, UIFAKKLoadGameClass, NULL )
|
||||
class FAKKLoadGameItem : public UIListCtrlItem
|
||||
{
|
||||
{ NULL, NULL }
|
||||
str strings[4];
|
||||
|
||||
public:
|
||||
FAKKLoadGameItem(const str& missionName, const str& elapsedTime, const str& dateTime, const str& fileName);
|
||||
|
||||
int getListItemValue(int which) const override;
|
||||
griditemtype_t getListItemType(int which) const override;
|
||||
str getListItemString(int which) const override;
|
||||
void DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) override;
|
||||
qboolean IsHeaderEntry() const override;
|
||||
};
|
||||
|
||||
static UIFAKKLoadGameClass *loadgame_ui = NULL;
|
||||
|
||||
Event EV_FAKKLoadGame_LoadGame
|
||||
(
|
||||
"loadgame",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
"Load the currently selected game"
|
||||
);
|
||||
Event EV_FAKKLoadGame_RemoveGame
|
||||
(
|
||||
"removegame",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
"Delete the currently selected game"
|
||||
);
|
||||
Event EV_FAKKLoadGame_DeleteGame
|
||||
(
|
||||
"deletegame",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
"Delete the currently selected game... for real"
|
||||
);
|
||||
Event EV_FAKKLoadGame_NoDeleteGame
|
||||
(
|
||||
"nodeletegame",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
"Delete the currently selected game... for real"
|
||||
);
|
||||
Event EV_FAKKLoadGame_SaveGame
|
||||
(
|
||||
"savegame",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
"Save the currently selected game"
|
||||
);
|
||||
|
||||
CLASS_DECLARATION(UIListCtrl, UIFAKKLoadGameClass, NULL) {
|
||||
{&EV_UIListBase_ItemSelected, &UIFAKKLoadGameClass::SelectGame },
|
||||
{&EV_UIListBase_ItemDoubleClicked, &UIFAKKLoadGameClass::LoadGame },
|
||||
{&EV_FAKKLoadGame_RemoveGame, &UIFAKKLoadGameClass::RemoveGame },
|
||||
{&EV_FAKKLoadGame_DeleteGame, &UIFAKKLoadGameClass::DeleteGame },
|
||||
{&EV_FAKKLoadGame_NoDeleteGame, &UIFAKKLoadGameClass::NoDeleteGame},
|
||||
{&EV_FAKKLoadGame_LoadGame, &UIFAKKLoadGameClass::LoadGame },
|
||||
{&EV_FAKKLoadGame_SaveGame, &UIFAKKLoadGameClass::SaveGame },
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
UIFAKKLoadGameClass::UIFAKKLoadGameClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
Connect(this, EV_UIListBase_ItemDoubleClicked, EV_UIListBase_ItemDoubleClicked);
|
||||
Connect(this, EV_UIListBase_ItemSelected, EV_UIListBase_ItemSelected);
|
||||
AllowActivate(false);
|
||||
m_bRemovePending = false;
|
||||
|
||||
setHeaderFont("facfont-20");
|
||||
loadgame_ui = this;
|
||||
}
|
||||
|
||||
void UIFAKKLoadGameClass::SelectGame( Event *ev )
|
||||
UIFAKKLoadGameClass::~UIFAKKLoadGameClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
loadgame_ui = NULL;
|
||||
}
|
||||
|
||||
void UIFAKKLoadGameClass::LoadGame( Event *ev )
|
||||
void UIFAKKLoadGameClass::UpdateUIElement(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
float width;
|
||||
|
||||
RemoveAllColumns();
|
||||
|
||||
width = getClientFrame().size.width;
|
||||
AddColumn(Sys_LV_CL_ConvertString("Mission"), 0, width * 0.555, false, false);
|
||||
AddColumn(Sys_LV_CL_ConvertString("Elapsed Time"), 1, width * 0.17f, true, true);
|
||||
AddColumn(Sys_LV_CL_ConvertString("Date & Time Logged"), 2, width * 0.275f, true, true);
|
||||
|
||||
uWinMan.ActivateControl(this);
|
||||
|
||||
SetupFiles();
|
||||
}
|
||||
|
||||
void UIFAKKLoadGameClass::SaveGame( Event *ev )
|
||||
void UIFAKKLoadGameClass::SetupFiles(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
char **filenames;
|
||||
int numfiles;
|
||||
int i;
|
||||
const char *searchFolder = Com_GetArchiveFolder();
|
||||
|
||||
// cleanup
|
||||
DeleteAllItems();
|
||||
|
||||
filenames = FS_ListFiles(searchFolder, "ssv", qfalse, &numfiles);
|
||||
|
||||
for (i = 0; i < numfiles; i++) {
|
||||
const char *filename;
|
||||
str work;
|
||||
str gametime;
|
||||
str date;
|
||||
fileHandle_t f;
|
||||
savegamestruct_t save;
|
||||
|
||||
filename = filenames[i];
|
||||
work = searchFolder;
|
||||
work += "/";
|
||||
work += filename;
|
||||
|
||||
FS_FOpenFileRead(work, &f, qfalse, qtrue);
|
||||
if (!f) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FS_Read(&save, sizeof(savegamestruct_t), f);
|
||||
FS_FCloseFile(f);
|
||||
Com_SwapSaveStruct(&save);
|
||||
|
||||
if (save.version != SAVEGAME_STRUCT_VERSION) {
|
||||
// wrong save game version
|
||||
continue;
|
||||
}
|
||||
|
||||
if (save.type != com_target_game->integer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
gametime = (save.mapTime / 1000);
|
||||
date = save.time;
|
||||
|
||||
AddItem(new FAKKLoadGameItem(save.comment, gametime, date, save.saveName));
|
||||
}
|
||||
|
||||
FS_FreeFileList(filenames);
|
||||
|
||||
// sort by date
|
||||
SortByColumn(2);
|
||||
|
||||
// select the first item
|
||||
TrySelectItem(1);
|
||||
SelectGame(NULL);
|
||||
}
|
||||
|
||||
void UIFAKKLoadGameClass::RemoveGame( Event *ev )
|
||||
void UIFAKKLoadGameClass::SelectGame(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
UIWidget *wid;
|
||||
const char *shotName;
|
||||
|
||||
if (getCurrentItem() > 0) {
|
||||
shotName = Com_GetArchiveFileName(GetItem(getCurrentItem())->getListItemString(3), "tga");
|
||||
} else {
|
||||
shotName = "textures/menu/no_saved_games.tga";
|
||||
}
|
||||
|
||||
wid = findSibling("LoadSaveShot");
|
||||
if (!wid) {
|
||||
return;
|
||||
}
|
||||
|
||||
wid->setMaterial(uWinMan.RefreshShader(shotName));
|
||||
}
|
||||
|
||||
void UIFAKKLoadGameClass::DeleteGame( Event *ev )
|
||||
void UIFAKKLoadGameClass::RemoveGame(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
if (m_bRemovePending || getCurrentItem() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Cbuf_ExecuteText(
|
||||
EXEC_NOW,
|
||||
"dialog \"\" \"\" \"widgetcommand LoadSaveList deletegame\" \"widgetcommand LoadSaveList nodeletegame\" 256 64 "
|
||||
"confirm_delete menu_button_trans menu_button_trans\n"
|
||||
);
|
||||
m_bRemovePending = true;
|
||||
}
|
||||
|
||||
void UIFAKKLoadGameClass::NoDeleteGame( Event *ev )
|
||||
void UIFAKKLoadGameClass::NoDeleteGame(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
m_bRemovePending = false;
|
||||
}
|
||||
|
||||
qboolean UIFAKKLoadGameClass::KeyEvent( int key, unsigned int time )
|
||||
void UIFAKKLoadGameClass::DeleteGame(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
return qfalse;
|
||||
str name;
|
||||
cvar_t *var;
|
||||
m_bRemovePending = false;
|
||||
|
||||
if (getCurrentItem() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = GetItem(getCurrentItem())->getListItemString(3);
|
||||
var = Cvar_Get("g_lastsave", "", 0);
|
||||
|
||||
if (!strcmp(name, var->string)) {
|
||||
// Make sure the last save is not the save being deleted
|
||||
Cvar_Set("g_lastsave", "");
|
||||
}
|
||||
|
||||
Com_WipeSavegame(name);
|
||||
SetupFiles();
|
||||
}
|
||||
|
||||
void UIFAKKLoadGameClass::UpdateUIElement( void )
|
||||
void UIFAKKLoadGameClass::LoadGame(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
char cmdString[266];
|
||||
str name;
|
||||
|
||||
if (getCurrentItem() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = GetItem(getCurrentItem())->getListItemString(3);
|
||||
// Execute the command
|
||||
Com_sprintf(cmdString, sizeof(cmdString), "loadgame %s\n", name.c_str());
|
||||
Cbuf_AddText(cmdString);
|
||||
}
|
||||
|
||||
void UIFAKKLoadGameClass::SetupFiles( void )
|
||||
void UIFAKKLoadGameClass::SaveGame(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
Cbuf_ExecuteText(EXEC_NOW, "savegame");
|
||||
}
|
||||
|
||||
void UI_SetupFiles( void ) {
|
||||
// FIXME: stub
|
||||
qboolean UIFAKKLoadGameClass::KeyEvent(int key, unsigned int time)
|
||||
{
|
||||
switch (key) {
|
||||
case K_DEL:
|
||||
RemoveGame(NULL);
|
||||
return qtrue;
|
||||
case K_ENTER:
|
||||
case K_KP_ENTER:
|
||||
LoadGame(NULL);
|
||||
return qtrue;
|
||||
case K_UPARROW:
|
||||
if (getCurrentItem() > 1) {
|
||||
TrySelectItem(getCurrentItem() - 1);
|
||||
SelectGame(NULL);
|
||||
return qtrue;
|
||||
}
|
||||
break;
|
||||
case K_DOWNARROW:
|
||||
if (getCurrentItem() < getNumItems()) {
|
||||
TrySelectItem(getCurrentItem() + 1);
|
||||
SelectGame(NULL);
|
||||
return qtrue;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return UIListBase::KeyEvent(key, time);
|
||||
}
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
void UI_SetupFiles(void)
|
||||
{
|
||||
if (loadgame_ui && loadgame_ui->getShow()) {
|
||||
loadgame_ui->SetupFiles();
|
||||
}
|
||||
}
|
||||
|
||||
FAKKLoadGameItem::FAKKLoadGameItem(
|
||||
const str& missionName, const str& elapsedTime, const str& dateTime, const str& fileName
|
||||
)
|
||||
{
|
||||
strings[0] = missionName;
|
||||
strings[1] = elapsedTime;
|
||||
strings[2] = dateTime;
|
||||
strings[3] = fileName;
|
||||
}
|
||||
|
||||
int FAKKLoadGameItem::getListItemValue(int which) const
|
||||
{
|
||||
return atoi(strings[which]);
|
||||
}
|
||||
|
||||
griditemtype_t FAKKLoadGameItem::getListItemType(int which) const
|
||||
{
|
||||
return griditemtype_t::TYPE_STRING;
|
||||
}
|
||||
|
||||
str FAKKLoadGameItem::getListItemString(int which) const
|
||||
{
|
||||
str itemstring;
|
||||
|
||||
switch (which) {
|
||||
case 0:
|
||||
case 3:
|
||||
itemstring = strings[which];
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
int numseconds;
|
||||
int numseconds_hours;
|
||||
|
||||
// hours
|
||||
numseconds = atol(strings[1]);
|
||||
itemstring += (numseconds / 3600);
|
||||
itemstring += ":";
|
||||
|
||||
// minutes
|
||||
numseconds_hours = numseconds % 3600;
|
||||
if (numseconds_hours / 60 <= 9) {
|
||||
itemstring += "0";
|
||||
}
|
||||
itemstring += (numseconds_hours / 60);
|
||||
itemstring += ":";
|
||||
|
||||
// seconds
|
||||
if (numseconds_hours / 60 <= 9) {
|
||||
itemstring += "0";
|
||||
}
|
||||
itemstring += (numseconds_hours % 60);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
time_t time;
|
||||
char buffer[2048];
|
||||
|
||||
time = atol(strings[2]);
|
||||
strftime(buffer, sizeof(buffer), "%a %b %d %H:%M:%S %Y", localtime(&time));
|
||||
itemstring = buffer;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return itemstring;
|
||||
}
|
||||
|
||||
void FAKKLoadGameItem::DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) {}
|
||||
|
||||
qboolean FAKKLoadGameItem::IsHeaderEntry() const
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
+18
-28
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,38 +20,28 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UILOADSAVE_H__
|
||||
#define __CL_UILOADSAVE_H__
|
||||
#pragma once
|
||||
|
||||
class UIFAKKLoadGameClass : public UIListCtrl {
|
||||
bool m_bRemovePending;
|
||||
class UIFAKKLoadGameClass : public UIListCtrl
|
||||
{
|
||||
bool m_bRemovePending;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( UIFAKKLoadGameClass );
|
||||
CLASS_PROTOTYPE(UIFAKKLoadGameClass);
|
||||
|
||||
protected:
|
||||
void SelectGame( Event *ev );
|
||||
void LoadGame( Event *ev );
|
||||
void SaveGame( Event *ev );
|
||||
void RemoveGame( Event *ev );
|
||||
void DeleteGame( Event *ev );
|
||||
void NoDeleteGame( Event *ev );
|
||||
qboolean KeyEvent( int key, unsigned int time ) override;
|
||||
void UpdateUIElement( void ) override;
|
||||
void SelectGame(Event *ev);
|
||||
void LoadGame(Event *ev);
|
||||
void SaveGame(Event *ev);
|
||||
void RemoveGame(Event *ev);
|
||||
void DeleteGame(Event *ev);
|
||||
void NoDeleteGame(Event *ev);
|
||||
qboolean KeyEvent(int key, unsigned int time) override;
|
||||
void UpdateUIElement(void) override;
|
||||
|
||||
public:
|
||||
UIFAKKLoadGameClass();
|
||||
UIFAKKLoadGameClass();
|
||||
~UIFAKKLoadGameClass();
|
||||
|
||||
void SetupFiles( void );
|
||||
void SetupFiles(void);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void UI_SetupFiles( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,449 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "cl_ui.h"
|
||||
#include "cl_uimaprotationsetup.h"
|
||||
|
||||
Event EV_MapListBox_RefreshMapList
|
||||
(
|
||||
"RefreshMapList",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
"Refreshes the map list."
|
||||
);
|
||||
|
||||
Event EV_MapRotationListBox_RefreshRotationList
|
||||
(
|
||||
"RefreshRotationList",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
"Refreshed the map rotation list."
|
||||
);
|
||||
|
||||
CLASS_DECLARATION(UIListBox, UIMapRotationListBox, NULL) {
|
||||
{&EV_MapRotationListBox_RefreshRotationList, &UIMapRotationListBox::RefreshRotationList},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
UIMapRotationListBox::UIMapRotationListBox() {}
|
||||
|
||||
void UIMapRotationListBox::RefreshRotationList(Event *ev)
|
||||
{
|
||||
DeleteAllItems();
|
||||
PopulateRotationList();
|
||||
}
|
||||
|
||||
void UIMapRotationListBox::PopulateRotationList()
|
||||
{
|
||||
cvar_t *filter;
|
||||
cvar_t *maplistVar;
|
||||
const char *token;
|
||||
char mapBuffer[1024];
|
||||
|
||||
filter = Cvar_Get("g_maprotation_filter", "ffa", 0);
|
||||
if (!Q_stricmp(filter->string, "obj")) {
|
||||
maplistVar = Cvar_Get("ui_maplist_obj", "", 0);
|
||||
} else if (!Q_stricmp(filter->string, "tow")) {
|
||||
maplistVar = Cvar_Get("ui_maplist_tow", "", 0);
|
||||
} else if (!Q_stricmp(filter->string, "lib")) {
|
||||
maplistVar = Cvar_Get("ui_maplist_lib", "", 0);
|
||||
} else if (!Q_stricmp(filter->string, "team")) {
|
||||
maplistVar = Cvar_Get("ui_maplist_team", "", 0);
|
||||
} else if (!Q_stricmp(filter->string, "round")) {
|
||||
maplistVar = Cvar_Get("ui_maplist_round", "", 0);
|
||||
} else {
|
||||
maplistVar = Cvar_Get("ui_maplist_ffa", "", 0);
|
||||
}
|
||||
|
||||
strcpy(mapBuffer, maplistVar->string);
|
||||
|
||||
for (token = strtok(mapBuffer, " /"); token; token = strtok(NULL, " /")) {
|
||||
if (!Q_stricmp(token, "dm")) {
|
||||
continue;
|
||||
}
|
||||
if (!Q_stricmp(token, "obj")) {
|
||||
continue;
|
||||
}
|
||||
if (!Q_stricmp(token, "lib")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AddItem(token, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(UIListBox, UIMapListBox, NULL) {
|
||||
{&EV_MapListBox_RefreshMapList, &UIMapListBox::RefreshMapList},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
UIMapListBox::UIMapListBox() {}
|
||||
|
||||
void UIMapListBox::RefreshMapList(Event *ev)
|
||||
{
|
||||
DeleteAllItems();
|
||||
PopulateMapList();
|
||||
}
|
||||
|
||||
void UIMapListBox::PopulateMapList()
|
||||
{
|
||||
cvar_t *filter;
|
||||
char **filenames;
|
||||
int numfiles;
|
||||
str path;
|
||||
int i;
|
||||
bool bTugOfWar = false;
|
||||
bool bObjective = false;
|
||||
bool bLiberation = false;
|
||||
|
||||
filter = Cvar_Get("g_maprotation_filter", "ffa", 0);
|
||||
if (!Q_stricmp(filter->string, "lib")) {
|
||||
path = "maps/lib/";
|
||||
bLiberation = true;
|
||||
} else if (!Q_stricmp(filter->string, "obj") || !Q_stricmp(filter->string, "tow")) {
|
||||
path = "maps/obj/";
|
||||
if (!Q_stricmp(filter->string, "tow")) {
|
||||
bTugOfWar = true;
|
||||
} else {
|
||||
bObjective = true;
|
||||
}
|
||||
} else {
|
||||
path = "maps/dm/";
|
||||
}
|
||||
|
||||
filenames = FS_ListFiles(path, ".bsp", qfalse, &numfiles);
|
||||
|
||||
for (i = 0; i < numfiles; i++) {
|
||||
const char *filename = filenames[i];
|
||||
const char *token;
|
||||
char mapName[256];
|
||||
char tokenized[256];
|
||||
bool bHasMP = false;
|
||||
bool bHasTOW = false;
|
||||
bool bHasLib = false;
|
||||
|
||||
strcpy(mapName, filename);
|
||||
mapName[strlen(mapName) - 4] = 0;
|
||||
|
||||
if (!COM_IsMapValid(mapName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bTugOfWar || bLiberation) {
|
||||
strcpy(tokenized, mapName);
|
||||
|
||||
for (token = strtok(tokenized, "_"); token; token = strtok(NULL, "_")) {
|
||||
if (bLiberation) {
|
||||
if (!Q_stricmp(token, "MP")) {
|
||||
bHasMP = true;
|
||||
}
|
||||
if (!Q_stricmp(token, "LIB")) {
|
||||
bHasLib = true;
|
||||
}
|
||||
if (bHasMP && bHasLib) {
|
||||
AddItem(mapName, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bTugOfWar) {
|
||||
if (!Q_stricmp(token, "MP")) {
|
||||
bHasMP = true;
|
||||
}
|
||||
if (!Q_stricmp(token, "TOW")) {
|
||||
bHasTOW = true;
|
||||
}
|
||||
if (bHasMP && bHasTOW) {
|
||||
AddItem(mapName, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (bObjective) {
|
||||
strcpy(tokenized, mapName);
|
||||
|
||||
for (token = strtok(tokenized, "_"); token; token = strtok(NULL, "_")) {
|
||||
if (!Q_stricmp(token, "obj")) {
|
||||
AddItem(mapName, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Q_stricmp(mapName, "mp_ship_lib")) {
|
||||
AddItem(mapName, NULL);
|
||||
}
|
||||
} else {
|
||||
AddItem(mapName, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (bObjective) {
|
||||
path = "maps/lib/";
|
||||
|
||||
filenames = FS_ListFiles(path, ".bsp", qfalse, &numfiles);
|
||||
|
||||
for (i = 0; i < numfiles; i++) {
|
||||
const char *filename = filenames[i];
|
||||
const char *token;
|
||||
char mapName[256];
|
||||
char tokenized[256];
|
||||
|
||||
strcpy(mapName, filename);
|
||||
mapName[strlen(mapName) - 4] = 0;
|
||||
strcpy(tokenized, mapName);
|
||||
|
||||
token = strtok(tokenized, "_");
|
||||
if (!Q_stricmp(token, "obj") || !Q_stricmp(mapName, "mp_ship_lib")) {
|
||||
AddItem(mapName, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bTugOfWar && !bObjective && !bLiberation) {
|
||||
int type;
|
||||
|
||||
for (type = 0; type < 2; type++) {
|
||||
if (type == 0) {
|
||||
path = "maps/obj/";
|
||||
} else {
|
||||
path = "maps/lib/";
|
||||
}
|
||||
|
||||
filenames = FS_ListFiles(path, ".bsp", qfalse, &numfiles);
|
||||
|
||||
for (i = 0; i < numfiles; i++) {
|
||||
const char *filename = filenames[i];
|
||||
char mapName[256];
|
||||
|
||||
strcpy(mapName, filename);
|
||||
mapName[strlen(mapName) - 4] = 0;
|
||||
|
||||
if (!COM_IsMapValid(mapName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Q_stricmp(mapName, "obj_team2") || !Q_stricmp(mapName, "obj_team4")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AddItem(mapName, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(UIButton, UIAddToRotationButton, NULL) {
|
||||
{&W_LeftMouseUp, &UIAddToRotationButton::Released},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
void UIAddToRotationButton::Released(Event *ev)
|
||||
{
|
||||
UIListBox *mapList;
|
||||
UIListBox *rotationList;
|
||||
size_t prefixLength;
|
||||
int i;
|
||||
|
||||
mapList = static_cast<UIListBox *>(uWinMan.FindWidget("Map List"));
|
||||
rotationList = static_cast<UIListBox *>(uWinMan.FindWidget("Rotation List"));
|
||||
|
||||
if (Cvar_Get("g_maprotation_filter", "ffa", 0)) {
|
||||
prefixLength = strlen("obj/") + 1;
|
||||
} else {
|
||||
prefixLength = 1;
|
||||
}
|
||||
|
||||
if (mapList && rotationList) {
|
||||
size_t mapLength = 0;
|
||||
int item = mapList->getCurrentItem();
|
||||
|
||||
for (i = 1; i <= rotationList->getNumItems(); i++) {
|
||||
str text = rotationList->getItemText(i);
|
||||
|
||||
mapLength += text.length();
|
||||
}
|
||||
|
||||
if (item) {
|
||||
str text = mapList->getItemText(item);
|
||||
|
||||
if (prefixLength + mapLength + text.length() < 256) {
|
||||
rotationList->AddItem(text, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UIButtonBase::Released(ev);
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(UIButton, UIRemoveFromRotationButton, NULL) {
|
||||
{&W_LeftMouseUp, &UIRemoveFromRotationButton::Released},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
void UIRemoveFromRotationButton::Released(Event *ev)
|
||||
{
|
||||
UIListBox *list;
|
||||
|
||||
list = static_cast<UIListBox *>(uWinMan.FindWidget("Rotation List"));
|
||||
if (list) {
|
||||
list->DeleteItem(list->getCurrentItem());
|
||||
}
|
||||
|
||||
UIButtonBase::Released(ev);
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(UIButton, UIRotationApplyButton, NULL) {
|
||||
{&W_LeftMouseUp, &UIRotationApplyButton::Released},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
void UIRotationApplyButton::Released(Event *ev)
|
||||
{
|
||||
UIListBox *list;
|
||||
cvar_t *filter;
|
||||
str cvarName;
|
||||
str maplistStr;
|
||||
int i;
|
||||
bool bObjective = false;
|
||||
bool bLiberation = false;
|
||||
|
||||
filter = Cvar_Get("g_maprotation_filter", "ffa", 0);
|
||||
if (!Q_stricmp(filter->string, "obj")) {
|
||||
cvarName = "ui_maplist_obj";
|
||||
bObjective = true;
|
||||
} else if (!Q_stricmp(filter->string, "tow")) {
|
||||
cvarName = "ui_maplist_obj";
|
||||
bObjective = true;
|
||||
} else if (!Q_stricmp(filter->string, "lib")) {
|
||||
cvarName = "ui_maplist_lib";
|
||||
bLiberation = true;
|
||||
} else if (!Q_stricmp(filter->string, "team")) {
|
||||
cvarName = "ui_maplist_team";
|
||||
} else if (!Q_stricmp(filter->string, "round")) {
|
||||
cvarName = "ui_maplist_round";
|
||||
} else {
|
||||
cvarName = "ui_maplist_ffa";
|
||||
}
|
||||
Cvar_Set(cvarName, "");
|
||||
|
||||
list = static_cast<UIListBox *>(uWinMan.FindWidget("Rotation List"));
|
||||
if (list) {
|
||||
for (i = 1; i <= list->getNumItems(); i++) {
|
||||
const char *token;
|
||||
str text = list->getItemText(i);
|
||||
char map[256];
|
||||
bool bHasTOW = false, bHasObj = false, bHasLib = false, bHasShip = false;
|
||||
|
||||
strcpy(map, text);
|
||||
for (token = strtok(map, "_"); token; token = strtok(NULL, "_")) {
|
||||
if (!Q_stricmp(token, "TOW")) {
|
||||
bHasTOW = true;
|
||||
break;
|
||||
}
|
||||
if (!Q_stricmp(token, "obj")) {
|
||||
bHasObj = true;
|
||||
break;
|
||||
}
|
||||
if (!Q_stricmp(token, "lib")) {
|
||||
bHasLib = true;
|
||||
break;
|
||||
}
|
||||
if (!Q_stricmp(token, "ship")) {
|
||||
bHasShip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bHasShip) {
|
||||
maplistStr += "lib/";
|
||||
} else if (bObjective || bHasTOW || bHasObj) {
|
||||
maplistStr += "obj/";
|
||||
} else if (bHasLib || bLiberation) {
|
||||
maplistStr += "lib/";
|
||||
} else {
|
||||
maplistStr += "dm/";
|
||||
}
|
||||
|
||||
maplistStr += text;
|
||||
maplistStr += " ";
|
||||
|
||||
if (i == 1) {
|
||||
Cvar_Set("ui_dmmap", maplistStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Cvar_Set(cvarName, maplistStr);
|
||||
|
||||
UIButtonBase::Released(ev);
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(UIButton, UIRotationMoveItemUpButton, NULL) {
|
||||
{&W_LeftMouseUp, &UIRotationMoveItemUpButton::Released},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
void UIRotationMoveItemUpButton::Released(Event *ev)
|
||||
{
|
||||
UIListBox *list;
|
||||
int item;
|
||||
|
||||
list = static_cast<UIListBox *>(uWinMan.FindWidget("Rotation List"));
|
||||
item = list->getCurrentItem();
|
||||
|
||||
if (item < list->getNumItems() && list->getNumItems() > 1) {
|
||||
str text = list->getItemText(item + 1);
|
||||
|
||||
list->DeleteItem(list->getCurrentItem() - 1);
|
||||
list->InsertItem(text, item);
|
||||
list->setCurrentItem(item - 1);
|
||||
}
|
||||
|
||||
UIButtonBase::Released(ev);
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(UIButton, UIRotationMoveItemDownButton, NULL) {
|
||||
{&W_LeftMouseUp, &UIRotationMoveItemDownButton::Released},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
void UIRotationMoveItemDownButton::Released(Event *ev)
|
||||
{
|
||||
UIListBox *list;
|
||||
int item;
|
||||
|
||||
list = static_cast<UIListBox *>(uWinMan.FindWidget("Rotation List"));
|
||||
item = list->getCurrentItem();
|
||||
|
||||
if (item < list->getNumItems() && list->getNumItems() > 1) {
|
||||
str text = list->getItemText(item + 1);
|
||||
|
||||
list->DeleteItem(list->getCurrentItem() + 1);
|
||||
list->InsertItem(text, item);
|
||||
list->setCurrentItem(item + 1);
|
||||
}
|
||||
|
||||
UIButtonBase::Released(ev);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../uilib/uilistbox.h"
|
||||
|
||||
class UIMapRotationListBox : public UIListBox
|
||||
{
|
||||
CLASS_PROTOTYPE(UIMapRotationListBox);
|
||||
|
||||
public:
|
||||
UIMapRotationListBox();
|
||||
|
||||
void RefreshRotationList(Event *ev);
|
||||
void PopulateRotationList();
|
||||
};
|
||||
|
||||
class UIMapListBox : public UIListBox
|
||||
{
|
||||
CLASS_PROTOTYPE(UIMapListBox);
|
||||
|
||||
public:
|
||||
UIMapListBox();
|
||||
|
||||
void RefreshMapList(Event *ev);
|
||||
void PopulateMapList();
|
||||
};
|
||||
|
||||
class UIAddToRotationButton : public UIButton
|
||||
{
|
||||
CLASS_PROTOTYPE(UIAddToRotationButton);
|
||||
|
||||
public:
|
||||
void Released(Event *ev);
|
||||
};
|
||||
|
||||
class UIRemoveFromRotationButton : public UIButton
|
||||
{
|
||||
CLASS_PROTOTYPE(UIRemoveFromRotationButton);
|
||||
|
||||
public:
|
||||
void Released(Event *ev);
|
||||
};
|
||||
|
||||
class UIRotationApplyButton : public UIButton
|
||||
{
|
||||
CLASS_PROTOTYPE(UIRotationApplyButton);
|
||||
|
||||
public:
|
||||
void Released(Event *ev);
|
||||
};
|
||||
|
||||
class UIRotationMoveItemUpButton : public UIButton
|
||||
{
|
||||
CLASS_PROTOTYPE(UIRotationMoveItemUpButton);
|
||||
|
||||
public:
|
||||
void Released(Event *ev);
|
||||
};
|
||||
|
||||
class UIRotationMoveItemDownButton : public UIButton
|
||||
{
|
||||
CLASS_PROTOTYPE(UIRotationMoveItemDownButton);
|
||||
|
||||
public:
|
||||
void Released(Event *ev);
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023-2024 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -22,47 +22,107 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "cl_ui.h"
|
||||
|
||||
CLASS_DECLARATION( FilePickerClass, MapRunnerClass, NULL )
|
||||
{
|
||||
{ NULL, NULL }
|
||||
CLASS_DECLARATION(FilePickerClass, MapRunnerClass, NULL) {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void MapRunnerClass::FileChosen( str ¤tDirectory, str &partialName, str &fullname )
|
||||
void MapRunnerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname)
|
||||
{
|
||||
// FIXME: stub
|
||||
str newName;
|
||||
|
||||
newName = "spmap " + str(fullname, 5, fullname.length() - 4) + "\n";
|
||||
// insert the command
|
||||
Cbuf_AddText(newName);
|
||||
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
CLASS_DECLARATION( FilePickerClass, ViewSpawnerClass, NULL )
|
||||
{
|
||||
{ NULL, NULL }
|
||||
CLASS_DECLARATION(FilePickerClass, UIPickFileClass, NULL) {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void ViewSpawnerClass::FileChosen( str ¤tDirectory, str &partialName, str &fullname )
|
||||
UIPickFileClass::UIPickFileClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
retobj = NULL;
|
||||
retevent = NULL;
|
||||
}
|
||||
|
||||
CLASS_DECLARATION( FilePickerClass, LODSpawnerClass, NULL )
|
||||
UIPickFileClass::~UIPickFileClass()
|
||||
{
|
||||
{ NULL, NULL }
|
||||
if (retevent) {
|
||||
delete retevent;
|
||||
}
|
||||
}
|
||||
|
||||
void UIPickFileClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname)
|
||||
{
|
||||
if (!retobj || !retevent) {
|
||||
CloseWindow();
|
||||
return;
|
||||
}
|
||||
|
||||
retevent->AddString(fullname);
|
||||
retobj->ProcessEvent(retevent);
|
||||
|
||||
retevent = NULL;
|
||||
retobj = NULL;
|
||||
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
void PickFile(const char *name, Listener *obj, Event& event)
|
||||
{
|
||||
UIPickFileClass *picker;
|
||||
str currentpath;
|
||||
int i;
|
||||
|
||||
picker = new UIPickFileClass();
|
||||
picker->retevent = new Event(event);
|
||||
picker->retobj = obj;
|
||||
|
||||
if (name && *name && strchr(name, '/')) {
|
||||
currentpath = name;
|
||||
|
||||
for (i = currentpath.length(); i > 0; i--) {
|
||||
if (currentpath[i] == '/') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
currentpath = str(currentpath, 0, i + 1);
|
||||
} else {
|
||||
currentpath = "";
|
||||
}
|
||||
|
||||
picker->Setup("", currentpath, ".*", "");
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(FilePickerClass, ViewSpawnerClass, NULL) {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void LODSpawnerClass::FileChosen( str ¤tDirectory, str &partialName, str &fullname )
|
||||
void ViewSpawnerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname)
|
||||
{
|
||||
// FIXME: stub
|
||||
str newName;
|
||||
|
||||
newName = "viewspawn " + fullname + "\n";
|
||||
// insert the command
|
||||
Cbuf_AddText(newName);
|
||||
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
CLASS_DECLARATION( FilePickerClass, UIPickFileClass, NULL )
|
||||
{
|
||||
{ NULL, NULL }
|
||||
CLASS_DECLARATION(FilePickerClass, LODSpawnerClass, NULL) {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void UIPickFileClass::FileChosen( str ¤tDirectory, str &partialName, str &fullname )
|
||||
void LODSpawnerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname)
|
||||
{
|
||||
// FIXME: stub
|
||||
}
|
||||
str newName;
|
||||
|
||||
void PickFile( const char *name, Listener *obj, Event& event )
|
||||
{
|
||||
// FIXME: stub
|
||||
newName = "lod_spawn " + fullname + "\n";
|
||||
// insert the command
|
||||
Cbuf_AddText(newName);
|
||||
|
||||
CloseWindow();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,40 +20,44 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UIMAPRUNNER_H__
|
||||
#define __CL_UIMAPRUNNER_H__
|
||||
#pragma once
|
||||
|
||||
class MapRunnerClass : public FilePickerClass {
|
||||
class MapRunnerClass : public FilePickerClass
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE( MapRunnerClass );
|
||||
CLASS_PROTOTYPE(MapRunnerClass);
|
||||
|
||||
void FileChosen( str ¤tDirectory, str &partialName, str &fullname ) override;
|
||||
void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override;
|
||||
};
|
||||
|
||||
class ViewSpawnerClass : public FilePickerClass {
|
||||
class ViewSpawnerClass : public FilePickerClass
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE( ViewSpawnerClass );
|
||||
CLASS_PROTOTYPE(ViewSpawnerClass);
|
||||
|
||||
void FileChosen( str ¤tDirectory, str &partialName, str &fullname ) override;
|
||||
void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override;
|
||||
};
|
||||
|
||||
class LODSpawnerClass : public FilePickerClass {
|
||||
class LODSpawnerClass : public FilePickerClass
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE( LODSpawnerClass );
|
||||
CLASS_PROTOTYPE(LODSpawnerClass);
|
||||
|
||||
void FileChosen( str ¤tDirectory, str &partialName, str &fullname ) override;
|
||||
void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override;
|
||||
};
|
||||
|
||||
class UIPickFileClass : public FilePickerClass {
|
||||
class UIPickFileClass : public FilePickerClass
|
||||
{
|
||||
public:
|
||||
Listener *retobj;
|
||||
Event *retevent;
|
||||
Listener *retobj;
|
||||
Event *retevent;
|
||||
|
||||
CLASS_PROTOTYPE( UIPickFileClass );
|
||||
CLASS_PROTOTYPE(UIPickFileClass);
|
||||
|
||||
void FileChosen( str ¤tDirectory, str &partialName, str &fullname ) override;
|
||||
UIPickFileClass();
|
||||
~UIPickFileClass();
|
||||
|
||||
void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override;
|
||||
};
|
||||
|
||||
void PickFile( const char *name, Listener *obj, Event& event );
|
||||
|
||||
#endif /* __CL_UIMAPRUNNER_H__ */
|
||||
void PickFile(const char *name, Listener *obj, Event& event);
|
||||
+138
-27
@@ -22,68 +22,179 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "cl_ui.h"
|
||||
|
||||
CLASS_DECLARATION( UIWidget, FakkMiniconsole, NULL )
|
||||
{
|
||||
{ NULL, NULL }
|
||||
Event EV_Minicon_Goin("_minicon_goin", EV_DEFAULT, NULL, NULL, "Event to make the miniconsole disappear");
|
||||
|
||||
CLASS_DECLARATION(UIWidget, FakkMiniconsole, NULL) {
|
||||
{&W_SizeChanged, &FakkMiniconsole::OnSizeChanged},
|
||||
{&EV_Minicon_Goin, &FakkMiniconsole::MoveInEvent },
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
FakkMiniconsole::FakkMiniconsole()
|
||||
{
|
||||
// FIXME: stub
|
||||
m_maxlines = 0;
|
||||
m_reallyshown = true;
|
||||
m_boxstate = boxstate_t::box_in;
|
||||
m_boxtime = uid.time;
|
||||
m_movespeed = 500;
|
||||
}
|
||||
|
||||
|
||||
void FakkMiniconsole::VerifyBoxOut( void )
|
||||
void FakkMiniconsole::setShowState(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
if (m_reallyshown) {
|
||||
setShow(m_boxstate != boxstate_t::box_in);
|
||||
} else {
|
||||
setShow(false);
|
||||
}
|
||||
}
|
||||
|
||||
void FakkMiniconsole::ChangeBoxState( boxstate_t state )
|
||||
void FakkMiniconsole::setRealShow(bool b)
|
||||
{
|
||||
// FIXME: stub
|
||||
m_reallyshown = b;
|
||||
setShowState();
|
||||
}
|
||||
|
||||
void FakkMiniconsole::HandleBoxMoving( void )
|
||||
void FakkMiniconsole::VerifyBoxOut(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
PostMoveinEvent();
|
||||
|
||||
if (m_boxstate && m_boxstate != boxstate_t::box_out) {
|
||||
ChangeBoxState(box_moving_out);
|
||||
}
|
||||
}
|
||||
|
||||
void FakkMiniconsole::PostMoveinEvent( void )
|
||||
void FakkMiniconsole::Print(const char *text)
|
||||
{
|
||||
// FIXME: stub
|
||||
str *lastline;
|
||||
const char *p;
|
||||
|
||||
if (!m_lines.NumObjects()) {
|
||||
m_lines.AddObject({});
|
||||
}
|
||||
|
||||
lastline = &m_lines.ObjectAt(m_lines.NumObjects());
|
||||
|
||||
if (*text) {
|
||||
for (p = text; *p; p++) {
|
||||
if (*p != '\n') {
|
||||
*lastline += *p;
|
||||
} else {
|
||||
m_lines.AddObject({});
|
||||
lastline = &m_lines.ObjectAt(m_lines.NumObjects());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lastline && lastline->length() > 128) {
|
||||
Print("\n");
|
||||
}
|
||||
|
||||
if (m_maxlines < 0) {
|
||||
m_maxlines = 1;
|
||||
}
|
||||
|
||||
while (m_lines.NumObjects() > this->m_maxlines) {
|
||||
m_lines.RemoveObjectAt(1);
|
||||
}
|
||||
|
||||
VerifyBoxOut();
|
||||
}
|
||||
|
||||
void FakkMiniconsole::setShowState( void )
|
||||
void FakkMiniconsole::PostMoveinEvent(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
if (m_boxstate != boxstate_t::box_out) {
|
||||
return;
|
||||
}
|
||||
|
||||
CancelEventsOfType(EV_Minicon_Goin);
|
||||
PostEvent(new Event(EV_Minicon_Goin), 5.f);
|
||||
}
|
||||
|
||||
void FakkMiniconsole::OnSizeChanged( Event *ev )
|
||||
void FakkMiniconsole::OnSizeChanged(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
m_maxlines = m_frame.size.height / m_font->getHeight(false);
|
||||
}
|
||||
|
||||
void FakkMiniconsole::Print( const char *text )
|
||||
void FakkMiniconsole::MoveInEvent(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
ChangeBoxState(boxstate_t::box_moving_in);
|
||||
}
|
||||
|
||||
void FakkMiniconsole::Create( const UISize2D& size, const UColor& fore, const UColor& back, float alpha )
|
||||
void FakkMiniconsole::HandleBoxMoving(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
int delta;
|
||||
UIRect2D newRect;
|
||||
|
||||
if (m_boxstate == boxstate_t::box_out || m_boxstate == boxstate_t::box_in) {
|
||||
return;
|
||||
}
|
||||
|
||||
delta = m_movespeed * (uid.time - m_boxtime) / 1000;
|
||||
m_boxtime = 1000 * delta / m_movespeed + m_boxtime;
|
||||
|
||||
switch (m_boxstate) {
|
||||
case boxstate_t::box_moving_in:
|
||||
newRect = UIRect2D(delta + m_frame.pos.x, m_frame.pos.y, m_frame.size.width, m_frame.size.height);
|
||||
if (newRect.pos.x >= uid.vidWidth) {
|
||||
newRect.pos.x = uid.vidWidth;
|
||||
ChangeBoxState(boxstate_t::box_in);
|
||||
}
|
||||
break;
|
||||
case boxstate_t::box_moving_out:
|
||||
newRect = UIRect2D(-delta + m_frame.pos.x, m_frame.pos.y, m_frame.size.width, m_frame.size.height);
|
||||
if (newRect.pos.x <= uid.vidWidth - newRect.size.width) {
|
||||
newRect.pos.x = uid.vidWidth - newRect.size.width;
|
||||
ChangeBoxState(boxstate_t::box_out);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ChangeBoxState(boxstate_t::box_in);
|
||||
break;
|
||||
}
|
||||
|
||||
setFrame(newRect);
|
||||
}
|
||||
|
||||
void FakkMiniconsole::MoveInEvent( Event *ev )
|
||||
void FakkMiniconsole::Draw(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
float aty;
|
||||
int i;
|
||||
|
||||
HandleBoxMoving();
|
||||
|
||||
m_font->setColor(m_foreground_color);
|
||||
aty = m_frame.size.height - m_font->getHeight(false);
|
||||
for (i = m_lines.NumObjects(); i > 0; i--) {
|
||||
if (-m_font->getHeight(false) >= aty) {
|
||||
break;
|
||||
}
|
||||
|
||||
m_font->Print(0, aty, m_lines.ObjectAt(i), -1, false);
|
||||
aty -= m_font->getHeight(false);
|
||||
}
|
||||
}
|
||||
|
||||
void FakkMiniconsole::Draw( void )
|
||||
void FakkMiniconsole::Create(const UISize2D& size, const UColor& fore, const UColor& back, float alpha)
|
||||
{
|
||||
// FIXME: stub
|
||||
InitFrame(NULL, uid.vidWidth, 0, size.width, size.height, 0);
|
||||
|
||||
setBackgroundColor(back, true);
|
||||
setForegroundColor(fore);
|
||||
setBackgroundAlpha(alpha);
|
||||
Connect(this, W_SizeChanged, W_SizeChanged);
|
||||
OnSizeChanged(NULL);
|
||||
|
||||
m_movespeed = size.width * 3;
|
||||
|
||||
setShowState();
|
||||
}
|
||||
|
||||
void FakkMiniconsole::setRealShow( bool b )
|
||||
void FakkMiniconsole::ChangeBoxState(boxstate_t state)
|
||||
{
|
||||
// FIXME: stub
|
||||
m_boxstate = state;
|
||||
m_boxtime = uid.time;
|
||||
setShowState();
|
||||
if (state == boxstate_t::box_out) {
|
||||
PostMoveinEvent();
|
||||
}
|
||||
}
|
||||
+23
-25
@@ -20,38 +20,36 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UIMINICON_H__
|
||||
#define __CL_UIMINICON_H__
|
||||
#pragma once
|
||||
|
||||
class FakkMiniconsole : public UIWidget {
|
||||
class FakkMiniconsole : public UIWidget
|
||||
{
|
||||
protected:
|
||||
Container<str> m_lines;
|
||||
int m_maxlines;
|
||||
bool m_reallyshown;
|
||||
bool m_boxmovingout;
|
||||
boxstate_t m_boxstate;
|
||||
int m_boxtime;
|
||||
int m_movespeed;
|
||||
Container<str> m_lines;
|
||||
int m_maxlines;
|
||||
bool m_reallyshown;
|
||||
bool m_boxmovingout;
|
||||
boxstate_t m_boxstate;
|
||||
int m_boxtime;
|
||||
int m_movespeed;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( FakkMiniconsole );
|
||||
CLASS_PROTOTYPE(FakkMiniconsole);
|
||||
|
||||
protected:
|
||||
void VerifyBoxOut( void );
|
||||
void ChangeBoxState( boxstate_t state );
|
||||
void HandleBoxMoving( void );
|
||||
void PostMoveinEvent( void );
|
||||
void setShowState( void );
|
||||
void VerifyBoxOut(void);
|
||||
void ChangeBoxState(boxstate_t state);
|
||||
void HandleBoxMoving(void);
|
||||
void PostMoveinEvent(void);
|
||||
void setShowState(void);
|
||||
|
||||
public:
|
||||
FakkMiniconsole();
|
||||
FakkMiniconsole();
|
||||
|
||||
void OnSizeChanged( Event *ev );
|
||||
void Print( const char *text );
|
||||
void Create( const UISize2D& size, const UColor& fore, const UColor& back, float alpha );
|
||||
void MoveInEvent( Event *ev );
|
||||
void Draw( void ) override;
|
||||
void setRealShow( bool b );
|
||||
void OnSizeChanged(Event *ev);
|
||||
void Print(const char *text);
|
||||
void Create(const UISize2D& size, const UColor& fore, const UColor& back, float alpha);
|
||||
void MoveInEvent(Event *ev);
|
||||
void Draw(void) override;
|
||||
void setRealShow(bool b);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -21,73 +21,339 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "cl_ui.h"
|
||||
#include "../qcommon/localization.h"
|
||||
|
||||
CLASS_DECLARATION( USignal, MpMapPickerClass, NULL )
|
||||
class MpMapPickerItem : public UIListCtrlItem
|
||||
{
|
||||
{ NULL, NULL }
|
||||
str m_string;
|
||||
// Added in 2.0
|
||||
str m_directory;
|
||||
|
||||
public:
|
||||
MpMapPickerItem(const str& string, const str& directory);
|
||||
|
||||
int getListItemValue(int which) const override;
|
||||
griditemtype_t getListItemType(int which) const override;
|
||||
str getListItemString(int which) const override;
|
||||
void DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) override;
|
||||
qboolean IsHeaderEntry() const override;
|
||||
};
|
||||
|
||||
CLASS_DECLARATION(USignal, MpMapPickerClass, NULL) {
|
||||
{&EV_UIListBase_ItemSelected, &MpMapPickerClass::FileSelected },
|
||||
{&EV_UIListBase_ItemDoubleClicked, &MpMapPickerClass::FileChosen },
|
||||
{&W_Deactivated, &MpMapPickerClass::OnDeactivated},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
MpMapPickerClass::MpMapPickerClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
window = new UIFloatingWindow();
|
||||
window->Create(
|
||||
NULL,
|
||||
UIRect2D((cls.glconfig.vidWidth - 300) / 2, (cls.glconfig.vidHeight - 200) / 2, 300, 200),
|
||||
"Select a Map",
|
||||
UColor(0.15f, 0.195f, 0.278f),
|
||||
UHudColor
|
||||
);
|
||||
window->setFont("facfont-20");
|
||||
window->PassEventToWidget("closebutton", new Event(EV_Widget_Disable));
|
||||
window->PassEventToWidget("minimizebutton", new Event(EV_Widget_Disable));
|
||||
window->Connect(this, W_Deactivated, W_Deactivated);
|
||||
|
||||
listbox = new UIListCtrl();
|
||||
listbox->InitFrame(window->getChildSpace(), window->getChildSpace()->getClientFrame(), 0);
|
||||
listbox->SetDrawHeader(false);
|
||||
listbox->setFont("facfont-20");
|
||||
listbox->FrameInitialized();
|
||||
listbox->AddColumn(Sys_LV_CL_ConvertString("Select a Map"), 0, 400, false, false);
|
||||
|
||||
listbox->Connect(this, EV_UIListBase_ItemDoubleClicked, EV_UIListBase_ItemDoubleClicked);
|
||||
listbox->Connect(this, EV_UIListBase_ItemSelected, EV_UIListBase_ItemSelected);
|
||||
listbox->AllowActivate(true);
|
||||
|
||||
// Added in 2.0
|
||||
// Don't localize elements
|
||||
listbox->SetDontLocalize();
|
||||
}
|
||||
|
||||
MpMapPickerClass::~MpMapPickerClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
if (listbox) {
|
||||
delete listbox;
|
||||
listbox = NULL;
|
||||
}
|
||||
|
||||
if (window) {
|
||||
delete window;
|
||||
window = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void MpMapPickerClass::SetupFiles( void )
|
||||
void MpMapPickerClass::Setup(const char *root_directory, const char *current_directory, const char *game_type)
|
||||
{
|
||||
// FIXME: stub
|
||||
Initialize(root_directory, current_directory, game_type);
|
||||
}
|
||||
|
||||
void MpMapPickerClass::GotoParentDirectory( void )
|
||||
void MpMapPickerClass::Initialize(const char *root_directory, const char *current_directory, const char *game_type)
|
||||
{
|
||||
// FIXME: stub
|
||||
rootDirectory = root_directory;
|
||||
if (rootDirectory.length() > 1 && rootDirectory[rootDirectory.length() - 1] != '/') {
|
||||
rootDirectory += "/";
|
||||
}
|
||||
|
||||
currentDirectory = current_directory;
|
||||
if (currentDirectory.length() > 1 && currentDirectory[currentDirectory.length() - 1] != '/') {
|
||||
currentDirectory += "/";
|
||||
}
|
||||
|
||||
if (game_type) {
|
||||
gameType = game_type;
|
||||
}
|
||||
|
||||
SetupFiles();
|
||||
}
|
||||
|
||||
void MpMapPickerClass::GotoSubDirectory( str subdir )
|
||||
void MpMapPickerClass::GotoParentDirectory(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
uintptr_t i;
|
||||
|
||||
if (currentDirectory == rootDirectory) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = currentDirectory.length() - 2; i > 0; i--) {
|
||||
if (currentDirectory[i] == '/') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentDirectory[i] == '/') {
|
||||
i++;
|
||||
}
|
||||
|
||||
currentDirectory = str(currentDirectory, 0, i);
|
||||
|
||||
// refresh files
|
||||
SetupFiles();
|
||||
}
|
||||
|
||||
void MpMapPickerClass::Initialize( const char *root_directory, const char *current_directory )
|
||||
void MpMapPickerClass::GotoSubDirectory(str subdir)
|
||||
{
|
||||
// FIXME: stub
|
||||
currentDirectory += subdir + "/";
|
||||
|
||||
// refresh files
|
||||
SetupFiles();
|
||||
}
|
||||
|
||||
void MpMapPickerClass::CloseWindow( void )
|
||||
void MpMapPickerClass::SetupFiles(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
char **filenames;
|
||||
int numfiles;
|
||||
int i;
|
||||
char mapname[128];
|
||||
bool bTugOfWar = false, bObjective = false, bLiberation = false;
|
||||
|
||||
listbox->DeleteAllItems();
|
||||
|
||||
if (gameType == "tow") {
|
||||
bTugOfWar = true;
|
||||
} else if (gameType == "obj") {
|
||||
bObjective = true;
|
||||
} else if (gameType == "lib") {
|
||||
bLiberation = true;
|
||||
} else {
|
||||
// retrieve directories
|
||||
filenames = FS_ListFiles(rootDirectory, ".bsp", qfalse, &numfiles);
|
||||
|
||||
for (i = 0; i < numfiles; i++) {
|
||||
const char *filename = filenames[i];
|
||||
|
||||
strcpy(mapname, filename);
|
||||
mapname[strlen(mapname) - 4] = 0;
|
||||
|
||||
if (COM_IsMapValid(mapname)) {
|
||||
listbox->AddItem(new MpMapPickerItem(mapname, rootDirectory));
|
||||
}
|
||||
}
|
||||
|
||||
FS_FreeFileList(filenames);
|
||||
}
|
||||
|
||||
if (com_target_game->integer > target_game_e::TG_MOH) {
|
||||
if (currentDirectory.length()) {
|
||||
if (currentDirectory == "maps/-/") {
|
||||
SetupSecondaryFiles(currentDirectory, bTugOfWar, bObjective, bLiberation);
|
||||
} else {
|
||||
SetupSecondaryFiles("maps/obj/", bTugOfWar, bObjective, bLiberation);
|
||||
SetupSecondaryFiles("maps/lib/", bTugOfWar, bObjective, bLiberation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
listbox->SortByColumn(0);
|
||||
}
|
||||
|
||||
void MpMapPickerClass::FileSelected( Event *ev )
|
||||
void MpMapPickerClass::SetupSecondaryFiles(const char *path, bool bTugOfWar, bool bObjective, bool bLiberation)
|
||||
{
|
||||
// FIXME: stub
|
||||
char **filenames;
|
||||
int numfiles;
|
||||
int i;
|
||||
char mapname[128];
|
||||
char string[1024];
|
||||
|
||||
filenames = FS_ListFiles(path, ".bsp", qfalse, &numfiles);
|
||||
|
||||
for (i = 0; i < numfiles; i++) {
|
||||
const char *filename = filenames[i];
|
||||
const char *token;
|
||||
|
||||
strcpy(mapname, filename);
|
||||
mapname[strlen(mapname) - 4] = 0;
|
||||
|
||||
if (!COM_IsMapValid(mapname)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bTugOfWar || bObjective || bLiberation) {
|
||||
bool bHasMP = false, bHasTOW = false, bHasLib = false;
|
||||
|
||||
strcpy(string, mapname);
|
||||
|
||||
for (token = strtok(string, "_"); token; token = strtok(NULL, "_")) {
|
||||
if (bObjective) {
|
||||
if (!Q_stricmp(token, "obj")) {
|
||||
listbox->AddItem(new MpMapPickerItem(mapname, path));
|
||||
} else if (!Q_stricmp(token, "ship")) {
|
||||
listbox->AddItem(new MpMapPickerItem(mapname, path));
|
||||
}
|
||||
}
|
||||
|
||||
if (bTugOfWar) {
|
||||
if (!Q_stricmp(token, "MP")) {
|
||||
bHasMP = true;
|
||||
}
|
||||
if (!Q_stricmp(token, "TOW")) {
|
||||
bHasTOW = true;
|
||||
}
|
||||
|
||||
if (bHasMP && bHasTOW) {
|
||||
listbox->AddItem(new MpMapPickerItem(mapname, path));
|
||||
}
|
||||
}
|
||||
|
||||
if (bLiberation) {
|
||||
if (!Q_stricmp(token, "MP")) {
|
||||
bHasMP = true;
|
||||
}
|
||||
if (!Q_stricmp(token, "LIB")) {
|
||||
bHasLib = true;
|
||||
}
|
||||
|
||||
if (bHasMP && bHasLib) {
|
||||
listbox->AddItem(new MpMapPickerItem(mapname, path));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!Q_stricmp(mapname, "obj_team2") || !Q_stricmp(mapname, "obj_team4")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
listbox->AddItem(new MpMapPickerItem(mapname, path));
|
||||
}
|
||||
}
|
||||
|
||||
FS_FreeFileList(filenames);
|
||||
}
|
||||
|
||||
void MpMapPickerClass::FileSelected( str& currentDirectory, str& partialName, str& fullname )
|
||||
void MpMapPickerClass::FileSelected(const str& currentDirectory, const str& partialName, const str& fullname)
|
||||
{
|
||||
// FIXME: stub
|
||||
FileChosen(currentDirectory, partialName, fullname);
|
||||
}
|
||||
|
||||
void MpMapPickerClass::FileChosen( Event *ev )
|
||||
void MpMapPickerClass::FileSelected(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
if (!listbox->getCurrentItem()) {
|
||||
return;
|
||||
}
|
||||
|
||||
uii.Snd_PlaySound("sound/menu/apply.wav");
|
||||
|
||||
UIListCtrlItem *item = listbox->GetItem(listbox->getCurrentItem());
|
||||
str name = item->getListItemString(0);
|
||||
str directory = item->getListItemString(1);
|
||||
|
||||
FileSelected(directory, name, directory + name);
|
||||
}
|
||||
|
||||
void MpMapPickerClass::FileChosen( str& currentDirectory, str& partialName, str& fullname )
|
||||
void MpMapPickerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname)
|
||||
{
|
||||
// FIXME: stub
|
||||
const char *pszFilename;
|
||||
str sCommand;
|
||||
|
||||
pszFilename = fullname.c_str();
|
||||
sCommand = va("ui_dmmap %s\n", pszFilename + 5);
|
||||
|
||||
Cbuf_AddText(sCommand);
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
void MpMapPickerClass::OnDeactivated( Event *ev )
|
||||
void MpMapPickerClass::FileChosen(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
if (!listbox->getCurrentItem()) {
|
||||
return;
|
||||
}
|
||||
|
||||
uii.Snd_PlaySound("sound/menu/apply.wav");
|
||||
|
||||
UIListCtrlItem *item = listbox->GetItem(listbox->getCurrentItem());
|
||||
str name = item->getListItemString(0);
|
||||
str directory = item->getListItemString(1);
|
||||
|
||||
FileSelected(directory, name, directory + name);
|
||||
}
|
||||
|
||||
void MpMapPickerClass::Setup( const char *root_directory, const char *current_directory )
|
||||
void MpMapPickerClass::CloseWindow(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
PostEvent(EV_Remove, 0);
|
||||
}
|
||||
|
||||
void MpMapPickerClass::OnDeactivated(Event *ev)
|
||||
{
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
MpMapPickerItem::MpMapPickerItem(const str& string, const str& directory)
|
||||
{
|
||||
m_string = string;
|
||||
m_directory = directory;
|
||||
}
|
||||
|
||||
int MpMapPickerItem::getListItemValue(int which) const
|
||||
{
|
||||
return atoi(m_string);
|
||||
}
|
||||
|
||||
griditemtype_t MpMapPickerItem::getListItemType(int which) const
|
||||
{
|
||||
return griditemtype_t::TYPE_STRING;
|
||||
}
|
||||
|
||||
str MpMapPickerItem::getListItemString(int which) const
|
||||
{
|
||||
switch (which) {
|
||||
default:
|
||||
case 0:
|
||||
return m_string;
|
||||
case 1:
|
||||
return m_directory;
|
||||
}
|
||||
}
|
||||
|
||||
void MpMapPickerItem::DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) {}
|
||||
|
||||
qboolean MpMapPickerItem::IsHeaderEntry() const
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,39 +20,40 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UIMPMAPPICKER_H__
|
||||
#define __CL_UIMPMAPPICKER_H__
|
||||
#pragma once
|
||||
|
||||
class UIFloatingWindow;
|
||||
|
||||
class MpMapPickerClass : public USignal {
|
||||
UIFloatingWindow *window;
|
||||
UIListCtrl *listbox;
|
||||
str currentDirectory;
|
||||
str rootDirectory;
|
||||
class MpMapPickerClass : public USignal
|
||||
{
|
||||
UIFloatingWindow *window;
|
||||
UIListCtrl *listbox;
|
||||
str currentDirectory;
|
||||
str rootDirectory;
|
||||
str gameType;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( MpMapPickerClass );
|
||||
CLASS_PROTOTYPE(MpMapPickerClass);
|
||||
|
||||
private:
|
||||
void SetupFiles( void );
|
||||
void GotoParentDirectory( void );
|
||||
void GotoSubDirectory( str subdir );
|
||||
void Initialize( const char *root_directory, const char *current_directory );
|
||||
void SetupFiles(void);
|
||||
void SetupSecondaryFiles(const char *path, bool bTugOfWar, bool bObjective, bool bLiberation);
|
||||
void GotoParentDirectory(void);
|
||||
void GotoSubDirectory(str subdir);
|
||||
void Initialize(const char *root_directory, const char *current_directory, const char *game_type);
|
||||
|
||||
protected:
|
||||
void CloseWindow( void );
|
||||
void FileSelected( Event *ev );
|
||||
virtual void FileSelected( str& currentDirectory, str& partialName, str& fullname );
|
||||
void FileChosen( Event *ev );
|
||||
virtual void FileChosen( str& currentDirectory, str& partialName, str& fullname );
|
||||
void OnDeactivated( Event *ev );
|
||||
void CloseWindow(void);
|
||||
void FileSelected(Event *ev);
|
||||
virtual void FileSelected(const str& currentDirectory, const str& partialName, const str& fullname);
|
||||
void FileChosen(Event *ev);
|
||||
virtual void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname);
|
||||
void OnDeactivated(Event *ev);
|
||||
|
||||
public:
|
||||
MpMapPickerClass();
|
||||
~MpMapPickerClass();
|
||||
MpMapPickerClass();
|
||||
~MpMapPickerClass();
|
||||
|
||||
void Setup( const char *root_directory, const char *current_directory );
|
||||
// game_type was added in 2.0
|
||||
void Setup(const char *root_directory, const char *current_directory, const char *game_type = NULL);
|
||||
};
|
||||
|
||||
#endif /* __CL_UIMPMAPPICKER_H__ */
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -22,62 +22,361 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "cl_ui.h"
|
||||
|
||||
CLASS_DECLARATION( USignal, PlayerModelPickerClass, NULL )
|
||||
class PMPickerItem : public UIListCtrlItem
|
||||
{
|
||||
{ NULL, NULL }
|
||||
str m_string;
|
||||
|
||||
public:
|
||||
PMPickerItem(const str& string);
|
||||
|
||||
int getListItemValue(int which) const override;
|
||||
griditemtype_t getListItemType(int which) const override;
|
||||
str getListItemString(int which) const override;
|
||||
void DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) override;
|
||||
qboolean IsHeaderEntry() const override;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
const char *fileName;
|
||||
const char *displayName;
|
||||
} PMPickerModel_t;
|
||||
|
||||
static const PMPickerModel_t pickerModels[] = {
|
||||
// 2.0 skins
|
||||
{"allied_101st_captain", "US - 101st Airborne Captain" },
|
||||
{"allied_101st_infantry", "US - 101st Airborne Private 1" },
|
||||
{"allied_101st_scout", "US - 101st Airborne Private 2" },
|
||||
{"allied_501st_pir_scout", "US - 501st Paratrooper 1" },
|
||||
{"allied_501st_pir_soldier", "US - 501st Paratrooper 2" },
|
||||
// 1.0 skins
|
||||
{"allied_airborne", "US - 501st Paratrooper 3" },
|
||||
// Readded in OPM (was removed in 2.0)
|
||||
{"allied_manon", "US - Manon" },
|
||||
// 2.0 skins
|
||||
{"allied_british_6th_airborne_captain", "UK - 6th Airborne Captain" },
|
||||
{"allied_british_6th_airborne_paratrooper", "UK - 6th Airborne Paratrooper" },
|
||||
// 1.0 skins
|
||||
{"allied_pilot", "US - Army Pilot" },
|
||||
// 2.0 skins
|
||||
{"allied_russian_corporal", "RA - Corporal" },
|
||||
{"allied_russian_crazy_boris", "RA - Crazy Boris" },
|
||||
{"allied_russian_recon_scout", "RA - Junior Lieutenant" },
|
||||
{"allied_russian_recon_soldier", "RA - Black Sea Petty Officer" },
|
||||
// 1.0 skins
|
||||
{"allied_sas", "UK - SAS Officer" },
|
||||
{"american_army", "US - Soldier" },
|
||||
{"american_ranger", "US - Ranger" },
|
||||
// 1.0 skins
|
||||
{"german_afrika_officer", "DE - Afrika Officer" },
|
||||
{"german_afrika_private", "DE - Afrika Private" },
|
||||
// 2.0 skins
|
||||
{"german_ardennes_artillery_commander", "DE - Artillery Commander" },
|
||||
{"german_dday_colonel", "DE - Normandy Colonel" },
|
||||
// 1.0 skins
|
||||
{"german_elite_officer", "DE - Elite Officer" },
|
||||
{"german_elite_sentry", "DE - Elite Sentry" },
|
||||
{"german_kradshutzen", "DE - Kradshutzen" },
|
||||
{"german_panzer_grenadier", "DE - Panzer Grenadier" },
|
||||
{"german_panzer_obershutze", "DE - Panzer Obershutze" },
|
||||
{"german_panzer_shutze", "DE - Panzer Shutze" },
|
||||
{"german_panzer_tankcommander", "DE - Panzer Tank Commander" },
|
||||
{"german_scientist", "DE - German Scientist" },
|
||||
// Those skins were superseded by german_waffenss
|
||||
{"german_waffen_officer", "DE - Waffen Officer" },
|
||||
{"german_waffen_shutze", "DE - Waffen Shutze" },
|
||||
// 1.0 skins
|
||||
{"german_waffenss_officer", "DE - Waffen Officer" },
|
||||
{"german_waffenss_shutze", "DE - Waffen Shutze" },
|
||||
{"german_wehrmacht_officer", "DE - Wehrmacht Officer" },
|
||||
{"german_wehrmacht_soldier", "DE - Wehrmacht Soldier" },
|
||||
{"german_winter_1", "DE - Winter Infantry 1" },
|
||||
{"german_winter_2", "DE - Winter Infantry 2" },
|
||||
{"german_worker", "DE - German Mechanic" },
|
||||
// 2.11 skins
|
||||
{"allied_british_tank_corporal", "UK - 6th Royal Tank Regiment" },
|
||||
{"allied_russian_seaman", "RA - Red Navy Seaman" },
|
||||
{"german_Panzer_Corporal", "DE - 1st Panzer Regiment" },
|
||||
{"allied_technician", "US - Air Force Technician" },
|
||||
{"german_stukageschwader", "DE - Stukageschwader" },
|
||||
// 2.30 skins
|
||||
{"It_AX_Ital_Vol", "IT - 10th Army XXI Corps" },
|
||||
{"SC_AX_Ital_Inf", "IT - 6th Army 202nd Coastal Div"},
|
||||
{"SC_AX_Ital_Inf2", "IT - 114th Inf Regiment" },
|
||||
{"SC_AX_ITAL_PARA", "IT - Paracadutista Militare" },
|
||||
// 2.40 skins
|
||||
{"allied_Wheathers", "US - General Wheathers" },
|
||||
{"allied_US_Tank", "US - II Corps Tank Commander" },
|
||||
{"allied_US_Mask", "US - II Corps Infantry" },
|
||||
{"allied_british_Cmd", "UK - 10th Corps" },
|
||||
{"allied_british_Tank", "UK - 8th Army" },
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
const char *PM_FilenameToDisplayname(const char *fileName)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; pickerModels[i].fileName; i++) {
|
||||
const PMPickerModel_t& model = pickerModels[i];
|
||||
|
||||
if (!Q_stricmp(model.fileName, fileName)) {
|
||||
return model.displayName;
|
||||
}
|
||||
}
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
const char *PM_DisplaynameToFilename(const char *displayName)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; pickerModels[i].fileName; i++) {
|
||||
const PMPickerModel_t& model = pickerModels[i];
|
||||
|
||||
if (!Q_stricmp(model.displayName, displayName)) {
|
||||
return model.fileName;
|
||||
}
|
||||
}
|
||||
|
||||
return displayName;
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(USignal, PlayerModelPickerClass, NULL) {
|
||||
{&EV_UIListBase_ItemSelected, &PlayerModelPickerClass::FileSelected },
|
||||
{&EV_UIListBase_ItemDoubleClicked, &PlayerModelPickerClass::FileChosen },
|
||||
{&UIFloatingWindow::W_ClosePressed, &PlayerModelPickerClass::OnDeactivated},
|
||||
{&W_Deactivated, &PlayerModelPickerClass::OnDeactivated},
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
PlayerModelPickerClass::PlayerModelPickerClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
window = new UIFloatingWindow();
|
||||
window->Create(
|
||||
NULL,
|
||||
UIRect2D((cls.glconfig.vidWidth - 400) / 2, (cls.glconfig.vidHeight - 300) / 2, 400, 300),
|
||||
"Player Model Select...",
|
||||
UColor(0.15f, 0.195f, 0.278f),
|
||||
UHudColor
|
||||
);
|
||||
window->setFont("facfont-20");
|
||||
window->PassEventToWidget("closebutton", new Event(EV_Widget_Disable));
|
||||
window->PassEventToWidget("minimizebutton", new Event(EV_Widget_Disable));
|
||||
window->Connect(this, W_Deactivated, W_Deactivated);
|
||||
|
||||
listbox = new UIListCtrl();
|
||||
listbox->InitFrame(window->getChildSpace(), window->getChildSpace()->getClientFrame(), 0);
|
||||
listbox->SetDrawHeader(false);
|
||||
listbox->setFont("facfont-20");
|
||||
listbox->FrameInitialized();
|
||||
listbox->AddColumn("Player Model", 0, 400, false, false);
|
||||
|
||||
listbox->Connect(this, EV_UIListBase_ItemDoubleClicked, EV_UIListBase_ItemDoubleClicked);
|
||||
listbox->Connect(this, EV_UIListBase_ItemSelected, EV_UIListBase_ItemSelected);
|
||||
listbox->AllowActivate(true);
|
||||
|
||||
// Added in 2.0
|
||||
// Don't localize elements
|
||||
listbox->SetDontLocalize();
|
||||
|
||||
m_bGermanModels = false;
|
||||
}
|
||||
|
||||
PlayerModelPickerClass::~PlayerModelPickerClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
if (listbox) {
|
||||
delete listbox;
|
||||
listbox = NULL;
|
||||
}
|
||||
|
||||
if (window) {
|
||||
delete window;
|
||||
window = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerModelPickerClass::SetupFiles( void )
|
||||
void PlayerModelPickerClass::Setup(const char *root_directory, const char *current_directory, qboolean bGermanModels)
|
||||
{
|
||||
// FIXME: stub
|
||||
Initialize(root_directory, current_directory, bGermanModels);
|
||||
}
|
||||
|
||||
void PlayerModelPickerClass::Initialize( const char *root_directory, const char *current_directory, qboolean bGermanModels )
|
||||
void PlayerModelPickerClass::Initialize(
|
||||
const char *root_directory, const char *current_directory, qboolean bGermanModels
|
||||
)
|
||||
{
|
||||
// FIXME: stub
|
||||
rootDirectory = root_directory;
|
||||
m_bGermanModels = bGermanModels;
|
||||
if (rootDirectory.length() > 1 && rootDirectory[rootDirectory.length() - 1] != '/') {
|
||||
rootDirectory += "/";
|
||||
}
|
||||
|
||||
currentDirectory = current_directory;
|
||||
if (currentDirectory.length() > 1 && currentDirectory[currentDirectory.length() - 1] != '/') {
|
||||
currentDirectory += "/";
|
||||
}
|
||||
|
||||
SetupFiles();
|
||||
}
|
||||
|
||||
void PlayerModelPickerClass::CloseWindow( void )
|
||||
void PlayerModelPickerClass::SetupFiles(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
str mappath;
|
||||
char work[128];
|
||||
char **filenames;
|
||||
const char *displayName;
|
||||
int numfiles;
|
||||
int i;
|
||||
int iLen;
|
||||
qboolean bIsGerman;
|
||||
|
||||
// cleanup
|
||||
listbox->DeleteAllItems();
|
||||
|
||||
if (m_bGermanModels) {
|
||||
window->setTitle("Select Your Axis Player Model");
|
||||
} else {
|
||||
window->setTitle("Select Your Allied Player Model");
|
||||
}
|
||||
|
||||
filenames = FS_ListFiles(currentDirectory, ".tik", qfalse, &numfiles);
|
||||
|
||||
for (i = 0; i < numfiles; i++) {
|
||||
Q_strncpyz(work, filenames[i], sizeof(work));
|
||||
|
||||
if (strstr(work, "_fps")) {
|
||||
// ignore view models
|
||||
continue;
|
||||
}
|
||||
|
||||
if (work[0] == '_') {
|
||||
// ignore hidden models
|
||||
continue;
|
||||
}
|
||||
|
||||
// allied_manon readded in OPM
|
||||
//if (!Q_stricmpn(work, "allied_manon")) {
|
||||
// continue;
|
||||
//}
|
||||
|
||||
bIsGerman = !Q_stricmpn(work, "german", 6u) || !Q_stricmpn(work, "axis", 4u) || !Q_stricmpn(work, "it", 2u)
|
||||
|| !Q_stricmpn(work, "sc", 2u);
|
||||
|
||||
if (m_bGermanModels != bIsGerman) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// strip the extension
|
||||
work[strlen(work) - 4] = 0;
|
||||
displayName = PM_FilenameToDisplayname(work);
|
||||
|
||||
listbox->AddItem(new PMPickerItem(displayName));
|
||||
}
|
||||
|
||||
FS_FreeFileList(filenames);
|
||||
|
||||
listbox->SortByColumn(0);
|
||||
}
|
||||
|
||||
void PlayerModelPickerClass::FileSelected( Event *ev )
|
||||
void PlayerModelPickerClass::FileSelected(
|
||||
const str& name, const str& currentDirectory, const str& partialName, const str& fullname
|
||||
)
|
||||
{
|
||||
// FIXME: stub
|
||||
FileChosen(name, currentDirectory, partialName, fullname);
|
||||
}
|
||||
|
||||
void PlayerModelPickerClass::FileSelected( str& currentDirectory, str& partialName, str& fullname )
|
||||
void PlayerModelPickerClass::FileSelected(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
str name;
|
||||
char donotshowssindeorfr[64];
|
||||
str fullname;
|
||||
|
||||
name = listbox->GetItem(listbox->getCurrentItem())->getListItemString(0);
|
||||
fullname = PM_DisplaynameToFilename(name);
|
||||
|
||||
if (!Q_stricmpn(fullname, "german_waffen_", 14)) {
|
||||
Q_strncpyz(donotshowssindeorfr, "german_waffenss_", sizeof(donotshowssindeorfr));
|
||||
Q_strcat(donotshowssindeorfr, sizeof(donotshowssindeorfr), fullname.c_str() + 14);
|
||||
} else {
|
||||
Q_strncpyz(donotshowssindeorfr, fullname, sizeof(donotshowssindeorfr));
|
||||
}
|
||||
|
||||
FileSelected(name, currentDirectory, fullname, currentDirectory + donotshowssindeorfr);
|
||||
}
|
||||
|
||||
void PlayerModelPickerClass::FileChosen( Event *ev )
|
||||
void PlayerModelPickerClass::FileChosen(
|
||||
const str& name, const str& currentDirectory, const str& partialName, const str& fullname
|
||||
)
|
||||
{
|
||||
// FIXME: stub
|
||||
str sCommand;
|
||||
|
||||
if (m_bGermanModels) {
|
||||
sCommand += "ui_dm_playergermanmodel \"" + name;
|
||||
sCommand += "\" ; ui_dm_playergermanmodel_set " + partialName;
|
||||
sCommand += " ; ui_disp_playergermanmodel " + fullname + ".tik";
|
||||
} else {
|
||||
sCommand += "ui_dm_playermodel \"" + name;
|
||||
sCommand += "\" ; ui_dm_playermodel_set " + partialName;
|
||||
sCommand += " ; ui_disp_playermodel " + fullname + ".tik";
|
||||
}
|
||||
sCommand += "\n";
|
||||
|
||||
Cbuf_AddText(sCommand);
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
void PlayerModelPickerClass::FileChosen( str& currentDirectory, str& partialName, str& fullname )
|
||||
void PlayerModelPickerClass::FileChosen(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
str name;
|
||||
char donotshowssindeorfr[64];
|
||||
str fullname;
|
||||
|
||||
name = listbox->GetItem(listbox->getCurrentItem())->getListItemString(0);
|
||||
fullname = PM_DisplaynameToFilename(name);
|
||||
|
||||
if (!Q_stricmpn(fullname, "german_waffen_", 14)) {
|
||||
Q_strncpyz(donotshowssindeorfr, "german_waffen_", sizeof(donotshowssindeorfr));
|
||||
Q_strcat(donotshowssindeorfr, sizeof(donotshowssindeorfr), fullname.c_str() + 14);
|
||||
} else {
|
||||
Q_strncpyz(donotshowssindeorfr, fullname, sizeof(donotshowssindeorfr));
|
||||
}
|
||||
|
||||
FileChosen(name, currentDirectory, fullname, currentDirectory + donotshowssindeorfr);
|
||||
}
|
||||
|
||||
void PlayerModelPickerClass::OnDeactivated( Event *ev )
|
||||
void PlayerModelPickerClass::CloseWindow(void)
|
||||
{
|
||||
// FIXME: stub
|
||||
PostEvent(EV_Remove, 0);
|
||||
}
|
||||
|
||||
void PlayerModelPickerClass::Setup( const char *root_directory, const char *current_directory, qboolean bGermanModels )
|
||||
void PlayerModelPickerClass::OnDeactivated(Event *ev)
|
||||
{
|
||||
// FIXME: stub
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
PMPickerItem::PMPickerItem(const str& string)
|
||||
{
|
||||
m_string = string;
|
||||
}
|
||||
|
||||
int PMPickerItem::getListItemValue(int which) const
|
||||
{
|
||||
return atoi(m_string);
|
||||
}
|
||||
|
||||
griditemtype_t PMPickerItem::getListItemType(int which) const
|
||||
{
|
||||
return griditemtype_t::TYPE_STRING;
|
||||
}
|
||||
|
||||
str PMPickerItem::getListItemString(int which) const
|
||||
{
|
||||
return m_string;
|
||||
}
|
||||
|
||||
void PMPickerItem::DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont *pFont) {}
|
||||
|
||||
qboolean PMPickerItem::IsHeaderEntry() const
|
||||
{
|
||||
return qfalse;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,37 +20,41 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UIPLAYERMODELPICKER_H__
|
||||
#define __CL_UIPLAYERMODELPICKER_H__
|
||||
#pragma once
|
||||
|
||||
class UIFloatingWindow;
|
||||
|
||||
class PlayerModelPickerClass : public USignal {
|
||||
UIFloatingWindow *window;
|
||||
UIListCtrl *listbox;
|
||||
str currentDirectory;
|
||||
str rootDirectory;
|
||||
qboolean m_bGermanModels;
|
||||
class PlayerModelPickerClass : public USignal
|
||||
{
|
||||
UIFloatingWindow *window;
|
||||
UIListCtrl *listbox;
|
||||
str currentDirectory;
|
||||
str rootDirectory;
|
||||
qboolean m_bGermanModels;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( PlayerModelPickerClass );
|
||||
CLASS_PROTOTYPE(PlayerModelPickerClass);
|
||||
|
||||
private:
|
||||
void SetupFiles( void );
|
||||
void Initialize( const char *root_directory, const char *current_directory, qboolean bGermanModels );
|
||||
void SetupFiles(void);
|
||||
void Initialize(const char *root_directory, const char *current_directory, qboolean bGermanModels);
|
||||
|
||||
protected:
|
||||
void CloseWindow( void );
|
||||
void FileSelected( Event *ev );
|
||||
virtual void FileSelected( str& currentDirectory, str& partialName, str& fullname );
|
||||
void FileChosen( Event *ev );
|
||||
virtual void FileChosen( str& currentDirectory, str& partialName, str& fullname );
|
||||
void OnDeactivated( Event *ev );
|
||||
void CloseWindow(void);
|
||||
void FileSelected(Event *ev);
|
||||
// The name parameter was added in 2.0.
|
||||
virtual void FileSelected(const str& name, const str& currentDirectory, const str& partialName, const str& fullname);
|
||||
void FileChosen(Event *ev);
|
||||
// The name parameter was added in 2.0.
|
||||
virtual void FileChosen(const str& name, const str& currentDirectory, const str& partialName, const str& fullname);
|
||||
void OnDeactivated(Event *ev);
|
||||
|
||||
public:
|
||||
PlayerModelPickerClass();
|
||||
~PlayerModelPickerClass();
|
||||
PlayerModelPickerClass();
|
||||
~PlayerModelPickerClass();
|
||||
|
||||
void Setup( const char *root_directory, const char *current_directory, qboolean bGermanModels );
|
||||
void Setup(const char *root_directory, const char *current_directory, qboolean bGermanModels);
|
||||
};
|
||||
|
||||
#endif /* __CL_UIPLAYERMODELPICKER_H__ */
|
||||
const char* PM_FilenameToDisplayname(const char* fileName);
|
||||
const char* PM_DisplaynameToFilename(const char* displayName);
|
||||
@@ -79,6 +79,7 @@ struct ServerListInstance {
|
||||
};
|
||||
|
||||
class FAKKServerListItem : public UIListCtrlItem {
|
||||
UIFAKKServerList* m_parent; // Added in OPM
|
||||
str m_strings[6];
|
||||
str m_sVersion;
|
||||
bool m_bDifferentVersion;
|
||||
@@ -94,7 +95,7 @@ public:
|
||||
int m_iGameSpyPort;
|
||||
|
||||
public:
|
||||
FAKKServerListItem(str string1, str string2, str string3, str string4, str string5, str string6, str ver);
|
||||
FAKKServerListItem(UIFAKKServerList* parent, str string1, str string2, str string3, str string4, str string5, str string6, str ver);
|
||||
|
||||
griditemtype_t getListItemType(int index) const override;
|
||||
int getListItemValue(int i) const override;
|
||||
@@ -125,8 +126,9 @@ ServerListInstance g_ServerListInst[2];
|
||||
void UpdateServerListCallBack(GServerList serverlist, int msg, void* instance, void* param1, void* param2);
|
||||
static void AddFilter(char* filter, const char* value);
|
||||
|
||||
FAKKServerListItem::FAKKServerListItem(str string1, str string2, str string3, str string4, str string5, str string6, str ver)
|
||||
FAKKServerListItem::FAKKServerListItem(UIFAKKServerList* parent, str string1, str string2, str string3, str string4, str string5, str string6, str ver)
|
||||
{
|
||||
m_parent = parent;
|
||||
m_strings[0] = string1;
|
||||
m_strings[1] = string2;
|
||||
m_strings[2] = string3;
|
||||
@@ -164,84 +166,95 @@ void FAKKServerListItem::setListItemString(int i, str sNewString)
|
||||
void FAKKServerListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, bool bSelected, UIFont* pFont)
|
||||
{
|
||||
static cvar_t *pColoringType = Cvar_Get("cl_browserdetailedcolors", "0", CVAR_ARCHIVE);
|
||||
UIRect2D newRect = drawRect;
|
||||
vec2_t virtualScale = { 1.f, 1.f };
|
||||
|
||||
/*
|
||||
if (m_parent->isVirtual()) {
|
||||
virtualScale[0] = uid.vidWidth / 640.f;
|
||||
virtualScale[1] = uid.vidHeight / 480.f;
|
||||
newRect.size.width *= uid.vidWidth / 1024;
|
||||
newRect.size.height *= uid.vidHeight / 768;
|
||||
}
|
||||
*/
|
||||
|
||||
if (!pColoringType->integer) {
|
||||
if (IfQueryFailed() || (IsDifferentVersion() && IsQueried())) {
|
||||
if (bSelected) {
|
||||
DrawBox(drawRect, UColor(0.2f, 0.0f, 0.0f), 1.0);
|
||||
DrawBox(newRect, UColor(0.2f, 0.0f, 0.0f), 1.0);
|
||||
pFont->setColor(UColor(0.9f, 0.0f, 0.0f));
|
||||
} else {
|
||||
DrawBox(drawRect, UColor(0.1f, 0.0f, 0.0f), 1.0);
|
||||
DrawBox(newRect, UColor(0.1f, 0.0f, 0.0f), 1.0);
|
||||
pFont->setColor(UColor(0.55f, 0.0f, 0.0f));
|
||||
}
|
||||
} else if (IsQueried()) {
|
||||
if (bSelected) {
|
||||
DrawBox(drawRect, UColor(0.2f, 0.18f, 0.015f), 1.0);
|
||||
DrawBox(newRect, UColor(0.2f, 0.18f, 0.015f), 1.0);
|
||||
pFont->setColor(UColor(0.9f, 0.8f, 0.6f));
|
||||
} else {
|
||||
DrawBox(drawRect, UColor(0.02f, 0.07f, 0.004f), 1.0);
|
||||
DrawBox(newRect, UColor(0.02f, 0.07f, 0.004f), 1.0);
|
||||
pFont->setColor(UHudColor);
|
||||
}
|
||||
} else {
|
||||
if (bSelected) {
|
||||
DrawBox(drawRect, UColor(0.15f, 0.18f, 0.18f), 1.0);
|
||||
DrawBox(newRect, UColor(0.15f, 0.18f, 0.18f), 1.0);
|
||||
pFont->setColor(UColor(0.6f, 0.7f, 0.8f));
|
||||
} else {
|
||||
DrawBox(drawRect, UColor(0.005f, 0.07f, 0.02f), 1.0);
|
||||
DrawBox(newRect, UColor(0.005f, 0.07f, 0.02f), 1.0);
|
||||
pFont->setColor(UColor(0.05f, 0.5f, 0.6f));
|
||||
}
|
||||
}
|
||||
|
||||
pFont->Print(
|
||||
drawRect.pos.x + 1.0,
|
||||
drawRect.pos.y,
|
||||
newRect.pos.x / virtualScale[0] + 1.0,
|
||||
newRect.pos.y / virtualScale[1],
|
||||
getListItemString(iColumn).c_str(),
|
||||
-1,
|
||||
qfalse
|
||||
false //m_parent->isVirtual()
|
||||
);
|
||||
} else {
|
||||
if (IsDifferentVersion()) {
|
||||
if (IsQueried()) {
|
||||
if (bSelected) {
|
||||
DrawBox(drawRect, UColor(0.25f, 0.0f, 0.0f), 1.0);
|
||||
DrawBox(newRect, UColor(0.25f, 0.0f, 0.0f), 1.0);
|
||||
pFont->setColor(UColor(0.0f, 0.5f, 0.0f));
|
||||
} else {
|
||||
DrawBox(drawRect, UColor(0.005f, 0.07f, 0.02f), 1.0);
|
||||
DrawBox(newRect, UColor(0.005f, 0.07f, 0.02f), 1.0);
|
||||
pFont->setColor(UColor(0.0f, 0.35f, 0.0f));
|
||||
}
|
||||
} else {
|
||||
if (bSelected) {
|
||||
DrawBox(drawRect, UColor(0.25f, 0.0f, 0.0f), 1.0);
|
||||
DrawBox(newRect, UColor(0.25f, 0.0f, 0.0f), 1.0);
|
||||
pFont->setColor(UColor(0.5f, 0.6f, 0.7f));
|
||||
} else {
|
||||
DrawBox(drawRect, UColor(0.15f, 0.0f, 0.0f), 1.0);
|
||||
DrawBox(newRect, UColor(0.15f, 0.0f, 0.0f), 1.0);
|
||||
pFont->setColor(UColor(0.05f, 0.4f, 0.5f));
|
||||
}
|
||||
}
|
||||
} else if (IsQueried()) {
|
||||
if (bSelected) {
|
||||
DrawBox(drawRect, UColor(0.2f, 0.18f, 0.015f), 1.0);
|
||||
DrawBox(newRect, UColor(0.2f, 0.18f, 0.015f), 1.0);
|
||||
pFont->setColor(UColor(0.9f, 0.8f, 0.6f));
|
||||
} else {
|
||||
DrawBox(drawRect, UColor(0.02f, 0.07f, 0.005f), 1.0);
|
||||
DrawBox(newRect, UColor(0.02f, 0.07f, 0.005f), 1.0);
|
||||
pFont->setColor(UHudColor);
|
||||
}
|
||||
} else {
|
||||
if (bSelected) {
|
||||
DrawBox(drawRect, UColor(0.15f, 0.18f, 0.18f), 1.0);
|
||||
DrawBox(newRect, UColor(0.15f, 0.18f, 0.18f), 1.0);
|
||||
pFont->setColor(UColor(0.6f, 0.7f, 0.8f));
|
||||
} else {
|
||||
DrawBox(drawRect, UColor(0.005f, 0.07f, 0.02f), 1.0);
|
||||
DrawBox(newRect, UColor(0.005f, 0.07f, 0.02f), 1.0);
|
||||
pFont->setColor(UColor(0.05f, 0.5f, 0.6f));
|
||||
}
|
||||
|
||||
if (IfQueryFailed()) {
|
||||
DrawBox(
|
||||
UIRect2D(
|
||||
drawRect.pos.x,
|
||||
drawRect.pos.y + drawRect.size.height * 0.5 - 1.0 + drawRect.pos.y,
|
||||
drawRect.size.width,
|
||||
drawRect.size.height * 0.5 - 1.0 + drawRect.pos.y
|
||||
newRect.pos.x,
|
||||
newRect.pos.y + newRect.size.height * 0.5 - 1.0 + newRect.pos.y,
|
||||
newRect.size.width,
|
||||
newRect.size.height * 0.5 - 1.0 + newRect.pos.y
|
||||
),
|
||||
URed,
|
||||
0.3f
|
||||
@@ -249,19 +262,19 @@ void FAKKServerListItem::DrawListItem(int iColumn, const UIRect2D& drawRect, boo
|
||||
}
|
||||
|
||||
pFont->Print(
|
||||
drawRect.pos.x + 1.0,
|
||||
drawRect.pos.y,
|
||||
newRect.pos.x / virtualScale[0] + 1.0,
|
||||
newRect.pos.y / virtualScale[1],
|
||||
getListItemString(iColumn).c_str(),
|
||||
-1,
|
||||
qfalse
|
||||
false //m_parent->isVirtual()
|
||||
);
|
||||
|
||||
if (IsDifferentVersion()) {
|
||||
DrawBox(
|
||||
UIRect2D(
|
||||
drawRect.pos.x,
|
||||
drawRect.pos.y + drawRect.size.height * 0.5 - 1.0 + drawRect.pos.y,
|
||||
drawRect.size.width,
|
||||
newRect.pos.x,
|
||||
newRect.pos.y + newRect.size.height * 0.5 - 1.0 + newRect.pos.y,
|
||||
newRect.size.width,
|
||||
1.0
|
||||
),
|
||||
URed,
|
||||
@@ -730,6 +743,14 @@ void UIFAKKServerList::UpdateServer( Event *ev )
|
||||
|
||||
FAKKServerListItem* item = (FAKKServerListItem*)GetItem(getCurrentItem());
|
||||
ServerListAuxUpdate(m_serverList[0], item->m_sIP.c_str(), item->m_iGameSpyPort, true, GQueryType::qt_status);
|
||||
|
||||
if (com_target_game->integer >= target_game_e::TG_MOHTT) {
|
||||
const cvar_t* dm_omit_spearhead = Cvar_Get("dm_omit_spearhead", "0", CVAR_ARCHIVE);
|
||||
// check for Spearhead
|
||||
if (!dm_omit_spearhead->integer) {
|
||||
ServerListAuxUpdate(m_serverList[1], item->m_sIP.c_str(), item->m_iGameSpyPort, true, GQueryType::qt_status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int UIFAKKServerList::ServerCompareFunction( const UIListCtrlItem *i1, const UIListCtrlItem *i2, int columnname )
|
||||
@@ -1009,7 +1030,7 @@ void UpdateServerListCallBack(GServerList serverlist, int msg, void* instance, v
|
||||
return;
|
||||
}
|
||||
|
||||
Cvar_Set("dm_serverstatusbar", va("%i", param2));
|
||||
Cvar_Set("dm_serverstatusbar", va("%i", (int)(uintptr_t)param2));
|
||||
}
|
||||
|
||||
if (msg == LIST_PROGRESS)
|
||||
@@ -1019,23 +1040,36 @@ void UpdateServerListCallBack(GServerList serverlist, int msg, void* instance, v
|
||||
str sServerName;
|
||||
str sPlayers;
|
||||
const char* pszGameVer;
|
||||
const char* pszGameVerNumber;
|
||||
|
||||
pszHostName = ServerGetStringValue(server, "hostname", "(NONE)");
|
||||
bDiffVersion = false;
|
||||
pszGameVer = ServerGetStringValue(server, "gamever", "1.00");
|
||||
pszGameVerNumber = pszGameVer;
|
||||
|
||||
if (pszGameVerNumber[0] == 'd') {
|
||||
// demo server
|
||||
pszGameVerNumber++;
|
||||
}
|
||||
|
||||
if (com_target_game->integer >= target_game_e::TG_MOHTT) {
|
||||
if (iServerType == target_game_e::TG_MOHTT) {
|
||||
if (fabs(atof(pszGameVer) - com_target_version->value) > 0.1f) {
|
||||
//if (fabs(atof(pszGameVerNumber) - com_target_version->value) > 0.1f) {
|
||||
// bDiffVersion = true;
|
||||
//}
|
||||
if (fabs(atof(pszGameVerNumber)) < 2.3f) {
|
||||
bDiffVersion = true;
|
||||
}
|
||||
} else {
|
||||
if (fabs(atof(pszGameVer) - com_target_version->value) > 0.3f) {
|
||||
//if (fabs(atof(pszGameVerNumber) - com_target_version->value) > 0.3f) {
|
||||
// bDiffVersion = true;
|
||||
//}
|
||||
if (fabs(atof(pszGameVerNumber)) < 2.1f) {
|
||||
bDiffVersion = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (fabs(atof(pszGameVer) - com_target_version->value) > 0.1f) {
|
||||
if (fabs(atof(pszGameVerNumber) - com_target_version->value) > 0.1f) {
|
||||
bDiffVersion = true;
|
||||
}
|
||||
}
|
||||
@@ -1056,7 +1090,7 @@ void UpdateServerListCallBack(GServerList serverlist, int msg, void* instance, v
|
||||
}
|
||||
|
||||
if (i > uiServerList->getNumItems() || !pNewServerItem) {
|
||||
pNewServerItem = new FAKKServerListItem("?", sAddress, "?", "?/?", "?", "?", "?");
|
||||
pNewServerItem = new FAKKServerListItem(uiServerList, "?", sAddress, "?", "?/?", "?", "?", "?");
|
||||
pNewServerItem->m_sIP = ServerGetAddress(server);
|
||||
pNewServerItem->m_uiRealIP = iRealIP;
|
||||
pNewServerItem->m_iGameSpyPort = iGameSpyPort;
|
||||
@@ -1154,7 +1188,7 @@ void UpdateServerListCallBack(GServerList serverlist, int msg, void* instance, v
|
||||
continue;
|
||||
}
|
||||
|
||||
pNewServerItem = new FAKKServerListItem("?", sAddress, "?", "?/?", "?", "?", "?");
|
||||
pNewServerItem = new FAKKServerListItem(uiServerList, "?", sAddress, "?", "?/?", "?", "?", "?");
|
||||
pNewServerItem->m_sIP = ServerGetAddress(arrayServer);
|
||||
pNewServerItem->m_uiRealIP = iRealIP;
|
||||
pNewServerItem->m_iPort = PORT_SERVER;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -22,22 +22,42 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "cl_ui.h"
|
||||
|
||||
CLASS_DECLARATION( FilePickerClass, SoundPickerClass, NULL )
|
||||
{
|
||||
{ NULL, NULL }
|
||||
CLASS_DECLARATION(FilePickerClass, SoundPickerClass, NULL) {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
SoundPickerClass::SoundPickerClass()
|
||||
{
|
||||
// FIXME: stub
|
||||
str soundpath;
|
||||
str currentpath;
|
||||
const char *varValue;
|
||||
int i;
|
||||
|
||||
soundpath = "sound";
|
||||
|
||||
varValue = UI_GetCvarString("ui_pickedsound", NULL);
|
||||
if (varValue && *varValue) {
|
||||
currentpath = varValue;
|
||||
|
||||
for (i = currentpath.length(); i > 0; i--) {
|
||||
if (currentpath[i] == '/') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
currentpath = str(currentpath, 0, i + 1);
|
||||
} else {
|
||||
currentpath = soundpath;
|
||||
}
|
||||
}
|
||||
|
||||
void SoundPickerClass::FileSelected( str ¤tDirectory, str &partialName, str &fullname )
|
||||
void SoundPickerClass::FileSelected(const str& currentDirectory, const str& partialName, const str& fullname)
|
||||
{
|
||||
|
||||
uii.Snd_PlaySound(fullname);
|
||||
}
|
||||
|
||||
void SoundPickerClass::FileChosen( str ¤tDirectory, str &partialName, str &fullname )
|
||||
void SoundPickerClass::FileChosen(const str& currentDirectory, const str& partialName, const str& fullname)
|
||||
{
|
||||
|
||||
uii.Cvar_Set("ui_pickedsound", fullname);
|
||||
CloseWindow();
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015 the OpenMoHAA team
|
||||
Copyright (C) 2023 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
@@ -20,17 +20,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UISOUNDPICKER_H__
|
||||
#define __CL_UISOUNDPICKER_H__
|
||||
#pragma once
|
||||
|
||||
class SoundPickerClass : public FilePickerClass {
|
||||
class SoundPickerClass : public FilePickerClass
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE( SoundPickerClass );
|
||||
CLASS_PROTOTYPE(SoundPickerClass);
|
||||
|
||||
SoundPickerClass();
|
||||
SoundPickerClass();
|
||||
|
||||
void FileSelected( str ¤tDirectory, str &partialName, str &fullname ) override;
|
||||
void FileChosen( str ¤tDirectory, str &partialName, str &fullname ) override;
|
||||
void FileSelected(const str& currentDirectory, const str& partialName, const str& fullname) override;
|
||||
void FileChosen(const str& currentDirectory, const str& partialName, const str& fullname) override;
|
||||
};
|
||||
|
||||
#endif /* __CL_UISOUNDPICKER_H__ */
|
||||
+1174
-1158
File diff suppressed because it is too large.
Load diff
+73
-70
@@ -20,85 +20,88 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UISTD_H__
|
||||
#define __CL_UISTD_H__
|
||||
#pragma once
|
||||
|
||||
typedef enum {
|
||||
L_STATBAR_NONE,
|
||||
L_STATBAR_HORIZONTAL,
|
||||
L_STATBAR_VERTICAL,
|
||||
L_STATBAR_VERTICAL_REVERSE,
|
||||
L_STATBAR_VERTICAL_STAGGER_EVEN,
|
||||
L_STATBAR_VERTICAL_STAGGER_ODD,
|
||||
L_STATBAR_CIRCULAR,
|
||||
L_STATBAR_NEEDLE,
|
||||
L_STATBAR_ROTATOR,
|
||||
L_STATBAR_COMPASS,
|
||||
L_STATBAR_SPINNER,
|
||||
L_STATBAR_HEADING_SPINNER
|
||||
L_STATBAR_NONE,
|
||||
L_STATBAR_HORIZONTAL,
|
||||
L_STATBAR_VERTICAL,
|
||||
L_STATBAR_VERTICAL_REVERSE,
|
||||
L_STATBAR_VERTICAL_STAGGER_EVEN,
|
||||
L_STATBAR_VERTICAL_STAGGER_ODD,
|
||||
L_STATBAR_CIRCULAR,
|
||||
L_STATBAR_NEEDLE,
|
||||
L_STATBAR_ROTATOR,
|
||||
L_STATBAR_COMPASS,
|
||||
L_STATBAR_SPINNER,
|
||||
L_STATBAR_HEADING_SPINNER
|
||||
} statbar_orientation_t;
|
||||
|
||||
class UIFakkLabel : public UILabel {
|
||||
extern Event EV_ClearInvItemReference;
|
||||
|
||||
class UIFakkLabel : public UILabel
|
||||
{
|
||||
protected:
|
||||
SafePtr<inventory_item_t> m_lastitem;
|
||||
int m_lastitemindex;
|
||||
int m_stat;
|
||||
int m_stat_configstring;
|
||||
int m_maxstat;
|
||||
int m_itemindex;
|
||||
int m_inventoryrendermodelindex;
|
||||
str m_sDrawModelName;
|
||||
qboolean m_rendermodel;
|
||||
statbar_orientation_t m_statbar_or;
|
||||
float m_statbar_min;
|
||||
float m_statbar_max;
|
||||
float m_lastfrac;
|
||||
float m_flashtime;
|
||||
vec3_t m_offset;
|
||||
vec3_t m_rotateoffset;
|
||||
vec3_t m_angles;
|
||||
float m_scale;
|
||||
str m_anim;
|
||||
UIReggedMaterial *m_statbar_material;
|
||||
UIReggedMaterial *m_statbar_material_flash;
|
||||
SafePtr<inventory_item_t> m_lastitem;
|
||||
int m_lastitemindex;
|
||||
int m_stat;
|
||||
int m_stat_alpha;
|
||||
int m_stat_configstring;
|
||||
int m_maxstat;
|
||||
int m_itemindex;
|
||||
int m_inventoryrendermodelindex;
|
||||
str m_sDrawModelName;
|
||||
qboolean m_rendermodel;
|
||||
statbar_orientation_t m_statbar_or;
|
||||
float m_statbar_min;
|
||||
float m_statbar_max;
|
||||
float m_lastfrac;
|
||||
float m_flashtime;
|
||||
vec3_t m_offset;
|
||||
vec3_t m_rotateoffset;
|
||||
vec3_t m_angles;
|
||||
float m_scale;
|
||||
str m_anim;
|
||||
UIReggedMaterial *m_statbar_material;
|
||||
UIReggedMaterial *m_statbar_material_flash;
|
||||
UIReggedMaterial *m_statbar_material_marker;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( UIFakkLabel );
|
||||
CLASS_PROTOTYPE(UIFakkLabel);
|
||||
|
||||
UIFakkLabel();
|
||||
UIFakkLabel();
|
||||
|
||||
void LayoutPlayerStat( Event *ev );
|
||||
void LayoutPlayerStatConfigstring( Event *ev );
|
||||
void LayoutMaxPlayerStat( Event *ev );
|
||||
void LayoutItemIndex( Event *ev );
|
||||
void InventoryRenderModelIndex( Event *ev );
|
||||
void LayoutModelName( Event *ev );
|
||||
void ClearInvItemReference( Event *ev );
|
||||
void LayoutStatbar( Event *ev );
|
||||
void LayoutStatbarShader( Event *ev );
|
||||
void LayoutStatbarTileShader( Event *ev );
|
||||
void LayoutStatbarShader_Flash( Event *ev );
|
||||
void LayoutStatbarEndAngles( Event *ev );
|
||||
void LayoutStatbarNeedleWidth( Event *ev );
|
||||
void LayoutStatbarRotatorSize( Event *ev );
|
||||
void LayoutStatbarTileShader_Flash( Event *ev );
|
||||
void LayoutRenderModel( Event *ev );
|
||||
void LayoutRenderModelOffset( Event *ev );
|
||||
void LayoutRenderModelRotateOffset( Event *ev );
|
||||
void LayoutRenderModelAngles( Event *ev );
|
||||
void LayoutRenderModelScale( Event *ev );
|
||||
void LayoutRenderModelAnim( Event *ev );
|
||||
void LayoutPlayerStat(Event *ev);
|
||||
void LayoutPlayerStatAlpha(Event *ev); // Added in 2.0
|
||||
void LayoutPlayerStatConfigstring(Event *ev);
|
||||
void LayoutMaxPlayerStat(Event *ev);
|
||||
void LayoutItemIndex(Event *ev);
|
||||
void InventoryRenderModelIndex(Event *ev);
|
||||
void LayoutModelName(Event *ev);
|
||||
void ClearInvItemReference(Event *ev);
|
||||
void LayoutStatbar(Event *ev);
|
||||
void LayoutStatbarShader(Event *ev);
|
||||
void LayoutStatbarTileShader(Event *ev);
|
||||
void LayoutStatbarShader_Flash(Event *ev);
|
||||
void LayoutStatbarShader_Marker(Event *ev); // Added in 2.0
|
||||
void LayoutStatbarEndAngles(Event *ev);
|
||||
void LayoutStatbarNeedleWidth(Event *ev);
|
||||
void LayoutStatbarRotatorSize(Event *ev);
|
||||
void LayoutStatbarTileShader_Flash(Event *ev);
|
||||
void LayoutRenderModel(Event *ev);
|
||||
void LayoutRenderModelOffset(Event *ev);
|
||||
void LayoutRenderModelRotateOffset(Event *ev);
|
||||
void LayoutRenderModelAngles(Event *ev);
|
||||
void LayoutRenderModelScale(Event *ev);
|
||||
void LayoutRenderModelAnim(Event *ev);
|
||||
|
||||
void DrawStatbar( float frac );
|
||||
void DrawStatCircle( float frac );
|
||||
void DrawStatNeedle( float frac );
|
||||
void DrawStatRotator( float frac );
|
||||
void DrawStatCompass( float frac );
|
||||
void DrawStatSpinner( float frac );
|
||||
void StatCircleTexCoord( float fAng, vec3_t vTexCoord );
|
||||
void DrawStatbar(float frac);
|
||||
void DrawStatCircle(float frac);
|
||||
void DrawStatNeedle(float frac);
|
||||
void DrawStatRotator(float frac);
|
||||
void DrawStatCompass(float frac);
|
||||
void DrawStatSpinner(float frac);
|
||||
void StatCircleTexCoord(float fAng, vec3_t vTexCoord);
|
||||
|
||||
void Draw( void ) override;
|
||||
void Draw(void) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+513
-364
@@ -21,424 +21,573 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "cl_ui.h"
|
||||
#include "../qcommon/localization.h"
|
||||
|
||||
CLASS_DECLARATION( UIWidget, View3D, NULL )
|
||||
{
|
||||
{ &W_Activated, &View3D::OnActivate },
|
||||
{ &W_Deactivated, &View3D::OnDeactivate },
|
||||
{ &W_LeftMouseDown, &View3D::Pressed },
|
||||
{ NULL, NULL }
|
||||
CLASS_DECLARATION(UIWidget, View3D, NULL) {
|
||||
{&W_Activated, &View3D::OnActivate },
|
||||
{&W_Deactivated, &View3D::OnDeactivate},
|
||||
{&W_LeftMouseDown, &View3D::Pressed },
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
#define MAX_SUBTITLES 4
|
||||
|
||||
cvar_t* subs[MAX_SUBTITLES];
|
||||
cvar_t* teams[MAX_SUBTITLES];
|
||||
float fadeTime[MAX_SUBTITLES];
|
||||
float subLife[MAX_SUBTITLES];
|
||||
float alpha[MAX_SUBTITLES];
|
||||
char oldStrings[MAX_SUBTITLES][2048];
|
||||
cvar_t *subs[MAX_SUBTITLES];
|
||||
cvar_t *teams[MAX_SUBTITLES];
|
||||
float fadeTime[MAX_SUBTITLES];
|
||||
float subLife[MAX_SUBTITLES];
|
||||
float alpha[MAX_SUBTITLES];
|
||||
char oldStrings[MAX_SUBTITLES][2048];
|
||||
|
||||
View3D::View3D()
|
||||
{
|
||||
// set as transparent
|
||||
setBackgroundColor(UClear, true);
|
||||
// no border
|
||||
setBorderStyle(border_none);
|
||||
AllowActivate(true);
|
||||
// set as transparent
|
||||
setBackgroundColor(UClear, true);
|
||||
// no border
|
||||
setBorderStyle(border_none);
|
||||
AllowActivate(true);
|
||||
|
||||
m_printfadetime = 0.0;
|
||||
m_print_mat = NULL;
|
||||
m_locationprint = qfalse;
|
||||
m_printfadetime = 0.0;
|
||||
m_print_mat = NULL;
|
||||
m_locationprint = qfalse;
|
||||
}
|
||||
|
||||
void View3D::Draw
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
void View3D::UpdateLocationPrint(int x, int y, const char *s, float alpha)
|
||||
{
|
||||
if (clc.state != CA_DISCONNECTED) {
|
||||
SCR_DrawScreenField();
|
||||
}
|
||||
|
||||
set2D();
|
||||
|
||||
re.SavePerformanceCounters();
|
||||
|
||||
Draw2D();
|
||||
m_printstring = s;
|
||||
m_printalpha = alpha;
|
||||
m_printfadetime = 4000.0;
|
||||
m_x_coord = x;
|
||||
m_y_coord = y;
|
||||
m_locationprint = qtrue;
|
||||
}
|
||||
|
||||
void View3D::DrawLetterbox
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
void View3D::UpdateCenterPrint(const char *s, float alpha)
|
||||
{
|
||||
float frac;
|
||||
vec4_t col;
|
||||
m_printstring = s;
|
||||
|
||||
col[0] = col[1] = col[2] = 0;
|
||||
col[3] = 1;
|
||||
if (s[0] == '@') {
|
||||
m_print_mat = uWinMan.RegisterShader(s + 1);
|
||||
} else {
|
||||
m_print_mat = NULL;
|
||||
}
|
||||
|
||||
frac = cl.snap.ps.stats[STAT_LETTERBOX] / 32767.0;
|
||||
if (frac > 0.0) {
|
||||
m_letterbox_active = true;
|
||||
re.SetColor(col);
|
||||
|
||||
re.DrawBox(0.0, 0.0, m_screenframe.size.width, m_screenframe.size.height);
|
||||
re.DrawBox(0.0, m_screenframe.size.height - m_screenframe.size.height * frac, m_screenframe.size.width, m_screenframe.size.height);
|
||||
} else {
|
||||
m_letterbox_active = false;
|
||||
}
|
||||
m_printalpha = alpha;
|
||||
m_printfadetime = 4000.0;
|
||||
m_locationprint = qfalse;
|
||||
}
|
||||
|
||||
void View3D::DrawFades
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
void View3D::PrintSound(int channel, const char *name, float vol, int rvol, float pitch, float base, int& line)
|
||||
{
|
||||
if (cl.snap.ps.blend[3] > 0) {
|
||||
re.SetColor(cl.snap.ps.blend);
|
||||
if (cl.snap.ps.stats[STAT_ADDFADE]) {
|
||||
re.AddBox(0.0, 0.0, m_screenframe.size.width, m_screenframe.size.height);
|
||||
} else {
|
||||
re.DrawBox(0.0, 0.0, m_screenframe.size.width, m_screenframe.size.height);
|
||||
}
|
||||
}
|
||||
char buf[255];
|
||||
float x;
|
||||
float xStep;
|
||||
float height;
|
||||
|
||||
height = m_font->getHeight(false);
|
||||
xStep = height;
|
||||
|
||||
x = 0;
|
||||
sprintf(buf, "%d", channel);
|
||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
||||
|
||||
x += xStep + xStep;
|
||||
sprintf(buf, "%s", name);
|
||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
||||
|
||||
x += xStep * 30.0;
|
||||
sprintf(buf, "vol:%.2f", vol);
|
||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
||||
|
||||
x += xStep * 8;
|
||||
sprintf(buf, "rvol:%.2f", (float)(rvol / 128.f));
|
||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
||||
|
||||
x += xStep * 5;
|
||||
sprintf(buf, "pit:%.2f", pitch);
|
||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
||||
|
||||
x += xStep * 5;
|
||||
sprintf(buf, "base:%d", (int)base);
|
||||
m_font->Print(x, height * line + m_frame.pos.y, buf, -1, false);
|
||||
|
||||
line++;
|
||||
}
|
||||
|
||||
void View3D::Draw2D
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
void View3D::Pressed(Event *ev)
|
||||
{
|
||||
if (!cls.no_menus) {
|
||||
DrawFades();
|
||||
}
|
||||
|
||||
DrawLetterbox();
|
||||
|
||||
if ((cl_debuggraph->integer || cl_timegraph->integer) && !cls.no_menus)
|
||||
{
|
||||
SCR_DrawDebugGraph();
|
||||
}
|
||||
else if (!cls.no_menus)
|
||||
{
|
||||
if (cge) {
|
||||
cge->CG_Draw2D();
|
||||
}
|
||||
|
||||
if (m_locationprint) {
|
||||
LocationPrint();
|
||||
} else {
|
||||
CenterPrint();
|
||||
}
|
||||
|
||||
if (!cls.no_menus)
|
||||
{
|
||||
DrawSoundOverlay();
|
||||
DrawSubtitleOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
if (fps->integer && !cls.no_menus)
|
||||
{
|
||||
DrawFPS();
|
||||
DrawProf();
|
||||
}
|
||||
IN_MouseOff();
|
||||
OnActivate(ev);
|
||||
}
|
||||
|
||||
void View3D::DrawFPS
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
void View3D::OnDeactivate(Event *ev)
|
||||
{
|
||||
char string[128];
|
||||
|
||||
setFont("verdana-14");
|
||||
if (fps->integer == 2)
|
||||
{
|
||||
re.SetColor(UBlack);
|
||||
re.DrawBox(
|
||||
0.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 4.0,
|
||||
m_frame.pos.x + m_frame.size.width,
|
||||
m_font->getHeight(qfalse) * 4.0
|
||||
);
|
||||
}
|
||||
|
||||
sprintf(string, "FPS %4.1f", currentfps);
|
||||
if (currentfps > 23.94) {
|
||||
if (cl_greenfps->integer) {
|
||||
m_font->setColor(UGreen);
|
||||
} else {
|
||||
m_font->setColor(UWhite);
|
||||
}
|
||||
} else if (currentfps > 18.0) {
|
||||
m_font->setColor(UYellow);
|
||||
} else {
|
||||
// low fps
|
||||
m_font->setColor(URed);
|
||||
}
|
||||
|
||||
m_font->Print(
|
||||
m_font->getHeight(qfalse) * 10.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 3.0,
|
||||
string,
|
||||
-1,
|
||||
qfalse
|
||||
);
|
||||
|
||||
// Draw elements count
|
||||
if (cl_greenfps->integer) {
|
||||
m_font->setColor(UGreen);
|
||||
}
|
||||
else {
|
||||
m_font->setColor(UWhite);
|
||||
}
|
||||
|
||||
sprintf(string, "wt%5d wv%5d cl%d", cls.world_tris, cls.world_verts, cls.character_lights);
|
||||
|
||||
m_font->Print(
|
||||
m_font->getHeight(qfalse) * 10.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 2.0,
|
||||
string,
|
||||
-1,
|
||||
qfalse
|
||||
);
|
||||
|
||||
sprintf(string, "t%5d v%5d Mtex%5.2f", cls.total_tris, cls.total_verts, (float)cls.total_texels * 0.00000095367432);
|
||||
|
||||
|
||||
m_font->Print(
|
||||
m_font->getHeight(qfalse) * 10.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse),
|
||||
string,
|
||||
-1,
|
||||
qfalse
|
||||
);
|
||||
|
||||
m_font->setColor(UBlack);
|
||||
cls.keyCatchers |= KEYCATCH_UI;
|
||||
}
|
||||
|
||||
void View3D::DrawProf
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
void View3D::OnActivate(Event *ev)
|
||||
{
|
||||
// Normal empty function
|
||||
}
|
||||
|
||||
void View3D::PrintSound
|
||||
(
|
||||
int channel,
|
||||
const char *name,
|
||||
float vol,
|
||||
int rvol,
|
||||
float pitch,
|
||||
float base,
|
||||
int& line
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void View3D::DrawSoundOverlay
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
{
|
||||
setFont("verdana-14");
|
||||
m_font->setColor(UWhite);
|
||||
|
||||
if (sound_overlay->integer) {
|
||||
Com_Printf("sound_overlay isn't supported with OpenAL/SDL right now.\n");
|
||||
Cvar_Set("sound_overlay", "0");
|
||||
}
|
||||
}
|
||||
|
||||
void View3D::CenterPrint
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void View3D::LocationPrint
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void View3D::OnActivate
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
{
|
||||
UIWidget* wid;
|
||||
UList<UIWidget*> widgets;
|
||||
UIWidget *wid;
|
||||
UList<UIWidget *> widgets;
|
||||
|
||||
UI_CloseInventory();
|
||||
cls.keyCatchers &= ~KEYCATCH_UI;
|
||||
|
||||
for (wid = getParent()->getFirstChild(); wid; wid = getParent()->getNextChild(wid))
|
||||
{
|
||||
if (wid->getAlwaysOnBottom() && wid != this) {
|
||||
widgets.AddTail(wid);
|
||||
}
|
||||
}
|
||||
for (wid = getParent()->getFirstChild(); wid; wid = getParent()->getNextChild(wid)) {
|
||||
if (wid->getAlwaysOnBottom() && wid != this) {
|
||||
widgets.AddTail(wid);
|
||||
}
|
||||
}
|
||||
|
||||
widgets.IterateFromHead();
|
||||
while (widgets.IsCurrentValid())
|
||||
{
|
||||
widgets.getCurrent()->BringToFrontPropogated();
|
||||
widgets.IterateNext();
|
||||
}
|
||||
widgets.IterateFromHead();
|
||||
while (widgets.IsCurrentValid()) {
|
||||
widgets.getCurrent()->BringToFrontPropogated();
|
||||
widgets.IterateNext();
|
||||
}
|
||||
}
|
||||
|
||||
void View3D::OnDeactivate
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void View3D::LocationPrint(void)
|
||||
{
|
||||
cls.keyCatchers |= KEYCATCH_UI;
|
||||
fonthorzjustify_t horiz;
|
||||
fontvertjustify_t vert;
|
||||
int x, y;
|
||||
const char *p;
|
||||
float alpha;
|
||||
UIRect2D frame;
|
||||
|
||||
if (!m_printfadetime) {
|
||||
m_locationprint = false;
|
||||
return;
|
||||
}
|
||||
|
||||
horiz = FONT_JUSTHORZ_LEFT;
|
||||
vert = FONT_JUSTVERT_TOP;
|
||||
|
||||
p = Sys_LV_CL_ConvertString(m_printstring);
|
||||
if (m_printfadetime > 3250) {
|
||||
alpha = 1.f - (m_printfadetime - 3250.f) / 750.f * m_printalpha;
|
||||
} else if (m_printfadetime >= 750) {
|
||||
alpha = 1.f;
|
||||
} else {
|
||||
alpha = m_printfadetime / 750.f * m_printalpha;
|
||||
}
|
||||
|
||||
alpha = Q_clamp_float(alpha, 0, 1);
|
||||
|
||||
x = m_x_coord / 640.f * m_screenframe.size.width;
|
||||
y = (480 - m_font->getHeight(false) - m_y_coord) / 480.f * m_screenframe.size.height;
|
||||
|
||||
if (m_x_coord == -1) {
|
||||
horiz = FONT_JUSTHORZ_CENTER;
|
||||
x = 0;
|
||||
}
|
||||
if (m_y_coord == -1) {
|
||||
vert = FONT_JUSTVERT_CENTER;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
m_font->setColor(UColor(0, 0, 0, alpha));
|
||||
frame = getClientFrame();
|
||||
|
||||
m_font->PrintJustified(
|
||||
UIRect2D(frame.pos.x + x + 1, frame.pos.y + y + 1, frame.size.width, frame.size.height),
|
||||
horiz,
|
||||
vert,
|
||||
p,
|
||||
m_bVirtual ? m_vVirtualScale : NULL
|
||||
);
|
||||
|
||||
m_font->setColor(UColor(1, 1, 1, alpha));
|
||||
frame = getClientFrame();
|
||||
|
||||
m_font->PrintJustified(
|
||||
UIRect2D(frame.pos.x + x, frame.pos.y + y, frame.size.width, frame.size.height),
|
||||
horiz,
|
||||
vert,
|
||||
p,
|
||||
m_bVirtual ? m_vVirtualScale : NULL
|
||||
);
|
||||
|
||||
m_font->setColor(UBlack);
|
||||
m_printfadetime -= cls.frametime;
|
||||
|
||||
if (m_printfadetime < 0) {
|
||||
m_printfadetime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void View3D::DrawSubtitleOverlay
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
qboolean View3D::LetterboxActive(void)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void View3D::ClearCenterPrint
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
{
|
||||
m_printfadetime = 0.0;
|
||||
}
|
||||
|
||||
void View3D::UpdateCenterPrint
|
||||
(
|
||||
const char *s,
|
||||
float alpha
|
||||
)
|
||||
|
||||
{
|
||||
m_printstring = s;
|
||||
|
||||
if (s[0] == '@') {
|
||||
m_print_mat = uWinMan.RegisterShader(s + 1);
|
||||
} else {
|
||||
m_print_mat = NULL;
|
||||
}
|
||||
|
||||
m_printalpha = alpha;
|
||||
m_printfadetime = 4000.0;
|
||||
m_locationprint = qfalse;
|
||||
}
|
||||
|
||||
void View3D::UpdateLocationPrint
|
||||
(
|
||||
int x,
|
||||
int y,
|
||||
const char *s,
|
||||
float alpha
|
||||
)
|
||||
|
||||
{
|
||||
m_printstring = s;
|
||||
m_printalpha = alpha;
|
||||
m_printfadetime = 4000.0;
|
||||
m_x_coord = x;
|
||||
m_y_coord = y;
|
||||
m_locationprint = qtrue;
|
||||
}
|
||||
|
||||
qboolean View3D::LetterboxActive
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
{
|
||||
return m_letterbox_active;
|
||||
return m_letterbox_active;
|
||||
}
|
||||
|
||||
float avWidth = 0.0;
|
||||
|
||||
void View3D::InitSubtitle
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
void View3D::InitSubtitle(void)
|
||||
{
|
||||
float totalWidth;
|
||||
float totalWidth;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
subs[i] = Cvar_Get(va("subtitle%d", i), "", 0);
|
||||
teams[i] = Cvar_Get(va("subteam%d", i), "0", 0);
|
||||
strcpy(oldStrings[i], subs[i]->string);
|
||||
fadeTime[i] = 4000.0;
|
||||
subLife[i] = 4000.0;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
subs[i] = Cvar_Get(va("subtitle%d", i), "", 0);
|
||||
teams[i] = Cvar_Get(va("subteam%d", i), "0", 0);
|
||||
strcpy(oldStrings[i], subs[i]->string);
|
||||
fadeTime[i] = 4000.0;
|
||||
subLife[i] = 4000.0;
|
||||
}
|
||||
|
||||
totalWidth = 0.0;
|
||||
for (char j = 'A'; j <= 'Z'; j++) {
|
||||
totalWidth += m_font->getCharWidth(j);
|
||||
}
|
||||
totalWidth = 0.0;
|
||||
for (char j = 'A'; j <= 'Z'; j++) {
|
||||
totalWidth += m_font->getCharWidth(j);
|
||||
}
|
||||
|
||||
avWidth = totalWidth / 26.0;
|
||||
avWidth = totalWidth / 26.0;
|
||||
}
|
||||
|
||||
void View3D::FrameInitialized
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
void View3D::FrameInitialized(void)
|
||||
{
|
||||
Connect(this, W_Activated, W_Activated);
|
||||
Connect(this, W_Deactivated, W_Deactivated);
|
||||
Connect(this, W_Activated, W_Activated);
|
||||
Connect(this, W_Deactivated, W_Deactivated);
|
||||
}
|
||||
|
||||
void View3D::Pressed
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
|
||||
void View3D::DrawSubtitleOverlay(void)
|
||||
{
|
||||
IN_MouseOff();
|
||||
OnActivate(ev);
|
||||
cvar_t *subAlpha;
|
||||
int i;
|
||||
float minX, maxY;
|
||||
int line;
|
||||
|
||||
subAlpha = Cvar_Get("subAlpha", "0.5", 0);
|
||||
|
||||
setFont("facfont-20");
|
||||
m_font->setColor(URed);
|
||||
|
||||
for (i = 0; i < MAX_SUBTITLES; i++) {
|
||||
if (strcmp(oldStrings[i], subs[i]->string)) {
|
||||
fadeTime[i] = 2500 * ((strlen(subs[i]->string) / 68) + 1.f) + 1500;
|
||||
subLife[i] = fadeTime[i];
|
||||
Q_strncpyz(oldStrings[i], subs[i]->string, sizeof(oldStrings[i]));
|
||||
}
|
||||
|
||||
if (fadeTime[i] > subLife[i] - 750.f) {
|
||||
alpha[i] = 1.f - (fadeTime[i] - (subLife[i] - 750.f)) / 750.f;
|
||||
} else if (fadeTime[i] < 750) {
|
||||
alpha[i] = fadeTime[i] / 750.f;
|
||||
} else {
|
||||
alpha[i] = 1.f;
|
||||
}
|
||||
|
||||
fadeTime[i] -= cls.frametime;
|
||||
if (fadeTime[i] < 0) {
|
||||
// Clear the subtitle
|
||||
fadeTime[i] = 0;
|
||||
oldStrings[i][0] = 0;
|
||||
Cvar_Set(va("subtitle%d", i), "");
|
||||
}
|
||||
}
|
||||
|
||||
minX = m_screenframe.size.height - m_font->getHeight(false) * 10;
|
||||
maxY = (m_frame.pos.x + m_frame.size.width) - (m_frame.pos.x + m_frame.size.width) * 0.2f;
|
||||
line = 0;
|
||||
|
||||
for (i = 0; i < MAX_SUBTITLES; i++) {
|
||||
if (m_font->getWidth(subs[i]->string, sizeof(oldStrings[i])) > maxY) {
|
||||
char buf[2048];
|
||||
char *c;
|
||||
char *end;
|
||||
char *start;
|
||||
float total;
|
||||
int blockcount;
|
||||
|
||||
c = buf;
|
||||
strcpy(buf, subs[i]->string);
|
||||
|
||||
total = 0;
|
||||
end = NULL;
|
||||
start = buf;
|
||||
while (*c) {
|
||||
blockcount = m_font->DBCSGetWordBlockCount(c, -1);
|
||||
if (!blockcount) {
|
||||
break;
|
||||
}
|
||||
|
||||
total += m_font->getWidth(c, blockcount);
|
||||
c += blockcount;
|
||||
|
||||
if (total > maxY) {
|
||||
total = 0;
|
||||
if (end < start) {
|
||||
Com_DPrintf("ERROR - word longer than possible line\n");
|
||||
break;
|
||||
}
|
||||
|
||||
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
|
||||
m_font->Print(18, m_font->getHeight(false) * line + minX + 1.f, start, -1, false);
|
||||
|
||||
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
|
||||
m_font->Print(20, m_font->getHeight(false) * line + minX, start, -1, false);
|
||||
|
||||
start = end + 1;
|
||||
c = end + 1;
|
||||
line++;
|
||||
}
|
||||
}
|
||||
|
||||
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
|
||||
m_font->Print(18, m_font->getHeight(false) * line + minX + 1.f, start, -1, qfalse);
|
||||
|
||||
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
|
||||
m_font->Print(20, m_font->getHeight(false) * line + minX, start, -1, qfalse);
|
||||
line++;
|
||||
} else {
|
||||
m_font->setColor(UColor(0, 0, 0, alpha[i] * subAlpha->value));
|
||||
m_font->Print(18, m_font->getHeight(false) * line + minX + 1.f, subs[i]->string, -1, qfalse);
|
||||
|
||||
m_font->setColor(UColor(1, 1, 1, alpha[i] * subAlpha->value));
|
||||
m_font->Print(20, m_font->getHeight(false) * line + minX, subs[i]->string, -1, qfalse);
|
||||
|
||||
line++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CLASS_DECLARATION( UIWidget, ConsoleView, NULL )
|
||||
void View3D::DrawSoundOverlay(void)
|
||||
{
|
||||
{ NULL, NULL }
|
||||
setFont("verdana-14");
|
||||
m_font->setColor(UWhite);
|
||||
|
||||
// FIXME: TODO
|
||||
if (sound_overlay->integer) {
|
||||
Com_Printf("sound_overlay isn't supported with OpenAL/SDL right now.\n");
|
||||
Cvar_Set("sound_overlay", "0");
|
||||
}
|
||||
}
|
||||
|
||||
void View3D::DrawProf(void)
|
||||
{
|
||||
// Normal empty function
|
||||
}
|
||||
|
||||
void View3D::DrawLetterbox(void)
|
||||
{
|
||||
float frac;
|
||||
vec4_t col;
|
||||
|
||||
col[0] = col[1] = col[2] = 0;
|
||||
col[3] = 1;
|
||||
|
||||
frac = cl.snap.ps.stats[STAT_LETTERBOX] / 32767.0;
|
||||
if (frac > 0.0) {
|
||||
m_letterbox_active = true;
|
||||
re.SetColor(col);
|
||||
|
||||
re.DrawBox(0.0, 0.0, m_screenframe.size.width, m_screenframe.size.height);
|
||||
re.DrawBox(
|
||||
0.0,
|
||||
m_screenframe.size.height - m_screenframe.size.height * frac,
|
||||
m_screenframe.size.width,
|
||||
m_screenframe.size.height
|
||||
);
|
||||
} else {
|
||||
m_letterbox_active = false;
|
||||
}
|
||||
}
|
||||
|
||||
void View3D::DrawFades(void)
|
||||
{
|
||||
if (cl.snap.ps.blend[3] > 0) {
|
||||
re.SetColor(cl.snap.ps.blend);
|
||||
if (cl.snap.ps.stats[STAT_ADDFADE]) {
|
||||
re.AddBox(0.0, 0.0, m_screenframe.size.width, m_screenframe.size.height);
|
||||
} else {
|
||||
re.DrawBox(0.0, 0.0, m_screenframe.size.width, m_screenframe.size.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void View3D::DrawFPS(void)
|
||||
{
|
||||
char string[128];
|
||||
|
||||
setFont("verdana-14");
|
||||
if (fps->integer == 2) {
|
||||
re.SetColor(UBlack);
|
||||
re.DrawBox(
|
||||
0.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 4.0,
|
||||
m_frame.pos.x + m_frame.size.width,
|
||||
m_font->getHeight(qfalse) * 4.0
|
||||
);
|
||||
}
|
||||
|
||||
sprintf(string, "FPS %4.1f", currentfps);
|
||||
if (currentfps > 23.94) {
|
||||
if (cl_greenfps->integer) {
|
||||
m_font->setColor(UGreen);
|
||||
} else {
|
||||
m_font->setColor(UWhite);
|
||||
}
|
||||
} else if (currentfps > 18.0) {
|
||||
m_font->setColor(UYellow);
|
||||
} else {
|
||||
// low fps
|
||||
m_font->setColor(URed);
|
||||
}
|
||||
|
||||
m_font->Print(
|
||||
m_font->getHeight(qfalse) * 10.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 3.0,
|
||||
string,
|
||||
-1,
|
||||
qfalse
|
||||
);
|
||||
|
||||
// Draw elements count
|
||||
if (cl_greenfps->integer) {
|
||||
m_font->setColor(UGreen);
|
||||
} else {
|
||||
m_font->setColor(UWhite);
|
||||
}
|
||||
|
||||
sprintf(string, "wt%5d wv%5d cl%d", cls.world_tris, cls.world_verts, cls.character_lights);
|
||||
|
||||
m_font->Print(
|
||||
m_font->getHeight(qfalse) * 10.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse) * 2.0,
|
||||
string,
|
||||
-1,
|
||||
qfalse
|
||||
);
|
||||
|
||||
sprintf(string, "t%5d v%5d Mtex%5.2f", cls.total_tris, cls.total_verts, (float)cls.total_texels * 0.00000095367432);
|
||||
|
||||
m_font->Print(
|
||||
m_font->getHeight(qfalse) * 10.0,
|
||||
m_frame.pos.y + m_frame.size.height - m_font->getHeight(qfalse),
|
||||
string,
|
||||
-1,
|
||||
qfalse
|
||||
);
|
||||
|
||||
m_font->setColor(UBlack);
|
||||
}
|
||||
|
||||
void View3D::Draw2D(void)
|
||||
{
|
||||
if (!cls.no_menus) {
|
||||
DrawFades();
|
||||
}
|
||||
|
||||
DrawLetterbox();
|
||||
|
||||
if ((cl_debuggraph->integer || cl_timegraph->integer) && !cls.no_menus) {
|
||||
SCR_DrawDebugGraph();
|
||||
} else if (!cls.no_menus) {
|
||||
if (cge) {
|
||||
cge->CG_Draw2D();
|
||||
}
|
||||
|
||||
if (m_locationprint) {
|
||||
LocationPrint();
|
||||
} else {
|
||||
CenterPrint();
|
||||
}
|
||||
|
||||
if (!cls.no_menus) {
|
||||
DrawSoundOverlay();
|
||||
DrawSubtitleOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
if (fps->integer && !cls.no_menus) {
|
||||
DrawFPS();
|
||||
DrawProf();
|
||||
}
|
||||
}
|
||||
|
||||
void View3D::Draw(void)
|
||||
{
|
||||
if (clc.state != CA_DISCONNECTED) {
|
||||
SCR_DrawScreenField();
|
||||
}
|
||||
|
||||
set2D();
|
||||
|
||||
re.SavePerformanceCounters();
|
||||
|
||||
Draw2D();
|
||||
}
|
||||
|
||||
void View3D::ClearCenterPrint(void)
|
||||
{
|
||||
m_printfadetime = 0.0;
|
||||
}
|
||||
|
||||
void View3D::CenterPrint(void)
|
||||
{
|
||||
float alpha;
|
||||
const char *p;
|
||||
qhandle_t mat;
|
||||
float x, y;
|
||||
float w, h;
|
||||
|
||||
if (!m_printfadetime) {
|
||||
return;
|
||||
}
|
||||
|
||||
p = Sys_LV_CL_ConvertString(m_printstring);
|
||||
if (m_printfadetime > 3250) {
|
||||
alpha = 1.f - (m_printfadetime - 3250.f) / 750.f * m_printalpha;
|
||||
} else if (m_printfadetime >= 750) {
|
||||
alpha = 1.f;
|
||||
} else {
|
||||
alpha = m_printfadetime / 750.f * m_printalpha;
|
||||
}
|
||||
|
||||
alpha = Q_clamp_float(alpha, 0, 1);
|
||||
|
||||
if (!m_print_mat) {
|
||||
UIRect2D frame;
|
||||
m_font->setColor(UColor(0, 0, 0, alpha));
|
||||
|
||||
frame = getClientFrame();
|
||||
|
||||
m_font->PrintJustified(
|
||||
UIRect2D(frame.pos.x + 1, frame.pos.y + 1, frame.size.width, frame.size.height),
|
||||
m_iFontAlignmentHorizontal,
|
||||
m_iFontAlignmentVertical,
|
||||
p,
|
||||
m_bVirtual ? m_vVirtualScale : NULL
|
||||
);
|
||||
|
||||
m_font->setColor(UColor(1, 1, 1, alpha));
|
||||
|
||||
frame = getClientFrame();
|
||||
|
||||
m_font->PrintJustified(
|
||||
frame, m_iFontAlignmentHorizontal, m_iFontAlignmentVertical, p, m_bVirtual ? m_vVirtualScale : NULL
|
||||
);
|
||||
|
||||
m_font->setColor(UBlack);
|
||||
} else if ((mat = m_print_mat->GetMaterial())) {
|
||||
vec4_t col {alpha, alpha, alpha, alpha};
|
||||
|
||||
re.SetColor(col);
|
||||
|
||||
w = re.GetShaderWidth(mat);
|
||||
h = re.GetShaderHeight(mat);
|
||||
x = (m_frame.pos.x + m_frame.size.width - w) * 0.5f;
|
||||
y = (m_frame.pos.y + m_frame.size.height - h) * 0.5f;
|
||||
|
||||
re.DrawStretchPic(x, y, w, h, 0, 0, 1, 1, mat);
|
||||
}
|
||||
|
||||
m_printfadetime -= cls.frametime;
|
||||
|
||||
if (m_printfadetime < 0) {
|
||||
m_printfadetime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CLASS_DECLARATION(UIWidget, ConsoleView, NULL) {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
void ConsoleView::Draw
|
||||
(
|
||||
void
|
||||
)
|
||||
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
void ConsoleView::Draw(void) {}
|
||||
+37
-38
@@ -20,55 +20,54 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __CL_UIVIEW3D__
|
||||
#define __CL_UIVIEW3D__
|
||||
#pragma once
|
||||
|
||||
class View3D : public UIWidget {
|
||||
float m_printfadetime;
|
||||
float m_printalpha;
|
||||
str m_printstring;
|
||||
UIReggedMaterial *m_print_mat;
|
||||
qboolean m_locationprint;
|
||||
int m_x_coord;
|
||||
int m_y_coord;
|
||||
qboolean m_letterbox_active;
|
||||
class View3D : public UIWidget
|
||||
{
|
||||
float m_printfadetime;
|
||||
float m_printalpha;
|
||||
str m_printstring;
|
||||
UIReggedMaterial *m_print_mat;
|
||||
qboolean m_locationprint;
|
||||
int m_x_coord;
|
||||
int m_y_coord;
|
||||
qboolean m_letterbox_active;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( View3D );
|
||||
CLASS_PROTOTYPE(View3D);
|
||||
|
||||
protected:
|
||||
void Draw( void ) override;
|
||||
void DrawLetterbox( void );
|
||||
void DrawFades( void );
|
||||
void Draw2D( void );
|
||||
void DrawFPS( void );
|
||||
void DrawProf( void );
|
||||
void PrintSound( int channel, const char *name, float vol, int rvol, float pitch, float base, int& line );
|
||||
void DrawSoundOverlay( void );
|
||||
void CenterPrint( void );
|
||||
void LocationPrint( void );
|
||||
void OnActivate( Event *ev );
|
||||
void OnDeactivate( Event *ev );
|
||||
void DrawSubtitleOverlay( void );
|
||||
void Draw(void) override;
|
||||
void DrawLetterbox(void);
|
||||
void DrawFades(void);
|
||||
void Draw2D(void);
|
||||
void DrawFPS(void);
|
||||
void DrawProf(void);
|
||||
void PrintSound(int channel, const char *name, float vol, int rvol, float pitch, float base, int& line);
|
||||
void DrawSoundOverlay(void);
|
||||
void CenterPrint(void);
|
||||
void LocationPrint(void);
|
||||
void OnActivate(Event *ev);
|
||||
void OnDeactivate(Event *ev);
|
||||
void DrawSubtitleOverlay(void);
|
||||
|
||||
public:
|
||||
View3D();
|
||||
View3D();
|
||||
|
||||
void ClearCenterPrint( void );
|
||||
void UpdateCenterPrint( const char *s, float alpha );
|
||||
void UpdateLocationPrint( int x, int y, const char *s, float alpha );
|
||||
qboolean LetterboxActive( void );
|
||||
void InitSubtitle( void );
|
||||
void FrameInitialized( void ) override;
|
||||
virtual void Pressed( Event *ev );
|
||||
void ClearCenterPrint(void);
|
||||
void UpdateCenterPrint(const char *s, float alpha);
|
||||
void UpdateLocationPrint(int x, int y, const char *s, float alpha);
|
||||
qboolean LetterboxActive(void);
|
||||
void InitSubtitle(void);
|
||||
void FrameInitialized(void) override;
|
||||
virtual void Pressed(Event *ev);
|
||||
};
|
||||
|
||||
class ConsoleView : public UIWidget {
|
||||
class ConsoleView : public UIWidget
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE( ConsoleView );
|
||||
CLASS_PROTOTYPE(ConsoleView);
|
||||
|
||||
protected:
|
||||
void Draw( void ) override;
|
||||
void Draw(void) override;
|
||||
};
|
||||
|
||||
#endif /* __CL_UIVIEW3D__ */
|
||||
@@ -21,8 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
// client.h -- primary header for client
|
||||
|
||||
#ifndef __CLIENT_H__
|
||||
#define __CLIENT_H__
|
||||
#pragma once
|
||||
|
||||
#include "../qcommon/q_shared.h"
|
||||
#include "../qcommon/qcommon.h"
|
||||
@@ -321,7 +320,7 @@ typedef struct {
|
||||
serverInfo_t globalServers[MAX_GLOBAL_SERVERS];
|
||||
// additional global servers
|
||||
int numGlobalServerAddresses;
|
||||
serverAddress_t globalServerAddresses[MAX_GLOBAL_SERVERS];
|
||||
netadr_t globalServerAddresses[MAX_GLOBAL_SERVERS];
|
||||
|
||||
int numfavoriteservers;
|
||||
serverInfo_t favoriteServers[MAX_OTHER_SERVERS];
|
||||
@@ -352,7 +351,7 @@ typedef struct {
|
||||
clientAnim_t anim;
|
||||
stopWatch_t stopwatch;
|
||||
void* savedCgameState;
|
||||
int savedCgameStateSize;
|
||||
size_t savedCgameStateSize;
|
||||
char gcdResponse[73];
|
||||
int unknown3_0;
|
||||
int currentRate;
|
||||
@@ -471,7 +470,7 @@ void CL_AddReliableCommand(const char *cmd, qboolean isDisconnectCmd);
|
||||
|
||||
void CL_StartHunkUsers( qboolean rendererOnly );
|
||||
|
||||
void CL_Connect( const char *server );
|
||||
void CL_Connect( const char *server, netadrtype_t family );
|
||||
|
||||
void CL_Disconnect_f (void);
|
||||
void CL_GetChallengePacket (void);
|
||||
@@ -690,5 +689,3 @@ void CL_InitConsoleCommands( void );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __CLIENT_H__
|
||||
@@ -58,6 +58,10 @@ typedef struct {
|
||||
|
||||
void S_ChannelFree_Callback(channel_t* v);
|
||||
void S_LoadData(soundsystemsavegame_t* pSave);
|
||||
void S_SaveData(soundsystemsavegame_t* pSave);
|
||||
void S_ReLoad(soundsystemsavegame_t* pSave);
|
||||
|
||||
extern qboolean s_bSoundPaused;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -21,11 +21,24 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../snd_local.h"
|
||||
#include "../client.h"
|
||||
|
||||
#if defined(NO_MODERN_DMA) && NO_MODERN_DMA
|
||||
|
||||
qboolean s_bSoundPaused = qfalse;
|
||||
|
||||
void S_Init2()
|
||||
{
|
||||
S_Init();
|
||||
SND_setup();
|
||||
|
||||
// HACK: S_RegisterSound returns 0 when unsuccessful, or it returns the the sfx handle
|
||||
// But the first sfx handle is also 0...
|
||||
S_RegisterSound("sound/null.wav", qfalse);
|
||||
|
||||
Cmd_AddCommand("tmstart", S_TriggeredMusic_Start);
|
||||
Cmd_AddCommand("tmstartloop", S_TriggeredMusic_StartLoop);
|
||||
Cmd_AddCommand("tmstop", S_TriggeredMusic_Stop);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -46,7 +59,18 @@ S_AddLoopingSound
|
||||
*/
|
||||
void S_AddLoopingSound(const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle, float volume, float minDist, float maxDist, float pitch, int flags)
|
||||
{
|
||||
if (!sfxHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
// FIXME: unimplemented
|
||||
|
||||
if (VectorCompare(origin, vec3_origin)) {
|
||||
// Consider it to be a local sound, uses the player origin
|
||||
S_AddLoopingSound(cl.snap.ps.clientNum, cl.snap.ps.origin, velocity, sfxHandle);
|
||||
return;
|
||||
}
|
||||
|
||||
S_AddLoopingSound(ENTITYNUM_WORLD, origin, velocity, sfxHandle);
|
||||
}
|
||||
|
||||
@@ -55,7 +79,7 @@ void S_AddLoopingSound(const vec3_t origin, const vec3_t velocity, sfxHandle_t s
|
||||
S_StopAllSounds
|
||||
=================
|
||||
*/
|
||||
void S_StopAllSounds(qboolean stop_music)
|
||||
void S_StopAllSounds2(qboolean stop_music)
|
||||
{
|
||||
// Call the original function
|
||||
S_StopAllSounds();
|
||||
@@ -83,12 +107,29 @@ void S_Respatialize(int entityNum, const vec3_t origin,
|
||||
{
|
||||
S_Respatialize(entityNum, origin, axis, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
S_StartLocalSoundChannel
|
||||
=================
|
||||
*/
|
||||
void S_StartLocalSound(const char* sound_name, qboolean force_load)
|
||||
{
|
||||
sfxHandle_t h;
|
||||
|
||||
h = S_RegisterSound(sound_name, qfalse);
|
||||
|
||||
if (h) {
|
||||
S_StartLocalSound(h, CHAN_LOCAL_SOUND);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
S_StartLocalSound
|
||||
=================
|
||||
*/
|
||||
void S_StartLocalSound(const char* sound_name, qboolean force_load)
|
||||
void S_StartLocalSoundChannel(const char* sound_name, qboolean force_load, int channel)
|
||||
{
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
@@ -340,6 +381,16 @@ void MUSIC_CheckForStoppedSongs(void)
|
||||
STUB();
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_CurrentSoundtrack
|
||||
==============
|
||||
*/
|
||||
const char* S_CurrentSoundtrack()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
S_IsSoundRegistered
|
||||
@@ -404,22 +455,141 @@ void S_FadeSound(float fTime)
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_TriggeredMusic_Start
|
||||
==============
|
||||
*/
|
||||
void S_TriggeredMusic_Start()
|
||||
{
|
||||
if (Cmd_Argc() != 2) {
|
||||
Com_Printf("tmstart <sound file>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
S_StartBackgroundTrack(Cmd_Argv(1), "");
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_TriggeredMusic_StartLoop
|
||||
==============
|
||||
*/
|
||||
void S_TriggeredMusic_StartLoop()
|
||||
{
|
||||
if (Cmd_Argc() != 2) {
|
||||
Com_Printf("tmstartloop <sound file>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
S_StartBackgroundTrack(Cmd_Argv(1), Cmd_Argv(1));
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_TriggeredMusic_Stop
|
||||
==============
|
||||
*/
|
||||
void S_TriggeredMusic_Stop()
|
||||
{
|
||||
S_StopBackgroundTrack();
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_TriggeredMusic_PlayIntroMusic
|
||||
==============
|
||||
*/
|
||||
void S_TriggeredMusic_PlayIntroMusic() {
|
||||
S_StartBackgroundTrack("sound/music/mus_MainTheme.mp3", "");
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_TriggeredMusic_SetupHandle
|
||||
==============
|
||||
*/
|
||||
void S_TriggeredMusic_SetupHandle(const char* pszName, int iLoopCount, int iOffset, qboolean autostart) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_GetMusicFilename
|
||||
==============
|
||||
*/
|
||||
const char* S_GetMusicFilename() {
|
||||
// FIXME: unimplemented
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_GetMusicLoopCount
|
||||
==============
|
||||
*/
|
||||
int S_GetMusicLoopCount() {
|
||||
// FIXME: unimplemented
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_GetMusicOffset
|
||||
==============
|
||||
*/
|
||||
unsigned int S_GetMusicOffset() {
|
||||
// FIXME: unimplemented
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
callbackServer
|
||||
==============
|
||||
*/
|
||||
void callbackServer(int entnum, int channel_number, const char* name) {
|
||||
if (com_sv_running->integer) {
|
||||
SV_SoundCallback(entnum, channel_number, name);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_ChannelFree_Callback
|
||||
==============
|
||||
*/
|
||||
void S_ChannelFree_Callback(channel_t* v) {
|
||||
if (v->entnum & S_FLAG_DO_CALLBACK) {
|
||||
callbackServer(v->entnum & ~S_FLAG_DO_CALLBACK, v - s_channels, v->thesfx->soundName);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_LoadData
|
||||
==============
|
||||
*/
|
||||
void S_LoadData(soundsystemsavegame_t* pSave) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_SaveData
|
||||
==============
|
||||
*/
|
||||
void S_SaveData(soundsystemsavegame_t* pSave) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_ReLoad
|
||||
==============
|
||||
*/
|
||||
void S_ReLoad(soundsystemsavegame_t* pSave) {
|
||||
// FIXME: unimplemented
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -30,8 +30,8 @@ void S_Respatialize(int entityNum, const vec3_t origin, vec3_t axis[3]);
|
||||
sfxHandle_t S_RegisterSound(const char* sample, qboolean compressed, qboolean streamed);
|
||||
void S_AddLoopingSound(const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle, float volume, float minDist, float maxDist, float pitch, int flags);
|
||||
void S_StartLocalSound(const char* name, qboolean force_load);
|
||||
void S_StartLocalSoundChannel(const char* sound_name, qboolean force_load, int channel);
|
||||
void S_StartSound(const vec3_t origin, int entNum, int entChannel, sfxHandle_t sfxHandle, float volume, float minDist, float pitch, float maxDist, qboolean streamed);
|
||||
void S_StopAllSounds(qboolean stop_music);
|
||||
void S_ClearLoopingSounds(void);
|
||||
qboolean S_IsSoundRegistered(const char* name);
|
||||
void S_Init2();
|
||||
@@ -64,7 +64,14 @@ qboolean MUSIC_PlaySong(const char* alias);
|
||||
void MUSIC_UpdateMusicVolumes(void);
|
||||
void MUSIC_CheckForStoppedSongs(void);
|
||||
|
||||
void S_TriggeredMusic_Start();
|
||||
void S_TriggeredMusic_StartLoop();
|
||||
void S_TriggeredMusic_Stop();
|
||||
|
||||
const char* S_CurrentSoundtrack();
|
||||
|
||||
void S_StopSound(int entnum, int channel);
|
||||
void S_StopAllSounds2(qboolean stop_music);
|
||||
float S_GetSoundTime(sfxHandle_t handle);
|
||||
void S_SetGlobalAmbientVolumeLevel(float volume);
|
||||
void S_SetReverb(int reverb_type, float reverb_level);
|
||||
@@ -73,6 +80,11 @@ qboolean S_IsSoundPlaying(int channelNumber, const char* name);
|
||||
void S_UpdateEntity(int entityNum, const vec3_t origin, const vec3_t velocity, qboolean use_listener);
|
||||
void S_FadeSound(float fTime);
|
||||
void S_TriggeredMusic_PlayIntroMusic();
|
||||
void S_TriggeredMusic_SetupHandle(const char* pszName, int iLoopCount, int iOffset, qboolean autostart);
|
||||
|
||||
const char* S_GetMusicFilename();
|
||||
int S_GetMusicLoopCount();
|
||||
unsigned int S_GetMusicOffset();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ LPALGETSOURCEF qalGetSourcef;
|
||||
LPALGETSOURCE3F qalGetSource3f;
|
||||
LPALGETSOURCEFV qalGetSourcefv;
|
||||
LPALGETSOURCEI qalGetSourcei;
|
||||
LPALGETSOURCEIV qalGetSourceiv;
|
||||
LPALSOURCEPLAYV qalSourcePlayv;
|
||||
LPALSOURCESTOPV qalSourceStopv;
|
||||
LPALSOURCEREWINDV qalSourceRewindv;
|
||||
@@ -81,6 +82,7 @@ LPALDELETEBUFFERS qalDeleteBuffers;
|
||||
LPALISBUFFER qalIsBuffer;
|
||||
LPALBUFFERDATA qalBufferData;
|
||||
LPALGETBUFFERF qalGetBufferf;
|
||||
LPALGETBUFFERFV qalGetBufferfv;
|
||||
LPALGETBUFFERI qalGetBufferi;
|
||||
LPALDOPPLERFACTOR qalDopplerFactor;
|
||||
LPALSPEEDOFSOUND qalSpeedOfSound;
|
||||
@@ -184,6 +186,7 @@ qboolean QAL_Init(const char *libname)
|
||||
qalGetSource3f = GPA("alGetSource3f");
|
||||
qalGetSourcefv = GPA("alGetSourcefv");
|
||||
qalGetSourcei = GPA("alGetSourcei");
|
||||
qalGetSourceiv = GPA("alGetSourceiv");
|
||||
qalSourcePlayv = GPA("alSourcePlayv");
|
||||
qalSourceStopv = GPA("alSourceStopv");
|
||||
qalSourceRewindv = GPA("alSourceRewindv");
|
||||
@@ -199,6 +202,7 @@ qboolean QAL_Init(const char *libname)
|
||||
qalIsBuffer = GPA("alIsBuffer");
|
||||
qalBufferData = GPA("alBufferData");
|
||||
qalGetBufferf = GPA("alGetBufferf");
|
||||
qalGetBufferfv = GPA("alGetBufferfv");
|
||||
qalGetBufferi = GPA("alGetBufferi");
|
||||
qalDopplerFactor = GPA("alDopplerFactor");
|
||||
qalSpeedOfSound = GPA("alSpeedOfSound");
|
||||
@@ -283,6 +287,7 @@ void QAL_Shutdown( void )
|
||||
qalGetSource3f = NULL;
|
||||
qalGetSourcefv = NULL;
|
||||
qalGetSourcei = NULL;
|
||||
qalGetSourceiv = NULL;
|
||||
qalSourcePlayv = NULL;
|
||||
qalSourceStopv = NULL;
|
||||
qalSourceRewindv = NULL;
|
||||
@@ -298,6 +303,7 @@ void QAL_Shutdown( void )
|
||||
qalIsBuffer = NULL;
|
||||
qalBufferData = NULL;
|
||||
qalGetBufferf = NULL;
|
||||
qalGetBufferfv = NULL;
|
||||
qalGetBufferi = NULL;
|
||||
qalDopplerFactor = NULL;
|
||||
qalSpeedOfSound = NULL;
|
||||
|
||||
@@ -55,6 +55,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
# define ALC_ALL_DEVICES_SPECIFIER 0x1013
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENAL_DLOPEN
|
||||
extern LPALENABLE qalEnable;
|
||||
extern LPALDISABLE qalDisable;
|
||||
@@ -248,4 +252,8 @@ extern LPALCCAPTURESAMPLES qalcCaptureSamples;
|
||||
qboolean QAL_Init(const char *libname);
|
||||
void QAL_Shutdown( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __QAL_H__
|
||||
@@ -27,6 +27,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "../qcommon/q_shared.h"
|
||||
#include "../qcommon/qcommon.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct snd_info_s
|
||||
{
|
||||
int rate;
|
||||
@@ -113,4 +117,8 @@ void S_OggOpus_CodecCloseStream(snd_stream_t *stream);
|
||||
int S_OggOpus_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer);
|
||||
#endif // USE_CODEC_OPUS
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // !_SND_CODEC_H_
|
||||
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "snd_codec.h"
|
||||
|
||||
// includes for the MP3 codec
|
||||
#include "../libmad-0.15.1b/synth.h"
|
||||
#include "mad.h"
|
||||
|
||||
#define MP3_SAMPLE_WIDTH 2
|
||||
#define MP3_PCMSAMPLES_PERSLICE 32
|
||||
|
||||
+13
-3
@@ -785,7 +785,11 @@ void S_Base_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t ve
|
||||
}
|
||||
|
||||
if ( !sfx->soundLength ) {
|
||||
Com_Error( ERR_DROP, "%s has length 0", sfx->soundName );
|
||||
// Fixed in OPM
|
||||
// Why should it crash???
|
||||
//Com_Error( ERR_DROP, "%s has length 0", sfx->soundName );
|
||||
Com_Printf( "%s has length 0\n", sfx->soundName );
|
||||
return;
|
||||
}
|
||||
|
||||
VectorCopy( origin, loopSounds[entityNum].origin );
|
||||
@@ -848,7 +852,11 @@ void S_Base_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_
|
||||
}
|
||||
|
||||
if ( !sfx->soundLength ) {
|
||||
Com_Error( ERR_DROP, "%s has length 0", sfx->soundName );
|
||||
// Fixed in OPM
|
||||
// Why should it crash???
|
||||
//Com_Error( ERR_DROP, "%s has length 0", sfx->soundName );
|
||||
Com_Printf( "%s has length 0", sfx->soundName );
|
||||
return;
|
||||
}
|
||||
VectorCopy( origin, loopSounds[entityNum].origin );
|
||||
VectorCopy( velocity, loopSounds[entityNum].velocity );
|
||||
@@ -1581,7 +1589,9 @@ qboolean S_Base_Init( soundInterface_t *si ) {
|
||||
|
||||
if ( r ) {
|
||||
s_soundStarted = 1;
|
||||
s_soundMuted = 1;
|
||||
// Fixed in OPM
|
||||
// The UI must be able to play sounds
|
||||
// s_soundMuted = 1;
|
||||
// s_numSfx = 0;
|
||||
|
||||
Com_Memset(sfxHash, 0, sizeof(sfx_t *)*LOOP_HASH);
|
||||
|
||||
@@ -0,0 +1,816 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2024 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "snd_local.h"
|
||||
#include "snd_openal_new.h"
|
||||
#include "client.h"
|
||||
#include "cl_ui.h"
|
||||
|
||||
typedef struct {
|
||||
vec3_t origin;
|
||||
vec3_t velocity;
|
||||
sfx_t *sfx;
|
||||
int mergeFrame;
|
||||
} loopSound_t;
|
||||
|
||||
qboolean s_bLastInitSound = qfalse;
|
||||
qboolean s_bSoundStarted = qfalse;
|
||||
qboolean s_bSoundPaused = qfalse;
|
||||
qboolean s_bTryUnpause = qfalse;
|
||||
int s_iListenerNumber = 0;
|
||||
float s_fAmbientVolume = 1.f;
|
||||
|
||||
int number_of_sfx_infos = 0;
|
||||
|
||||
cvar_t *s_volume;
|
||||
cvar_t *s_loadas8bit;
|
||||
cvar_t *s_khz;
|
||||
cvar_t *s_show;
|
||||
cvar_t *s_testsound;
|
||||
cvar_t *s_separation;
|
||||
cvar_t *s_musicVolume;
|
||||
cvar_t *s_ambientVolume;
|
||||
|
||||
sfx_info_t sfx_infos[MAX_SFX_INFOS];
|
||||
|
||||
sfx_t s_knownSfx[MAX_SFX];
|
||||
int s_numSfx;
|
||||
|
||||
s_entity_t s_entity[MAX_GENTITIES];
|
||||
|
||||
static int s_registrationSequence;
|
||||
static qboolean s_inRegistration;
|
||||
|
||||
cvar_t *s_mixPreStep;
|
||||
cvar_t *s_dialogscale;
|
||||
|
||||
int numLoopSounds;
|
||||
loopSound_t loopSounds[MAX_LOOP_SOUNDS];
|
||||
|
||||
/*
|
||||
==============
|
||||
S_SoundInfo_f
|
||||
==============
|
||||
*/
|
||||
void S_SoundInfo_f()
|
||||
{
|
||||
S_PrintInfo();
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_SoundDump_f
|
||||
==============
|
||||
*/
|
||||
void S_SoundDump_f()
|
||||
{
|
||||
S_DumpInfo();
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_Init
|
||||
==============
|
||||
*/
|
||||
void S_Init(qboolean full_startup)
|
||||
{
|
||||
int iStart, iEnd;
|
||||
cvar_t *cv;
|
||||
|
||||
Com_Printf("------- Sound Initialization (%s) -------\n", full_startup ? "full" : "partial");
|
||||
|
||||
iStart = Sys_Milliseconds();
|
||||
|
||||
s_volume = Cvar_Get("s_volume", "0.9", CVAR_ARCHIVE);
|
||||
s_musicVolume = Cvar_Get("s_musicvolume", "0.9", CVAR_ARCHIVE);
|
||||
s_ambientVolume = Cvar_Get("s_ambientvolume", "1.00", CVAR_ARCHIVE);
|
||||
s_separation = Cvar_Get("s_separation", "0.5", CVAR_ARCHIVE);
|
||||
s_khz = Cvar_Get("s_khz", "11", CVAR_ARCHIVE | CVAR_SOUND_LATCH);
|
||||
s_loadas8bit = Cvar_Get("s_loadas8bit", "0", CVAR_ARCHIVE | CVAR_LATCH);
|
||||
s_mixPreStep = Cvar_Get("s_mixPreStep", "0.05", CVAR_ARCHIVE);
|
||||
s_show = Cvar_Get("s_show", "0", CVAR_CHEAT);
|
||||
s_testsound = Cvar_Get("s_testsound", "0", CVAR_CHEAT);
|
||||
s_dialogscale = Cvar_Get("s_dialogscale", "1", CVAR_ARCHIVE);
|
||||
s_bLastInitSound = false;
|
||||
|
||||
cv = Cvar_Get("s_initsound", "1", 0);
|
||||
|
||||
if (cv->integer) {
|
||||
Cmd_AddCommand("play", S_Play);
|
||||
Cmd_AddCommand("soundlist", S_SoundList);
|
||||
Cmd_AddCommand("soundinfo", S_SoundInfo_f);
|
||||
Cmd_AddCommand("sounddump", S_SoundDump_f);
|
||||
|
||||
if (S_Driver_Init()) {
|
||||
s_bLastInitSound = true;
|
||||
s_bSoundStarted = true;
|
||||
|
||||
if (full_startup) {
|
||||
s_numSfx = 0;
|
||||
S_StopAllSounds(true);
|
||||
}
|
||||
|
||||
S_FindName("***DEFAULT***", -1);
|
||||
S_SoundInfo_f();
|
||||
}
|
||||
} else {
|
||||
Com_Printf("Sound Not Initializing.\n");
|
||||
s_bSoundStarted = 0;
|
||||
}
|
||||
|
||||
iEnd = Sys_Milliseconds();
|
||||
Com_Printf("------- Sound Initialization Complete ------- %i ms\n", iEnd - iStart);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_Shutdown
|
||||
==============
|
||||
*/
|
||||
void S_Shutdown(qboolean full_shutdown)
|
||||
{
|
||||
int i;
|
||||
sfx_t *sfx;
|
||||
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
Com_Printf("------- Sound Shutdown (%s) -------\n", full_shutdown ? "full" : "partial");
|
||||
|
||||
S_Driver_Shutdown();
|
||||
s_bSoundStarted = false;
|
||||
|
||||
Cmd_RemoveCommand("play");
|
||||
Cmd_RemoveCommand("music");
|
||||
Cmd_RemoveCommand("stopsound");
|
||||
Cmd_RemoveCommand("soundlist");
|
||||
Cmd_RemoveCommand("soundinfo");
|
||||
|
||||
if (full_shutdown) {
|
||||
for (i = 0; i < s_numSfx; i++) {
|
||||
sfx = &s_knownSfx[i];
|
||||
|
||||
if (sfx->name[0]) {
|
||||
if (sfx->data) {
|
||||
Z_Free(sfx->data);
|
||||
}
|
||||
|
||||
*sfx = {};
|
||||
}
|
||||
}
|
||||
|
||||
s_numSfx = 0;
|
||||
}
|
||||
|
||||
Com_Printf("------- Sound Shutdown Complete -------\n");
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_NameExists
|
||||
==============
|
||||
*/
|
||||
qboolean S_NameExists(const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (strlen(name) >= MAX_RES_NAME) {
|
||||
Com_DPrintf("Sound name too long: %s", name);
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
for (i = 0; i < s_numSfx; i++) {
|
||||
if (!strcmp(s_knownSfx[i].name, name)) {
|
||||
return qtrue;
|
||||
}
|
||||
}
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_FindName
|
||||
==============
|
||||
*/
|
||||
sfx_t *S_FindName(const char *name, int sequenceNumber)
|
||||
{
|
||||
int i;
|
||||
sfx_t *sfx;
|
||||
|
||||
if (!name) {
|
||||
Com_DPrintf("S_FindName: NULL\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!name[0]) {
|
||||
Com_DPrintf("S_FindName: empty name\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (strlen(name) >= MAX_RES_NAME) {
|
||||
Com_DPrintf("Sound name too long: %s", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < s_numSfx; i++) {
|
||||
sfx = &s_knownSfx[i];
|
||||
|
||||
if (!strcmp(sfx->name, name)) {
|
||||
if (sfx->registration_sequence != -1) {
|
||||
sfx->registration_sequence = sequenceNumber;
|
||||
}
|
||||
|
||||
return sfx;
|
||||
}
|
||||
}
|
||||
|
||||
sfx = &s_knownSfx[0];
|
||||
|
||||
for (i = 0; i < s_numSfx; i++) {
|
||||
sfx = &s_knownSfx[i];
|
||||
if (!sfx->name[0]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == s_numSfx) {
|
||||
if (i == MAX_SFX) {
|
||||
Com_Error(ERR_FATAL, "S_FindName: out of sfx_t");
|
||||
}
|
||||
|
||||
sfx = &s_knownSfx[s_numSfx];
|
||||
s_numSfx++;
|
||||
}
|
||||
|
||||
*sfx = {};
|
||||
// Fixed in OPM
|
||||
// strcpy was used before
|
||||
//strcpy(sfx->name, name);
|
||||
Q_strncpyz(sfx->name, name, sizeof(sfx->name));
|
||||
sfx->registration_sequence = sequenceNumber;
|
||||
|
||||
return sfx;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_BeginRegistration
|
||||
==============
|
||||
*/
|
||||
void S_BeginRegistration()
|
||||
{
|
||||
Com_Printf("------- Sound Begin Registration -------\n");
|
||||
|
||||
S_StopAllSounds(true);
|
||||
|
||||
++s_registrationSequence;
|
||||
s_inRegistration = true;
|
||||
s_knownSfx[0].registration_sequence = s_registrationSequence;
|
||||
|
||||
Com_Printf("------- Sound Begin Registration Complete -------\n");
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_DefaultSound
|
||||
==============
|
||||
*/
|
||||
void S_DefaultSound(sfx_t *sfx)
|
||||
{
|
||||
sfx->data = NULL;
|
||||
sfx->iFlags |= SFX_FLAG_DEFAULT_SOUND;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_IsSoundRegistered
|
||||
==============
|
||||
*/
|
||||
qboolean S_IsSoundRegistered(const char *name)
|
||||
{
|
||||
char szCacheName[MAX_QPATH];
|
||||
int i;
|
||||
|
||||
if (!s_bSoundStarted) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
for (i = 0; name[i] && i < MAX_QPATH; i++) {
|
||||
szCacheName[i] = tolower(name[i]);
|
||||
}
|
||||
szCacheName[i] = 0;
|
||||
|
||||
if (i >= MAX_QPATH) {
|
||||
Com_Printf("Sound name exceeds MAX_QPATH\n");
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
return S_NameExists(szCacheName);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_RegisterSound
|
||||
==============
|
||||
*/
|
||||
sfxHandle_t S_RegisterSound(const char *name, int streamed, qboolean force_load)
|
||||
{
|
||||
char szCacheName[MAX_QPATH];
|
||||
sfx_t *sfx;
|
||||
int i;
|
||||
|
||||
if (!s_bSoundStarted) {
|
||||
Com_Printf("ERROR: Trying to register sound %s when soundsystem hasn't started.\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; name[i] && i < MAX_QPATH; i++) {
|
||||
szCacheName[i] = tolower(name[i]);
|
||||
}
|
||||
szCacheName[i] = 0;
|
||||
|
||||
if (i >= MAX_QPATH) {
|
||||
Com_Printf("Sound name exceeds MAX_QPATH\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
sfx = S_FindName(szCacheName, s_registrationSequence);
|
||||
if (!sfx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!sfx->data) {
|
||||
if (!S_LoadSound(sfx->name, sfx, streamed, force_load)) {
|
||||
Com_DPrintf("Couldn't load sound: %s\n", sfx->name);
|
||||
if (!S_LoadSound("sound/default.wav", sfx, streamed, 0)) {
|
||||
Com_DPrintf("Couldn't load sound: sound/default.wav\n");
|
||||
sfx->iFlags |= SFX_FLAG_DEFAULT_SOUND;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
sfx->iFlags &= ~SFX_FLAG_DEFAULT_SOUND;
|
||||
sfx->sfx_info_index = 0;
|
||||
|
||||
for (i = 0; i < number_of_sfx_infos; i++) {
|
||||
if (!Q_stricmp(sfx->name, sfx_infos[i].name)) {
|
||||
sfx->sfx_info_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sfx - s_knownSfx;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_GetSoundTime
|
||||
==============
|
||||
*/
|
||||
float S_GetSoundTime(sfxHandle_t handle)
|
||||
{
|
||||
return s_knownSfx[handle].time_length;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_EndRegistration
|
||||
==============
|
||||
*/
|
||||
void S_EndRegistration()
|
||||
{
|
||||
int i;
|
||||
sfx_t *sfx;
|
||||
|
||||
Com_Printf("------- Sound End Registration -------\n");
|
||||
s_inRegistration = qfalse;
|
||||
|
||||
for (i = 0; i < s_numSfx; i++) {
|
||||
sfx = &s_knownSfx[i];
|
||||
|
||||
if (!sfx->name[0]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sfx->registration_sequence && sfx->registration_sequence != s_registrationSequence) {
|
||||
if (sfx->data) {
|
||||
Z_Free(sfx->data);
|
||||
}
|
||||
|
||||
*sfx = {};
|
||||
}
|
||||
}
|
||||
|
||||
Com_Printf("------- Sound End Registration Complete -------\n");
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_UpdateEntity
|
||||
==============
|
||||
*/
|
||||
void S_UpdateEntity(int entityNum, const vec3_t origin, const vec3_t vel, qboolean use_listener)
|
||||
{
|
||||
if (entityNum > MAX_GENTITIES) {
|
||||
Com_Error(ERR_DROP, "S_UpdateEntityPosition: bad entitynum %i", entityNum);
|
||||
}
|
||||
|
||||
VectorCopy(origin, s_entity[entityNum].position);
|
||||
VectorCopy(vel, s_entity[entityNum].velocity);
|
||||
s_entity[entityNum].use_listener = use_listener;
|
||||
s_entity[entityNum].time = cl.serverTime;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_SetGlobalAmbientVolumeLevel
|
||||
==============
|
||||
*/
|
||||
void S_SetGlobalAmbientVolumeLevel(float volume)
|
||||
{
|
||||
s_fAmbientVolume = volume;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_StartSound
|
||||
==============
|
||||
*/
|
||||
void S_StartSound(
|
||||
const vec3_t origin,
|
||||
int entnum,
|
||||
int entchannel,
|
||||
sfxHandle_t sfxHandle,
|
||||
float volume,
|
||||
float min_dist,
|
||||
float pitch,
|
||||
float maxDist,
|
||||
int streamed
|
||||
)
|
||||
{
|
||||
if (s_show_sounds->integer > 0 && sfxHandle > 0 && sfxHandle < s_numSfx) {
|
||||
Com_DPrintf("S_StartSound: %s\n", s_knownSfx[sfxHandle].name);
|
||||
}
|
||||
|
||||
if (!s_bSoundStarted) {
|
||||
if (s_show_sounds->integer > 0) {
|
||||
Com_DPrintf("^~^~^ sound system not yet started\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (server_loading) {
|
||||
if (s_show_sounds->integer > 0) {
|
||||
Com_DPrintf("^~^~^ cannot start sounds while loading a server\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (sfxHandle < 0 || sfxHandle >= s_numSfx) {
|
||||
Com_Error(ERR_DROP, "S_StartSound: handle %i out of range", sfxHandle);
|
||||
}
|
||||
|
||||
if (!sfxHandle) {
|
||||
if (s_show_sounds->integer > 0) {
|
||||
Com_DPrintf("^~^~^ null handle\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (entnum && (entchannel == CHAN_DIALOG || entchannel == CHAN_DIALOG_SECONDARY) && s_dialogscale->value > 0) {
|
||||
volume *= s_dialogscale->value;
|
||||
}
|
||||
|
||||
S_Driver_StartSound(origin, entnum, entchannel, sfxHandle, volume, min_dist, pitch, maxDist, streamed);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_StartLocalSound
|
||||
==============
|
||||
*/
|
||||
void S_StartLocalSound(const char *sound_name, qboolean force_load)
|
||||
{
|
||||
sfxHandle_t sfxHandle;
|
||||
const char *name;
|
||||
AliasListNode_t *pSoundAlias = NULL;
|
||||
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sound_name) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = Alias_FindRandom(sound_name, &pSoundAlias);
|
||||
if (!name) {
|
||||
name = sound_name;
|
||||
}
|
||||
|
||||
sfxHandle = S_RegisterSound(name, pSoundAlias ? pSoundAlias->streamed : qfalse, force_load);
|
||||
|
||||
if (!pSoundAlias) {
|
||||
S_StartSound(NULL, s_iListenerNumber, CHAN_MENU, sfxHandle, -1.0, -1.0, 1.0, -1.0, qfalse);
|
||||
return;
|
||||
}
|
||||
|
||||
S_StartSound(
|
||||
0,
|
||||
s_iListenerNumber,
|
||||
CHAN_MENU,
|
||||
sfxHandle,
|
||||
pSoundAlias->volume + random() * pSoundAlias->volumeMod,
|
||||
-1.0,
|
||||
pSoundAlias->pitch + random() * pSoundAlias->pitchMod,
|
||||
pSoundAlias->maxDist,
|
||||
pSoundAlias->streamed
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_StartLocalSoundChannel
|
||||
|
||||
Added in 2.0
|
||||
Starts a local sound, with the specified channel
|
||||
==============
|
||||
*/
|
||||
void S_StartLocalSoundChannel(const char *sound_name, qboolean force_load, soundChannel_t channel)
|
||||
{
|
||||
sfxHandle_t sfxHandle;
|
||||
const char *name;
|
||||
AliasListNode_t *pSoundAlias = NULL;
|
||||
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!sound_name) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = Alias_FindRandom(sound_name, &pSoundAlias);
|
||||
if (!name) {
|
||||
name = sound_name;
|
||||
}
|
||||
|
||||
sfxHandle = S_RegisterSound(name, pSoundAlias ? pSoundAlias->streamed : qfalse, force_load);
|
||||
|
||||
if (!pSoundAlias) {
|
||||
S_StartSound(NULL, s_iListenerNumber, channel, sfxHandle, -1.0, -1.0, 1.0, -1.0, qfalse);
|
||||
return;
|
||||
}
|
||||
|
||||
S_StartSound(
|
||||
0,
|
||||
s_iListenerNumber,
|
||||
channel,
|
||||
sfxHandle,
|
||||
pSoundAlias->volume + random() * pSoundAlias->volumeMod,
|
||||
-1.0,
|
||||
pSoundAlias->pitch + random() * pSoundAlias->pitchMod,
|
||||
pSoundAlias->maxDist,
|
||||
pSoundAlias->streamed
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_StopAllSounds
|
||||
==============
|
||||
*/
|
||||
void S_StopAllSounds(qboolean stop_music)
|
||||
{
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
Com_Printf("------- S_StopAllSounds (%s) -------\n", stop_music ? "stop music" : "don't stop music");
|
||||
|
||||
// Tell the driver to stop all sounds
|
||||
S_Driver_StopAllSounds(stop_music);
|
||||
|
||||
Com_Printf("------- S_StopAllSounds Complete-------\n");
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_ClearLoopingSounds
|
||||
==============
|
||||
*/
|
||||
void S_ClearLoopingSounds()
|
||||
{
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
S_Driver_ClearLoopingSounds();
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_AddLoopingSound
|
||||
==============
|
||||
*/
|
||||
void S_AddLoopingSound(
|
||||
const vec3_t origin,
|
||||
const vec3_t velocity,
|
||||
sfxHandle_t sfxHandle,
|
||||
float volume,
|
||||
float min_dist,
|
||||
float max_dist,
|
||||
float pitch,
|
||||
int flags
|
||||
)
|
||||
{
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sfxHandle < 0 || sfxHandle >= s_numSfx) {
|
||||
Com_Error(ERR_DROP, "S_AddLoopingSound: handle %i out of range", sfxHandle);
|
||||
}
|
||||
|
||||
if (!sfxHandle) {
|
||||
return;
|
||||
}
|
||||
|
||||
S_Driver_AddLoopingSound(origin, velocity, sfxHandle, volume, min_dist, max_dist, pitch, flags);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_Respatialize
|
||||
==============
|
||||
*/
|
||||
void S_Respatialize(int entityNum, const vec3_t head, vec3_t axis[3])
|
||||
{
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
S_Driver_Respatialize(entityNum, head, axis);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_Update
|
||||
==============
|
||||
*/
|
||||
void S_Update()
|
||||
{
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (server_loading) {
|
||||
return;
|
||||
}
|
||||
|
||||
S_Driver_Update();
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_StopSound
|
||||
==============
|
||||
*/
|
||||
void S_StopSound(int entnum, int channel)
|
||||
{
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel == CHAN_AUTO) {
|
||||
return;
|
||||
}
|
||||
|
||||
S_Driver_StopSound(entnum, channel);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_SetReverb
|
||||
==============
|
||||
*/
|
||||
void S_SetReverb(int reverb_type, float reverb_level)
|
||||
{
|
||||
if (!s_bSoundStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
S_Driver_SetReverb(reverb_type, reverb_level);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_Play
|
||||
==============
|
||||
*/
|
||||
void S_Play()
|
||||
{
|
||||
int i;
|
||||
char name[MAX_QPATH];
|
||||
|
||||
for (i = 1; i < Cmd_Argc(); i++) {
|
||||
if (strrchr(Cmd_Argv(i), '.')) {
|
||||
Q_strncpyz(name, Cmd_Argv(i), sizeof(name));
|
||||
} else {
|
||||
Com_sprintf(name, sizeof(name), "%s.wav", Cmd_Argv(1));
|
||||
}
|
||||
}
|
||||
|
||||
S_StartLocalSound(name, qfalse);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_SoundList
|
||||
==============
|
||||
*/
|
||||
void S_SoundList()
|
||||
{
|
||||
int i;
|
||||
sfx_t *sfx;
|
||||
int size;
|
||||
int total = 0;
|
||||
|
||||
for (i = 0; i < s_numSfx; i++) {
|
||||
sfx = &s_knownSfx[i];
|
||||
|
||||
if (sfx->registration_sequence) {
|
||||
size = sfx->length * sfx->width;
|
||||
total += size;
|
||||
Com_Printf("(%2db) %6i : %s\n", sfx->width * 8, size, sfx->name);
|
||||
}
|
||||
}
|
||||
|
||||
Com_Printf("Total resident: %i\n", total);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_ClearSoundBuffer
|
||||
==============
|
||||
*/
|
||||
void S_ClearSoundBuffer()
|
||||
{
|
||||
// TODO: Remove once AL is fully implemented
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_GetMusicFilename
|
||||
==============
|
||||
*/
|
||||
const char* S_GetMusicFilename()
|
||||
{
|
||||
return S_Driver_GetMusicFilename();
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_GetMusicLoopCount
|
||||
==============
|
||||
*/
|
||||
int S_GetMusicLoopCount()
|
||||
{
|
||||
return S_Driver_GetMusicLoopCount();
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_GetMusicOffset
|
||||
==============
|
||||
*/
|
||||
unsigned int S_GetMusicOffset()
|
||||
{
|
||||
return S_Driver_GetMusicOffset();
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2024 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "snd_local.h"
|
||||
#include "../qcommon/tiki.h"
|
||||
|
||||
void load_sfx_info()
|
||||
{
|
||||
TikiScript tiki;
|
||||
const char *token;
|
||||
int current_sound_file;
|
||||
char file_name[MAX_QPATH];
|
||||
|
||||
sfx_infos[0].name[0] = 0;
|
||||
sfx_infos[0].max_factor = -1.0;
|
||||
sfx_infos[0].loop_start = -1;
|
||||
sfx_infos[0].loop_end = -1;
|
||||
sfx_infos[0].max_number_playing = 5;
|
||||
number_of_sfx_infos = 1;
|
||||
|
||||
for (current_sound_file = 0; current_sound_file < 10; current_sound_file++) {
|
||||
Com_sprintf(file_name, sizeof(file_name), "global/sound%d.txt", current_sound_file);
|
||||
|
||||
if (!tiki.LoadFile(file_name, qtrue)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Com_Printf("Loading %s\n", file_name);
|
||||
|
||||
while (tiki.TokenAvailable(qtrue)) {
|
||||
token = tiki.GetToken(qtrue);
|
||||
|
||||
if (!Q_stricmp(token, "sound")) {
|
||||
if (tiki.TokenAvailable(qtrue)) {
|
||||
token = tiki.GetToken(qtrue);
|
||||
|
||||
if (number_of_sfx_infos == 1000) {
|
||||
Com_DPrintf("Too many sound infos specified\n");
|
||||
break;
|
||||
}
|
||||
|
||||
Q_strncpyz(sfx_infos[number_of_sfx_infos].name, token, sizeof(sfx_infos[number_of_sfx_infos].name));
|
||||
sfx_infos[number_of_sfx_infos].max_factor = -1.f;
|
||||
sfx_infos[number_of_sfx_infos].loop_start = -1;
|
||||
sfx_infos[number_of_sfx_infos].loop_end = -1;
|
||||
sfx_infos[number_of_sfx_infos].max_number_playing = 5;
|
||||
number_of_sfx_infos++;
|
||||
}
|
||||
} else if (!Q_stricmp(token, "loopstart")) {
|
||||
if (!tiki.TokenAvailable(qtrue)) {
|
||||
token = tiki.GetToken(qtrue);
|
||||
sfx_infos[number_of_sfx_infos - 1].loop_start = atoi(token);
|
||||
}
|
||||
} else if (!Q_stricmp(token, "loopend")) {
|
||||
if (!tiki.TokenAvailable(qtrue)) {
|
||||
token = tiki.GetToken(qtrue);
|
||||
sfx_infos[number_of_sfx_infos - 1].loop_end = atoi(token);
|
||||
}
|
||||
} else if (!Q_stricmp(token, "maxnumber")) {
|
||||
if (!tiki.TokenAvailable(qtrue)) {
|
||||
token = tiki.GetToken(qtrue);
|
||||
sfx_infos[number_of_sfx_infos - 1].max_number_playing = atoi(token);
|
||||
}
|
||||
} else if (!Q_stricmp(token, "maxfactor")) {
|
||||
if (!tiki.TokenAvailable(qtrue)) {
|
||||
token = tiki.GetToken(qtrue);
|
||||
sfx_infos[number_of_sfx_infos - 1].max_factor = atoi(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tiki.Close();
|
||||
|
||||
sfx_infos[0].name[0] = 0;
|
||||
}
|
||||
@@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "../qcommon/qcommon.h"
|
||||
#include "snd_public.h"
|
||||
|
||||
#if defined(NO_MODERN_DMA) && NO_MODERN_DMA
|
||||
|
||||
#define PAINTBUFFER_SIZE 4096 // this is in samples
|
||||
|
||||
#define SND_CHUNK_SIZE 1024 // samples
|
||||
@@ -281,3 +283,7 @@ void S_PaintChannelFrom16_altivec( portable_samplepair_t paintbuffer[PAINTBUFFER
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
# include "snd_local_new.h"
|
||||
#endif
|
||||
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2024 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../qcommon/q_shared.h"
|
||||
#include "../qcommon/qcommon.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern cvar_t *s_volume;
|
||||
extern cvar_t *s_khz;
|
||||
extern cvar_t *s_loadas8bit;
|
||||
extern cvar_t *s_separation;
|
||||
extern cvar_t *s_musicVolume;
|
||||
extern cvar_t *s_ambientVolume;
|
||||
|
||||
typedef struct {
|
||||
int format;
|
||||
float rate;
|
||||
|
||||
float width;
|
||||
int channels;
|
||||
int samples;
|
||||
|
||||
int dataofs;
|
||||
int datasize;
|
||||
} wavinfo_t;
|
||||
|
||||
typedef struct sfx_s {
|
||||
int iFlags;
|
||||
|
||||
int length;
|
||||
int width;
|
||||
byte *data;
|
||||
char name[64];
|
||||
|
||||
int registration_sequence;
|
||||
int sfx_info_index;
|
||||
float time_length;
|
||||
|
||||
wavinfo_t info;
|
||||
unsigned int buffer;
|
||||
} sfx_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned short wFormatTag;
|
||||
unsigned short nChannels;
|
||||
unsigned int nSamplesPerSec;
|
||||
unsigned int nAvgBytesPerSec;
|
||||
unsigned short nBlockAlign;
|
||||
unsigned short wBitsPerSample;
|
||||
unsigned short cbSize;
|
||||
} wavinfo_x_t;
|
||||
|
||||
typedef struct {
|
||||
char name[64];
|
||||
|
||||
int loop_start;
|
||||
int loop_end;
|
||||
|
||||
int max_number_playing;
|
||||
float max_factor;
|
||||
} sfx_info_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t position;
|
||||
vec3_t velocity;
|
||||
int time;
|
||||
qboolean use_listener;
|
||||
} s_entity_t;
|
||||
|
||||
typedef struct {
|
||||
char alias[32];
|
||||
char path[64];
|
||||
|
||||
int mood_num;
|
||||
int flags;
|
||||
float volume;
|
||||
float fadetime;
|
||||
|
||||
int current_pos;
|
||||
int current_state;
|
||||
} song_t;
|
||||
|
||||
typedef struct {
|
||||
int iFlags;
|
||||
char szName[64];
|
||||
} sfxsavegame_t;
|
||||
|
||||
typedef struct {
|
||||
qboolean bPlaying;
|
||||
int iStatus;
|
||||
sfxsavegame_t sfx;
|
||||
|
||||
int iEntNum;
|
||||
int iEntChannel;
|
||||
vec3_t vOrigin;
|
||||
float fVolume;
|
||||
int iBaseRate;
|
||||
float fNewPitchMult;
|
||||
float fMinDist;
|
||||
float fMaxDist;
|
||||
|
||||
int iStartTime;
|
||||
int iTime;
|
||||
int iNextCheckObstructionTime;
|
||||
int iEndTime;
|
||||
|
||||
int iFlags;
|
||||
int iOffset;
|
||||
int iLoopCount;
|
||||
} channelbasesavegame_t;
|
||||
|
||||
typedef struct {
|
||||
channelbasesavegame_t Channels[96];
|
||||
} soundsystemsavegame_t;
|
||||
|
||||
enum channel_flags_t {
|
||||
CHANNEL_FLAG_PLAY_DEFERRED = 1,
|
||||
CHANNEL_FLAG_LOCAL_LISTENER = 16,
|
||||
CHANNEL_FLAG_NO_ENTITY = 32,
|
||||
CHANNEL_FLAG_PAUSED = 64,
|
||||
CHANNEL_FLAG_LOOPING = 128,
|
||||
// Added in OPM
|
||||
CHANNEL_FLAG_MISSING_ENT = 256,
|
||||
};
|
||||
|
||||
enum sfx_flags_t {
|
||||
SFX_FLAG_DEFAULT_SOUND = 1,
|
||||
SFX_FLAG_MP3 = 2,
|
||||
SFX_FLAG_STREAMED = 4,
|
||||
SFX_FLAG_NO_OFFSET = 8,
|
||||
SFX_FLAG_NULL = 16,
|
||||
};
|
||||
|
||||
enum loopsound_flags_t {
|
||||
LOOPSOUND_FLAG_NO_PAN = 1
|
||||
};
|
||||
|
||||
#define MAX_SFX 1400
|
||||
#define MAX_SFX_INFOS 1000
|
||||
#define MAX_LOOP_SOUNDS 64
|
||||
|
||||
extern qboolean s_bLastInitSound;
|
||||
extern qboolean s_bSoundStarted;
|
||||
extern qboolean s_bSoundPaused;
|
||||
extern qboolean s_bTryUnpause;
|
||||
extern int s_iListenerNumber;
|
||||
extern float s_fAmbientVolume;
|
||||
extern int number_of_sfx_infos;
|
||||
extern sfx_info_t sfx_infos[];
|
||||
extern sfx_t s_knownSfx[];
|
||||
extern int s_numSfx;
|
||||
extern s_entity_t s_entity[];
|
||||
|
||||
// The current sound driver.
|
||||
// Currently OPENAL
|
||||
#define SOUND_DRIVER OPENAL
|
||||
|
||||
//
|
||||
// snd_info.cpp
|
||||
//
|
||||
void load_sfx_info();
|
||||
|
||||
//
|
||||
// snd_dma_new.cpp
|
||||
//
|
||||
|
||||
sfx_t *S_FindName(const char *name, int sequenceNumber);
|
||||
void S_DefaultSound(sfx_t *sfx);
|
||||
|
||||
void S_LoadData(soundsystemsavegame_t *pSave);
|
||||
void S_SaveData(soundsystemsavegame_t *pSave);
|
||||
void S_ClearSoundBuffer();
|
||||
|
||||
//
|
||||
// snd_mem.c
|
||||
//
|
||||
qboolean S_LoadSound(const char *fileName, sfx_t *sfx, int streamed, qboolean force_load);
|
||||
|
||||
#define S_StopAllSounds2 S_StopAllSounds
|
||||
|
||||
//
|
||||
// Driver-specific functions
|
||||
//
|
||||
#define S_Call_SndDriver(driver, func) S_##driver##_##func
|
||||
#define S_Call_SndDriverX(driver, func) S_Call_SndDriver(driver, func)
|
||||
|
||||
#define S_Driver_Init S_Call_SndDriverX(SOUND_DRIVER, Init)
|
||||
#define S_Driver_Shutdown S_Call_SndDriverX(SOUND_DRIVER, Shutdown)
|
||||
#define S_Driver_StartSound S_Call_SndDriverX(SOUND_DRIVER, StartSound)
|
||||
#define S_Driver_AddLoopingSound S_Call_SndDriverX(SOUND_DRIVER, AddLoopingSound)
|
||||
#define S_Driver_ClearLoopingSounds S_Call_SndDriverX(SOUND_DRIVER, ClearLoopingSounds)
|
||||
#define S_Driver_StopSound S_Call_SndDriverX(SOUND_DRIVER, StopSound)
|
||||
#define S_Driver_StopAllSounds S_Call_SndDriverX(SOUND_DRIVER, StopAllSounds)
|
||||
#define S_Driver_Respatialize S_Call_SndDriverX(SOUND_DRIVER, Respatialize)
|
||||
#define S_Driver_SetReverb S_Call_SndDriverX(SOUND_DRIVER, SetReverb)
|
||||
#define S_Driver_Update S_Call_SndDriverX(SOUND_DRIVER, Update)
|
||||
#define S_Driver_GetMusicFilename S_Call_SndDriverX(SOUND_DRIVER, GetMusicFilename)
|
||||
#define S_Driver_GetMusicLoopCount S_Call_SndDriverX(SOUND_DRIVER, GetMusicLoopCount)
|
||||
#define S_Driver_GetMusicOffset S_Call_SndDriverX(SOUND_DRIVER, GetMusicOffset)
|
||||
|
||||
void S_PrintInfo();
|
||||
void S_DumpInfo();
|
||||
qboolean S_NeedFullRestart();
|
||||
void S_ReLoad(soundsystemsavegame_t* pSave);
|
||||
|
||||
extern cvar_t *s_show_sounds;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,567 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2024 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "snd_local.h"
|
||||
#include "cl_ui.h"
|
||||
|
||||
byte *data_p;
|
||||
byte *iff_end;
|
||||
byte *last_chunk;
|
||||
byte *iff_data;
|
||||
int iff_chunk_len;
|
||||
|
||||
qboolean S_LoadMP3(const char *fileName, sfx_t *sfx);
|
||||
|
||||
/*
|
||||
==============
|
||||
GetLittleShort
|
||||
==============
|
||||
*/
|
||||
short int GetLittleShort()
|
||||
{
|
||||
union {
|
||||
short value;
|
||||
byte bytes[2];
|
||||
} val;
|
||||
|
||||
# ifdef Q3_LITTLE_ENDIAN
|
||||
val.bytes[0] = data_p[0];
|
||||
val.bytes[1] = data_p[1];
|
||||
# else
|
||||
val.bytes[0] = data_p[1];
|
||||
val.bytes[1] = data_p[0];
|
||||
# endif
|
||||
|
||||
data_p += sizeof(short);
|
||||
return val.value;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
GetLittleLong
|
||||
==============
|
||||
*/
|
||||
int GetLittleLong()
|
||||
{
|
||||
union {
|
||||
int value;
|
||||
byte bytes[4];
|
||||
} val;
|
||||
|
||||
# ifdef Q3_LITTLE_ENDIAN
|
||||
val.bytes[0] = data_p[0];
|
||||
val.bytes[1] = data_p[1];
|
||||
val.bytes[2] = data_p[2];
|
||||
val.bytes[3] = data_p[3];
|
||||
# else
|
||||
val.bytes[0] = data_p[3];
|
||||
val.bytes[1] = data_p[2];
|
||||
val.bytes[2] = data_p[1];
|
||||
val.bytes[3] = data_p[0];
|
||||
# endif
|
||||
|
||||
data_p += sizeof(int);
|
||||
return val.value;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SetLittleShort
|
||||
==============
|
||||
*/
|
||||
void SetLittleShort(int i)
|
||||
{
|
||||
union {
|
||||
short value;
|
||||
byte bytes[2];
|
||||
} val;
|
||||
|
||||
val.value = i;
|
||||
|
||||
# ifdef Q3_LITTLE_ENDIAN
|
||||
data_p[0] = val.bytes[0];
|
||||
data_p[1] = val.bytes[1];
|
||||
# else
|
||||
data_p[0] = val.bytes[1];
|
||||
data_p[1] = val.bytes[0];
|
||||
# endif
|
||||
|
||||
data_p += sizeof(short);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SetLittleLong
|
||||
==============
|
||||
*/
|
||||
void SetLittleLong(int i)
|
||||
{
|
||||
union {
|
||||
int value;
|
||||
byte bytes[4];
|
||||
} val;
|
||||
|
||||
val.value = i;
|
||||
|
||||
# ifdef Q3_LITTLE_ENDIAN
|
||||
data_p[0] = val.bytes[0];
|
||||
data_p[1] = val.bytes[1];
|
||||
data_p[2] = val.bytes[2];
|
||||
data_p[3] = val.bytes[3];
|
||||
# else
|
||||
data_p[0] = val.bytes[3];
|
||||
data_p[1] = val.bytes[2];
|
||||
data_p[2] = val.bytes[1];
|
||||
data_p[3] = val.bytes[0];
|
||||
# endif
|
||||
|
||||
data_p += sizeof(int);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
FindNextChunk
|
||||
==============
|
||||
*/
|
||||
void FindNextChunk(const char *name)
|
||||
{
|
||||
int value;
|
||||
|
||||
while (1) {
|
||||
data_p = last_chunk;
|
||||
|
||||
if (last_chunk >= (byte *)iff_end) {
|
||||
break;
|
||||
}
|
||||
|
||||
data_p = last_chunk + 4;
|
||||
value = GetLittleLong();
|
||||
|
||||
iff_chunk_len = value;
|
||||
if (value < 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
data_p -= 8;
|
||||
value++;
|
||||
value &= ~1;
|
||||
|
||||
last_chunk = data_p + value + 8;
|
||||
if (!strncmp((const char *)data_p, name, 4u)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
data_p = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
FindChunk
|
||||
==============
|
||||
*/
|
||||
void FindChunk(const char *name)
|
||||
{
|
||||
last_chunk = iff_data;
|
||||
FindNextChunk(name);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
DumpChunks
|
||||
==============
|
||||
*/
|
||||
void DumpChunks()
|
||||
{
|
||||
char str[5];
|
||||
|
||||
str[4] = 0;
|
||||
|
||||
data_p = iff_data;
|
||||
do {
|
||||
memcpy(str, data_p, 4);
|
||||
data_p += 4;
|
||||
|
||||
iff_chunk_len = GetLittleLong();
|
||||
|
||||
Com_Printf("0x%x : %s (%d)\n", data_p - 4, str, iff_chunk_len);
|
||||
|
||||
data_p += (iff_chunk_len + 1) & ~1;
|
||||
} while (data_p < (byte *)iff_end);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
GetWavinfo
|
||||
==============
|
||||
*/
|
||||
wavinfo_t GetWavinfo(const char *name, byte *wav, int wavlength)
|
||||
{
|
||||
wavinfo_t info;
|
||||
int samples;
|
||||
|
||||
memset(&info, 0, sizeof(wavinfo_t));
|
||||
|
||||
if (!wav) {
|
||||
return info;
|
||||
}
|
||||
|
||||
iff_data = wav;
|
||||
iff_end = &wav[wavlength];
|
||||
FindChunk("RIFF");
|
||||
|
||||
if (!data_p || strncmp((const char *)data_p + 8, "WAVE", 4u)) {
|
||||
Com_Printf("Missing RIFF/WAVE chunks\n");
|
||||
return info;
|
||||
}
|
||||
|
||||
iff_data = data_p + 12;
|
||||
FindChunk("fmt ");
|
||||
if (!data_p) {
|
||||
Com_Printf("Missing fmt chunk\n");
|
||||
return info;
|
||||
}
|
||||
|
||||
data_p += 8;
|
||||
|
||||
info.format = GetLittleShort();
|
||||
if (info.format == 17) {
|
||||
info.channels = GetLittleShort();
|
||||
info.rate = (float)GetLittleLong();
|
||||
data_p += 6;
|
||||
info.width = (float)GetLittleShort() / 8.f;
|
||||
data_p += 2;
|
||||
|
||||
FindChunk("data");
|
||||
if (!data_p) {
|
||||
Com_Printf("Missing data chunk\n");
|
||||
return info;
|
||||
}
|
||||
|
||||
data_p += 4;
|
||||
if (info.width >= 1.0) {
|
||||
samples = (int)((float)GetLittleLong() / info.width);
|
||||
} else {
|
||||
samples = (int)((float)GetLittleLong() * info.width);
|
||||
}
|
||||
|
||||
if (!info.samples) {
|
||||
info.samples = samples;
|
||||
} else if (samples < info.samples) {
|
||||
Com_Error(ERR_DROP, "Sound %s has a bad loop length", name);
|
||||
}
|
||||
|
||||
info.dataofs = 0;
|
||||
} else if (info.format == 1) {
|
||||
info.channels = GetLittleShort();
|
||||
info.rate = (float)GetLittleLong();
|
||||
data_p += 6;
|
||||
info.width = (float)(GetLittleShort() / 8);
|
||||
|
||||
FindChunk("data");
|
||||
if (!data_p) {
|
||||
Com_Printf("Missing data chunk\n");
|
||||
return info;
|
||||
}
|
||||
|
||||
data_p += 4;
|
||||
samples = (float)GetLittleLong() / info.width;
|
||||
|
||||
if (!info.samples) {
|
||||
info.samples = samples;
|
||||
} else if (samples < info.samples) {
|
||||
Com_Error(ERR_DROP, "Sound %s has a bad loop length", name);
|
||||
}
|
||||
|
||||
info.dataofs = data_p - wav;
|
||||
} else {
|
||||
Com_Printf("Microsoft PCM format only\n");
|
||||
return info;
|
||||
}
|
||||
|
||||
info.datasize = iff_chunk_len;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
DownSampleWav
|
||||
==============
|
||||
*/
|
||||
qboolean DownSampleWav(wavinfo_t *info, byte *wav, int wavlength, int newkhz, byte **newdata)
|
||||
{
|
||||
int newdatasize;
|
||||
byte* datap;
|
||||
int i;
|
||||
int ii;
|
||||
int error;
|
||||
int width;
|
||||
int oldsamples;
|
||||
int oldrate;
|
||||
|
||||
newdatasize = 0;
|
||||
datap = &wav[info->dataofs];
|
||||
|
||||
if (info->channels > 1)
|
||||
{
|
||||
Com_DPrintf("Could not downsample WAV file. Stereo WAVs not supported!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (info->format != 1 || !info->dataofs)
|
||||
{
|
||||
Com_DPrintf("Could not downsample WAV file. Not PCM format!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (info->rate <= newkhz) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
error = 0;
|
||||
width = info->width;
|
||||
for (i = 0; i < info->samples; i++) {
|
||||
error += newkhz;
|
||||
while (error > info->rate) {
|
||||
error -= info->rate;
|
||||
newdatasize += width;
|
||||
}
|
||||
}
|
||||
|
||||
oldsamples = info->samples;
|
||||
oldrate = info->rate;
|
||||
info->samples = newdatasize / width;
|
||||
info->rate = (float)newkhz;
|
||||
newdatasize += info->dataofs;
|
||||
|
||||
*newdata = (byte*)Z_TagMalloc(newdatasize, TAG_SOUND);
|
||||
memcpy(*newdata, wav, info->dataofs);
|
||||
|
||||
iff_data = *newdata;
|
||||
iff_end = *newdata + newdatasize;
|
||||
FindChunk("RIFF");
|
||||
|
||||
if (!data_p || strncmp((const char*)data_p + 8, "WAVE", 4u))
|
||||
{
|
||||
Com_DPrintf("Missing RIFF/WAVE chunks\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
iff_data = data_p + 12;
|
||||
FindChunk("fmt ");
|
||||
if (!data_p)
|
||||
{
|
||||
Com_DPrintf("Missing fmt chunk\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
data_p += 12;
|
||||
SetLittleShort((int)info->rate);
|
||||
data_p += 8;
|
||||
|
||||
FindChunk("data");
|
||||
if (!data_p)
|
||||
{
|
||||
Com_DPrintf("Missing data chunk\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
data_p += 4;
|
||||
SetLittleLong((int)(info->samples * info->width));
|
||||
|
||||
error = 0;
|
||||
for (i = 0; i < oldsamples; i++) {
|
||||
error += newkhz;
|
||||
while (error > oldrate) {
|
||||
error -= oldrate;
|
||||
for (ii = 0; ii < width; ii++) {
|
||||
data_p[ii] = datap[ii];
|
||||
}
|
||||
|
||||
data_p += width;
|
||||
}
|
||||
|
||||
datap += width;
|
||||
}
|
||||
|
||||
return newdatasize;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
DownSampleWav_MILES
|
||||
==============
|
||||
*/
|
||||
int DownSampleWav_MILES(wavinfo_t *info, byte *wav, int wavlength, int newkhz, byte **newdata)
|
||||
{
|
||||
//STUB_DESC("sound stuff");
|
||||
//return 0;
|
||||
// FIXME: unimplemented
|
||||
// Fallback to software downsampling
|
||||
return DownSampleWav(info, wav, wavlength, newkhz, newdata);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_LoadSound
|
||||
==============
|
||||
*/
|
||||
qboolean S_LoadSound(const char *fileName, sfx_t *sfx, int streamed, qboolean force_load)
|
||||
{
|
||||
int size;
|
||||
fileHandle_t file_handle;
|
||||
char tempName[MAX_RES_NAME + 1];
|
||||
int realKhz;
|
||||
|
||||
sfx->buffer = 0;
|
||||
|
||||
if (fileName[0] == '*') {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if (streamed) {
|
||||
//
|
||||
// Added in 2.0
|
||||
// Will be loaded next time
|
||||
sfx->length = 5000;
|
||||
sfx->width = 1;
|
||||
sfx->iFlags |= SFX_FLAG_STREAMED;
|
||||
sfx->time_length = 5000.0;
|
||||
sfx->data = NULL;
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
if (clc.state != CA_LOADING && !force_load) {
|
||||
Com_Printf("**************S_LoadSound: %s\n", fileName);
|
||||
}
|
||||
|
||||
if (strstr(fileName, ".mp3")) {
|
||||
return S_LoadMP3(fileName, sfx);
|
||||
}
|
||||
|
||||
size = FS_FOpenFileRead(fileName, &file_handle, qfalse, qtrue);
|
||||
if (size <= 0)
|
||||
{
|
||||
if (file_handle) {
|
||||
FS_FCloseFile(file_handle);
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
sfx->data = (byte*)Z_TagMalloc(size, TAG_SOUND);
|
||||
|
||||
FS_Read(sfx->data, size, file_handle);
|
||||
FS_FCloseFile(file_handle);
|
||||
sfx->info = GetWavinfo(fileName, sfx->data, size);
|
||||
|
||||
if (sfx->info.channels != 1 && !streamed)
|
||||
{
|
||||
Com_Printf("%s is a stereo wav file\n", fileName);
|
||||
Z_Free(sfx->data);
|
||||
sfx->data = NULL;
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if (!sfx->info.dataofs) {
|
||||
sfx->iFlags |= SFX_FLAG_NO_OFFSET;
|
||||
}
|
||||
|
||||
switch (s_khz->integer) {
|
||||
case 11:
|
||||
realKhz = 11025;
|
||||
break;
|
||||
case 22:
|
||||
default:
|
||||
realKhz = 22050;
|
||||
break;
|
||||
case 44:
|
||||
realKhz = 44100;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(sfx->iFlags & SFX_FLAG_STREAMED) && realKhz < sfx->info.rate) {
|
||||
byte* newdata;
|
||||
int newdatasize;
|
||||
|
||||
newdata = NULL;
|
||||
if (sfx->iFlags & SFX_FLAG_NO_OFFSET) {
|
||||
newdatasize = DownSampleWav_MILES(&sfx->info, sfx->data, size, realKhz, &newdata);
|
||||
} else {
|
||||
newdatasize = DownSampleWav(&sfx->info, sfx->data, size, realKhz, &newdata);
|
||||
}
|
||||
|
||||
if (newdatasize) {
|
||||
Z_Free(sfx->data);
|
||||
sfx->data = newdata;
|
||||
}
|
||||
}
|
||||
|
||||
sfx->length = sfx->info.samples;
|
||||
sfx->width = sfx->info.width;
|
||||
sfx->time_length = sfx->info.samples / sfx->info.rate * 1000.f;
|
||||
|
||||
if (sfx->iFlags & SFX_FLAG_STREAMED) {
|
||||
Z_Free(sfx->data);
|
||||
sfx->data = NULL;
|
||||
}
|
||||
|
||||
sprintf(tempName, "k%s", fileName);
|
||||
UI_LoadResource(tempName);
|
||||
|
||||
if (strstr(fileName, "sound/null.wav")) {
|
||||
sfx->iFlags |= SFX_FLAG_NULL;
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
S_LoadMP3
|
||||
==============
|
||||
*/
|
||||
qboolean S_LoadMP3(const char *fileName, sfx_t *sfx)
|
||||
{
|
||||
int length;
|
||||
fileHandle_t file_handle;
|
||||
|
||||
length = FS_FOpenFileRead(fileName, &file_handle, 0, 1);
|
||||
if (length <= 0) {
|
||||
if (file_handle) {
|
||||
FS_FCloseFile(file_handle);
|
||||
}
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
memset(&sfx->info, 0, sizeof(sfx->info));
|
||||
sfx->data = (byte*)Z_TagMalloc(length, TAG_SOUND);
|
||||
sfx->length = length;
|
||||
sfx->width = 1;
|
||||
FS_Read(sfx->data, length, file_handle);
|
||||
FS_FCloseFile(file_handle);
|
||||
|
||||
sfx->iFlags |= SFX_FLAG_MP3;
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
@@ -1,29 +1,25 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
Copyright (C) 2024 the OpenMoHAA team
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "../qcommon/vm_local.h"
|
||||
|
||||
void VM_Compile( vm_t *vm, vmHeader_t *header ) {}
|
||||
int VM_CallCompiled( vm_t *vm, int *args ) {}
|
||||
|
||||
|
||||
// See the header file for information
|
||||
|
||||
#include "snd_miles_new.h"
|
||||
@@ -1,38 +1,28 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
Copyright (C) 2024 the OpenMoHAA team
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
Quake III Arena source code is free software; you can redistribute it
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
Quake III Arena source code is distributed in the hope that it will be
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Foobar; if not, write to the Free Software
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#if !( defined __linux__ || defined __FreeBSD__ )
|
||||
#error You should include this file only on Linux/FreeBSD platforms
|
||||
#endif
|
||||
|
||||
#ifndef __GLW_LINUX_H__
|
||||
#define __GLW_LINUX_H__
|
||||
//
|
||||
// This file exists in the original source code.
|
||||
// But this driver won't be implemented, as OpenAL is a better sound system!
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *OpenGLLib; // instance of OpenGL library
|
||||
|
||||
FILE *log_fp;
|
||||
} glwstate_t;
|
||||
|
||||
extern glwstate_t glw_state;
|
||||
|
||||
#endif
|
||||
#pragma once
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,248 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2024 the OpenMoHAA team
|
||||
|
||||
This file is part of OpenMoHAA source code.
|
||||
|
||||
OpenMoHAA source code is free software; you can redistribute it
|
||||
and/or modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the License,
|
||||
or (at your option) any later version.
|
||||
|
||||
OpenMoHAA source code is distributed in the hope that it will be
|
||||
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenMoHAA source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "qal.h"
|
||||
|
||||
#undef OPENAL
|
||||
|
||||
typedef int S32;
|
||||
typedef unsigned int U32;
|
||||
|
||||
#define MAX_OPENAL_CHANNELS_3D 32
|
||||
#define MAX_OPENAL_CHANNELS_2D 32
|
||||
#define MAX_OPENAL_CHANNELS_2D_STREAM 32
|
||||
#define MAX_OPENAL_POSITION_CHANNELS (MAX_OPENAL_CHANNELS_3D + MAX_OPENAL_CHANNELS_2D + MAX_OPENAL_CHANNELS_2D_STREAM)
|
||||
#define MAX_OPENAL_SONGS 2
|
||||
#define MAX_OPENAL_MISC_CHANNELS 3
|
||||
#define MAX_OPENAL_CHANNELS \
|
||||
(MAX_OPENAL_CHANNELS_3D + MAX_OPENAL_CHANNELS_2D + MAX_OPENAL_CHANNELS_2D_STREAM + MAX_OPENAL_SONGS \
|
||||
+ MAX_OPENAL_MISC_CHANNELS)
|
||||
#define MAX_OPENAL_LOOP_SOUNDS 64
|
||||
|
||||
#define OPENAL_CHANNEL_MP3_ID \
|
||||
(MAX_OPENAL_CHANNELS_3D + MAX_OPENAL_CHANNELS_2D + MAX_OPENAL_CHANNELS_2D_STREAM + MAX_OPENAL_SONGS)
|
||||
#define OPENAL_CHANNEL_TRIGGER_MUSIC_ID (OPENAL_CHANNEL_MP3_ID + 1)
|
||||
#define OPENAL_CHANNEL_MOVIE_ID (OPENAL_CHANNEL_TRIGGER_MUSIC_ID + 1)
|
||||
|
||||
#define MAX_STREAM_BUFFERS 16
|
||||
#define MAX_BUFFER_SAMPLES 16384
|
||||
|
||||
typedef enum {
|
||||
FADE_NONE,
|
||||
FADE_IN,
|
||||
FADE_OUT
|
||||
} fade_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t vOrigin;
|
||||
vec3_t vRelativeOrigin;
|
||||
vec3_t vVelocity;
|
||||
|
||||
sfx_t *pSfx;
|
||||
qboolean bPlaying;
|
||||
|
||||
int iChannel;
|
||||
float fVolume;
|
||||
float fPitch;
|
||||
|
||||
int iStartTime;
|
||||
qboolean bInUse;
|
||||
qboolean bCombine;
|
||||
|
||||
float fBaseVolume;
|
||||
float fMinDist;
|
||||
float fMaxDist;
|
||||
int iFlags;
|
||||
} openal_loop_sound_t;
|
||||
|
||||
struct openal_channel {
|
||||
sfx_t *pSfx;
|
||||
int iEntNum;
|
||||
int iEntChannel;
|
||||
vec3_t vOrigin;
|
||||
|
||||
float fVolume;
|
||||
int iBaseRate;
|
||||
float fNewPitchMult;
|
||||
float fMinDist;
|
||||
float fMaxDist;
|
||||
|
||||
int iStartTime;
|
||||
int iTime;
|
||||
int iEndTime;
|
||||
int iFlags;
|
||||
int iPausedOffset;
|
||||
|
||||
int song_number;
|
||||
|
||||
fade_t fading;
|
||||
int fade_time;
|
||||
int fade_start_time;
|
||||
|
||||
ALuint source;
|
||||
ALuint buffer;
|
||||
ALubyte *bufferdata;
|
||||
|
||||
public:
|
||||
void play();
|
||||
virtual void stop();
|
||||
void pause();
|
||||
|
||||
void set_no_3d();
|
||||
void set_3d();
|
||||
|
||||
void set_gain(float gain);
|
||||
void set_velocity(float v0, float v1, float v2);
|
||||
void set_position(float v0, float v1, float v2);
|
||||
|
||||
bool is_free();
|
||||
bool is_paused();
|
||||
bool is_playing();
|
||||
|
||||
void force_free();
|
||||
virtual bool set_sfx(sfx_t *pSfx);
|
||||
|
||||
void start_sample();
|
||||
void stop_sample();
|
||||
void resume_sample();
|
||||
void end_sample();
|
||||
|
||||
void set_sample_pan(S32 pan);
|
||||
void set_sample_playback_rate(S32 pan);
|
||||
S32 sample_playback_rate();
|
||||
|
||||
S32 sample_volume();
|
||||
virtual U32 sample_offset();
|
||||
U32 sample_ms_offset();
|
||||
U32 sample_loop_count();
|
||||
virtual void set_sample_offset(U32 offset);
|
||||
void set_sample_ms_offset(U32 offset);
|
||||
virtual void set_sample_loop_count(S32 count);
|
||||
void set_sample_loop_block(S32 start_offset, S32 end_offset);
|
||||
|
||||
U32 sample_status();
|
||||
|
||||
public:
|
||||
virtual void update();
|
||||
|
||||
virtual U32 buffer_frequency() const;
|
||||
};
|
||||
|
||||
struct openal_channel_two_d_stream : public openal_channel {
|
||||
private:
|
||||
char fileName[64];
|
||||
void *streamHandle;
|
||||
unsigned int buffers[MAX_STREAM_BUFFERS];
|
||||
unsigned int currentBuf;
|
||||
unsigned int sampleLoopCount;
|
||||
unsigned int sampleLooped;
|
||||
unsigned int streamNextOffset;
|
||||
bool streaming;
|
||||
|
||||
public:
|
||||
openal_channel_two_d_stream();
|
||||
~openal_channel_two_d_stream();
|
||||
|
||||
void stop() override;
|
||||
bool set_sfx(sfx_t *pSfx) override;
|
||||
void set_sample_loop_count(S32 count) override;
|
||||
void update() override;
|
||||
U32 sample_offset() override;
|
||||
void set_sample_offset(U32 offset) override;
|
||||
|
||||
bool queue_stream(const char *fileName);
|
||||
|
||||
protected:
|
||||
U32 buffer_frequency() const override;
|
||||
|
||||
private:
|
||||
void clear_stream();
|
||||
|
||||
unsigned int getQueueLength() const;
|
||||
unsigned int getCurrentStreamPosition() const;
|
||||
unsigned int getBytesPerSample() const;
|
||||
};
|
||||
|
||||
struct openal_internal_t {
|
||||
openal_channel chan_3D[MAX_OPENAL_CHANNELS_3D];
|
||||
openal_channel chan_2D[MAX_OPENAL_CHANNELS_2D];
|
||||
openal_channel_two_d_stream chan_2D_stream[MAX_OPENAL_CHANNELS_2D_STREAM];
|
||||
openal_channel_two_d_stream chan_song[MAX_OPENAL_SONGS];
|
||||
openal_channel_two_d_stream chan_mp3;
|
||||
openal_channel_two_d_stream chan_trig_music;
|
||||
openal_channel_two_d_stream chan_movie;
|
||||
|
||||
// Pointers to channels
|
||||
openal_channel *channel[MAX_OPENAL_CHANNELS];
|
||||
|
||||
openal_loop_sound_t loop_sounds[MAX_OPENAL_LOOP_SOUNDS];
|
||||
|
||||
openal_channel movieChannel;
|
||||
sfx_t movieSFX;
|
||||
|
||||
char tm_filename[MAX_RES_NAME];
|
||||
int tm_loopcount;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
qboolean S_OPENAL_Init();
|
||||
void S_OPENAL_Shutdown();
|
||||
void S_OPENAL_StartSound(
|
||||
const vec3_t vOrigin,
|
||||
int iEntNum,
|
||||
int iEntChannel,
|
||||
sfxHandle_t sfxHandle,
|
||||
float fVolume,
|
||||
float fMinDist,
|
||||
float fPitch,
|
||||
float fMaxDist,
|
||||
qboolean bStreamed
|
||||
);
|
||||
void S_OPENAL_AddLoopingSound(
|
||||
const vec3_t vOrigin,
|
||||
const vec3_t vVelocity,
|
||||
sfxHandle_t sfxHandle,
|
||||
float fVolume,
|
||||
float fMinDist,
|
||||
float fMaxDist,
|
||||
float fPitch,
|
||||
int iFlags
|
||||
);
|
||||
void S_OPENAL_ClearLoopingSounds();
|
||||
void S_OPENAL_StopSound(int iEntNum, int iEntChannel);
|
||||
void S_OPENAL_StopAllSounds(qboolean bStopMusic);
|
||||
void S_OPENAL_Respatialize(int iEntNum, const vec3_t vHeadPos, const vec3_t vAxis[3]);
|
||||
void S_OPENAL_SetReverb(int iType, float fLevel);
|
||||
void S_OPENAL_Update();
|
||||
|
||||
const char *S_OPENAL_GetMusicFilename();
|
||||
int S_OPENAL_GetMusicLoopCount();
|
||||
unsigned int S_OPENAL_GetMusicOffset();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#if defined(NO_MODERN_DMA) && NO_MODERN_DMA
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -89,3 +91,78 @@ void S_MasterGain(float gain);
|
||||
#endif
|
||||
|
||||
#include "new/snd_public_new.h"
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void S_SoundInfo_f();
|
||||
void S_SoundDump_f();
|
||||
void S_Init(qboolean full_startup);
|
||||
void S_Shutdown(qboolean full_shutdown);
|
||||
qboolean S_NameExists(const char* name);
|
||||
void S_BeginRegistration();
|
||||
qboolean S_IsSoundRegistered(const char* name);
|
||||
sfxHandle_t S_RegisterSound(const char* name, int streamed, qboolean force_load);
|
||||
float S_GetSoundTime(sfxHandle_t handle);
|
||||
void S_EndRegistration();
|
||||
void S_UpdateEntity(int entityNum, const vec3_t origin, const vec3_t vel, qboolean use_listener);
|
||||
void S_SetGlobalAmbientVolumeLevel(float volume);
|
||||
void S_StartSound(const vec3_t origin, int entnum, int entchannel, sfxHandle_t sfxHandle, float volume, float min_dist, float pitch, float maxDist, int streamed);
|
||||
void S_StartLocalSound(const char* sound_name, qboolean force_load);
|
||||
void S_StartLocalSoundChannel(const char* sound_name, qboolean force_load, soundChannel_t channel);
|
||||
void S_StopAllSounds(qboolean stop_music);
|
||||
void S_ClearLoopingSounds();
|
||||
void S_AddLoopingSound(const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle, float volume, float min_dist, float max_dist, float pitch, int flags);
|
||||
void S_Respatialize(int entityNum, const vec3_t head, vec3_t axis[3]);
|
||||
void S_Update();
|
||||
void S_StopSound(int entnum, int channel);
|
||||
void S_SetReverb(int reverb_type, float reverb_level);
|
||||
void S_Play();
|
||||
void S_SoundList();
|
||||
|
||||
qboolean S_IsSoundPlaying(int channel_number, const char* sfxName);
|
||||
void S_FadeSound(float fTime);
|
||||
|
||||
qboolean MUSIC_LoadSoundtrackFile(const char* filename);
|
||||
qboolean MUSIC_SongValid(const char* mood);
|
||||
qboolean MUSIC_Loaded();
|
||||
void Music_Update();
|
||||
void MUSIC_SongEnded();
|
||||
void MUSIC_NewSoundtrack(const char* name);
|
||||
void MUSIC_UpdateMood(int current, int fallback);
|
||||
void MUSIC_UpdateVolume(float volume, float fade_time);
|
||||
void MUSIC_StopAllSongs();
|
||||
void MUSIC_FreeAllSongs();
|
||||
qboolean MUSIC_Playing();
|
||||
int MUSIC_FindSong(const char* name);
|
||||
void S_loadsoundtrack();
|
||||
const char* S_CurrentSoundtrack();
|
||||
void S_PlaySong();
|
||||
int MUSIC_CurrentSongChannel();
|
||||
void MUSIC_StopChannel(int channel_number);
|
||||
qboolean MUSIC_PlaySong(const char* alias);
|
||||
void MUSIC_UpdateMusicVolumes();
|
||||
void MUSIC_CheckForStoppedSongs();
|
||||
void S_TriggeredMusic_SetupHandle(const char* pszName, int iLoopCount, int iOffset, qboolean autostart);
|
||||
void S_TriggeredMusic_Start();
|
||||
void S_TriggeredMusic_StartLoop();
|
||||
void S_TriggeredMusic_Stop();
|
||||
void S_TriggeredMusic_Pause();
|
||||
void S_TriggeredMusic_Unpause();
|
||||
void S_TriggeredMusic_PlayIntroMusic();
|
||||
void S_StopMovieAudio();
|
||||
void S_SetupMovieAudio(const char* pszMovieName);
|
||||
int S_CurrentMoviePosition();
|
||||
|
||||
const char* S_GetMusicFilename();
|
||||
int S_GetMusicLoopCount();
|
||||
unsigned int S_GetMusicOffset();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -120,7 +120,7 @@ bool UConnection::SendEvent
|
||||
ptr = m_listeners.ObjectAt( i );
|
||||
if( ptr )
|
||||
{
|
||||
Event *e = new Event( m_events.ObjectAt( i ) );
|
||||
Event *e = new Event( *m_events.ObjectAt( i ) );
|
||||
|
||||
for( j = 1; j < numargs; j++ )
|
||||
{
|
||||
|
||||
@@ -21,6 +21,46 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "DrivableVehicleTandem.h"
|
||||
#include "vehicleturret.h"
|
||||
|
||||
// FIXME: unimplemented
|
||||
CLASS_DECLARATION(DrivableVehicle, DrivableVehicleTandem, "DrivableVehicleTandem") {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
DrivableVehicleTandem::DrivableVehicleTandem()
|
||||
{
|
||||
}
|
||||
|
||||
DrivableVehicleTandem::~DrivableVehicleTandem()
|
||||
{
|
||||
}
|
||||
|
||||
void DrivableVehicleTandem::SpawnTurret(Event* ev)
|
||||
{
|
||||
VehicleTurretGunTandem* pTurret = new VehicleTurretGunTandem();
|
||||
int slot;
|
||||
|
||||
pTurret->SetBaseOrientation(orientation, NULL);
|
||||
pTurret->setModel(ev->GetString(2));
|
||||
|
||||
slot = ev->GetInteger(1);
|
||||
AttachTurretSlot(slot, pTurret, vec_zero, NULL);
|
||||
pTurret->SetVehicleOwner(this);
|
||||
|
||||
pTurret->PostEvent(EV_TakeDamage, EV_POSTSPAWN);
|
||||
|
||||
UpdateTurretSlot(slot);
|
||||
|
||||
pTurret->ProcessPendingEvents();
|
||||
}
|
||||
|
||||
void DrivableVehicleTandem::UpdateTurretSlot(int iSlot)
|
||||
{
|
||||
DrivableVehicle::UpdateTurretSlot(iSlot);
|
||||
|
||||
if (Turrets[iSlot].ent && Turrets[iSlot].ent->isSubclassOf(VehicleTurretGunTandem)) {
|
||||
VehicleTurretGunTandem* pTurret = static_cast<VehicleTurretGunTandem*>(Turrets[iSlot].ent.Pointer());
|
||||
pTurret->UpdateLinkedTurret();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,3 +21,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "vehicle.h"
|
||||
|
||||
class DrivableVehicleTandem : public DrivableVehicle {
|
||||
private:
|
||||
CLASS_PROTOTYPE(DrivableVehicleTandem);
|
||||
|
||||
public:
|
||||
DrivableVehicleTandem();
|
||||
~DrivableVehicleTandem();
|
||||
|
||||
void SpawnTurret(Event* ev) override;
|
||||
void UpdateTurretSlot(int iSlot) override;
|
||||
};
|
||||
+1581
-421
File diff suppressed because it is too large.
Load diff
+47
-28
@@ -26,18 +26,19 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "animate.h"
|
||||
|
||||
typedef enum {
|
||||
CONTROLLER_ALLIES,
|
||||
CONTROLLER_AXIS,
|
||||
CONTROLLER_ALLIES,
|
||||
CONTROLLER_AXIS,
|
||||
CONTROLLER_DRAW
|
||||
} eController;
|
||||
|
||||
#define PT_SPAWNFLAG_PLAY_FIRE_SOUND 1
|
||||
#define PT_SPAWNFLAG_TARGET_RANDOM 4
|
||||
#define PT_SPAWNFLAG_TURN_ON 8
|
||||
#define PT_SPAWNFLAG_SET_YAW 16
|
||||
#define PT_SPAWNFLAG_SET_ROLL 32
|
||||
#define PT_SPAWNFLAG_TARGET_PLAYER 64
|
||||
#define PT_SPAWNFLAG_HIDDEN 128
|
||||
#define PT_SPAWNFLAG_PLAY_FIRE_SOUND 1
|
||||
#define PT_SPAWNFLAG_PLAY_MOTION_SOUND 2
|
||||
#define PT_SPAWNFLAG_TARGET_RANDOM 4
|
||||
#define PT_SPAWNFLAG_TURN_ON 8
|
||||
#define PT_SPAWNFLAG_ROTATE_YAW 16
|
||||
#define PT_SPAWNFLAG_ROTATE_ROLL 32
|
||||
#define PT_SPAWNFLAG_TARGET_PLAYER 64
|
||||
#define PT_SPAWNFLAG_HIDDEN 128
|
||||
|
||||
void ClearProjectileTargets();
|
||||
|
||||
@@ -52,7 +53,7 @@ public:
|
||||
ProjectileTarget();
|
||||
|
||||
void EventSetId(Event *ev);
|
||||
int GetTarget() const;
|
||||
int GetTarget() const;
|
||||
};
|
||||
|
||||
#define MAX_PROJECTILE_GENERATOR_TARGETS 16
|
||||
@@ -101,20 +102,28 @@ public:
|
||||
bool ShouldStartOn() const;
|
||||
bool ShouldHideModel() const;
|
||||
bool ShouldPlayFireSound() const;
|
||||
bool ShouldPlayMotionSound() const;
|
||||
bool ShouldRotateYaw() const;
|
||||
bool ShouldRotateRoll() const;
|
||||
|
||||
void EventIsTurnedOn(Event *ev);
|
||||
void EventGetTargetEntity(Event *ev);
|
||||
void EventLaunchSound(Event *ev);
|
||||
void SetTarget(Event *ev);
|
||||
void OnInitialize(Event *ev);
|
||||
void TurnOff(Event *ev);
|
||||
void TurnOn(Event *ev);
|
||||
bool ShouldTargetRandom() const;
|
||||
void ChooseTarget();
|
||||
void EventIsTurnedOn(Event *ev);
|
||||
void EventGetTargetEntity(Event *ev);
|
||||
void EventLaunchSound(Event *ev);
|
||||
void SetTarget(Event *ev);
|
||||
void SetTarget(Entity *ent);
|
||||
void OnInitialize(Event *ev);
|
||||
void TurnOff(Event *ev);
|
||||
void TurnOn(Event *ev);
|
||||
bool ShouldTargetRandom() const;
|
||||
Entity *ChooseTarget();
|
||||
|
||||
void GetLocalTargets();
|
||||
bool ShouldTargetPlayer() const;
|
||||
void GetTargetPos(Entity *target);
|
||||
Vector GetTargetPos(Entity *target);
|
||||
void GetMuzzlePos(Vector& pos);
|
||||
void Fire();
|
||||
void TryLaunchSound();
|
||||
void SetWeaponAnim(const char *name, Event *ev);
|
||||
void EventAccuracy(Event *ev);
|
||||
void EventMaxDelay(Event *ev);
|
||||
void EventMinDelay(Event *ev);
|
||||
@@ -125,11 +134,11 @@ public:
|
||||
void EventMaxDuration(Event *ev);
|
||||
void EventMinDuration(Event *ev);
|
||||
void SetWeaponModel(Event *ev);
|
||||
void EventSetId(Event* ev);
|
||||
void EventmaxDonut(Event* ev);
|
||||
void EventminDonut(Event* ev);
|
||||
void EventarcDonut(Event* ev);
|
||||
void EventisDonut(Event* ev);
|
||||
void EventSetId(Event *ev);
|
||||
void EventmaxDonut(Event *ev);
|
||||
void EventminDonut(Event *ev);
|
||||
void EventarcDonut(Event *ev);
|
||||
void EventisDonut(Event *ev);
|
||||
virtual bool Attack(int count);
|
||||
|
||||
void Archive(Archiver& arc) override;
|
||||
@@ -154,8 +163,9 @@ public:
|
||||
void PlayPreImpactSound(Event *ev);
|
||||
void SetProjectileModel(Event *ev);
|
||||
|
||||
bool Attack(int count) override;
|
||||
void Archive(Archiver& arc) override;
|
||||
float EstimateImpactTime(const Vector& targetOrigin, const Vector& fromOrigin, float speed) const;
|
||||
bool Attack(int count) override;
|
||||
void Archive(Archiver& arc) override;
|
||||
};
|
||||
|
||||
class ProjectileGenerator_Gun : public ProjectileGenerator
|
||||
@@ -196,6 +206,7 @@ public:
|
||||
void SetBulletRange(Event *ev);
|
||||
|
||||
bool Attack(int count) override;
|
||||
bool TickWeaponAnim();
|
||||
void TickCycle(Event *ev) override;
|
||||
void Archive(Archiver& arc) override;
|
||||
};
|
||||
@@ -238,6 +249,8 @@ public:
|
||||
|
||||
ThrobbingBox_Explosive();
|
||||
|
||||
bool ShouldDoExplosion();
|
||||
|
||||
void SetExplosionOffset(Event *ev);
|
||||
void SetExplosionEffect(Event *ev);
|
||||
void SetTriggered(Event *ev);
|
||||
@@ -293,6 +306,8 @@ private:
|
||||
public:
|
||||
CLASS_PROTOTYPE(ThrobbingBox_Stickybomb);
|
||||
|
||||
ThrobbingBox_Stickybomb();
|
||||
|
||||
void OnStickyBombWet(Event *ev);
|
||||
void OnStickyBombUse(Event *ev);
|
||||
|
||||
@@ -312,7 +327,7 @@ public:
|
||||
|
||||
Objective();
|
||||
|
||||
void Archive(Archiver &arc) override;
|
||||
void Archive(Archiver& arc) override;
|
||||
void TurnOn(Event *ev);
|
||||
void TurnOff(Event *ev);
|
||||
void Complete(Event *ev);
|
||||
@@ -327,6 +342,10 @@ class FencePost : public Entity
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE(FencePost);
|
||||
|
||||
FencePost();
|
||||
|
||||
void Killed(Event* ev) override;
|
||||
};
|
||||
|
||||
class AISpawnPoint : public SimpleArchivedEntity
|
||||
|
||||
+99
-12
@@ -114,19 +114,105 @@ void TOWObjectiveMan::TakeOverObjective(eController controller, eController cont
|
||||
}
|
||||
}
|
||||
|
||||
Event EV_SetController("ControlledBy", EV_DEFAULT, "i", "ControlledBy", "Sets the team controlling the objective");
|
||||
Event EV_TakeOver(
|
||||
"TakeOver", EV_DEFAULT, "i", "TeamNum", "Sets the team controlling the objective. 0 = Axis, 1 = Allies"
|
||||
//---------------------------------------------------------------------------------------------
|
||||
/*QUAKED func_TOWObjective (1.0 0.0 1.0) (-12 -12 -12) (12 12 12) StartOn Respawner
|
||||
|
||||
This object is an extension of the standard objective object. It is used for Tug of War
|
||||
Maps.
|
||||
|
||||
object used to simplify placing objectives. You may optionally connect this object to the
|
||||
target you want to use for the compass position....
|
||||
|
||||
Checkboxes:
|
||||
StartOn - check this if you want this objective to be displayed when the level first loads
|
||||
|
||||
Respawner - check this if the objective is the respawn point for a team. If you set this
|
||||
you must set ControlledBy to a valid team and not Neutral.
|
||||
|
||||
|
||||
Parameters:
|
||||
ControlledBy 0 = Axis, 1 = Allies, 2 = Neutral
|
||||
AxisObjNum 1 - 5. Set the objective number for the axis. This will associate the objective with
|
||||
the check box for the corresponding text in the score screen.
|
||||
AlliesObjNum 1 - 5. Set the objective number for the allies. This will associate the objective with
|
||||
the check box for the corresponding text in the score screen.
|
||||
|
||||
ObjectiveNbr <nObjNbr=0> Please ignore this for now.
|
||||
|
||||
Events:
|
||||
TurnOn
|
||||
TurnOff
|
||||
Complete
|
||||
Text <sNewText>
|
||||
SetCurrent
|
||||
SetController <ControlledBy> - This will set the starting controller default is neutral. See ControlledBy var above.
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
Event EV_SetController
|
||||
(
|
||||
"ControlledBy",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"ControlledBy",
|
||||
"Sets the team controlling the objective",
|
||||
EV_NORMAL
|
||||
);
|
||||
Event EV_SetAxisObjNum("AxisObjNum", EV_DEFAULT, "i", "AxisObjNum", "Sets the objective number for the axis team");
|
||||
Event EV_SetAlliesObjNum(
|
||||
"AlliesObjNum", EV_DEFAULT, "i", "AlliesObjNum", "Sets the objective number for the allies team"
|
||||
Event EV_TakeOver
|
||||
(
|
||||
"TakeOver",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"TeamNum",
|
||||
"Sets the team controlling the objective. 0 = Axis, 1 = Allies",
|
||||
EV_NORMAL
|
||||
);
|
||||
static Event EV_Initialize("initialize", EV_DEFAULT, 0, 0, "Initialize object");
|
||||
static Event EV_SetCurrent(
|
||||
"SetCurrent", EV_DEFAULT, "i", "TeamNum", "Set this objective as the current objective for the specified team."
|
||||
Event EV_SetAxisObjNum
|
||||
(
|
||||
"AxisObjNum",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"AxisObjNum",
|
||||
"Sets the objective number for the axis team",
|
||||
EV_NORMAL
|
||||
);
|
||||
Event EV_SetAlliesObjNum
|
||||
(
|
||||
"AlliesObjNum",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"AlliesObjNum",
|
||||
"Sets the objective number for the allies team",
|
||||
EV_NORMAL
|
||||
);
|
||||
static Event EV_Initialize
|
||||
(
|
||||
"initialize",
|
||||
EV_DEFAULT,
|
||||
0,
|
||||
0,
|
||||
"Initialize object",
|
||||
EV_NORMAL
|
||||
);
|
||||
static Event EV_SetCurrent
|
||||
(
|
||||
"SetCurrent",
|
||||
EV_DEFAULT,
|
||||
"i",
|
||||
"TeamNum",
|
||||
"Set this objective as the current objective for the specified team.",
|
||||
EV_NORMAL
|
||||
);
|
||||
Event EV_GetController
|
||||
(
|
||||
"ControlledBy",
|
||||
EV_DEFAULT,
|
||||
0,
|
||||
0,
|
||||
"Objective controller",
|
||||
EV_GETTER
|
||||
);
|
||||
Event EV_GetController("ControlledBy", EV_DEFAULT, 0, 0, "Objective controller", EV_GETTER);
|
||||
|
||||
CLASS_DECLARATION(Objective, TOWObjective, "func_towobjective") {
|
||||
{&EV_SetController, &TOWObjective::SetController },
|
||||
@@ -195,6 +281,7 @@ void TOWObjective::TakeOver(Event *ev)
|
||||
}
|
||||
|
||||
g_TOWObjectiveMan.TakeOverObjective(m_eController, controller);
|
||||
m_eController = controller;
|
||||
|
||||
if (m_bNoRespawnForLeading) {
|
||||
//
|
||||
@@ -216,8 +303,8 @@ void TOWObjective::SetAxisObjNum(Event *ev)
|
||||
|
||||
void TOWObjective::OnInitialize(Event *ev)
|
||||
{
|
||||
m_sAlliesObjName = "tow_allied_obj" + str(m_iAlliesObjNum);
|
||||
m_sAxisObjName = "tow_allied_obj" + str(m_iAxisObjNum);
|
||||
m_sAlliesObjName = "tow_allied_obj" + str(m_iAlliesObjNum);
|
||||
m_sAxisObjName = "tow_axis_obj" + str(m_iAxisObjNum);
|
||||
|
||||
switch (m_eController) {
|
||||
case CONTROLLER_ALLIES:
|
||||
|
||||
@@ -24,72 +24,77 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "VehicleCollisionEntity.h"
|
||||
#include "g_phys.h"
|
||||
|
||||
CLASS_DECLARATION( Entity, VehicleCollisionEntity, NULL )
|
||||
{
|
||||
{ &EV_Damage, &VehicleCollisionEntity::EventDamage },
|
||||
{ NULL, NULL }
|
||||
Event EV_Owner
|
||||
(
|
||||
"owner",
|
||||
EV_DEFAULT,
|
||||
NULL,
|
||||
NULL,
|
||||
"owner",
|
||||
EV_GETTER
|
||||
);
|
||||
|
||||
CLASS_DECLARATION(Entity, VehicleCollisionEntity, NULL) {
|
||||
{&EV_Damage, &VehicleCollisionEntity::EventDamage},
|
||||
{&EV_Owner, &VehicleCollisionEntity::GetOwner },
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
||||
VehicleCollisionEntity::VehicleCollisionEntity
|
||||
(
|
||||
Entity *ent
|
||||
)
|
||||
VehicleCollisionEntity::VehicleCollisionEntity(Entity *ent)
|
||||
{
|
||||
if( LoadingSavegame )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (LoadingSavegame) {
|
||||
return;
|
||||
}
|
||||
|
||||
edict->s.eType = ET_GENERAL;
|
||||
edict->s.eType = ET_GENERAL;
|
||||
|
||||
m_pOwner = ent;
|
||||
takedamage = DAMAGE_YES;
|
||||
m_pOwner = ent;
|
||||
takedamage = DAMAGE_YES;
|
||||
|
||||
edict->s.renderfx &= ~RF_DONTDRAW;
|
||||
edict->r.svFlags &= ~SVF_NOCLIENT;
|
||||
showModel();
|
||||
setMoveType(MOVETYPE_PUSH);
|
||||
setSolidType(SOLID_NOT);
|
||||
|
||||
setMoveType( MOVETYPE_PUSH );
|
||||
|
||||
edict->clipmask |= MASK_CLIP;
|
||||
edict->s.eFlags |= EF_LINKANGLES;
|
||||
edict->clipmask |= MASK_VEHICLE;
|
||||
edict->s.eFlags |= EF_LINKANGLES;
|
||||
}
|
||||
|
||||
VehicleCollisionEntity::VehicleCollisionEntity
|
||||
(
|
||||
void
|
||||
)
|
||||
VehicleCollisionEntity::VehicleCollisionEntity(void)
|
||||
{
|
||||
if( LoadingSavegame )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (LoadingSavegame) {
|
||||
return;
|
||||
}
|
||||
|
||||
gi.Error( ERR_DROP, "VehicleCollisionEntity Created with no parameters!\n" );
|
||||
gi.Error(ERR_DROP, "VehicleCollisionEntity Created with no parameters!\n");
|
||||
}
|
||||
|
||||
void VehicleCollisionEntity::EventDamage
|
||||
(
|
||||
Event *ev
|
||||
)
|
||||
void VehicleCollisionEntity::GetOwner(Event *ev)
|
||||
{
|
||||
Event *event = new Event( ev );
|
||||
|
||||
m_pOwner->ProcessEvent( event );
|
||||
ev->AddListener(m_pOwner);
|
||||
}
|
||||
|
||||
void VehicleCollisionEntity::Solid
|
||||
(
|
||||
void
|
||||
)
|
||||
void VehicleCollisionEntity::Solid(void)
|
||||
{
|
||||
setContents( CONTENTS_SOLID );
|
||||
setSolidType( SOLID_BSP );
|
||||
setContents(CONTENTS_SOLID);
|
||||
setSolidType(SOLID_BSP);
|
||||
}
|
||||
|
||||
void VehicleCollisionEntity::NotSolid
|
||||
(
|
||||
void
|
||||
)
|
||||
void VehicleCollisionEntity::NotSolid(void)
|
||||
{
|
||||
setSolidType( SOLID_NOT );
|
||||
setSolidType(SOLID_NOT);
|
||||
}
|
||||
|
||||
void VehicleCollisionEntity::EventDamage(Event *ev)
|
||||
{
|
||||
m_pOwner->ProcessEvent(*ev);
|
||||
}
|
||||
|
||||
void VehicleCollisionEntity::Used(Event *ev)
|
||||
{
|
||||
m_pOwner->ProcessEvent(*ev);
|
||||
}
|
||||
|
||||
Entity *VehicleCollisionEntity::GetOwner() const
|
||||
{
|
||||
return m_pOwner;
|
||||
}
|
||||
Loaded 100 of 646 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user