mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-06 04:05:11 +08:00
Compare commits
998 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da65cc99d9 | ||
|
|
7dde4c03a7 | ||
|
|
326a7d79f0 | ||
|
|
dd3fcb6461 | ||
|
|
fa90dbbd5e | ||
|
|
dd1daa5bff | ||
|
|
154dd5c9ae | ||
|
|
2ee7367567 | ||
|
|
3da10f28c4 | ||
|
|
612e7560ae | ||
|
|
fe362a1ab5 | ||
|
|
8399107826 | ||
|
|
077bc7323c | ||
|
|
6f2b559c5a | ||
|
|
fec0a6baf6 | ||
|
|
ac75bdf2d4 | ||
|
|
56859e03c3 | ||
|
|
959e10f720 | ||
|
|
0991255534 | ||
|
|
199d3fd422 | ||
|
|
c07109e69c | ||
|
|
08e7bb1bf4 | ||
|
|
d0010cf9cb | ||
|
|
ecd675926a | ||
|
|
0c3be639c5 | ||
|
|
3a9801853d | ||
|
|
3907be3c8f | ||
|
|
9421457b3a | ||
|
|
ac4a14ef6c | ||
|
|
c613118199 | ||
|
|
755db4d56b | ||
|
|
2e180d5548 | ||
|
|
bf9840c2a8 | ||
|
|
f56887bde9 | ||
|
|
23fe1c0985 | ||
|
|
5266f17d56 | ||
|
|
744f75d4a3 | ||
|
|
09203dc512 | ||
|
|
3c3d5d472e | ||
|
|
4c6e64c89b | ||
|
|
7afee98f99 | ||
|
|
f562926aaa | ||
|
|
b25c83edc4 | ||
|
|
c42b5e043d | ||
|
|
1e5921d33f | ||
|
|
663344eeaa | ||
|
|
e4e34cc835 | ||
|
|
b36fc0e2ae | ||
|
|
924d6ada60 | ||
|
|
8343cadd30 | ||
|
|
0636dc45bd | ||
|
|
611ee64cd9 | ||
|
|
5a17e7f425 | ||
|
|
db39f0cc88 | ||
|
|
3f48bce7da | ||
|
|
936b491248 | ||
|
|
428e8ef427 | ||
|
|
934dffd273 | ||
|
|
0c34a5081c | ||
|
|
f09682131f | ||
|
|
32ddc2a47f | ||
|
|
729f534614 | ||
|
|
6937d0c17e | ||
|
|
4dba8219ca | ||
|
|
f8b0ec8c4b | ||
|
|
ce20da28e1 | ||
|
|
40ed87d8de | ||
|
|
5bae732818 | ||
|
|
08b3de08e7 | ||
|
|
a51c5d93fc | ||
|
|
55dbb2ca3f | ||
|
|
4b930c7854 | ||
|
|
d68823708f | ||
|
|
4b5d09a968 | ||
|
|
7e4a7ac23d | ||
|
|
62cdf2ae5b | ||
|
|
94c42160b7 | ||
|
|
18bbfebc5d | ||
|
|
d18cb1f74c | ||
|
|
2807841511 | ||
|
|
13ed8d4529 | ||
|
|
1ff06c2c1e | ||
|
|
0cb591821a | ||
|
|
8700f44175 | ||
|
|
6ba73a732a | ||
|
|
4b97d8bcda | ||
|
|
0dc6f1674f | ||
|
|
6bc6f0dd70 | ||
|
|
39abd82e5d | ||
|
|
15924aebaa | ||
|
|
b79c95d295 | ||
|
|
453c0d890d | ||
|
|
60f0f68e68 | ||
|
|
79adaa11e0 | ||
|
|
6819050d91 | ||
|
|
d2740f78c1 | ||
|
|
6953e829c4 | ||
|
|
1365020302 | ||
|
|
0e7013eeb0 | ||
|
|
a46e459124 | ||
|
|
dfed24c290 | ||
|
|
1f308a43c8 | ||
|
|
2062e55c6a | ||
|
|
90038d2924 | ||
|
|
9aff6ca633 | ||
|
|
6aa61657e0 | ||
|
|
2958b14cc2 | ||
|
|
aa6674b032 | ||
|
|
7a7bca2991 | ||
|
|
7e9f90a09d | ||
|
|
5e8373fa46 | ||
|
|
9d826016b0 | ||
|
|
7f1dd248c2 | ||
|
|
4d5e7c0557 | ||
|
|
9e99a2bc37 | ||
|
|
8dafbaeda2 | ||
|
|
ae35f15f15 | ||
|
|
0dd91ceda2 | ||
|
|
d6f8112860 | ||
|
|
a1db6c6a9b | ||
|
|
271d15f989 | ||
|
|
00e5d42459 | ||
|
|
291fdfac68 | ||
|
|
5e31e3fad0 | ||
|
|
7f6395fa7d | ||
|
|
aee9f454fc | ||
|
|
e3c3b05396 | ||
|
|
6e637456ef | ||
|
|
5e5ffec67d | ||
|
|
06cadacb59 | ||
|
|
cb8e0a50bc | ||
|
|
b3a5283517 | ||
|
|
5348046109 | ||
|
|
57d48b64eb | ||
|
|
5145b1956c | ||
|
|
bb48e5209e | ||
|
|
37cba10c14 | ||
|
|
1decb1c7fb | ||
|
|
ba1347a8ce | ||
|
|
feb01b270e | ||
|
|
114a256675 | ||
|
|
2897e5f17e | ||
|
|
6723758edc | ||
|
|
23956a0b82 | ||
|
|
93a43ae9a5 | ||
|
|
8905e7cbb7 | ||
|
|
bf8b87c29d | ||
|
|
803c396fa2 | ||
|
|
0933261898 | ||
|
|
e93d362391 | ||
|
|
2b13de80bf | ||
|
|
2c67f4cb39 | ||
|
|
4705683ebc | ||
|
|
78baf568ae | ||
|
|
1218f4aeb6 | ||
|
|
531c6cc375 | ||
|
|
edf3fcd398 | ||
|
|
c67f065d90 | ||
|
|
148846c02d | ||
|
|
8afb2dbdec | ||
|
|
14be566401 | ||
|
|
0577ecbccf | ||
|
|
880dd2546f | ||
|
|
c2063c869d | ||
|
|
49a133514a | ||
|
|
94dc801150 | ||
|
|
fe118e9683 | ||
|
|
e0d993a5a8 | ||
|
|
cf35943f51 | ||
|
|
cd715178d2 | ||
|
|
869b684536 | ||
|
|
bc56ce754b | ||
|
|
32897450fc | ||
|
|
e0e9942bd5 | ||
|
|
fdbd1c5658 | ||
|
|
eaf983c054 | ||
|
|
e11eeb24fc | ||
|
|
6dcd8c3af8 | ||
|
|
d68eab6b65 | ||
|
|
8ec6eaa49a | ||
|
|
a38f561d7c | ||
|
|
cb404b2730 | ||
|
|
83d3c02e53 | ||
|
|
8be58bcd21 | ||
|
|
06e38b45c8 | ||
|
|
d3dd671759 | ||
|
|
e0b8c338a8 | ||
|
|
ee363ebb74 | ||
|
|
e4bb3ecd12 | ||
|
|
d05bfb55c5 | ||
|
|
9c26983136 | ||
|
|
fa622168a0 | ||
|
|
eff814b148 | ||
|
|
11c373a183 | ||
|
|
898b697b70 | ||
|
|
6d8026cd81 | ||
|
|
1e7abdc144 | ||
|
|
ff1b28244b | ||
|
|
7782fa09ac | ||
|
|
ae624801ac | ||
|
|
8889bda261 | ||
|
|
a5fa4df37c | ||
|
|
2183240221 | ||
|
|
33800954ec | ||
|
|
67cb5a4dde | ||
|
|
9fd7e333df | ||
|
|
a9628cc0f0 | ||
|
|
f33de46508 | ||
|
|
595d452c23 | ||
|
|
911e670be6 | ||
|
|
9ea973dad6 | ||
|
|
fcdd45341c | ||
|
|
53d2d10932 | ||
|
|
88772a1c34 | ||
|
|
1c21590e96 | ||
|
|
d2a8cfe614 | ||
|
|
39ff3b199a | ||
|
|
ddf070b63d | ||
|
|
4c559a4a08 | ||
|
|
fa16c49246 | ||
|
|
d382f6886d | ||
|
|
02e111c5e1 | ||
|
|
73516eea4c | ||
|
|
6e2dbd4e1c | ||
|
|
67cdbef833 | ||
|
|
d6bb72f772 | ||
|
|
e6dd4882cc | ||
|
|
cb62e65f9f | ||
|
|
cb5e282af4 | ||
|
|
b175d8a0cb | ||
|
|
fbb88a55cb | ||
|
|
f3a40ac794 | ||
|
|
dc207a449c | ||
|
|
5a8de90918 | ||
|
|
2d6b770e7c | ||
|
|
409eee3bb4 | ||
|
|
ac5bb86301 | ||
|
|
530d376c44 | ||
|
|
b777ba9549 | ||
|
|
bc39b707d4 | ||
|
|
cb0791c915 | ||
|
|
03c73f56d2 | ||
|
|
94d0c78913 | ||
|
|
34463dcddc | ||
|
|
da11da97ad | ||
|
|
c0043a5467 | ||
|
|
7770b1a82b | ||
|
|
faf592adb4 | ||
|
|
0aa57854ca | ||
|
|
fd8c1becec | ||
|
|
0afc3d83c6 | ||
|
|
d633fe5deb | ||
|
|
5040cb83d0 | ||
|
|
2b385ff1f4 | ||
|
|
cd5028eed1 | ||
|
|
3ce014d5f5 | ||
|
|
75aaf1c66d | ||
|
|
26401a4fbf | ||
|
|
dba757f0c2 | ||
|
|
7f3ee9ca71 | ||
|
|
9a1414505a | ||
|
|
13c1e807ad | ||
|
|
6e95e19589 | ||
|
|
8f47596ad0 | ||
|
|
4f4c63b1dd | ||
|
|
66323fe9ca | ||
|
|
16e60bbb5f | ||
|
|
0389d2495f | ||
|
|
4049c54511 | ||
|
|
e8006c3253 | ||
|
|
07aa9595c0 | ||
|
|
b91e97ca53 | ||
|
|
cd0f7af38a | ||
|
|
ac1bf4a9f8 | ||
|
|
af0046f401 | ||
|
|
43575b485d | ||
|
|
67c6cfce71 | ||
|
|
5986874be2 | ||
|
|
cf17b4f63c | ||
|
|
d1ac48b2a1 | ||
|
|
3032ce3bee | ||
|
|
ba69f9e62a | ||
|
|
8323df240b | ||
|
|
a1ae770f70 | ||
|
|
56938344b8 | ||
|
|
a862e641f1 | ||
|
|
00b9ac676e | ||
|
|
8bb6aa2c51 | ||
|
|
505392c2f8 | ||
|
|
37f9c25212 | ||
|
|
ee2c1ad8fa | ||
|
|
7771356e66 | ||
|
|
cb417a3d51 | ||
|
|
01dcb52b4c | ||
|
|
24adb6e3e0 | ||
|
|
d992f8525b | ||
|
|
7be094b563 | ||
|
|
386a68e334 | ||
|
|
ca57c8424d | ||
|
|
214f53b8a7 | ||
|
|
143310bdb7 | ||
|
|
dc8b8ccab3 | ||
|
|
e3c095a3fa | ||
|
|
61f49938e5 | ||
|
|
d697421d81 | ||
|
|
f71619d541 | ||
|
|
0eb1d4c7c0 | ||
|
|
5cfe9ef181 | ||
|
|
d790292829 | ||
|
|
fce0ef6ad2 | ||
|
|
f9269dcc1c | ||
|
|
4b163e6d30 | ||
|
|
147c702f2f | ||
|
|
b1f23f9ff6 | ||
|
|
53eb569216 | ||
|
|
7c8105247c | ||
|
|
35ae421ac1 | ||
|
|
e3e161f281 | ||
|
|
8f9800eb3c | ||
|
|
a5593963c5 | ||
|
|
e308281b0b | ||
|
|
0ce8d92f27 | ||
|
|
938a9f372f | ||
|
|
a0514c242b | ||
|
|
b96eb14cf7 | ||
|
|
1636d36dc2 | ||
|
|
9bb2870e38 | ||
|
|
d9545e5e78 | ||
|
|
827105405f | ||
|
|
2f8fec6b70 | ||
|
|
20ecfcd8e0 | ||
|
|
b539ed5a3d | ||
|
|
4eab7d6503 | ||
|
|
8a4239d48d | ||
|
|
cedc1e0eb2 | ||
|
|
4beba75159 | ||
|
|
a0cbac4fc7 | ||
|
|
9662ab106f | ||
|
|
4e4a9827b1 | ||
|
|
04ee7c3a55 | ||
|
|
a85a856215 | ||
|
|
9e30fc253f | ||
|
|
b2895770b8 | ||
|
|
37255354d4 | ||
|
|
661b53d0b3 | ||
|
|
56e256fc86 | ||
|
|
1f7dfecf89 | ||
|
|
6f121b90c1 | ||
|
|
2d48e73f9d | ||
|
|
58a747e8ac | ||
|
|
3bf5f19446 | ||
|
|
da4062ede9 | ||
|
|
e700a7498e | ||
|
|
6f27d05361 | ||
|
|
baefab7e3d | ||
|
|
7dda1c28f4 | ||
|
|
364c96f45c | ||
|
|
7aa163f713 | ||
|
|
62fb743a20 | ||
|
|
40211efa9a | ||
|
|
be98a228a7 | ||
|
|
1f7171462b | ||
|
|
511d728337 | ||
|
|
61b39f4257 | ||
|
|
3e4bd20919 | ||
|
|
7d10660b87 | ||
|
|
6aa4765c3e | ||
|
|
fa68108907 | ||
|
|
771c09226e | ||
|
|
8d0ea1d03e | ||
|
|
83953c7fb3 | ||
|
|
8b94443ba2 | ||
|
|
5e8d3acc51 | ||
|
|
d347096396 | ||
|
|
54920f13df | ||
|
|
d01a33814c | ||
|
|
efd2e434b4 | ||
|
|
2202e13a61 | ||
|
|
7702a7a8d0 | ||
|
|
8320f0598f | ||
|
|
165c1622f8 | ||
|
|
b8c0d7f59e | ||
|
|
6197ba8af6 | ||
|
|
89a3fd6323 | ||
|
|
ec18dd9535 | ||
|
|
bb4c73b25c | ||
|
|
90e0c070ac | ||
|
|
83b7f795c1 | ||
|
|
0366035237 | ||
|
|
a8f7b4fc5c | ||
|
|
f2d588574c | ||
|
|
0579ecd30f | ||
|
|
b5d9bf5dc8 | ||
|
|
413882a8d5 | ||
|
|
c92f8f71a7 | ||
|
|
a378379ac5 | ||
|
|
bcb4c9a722 | ||
|
|
eb22ff53c4 | ||
|
|
b1406e8ecd | ||
|
|
4eee187f1b | ||
|
|
76a8fe4873 | ||
|
|
f010e2be12 | ||
|
|
7484c51490 | ||
|
|
96c4044a6c | ||
|
|
3d9a97348e | ||
|
|
81b6c1c333 | ||
|
|
a62cb2a93f | ||
|
|
e9f26fe29d | ||
|
|
3ae7ecaeb3 | ||
|
|
75e690791d | ||
|
|
f2c927906f | ||
|
|
61751cc306 | ||
|
|
ba11b849ed | ||
|
|
014a09e222 | ||
|
|
b535c24edb | ||
|
|
8d2bea03e0 | ||
|
|
497ae6d269 | ||
|
|
e7eeba1de0 | ||
|
|
d14ce5ac39 | ||
|
|
76dae35955 | ||
|
|
70d45f23de | ||
|
|
9735dedf2f | ||
|
|
a8cc5b7cef | ||
|
|
003bbea358 | ||
|
|
5be28ce93d | ||
|
|
647b2658d1 | ||
|
|
85240f0145 | ||
|
|
9119635ed3 | ||
|
|
ab16867f6b | ||
|
|
73cf465ce4 | ||
|
|
37181e410f | ||
|
|
1ffc593993 | ||
|
|
8ef383a4d3 | ||
|
|
3023c8a72b | ||
|
|
9b68b0c1e2 | ||
|
|
01a33dcf7e | ||
|
|
4000654deb | ||
|
|
90ff7f24b3 | ||
|
|
b42f020ad5 | ||
|
|
6422005716 | ||
|
|
efc9048b43 | ||
|
|
12bc507156 | ||
|
|
f9a7ffa5e8 | ||
|
|
b9a2f58e23 | ||
|
|
b146f495fc | ||
|
|
4a1f441151 | ||
|
|
94ec8cb997 | ||
|
|
621e33fde2 | ||
|
|
db72378806 | ||
|
|
d596f4ea52 | ||
|
|
6f2016db06 | ||
|
|
27e742df12 | ||
|
|
86d823b877 | ||
|
|
82697ca2a9 | ||
|
|
4606a18b25 | ||
|
|
9145589414 | ||
|
|
1d78d7c720 | ||
|
|
1cc2ec9095 | ||
|
|
5cf4e34607 | ||
|
|
b32de42ab7 | ||
|
|
b04a48f126 | ||
|
|
3c0a34926a | ||
|
|
039b42868d | ||
|
|
671c247381 | ||
|
|
9048c108c4 | ||
|
|
b797e0af1a | ||
|
|
85b5b4e965 | ||
|
|
74062fab12 | ||
|
|
67ce4cfbef | ||
|
|
fe464af3ff | ||
|
|
45b091028b | ||
|
|
00619d5795 | ||
|
|
2e953bd1a9 | ||
|
|
57f9e7dda6 | ||
|
|
d14ce61520 | ||
|
|
5af6506d86 | ||
|
|
e9e4a1296d | ||
|
|
85c2126775 | ||
|
|
a1391f3d0b | ||
|
|
bb8ba4225c | ||
|
|
7d3e8c0a57 | ||
|
|
55c3040db1 | ||
|
|
90e4fbed31 | ||
|
|
4819790272 | ||
|
|
f904ba53e2 | ||
|
|
e06b7412ac | ||
|
|
dec1b8dfb4 | ||
|
|
c9b5332d16 | ||
|
|
fe14a360b4 | ||
|
|
ab7a67464b | ||
|
|
29a48cb34c | ||
|
|
3fef353291 | ||
|
|
1a700fd06b | ||
|
|
e3e2f3afe5 | ||
|
|
87f380b90c | ||
|
|
3ebb4d0ea3 | ||
|
|
d4b4a4a864 | ||
|
|
bd6532fae4 | ||
|
|
25235b5296 | ||
|
|
2c17af4850 | ||
|
|
7d8b63fd88 | ||
|
|
5be982cc72 | ||
|
|
2d968cf328 | ||
|
|
4d9563ea03 | ||
|
|
d62a12dd9a | ||
|
|
99478ba9bd | ||
|
|
211d3c5213 | ||
|
|
20c7c36996 | ||
|
|
228dab5965 | ||
|
|
4b955a320b | ||
|
|
d5911b33b1 | ||
|
|
f1638b09c5 | ||
|
|
741fcfb202 | ||
|
|
54d54b1457 | ||
|
|
d5b6ccb3e2 | ||
|
|
6448964c37 | ||
|
|
46378e3738 | ||
|
|
b2038e76d3 | ||
|
|
eb650b71ad | ||
|
|
968994bba5 | ||
|
|
3c1c13850e | ||
|
|
459f4a9788 | ||
|
|
d17fdea884 | ||
|
|
b20efff57c | ||
|
|
36159e6622 | ||
|
|
c953ba0852 | ||
|
|
b38ef43260 | ||
|
|
fea2395a80 | ||
|
|
ffaab11da9 | ||
|
|
f6b3603934 | ||
|
|
9421963b29 | ||
|
|
239c13da28 | ||
|
|
eb6f67ed07 | ||
|
|
c206e72f7b | ||
|
|
79e6ebbe23 | ||
|
|
d4638a9cf4 | ||
|
|
7ccc9b0795 | ||
|
|
6c1d911193 | ||
|
|
9587aacee3 | ||
|
|
777562aea8 | ||
|
|
a40d64d3a6 | ||
|
|
7704d9b2ef | ||
|
|
d87dd2a60a | ||
|
|
6403a265de | ||
|
|
3fa4a36983 | ||
|
|
8b16c30fb8 | ||
|
|
20a177c783 | ||
|
|
0840d9ec25 | ||
|
|
4124e01d65 | ||
|
|
129325f3a4 | ||
|
|
9cd22a98bd | ||
|
|
6a6d21ed32 | ||
|
|
041315da44 | ||
|
|
aa30661c26 | ||
|
|
031bac8d13 | ||
|
|
0cf1e3b1da | ||
|
|
441795943b | ||
|
|
a9cf3357c7 | ||
|
|
84761e62ff | ||
|
|
60a1c4f0cc | ||
|
|
77b23eec9f | ||
|
|
f4bcea6182 | ||
|
|
ea6a86a83d | ||
|
|
47879942bb | ||
|
|
6c006e087d | ||
|
|
8385563bef | ||
|
|
f9f96552b7 | ||
|
|
ca3913cd88 | ||
|
|
8b07916598 | ||
|
|
5f122a7435 | ||
|
|
50c656df94 | ||
|
|
5436658ce7 | ||
|
|
d7ea40d850 | ||
|
|
184ca6517c | ||
|
|
f4c36f49db | ||
|
|
ae26783902 | ||
|
|
45fdd74dd2 | ||
|
|
880a9651d8 | ||
|
|
db30358d06 | ||
|
|
ebbe22b09a | ||
|
|
752dd13c04 | ||
|
|
469a080000 | ||
|
|
efc12f1045 | ||
|
|
becb58223a | ||
|
|
f48335f2f2 | ||
|
|
8b5926f9b1 | ||
|
|
0b13bf393f | ||
|
|
58b5e1a9df | ||
|
|
17f719558c | ||
|
|
70abee3e28 | ||
|
|
37defbbd14 | ||
|
|
62f04137a5 | ||
|
|
5f849c4823 | ||
|
|
b09242e41c | ||
|
|
1538bc609d | ||
|
|
26616314f8 | ||
|
|
1483b21f00 | ||
|
|
743c5ca8d5 | ||
|
|
92b89936b3 | ||
|
|
8abbef8dbd | ||
|
|
59f3b63e0a | ||
|
|
6a6f341c07 | ||
|
|
402a596415 | ||
|
|
52eb84d34b | ||
|
|
f3a2f46fb3 | ||
|
|
4880ca3ca2 | ||
|
|
121c72c9e0 | ||
|
|
e20e114643 | ||
|
|
7e08104631 | ||
|
|
7aa7f4dbbd | ||
|
|
fb6fd61cd9 | ||
|
|
34da3e0ccd | ||
|
|
0a22040c6e | ||
|
|
c55b7dcda7 | ||
|
|
78f8932313 | ||
|
|
f00181223f | ||
|
|
bf2f829382 | ||
|
|
297ca08e81 | ||
|
|
8339096ad8 | ||
|
|
3d39d78e53 | ||
|
|
00ce909fc8 | ||
|
|
aabf5f5621 | ||
|
|
9c6352ec57 | ||
|
|
7382fc7c49 | ||
|
|
5fa9632ec0 | ||
|
|
db78726656 | ||
|
|
57320c0c25 | ||
|
|
31ab710485 | ||
|
|
4247af8fa8 | ||
|
|
e5000742f1 | ||
|
|
971f9b6de5 | ||
|
|
199ebfed48 | ||
|
|
97aba69ed0 | ||
|
|
234507b7f1 | ||
|
|
d0d5fd1a3f | ||
|
|
e7234bada2 | ||
|
|
94cbb4e1e0 | ||
|
|
437ba6d7a2 | ||
|
|
574f03c139 | ||
|
|
c3abec5127 | ||
|
|
a69bda0b9b | ||
|
|
576b78799e | ||
|
|
faee030740 | ||
|
|
8b5c5826a8 | ||
|
|
e193ac2c04 | ||
|
|
ee4744e7cd | ||
|
|
142a38f3dc | ||
|
|
e50b91b559 | ||
|
|
2bf2b95b3a | ||
|
|
94cfe1217a | ||
|
|
dbb4b2c1f9 | ||
|
|
6ede01ea05 | ||
|
|
2ecfa20f94 | ||
|
|
48808e4ede | ||
|
|
955dde6d5f | ||
|
|
7299ee9f11 | ||
|
|
5e17b4bf17 | ||
|
|
2c17dce25b | ||
|
|
1b372115a5 | ||
|
|
99bd7c81da | ||
|
|
2b1ed2b20a | ||
|
|
f7c60ea9d1 | ||
|
|
119b458b0f | ||
|
|
d913ef0fc4 | ||
|
|
bccc0e63d5 | ||
|
|
23d0f33ad1 | ||
|
|
ddd17fe238 | ||
|
|
b1e3fa5f4d | ||
|
|
e99ca5947b | ||
|
|
932cf03a29 | ||
|
|
c09190f66e | ||
|
|
1d9b5d4611 | ||
|
|
e05c1ed912 | ||
|
|
7b36796f41 | ||
|
|
69bb25bb18 | ||
|
|
398d6007be | ||
|
|
4d63eb4413 | ||
|
|
8770bdc694 | ||
|
|
74f935d94f | ||
|
|
cd30812607 | ||
|
|
8b30a7631d | ||
|
|
a169f93b9f | ||
|
|
f786ea65f5 | ||
|
|
b578d44ea2 | ||
|
|
40574d9be0 | ||
|
|
7bb8124b69 | ||
|
|
2b1d4f4377 | ||
|
|
31a53f4842 | ||
|
|
f3468c0321 | ||
|
|
23af5dcaf1 | ||
|
|
097974bde2 | ||
|
|
a97d8c119b | ||
|
|
480ef0a468 | ||
|
|
f044a59984 | ||
|
|
f3ae5159cb | ||
|
|
52fca4ac0c | ||
|
|
98bf05b948 | ||
|
|
bbd4c1315e | ||
|
|
35869586c9 | ||
|
|
ed049ea539 | ||
|
|
6ba406be7d | ||
|
|
860d3be42d | ||
|
|
0801922466 | ||
|
|
103a2fccaa | ||
|
|
cb7820b45b | ||
|
|
1a6fd72d19 | ||
|
|
5e65df3c2a | ||
|
|
b534422aed | ||
|
|
1866c00789 | ||
|
|
1162e5a65b | ||
|
|
5da11291a2 | ||
|
|
042d2e436c | ||
|
|
2da65ab122 | ||
|
|
8c668b29c6 | ||
|
|
75643895ef | ||
|
|
6a02a571c1 | ||
|
|
1e5f12a0ae | ||
|
|
a297a0b5ad | ||
|
|
9da413b2cc | ||
|
|
0ca0dc9731 | ||
|
|
7205f2d4fa | ||
|
|
196c311113 | ||
|
|
0409107ee2 | ||
|
|
c8035c1adf | ||
|
|
5fda638edf | ||
|
|
ed05519c60 | ||
|
|
ac77bab967 | ||
|
|
9935e2c8d3 | ||
|
|
80fc7209ed | ||
|
|
908082097f | ||
|
|
245533defa | ||
|
|
b8c4c31e02 | ||
|
|
626df3673c | ||
|
|
3a288ffe4a | ||
|
|
422e511aac | ||
|
|
621cdba53c | ||
|
|
e7ddc6d6c5 | ||
|
|
b1a06baf83 | ||
|
|
c3c0954613 | ||
|
|
463a339a09 | ||
|
|
71cae6b02b | ||
|
|
ccac3e9cfc | ||
|
|
aac44ef866 | ||
|
|
5d6d6c766e | ||
|
|
28e6dec4b0 | ||
|
|
e2606cf97f | ||
|
|
cfea381c84 | ||
|
|
bd7e2fe88d | ||
|
|
30c32b0088 | ||
|
|
95ce9fc00f | ||
|
|
a580e98f28 | ||
|
|
2072f5c276 | ||
|
|
28c47a5c86 | ||
|
|
08dd632d87 | ||
|
|
bbde1394e1 | ||
|
|
ede52d7808 | ||
|
|
9ce9fa8cb5 | ||
|
|
6debd84a2e | ||
|
|
62995b0769 | ||
|
|
ec50c4571c | ||
|
|
09938b978b | ||
|
|
6eb327eac2 | ||
|
|
cbb8db0089 | ||
|
|
154ef82719 | ||
|
|
ec80b0884f | ||
|
|
6a78b4ed1f | ||
|
|
239c6759cb | ||
|
|
017714f3a0 | ||
|
|
16aa5a78fe | ||
|
|
baa94e2064 | ||
|
|
f9b13472b5 | ||
|
|
2922267ae1 | ||
|
|
3c4e75f1b2 | ||
|
|
130a7b3c42 | ||
|
|
17b0c23f2e | ||
|
|
4b58b0b168 | ||
|
|
298393b653 | ||
|
|
aed53c4fda | ||
|
|
7ad7af76dd | ||
|
|
0964fb11e4 | ||
|
|
f173ce11f7 | ||
|
|
3046c9e68e | ||
|
|
137836348b | ||
|
|
05eab0b5b0 | ||
|
|
a1edbaced4 | ||
|
|
3fe737058f | ||
|
|
9c3e8f7e48 | ||
|
|
dcf64c6b33 | ||
|
|
b9945d62a3 | ||
|
|
776d1cb52c | ||
|
|
81e142936d | ||
|
|
a6fba0cb96 | ||
|
|
1b9bfd8906 | ||
|
|
e9d988f5d6 | ||
|
|
7852192fc4 | ||
|
|
4db01487ba | ||
|
|
7b806add63 | ||
|
|
d3c310628f | ||
|
|
62af116654 | ||
|
|
2b085cb69e | ||
|
|
27ee4337fe | ||
|
|
f0297fc448 | ||
|
|
d74743ac1d | ||
|
|
28471aee97 | ||
|
|
deb537c1bb | ||
|
|
9d93eca572 | ||
|
|
66d1a632a7 | ||
|
|
847be54457 | ||
|
|
9d156b4285 | ||
|
|
edde871eb5 | ||
|
|
7c772d6bfd | ||
|
|
f0d0861160 | ||
|
|
1ef0b44a41 | ||
|
|
25d8a94c1c | ||
|
|
b60b3f7d18 | ||
|
|
b1db062fbc | ||
|
|
d4e5e609af | ||
|
|
f36d1f5621 | ||
|
|
f350683e83 | ||
|
|
3c5f7de747 | ||
|
|
d81288d281 | ||
|
|
d18708acf5 | ||
|
|
18353d9ae6 | ||
|
|
ef39f9c9cf | ||
|
|
a03aa3ddb3 | ||
|
|
c09aff8bd7 | ||
|
|
70518a873c | ||
|
|
95e64f3997 | ||
|
|
2fab2d9f7e | ||
|
|
de838ec5e8 | ||
|
|
90d2434bb0 | ||
|
|
96e0167e47 | ||
|
|
68ed732928 | ||
|
|
c603abfebf | ||
|
|
85960b2c90 | ||
|
|
ca501c0378 | ||
|
|
e9e364f054 | ||
|
|
7c9af89620 | ||
|
|
f4567b2c9d | ||
|
|
7390d11505 | ||
|
|
960e46c564 | ||
|
|
265f79fc72 | ||
|
|
a5258bea65 | ||
|
|
25f07ddb97 | ||
|
|
6ba7781a61 | ||
|
|
23a7dce3be | ||
|
|
880d3de53a | ||
|
|
5af7a19b40 | ||
|
|
da094fa04e | ||
|
|
bff9ca8438 | ||
|
|
e50d22bce7 | ||
|
|
216b4f4147 | ||
|
|
4ced29ee8f | ||
|
|
844b3a39a7 | ||
|
|
9e618ce3e1 | ||
|
|
abda3b52ab | ||
|
|
649f32a185 | ||
|
|
8710922a61 | ||
|
|
8ea5536b42 | ||
|
|
48d1aa5115 | ||
|
|
eafe5d6c68 | ||
|
|
f1d9034546 | ||
|
|
b0c077ccf8 | ||
|
|
a0f0eca77c | ||
|
|
e74513556a | ||
|
|
891c984c56 | ||
|
|
491188a0f3 | ||
|
|
9dadc0de93 | ||
|
|
1dedf0e208 | ||
|
|
e123499e23 | ||
|
|
7601a4cd29 | ||
|
|
c8b78b4124 | ||
|
|
fdb2055b62 | ||
|
|
2c0a03704c | ||
|
|
2edbcb996d | ||
|
|
76e01f490c | ||
|
|
f23029efe0 | ||
|
|
e70dea54c0 | ||
|
|
ca28332c6c | ||
|
|
f15e2c2dcf | ||
|
|
572705bc08 | ||
|
|
473810fc0c | ||
|
|
d0ff201da2 | ||
|
|
b5c621ae36 | ||
|
|
7cdead7bac | ||
|
|
f26ac52102 | ||
|
|
5d48708615 | ||
|
|
0561ac2076 | ||
|
|
ae5257c654 | ||
|
|
5a449a56ea | ||
|
|
69549787bc | ||
|
|
0db8d95bc9 | ||
|
|
236c16e35f | ||
|
|
79d8bc2cdd | ||
|
|
fac536f8c4 | ||
|
|
aa5d52cebc | ||
|
|
7e372645da | ||
|
|
0c058f2eca | ||
|
|
d9320f964e | ||
|
|
b29adf752c | ||
|
|
43b746d2f8 | ||
|
|
817206815d | ||
|
|
37aa201ed7 | ||
|
|
d3a0146b5a | ||
|
|
30771fefa6 | ||
|
|
6ae44d7577 | ||
|
|
42b4e456a2 | ||
|
|
290b9cae0b | ||
|
|
ec6bfa2421 | ||
|
|
46a3e729db | ||
|
|
5ca7bb5f12 | ||
|
|
86dfaf9930 | ||
|
|
7d37ff33aa | ||
|
|
415e517107 | ||
|
|
0b0ec876a5 | ||
|
|
34f6f6d539 | ||
|
|
0681209114 | ||
|
|
becd0eba03 | ||
|
|
063eb151c4 | ||
|
|
3f2a8f7704 | ||
|
|
c8b83385df | ||
|
|
ac1c8594b7 | ||
|
|
0c903c1e56 | ||
|
|
dcc19aeafb | ||
|
|
faf15df62f | ||
|
|
a3c90248a7 | ||
|
|
78365d2bc6 | ||
|
|
176b31b4a2 | ||
|
|
efe8ddf151 | ||
|
|
e1f80fba3d | ||
|
|
fd649905ea | ||
|
|
bd4988e588 | ||
|
|
4ef527a92d | ||
|
|
e8d13cd0d5 | ||
|
|
501985be48 | ||
|
|
ebe3a203ba | ||
|
|
63513ec475 | ||
|
|
545b781934 | ||
|
|
0d035746d5 | ||
|
|
ec41db7ef8 | ||
|
|
362217935f | ||
|
|
8704c07e4b | ||
|
|
7d1df4c097 | ||
|
|
2c755778f4 | ||
|
|
9ab3300b76 | ||
|
|
535b00d98f | ||
|
|
de35262a3b | ||
|
|
314a6deba9 | ||
|
|
d3990e03e6 | ||
|
|
cec7bf8488 | ||
|
|
32aa9a9f54 | ||
|
|
b7622e6009 | ||
|
|
fd1f0e685a | ||
|
|
a015d6b915 | ||
|
|
7350be6e7f | ||
|
|
926b909f3d | ||
|
|
c1076f43f7 | ||
|
|
af7123f7dd | ||
|
|
5d13112e25 | ||
|
|
40094f2867 | ||
|
|
6db7c191eb | ||
|
|
a2e2dd5bdf | ||
|
|
7fdabb73a8 | ||
|
|
86337db5b3 | ||
|
|
8e3c748f12 | ||
|
|
b825e584f3 | ||
|
|
13fe097318 | ||
|
|
5af7eb6c18 | ||
|
|
be4b885254 | ||
|
|
b70fab5384 | ||
|
|
92c321848d | ||
|
|
2de6d00a82 | ||
|
|
5744aa8d9e | ||
|
|
fc7ed1ab75 | ||
|
|
7c9b724531 | ||
|
|
64257ef428 | ||
|
|
4a0add4063 | ||
|
|
45c0eaa26c | ||
|
|
15096aa15a | ||
|
|
36f756feeb | ||
|
|
4d4a7d49d5 | ||
|
|
4189af8b50 | ||
|
|
990d526a07 | ||
|
|
5a1b03ac20 | ||
|
|
158db1c454 | ||
|
|
7ace83eeab | ||
|
|
b940a62f02 | ||
|
|
d564a062ce | ||
|
|
7671365c92 | ||
|
|
f7a58ec04d | ||
|
|
8e508cf065 | ||
|
|
e5b0473e4a | ||
|
|
136123eeb3 | ||
|
|
32b07cda86 | ||
|
|
25325e6150 | ||
|
|
a639b72e90 | ||
|
|
08984bd549 | ||
|
|
bf08a8261b |
32
.cirrus.yml
Normal file
32
.cirrus.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
task:
|
||||
name: freebsd-10-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-10-4
|
||||
setup_script:
|
||||
- pkg install -y git sdl2 python
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
# - ./scripts/build_freebsd_engine.sh dedicated
|
||||
- ./scripts/build_freebsd_engine.sh
|
||||
|
||||
task:
|
||||
name: freebsd-11-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-11-3
|
||||
setup_script:
|
||||
- pkg install -y git sdl2 python
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
# - ./scripts/build_freebsd_engine.sh dedicated
|
||||
- ./scripts/build_freebsd_engine.sh
|
||||
|
||||
task:
|
||||
name: freebsd-12-amd64
|
||||
freebsd_instance:
|
||||
image_family: freebsd-12-0
|
||||
setup_script:
|
||||
- pkg install -y git sdl2 python
|
||||
- git submodule update --init --recursive
|
||||
test_script:
|
||||
# - ./scripts/build_freebsd_engine.sh dedicated
|
||||
- ./scripts/build_freebsd_engine.sh
|
||||
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = latin1
|
||||
end_of_line = lf
|
||||
indent_style = tab
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
329
.gitignore
vendored
Normal file
329
.gitignore
vendored
Normal file
@@ -0,0 +1,329 @@
|
||||
# Binaries
|
||||
*.o
|
||||
*.so
|
||||
*.a
|
||||
*.framework
|
||||
|
||||
# Other
|
||||
*.save
|
||||
|
||||
# Qt Creator for some reason creates *.user.$version files, so exclude it too
|
||||
*.user*
|
||||
*~
|
||||
|
||||
### Xcode ###
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.xcuserstate
|
||||
|
||||
|
||||
### OSX ###
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear on external disk
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### CMake ###
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
# makedepend
|
||||
Makefile.dep
|
||||
*.bak
|
||||
ALL_BUILD.*
|
||||
INSTALL.*
|
||||
ZERO_CHECK.*
|
||||
|
||||
# Visual Studio
|
||||
*.obj
|
||||
*.dll
|
||||
*.exp
|
||||
*.lib
|
||||
*.suo
|
||||
*.sdf
|
||||
Debug/
|
||||
Release/
|
||||
ipch/
|
||||
*.opensdf
|
||||
# Use CMake for generating projects
|
||||
*.vcxproj.filters
|
||||
*.vcxproj
|
||||
*.sln
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# DNX
|
||||
project.lock.json
|
||||
artifacts/
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# PVS Studio for Linux output
|
||||
*.cl.cfg
|
||||
|
||||
# Kate
|
||||
*.kate-swp
|
||||
*.swp
|
||||
|
||||
# QtCreator
|
||||
build-*
|
||||
|
||||
# Android
|
||||
*.apk
|
||||
*.config
|
||||
*.creator
|
||||
*.includes
|
||||
*.files
|
||||
|
||||
# Waf
|
||||
build_current
|
||||
.waf-*
|
||||
waf-*/
|
||||
waf3-*/
|
||||
.lock-waf*
|
||||
*.lastbuildstate
|
||||
*.unsuccessfulbuild
|
||||
__pycache__
|
||||
*.pyc
|
||||
|
||||
# MSVC projects
|
||||
*.vcproj
|
||||
*.sln
|
||||
*.vcxproj
|
||||
12
.gitmodules
vendored
Normal file
12
.gitmodules
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
[submodule "mainui"]
|
||||
path = mainui
|
||||
url = https://github.com/FWGS/mainui_cpp
|
||||
[submodule "ref_gl/nanogl"]
|
||||
path = ref_gl/nanogl
|
||||
url = https://github.com/FWGS/nanogl
|
||||
[submodule "ref_gl/gl-wes-v2"]
|
||||
path = ref_gl/gl-wes-v2
|
||||
url = https://github.com/FWGS/gl-wes-v2
|
||||
[submodule "vgui-dev"]
|
||||
path = vgui-dev
|
||||
url = https://github.com/FWGS/vgui-dev
|
||||
213
.travis.yml
Normal file
213
.travis.yml
Normal file
@@ -0,0 +1,213 @@
|
||||
language: c
|
||||
compiler: gcc
|
||||
sudo: false
|
||||
env:
|
||||
global:
|
||||
- SDL_VERSION=2.0.8
|
||||
- DEPLOY_BRANCH=anewengine
|
||||
git:
|
||||
depth: 50
|
||||
submodules: true
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: init
|
||||
name: "Initialize webdav cache"
|
||||
os: linux
|
||||
cache: false
|
||||
script:
|
||||
- sh scripts/yadisk_clear.sh
|
||||
- stage: build
|
||||
name: "Build for Windows MSVC"
|
||||
cache: ccache
|
||||
os: windows
|
||||
before_script:
|
||||
- sh scripts/travis_common_deps.sh
|
||||
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
||||
script:
|
||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
|
||||
after_script:
|
||||
- sh scripts/continious_upload.sh xash3d-vc.7z xash3d-vc2008-sln.7z
|
||||
- # ...
|
||||
name: "Build for Linux i686"
|
||||
cache: ccache
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
- g++-multilib
|
||||
- libx11-dev:i386
|
||||
- libxext-dev:i386
|
||||
- x11-utils
|
||||
- libgl1-mesa-dev
|
||||
- libasound-dev
|
||||
- libstdc++6:i386
|
||||
- libfuse2:i386
|
||||
- zlib1g:i386
|
||||
- unzip
|
||||
before_script:
|
||||
- export ARCH=i686
|
||||
- sh scripts/travis_common_deps.sh
|
||||
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
||||
script:
|
||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
|
||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
|
||||
after_script:
|
||||
- ccache --show-stats
|
||||
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
|
||||
- # ...
|
||||
name: "Build for Android"
|
||||
cache: ccache
|
||||
os: linux
|
||||
dist: xenial
|
||||
language: java # we want xenial, so just java, not android
|
||||
jdk: openjdk8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-9
|
||||
- lld-9
|
||||
- p7zip-full
|
||||
sources:
|
||||
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
|
||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||
before_script:
|
||||
- export ANDROID_HOME=$TRAVIS_BUILD_DIR/sdk
|
||||
- sh scripts/travis_common_deps.sh
|
||||
- sh scripts/travis_android_deps.sh r10e
|
||||
- export ANDROID_SDK_HOME=$ANDROID_HOME
|
||||
- export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
|
||||
script:
|
||||
- cd android
|
||||
- export ARCHS="armeabi armeabi-v7a x86"
|
||||
- export TOOLCHAIN="host"
|
||||
- sh compile.sh release
|
||||
after_script:
|
||||
- ccache --show-stats
|
||||
- sh ../scripts/continious_upload.sh xashdroid.apk
|
||||
- # ...
|
||||
name: "Build for Android 64"
|
||||
cache: ccache
|
||||
os: linux
|
||||
dist: xenial
|
||||
language: java # we want xenial, so just java, not android
|
||||
jdk: openjdk8
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- clang-9
|
||||
- lld-9
|
||||
- p7zip-full
|
||||
sources:
|
||||
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
|
||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||
before_script:
|
||||
- export ANDROID_HOME=$TRAVIS_BUILD_DIR/sdk
|
||||
- sh scripts/travis_common_deps.sh
|
||||
- sh scripts/travis_android_deps.sh r10e
|
||||
- export ANDROID_SDK_HOME=$ANDROID_HOME
|
||||
- export ANDROID_NDK_HOME=$ANDROID_SDK_HOME/ndk-bundle
|
||||
script:
|
||||
- cd android
|
||||
- export ARCHS="aarch64 x86_64"
|
||||
- export API=21
|
||||
- export TOOLCHAIN="host"
|
||||
- sh compile.sh release
|
||||
after_script:
|
||||
- ccache --show-stats
|
||||
- mv xashdroid.apk xashdroid-64-test.apk
|
||||
- sh ../scripts/continious_upload.sh xashdroid-64-test.apk
|
||||
- # ...
|
||||
name: "Build for Linux amd64"
|
||||
cache: ccache
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libx11-dev
|
||||
- libxext-dev
|
||||
- x11-utils
|
||||
- libgl1-mesa-dev
|
||||
- libasound-dev
|
||||
- libstdc++6
|
||||
- libfuse2
|
||||
- unzip
|
||||
before_script:
|
||||
- export ARCH=x86_64
|
||||
- sh scripts/travis_common_deps.sh
|
||||
- sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
||||
script:
|
||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh full
|
||||
- sh scripts/build_${TRAVIS_OS_NAME}_engine.sh dedicated
|
||||
after_script:
|
||||
- ccache --show-stats
|
||||
- sh scripts/continious_upload.sh xash3d-fwgs-${ARCH}.AppImage xashds-linux-${ARCH}
|
||||
# - # ...
|
||||
# name: "Build for Windows MinGW"
|
||||
# cache: ccache
|
||||
# os: linux
|
||||
# dist: xenial
|
||||
# addons:
|
||||
# apt:
|
||||
# packages:
|
||||
# - mingw-w64-i686-dev
|
||||
# - binutils-mingw-w64-i686
|
||||
# - gcc-mingw-w64-i686
|
||||
# - g++-mingw-w64-i686
|
||||
# - p7zip-full
|
||||
# before_script:
|
||||
# - sh scripts/travis_common_deps.sh
|
||||
# - sh scripts/travis_mingw_deps.sh
|
||||
# script:
|
||||
# - sh scripts/build_mingw_engine.sh
|
||||
# after_script:
|
||||
# - ccache --show-stats
|
||||
# - sh scripts/continious_upload.sh xash3d-mingw.7z
|
||||
# - # ...
|
||||
# name: "Build for OSX"
|
||||
# cache: ccache
|
||||
# os: osx
|
||||
# before_script:
|
||||
# - sh scripts/travis_common_deps.sh
|
||||
# - sh scripts/travis_${TRAVIS_OS_NAME}_deps.sh
|
||||
# script:
|
||||
# - sh scripts/build_${TRAVIS_OS_NAME}_engine.sh
|
||||
# after_script:
|
||||
# - sh scripts/continious_upload.sh xash3d-osx.tar.bz2
|
||||
- # ...
|
||||
name: "Build for MotoMAGX"
|
||||
sudo: true
|
||||
cache: ccache
|
||||
os: linux
|
||||
dist: xenial
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libc6:i386
|
||||
- libstdc++6:i386
|
||||
- gcc-multilib
|
||||
- g++-multilib
|
||||
- p7zip-full
|
||||
sources:
|
||||
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
|
||||
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||
before_script:
|
||||
- sh scripts/travis_common_deps.sh
|
||||
- sh scripts/travis_motomagx_deps.sh
|
||||
script:
|
||||
- sh scripts/build_motomagx_engine.sh
|
||||
after_script:
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
- ccache --show-stats
|
||||
- sh scripts/continious_upload.sh xash3d-magx.7z
|
||||
- stage: deploy
|
||||
name: "Deploy to github repo"
|
||||
os: linux
|
||||
cache: false
|
||||
script:
|
||||
- sh scripts/travis-deploy.sh xash3d-fwgs-i686.AppImage xash3d-fwgs-x86_64.AppImage xash3d-vc.7z xash3d-vc2008-sln.7z xashdroid.apk xashdroid-64-test.apk xashds-linux-i686 xashds-linux-x86_64 xash3d-magx.7z
|
||||
47
CONTRIBUTING.md
Normal file
47
CONTRIBUTING.md
Normal file
@@ -0,0 +1,47 @@
|
||||
## If you are reporting bugs
|
||||
|
||||
1. Check you are using latest version. You can build latest Xash3D FWGS for yourself, look to README.md.
|
||||
2. Check open issues is your bug is already reported and closed issues if it reported and fixed. Don't send bug if it's already reported.
|
||||
3. Re-run engine with `-dev 2 -log` arguments, reproduce bug and post engine.log which can be found in your working directory.
|
||||
3. Describe steps to reproduce bug.
|
||||
4. Describe which OS and architecture you are using.
|
||||
6. Attach screenshot if it will help clarify the situation.
|
||||
|
||||
## If you are contributing code
|
||||
|
||||
### Which branch?
|
||||
|
||||
* We recommend using `master` branch.
|
||||
|
||||
### Third-party libraries
|
||||
|
||||
* Philosophy of any Xash Project by Uncle Mike: don't be bloated. We follow it too.
|
||||
* Adding new library is allowed only if there is a REAL reason to use it. It's will be nice, if you will leave a possibility to remove new dependency at build-time.
|
||||
* Adding new dependencies for Waf Build System is not welcomed.
|
||||
|
||||
### Portability level
|
||||
|
||||
* Xash3D have it's own crt library. It's recommended to use it. It most cases it's just a wrappers around standart C library.
|
||||
* If your feature need platform-specific code, move it to `engine/platform` and try to implement to every supported OS and every supported compiler or at least leave a stubs.
|
||||
* You must put it under appopriate macro. It's a rule: Xash3D FWGS must compile everywhere. For list of platforms we support, refer to public/build.h file.
|
||||
|
||||
### Code style
|
||||
|
||||
* This project uses mixed Quake's and HLSDK's C/C++ code style convention.
|
||||
* In short:
|
||||
* Use spaces in parenthesis.
|
||||
* Only tabs for indentation.
|
||||
* Any brace must have it's own line.
|
||||
* Short blocks, if statements and loops on single line are allowed.
|
||||
* Avoid magic numbers.
|
||||
* While macros are powerful, it's better to avoid overusing them.
|
||||
* If you unsure, try to mimic code style from anywhere else of engine source code.
|
||||
* **ANY** commit message should start from declaring a tags, in format:
|
||||
|
||||
`tag: added some bugs`
|
||||
|
||||
`tag: subtag: fixed some features`
|
||||
|
||||
Tags can be any: subsystem, simple feature name or even just a filename, without extension.
|
||||
Just keep them always same, it helps keep history clean and commit messages short.
|
||||
|
||||
71
Documentation/engine-porting-guide.md
Normal file
71
Documentation/engine-porting-guide.md
Normal file
@@ -0,0 +1,71 @@
|
||||
## Abstract
|
||||
|
||||
Before start, I would recommend you to compile and run engine for already supported and well-spread platform, such as GNU/Linux or Windows. Hack it, get familiar with engine.
|
||||
|
||||
One beauties of Xash3D FWGS Engine is it modularity, so game logic, UI and renderers are located in platform-independent libraries. Every library is loaded at run time and may or may be not optional. For example, if your platform doesn't have OpenGL of any kind, you can skip it and use our software renderer! Of course, there is no real reason to run game engine, if you don't have game logic of any kind, so the minimal build of Xash3D FWGS is headless dedicated server.
|
||||
|
||||
Historically, Xash3D Engine was even more modular(see github.com/a1batross/Xash3D_ancient), but we thought that to fulfill our crossplatform needs we will keep all platform-specific stuff in the engine itself and libraries must import or expose platform-independent APIs.
|
||||
|
||||
Ok, get to the point!
|
||||
|
||||
## Porting guidelines
|
||||
|
||||
It will not be a complete tutorial as covering everything in one article is probably just impossible. Instead, I will give you hints on how engine can be ported, how to get your port to upstreamed and how you should maintain your port.
|
||||
|
||||
0) Get to know your platform. Maybe I asked for this lately, but you MUST KNOW YOUR PLATFORM, i.e. what's this capable of.
|
||||
|
||||
The one of unsupported configurations at this time is when platform can't load dynamic libraries(`*.so` or DLLs). We can't help you as supporting full-static ports are violating the GPL license in various ways.
|
||||
|
||||
The other yet unsupported configuration is the big endian.
|
||||
|
||||
1) Setup toolchain. For dirty port, you can write Makefile for yourself, engine is written that way, so **it doesn't relies** on any generated data or any special processing. But I recommend you to use Waf anyway, it's better integrated to engine and self-documentable. Also, I will cover only our Waf build options.
|
||||
|
||||
2) Open `public/build.h` file. Add appropriate checks for your operating system and/or CPU architecture. It shouldn't be hard.
|
||||
|
||||
Also, you'll need to build [Half-Life SDK](https://github.com/FWGS/hlsdk-xash3d/). It has same `public/build.h` so reflect changes into it. Note that to be compatible with HLSDK proprietary license, it's relicensed as public domain under [Unlicense](https://unlicense.org).
|
||||
|
||||
We have a library naming scheme that allows us and game creators to distribute binaries for different platforms in one archive. Read `Documentation/extensions/library-naming.md` for more information.
|
||||
|
||||
In short, you need to call your platform in unique way. For engine side it's done in `engine/common/build.c` file in engine source code, for HLSDK side it's done in `cmake/LibraryNaming.cmake` and `scripts/waifulib/library-naming.py` files in HLSDK source code.
|
||||
|
||||
You can use [predef project wiki](https://sourceforge.net/p/predef/wiki/Home/) for reference.
|
||||
|
||||
2) Look at the `engine/platform` directory. We usually try to have all platform-specific stuff inside this folder.
|
||||
|
||||
* Functions that must be available on your platform are declared in `platform.h` header. Most of them aren't used in headless dedicated build, but I will cover that later.
|
||||
|
||||
* The POSIX-compliant(for *nix operating systems) goes into `posix` subdirectory.
|
||||
|
||||
* The SDL-specific code goes into `sdl` subdirectory. Note that even I said before that platform-specific code is in `platform` directory, SDL obviously isn't a __platform__, so you can met checks for XASH_SDL inside whole engine, usually in input.
|
||||
|
||||
* Custom SWAP implementation for *nix-based systems is in `swap` subdirectory. It's used when hardware may not have enough memory and you can't add swap memory. I will cover that later
|
||||
It relies on a fact that systems with paged memory will load pages into RAM and move unused to mmap()-ed by custom swap area.
|
||||
That allowed to run game engine on music player with MIPS CPU, Linux without SWAP support and
|
||||
|
||||
* Other folders as `win32`, `android`, `linux` and so on are self-descriptive.
|
||||
|
||||
3) As proof of concept, you can try to test that network features and dynamic library loading are implemented correctly. Build a dedicated server with XASH_DEDICATED or `--dedicated` passed to `waf configure`.
|
||||
|
||||
Start a server and try to connect to it from PC. If everything is fine, then you can move to next step.
|
||||
|
||||
If you get out of memory issues, you can try Low Memory Mode, it's enabled with `--low-memory-mode=N` passed to `waf configure` where N is 1 or 2. Low Memory Mode 1 means that we will NOT break a network compatibility. 2 is deeper and doesn't guarantee protocol compatibility and available multiplayer. Of course, with Low Memory Mode 2 you can't test your port dedicated server.
|
||||
|
||||
If you got anything compiling, it's nice time to make a commit. Commit your changes into git and push them somewhere(GitHub, GitLab or what you prefer), so you will not lose them accidentally.
|
||||
|
||||
4) Here is most interesting, building the client part.
|
||||
|
||||
There are three possible situations for you, by increasing difficulty.
|
||||
|
||||
1. Do you have SDL2 for your platform? If yes, go ahead and compile engine with client part enabled.
|
||||
|
||||
2. Do you have SDL1.2 for your platform? If yes, try to compile it, but SDL1.2 support is very limited and not tested well.
|
||||
|
||||
3. You don't have SDL and you can't port it for some reason by yourself or SDL port just don't stable for your platform? Then you need to implement an engine backend.
|
||||
|
||||
How to implement engine backend? Well, we have a backends system that was introduced in Old Engine. It's simply two files: backends.h and defaults.h in `common` folder in repository root. You will need to add a macros for your backends in `backends.h` and define a logic in `defaults.h`. We have already have some, check them out, as they may be handy for you.
|
||||
|
||||
Once you did it, go back to `platform` directory and open `platform.h` headers. Create new subdirectory in `platform` folder and start implementing missing platform-specific backends one by one. I can't explain this as for obvious reasons it's too specific. You can use macros you defined before in `build.h` to check that you're compiling for your platform and `backends.h` macros to check if platform-specific backend must be enabled.
|
||||
|
||||
As you finished, compile engine, fix errors and commit your changes and push to repository.
|
||||
|
||||
Remember, if something doesn't work and you can't figure out why, you can join our Discord server at discord.me/fwgs. Ping me (@a1batross) or other engine developer and attach link to your repository, so we can discuss and help you in porting.
|
||||
68
Documentation/extensions/console-scripting.md
Normal file
68
Documentation/extensions/console-scripting.md
Normal file
@@ -0,0 +1,68 @@
|
||||
## Console variables
|
||||
|
||||
Console variables (or CVars) are present in all quake-based games.
|
||||
|
||||
By default, it is settings, created by engine, server or client libraries.
|
||||
|
||||
But you can use `set` command to define variables even if they are not created by the engine.
|
||||
|
||||
For example, you can set cvar before it is registered in code.
|
||||
|
||||
`set defaultmap crossfire`
|
||||
|
||||
This works even in server.cfg before server cvars initialization and the engine will reuse its value on cvar creation
|
||||
|
||||
## Aliases
|
||||
|
||||
An alias allows to define new commands.
|
||||
|
||||
`alias wnext "invnext;wait;wait;+attack;wait;-attack"`
|
||||
|
||||
You can hook any command by adding an alias to it and unaliasing it, when you want to use original command.
|
||||
|
||||
```
|
||||
alias invnext1 "unalias invnext;wnext;alias invnext invnext1"
|
||||
alias invnext invnext1
|
||||
```
|
||||
|
||||
## Scripting extensions
|
||||
|
||||
This is an extensions of Xash3D FWGS(merged to original Xash3D since build 3887), that can be enabled by cmd_scripting cvar.
|
||||
|
||||
Enabling scripting: `cmd_scripting 1`
|
||||
|
||||
This is an archive cvar and it will be saved.
|
||||
|
||||
### CVar substitution
|
||||
|
||||
You can substitute cvar value to any command by adding \$ symbol:
|
||||
|
||||
`echo $sv_cheats`
|
||||
|
||||
### Condition checking
|
||||
|
||||
Allows checking cvar values.
|
||||
|
||||
```
|
||||
if <value1> <operator> <value2>
|
||||
:<action1>
|
||||
:if <value3>
|
||||
::<action2>
|
||||
:<action3>
|
||||
else
|
||||
:<action4>
|
||||
```
|
||||
|
||||
* Values are any string or numeric values (for example, substituted cvars).
|
||||
* Operator is = (or ==), \!=, \<, \>, \<=, \>=. == is same to =.
|
||||
* If single value specified, condition is true when value is non-zero
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
if $sv_cheats == 1
|
||||
:echo Cheats enabled, adding cheat menu
|
||||
:exec cheatmenu.cfg
|
||||
else
|
||||
:echo Please enable cheats to use this!
|
||||
```
|
||||
48
Documentation/extensions/input-interface-ru.md
Normal file
48
Documentation/extensions/input-interface-ru.md
Normal file
@@ -0,0 +1,48 @@
|
||||
## Цель
|
||||
|
||||
На текущий момент клиенты имеют некоторые части платформозависимого кода внутри себя. Это плохо, т.к. мы не можем использовать одинаковые функции (если не перепишем почти половину кода SDL) на разных платформах.
|
||||
|
||||
## Клиентская часть
|
||||
|
||||
* Клиент будет иметь возможность полностью реализовать touch-ввод. Отрисовка может быть произведена через HUD.
|
||||
* Клиент получит простые события движения и обзора от движка
|
||||
|
||||
### Клиентская реализация
|
||||
|
||||
#### Клиент будет экспортировать некоторые функции движку (опционально):
|
||||
|
||||
* `int IN_ClientTouchEvent ( int fingerID, float x, float y, float dx, float dy );`
|
||||
|
||||
Вернёт 1 если касание активно, иначе 0.
|
||||
|
||||
* `void IN_ClientMoveEvent ( float forwardmove, float sidemove );`
|
||||
|
||||
Клиент будет накапливать значения величин для команд движения перед созданием команд и очищать их при CreateMove.
|
||||
|
||||
* `void IN_ClientLookEvent ( float relyaw, float relpitch );`
|
||||
|
||||
Клиент будет вращать камерой когда нужно, прямо как в реализации мыши
|
||||
|
||||
## Движковая часть
|
||||
|
||||
* Движок будет управлять событиями платформы и вызывать клиентские функции
|
||||
* Движок реализует стандартную систему взгляда и движения если её нет в клиенте
|
||||
|
||||
### Движковая реализация
|
||||
|
||||
#### События касания
|
||||
|
||||
Перед вызовом ClientMove движок обязан получить события о касании.
|
||||
|
||||
Если из клиента экспортирована функция IN_ClientTouchEvent, событие будет отправлено клиенту.
|
||||
|
||||
Иначе, движок будет рисовать свой touch-интерфейс.
|
||||
|
||||
#### Другие события
|
||||
|
||||
Интерфейс прикосновений и код джойстика в движке будут генерировать следующие два типа событий:
|
||||
* События движения (функция IN_ClientMoveEvent)
|
||||
* События просмотра (функция IN_ClientLookEvent)
|
||||
|
||||
Если клиент экспортирует эти функции, события будут отправляться клиенту перед CreateMove
|
||||
Иначе события просмотра будут происходить перед CreateMove, но после MoveEvent. Они будут применены к генерируемым командам
|
||||
48
Documentation/extensions/input-interface.md
Normal file
48
Documentation/extensions/input-interface.md
Normal file
@@ -0,0 +1,48 @@
|
||||
## Purpose
|
||||
|
||||
Clients have different platform-depended input code now.
|
||||
It is bad because we cannot use same functions (if we won't rewrite almost half of SDL) on different platforms.
|
||||
|
||||
## Client part
|
||||
|
||||
* Client will have ability to fully implement touch input. Drawing may be done by HUD.
|
||||
* Client will receive basic motion and look events from engine
|
||||
|
||||
### Client implementation
|
||||
|
||||
#### Client will optionally export some functions to Engine:
|
||||
* `int IN_ClientTouchEvent ( int fingerID, float x, float y, float dx, float dy );`
|
||||
|
||||
Return 1 if touch is active, 0 otherwise.
|
||||
|
||||
* `void IN_ClientMoveEvent ( float forwardmove, float sidemove );`
|
||||
|
||||
Client wil accumulate move values before creating commands and flush it on CreateMove.
|
||||
|
||||
* `void IN_ClientLookEvent ( float relyaw, float relpitch );`
|
||||
|
||||
Client will rotate camera when needed as in mouse implementation
|
||||
|
||||
## Engine part
|
||||
|
||||
* Engine will handle platform events and call client functions.
|
||||
* Engine will implement fallback look and movement system when client interface not present
|
||||
|
||||
### Engine implementation
|
||||
|
||||
#### Touch events
|
||||
|
||||
Before calling ClientMove engine must get touch events.
|
||||
|
||||
If client exported IN_ClientTouchEvent, event will be sent to client.
|
||||
|
||||
Otherwise engine will draw own touch interface.
|
||||
|
||||
#### Other events
|
||||
|
||||
Engine touch interface and joystick support code will generate two types of events:
|
||||
* Move events (IN_ClientMoveEvent function)
|
||||
* Look events (IN_ClientLookEvent function)
|
||||
|
||||
If client exported these functions, events will be sent to client before CreateMove
|
||||
Otherwise Look Event will be processed before CreateMove, but MoveEvent after. It will be applied to generated command
|
||||
41
Documentation/extensions/library-naming.md
Normal file
41
Documentation/extensions/library-naming.md
Normal file
@@ -0,0 +1,41 @@
|
||||
I propose a new library naming scheme, which will allow to distribute mods and games in single archive to different operating systems and CPUs:
|
||||
|
||||
Legend:
|
||||
* $os -- Q_buildos() return value, in lower case.
|
||||
* $arch -- Q_buildarch() return value, in lower case.
|
||||
* $ext -- OS-specific extension: dll, so, dylib, etc.
|
||||
|
||||
The scheme will be:
|
||||
|
||||
1. Client library:
|
||||
* ```client.$ext``` for **Win/Lin/Mac** with **x86**.
|
||||
* ```client_$arch.$ext``` for **Win/Lin/Mac** with **NON-x86**.
|
||||
* ```client_$os_$arch.$ext``` for everything else.
|
||||
|
||||
2. Menu library:
|
||||
* ```menu.$ext``` for **Win/Lin/Mac** with **x86**.
|
||||
* ```menu_$arch.$ext``` for **Win/Lin/Mac** with **NON-x86**.
|
||||
* ```menu_$os_$arch.$ext``` for everything else.
|
||||
|
||||
3. Server library:
|
||||
* On **Win/Lin/Mac** with **x86**, it **MUST** use the raw gamedll name for corresponding OS field from `gameinfo.txt`.
|
||||
* On **Win/Lin/Mac** with **NON-x86**, it **MUST** use the raw gamedll name for corresponding OS field from `gameinfo.txt`, but append ```_$arch``` before file extension. Like: ```hl_amd64.so``` or ```cs_e2k.so```.
|
||||
* On everything else, it must use gamedll name from ```gamedll_linux``` field, but append ```_$os_$arch``` before file extension. Like: ```hl_haiku_amd64.so``` or ```cs_freebsd_armhf.so```.
|
||||
Why ```gamedll_linux``` and not ```gamedll```? Because it looks more logic that way, most operating systems are *nix-like and share code with Linux, rather than Windows.
|
||||
|
||||
4. Refresh library: not needed, as RefAPI is not stable and it's not intended to distribute with mods.
|
||||
|
||||
For any libraries distributed **with** engine, naming scheme should be used more convenient for OS port.
|
||||
|
||||
Issue #0. Inconsistency between ABI and Q_buildarch.\
|
||||
Resolution: Change Q_buildarch return value to use Debian-styled architectures list: https://www.debian.org/ports/, which includes a special naming for big/little-endian and hard/soft-float ARM.
|
||||
|
||||
Issue #1: Build-system integration.\
|
||||
Resolution: implemented as [LibraryNaming.cmake](https://github.com/FWGS/hlsdk-xash3d/blob/master/cmake/LibraryNaming.cmake) and [library_naming.py](https://github.com/FWGS/hlsdk-xash3d/blob/master/scripts/waifulib/library_naming.py) extensions, see
|
||||
|
||||
Issue #2(related to #0): Which ARM flavours we actually need to handle?\
|
||||
Resolution: Little-endian only, as there is no known big-endian ARM platforms in the wild.
|
||||
Architecture is coded this way:
|
||||
* ```armvxy```, where `x` is ARM instruction set level and `y` is hard-float ABI presence: `hf` where hard float ABI used, otherwise `l`.
|
||||
|
||||
See discussion: https://github.com/FWGS/xash3d-fwgs/issues/39
|
||||
75
Documentation/mod-porting-guide.md
Normal file
75
Documentation/mod-porting-guide.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# Server porting
|
||||
Original valve's server code was compatible with linux and gcc 2.x.
|
||||
Newer gcc versions have restriction which breaks build.
|
||||
Now, to make it building with gcc 4.x, you need do following:
|
||||
* Go to cbase.h and redefine macros as following
|
||||
```
|
||||
#define SetThink( a ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (&a)
|
||||
#define SetTouch( a ) m_pfnTouch = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (&a)
|
||||
#define SetUse( a ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (&a)
|
||||
#define SetBlocked( a ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (&a)
|
||||
#define ResetThink( ) m_pfnThink = static_cast <void (CBaseEntity::*)(void)> (NULL)
|
||||
#define ResetTouch( ) m_pfnTouch = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (NULL)
|
||||
#define ResetUse( ) m_pfnUse = static_cast <void (CBaseEntity::*)( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )> (NULL)
|
||||
#define ResetBlocked( ) m_pfnBlocked = static_cast <void (CBaseEntity::*)(CBaseEntity *)> (NULL)
|
||||
...
|
||||
#define SetMoveDone( a ) m_pfnCallWhenMoveDone = static_cast <void (CBaseToggle::*)(void)> (&a)
|
||||
```
|
||||
* Replace all SetThink(NULL), SetTouch(NULL), setUse(NULL) and SetBlocked(NULL) by ResetThink(), ResetTouch(), ResetUse() and ResetBlocked()
|
||||
* Sometimes you may need to add #include <ctype.h> if functions tolower or isspace are missing
|
||||
|
||||
# Client porting
|
||||
|
||||
## VGUI library
|
||||
|
||||
Valve's client uses vgui library which is available only on x86 systems and has big amount of mistakes in headers. The best and simplest way of porting is removing VGUI dependency at all.
|
||||
Most singleplayer mods don't really use VGUI at all. It is used in multiplayer only to show score table and MOTD window
|
||||
|
||||
## Porting
|
||||
|
||||
### First strategy: full port
|
||||
|
||||
#### Basic port (Stage 1)
|
||||
* First, remove all files and headers which use vgui (contains "vgui" in file name).
|
||||
* After that, try to build it and remove vgui includes.
|
||||
* Remove all gViewPort usings.
|
||||
* Remove all CVoiceManager usings (xash3d does not support voice)
|
||||
* Redefine all DLLEXPORT defines as empty field (Place it under _WIN32 macro if you want to keep windows compatibility).
|
||||
* Remove hud_servers.cpp and Servers_Init/Servers_Shutdown from hud.cpp
|
||||
* Fix CAPS filenames in includes (like STDIO.H, replace by stdio.h).
|
||||
* Replace broken macros as DECLARE_MESSAGE, DECLARE_COMMAND by fixed examples from our hlsdk-xash3d port (cl_util.h)
|
||||
* Add ctype.h where it is need (tolower, isspace functions)
|
||||
* Add string.h where it is need (memcpy, strcpy, etc)
|
||||
* Use in_defs.h from hlsdk_client
|
||||
* Add scoreboard_stub.cpp and input_stub.cpp from hlsdk-xash3d to fix linking.
|
||||
Now your client should be able to build and work correctly. Add input_xash3d.cpp from hlsdk-xash3d project to fix input.
|
||||
|
||||
#### Multiplayer fix (Stage 2)
|
||||
Look at hlsdk-xash3d project.
|
||||
|
||||
Main changes are:
|
||||
* Add MOTD.cpp, scoreboard.cpp and input_xash3d.cpp
|
||||
* Add missing functions to hud_redraw.cpp, hud.cpp and tri.cpp, fix class defination in hud.h
|
||||
* Remove duplicate functions from hud.cpp and HOOK_MESSAGE's for it
|
||||
* Remove +showscores/-showscores hooks from input.h
|
||||
* Fix cl_util.h
|
||||
|
||||
### Second way: move mod to hlsdk-xash3d
|
||||
Look at changes you made in client.
|
||||
|
||||
If there are not much changes (for example, only some weapons was add), add these changes in hlsdk-xash3d.
|
||||
|
||||
You may use diff with original HLSDK you used and apply it as patch to hlsdk-xash3d.
|
||||
|
||||
Files must have same line endings (use dos2unix on all files).
|
||||
|
||||
I recommend to enable ignoring space changes in diff.
|
||||
### Writing Makefiles
|
||||
|
||||
Use Makefile from hlsdk-xash3d as Makefile example.
|
||||
|
||||
Get .c and .cpp file lists from Visual Studio project and fill SRCS and SRCS_C variables to Makefile.
|
||||
|
||||
Remove all files containing vgui in name from list, add missing include dirs.
|
||||
|
||||
Do same for Android.mk if you are building for android.
|
||||
36
Documentation/ports.md
Normal file
36
Documentation/ports.md
Normal file
@@ -0,0 +1,36 @@
|
||||
Xash3D FWGS is intended to be easily ported to specific platform, however main issue is maintaining such ports.
|
||||
|
||||
This page is about merged ports to main source tree and responsible for it developers.
|
||||
|
||||
For porting guidelines, look here(TODO!)
|
||||
|
||||
Status:
|
||||
* **Supported**: active, confirmed to be fully functional.
|
||||
* **In progress**: active, under development.
|
||||
* **Incomplete**: not active, but some work was accepted to main repository before
|
||||
* **Old Engine**: port was for old engine fork
|
||||
* **Not maintained**: lack of human resources
|
||||
* **Not merged**: was done in third-party fork, real status unknown
|
||||
* **Deprecated**: not supported anymore
|
||||
|
||||
Table is sorted by status.
|
||||
|
||||
| Platform | Status | Maintainer | Note
|
||||
| -------- | ------ | ---------- | ----
|
||||
| Windows | Supported | @a1batross |
|
||||
| Linux(x86) | Supported | @a1batross, @mittorn |
|
||||
| Linux(amd64) | Supported | @mittorn |
|
||||
| *BSD | Supported | @nekonomicon |
|
||||
| Linux(arm) | Supported | @a1batross, @mittorn |
|
||||
| Android | Supported | @a1batross, @mittorn |
|
||||
| MotoMAGX | Supported | @a1batross |
|
||||
| Linux(elbrus) | In progress | @a1batross, @mittorn | Rare and eventual access to e2k machine
|
||||
| Android/Linux(aarch64) | In progress | @a1batross |
|
||||
| Linux(mipsel) | In progress | @mittorn |
|
||||
| Haiku | Incomplete, Old Engine | not maintained |
|
||||
| Emscripten | Incomplete, Old Engine | not maintained |
|
||||
| PSVita | Not merged, Old Engine | not maintained | [GitHub Repository](https://github.com/fgsfdsfgs/vitaXash3D)
|
||||
| Switch | Not merged, Old Engine | not maintained | [GitHub Repository](https://github.com/switchports/xash3d-switch)
|
||||
| 3DS | Not merged, Old Engine | not maintained | [GitHub Repository](https://github.com/masterfeizz/Xash3DS)
|
||||
| macOS | Deprecated | not maintained | See GitHub issue #61
|
||||
| iOS | Deprecated | not maintained | See GitHub issue #61
|
||||
15
Documentation/public-servers-rules-and-recommendations.md
Normal file
15
Documentation/public-servers-rules-and-recommendations.md
Normal file
@@ -0,0 +1,15 @@
|
||||
As online community is growing, we don't want to keep bad or invalid servers on the Internet Games list. It's a common rules for all Xash3D server owners who are using default master server.
|
||||
|
||||
1. Breaking master server or clients is prohibited in any way. If you found a serious bug, contact us at contact 'at' fwgs.ru or post an issue at GitHub.
|
||||
|
||||
2. Changing settings, exploiting vulnerabilities of clients is prohibited in any way. If you found a serious bug, contact us at contact 'at' fwgs.ru or post an issue at GitHub.
|
||||
|
||||
2. Agressive advertisement and spam on other servers is prohibited in any way.
|
||||
|
||||
3. If your server is require downloading custom content, it should be available for everyone. Recommended way to deliver custom content is FastDL.
|
||||
|
||||
4. It's recommended to keep your server is up-to-date. You may use our public Debian/Ubuntu/Arch Linux [repository](https://github.com/FWGS/xash3d/wiki/How-to-set-up-a-Xash3D-Dedicated-Server-on-Debian-or-Ubuntu) to simplify updating process.
|
||||
|
||||
Just follow these rules to not get banned on our master server. Good luck, have fun!
|
||||
|
||||
|
||||
1226
Documentation/supported-mod-list.md
Normal file
1226
Documentation/supported-mod-list.md
Normal file
File diff suppressed because it is too large
Load Diff
93
README.md
Normal file
93
README.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# Xash3D FWGS Engine
|
||||
[](https://travis-ci.org/FWGS/xash3d-fwgs) [](https://discord.gg/TbnHcVb)
|
||||
|
||||
Xash3D FWGS is a fork of Xash3D Engine by Unkle Mike with extended features and crossplatform.
|
||||
|
||||
```
|
||||
Xash3D is a game engine, aimed to provide compatibility with Half-Life Engine,
|
||||
as well as to give game developers well known workflow and extend it.
|
||||
Read more about Xash3D on ModDB: https://www.moddb.com/engines/xash3d-engine
|
||||
```
|
||||
|
||||
Latest release build: https://github.com/FWGS/xash3d-fwgs/releases/latest
|
||||
|
||||
Latest development build: https://github.com/FWGS/xash3d-deploy/tree/newengine-master
|
||||
|
||||
## Fork features
|
||||
* HLSDK 2.4 support.
|
||||
* Crossplatform: officially supported x86 and ARM on Windows/Linux/BSD/Android. (see Documentation/ports.md for more info)
|
||||
* Modern compilers support: say no more to MSVC6.
|
||||
* Better multiplayer support: multiple master servers, headless dedicated server.
|
||||
* Mobility API: allows better game integration on mobile devices(vibration, touch controls)
|
||||
* Different input methods: touch, gamepad and classic mouse & keyboard.
|
||||
* TrueType font rendering, as a part of mainui_cpp.
|
||||
* Multiple renderers support(OpenGL, GLES, Software)
|
||||
* A set of small improvements, without broken compatibility.
|
||||
|
||||
## Planned fork features
|
||||
* Virtual Reality support and game API
|
||||
* Voice support
|
||||
* Vulkan renderer
|
||||
|
||||
## Contributing
|
||||
* Before sending an issue, check if someone already reported your issue. Make sure you're following "How To Ask Questions The Smart Way" guide by Eric Steven Raymond. Read more: http://www.catb.org/~esr/faqs/smart-questions.html
|
||||
* Before sending a PR, check if you followed our coding guide in CODING_STYLE.md file.
|
||||
|
||||
## Build instructions
|
||||
We are using Waf build system. If you have some Waf-related questions, I recommend you to read https://waf.io/book/
|
||||
|
||||
If you're stuck somewhere and you need a clear example, read `.travis.yml` and `scripts/build*.sh`.
|
||||
|
||||
### Prerequisites
|
||||
#### Windows(Visual Studio)
|
||||
* Install Visual Studio.
|
||||
* Install latest [Python](https://python.org) **OR** run `cinst python.install` if you have Chocolatey.
|
||||
* Install latest [Git](https://git-scm.com/download/win) **OR** run `cinst git.install` if you have Chocolatey.
|
||||
* Download [SDL2](https://libsdl.org/download-2.0.php) development package for Visual Studio.
|
||||
* Clone this repository: `git clone --recursive https://github.com/FWGS/xash3d-fwgs`.
|
||||
* Make sure you have at least 12GB of free space to store all build-time dependencies: ~10GB for Visual Studio, 300 MB for Git, 100 MB for Python and other.
|
||||
|
||||
#### GNU/Linux
|
||||
NOTE FOR USERS WITH X86 COMPATIBLE CPUs:
|
||||
We have forced build system to throw an error, if you're trying to build 64-bit engine. This done for keeping compatibility with Steam releases of Half-Life and based on it's engine games.
|
||||
Even if Xash3D FWGS does support targetting 64-bit, you can't load games without recompiling them from source code!
|
||||
|
||||
##### Debian/Ubuntu
|
||||
* Enable i386 on your system, if you're compiling 32-bit engine on amd64. If not, skip this
|
||||
|
||||
`$ sudo dpkg --add-architecture i386`
|
||||
* Install development tools
|
||||
* For 32-bit engine on amd64:
|
||||
|
||||
`$ sudo apt install build-essential gcc-multilib g++-multilib python libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype6-dev:i386`
|
||||
* For everything else:
|
||||
|
||||
`$ sudo apt install build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev`
|
||||
* Clone this repostory:
|
||||
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`
|
||||
|
||||
#### ArchLinux
|
||||
* ArchLinux users are lucky enough and there is a `xash3d-git` AUR package for them.
|
||||
|
||||
### Building
|
||||
#### Windows(Visual Studio)
|
||||
0) Open command line
|
||||
1) Navigate to `xash3d-fwgs` directory.
|
||||
2) Carefully examine which build options are available: `waf --help`
|
||||
3) Configure build: `waf configure -T release --sdl2=c:/path/to/SDL2 --prefix=c:/path/to/any/output/directory`
|
||||
4) Compile: `waf build`
|
||||
5) Install: `waf install`
|
||||
|
||||
#### Linux
|
||||
0) Examine which build options are available: `./waf --help`
|
||||
1) Configure build: `./waf configure -T release --prefix=/path/to/any/output/directory`
|
||||
(To compile 64-bit engine on 64-bit x86 processor, you need to pass `-8` also)
|
||||
2) Compile: `./waf build`
|
||||
3) Install(optional): `./waf install`
|
||||
|
||||
## Running
|
||||
0) Copy libraries and main executable somewhere, if you're skipped installation stage.
|
||||
1) Copy game files to same directory
|
||||
2) Run `xash3d.exe`/`xash3d.sh`/`xash3d` depending on which platform you're using.
|
||||
|
||||
For additional info, run Xash3D with `-help` command line key.
|
||||
54
common/backends.h
Normal file
54
common/backends.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
backends.h - backend macro definitions
|
||||
Copyright (C) 2016 Mittorn
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
#ifndef BACKENDS_H
|
||||
#define BACKENDS_H
|
||||
|
||||
// video backends (XASH_VIDEO)
|
||||
#define VIDEO_NULL 0
|
||||
#define VIDEO_SDL 1
|
||||
#define VIDEO_ANDROID 2
|
||||
#define VIDEO_FBDEV 3
|
||||
|
||||
// audio backends (XASH_SOUND)
|
||||
#define SOUND_NULL 0
|
||||
#define SOUND_SDL 1
|
||||
#define SOUND_OPENSLES 2
|
||||
#define SOUND_ALSA 3
|
||||
|
||||
// crash handler (XASH_CRASHHANDLER)
|
||||
#define CRASHHANDLER_NULL 0
|
||||
#define CRASHHANDLER_UCONTEXT 1
|
||||
#define CRASHHANDLER_DBGHELP 2
|
||||
#define CRASHHANDLER_WIN32 3
|
||||
|
||||
// input (XASH_INPUT)
|
||||
#define INPUT_NULL 0
|
||||
#define INPUT_SDL 1
|
||||
#define INPUT_ANDROID 2
|
||||
#define INPUT_EVDEV 3
|
||||
|
||||
// timer (XASH_TIMER)
|
||||
#define TIMER_NULL 0 // not used
|
||||
#define TIMER_SDL 1
|
||||
#define TIMER_LINUX 2
|
||||
#define TIMER_WIN32 3
|
||||
|
||||
// messageboxes (XASH_MESSAGEBOX)
|
||||
#define MSGBOX_STDERR 0
|
||||
#define MSGBOX_SDL 1
|
||||
#define MSGBOX_ANDROID 2
|
||||
#define MSGBOX_WIN32 3
|
||||
|
||||
#endif /* BACKENDS_H */
|
||||
@@ -57,4 +57,4 @@ struct beam_s
|
||||
struct particle_s *particles;
|
||||
};
|
||||
|
||||
#endif//BEAMDEF_H
|
||||
#endif//BEAMDEF_H
|
||||
|
||||
@@ -22,4 +22,4 @@ typedef struct
|
||||
vec3_t origin;
|
||||
} boneinfo_t;
|
||||
|
||||
#endif//BONEINFO_H
|
||||
#endif//BONEINFO_H
|
||||
|
||||
@@ -321,4 +321,4 @@ typedef struct
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
} dface32_t;
|
||||
|
||||
#endif//BSPFILE_H
|
||||
#endif//BSPFILE_H
|
||||
|
||||
@@ -102,4 +102,4 @@ struct cl_entity_s
|
||||
colorVec cvFloorColor;
|
||||
};
|
||||
|
||||
#endif//CL_ENTITY_H
|
||||
#endif//CL_ENTITY_H
|
||||
|
||||
110
common/com_image.h
Normal file
110
common/com_image.h
Normal file
@@ -0,0 +1,110 @@
|
||||
#pragma once
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
internal image format
|
||||
|
||||
typically expanded to rgba buffer
|
||||
NOTE: number at end of pixelformat name it's a total bitscount e.g. PF_RGB_24 == PF_RGB_888
|
||||
========================================================================
|
||||
*/
|
||||
#define ImageRAW( type ) (type == PF_RGBA_32 || type == PF_BGRA_32 || type == PF_RGB_24 || type == PF_BGR_24 || type == PF_LUMINANCE)
|
||||
#define ImageDXT( type ) (type == PF_DXT1 || type == PF_DXT3 || type == PF_DXT5 || type == PF_ATI2)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PF_UNKNOWN = 0,
|
||||
PF_INDEXED_24, // inflated palette (768 bytes)
|
||||
PF_INDEXED_32, // deflated palette (1024 bytes)
|
||||
PF_RGBA_32, // normal rgba buffer
|
||||
PF_BGRA_32, // big endian RGBA (MacOS)
|
||||
PF_RGB_24, // uncompressed dds or another 24-bit image
|
||||
PF_BGR_24, // big-endian RGB (MacOS)
|
||||
PF_LUMINANCE,
|
||||
PF_DXT1, // s3tc DXT1 format
|
||||
PF_DXT3, // s3tc DXT3 format
|
||||
PF_DXT5, // s3tc DXT5 format
|
||||
PF_ATI2, // latc ATI2N format
|
||||
PF_TOTALCOUNT, // must be last
|
||||
} pixformat_t;
|
||||
|
||||
typedef struct bpc_desc_s
|
||||
{
|
||||
int format; // pixelformat
|
||||
char name[16]; // used for debug
|
||||
uint glFormat; // RGBA format
|
||||
int bpp; // channels (e.g. rgb = 3, rgba = 4)
|
||||
} bpc_desc_t;
|
||||
|
||||
// imagelib global settings
|
||||
typedef enum
|
||||
{
|
||||
IL_USE_LERPING = BIT(0), // lerping images during resample
|
||||
IL_KEEP_8BIT = BIT(1), // don't expand paletted images
|
||||
IL_ALLOW_OVERWRITE = BIT(2), // allow to overwrite stored images
|
||||
IL_DONTFLIP_TGA = BIT(3), // Steam background completely ignore tga attribute 0x20 (stupid lammers!)
|
||||
IL_DDS_HARDWARE = BIT(4), // DXT compression is support
|
||||
IL_LOAD_DECAL = BIT(5), // special mode for load gradient decals
|
||||
IL_OVERVIEW = BIT(6), // overview required some unque operations
|
||||
} ilFlags_t;
|
||||
|
||||
// goes into rgbdata_t->encode
|
||||
#define DXT_ENCODE_DEFAULT 0 // don't use custom encoders
|
||||
#define DXT_ENCODE_COLOR_YCoCg 0x1A01 // make sure that value dosn't collide with anything
|
||||
#define DXT_ENCODE_ALPHA_1BIT 0x1A02 // normal 1-bit alpha
|
||||
#define DXT_ENCODE_ALPHA_8BIT 0x1A03 // normal 8-bit alpha
|
||||
#define DXT_ENCODE_ALPHA_SDF 0x1A04 // signed distance field
|
||||
#define DXT_ENCODE_NORMAL_AG_ORTHO 0x1A05 // orthographic projection
|
||||
#define DXT_ENCODE_NORMAL_AG_STEREO 0x1A06 // stereographic projection
|
||||
#define DXT_ENCODE_NORMAL_AG_PARABOLOID 0x1A07 // paraboloid projection
|
||||
#define DXT_ENCODE_NORMAL_AG_QUARTIC 0x1A08 // newton method
|
||||
#define DXT_ENCODE_NORMAL_AG_AZIMUTHAL 0x1A09 // Lambert Azimuthal Equal-Area
|
||||
|
||||
// rgbdata output flags
|
||||
typedef enum
|
||||
{
|
||||
// rgbdata->flags
|
||||
IMAGE_CUBEMAP = BIT(0), // it's 6-sides cubemap buffer
|
||||
IMAGE_HAS_ALPHA = BIT(1), // image contain alpha-channel
|
||||
IMAGE_HAS_COLOR = BIT(2), // image contain RGB-channel
|
||||
IMAGE_COLORINDEX = BIT(3), // all colors in palette is gradients of last color (decals)
|
||||
IMAGE_HAS_LUMA = BIT(4), // image has luma pixels (q1-style maps)
|
||||
IMAGE_SKYBOX = BIT(5), // only used by FS_SaveImage - for write right suffixes
|
||||
IMAGE_QUAKESKY = BIT(6), // it's a quake sky double layered clouds (so keep it as 8 bit)
|
||||
IMAGE_DDS_FORMAT = BIT(7), // a hint for GL loader
|
||||
IMAGE_MULTILAYER = BIT(8), // to differentiate from 3D texture
|
||||
IMAGE_ONEBIT_ALPHA = BIT(9), // binary alpha
|
||||
IMAGE_QUAKEPAL = BIT(10), // image has quake1 palette
|
||||
|
||||
// Image_Process manipulation flags
|
||||
IMAGE_FLIP_X = BIT(16), // flip the image by width
|
||||
IMAGE_FLIP_Y = BIT(17), // flip the image by height
|
||||
IMAGE_ROT_90 = BIT(18), // flip from upper left corner to down right corner
|
||||
IMAGE_ROT180 = IMAGE_FLIP_X|IMAGE_FLIP_Y,
|
||||
IMAGE_ROT270 = IMAGE_FLIP_X|IMAGE_FLIP_Y|IMAGE_ROT_90,
|
||||
IMAGE_EMBOSS = BIT(19), // apply emboss mapping
|
||||
IMAGE_RESAMPLE = BIT(20), // resample image to specified dims
|
||||
// reserved
|
||||
// reserved
|
||||
IMAGE_FORCE_RGBA = BIT(23), // force image to RGBA buffer
|
||||
IMAGE_MAKE_LUMA = BIT(24), // create luma texture from indexed
|
||||
IMAGE_QUANTIZE = BIT(25), // make indexed image from 24 or 32- bit image
|
||||
IMAGE_LIGHTGAMMA = BIT(26), // apply gamma for image
|
||||
IMAGE_REMAP = BIT(27), // interpret width and height as top and bottom color
|
||||
} imgFlags_t;
|
||||
|
||||
typedef struct rgbdata_s
|
||||
{
|
||||
word width; // image width
|
||||
word height; // image height
|
||||
word depth; // image depth
|
||||
uint type; // compression type
|
||||
uint flags; // misc image flags
|
||||
word encode; // DXT may have custom encoder, that will be decoded in GLSL-side
|
||||
byte numMips; // mipmap count
|
||||
byte *palette; // palette if present
|
||||
byte *buffer; // image buffer
|
||||
rgba_t fogParams; // some water textures in hl1 has info about fog color and alpha
|
||||
size_t size; // for bounds checking
|
||||
} rgbdata_t;
|
||||
|
||||
@@ -16,11 +16,9 @@ GNU General Public License for more details.
|
||||
#ifndef COM_MODEL_H
|
||||
#define COM_MODEL_H
|
||||
|
||||
#include "xash3d_types.h"
|
||||
#include "bspfile.h" // we need some declarations from it
|
||||
|
||||
typedef vec_t vec2_t[2];
|
||||
typedef vec_t vec4_t[4];
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
@@ -232,7 +230,7 @@ typedef struct mextrasurf_s
|
||||
int reserved[32]; // just for future expansions or mod-makers
|
||||
} mextrasurf_t;
|
||||
|
||||
typedef struct msurface_s
|
||||
struct msurface_s
|
||||
{
|
||||
int visframe; // should be drawn when node is crossed
|
||||
|
||||
@@ -264,7 +262,7 @@ typedef struct msurface_s
|
||||
|
||||
color24 *samples; // note: this is the actual lightmap data for this surface
|
||||
decal_t *pdecals;
|
||||
} msurface_t;
|
||||
};
|
||||
|
||||
typedef struct hull_s
|
||||
{
|
||||
@@ -504,4 +502,36 @@ typedef struct
|
||||
maliasframedesc_t frames[1]; // variable sized
|
||||
} aliashdr_t;
|
||||
|
||||
#endif//COM_MODEL_H
|
||||
|
||||
|
||||
// remapping info
|
||||
#define SUIT_HUE_START 192
|
||||
#define SUIT_HUE_END 223
|
||||
#define PLATE_HUE_START 160
|
||||
#define PLATE_HUE_END 191
|
||||
|
||||
#define SHIRT_HUE_START 16
|
||||
#define SHIRT_HUE_END 32
|
||||
#define PANTS_HUE_START 96
|
||||
#define PANTS_HUE_END 112
|
||||
|
||||
|
||||
// 1/32 epsilon to keep floating point happy
|
||||
#define DIST_EPSILON (1.0f / 32.0f)
|
||||
#define FRAC_EPSILON (1.0f / 1024.0f)
|
||||
#define BACKFACE_EPSILON 0.01f
|
||||
#define MAX_BOX_LEAFS 256
|
||||
#define ANIM_CYCLE 2
|
||||
#define MOD_FRAMES 20
|
||||
|
||||
|
||||
|
||||
#define MAX_DEMOS 32
|
||||
#define MAX_MOVIES 8
|
||||
#define MAX_CDTRACKS 32
|
||||
#define MAX_CLIENT_SPRITES 256 // SpriteTextures
|
||||
#define MAX_EFRAGS 8192 // Arcane Dimensions required
|
||||
#define MAX_REQUESTS 64
|
||||
|
||||
|
||||
#endif//COM_MODEL_H
|
||||
|
||||
@@ -22,4 +22,4 @@ typedef struct con_nprint_s
|
||||
float color[3]; // RGB colors ( 0.0 -> 1.0 scale )
|
||||
} con_nprint_t;
|
||||
|
||||
#endif//CON_NPRINT_H
|
||||
#endif//CON_NPRINT_H
|
||||
|
||||
@@ -729,20 +729,11 @@ enum
|
||||
typedef int func_t;
|
||||
typedef int string_t;
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
|
||||
#include "xash3d_types.h"
|
||||
#define Q_isspace( ch ) (ch < 32 || ch > 255)
|
||||
|
||||
#undef true
|
||||
#undef false
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef enum { false, true } qboolean;
|
||||
#else
|
||||
typedef int qboolean;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte r, g, b;
|
||||
@@ -778,4 +769,4 @@ typedef struct
|
||||
int hitgroup; // 0 == generic, non zero is specific body part
|
||||
} trace_t;
|
||||
|
||||
#endif//CONST_H
|
||||
#endif//CONST_H
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#define FCVAR_MOVEVARS (1<<10) // this cvar is a part of movevars_t struct that shared between client and server
|
||||
#define FCVAR_LATCH (1<<11) // notify client what this cvar will be applied only after server restart (but don't does more nothing)
|
||||
#define FCVAR_GLCONFIG (1<<12) // write it into opengl.cfg
|
||||
#define FCVAR_GLCONFIG (1<<12) // write it into <renderer>.cfg(see RefAPI)
|
||||
#define FCVAR_CHANGED (1<<13) // set each time the cvar is changed
|
||||
#define FCVAR_GAMEUIDLL (1<<14) // defined by the menu DLL
|
||||
#define FCVAR_CHEAT (1<<15) // can not be changed if cheats are disabled
|
||||
@@ -42,4 +42,4 @@ typedef struct cvar_s
|
||||
struct cvar_s *next;
|
||||
} cvar_t;
|
||||
|
||||
#endif//CVARDEF_H
|
||||
#endif//CVARDEF_H
|
||||
|
||||
184
common/defaults.h
Normal file
184
common/defaults.h
Normal file
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
defaults.h - set up default configuration
|
||||
Copyright (C) 2016 Mittorn
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef DEFAULTS_H
|
||||
#define DEFAULTS_H
|
||||
|
||||
#include "backends.h"
|
||||
#include "build.h"
|
||||
|
||||
/*
|
||||
===================================================================
|
||||
|
||||
SETUP BACKENDS DEFINITIONS
|
||||
|
||||
===================================================================
|
||||
*/
|
||||
#if !XASH_DEDICATED
|
||||
#if XASH_SDL
|
||||
// we are building using libSDL
|
||||
#ifndef XASH_VIDEO
|
||||
#define XASH_VIDEO VIDEO_SDL
|
||||
#endif // XASH_VIDEO
|
||||
|
||||
#ifndef XASH_INPUT
|
||||
#define XASH_INPUT INPUT_SDL
|
||||
#endif // XASH_INPUT
|
||||
|
||||
#ifndef XASH_SOUND
|
||||
#define XASH_SOUND SOUND_SDL
|
||||
#endif // XASH_SOUND
|
||||
|
||||
#if XASH_SDL == 2
|
||||
#ifndef XASH_TIMER
|
||||
#define XASH_TIMER TIMER_SDL
|
||||
#endif // XASH_TIMER
|
||||
|
||||
#ifndef XASH_MESSAGEBOX
|
||||
#define XASH_MESSAGEBOX MSGBOX_SDL
|
||||
#endif // XASH_MESSAGEBOX
|
||||
#endif
|
||||
#elif XASH_ANDROID
|
||||
// we are building for Android platform, use Android APIs
|
||||
#ifndef XASH_VIDEO
|
||||
#define XASH_VIDEO VIDEO_ANDROID
|
||||
#endif // XASH_VIDEO
|
||||
|
||||
#ifndef XASH_INPUT
|
||||
#define XASH_INPUT INPUT_ANDROID
|
||||
#endif // XASH_INPUT
|
||||
|
||||
#ifndef XASH_SOUND
|
||||
#define XASH_SOUND SOUND_OPENSLES
|
||||
#endif // XASH_SOUND
|
||||
|
||||
#ifndef XASH_MESSAGEBOX
|
||||
#define XASH_MESSAGEBOX MSGBOX_ANDROID
|
||||
#endif // XASH_MESSAGEBOX
|
||||
|
||||
#define XASH_USE_EVDEV
|
||||
#elif XASH_LINUX
|
||||
// we are building for Linux without SDL2, can draw only to framebuffer yet
|
||||
#ifndef XASH_VIDEO
|
||||
#define XASH_VIDEO VIDEO_FBDEV
|
||||
#endif // XASH_VIDEO
|
||||
|
||||
#ifndef XASH_INPUT
|
||||
#define XASH_INPUT INPUT_EVDEV
|
||||
#endif // XASH_INPUT
|
||||
|
||||
#ifndef XASH_SOUND
|
||||
#define XASH_SOUND SOUND_ALSA
|
||||
#endif // XASH_SOUND
|
||||
|
||||
#define XASH_USE_EVDEV
|
||||
#endif // XASH_LINUX
|
||||
|
||||
#endif // XASH_DEDICATED
|
||||
|
||||
//
|
||||
// select messagebox implementation
|
||||
//
|
||||
#ifndef XASH_MESSAGEBOX
|
||||
#if XASH_WIN32
|
||||
#define XASH_MESSAGEBOX MSGBOX_WIN32
|
||||
#else // !XASH_WIN32
|
||||
#define XASH_MESSAGEBOX MSGBOX_STDERR
|
||||
#endif // !XASH_WIN32
|
||||
#endif // XASH_MESSAGEBOX
|
||||
|
||||
//
|
||||
// select crashhandler based on defines
|
||||
//
|
||||
#ifndef XASH_CRASHHANDLER
|
||||
#if XASH_WIN32 && defined(DBGHELP)
|
||||
#define XASH_CRASHHANDLER CRASHHANDLER_DBGHELP
|
||||
#elif XASH_LINUX || XASH_BSD
|
||||
#define XASH_CRASHHANDLER CRASHHANDLER_UCONTEXT
|
||||
#else // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
|
||||
#define XASH_CRASHHANDLER CRASHHANDLER_NULL
|
||||
#endif // !(XASH_LINUX || XASH_BSD || XASH_WIN32)
|
||||
#endif
|
||||
|
||||
//
|
||||
// no timer - no xash
|
||||
//
|
||||
#ifndef XASH_TIMER
|
||||
#if XASH_WIN32
|
||||
#define XASH_TIMER TIMER_WIN32
|
||||
#else // !XASH_WIN32
|
||||
#define XASH_TIMER TIMER_LINUX
|
||||
#endif // !XASH_WIN32
|
||||
#endif
|
||||
|
||||
//
|
||||
// fallback to NULL
|
||||
//
|
||||
#ifndef XASH_VIDEO
|
||||
#define XASH_VIDEO VIDEO_NULL
|
||||
#endif // XASH_VIDEO
|
||||
|
||||
#ifndef XASH_SOUND
|
||||
#define XASH_SOUND SOUND_NULL
|
||||
#endif // XASH_SOUND
|
||||
|
||||
#ifndef XASH_INPUT
|
||||
#define XASH_INPUT INPUT_NULL
|
||||
#endif // XASH_INPUT
|
||||
|
||||
/*
|
||||
=========================================================================
|
||||
|
||||
Default build-depended cvar and constant values
|
||||
|
||||
=========================================================================
|
||||
*/
|
||||
|
||||
#if XASH_MOBILE_PLATFORM
|
||||
#define DEFAULT_TOUCH_ENABLE "1"
|
||||
#define DEFAULT_M_IGNORE "1"
|
||||
#else // !XASH_MOBILE_PLATFORM
|
||||
#define DEFAULT_TOUCH_ENABLE "0"
|
||||
#define DEFAULT_M_IGNORE "0"
|
||||
#endif // !XASH_MOBILE_PLATFORM
|
||||
|
||||
#if XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN
|
||||
#define XASH_INTERNAL_GAMELIBS
|
||||
// this means that libraries are provided with engine, but not in game data
|
||||
// You need add library loading code to library.c when adding new platform
|
||||
#endif // XASH_ANDROID || XASH_IOS || XASH_EMSCRIPTEN
|
||||
|
||||
// allow override for developer/debug builds
|
||||
#ifndef DEFAULT_DEV
|
||||
#define DEFAULT_DEV 0
|
||||
#endif // DEFAULT_DEV
|
||||
|
||||
#ifndef DEFAULT_FULLSCREEN
|
||||
#define DEFAULT_FULLSCREEN 1
|
||||
#endif // DEFAULT_FULLSCREEN
|
||||
|
||||
#ifndef DEFAULT_ACCELERATED_RENDERER
|
||||
#if XASH_MOBILE_PLATFORM
|
||||
#define DEFAULT_ACCELERATED_RENDERER "gles1"
|
||||
#else // !XASH_MOBILE_PLATFORM
|
||||
#define DEFAULT_ACCELERATED_RENDERER "gl"
|
||||
#endif // !XASH_MOBILE_PLATFORM
|
||||
#endif // DEFAULT_ACCELERATED_RENDERER
|
||||
|
||||
#ifndef DEFAULT_SOFTWARE_RENDERER
|
||||
#define DEFAULT_SOFTWARE_RENDERER "soft" // mittorn's ref_soft
|
||||
#endif // DEFAULT_SOFTWARE_RENDERER
|
||||
|
||||
#endif // DEFAULTS_H
|
||||
@@ -24,4 +24,4 @@ typedef struct demo_api_s
|
||||
void (*WriteBuffer)( int size, unsigned char *buffer );
|
||||
} demo_api_t;
|
||||
|
||||
#endif//DEMO_API_H
|
||||
#endif//DEMO_API_H
|
||||
|
||||
@@ -28,4 +28,4 @@ typedef struct dlight_s
|
||||
qboolean dark; // subtracts light instead of adding
|
||||
} dlight_t;
|
||||
|
||||
#endif//DLIGHT_H
|
||||
#endif//DLIGHT_H
|
||||
|
||||
@@ -26,4 +26,4 @@ GNU General Public License for more details.
|
||||
#define ENGINE_IMPROVED_LINETRACE (1<<6) // new traceline that tracing through alphatextures
|
||||
#define ENGINE_COMPUTE_STUDIO_LERP (1<<7) // enable MOVETYPE_STEP lerping back in engine
|
||||
|
||||
#endif//FEATURES_H
|
||||
#endif//FEATURES_H
|
||||
@@ -28,7 +28,7 @@ struct entity_state_s
|
||||
// Fields which are filled in by routines outside of delta compression
|
||||
int entityType;
|
||||
// Index into cl_entities array for this entity.
|
||||
int number;
|
||||
int number;
|
||||
float msg_time;
|
||||
|
||||
// Message number last time the player/entity state was updated.
|
||||
@@ -71,7 +71,7 @@ struct entity_state_s
|
||||
int owner;
|
||||
|
||||
// Friction, for prediction.
|
||||
float friction;
|
||||
float friction;
|
||||
// Gravity multiplier
|
||||
float gravity;
|
||||
|
||||
@@ -87,7 +87,7 @@ struct entity_state_s
|
||||
// Use the crouched hull, or the regular player hull.
|
||||
int usehull;
|
||||
// Latched buttons last time state updated.
|
||||
int oldbuttons;
|
||||
int oldbuttons;
|
||||
// -1 = in air, else pmove entity number
|
||||
int onground;
|
||||
int iStepLeft;
|
||||
@@ -185,4 +185,4 @@ typedef struct local_state_s
|
||||
weapon_data_t weapondata[MAX_LOCAL_WEAPONS];
|
||||
} local_state_t;
|
||||
|
||||
#endif//ENTITY_STATE_H
|
||||
#endif//ENTITY_STATE_H
|
||||
|
||||
@@ -22,4 +22,4 @@
|
||||
#define ET_BEAM 3
|
||||
#define ET_FRAGMENTED 4 // BMODEL or SPRITE that was split across BSP nodes
|
||||
|
||||
#endif//ENTITY_TYPES_H
|
||||
#endif//ENTITY_TYPES_H
|
||||
|
||||
@@ -55,4 +55,4 @@ typedef struct event_api_s
|
||||
void ( *EV_PopTraceBounds)( void );
|
||||
} event_api_t;
|
||||
|
||||
#endif//EVENT_API_H
|
||||
#endif//EVENT_API_H
|
||||
|
||||
@@ -44,4 +44,4 @@ typedef struct event_args_s
|
||||
int bparam2;
|
||||
} event_args_t;
|
||||
|
||||
#endif//EVENT_ARGS_H
|
||||
#endif//EVENT_ARGS_H
|
||||
|
||||
@@ -42,4 +42,4 @@
|
||||
// Only issue event client side ( from shared code )
|
||||
#define FEV_CLIENT (1<<6)
|
||||
|
||||
#endif//EVENT_FLAGS_H
|
||||
#endif//EVENT_FLAGS_H
|
||||
|
||||
@@ -47,4 +47,4 @@ typedef struct
|
||||
int gamemode;
|
||||
} GAMEINFO;
|
||||
|
||||
#endif//GAMEINFO_H
|
||||
#endif//GAMEINFO_H
|
||||
|
||||
@@ -56,4 +56,4 @@
|
||||
#define MAX_DIRECTOR_CMD_PARAMETERS 4
|
||||
#define MAX_DIRECTOR_CMD_STRING 128
|
||||
|
||||
#endif//HLTV_H
|
||||
#endif//HLTV_H
|
||||
|
||||
@@ -35,4 +35,4 @@ typedef struct IVoiceTweak_s
|
||||
float (*GetControlFloat)( VoiceTweakControl iControl );
|
||||
} IVoiceTweak;
|
||||
|
||||
#endif//IVOICETWEAK_H
|
||||
#endif//IVOICETWEAK_H
|
||||
|
||||
18
common/kbutton.h
Normal file
18
common/kbutton.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//========= Copyright <20> 1996-2002, Valve LLC, All rights reserved. ============
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================
|
||||
|
||||
#if !defined( KBUTTONH )
|
||||
#define KBUTTONH
|
||||
#pragma once
|
||||
|
||||
typedef struct kbutton_s
|
||||
{
|
||||
int down[2]; // key nums holding it down
|
||||
int state; // low bit is down state
|
||||
} kbutton_t;
|
||||
|
||||
#endif // !KBUTTONH
|
||||
@@ -26,4 +26,4 @@ typedef struct
|
||||
float time; // local time is gurantee what new style begins from the start, not mid or end of the sequence
|
||||
} lightstyle_t;
|
||||
|
||||
#endif//LIGHTSTYLE_H
|
||||
#endif//LIGHTSTYLE_H
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
// kill the request hook after receiving the first response
|
||||
#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
|
||||
|
||||
struct net_response_s;
|
||||
typedef void (*net_api_response_func_t) ( struct net_response_s *response );
|
||||
|
||||
#define NET_SUCCESS ( 0 )
|
||||
@@ -94,4 +95,4 @@ typedef struct net_api_s
|
||||
void (*SetValueForKey)( char *s, const char *key, const char *value, int maxsize );
|
||||
} net_api_t;
|
||||
|
||||
#endif//NET_APIH
|
||||
#endif//NET_APIH
|
||||
|
||||
@@ -34,4 +34,4 @@ typedef struct netadr_s
|
||||
unsigned short port;
|
||||
} netadr_t;
|
||||
|
||||
#endif//NETADR_H
|
||||
#endif//NETADR_H
|
||||
|
||||
@@ -50,4 +50,4 @@ typedef struct particle_s
|
||||
unsigned char context;
|
||||
} particle_t;
|
||||
|
||||
#endif//PARTICLEDEF_H
|
||||
#endif//PARTICLEDEF_H
|
||||
|
||||
@@ -38,4 +38,4 @@ struct pmtrace_s
|
||||
int hitgroup;
|
||||
};
|
||||
|
||||
#endif//PM_TRACE_H
|
||||
#endif//PM_TRACE_H
|
||||
|
||||
141
common/port.h
Normal file
141
common/port.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
port.h -- Portability Layer for Windows types
|
||||
Copyright (C) 2015 Alibek Omarov
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef PORT_H
|
||||
#define PORT_H
|
||||
|
||||
#include "build.h"
|
||||
|
||||
#if !XASH_WIN32
|
||||
#include <dlfcn.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define PATH_SPLITTER "/"
|
||||
|
||||
#if XASH_APPLE
|
||||
#include <sys/syslimits.h>
|
||||
#include "TargetConditionals.h"
|
||||
#define OS_LIB_EXT "dylib"
|
||||
#define OPEN_COMMAND "open"
|
||||
#else
|
||||
#define OS_LIB_EXT "so"
|
||||
#define OPEN_COMMAND "xdg-open"
|
||||
#endif
|
||||
|
||||
#define OS_LIB_PREFIX "lib"
|
||||
|
||||
#if XASH_ANDROID
|
||||
//#if defined(LOAD_HARDFP)
|
||||
// #define POSTFIX "_hardfp"
|
||||
//#else
|
||||
#define POSTFIX
|
||||
//#endif
|
||||
#else
|
||||
#endif
|
||||
|
||||
#define VGUI_SUPPORT_DLL "libvgui_support." OS_LIB_EXT
|
||||
|
||||
// Windows-specific
|
||||
#define __cdecl
|
||||
#define __stdcall
|
||||
|
||||
#define _inline static inline
|
||||
#define FORCEINLINE inline __attribute__((always_inline))
|
||||
#define O_BINARY 0 // O_BINARY is Windows extension
|
||||
#define O_TEXT 0 // O_TEXT is Windows extension
|
||||
|
||||
// Windows functions to Linux equivalent
|
||||
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
|
||||
#define LoadLibrary( x ) dlopen( x, RTLD_NOW )
|
||||
#define GetProcAddress( x, y ) dlsym( x, y )
|
||||
#define SetCurrentDirectory( x ) (!chdir( x ))
|
||||
#define FreeLibrary( x ) dlclose( x )
|
||||
//#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))
|
||||
#define max( a, b ) (((a) > (b)) ? (a) : (b))
|
||||
#define min( a, b ) (((a) < (b)) ? (a) : (b))
|
||||
#define tell( a ) lseek(a, 0, SEEK_CUR)
|
||||
|
||||
typedef unsigned char BYTE;
|
||||
typedef short int WORD;
|
||||
typedef unsigned int DWORD;
|
||||
typedef int LONG;
|
||||
typedef unsigned int ULONG;
|
||||
typedef int WPARAM;
|
||||
typedef unsigned int LPARAM;
|
||||
|
||||
typedef void* HANDLE;
|
||||
typedef void* HMODULE;
|
||||
typedef void* HINSTANCE;
|
||||
|
||||
typedef char* LPSTR;
|
||||
|
||||
typedef struct tagPOINT
|
||||
{
|
||||
int x, y;
|
||||
} POINT;
|
||||
#else // WIN32
|
||||
#define PATH_SPLITTER "\\"
|
||||
#ifdef __MINGW32__
|
||||
#define _inline static inline
|
||||
#define FORCEINLINE inline __attribute__((always_inline))
|
||||
#else
|
||||
#define FORCEINLINE __forceinline
|
||||
#endif
|
||||
|
||||
#define open _open
|
||||
#define read _read
|
||||
#define alloca _alloca
|
||||
|
||||
// shut-up compiler warnings
|
||||
#pragma warning(disable : 4244) // MIPS
|
||||
#pragma warning(disable : 4018) // signed/unsigned mismatch
|
||||
#pragma warning(disable : 4305) // truncation from const double to float
|
||||
#pragma warning(disable : 4115) // named type definition in parentheses
|
||||
#pragma warning(disable : 4100) // unreferenced formal parameter
|
||||
#pragma warning(disable : 4127) // conditional expression is constant
|
||||
#pragma warning(disable : 4057) // differs in indirection to slightly different base types
|
||||
#pragma warning(disable : 4201) // nonstandard extension used
|
||||
#pragma warning(disable : 4706) // assignment within conditional expression
|
||||
#pragma warning(disable : 4054) // type cast' : from function pointer
|
||||
#pragma warning(disable : 4310) // cast truncates constant value
|
||||
|
||||
#define HSPRITE WINAPI_HSPRITE
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#undef HSPRITE
|
||||
|
||||
#define OS_LIB_PREFIX ""
|
||||
#define OS_LIB_EXT "dll"
|
||||
#define VGUI_SUPPORT_DLL "../vgui_support." OS_LIB_EXT
|
||||
#ifdef XASH_64BIT
|
||||
// windows NameForFunction not implemented yet
|
||||
#define XASH_ALLOW_SAVERESTORE_OFFSETS
|
||||
#endif
|
||||
#endif //WIN32
|
||||
#ifndef XASH_LOW_MEMORY
|
||||
#define XASH_LOW_MEMORY 0
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#if defined XASH_SDL && !defined REF_DLL
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#endif // PORT_H
|
||||
@@ -35,4 +35,4 @@ typedef struct qfont_s
|
||||
byte data[4];
|
||||
} qfont_t;
|
||||
|
||||
#endif//QFONT_H
|
||||
#endif//QFONT_H
|
||||
|
||||
@@ -84,7 +84,7 @@ color24 gTracerColors[] =
|
||||
#define FTENT_CLIENTCUSTOM 0x00080000 // Must specify callback. Callback function is responsible for killing tempent and updating fields ( unless other flags specify how to do things )
|
||||
#define FTENT_SCALE 0x00100000 // An experiment
|
||||
|
||||
typedef struct tempent_s TEMPENTITY;
|
||||
struct pmtrace_s;
|
||||
typedef struct tempent_s
|
||||
{
|
||||
int flags;
|
||||
@@ -98,7 +98,7 @@ typedef struct tempent_s
|
||||
int hitSound;
|
||||
void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr );
|
||||
void (*callback)( struct tempent_s *ent, float frametime, float currenttime );
|
||||
TEMPENTITY *next;
|
||||
struct tempent_s *next;
|
||||
int priority;
|
||||
short clientIndex; // if attached, this is the index of the client to stick to
|
||||
// if COLLIDEALL, this is the index of the client to ignore
|
||||
@@ -117,58 +117,58 @@ typedef struct efx_api_s efx_api_t;
|
||||
struct efx_api_s
|
||||
{
|
||||
particle_t *(*R_AllocParticle)( void (*callback)( struct particle_s *particle, float frametime ));
|
||||
void (*R_BlobExplosion)( float *org );
|
||||
void (*R_Blood)( float *org, float *dir, int pcolor, int speed );
|
||||
void (*R_BloodSprite)( float *org, int colorindex, int modelIndex, int modelIndex2, float size );
|
||||
void (*R_BloodStream)( float *org, float *dir, int pcolor, int speed );
|
||||
void (*R_BreakModel)( float *pos, float *size, float *dir, float random, float life, int count, int modelIndex, char flags );
|
||||
void (*R_Bubbles)( float *mins, float *maxs, float height, int modelIndex, int count, float speed );
|
||||
void (*R_BubbleTrail)( float *start, float *end, float height, int modelIndex, int count, float speed );
|
||||
void (*R_BulletImpactParticles)( float *pos );
|
||||
void (*R_BlobExplosion)( const float *org );
|
||||
void (*R_Blood)( const float *org, const float *dir, int pcolor, int speed );
|
||||
void (*R_BloodSprite)( const float *org, int colorindex, int modelIndex, int modelIndex2, float size );
|
||||
void (*R_BloodStream)( const float *org, const float *dir, int pcolor, int speed );
|
||||
void (*R_BreakModel)( const float *pos, const float *size, const float *dir, float random, float life, int count, int modelIndex, char flags );
|
||||
void (*R_Bubbles)( const float *mins, const float *maxs, float height, int modelIndex, int count, float speed );
|
||||
void (*R_BubbleTrail)( const float *start, const float *end, float height, int modelIndex, int count, float speed );
|
||||
void (*R_BulletImpactParticles)( const float *pos );
|
||||
void (*R_EntityParticles)( struct cl_entity_s *ent );
|
||||
void (*R_Explosion)( float *pos, int model, float scale, float framerate, int flags );
|
||||
void (*R_FizzEffect)( struct cl_entity_s *pent, int modelIndex, int density );
|
||||
void (*R_FireField)( float *org, int radius, int modelIndex, int count, int flags, float life );
|
||||
void (*R_FlickerParticles)( float *org );
|
||||
void (*R_FunnelSprite)( float *org, int modelIndex, int reverse );
|
||||
void (*R_Implosion)( float *end, float radius, int count, float life );
|
||||
void (*R_LargeFunnel)( float *org, int reverse );
|
||||
void (*R_LavaSplash)( float *org );
|
||||
void (*R_MultiGunshot)( float *org, float *dir, float *noise, int count, int decalCount, int *decalIndices );
|
||||
void (*R_MuzzleFlash)( float *pos1, int type );
|
||||
void (*R_ParticleBox)( float *mins, float *maxs, unsigned char r, unsigned char g, unsigned char b, float life );
|
||||
void (*R_ParticleBurst)( float *pos, int size, int color, float life );
|
||||
void (*R_ParticleExplosion)( float *org );
|
||||
void (*R_ParticleExplosion2)( float *org, int colorStart, int colorLength );
|
||||
void (*R_ParticleLine)( float *start, float *end, unsigned char r, unsigned char g, unsigned char b, float life );
|
||||
void (*R_FlickerParticles)( const float *org );
|
||||
void (*R_FunnelSprite)( const float *org, int modelIndex, int reverse );
|
||||
void (*R_Implosion)( const float *end, float radius, int count, float life );
|
||||
void (*R_LargeFunnel)( const float *org, int reverse );
|
||||
void (*R_LavaSplash)( const float *org );
|
||||
void (*R_MultiGunshot)( const float *org, const float *dir, const float *noise, int count, int decalCount, int *decalIndices );
|
||||
void (*R_MuzzleFlash)( const float *pos1, int type );
|
||||
void (*R_ParticleBox)( const float *mins, const float *maxs, unsigned char r, unsigned char g, unsigned char b, float life );
|
||||
void (*R_ParticleBurst)( const float *pos, int size, int color, float life );
|
||||
void (*R_ParticleExplosion)( const float *org );
|
||||
void (*R_ParticleExplosion2)( const float *org, int colorStart, int colorLength );
|
||||
void (*R_ParticleLine)( const float *start, const float *end, unsigned char r, unsigned char g, unsigned char b, float life );
|
||||
void (*R_PlayerSprites)( int client, int modelIndex, int count, int size );
|
||||
void (*R_Projectile)( float *origin, float *velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) );
|
||||
void (*R_RicochetSound)( float *pos );
|
||||
void (*R_RicochetSprite)( float *pos, struct model_s *pmodel, float duration, float scale );
|
||||
void (*R_RocketFlare)( float *pos );
|
||||
void (*R_Projectile)( const float *origin, const float *velocity, int modelIndex, int life, int owner, void (*hitcallback)( struct tempent_s *ent, struct pmtrace_s *ptr ) );
|
||||
void (*R_RicochetSound)( const float *pos );
|
||||
void (*R_RicochetSprite)( const float *pos, struct model_s *pmodel, float duration, float scale );
|
||||
void (*R_RocketFlare)( const float *pos );
|
||||
void (*R_RocketTrail)( float *start, float *end, int type );
|
||||
void (*R_RunParticleEffect)( float *org, float *dir, int color, int count );
|
||||
void (*R_ShowLine)( float *start, float *end );
|
||||
void (*R_SparkEffect)( float *pos, int count, int velocityMin, int velocityMax );
|
||||
void (*R_SparkShower)( float *pos );
|
||||
void (*R_SparkStreaks)( float *pos, int count, int velocityMin, int velocityMax );
|
||||
void (*R_Spray)( float *pos, float *dir, int modelIndex, int count, int speed, int spread, int rendermode );
|
||||
void (*R_RunParticleEffect)( const float *org, const float *dir, int color, int count );
|
||||
void (*R_ShowLine)( const float *start, const float *end );
|
||||
void (*R_SparkEffect)( const float *pos, int count, int velocityMin, int velocityMax );
|
||||
void (*R_SparkShower)( const float *pos );
|
||||
void (*R_SparkStreaks)( const float *pos, int count, int velocityMin, int velocityMax );
|
||||
void (*R_Spray)( const float *pos, const float *dir, int modelIndex, int count, int speed, int spread, int rendermode );
|
||||
void (*R_Sprite_Explode)( TEMPENTITY *pTemp, float scale, int flags );
|
||||
void (*R_Sprite_Smoke)( TEMPENTITY *pTemp, float scale );
|
||||
void (*R_Sprite_Spray)( float *pos, float *dir, int modelIndex, int count, int speed, int iRand );
|
||||
void (*R_Sprite_Spray)( const float *pos, const float *dir, int modelIndex, int count, int speed, int iRand );
|
||||
void (*R_Sprite_Trail)( int type, float *start, float *end, int modelIndex, int count, float life, float size, float amplitude, int renderamt, float speed );
|
||||
void (*R_Sprite_WallPuff)( TEMPENTITY *pTemp, float scale );
|
||||
void (*R_StreakSplash)( float *pos, float *dir, int color, int count, float speed, int velocityMin, int velocityMax );
|
||||
void (*R_TracerEffect)( float *start, float *end );
|
||||
void (*R_StreakSplash)( const float *pos, const float *dir, int color, int count, float speed, int velocityMin, int velocityMax );
|
||||
void (*R_TracerEffect)( const float *start, const float *end );
|
||||
void (*R_UserTracerParticle)( float *org, float *vel, float life, int colorIndex, float length, unsigned char deathcontext, void (*deathfunc)( struct particle_s *particle ));
|
||||
particle_t *(*R_TracerParticles)( float *org, float *vel, float life );
|
||||
void (*R_TeleportSplash)( float *org );
|
||||
void (*R_TempSphereModel)( float *pos, float speed, float life, int count, int modelIndex );
|
||||
TEMPENTITY *(*R_TempModel)( float *pos, float *dir, float *angles, float life, int modelIndex, int soundtype );
|
||||
TEMPENTITY *(*R_DefaultSprite)( float *pos, int spriteIndex, float framerate );
|
||||
TEMPENTITY *(*R_TempSprite)( float *pos, float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );
|
||||
void (*R_TeleportSplash)( const float *org );
|
||||
void (*R_TempSphereModel)( const float *pos, float speed, float life, int count, int modelIndex );
|
||||
TEMPENTITY *(*R_TempModel)( const float *pos, const float *dir, const float *angles, float life, int modelIndex, int soundtype );
|
||||
TEMPENTITY *(*R_DefaultSprite)( const float *pos, int spriteIndex, float framerate );
|
||||
TEMPENTITY *(*R_TempSprite)( float *pos, const float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );
|
||||
int (*Draw_DecalIndex)( int id );
|
||||
int (*Draw_DecalIndexFromName)( char *name );
|
||||
int (*Draw_DecalIndexFromName)( const char *name );
|
||||
void (*R_DecalShoot)( int textureIndex, int entity, int modelIndex, float *position, int flags );
|
||||
void (*R_AttachTentToPlayer)( int client, int modelIndex, float zoffset, float life );
|
||||
void (*R_KillAttachedTents)( int client );
|
||||
@@ -182,14 +182,14 @@ struct efx_api_s
|
||||
BEAM *(*R_BeamRing)( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
|
||||
dlight_t *(*CL_AllocDlight)( int key );
|
||||
dlight_t *(*CL_AllocElight)( int key );
|
||||
TEMPENTITY *(*CL_TempEntAlloc)( float *org, struct model_s *model );
|
||||
TEMPENTITY *(*CL_TempEntAllocNoModel)( float *org );
|
||||
TEMPENTITY *(*CL_TempEntAllocHigh)( float *org, struct model_s *model );
|
||||
TEMPENTITY *(*CL_TentEntAllocCustom)( float *origin, struct model_s *model, int high, void (*callback)( struct tempent_s *ent, float frametime, float currenttime ));
|
||||
TEMPENTITY *(*CL_TempEntAlloc)( const float *org, struct model_s *model );
|
||||
TEMPENTITY *(*CL_TempEntAllocNoModel)( const float *org );
|
||||
TEMPENTITY *(*CL_TempEntAllocHigh)( const float *org, struct model_s *model );
|
||||
TEMPENTITY *(*CL_TentEntAllocCustom)( const float *origin, struct model_s *model, int high, void (*callback)( struct tempent_s *ent, float frametime, float currenttime ));
|
||||
void (*R_GetPackedColor)( short *packed, short color );
|
||||
short (*R_LookupColor)( unsigned char r, unsigned char g, unsigned char b );
|
||||
void (*R_DecalRemoveAll)( int textureIndex ); // textureIndex points to the decal index in the array, not the actual texture index.
|
||||
void (*R_FireCustomDecal)( int textureIndex, int entity, int modelIndex, float *position, int flags, float scale );
|
||||
};
|
||||
|
||||
#endif//R_EFX_H
|
||||
#endif//R_EFX_H
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef struct engine_studio_api_s
|
||||
// Check to see if pointer is in the cache
|
||||
void *( *Cache_Check )( struct cache_user_s *c );
|
||||
// Load file into cache ( can be swapped out on demand )
|
||||
void ( *LoadCacheFile )( char *path, struct cache_user_s *cu );
|
||||
void ( *LoadCacheFile )( const char *path, struct cache_user_s *cu );
|
||||
// Retrieve model pointer for the named model
|
||||
struct model_s *( *Mod_ForName )( const char *name, int crash_if_missing );
|
||||
// Retrieve pointer to studio model data block from a model
|
||||
@@ -120,7 +120,7 @@ typedef struct server_studio_api_s
|
||||
// Check to see if pointer is in the cache
|
||||
void *( *Cache_Check )( struct cache_user_s *c );
|
||||
// Load file into cache ( can be swapped out on demand )
|
||||
void ( *LoadCacheFile )( char *path, struct cache_user_s *cu );
|
||||
void ( *LoadCacheFile )( const char *path, struct cache_user_s *cu );
|
||||
// Retrieve pointer to studio model data block from a model
|
||||
void *( *Mod_Extradata )( struct model_s *mod );
|
||||
} server_studio_api_t;
|
||||
@@ -151,4 +151,4 @@ typedef struct sv_blending_interface_s
|
||||
const edict_t *pEdict );
|
||||
} sv_blending_interface_t;
|
||||
|
||||
#endif//R_STUDIOINT_H
|
||||
#endif//R_STUDIOINT_H
|
||||
|
||||
@@ -102,4 +102,4 @@ typedef struct ref_viewpass_s
|
||||
int flags; // if !=0 nothing is drawn by the engine except clientDraw functions
|
||||
} ref_viewpass_t;
|
||||
|
||||
#endif//REF_PARAMS_H
|
||||
#endif//REF_PARAMS_H
|
||||
|
||||
@@ -120,6 +120,7 @@ typedef enum
|
||||
{
|
||||
GLES_WRAPPER_NONE = 0, // native GLES
|
||||
GLES_WRAPPER_NANOGL, // used on GLES platforms
|
||||
GLES_WRAPPER_WES, // used on GLES platforms
|
||||
} gles_wrapper_t;
|
||||
|
||||
// 30 bytes here
|
||||
@@ -152,6 +153,8 @@ typedef struct decallist_s
|
||||
modelstate_t studio_state; // studio decals only
|
||||
} decallist_t;
|
||||
|
||||
struct ref_viewpass_s;
|
||||
|
||||
typedef struct render_api_s
|
||||
{
|
||||
// Get renderer info (doesn't changes engine state at all)
|
||||
@@ -175,9 +178,9 @@ typedef struct render_api_s
|
||||
const char* (*GL_TextureName)( unsigned int texnum );
|
||||
const byte* (*GL_TextureData)( unsigned int texnum ); // may be NULL
|
||||
int (*GL_LoadTexture)( const char *name, const byte *buf, size_t size, int flags );
|
||||
int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, int flags );
|
||||
int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, texFlags_t flags );
|
||||
int (*GL_LoadTextureArray)( const char **names, int flags );
|
||||
int (*GL_CreateTextureArray)( const char *name, int width, int height, int depth, const void *buffer, int flags );
|
||||
int (*GL_CreateTextureArray)( const char *name, int width, int height, int depth, const void *buffer, texFlags_t flags );
|
||||
void (*GL_FreeTexture)( unsigned int texnum );
|
||||
|
||||
// Decals manipulating (draw & remove)
|
||||
@@ -219,7 +222,7 @@ typedef struct render_api_s
|
||||
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
|
||||
const struct ref_overview_s *( *GetOverviewParms )( void );
|
||||
const char *( *GetFileByIndex )( int fileindex );
|
||||
int (*pfnSaveFile)( const char *filename, const void *data, long len );
|
||||
int (*pfnSaveFile)( const char *filename, const void *data, int len );
|
||||
void (*R_Reserved0)( void );
|
||||
|
||||
// static allocations
|
||||
@@ -228,14 +231,15 @@ typedef struct render_api_s
|
||||
|
||||
// engine utils (not related with render API but placed here)
|
||||
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly );
|
||||
unsigned long (*pfnFileBufferCRC32)( const void *buffer, const int length );
|
||||
unsigned int (*pfnFileBufferCRC32)( const void *buffer, const int length );
|
||||
int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
|
||||
void (*Host_Error)( const char *error, ... ); // cause Host Error
|
||||
void* ( *pfnGetModel )( int modelindex );
|
||||
float (*pfnTime)( void ); // Sys_DoubleTime
|
||||
void (*Cvar_Set)( char *name, char *value );
|
||||
void (*Cvar_Set)( const char *name, const char *value );
|
||||
void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents)
|
||||
void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
|
||||
// a1ba: changed long to int
|
||||
void (*SetRandomSeed)( int lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
|
||||
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 37
|
||||
} render_api_t;
|
||||
|
||||
@@ -254,7 +258,7 @@ typedef struct render_interface_s
|
||||
// clear decals by engine request (e.g. for demo recording or vid_restart)
|
||||
void (*R_ClearStudioDecals)( void );
|
||||
// grab r_speeds message
|
||||
qboolean (*R_SpeedsMessage)( char *out, size_t size );
|
||||
qboolean (*R_SpeedsMessage)( char *out, size_t size );
|
||||
// alloc or destroy model custom data
|
||||
void (*Mod_ProcessUserData)( struct model_s *mod, qboolean create, const byte *buffer );
|
||||
// alloc or destroy entity custom data
|
||||
@@ -269,4 +273,4 @@ typedef struct render_interface_s
|
||||
void (*CL_UpdateLatchedVars)( struct cl_entity_s *e, qboolean reset );
|
||||
} render_interface_t;
|
||||
|
||||
#endif//RENDER_API_H
|
||||
#endif//RENDER_API_H
|
||||
|
||||
@@ -26,4 +26,4 @@ typedef struct screenfade_s
|
||||
int fadeFlags; // Fading flags
|
||||
} screenfade_t;
|
||||
|
||||
#endif//SCREENFADE_H
|
||||
#endif//SCREENFADE_H
|
||||
|
||||
@@ -24,4 +24,4 @@ typedef struct mstudioevent_s
|
||||
char options[64];
|
||||
} mstudioevent_t;
|
||||
|
||||
#endif//STUDIO_EVENT_H
|
||||
#endif//STUDIO_EVENT_H
|
||||
|
||||
@@ -44,14 +44,14 @@ typedef struct triangleapi_s
|
||||
void (*Color4f)( float r, float g, float b, float a );
|
||||
void (*Color4ub)( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
|
||||
void (*TexCoord2f)( float u, float v );
|
||||
void (*Vertex3fv)( float *worldPnt );
|
||||
void (*Vertex3fv)( const float *worldPnt );
|
||||
void (*Vertex3f)( float x, float y, float z );
|
||||
void (*Brightness)( float brightness );
|
||||
void (*CullFace)( TRICULLSTYLE style );
|
||||
int (*SpriteTexture)( struct model_s *pSpriteModel, int frame );
|
||||
int (*WorldToScreen)( float *world, float *screen ); // Returns 1 if it's z clipped
|
||||
int (*WorldToScreen)( const float *world, float *screen ); // Returns 1 if it's z clipped
|
||||
void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b.
|
||||
void (*ScreenToWorld)( float *screen, float *world );
|
||||
void (*ScreenToWorld)( const float *screen, float *world );
|
||||
void (*GetMatrix)( const int pname, float *matrix );
|
||||
int (*BoxInPVS)( float *mins, float *maxs );
|
||||
void (*LightAtPoint)( float *pos, float *value );
|
||||
@@ -59,4 +59,4 @@ typedef struct triangleapi_s
|
||||
void (*FogParams)( float flDensity, int iFogSkybox );
|
||||
} triangleapi_t;
|
||||
|
||||
#endif//TRIANGLEAPI_H
|
||||
#endif//TRIANGLEAPI_H
|
||||
|
||||
@@ -36,4 +36,4 @@ typedef struct usercmd_s
|
||||
vec3_t impact_position;
|
||||
} usercmd_t;
|
||||
|
||||
#endif//USERCMD_H
|
||||
#endif//USERCMD_H
|
||||
|
||||
@@ -83,4 +83,4 @@ typedef struct mip_s
|
||||
unsigned int offsets[4]; // four mip maps stored
|
||||
} mip_t;
|
||||
|
||||
#endif//WADFILE_H
|
||||
#endif//WADFILE_H
|
||||
|
||||
@@ -47,4 +47,4 @@ typedef struct weapon_data_s
|
||||
float fuser4;
|
||||
} weapon_data_t;
|
||||
|
||||
#endif//WEAPONINFO_H
|
||||
#endif//WEAPONINFO_H
|
||||
|
||||
@@ -21,4 +21,4 @@ typedef struct wrect_s
|
||||
int left, right, top, bottom;
|
||||
} wrect_t;
|
||||
|
||||
#endif//WRECT_H
|
||||
#endif//WRECT_H
|
||||
|
||||
156
common/xash3d_types.h
Normal file
156
common/xash3d_types.h
Normal file
@@ -0,0 +1,156 @@
|
||||
// basic typedefs
|
||||
#ifndef XASH_TYPES_H
|
||||
#define XASH_TYPES_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <wchar.h> // off_t
|
||||
#endif // _WIN32
|
||||
|
||||
#include <sys/types.h> // off_t
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef int sound_t;
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec2_t[2];
|
||||
typedef vec_t vec3_t[3];
|
||||
typedef vec_t vec4_t[4];
|
||||
typedef vec_t quat_t[4];
|
||||
typedef byte rgba_t[4]; // unsigned byte colorpack
|
||||
typedef byte rgb_t[3]; // unsigned byte colorpack
|
||||
typedef vec_t matrix3x4[3][4];
|
||||
typedef vec_t matrix4x4[4][4];
|
||||
|
||||
#undef true
|
||||
#undef false
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef enum { false, true } qboolean;
|
||||
#else
|
||||
typedef int qboolean;
|
||||
#endif
|
||||
|
||||
#if _MSC_VER == 1200
|
||||
typedef __int64 integer64; //msvc6
|
||||
#elif defined (XASH_SDL) && !defined(REF_DLL)
|
||||
typedef Uint64 integer64;
|
||||
#else
|
||||
typedef unsigned long long integer64;
|
||||
#endif
|
||||
typedef integer64 longtime_t;
|
||||
|
||||
#define MAX_STRING 256 // generic string
|
||||
#define MAX_INFO_STRING 256 // infostrings are transmitted across network
|
||||
#define MAX_SERVERINFO_STRING 512 // server handles too many settings. expand to 1024?
|
||||
#define MAX_LOCALINFO_STRING 32768 // localinfo used on server and not sended to the clients
|
||||
#define MAX_SYSPATH 1024 // system filepath
|
||||
#define MAX_PRINT_MSG 8192 // how many symbols can handle single call of Con_Printf or Con_DPrintf
|
||||
#define MAX_TOKEN 2048 // parse token length
|
||||
#define MAX_MODS 512 // environment games that engine can keep visible
|
||||
#define MAX_USERMSG_LENGTH 2048 // don't modify it's relies on a client-side definitions
|
||||
|
||||
#define BIT( n ) ( 1U << ( n ))
|
||||
#define GAMMA ( 2.2f ) // Valve Software gamma
|
||||
#define INVGAMMA ( 1.0f / 2.2f ) // back to 1.0
|
||||
#define TEXGAMMA ( 0.9f ) // compensate dim textures
|
||||
#define SetBits( iBitVector, bits ) ((iBitVector) = (iBitVector) | (bits))
|
||||
#define ClearBits( iBitVector, bits ) ((iBitVector) = (iBitVector) & ~(bits))
|
||||
#define FBitSet( iBitVector, bit ) ((iBitVector) & (bit))
|
||||
|
||||
#ifndef __cplusplus
|
||||
#ifdef NULL
|
||||
#undef NULL
|
||||
#endif
|
||||
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
// color strings
|
||||
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
|
||||
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#ifdef __i386__
|
||||
#define EXPORT __attribute__ ((visibility ("default"),force_align_arg_pointer))
|
||||
#define GAME_EXPORT __attribute((force_align_arg_pointer))
|
||||
#else
|
||||
#define EXPORT __attribute__ ((visibility ("default")))
|
||||
#define GAME_EXPORT
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#define EXPORT __declspec( dllexport )
|
||||
#define GAME_EXPORT
|
||||
#else
|
||||
#define EXPORT
|
||||
#define GAME_EXPORT
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef XASH_BIG_ENDIAN
|
||||
#define LittleLong(x) (((int)(((x)&255)<<24)) + ((int)((((x)>>8)&255)<<16)) + ((int)(((x)>>16)&255)<<8) + (((x) >> 24)&255))
|
||||
#define LittleLongSW(x) (x = LittleLong(x) )
|
||||
#define LittleShort(x) ((short)( (((short)(x) >> 8) & 255) + (((short)(x) & 255) << 8)))
|
||||
#define LittleShortSW(x) (x = LittleShort(x) )
|
||||
_inline float LittleFloat( float f )
|
||||
{
|
||||
union
|
||||
{
|
||||
float f;
|
||||
unsigned char b[4];
|
||||
} dat1, dat2;
|
||||
|
||||
dat1.f = f;
|
||||
dat2.b[0] = dat1.b[3];
|
||||
dat2.b[1] = dat1.b[2];
|
||||
dat2.b[2] = dat1.b[1];
|
||||
dat2.b[3] = dat1.b[0];
|
||||
|
||||
return dat2.f;
|
||||
}
|
||||
#else
|
||||
#define LittleLong(x) (x)
|
||||
#define LittleLongSW(x)
|
||||
#define LittleShort(x) (x)
|
||||
#define LittleShortSW(x)
|
||||
#define LittleFloat(x) (x)
|
||||
#endif
|
||||
|
||||
|
||||
typedef unsigned int dword;
|
||||
typedef unsigned int uint;
|
||||
typedef char string[MAX_STRING];
|
||||
typedef struct file_s file_t; // normal file
|
||||
typedef struct wfile_s wfile_t; // wad file
|
||||
typedef struct stream_s stream_t; // sound stream for background music playing
|
||||
typedef off_t fs_offset_t;
|
||||
|
||||
typedef struct dllfunc_s
|
||||
{
|
||||
const char *name;
|
||||
void **func;
|
||||
} dllfunc_t;
|
||||
|
||||
typedef struct dll_info_s
|
||||
{
|
||||
const char *name; // name of library
|
||||
const dllfunc_t *fcts; // list of dll exports
|
||||
qboolean crash; // crash if dll not found
|
||||
void *link; // hinstance of loading library
|
||||
} dll_info_t;
|
||||
|
||||
typedef void (*setpair_t)( const char *key, const void *value, void *buffer, void *numpairs );
|
||||
|
||||
// config strings are a general means of communication from
|
||||
// the server to all connected clients.
|
||||
// each config string can be at most CS_SIZE characters.
|
||||
#if XASH_LOW_MEMORY == 0
|
||||
#define MAX_QPATH 64 // max length of a game pathname
|
||||
#elif XASH_LOW_MEMORY == 2
|
||||
#define MAX_QPATH 32 // should be enough for singleplayer
|
||||
#elif XASH_LOW_MEMORY == 1
|
||||
#define MAX_QPATH 48
|
||||
#endif
|
||||
#define MAX_OSPATH 260 // max length of a filesystem pathname
|
||||
#define CS_SIZE 64 // size of one config string
|
||||
#define CS_TIME 16 // size of time string
|
||||
|
||||
#endif // XASH_TYPES_H
|
||||
206
contrib/mittorn/Makefile.linux
Normal file
206
contrib/mittorn/Makefile.linux
Normal file
@@ -0,0 +1,206 @@
|
||||
#############################################
|
||||
# Makefile.linux - linux makefile
|
||||
# Copyright (C) 2017 mittorn
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
##############################################
|
||||
|
||||
# Default options - optimized to debug on local machine
|
||||
CC ?= gcc
|
||||
CXX ?= g++
|
||||
CFLAGS ?= -g -O1 -fsigned-char -Wall -Wextra -Wsign-compare -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-but-set-variable
|
||||
LDFLAGS =
|
||||
LBITS := $(shell getconf LONG_BIT)
|
||||
DEPS :=
|
||||
|
||||
XASH_COMMIT := $(firstword $(shell git rev-parse --short=6 HEAD) unknown)
|
||||
|
||||
ifeq ($(XASH_COMMIT),unknown)
|
||||
$(warning You seems to build xash3d without git)
|
||||
$(warning Please use git if you are going to publish your build)
|
||||
endif
|
||||
|
||||
# Pass 64BIT=1 to make arguments to allow amd64 builds
|
||||
ifneq ($(64BIT),1)
|
||||
ifeq ($(LBITS),64)
|
||||
LDFLAGS += -m32
|
||||
CFLAGS += -m32
|
||||
endif
|
||||
endif
|
||||
|
||||
TOPDIR = $(PWD)/..
|
||||
INCLUDES :=
|
||||
XASH_SINGLE_BINARY ?= 1
|
||||
INSTALL_DIR ?= ./install/
|
||||
ifeq ($(NANOGL),1)
|
||||
INCLUDES += -Inanogl -Inanogl/GL
|
||||
endif
|
||||
INCLUDES += -I/usr/include/SDL2 -Icommon -I../common -I. -I../pm_shared -Iclient -Iserver -Iclient/vgui -Icommon/sdl
|
||||
|
||||
#############################
|
||||
# Preprocessor defines:
|
||||
#############################
|
||||
DEFINES =
|
||||
|
||||
# Specify commit hash in version string
|
||||
DEFINES += -DXASH_BUILD_COMMIT=\"$(XASH_COMMIT)\"
|
||||
|
||||
|
||||
# Only SDL backend exists on linux
|
||||
ifeq ($(XASH_DEDICATED),1)
|
||||
DEFINES += -DXASH_DEDICATED
|
||||
else
|
||||
DEFINES += -DXASH_SDL
|
||||
LIBS += -lSDL2
|
||||
endif
|
||||
|
||||
#############################################
|
||||
# GL/GLES translators.
|
||||
# You need clone it to engine folder to use
|
||||
# Only one translator should be enabled
|
||||
#############################################
|
||||
ifeq ($(NANOGL),1)
|
||||
DEFINES += -DXASH_NANOGL -D__MULTITEXTURE_SUPPORT__ -DEGL_LIB=\"libEGL.so\"
|
||||
endif
|
||||
|
||||
ifeq ($(WES),1)
|
||||
DEFINES += -DXASH_WES -D__MULTITEXTURE_SUPPORT__ -DEGL_LIB=\"libEGL.so\"
|
||||
endif
|
||||
|
||||
ifeq ($(REGAL),1)
|
||||
DEFINES += -DXASH_REGAL -D__MULTITEXTURE_SUPPORT__ -DEGL_LIB=\"regal/lib/linux-32/libRegal.so\"
|
||||
LIBS += regal/lib/linux-32/libRegal.so
|
||||
endif
|
||||
|
||||
# Some libc implementations cannot use libdl in static builds, so disable it by default
|
||||
ifeq ($(XASH_STATIC),1)
|
||||
|
||||
ifneq ($(XASH_STATIC_LIBDL),1)
|
||||
DEFINES += -DNO_LIBDL
|
||||
endif
|
||||
|
||||
XASH_SINGLE_BINARY := 1
|
||||
endif
|
||||
|
||||
ifneq ($(XASH_STATIC),1)
|
||||
LIBS += -ldl
|
||||
endif
|
||||
|
||||
ifeq ($(XASH_STATIC_LIBDL),1)
|
||||
LIBS += -ldl
|
||||
endif
|
||||
|
||||
LIBS += -lm -pthread
|
||||
|
||||
|
||||
ifeq ($(XASH_SINGLE_BINARY),1)
|
||||
DEFINES += -DSINGLE_BINARY
|
||||
endif
|
||||
|
||||
# Collect files
|
||||
SRCS_CPP =
|
||||
SRCS = $(wildcard server/*.c) $(wildcard client/vgui/*.c) $(wildcard client/avi/*.c) $(wildcard common/*.c) $(wildcard common/imagelib/*.c) $(wildcard common/soundlib/*.c) $(wildcard common/soundlib/libmpg/*.c)
|
||||
ifneq ($(XASH_DEDICATED),1)
|
||||
SRCS += $(wildcard client/*.c)
|
||||
SRCS += $(wildcard platform/sdl/*.c)
|
||||
ifeq ($(WES),1)
|
||||
SRCS += $(wildcard gl-wes-v2/src/*.c)
|
||||
endif
|
||||
ifeq ($(NANOGL),1)
|
||||
SRCS_CPP += $(wildcard nanogl/*.cpp)
|
||||
endif
|
||||
endif
|
||||
OBJS = $(patsubst %.c,obj/%.o,$(SRCS))
|
||||
OBJS_CPP = $(patsubst %.cpp,obj/%.o,$(SRCS_CPP))
|
||||
|
||||
#################################
|
||||
# Windows DLL loader
|
||||
# Should be enabled only on i386 builds
|
||||
#################################
|
||||
LOADER :=
|
||||
ifeq ($(XASH_DLL_LOADER),1)
|
||||
DEFINES += -DDLL_LOADER
|
||||
ifeq ($(XASH_SINGLE_BINARY),1)
|
||||
LOADER = libloader.a
|
||||
else
|
||||
LOADER = libloader.so
|
||||
endif
|
||||
DEPS += $(LOADER)
|
||||
LIBS += $(LOADER)
|
||||
endif
|
||||
|
||||
# Rules for binaries
|
||||
ifeq ($(XASH_SINGLE_BINARY),0)
|
||||
BINARIES = libxash.so
|
||||
libxash.so : $(OBJS) $(OBJS_CPP) $(DEPS)
|
||||
$(CC) -fvisibility=hidden -o libxash.so $(LDFLAGS) -shared $(OBJS) $(OBJS_CPP) $(LIBS)
|
||||
|
||||
else
|
||||
BINARIES = xash
|
||||
xash: $(OBJS) $(OBJS_CPP) $(DEPS)
|
||||
ifeq ($(XASH_STATIC),1)
|
||||
$(CC) -o xash -static $(LDFLAGS) $(OBJS) $(OBJS_CPP) $(LIBS)
|
||||
else
|
||||
$(CC) -o xash -fvisibility=hidden $(LDFLAGS) $(OBJS) $(OBJS_CPP) $(LIBS)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(XASH_DLL_LOADER),1)
|
||||
$(LOADER):
|
||||
$(MAKE) -f ../loader/Makefile.linux -C ../loader $(LOADER)
|
||||
cp ../loader/$(LOADER) .
|
||||
endif
|
||||
|
||||
# Create dirs for object files
|
||||
DIRS := obj obj/server obj/client/avi obj/client/vgui obj/common/sdl obj/common/imagelib obj/common/soundlib/libmpg obj/platform/sdl obj/nanogl
|
||||
$(OBJS): | $(DIRS)
|
||||
|
||||
$(DIRS) :
|
||||
mkdir -p $(DIRS)
|
||||
|
||||
# Object rules
|
||||
obj/%.o : %.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(DEFINES) -c "$<" -o "$@" -Wno-unused-result -fvisibility=hidden
|
||||
|
||||
obj/%.o : %.cpp
|
||||
$(CXX) $(CFLAGS) $(INCLUDES) $(DEFINES) -c "$<" -o "$@"
|
||||
|
||||
|
||||
default: $(BINARIES)
|
||||
|
||||
.PHONY: depend clean list install
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(OBJS_CPP) $(BINARIES) ../loader/*.o ../loader/*.a ../loader/*.so $(LOADER)
|
||||
|
||||
list:
|
||||
@echo Sources:
|
||||
@echo $(SRCS)
|
||||
@echo C++ Sources:
|
||||
@echo $(SRCS_CPP)
|
||||
@echo Objects:
|
||||
@echo $(OBJS) $(OBJS_CPP)
|
||||
@echo Dirs:
|
||||
@echo $(DIRS)
|
||||
@echo Dependencies:
|
||||
@echo $(DEPS)
|
||||
|
||||
# Simple install rule
|
||||
install: $(BINARIES)
|
||||
mkdir -p $(INSTALL_DIR)
|
||||
|
||||
ifeq ($(XASH_SINGLE_BINARY),1)
|
||||
cp xash $(INSTALL_DIR)/xash_bin
|
||||
else
|
||||
cp libxash.so $(INSTALL_DIR)/
|
||||
cp libloader.so $(INSTALL_DIR)/
|
||||
endif
|
||||
269
contrib/mittorn/README.md
Normal file
269
contrib/mittorn/README.md
Normal file
@@ -0,0 +1,269 @@
|
||||
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
|
||||
|
||||
- [Building](#building)
|
||||
- [Manual build (without CMake)](#manual-build-without-cmake)
|
||||
- [Building Engine](#building-engine)
|
||||
- [Building launch binary](#building-launch-binary)
|
||||
- [Building on Windows](#building-on-windows)
|
||||
- [Visual Studio 2013 (recommended for Windows)](#visual-studio-2013-recommended-for-windows)
|
||||
- [Visual Studio 6](#visual-studio-6)
|
||||
- [MinGW](#mingw)
|
||||
- [Building Game mods](#building-game-mods)
|
||||
- [Linux](#linux)
|
||||
- [microndk](#microndk)
|
||||
- [Makefile.linux](#makefile-linux)
|
||||
- [Windows](#windows)
|
||||
- [Running](#running)
|
||||
- [Manual running](#manual-running)
|
||||
- [Running with GDB](#running-with-gdb)
|
||||
- [Using DLL Loader](#using-dll-loader)
|
||||
- [Running MinGW builds](#running-mingw-builds)
|
||||
- [Running MinGW builds under GDB](#running-mingw-builds-under-gdb)
|
||||
|
||||
# Building
|
||||
|
||||
## Manual build (without CMake)
|
||||
|
||||
### Building engine
|
||||
|
||||
Clone Xash3D repository using git:
|
||||
|
||||
git clone https://github.com/FWGS/xash3d
|
||||
|
||||
Move to the Xash3D folder:
|
||||
|
||||
cd xash3d/engine
|
||||
|
||||
make -f Makefile.linux XASH_VGUI=1
|
||||
|
||||
or same for dedicated
|
||||
|
||||
make -f Makefile.linux XASH_DEDICATED=1
|
||||
|
||||
To enable dll support on linux, build loader library:
|
||||
|
||||
cd ../loader
|
||||
make -f Makefile.linux libloader.so libloader.a
|
||||
cp libloader.so libloader.a ../engine/
|
||||
|
||||
And built engine with XASH_DLL_LOADER=1:
|
||||
|
||||
cd ../engine
|
||||
make -f Makefile.linux XASH_VGUI=1 XASH_SDL=1 XASH_DLL_LOADER=1
|
||||
|
||||
or same for dedicated server
|
||||
|
||||
cd ../engine
|
||||
make -f Makefile.linux XASH_DEDICATED=1 XASH_DLL_LOADER=1
|
||||
|
||||
### Building engine in separate library
|
||||
|
||||
Some old distros does not support hidden symbol visibility
|
||||
This results in crash when loading server library
|
||||
|
||||
Building launch binary
|
||||
|
||||
cd (xash3d)/game_launch
|
||||
gcc xash.c -o xash -ldl -lrt -lm
|
||||
|
||||
Building engine library:
|
||||
|
||||
make -f Makefile.linux XASH_SINGLE_BINARY=0
|
||||
|
||||
## Building on Windows
|
||||
|
||||
### Visual Studio 2013 (recommended for Windows)
|
||||
|
||||
Download latest prebuilt SDL2 from
|
||||
|
||||
https://www.libsdl.org/release/SDL2-devel-2.0.4-VC.zip
|
||||
|
||||
Unzip and rename `SDL2-2.0.4` folder to `SDL2` and put it next to xash3d project folder.
|
||||
|
||||
..\xash3d\
|
||||
..\SDL2\
|
||||
|
||||
Open `xash.sln` with Visual Studio 2013 and make a build. After building, copy contents of `Debug` or
|
||||
`Release` folder to directory you choose. Copy `valve` folder and `vgui.dll` from your Half Life game
|
||||
installation folder and `SDL2.dll` form `\SDL2\lib\x86\` to it.
|
||||
Move `vgui_support.dll` into `valve` folder.
|
||||
|
||||
..\valve\
|
||||
..\valve\vgui_support.dll
|
||||
..\menu.dll
|
||||
..\SDL2.dll
|
||||
..\vgui.dll
|
||||
..\xash.dll
|
||||
..\xash.exe
|
||||
|
||||
Now you good to go, just run `xash.exe`.
|
||||
|
||||
### Visual Studio 6
|
||||
|
||||
This is legacy configuration, but msvc6 seems to generate more stable and more effective code
|
||||
|
||||
Setup your msvc6 enviroment, unpack SDL2-2.0.4 to xash3d folder and do:
|
||||
|
||||
cd (xash3d)\engine
|
||||
..\msvc6\build.bat
|
||||
cd (xash3d)\game_launch
|
||||
..\msvc6\build_launch.bat
|
||||
|
||||
### MinGW
|
||||
|
||||
The most effective configuration, but maybe unstable.
|
||||
Setup your MinGW environment and run:
|
||||
|
||||
cd (xash3d)\engine\
|
||||
CC=gcc mingw32-make -f Makefile.mingw
|
||||
|
||||
engine will be built to single exe binary
|
||||
|
||||
## Building game mods
|
||||
|
||||
### Linux
|
||||
|
||||
#### microndk
|
||||
|
||||
All mods that ported to android may be build to linux using Android.mk with microndk:
|
||||
|
||||
[https://github.com/SDLash3D/microndk]
|
||||
|
||||
Clone microndk repo somewhere, change xash3d_config to preffered configuration (change arch to x86
|
||||
for example)
|
||||
|
||||
Go to dlls folder if you are building server or cl_dlls if you are building client and do:
|
||||
|
||||
make -f /path/to/microndk/microndk.mk -j4
|
||||
|
||||
Do:
|
||||
|
||||
make -f /path/to/microndk/microndk.mk -j4 clean
|
||||
|
||||
every time when you build client after building server
|
||||
|
||||
#### Makefile.linux
|
||||
|
||||
### Windows
|
||||
|
||||
On windows common way is using Visual Studio as many mods does not correctly work with mingw.
|
||||
|
||||
Just open project and build it.
|
||||
|
||||
Other is using mingw and microndk, but it was not tested yet.
|
||||
|
||||
hlsdk-xash3d based mods may work fine with mingw.
|
||||
|
||||
You may use microndk to build it. Build process is very similar to linux one.
|
||||
|
||||
After setting up MinGW enviroment, do:<br>
|
||||
`mingw32-make -f \path\to\microndk\Microndk.mk`
|
||||
|
||||
to build 64-bit library, use:<br>
|
||||
`mingw32-make -f \path\to\microndk\Microndk.mk 64BIT=1`
|
||||
|
||||
Edit xash3d_config.mk to set optimal CFLAGS if you are running server
|
||||
|
||||
# Running
|
||||
|
||||
Copy **valve** folder from Half-Life:
|
||||
|
||||
cp -r $HOME/.steam/steam/steamapps/common/Half-Life/valve $HOME/Games/Xash3D
|
||||
|
||||
**NOTE**: If you build with CMake, you can now use `make install`. It will install binaries where
|
||||
they must be located. So just run `xash3d` from command line in directory where is gamedata is located.
|
||||
For additional info look to the CMakeLists.txt in repo root and xash3d.sh script.
|
||||
|
||||
After a successful build, copy the next files to some other directory where you want to run Xash3D:
|
||||
|
||||
cp engine/libxash.so game_launch/xash3d mainui/libxashmenu.so $HOME/Games/Xash3D
|
||||
|
||||
If you built it with XASH_VGUI, also copy vgui.so:
|
||||
|
||||
cp ../hlsdk/linux/vgui.so vgui_support/libvgui_support.so $HOME/Games/Xash3D
|
||||
|
||||
Copy script:
|
||||
|
||||
cp ../xash3d.sh $HOME/Games/Xash3D
|
||||
|
||||
Run:
|
||||
|
||||
cd $HOME/Games/Xash3D
|
||||
./xash3d.sh
|
||||
|
||||
## Manual running
|
||||
|
||||
Put xash3d binaries and vgui(optionally) to you game data directory and run:
|
||||
|
||||
LD_LIBRARY_PATH=. ./xash -dev 5
|
||||
|
||||
## Running under GDB
|
||||
|
||||
LD_LIBRARY_PATH=. gdb --args ./xash -dev 5
|
||||
|
||||
## Using DLL Loader
|
||||
|
||||
Put vgui_support.dll from windows build to your game data folder and run:
|
||||
|
||||
LD_LIBRARY_PATH=. ./xash -dev 5 -vguilib vgui.dll -clientlib valve/cl_dlls/client.dll -dll dlls/hl.dll
|
||||
|
||||
## Running MinGW builds
|
||||
|
||||
Put exe file to your game data directory
|
||||
|
||||
cd (game)\
|
||||
xash_bin -dev 5
|
||||
|
||||
### Running MinGW builds under GDB
|
||||
|
||||
gdb --args ./xash_bin.exe -dev 5
|
||||
|
||||
# Useful GDB commands
|
||||
|
||||
Start or restart process:
|
||||
|
||||
(gdb) r
|
||||
|
||||
Show backtrace:
|
||||
|
||||
(gdb) bt
|
||||
|
||||
Full backtrace:
|
||||
|
||||
(gdb) bt full
|
||||
|
||||
Continue execution:
|
||||
|
||||
(gdb) c
|
||||
|
||||
Recover from segmentation fault:
|
||||
|
||||
Skipping function:
|
||||
|
||||
(gdb) handle SIGSEGV nopass
|
||||
(gdb) ret
|
||||
(gdb) c
|
||||
|
||||
Restart frame for beginning:
|
||||
|
||||
(gdb) handle SIGSEGV nopass
|
||||
(gdb) jump *Host_AbortCurrentFrame
|
||||
Anti-Crash script (useful for scripting servers):
|
||||
```
|
||||
cd /path/to/rootdir
|
||||
file xash
|
||||
set args xash -dev 5 -nowcon
|
||||
handle SIGSEGV nopass
|
||||
catch signal SIGSEGV
|
||||
set $crashes=0
|
||||
commands
|
||||
print $crashes++
|
||||
if $crashes > 500
|
||||
set $crashes=0
|
||||
run
|
||||
else
|
||||
jump *Host_AbortCurrentFrame
|
||||
end
|
||||
end
|
||||
run
|
||||
```
|
||||
7
contrib/mittorn/setup.sh
Executable file
7
contrib/mittorn/setup.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
SCRIPTDIR=$(dirname "$0")
|
||||
TOPDIR=$SCRIPTDIR/../../
|
||||
cp $SCRIPTDIR/Makefile.dllloader $TOPDIR/loader/
|
||||
cp $SCRIPTDIR/Makefile.emscripten $TOPDIR/engine/
|
||||
cp $SCRIPTDIR/Makefile.linux $TOPDIR/engine/
|
||||
cp $SCRIPTDIR/wscript $TOPDIR/engine/
|
||||
73
contrib/mittorn/wscript
Normal file
73
contrib/mittorn/wscript
Normal file
@@ -0,0 +1,73 @@
|
||||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# mittorn, 2018
|
||||
|
||||
VERSION='0.99'
|
||||
APPNAME='xash3d-fwgs'
|
||||
|
||||
top = '.'
|
||||
|
||||
def options(opt):
|
||||
opt.load('compiler_c')
|
||||
# opt.load('msvs')
|
||||
opt.add_option('--dedicated', action = 'store_true', help = 'build dedicated server only' )
|
||||
opt.add_option('--64bits', dest = 'amd64', action = 'store_true', help = 'build 64-bit engine on x86_64' )
|
||||
|
||||
|
||||
|
||||
def configure(conf):
|
||||
conf.load('compiler_c')
|
||||
conf.env.append_unique('CFLAGS', '-O2')
|
||||
conf.env.append_unique('DEFINES', 'SINGLE_BINARY')
|
||||
conf.env.append_value('LINKFLAGS', '-ldl')
|
||||
conf.env.append_value('LINKFLAGS', '-lm')
|
||||
conf.env.append_value('LINKFLAGS', '-pthread')
|
||||
|
||||
# check for 64-bit builds
|
||||
# TODO: check 32-bit toolchain and dependencies
|
||||
if conf.env.DEST_CPU == 'x86_64' and not conf.options.amd64:
|
||||
conf.env.append_value('LINKFLAGS', '-m32')
|
||||
conf.env.append_value('CFLAGS', '-m32')
|
||||
print('NOTE: will build engine with 64-bit toolchain using -m32')
|
||||
else:
|
||||
print('Warning: 64bit engine may be unstable')
|
||||
|
||||
# check for dedicated server build
|
||||
if conf.options.dedicated:
|
||||
conf.env.append_unique('DEFINES', 'XASH_DEDICATED')
|
||||
conf.env.dedicated = True
|
||||
else:
|
||||
# TODO: add way to specify SDL2 path, move to separate function
|
||||
try:
|
||||
conf.check_cfg(path='sdl2-config', args='--cflags --libs', package='', msg='Checking for SDL2', uselib_store='SDL2')
|
||||
except conf.errors.ConfigurationError:
|
||||
conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated')
|
||||
conf.env.append_unique('DEFINES', 'XASH_SDL')
|
||||
|
||||
def build(bld):
|
||||
# basic build: dedicated only, no dependencies
|
||||
use = [];
|
||||
source = bld.path.ant_glob([
|
||||
'common/*.c',
|
||||
'common/imagelib/*.c',
|
||||
'common/soundlib/*.c',
|
||||
'common/soundlib/libmpg/*.c',
|
||||
'server/*.c'])
|
||||
|
||||
# add client files and sdl2 library
|
||||
if not bld.env.dedicated:
|
||||
use += ['SDL2']
|
||||
source += bld.path.ant_glob([
|
||||
'client/*.c',
|
||||
'client/vgui/*.c',
|
||||
'client/avi/*.c',
|
||||
'platform/sdl/*.c'])
|
||||
|
||||
|
||||
bld(
|
||||
target = 'xash',
|
||||
features = 'c cprogram',
|
||||
includes = ['../common', '../pm_shared', 'common', 'server', 'client', 'client/vgui', '.' ],
|
||||
source = source,
|
||||
use = use
|
||||
)
|
||||
@@ -135,4 +135,4 @@ typedef struct
|
||||
aliasskintype_t type;
|
||||
} daliasskintype_t;
|
||||
|
||||
#endif//ALIAS_H
|
||||
#endif//ALIAS_H
|
||||
|
||||
@@ -15,6 +15,14 @@ GNU General Public License for more details.
|
||||
#ifndef CDLL_EXP_H
|
||||
#define CDLL_EXP_H
|
||||
|
||||
struct tempent_s;
|
||||
struct usercmd_s;
|
||||
struct physent_s;
|
||||
struct playermove_s;
|
||||
struct mstudioevent_s;
|
||||
struct engine_studio_api_s;
|
||||
struct r_studio_interface_s;
|
||||
|
||||
// NOTE: ordering is important!
|
||||
typedef struct cldll_func_s
|
||||
{
|
||||
@@ -62,6 +70,10 @@ typedef struct cldll_func_s
|
||||
// Xash3D extension
|
||||
int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback );
|
||||
void (*pfnClipMoveToEntity)( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr );
|
||||
// Xash3D FWGS extension
|
||||
int (*pfnTouchEvent)( int type, int fingerID, float x, float y, float dx, float dy );
|
||||
void (*pfnMoveEvent)( float forwardmove, float sidemove );
|
||||
void (*pfnLookEvent)( float relyaw, float relpitch );
|
||||
} cldll_func_t;
|
||||
|
||||
#endif//CDLL_EXP_H
|
||||
#endif//CDLL_EXP_H
|
||||
|
||||
@@ -27,6 +27,16 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "const.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAX_ALIAS_NAME 32
|
||||
|
||||
typedef struct cmdalias_s
|
||||
{
|
||||
struct cmdalias_s *next;
|
||||
char name[MAX_ALIAS_NAME];
|
||||
char *value;
|
||||
} cmdalias_t;
|
||||
|
||||
// this file is included by both the engine and the client-dll,
|
||||
// so make sure engine declarations aren't done twice
|
||||
@@ -96,8 +106,14 @@ typedef struct hud_player_info_s
|
||||
char *model;
|
||||
short topcolor;
|
||||
short bottomcolor;
|
||||
|
||||
uint64_t m_nSteamID;
|
||||
} hud_player_info_t;
|
||||
|
||||
struct screenfade_s;
|
||||
struct tagPOINT;
|
||||
struct event_args_s;
|
||||
|
||||
typedef struct cl_enginefuncs_s
|
||||
{
|
||||
// sprite handlers
|
||||
@@ -119,20 +135,20 @@ typedef struct cl_enginefuncs_s
|
||||
void (*pfnSetCrosshair)( HSPRITE hspr, wrect_t rc, int r, int g, int b );
|
||||
|
||||
// cvar handlers
|
||||
struct cvar_s *(*pfnRegisterVariable)( char *szName, char *szValue, int flags );
|
||||
float (*pfnGetCvarFloat)( char *szName );
|
||||
char* (*pfnGetCvarString)( char *szName );
|
||||
struct cvar_s *(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags );
|
||||
float (*pfnGetCvarFloat)( const char *szName );
|
||||
const char* (*pfnGetCvarString)( const char *szName );
|
||||
|
||||
// command handlers
|
||||
int (*pfnAddCommand)( char *cmd_name, void (*function)(void) );
|
||||
int (*pfnHookUserMsg)( char *szMsgName, pfnUserMsgHook pfn );
|
||||
int (*pfnServerCmd)( char *szCmdString );
|
||||
int (*pfnClientCmd)( char *szCmdString );
|
||||
int (*pfnAddCommand)( const char *cmd_name, void (*function)(void) );
|
||||
int (*pfnHookUserMsg)( const char *szMsgName, pfnUserMsgHook pfn );
|
||||
int (*pfnServerCmd)( const char *szCmdString );
|
||||
int (*pfnClientCmd)( const char *szCmdString );
|
||||
|
||||
void (*pfnGetPlayerInfo)( int ent_num, hud_player_info_t *pinfo );
|
||||
|
||||
// sound handlers
|
||||
void (*pfnPlaySoundByName)( char *szSound, float volume );
|
||||
void (*pfnPlaySoundByName)( const char *szSound, float volume );
|
||||
void (*pfnPlaySoundByIndex)( int iSound, float volume );
|
||||
|
||||
// vector helpers
|
||||
@@ -154,14 +170,14 @@ typedef struct cl_enginefuncs_s
|
||||
void (*GetViewAngles)( float * );
|
||||
void (*SetViewAngles)( float * );
|
||||
int (*GetMaxClients)( void );
|
||||
void (*Cvar_SetValue)( char *cvar, float value );
|
||||
void (*Cvar_SetValue)( const char *cvar, float value );
|
||||
|
||||
int (*Cmd_Argc)( void );
|
||||
char *(*Cmd_Argv)( int arg );
|
||||
void (*Con_Printf)( char *fmt, ... );
|
||||
void (*Con_DPrintf)( char *fmt, ... );
|
||||
void (*Con_NPrintf)( int pos, char *fmt, ... );
|
||||
void (*Con_NXPrintf)( struct con_nprint_s *info, char *fmt, ... );
|
||||
int (*Cmd_Argc)( void );
|
||||
const char *(*Cmd_Argv)( int arg );
|
||||
void (*Con_Printf)( const char *fmt, ... );
|
||||
void (*Con_DPrintf)( const char *fmt, ... );
|
||||
void (*Con_NPrintf)( int pos, const char *fmt, ... );
|
||||
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... );
|
||||
|
||||
const char* (*PhysInfo_ValueForKey)( const char *key );
|
||||
const char* (*ServerInfo_ValueForKey)( const char *key );
|
||||
@@ -180,8 +196,8 @@ typedef struct cl_enginefuncs_s
|
||||
void (*V_CalcShake)( void );
|
||||
void (*V_ApplyShake)( float *origin, float *angles, float factor );
|
||||
|
||||
int (*PM_PointContents)( float *point, int *truecontents );
|
||||
int (*PM_WaterEntity)( float *p );
|
||||
int (*PM_PointContents)( const float *point, int *truecontents );
|
||||
int (*PM_WaterEntity)( const float *p );
|
||||
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||
|
||||
struct model_s *(*CL_LoadModel)( const char *modelname, int *index );
|
||||
@@ -194,19 +210,20 @@ typedef struct cl_enginefuncs_s
|
||||
void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
|
||||
void (*pfnWeaponAnim)( int iAnim, int body );
|
||||
float (*pfnRandomFloat)( float flLow, float flHigh );
|
||||
long (*pfnRandomLong)( long lLow, long lHigh );
|
||||
void (*pfnHookEvent)( char *name, void ( *pfnEvent )( struct event_args_s *args ));
|
||||
int (*Con_IsVisible) ();
|
||||
int (*pfnRandomLong)( int lLow, int lHigh );
|
||||
void (*pfnHookEvent)( const char *name, void ( *pfnEvent )( struct event_args_s *args ));
|
||||
|
||||
int (*Con_IsVisible) ( void );
|
||||
const char *(*pfnGetGameDirectory)( void );
|
||||
struct cvar_s *(*pfnGetCvarPointer)( const char *szName );
|
||||
const char *(*Key_LookupBinding)( const char *pBinding );
|
||||
const char *(*pfnGetLevelName)( void );
|
||||
void (*pfnGetScreenFade)( struct screenfade_s *fade );
|
||||
void (*pfnSetScreenFade)( struct screenfade_s *fade );
|
||||
void* (*VGui_GetPanel)( );
|
||||
void* (*VGui_GetPanel)( void );
|
||||
void (*VGui_ViewportPaintBackground)( int extents[4] );
|
||||
|
||||
byte* (*COM_LoadFile)( char *path, int usehunk, int *pLength );
|
||||
byte* (*COM_LoadFile)( const char *path, int usehunk, int *pLength );
|
||||
char* (*COM_ParseFile)( char *data, char *token );
|
||||
void (*COM_FreeFile)( void *buffer );
|
||||
|
||||
@@ -248,39 +265,47 @@ typedef struct cl_enginefuncs_s
|
||||
void (*pfnGetMousePos)( struct tagPOINT *ppt );
|
||||
void (*pfnSetMousePos)( int x, int y );
|
||||
void (*pfnSetMouseEnable)( qboolean fEnable );
|
||||
void (*pfnUnused1)( void );
|
||||
void (*pfnUnused2)( void );
|
||||
void (*pfnUnused3)( void );
|
||||
void (*pfnUnused4)( void );
|
||||
float (*pfnGetClientOldTime)( void );
|
||||
float (*pfnGetGravity)( void );
|
||||
struct model_s*(*pfnGetModelByIndex)( int index );
|
||||
void (*pfnUnused5)( void );
|
||||
void (*pfnUnused6)( void );
|
||||
void (*pfnUnused7)( void );
|
||||
void (*pfnUnused8)( void );
|
||||
void (*pfnUnused9)( void );
|
||||
void (*pfnUnused10)( void );
|
||||
void (*pfnUnused11)( void );
|
||||
void (*pfnUnused12)( void );
|
||||
const char*(*LocalPlayerInfo_ValueForKey)( const char* key );
|
||||
void (*pfnUnused13)( void );
|
||||
void (*pfnUnused14)( void );
|
||||
void (*pfnUnused15)( void );
|
||||
void (*pfnUnused16)( void );
|
||||
void (*Cvar_Set)( char *name, char *value );
|
||||
void (*pfnUnused17)( void );
|
||||
void (*pfnUnused18)( void );
|
||||
void (*pfnUnused19)( void );
|
||||
double (*pfnSys_FloatTime)( void );
|
||||
void (*pfnUnused20)( void );
|
||||
void (*pfnUnused21)( void );
|
||||
void (*pfnUnused22)( void );
|
||||
void (*pfnUnused23)( void );
|
||||
void (*pfnFillRGBABlend)( int x, int y, int width, int height, int r, int g, int b, int a );
|
||||
int (*pfnGetAppID)( void );
|
||||
void (*pfnUnused24)( void );
|
||||
void (*pfnUnused25)( void );
|
||||
|
||||
// undocumented interface starts here
|
||||
struct cvar_s* (*pfnGetFirstCvarPtr)( void );
|
||||
void* (*pfnGetFirstCmdFunctionHandle)( void );
|
||||
void* (*pfnGetNextCmdFunctionHandle)( void *cmdhandle );
|
||||
const char* (*pfnGetCmdFunctionName)( void *cmdhandle );
|
||||
float (*pfnGetClientOldTime)( void );
|
||||
float (*pfnGetGravity)( void );
|
||||
struct model_s* (*pfnGetModelByIndex)( int index );
|
||||
void (*pfnSetFilterMode)( int mode ); // same as gl_texsort in original Quake
|
||||
void (*pfnSetFilterColor)( float red, float green, float blue );
|
||||
void (*pfnSetFilterBrightness)( float brightness );
|
||||
void *(*pfnSequenceGet)( const char *fileName, const char *entryName );
|
||||
void (*pfnSPR_DrawGeneric)( int frame, int x, int y, const wrect_t *prc, int blendsrc, int blenddst, int width, int height );
|
||||
void *(*pfnSequencePickSentence)( const char *groupName, int pickMethod, int *entryPicked );
|
||||
int (*pfnDrawString)( int x, int y, const char *str, int r, int g, int b );
|
||||
int (*pfnDrawStringReverse)( int x, int y, const char *str, int r, int g, int b );
|
||||
const char *(*LocalPlayerInfo_ValueForKey)( const char* key );
|
||||
int (*pfnVGUI2DrawCharacter)( int x, int y, int ch, unsigned int font );
|
||||
int (*pfnVGUI2DrawCharacterAdditive)( int x, int y, int ch, int r, int g, int b, unsigned int font );
|
||||
unsigned int (*pfnGetApproxWavePlayLen)( char *filename );
|
||||
void* (*GetCareerGameUI)( void ); // g-cont. !!!! potential crash-point!
|
||||
void (*Cvar_Set)( char *name, char *value );
|
||||
int (*pfnIsPlayingCareerMatch)( void );
|
||||
void (*pfnPlaySoundVoiceByName)( char *szSound, float volume, int pitch );
|
||||
void (*pfnPrimeMusicStream)( char *filename, int looping );
|
||||
double (*pfnSys_FloatTime)( void );
|
||||
|
||||
// decay funcs
|
||||
void (*pfnProcessTutorMessageDecayBuffer)( int *buffer, int buflen );
|
||||
void (*pfnConstructTutorMessageDecayBuffer)( int *buffer, int buflen );
|
||||
void (*pfnResetTutorMessageDecayData)( void );
|
||||
|
||||
void (*pfnPlaySoundByNameAtPitch)( char *szSound, float volume, int pitch );
|
||||
void (*pfnFillRGBABlend)( int x, int y, int width, int height, int r, int g, int b, int a );
|
||||
int (*pfnGetAppID)( void );
|
||||
cmdalias_t *(*pfnGetAliases)( void );
|
||||
void (*pfnVguiWrap2_GetMouseDelta)( int *x, int *y );
|
||||
|
||||
// added in 2019 update, not documented yet
|
||||
int (*pfnFilteredClientCmd)( const char *cmd );
|
||||
} cl_enginefunc_t;
|
||||
|
||||
#define CLDLL_INTERFACE_VERSION 7
|
||||
@@ -289,4 +314,4 @@ typedef struct cl_enginefuncs_s
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//CDLL_INT_H
|
||||
#endif//CDLL_INT_H
|
||||
|
||||
38
engine/client/avi/avi.h
Normal file
38
engine/client/avi/avi.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
avi.h -- common avi support header
|
||||
Copyright (C) 2018 a1batross, Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
#ifndef AVI_H
|
||||
#define AVI_H
|
||||
|
||||
//
|
||||
// avikit.c
|
||||
//
|
||||
typedef struct movie_state_s movie_state_t;
|
||||
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time );
|
||||
byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame );
|
||||
qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration );
|
||||
qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info );
|
||||
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length );
|
||||
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, int quiet );
|
||||
movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio );
|
||||
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time );
|
||||
int AVI_GetVideoFrameCount( movie_state_t *Avi );
|
||||
void AVI_CloseVideo( movie_state_t *Avi );
|
||||
qboolean AVI_IsActive( movie_state_t *Avi );
|
||||
void AVI_FreeVideo( movie_state_t *Avi );
|
||||
movie_state_t *AVI_GetState( int num );
|
||||
qboolean AVI_Initailize( void );
|
||||
void AVI_Shutdown( void );
|
||||
|
||||
#endif // AVI_H
|
||||
95
engine/client/avi/avi_stub.c
Normal file
95
engine/client/avi/avi_stub.c
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
avi_stub.c - playing AVI files (stub)
|
||||
Copyright (C) 2018 a1batross
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "build.h"
|
||||
#if !XASH_WIN32
|
||||
#include "common.h"
|
||||
|
||||
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
byte *AVI_GetVideoFrame( movie_state_t *Avi, int frame )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, int quiet )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
movie_state_t *AVI_LoadVideo( const char *filename, qboolean load_audio )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AVI_GetVideoFrameCount( movie_state_t *Avi )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AVI_CloseVideo( movie_state_t *Avi )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
qboolean AVI_IsActive( movie_state_t *Avi )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AVI_FreeVideo( movie_state_t *Avi )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
movie_state_t *AVI_GetState( int num )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qboolean AVI_Initailize( void )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void AVI_Shutdown( void )
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
#endif // WIN32
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
avikit.c - playing AVI files (based on original AVIKit code)
|
||||
avi_win.c - playing AVI files (based on original AVIKit code, Win32 version)
|
||||
Copyright (C) 2010 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -13,9 +13,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "build.h"
|
||||
#if XASH_WIN32
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
#include <vfw.h> // video for windows
|
||||
|
||||
// msvfw32.dll exports
|
||||
@@ -251,7 +252,7 @@ qboolean AVI_ACMConvertAudio( movie_state_t *Avi )
|
||||
return true;
|
||||
}
|
||||
|
||||
qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration )
|
||||
qboolean AVI_GetVideoInfo( movie_state_t *Avi, int *xres, int *yres, float *duration )
|
||||
{
|
||||
if( !Avi->active )
|
||||
return false;
|
||||
@@ -269,7 +270,7 @@ qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *du
|
||||
}
|
||||
|
||||
// returns a unique frame identifier
|
||||
long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
|
||||
int AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
|
||||
{
|
||||
if( !Avi->active )
|
||||
return 0;
|
||||
@@ -277,7 +278,7 @@ long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time )
|
||||
return (time * Avi->video_fps);
|
||||
}
|
||||
|
||||
long AVI_GetVideoFrameCount( movie_state_t *Avi )
|
||||
int AVI_GetVideoFrameCount( movie_state_t *Avi )
|
||||
{
|
||||
if( !Avi->active )
|
||||
return 0;
|
||||
@@ -285,7 +286,7 @@ long AVI_GetVideoFrameCount( movie_state_t *Avi )
|
||||
return Avi->video_frames;
|
||||
}
|
||||
|
||||
long AVI_TimeToSoundPosition( movie_state_t *Avi, long time )
|
||||
int AVI_TimeToSoundPosition( movie_state_t *Avi, int time )
|
||||
{
|
||||
if( !Avi->active || !Avi->audio_stream )
|
||||
return 0;
|
||||
@@ -382,7 +383,7 @@ qboolean AVI_SeekPosition( movie_state_t *Avi, dword offset )
|
||||
}
|
||||
|
||||
// get a chunk of audio from the stream (in bytes)
|
||||
long AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length )
|
||||
int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int length )
|
||||
{
|
||||
long result = 0;
|
||||
int i;
|
||||
@@ -729,4 +730,5 @@ void AVI_Shutdown( void )
|
||||
Sys_FreeLibrary( &msvfw_dll );
|
||||
Sys_FreeLibrary( &msacm_dll );
|
||||
avi_initialized = false;
|
||||
}
|
||||
}
|
||||
#endif // _WIN32
|
||||
@@ -15,7 +15,6 @@ GNU General Public License for more details.
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
/*
|
||||
====================
|
||||
@@ -148,23 +147,13 @@ CL_ScreenshotGetName
|
||||
*/
|
||||
qboolean CL_ScreenshotGetName( int lastnum, char *filename )
|
||||
{
|
||||
int a, b, c, d;
|
||||
|
||||
if( lastnum < 0 || lastnum > 9999 )
|
||||
{
|
||||
Con_Printf( S_ERROR "unable to write screenshot\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
a = lastnum / 1000;
|
||||
lastnum -= a * 1000;
|
||||
b = lastnum / 100;
|
||||
lastnum -= b * 100;
|
||||
c = lastnum / 10;
|
||||
lastnum -= c * 10;
|
||||
d = lastnum;
|
||||
|
||||
Q_sprintf( filename, "scrshots/%s_shot%i%i%i%i.bmp", clgame.mapname, a, b, c, d );
|
||||
Q_sprintf( filename, "scrshots/%s_shot%0004d.png", clgame.mapname, lastnum );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -176,8 +165,6 @@ CL_SnapshotGetName
|
||||
*/
|
||||
qboolean CL_SnapshotGetName( int lastnum, char *filename )
|
||||
{
|
||||
int a, b, c, d;
|
||||
|
||||
if( lastnum < 0 || lastnum > 9999 )
|
||||
{
|
||||
Con_Printf( S_ERROR "unable to write snapshot\n" );
|
||||
@@ -185,15 +172,7 @@ qboolean CL_SnapshotGetName( int lastnum, char *filename )
|
||||
return false;
|
||||
}
|
||||
|
||||
a = lastnum / 1000;
|
||||
lastnum -= a * 1000;
|
||||
b = lastnum / 100;
|
||||
lastnum -= b * 100;
|
||||
c = lastnum / 10;
|
||||
lastnum -= c * 10;
|
||||
d = lastnum;
|
||||
|
||||
Q_sprintf( filename, "../%s_%i%i%i%i.bmp", clgame.mapname, a, b, c, d );
|
||||
Q_sprintf( filename, "../%s_%0004d.png", clgame.mapname, lastnum );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -344,7 +323,7 @@ void CL_LevelShot_f( void )
|
||||
// check for exist
|
||||
if( cls.demoplayback && ( cls.demonum != -1 ))
|
||||
{
|
||||
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", cls.demoname, glState.wideScreen ? "16x9" : "4x3" );
|
||||
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", cls.demoname, refState.wideScreen ? "16x9" : "4x3" );
|
||||
Q_snprintf( filename, sizeof( filename ), "%s.dem", cls.demoname );
|
||||
|
||||
// make sure what levelshot is newer than demo
|
||||
@@ -353,7 +332,7 @@ void CL_LevelShot_f( void )
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", clgame.mapname, glState.wideScreen ? "16x9" : "4x3" );
|
||||
Q_sprintf( cls.shotname, "levelshots/%s_%s.bmp", clgame.mapname, refState.wideScreen ? "16x9" : "4x3" );
|
||||
|
||||
// make sure what levelshot is newer than bsp
|
||||
ft1 = FS_FileTime( cl.worldmodel->name, false );
|
||||
@@ -424,53 +403,7 @@ void CL_SetSky_f( void )
|
||||
return;
|
||||
}
|
||||
|
||||
R_SetupSky( Cmd_Argv( 1 ));
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SCR_TimeRefresh_f
|
||||
|
||||
timerefresh [noflip]
|
||||
================
|
||||
*/
|
||||
void SCR_TimeRefresh_f( void )
|
||||
{
|
||||
int i;
|
||||
double start, stop;
|
||||
double time;
|
||||
|
||||
if( cls.state != ca_active )
|
||||
return;
|
||||
|
||||
start = Sys_DoubleTime();
|
||||
|
||||
// run without page flipping like GoldSrc
|
||||
if( Cmd_Argc() == 1 )
|
||||
{
|
||||
pglDrawBuffer( GL_FRONT );
|
||||
for( i = 0; i < 128; i++ )
|
||||
{
|
||||
RI.viewangles[1] = i / 128.0 * 360.0f;
|
||||
R_RenderScene();
|
||||
}
|
||||
pglFinish();
|
||||
R_EndFrame();
|
||||
}
|
||||
else
|
||||
{
|
||||
for( i = 0; i < 128; i++ )
|
||||
{
|
||||
R_BeginFrame( true );
|
||||
RI.viewangles[1] = i / 128.0 * 360.0f;
|
||||
R_RenderScene();
|
||||
R_EndFrame();
|
||||
}
|
||||
}
|
||||
|
||||
stop = Sys_DoubleTime ();
|
||||
time = (stop - start);
|
||||
Con_Printf( "%f seconds (%f fps)\n", time, 128 / time );
|
||||
ref.dllFuncs.R_SetupSky( Cmd_Argv( 1 ));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -482,6 +415,6 @@ viewpos (level-designer helper)
|
||||
*/
|
||||
void SCR_Viewpos_f( void )
|
||||
{
|
||||
Con_Printf( "org ( %g %g %g )\n", RI.vieworg[0], RI.vieworg[1], RI.vieworg[2] );
|
||||
Con_Printf( "ang ( %g %g %g )\n", RI.viewangles[0], RI.viewangles[1], RI.viewangles[2] );
|
||||
}
|
||||
Con_Printf( "org ( %g %g %g )\n", refState.vieworg[0], refState.vieworg[1], refState.vieworg[2] );
|
||||
Con_Printf( "ang ( %g %g %g )\n", refState.viewangles[0], refState.viewangles[1], refState.viewangles[2] );
|
||||
}
|
||||
|
||||
@@ -70,6 +70,13 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
|
||||
return true;
|
||||
}
|
||||
|
||||
if( cl.downloadUrl[0] )
|
||||
{
|
||||
HTTP_AddDownload( filepath, pResource->nDownloadSize, true );
|
||||
host.downloadcount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
MSG_BeginClientCmd( msg, clc_stringcmd );
|
||||
MSG_WriteString( msg, va( "dlfile %s", filepath ));
|
||||
host.downloadcount++;
|
||||
@@ -140,4 +147,4 @@ void CL_ClearResourceLists( void )
|
||||
{
|
||||
CL_ClearResourceList( &cl.resourcesneeded );
|
||||
CL_ClearResourceList( &cl.resourcesonhand );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ GNU General Public License for more details.
|
||||
#include "client.h"
|
||||
#include "net_encode.h"
|
||||
#include "particledef.h"
|
||||
#include "gl_local.h"
|
||||
#include "cl_tent.h"
|
||||
#include "shake.h"
|
||||
#include "hltv.h"
|
||||
@@ -239,4 +238,4 @@ void CL_WriteMessageHistory( void )
|
||||
if( host_developer.value >= DEV_EXTENDED )
|
||||
CL_WriteErrorMessage( MSG_GetNumBytesRead( msg ) - 1, msg );
|
||||
cls_message_debug.parsing = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ GNU General Public License for more details.
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
#include "net_encode.h"
|
||||
|
||||
#define dem_unknown 0 // unknown command
|
||||
@@ -52,6 +51,7 @@ const char *demo_cmd[dem_lastcmd+1] =
|
||||
"dem_stop",
|
||||
};
|
||||
|
||||
#pragma pack( push, 1 )
|
||||
typedef struct
|
||||
{
|
||||
int id; // should be IDEM
|
||||
@@ -63,6 +63,7 @@ typedef struct
|
||||
char gamedir[64]; // name of game directory (FS_Gamedir())
|
||||
int directory_offset; // offset of Entry Directory.
|
||||
} demoheader_t;
|
||||
#pragma pack( pop )
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -349,9 +350,9 @@ Write demo header
|
||||
*/
|
||||
void CL_WriteDemoHeader( const char *name )
|
||||
{
|
||||
long copysize;
|
||||
long savepos;
|
||||
long curpos;
|
||||
int copysize;
|
||||
int savepos;
|
||||
int curpos;
|
||||
|
||||
Con_Printf( "recording to %s.\n", name );
|
||||
cls.demofile = FS_Open( name, "wb", false );
|
||||
@@ -489,7 +490,7 @@ void CL_DrawDemoRecording( void )
|
||||
{
|
||||
char string[64];
|
||||
rgba_t color = { 255, 255, 255, 255 };
|
||||
long pos;
|
||||
int pos;
|
||||
int len;
|
||||
|
||||
if(!( host_developer.value && cls.demorecording ))
|
||||
@@ -497,10 +498,10 @@ void CL_DrawDemoRecording( void )
|
||||
|
||||
pos = FS_Tell( cls.demofile );
|
||||
Q_snprintf( string, sizeof( string ), "^1RECORDING:^7 %s: %s time: %02d:%02d", cls.demoname,
|
||||
Q_memprint( pos ), (int)(cls.demotime / 60.0f ), (int)fmod( cls.demotime, 60.0f ));
|
||||
Q_memprint( pos ), (int)(cls.demotime / 60.0f ), (int)fmod( cls.demotime, 60.0f ));
|
||||
|
||||
Con_DrawStringLen( string, &len, NULL );
|
||||
Con_DrawString(( glState.width - len ) >> 1, glState.height >> 2, string, color );
|
||||
Con_DrawString(( refState.width - len ) >> 1, refState.height >> 4, string, color );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1153,6 +1154,7 @@ void CL_StopPlayback( void )
|
||||
// let game known about demo state
|
||||
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
|
||||
cls.state = ca_disconnected;
|
||||
memset( &cls.serveradr, 0, sizeof( cls.serveradr ) );
|
||||
cls.set_lastdemo = false;
|
||||
S_StopBackgroundTrack();
|
||||
cls.connect_time = 0;
|
||||
@@ -1169,7 +1171,7 @@ void CL_StopPlayback( void )
|
||||
CL_GetDemoComment
|
||||
==================
|
||||
*/
|
||||
qboolean CL_GetDemoComment( const char *demoname, char *comment )
|
||||
int CL_GetDemoComment( const char *demoname, char *comment )
|
||||
{
|
||||
file_t *demfile;
|
||||
demoheader_t demohdr;
|
||||
@@ -1185,7 +1187,7 @@ qboolean CL_GetDemoComment( const char *demoname, char *comment )
|
||||
{
|
||||
Q_strncpy( comment, "", MAX_STRING );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// read in the m_DemoHeader
|
||||
FS_Read( demfile, &demohdr, sizeof( demoheader_t ));
|
||||
@@ -1302,8 +1304,6 @@ CL_DemoGetName
|
||||
*/
|
||||
static void CL_DemoGetName( int lastnum, char *filename )
|
||||
{
|
||||
int a, b, c, d;
|
||||
|
||||
if( lastnum < 0 || lastnum > 9999 )
|
||||
{
|
||||
// bound
|
||||
@@ -1311,15 +1311,7 @@ static void CL_DemoGetName( int lastnum, char *filename )
|
||||
return;
|
||||
}
|
||||
|
||||
a = lastnum / 1000;
|
||||
lastnum -= a * 1000;
|
||||
b = lastnum / 100;
|
||||
lastnum -= b * 100;
|
||||
c = lastnum / 10;
|
||||
lastnum -= c * 10;
|
||||
d = lastnum;
|
||||
|
||||
Q_sprintf( filename, "demo%i%i%i%i", a, b, c, d );
|
||||
Q_sprintf( filename, "demo%0004d", lastnum );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1627,4 +1619,4 @@ void CL_Stop_f( void )
|
||||
{
|
||||
S_StopBackgroundTrack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@ GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
#include "mod_local.h"
|
||||
#include "entity_types.h"
|
||||
#include "studio.h"
|
||||
#include "world.h" // BOX_ON_PLANE_SIDE
|
||||
#include "client.h"
|
||||
#include "mathlib.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
@@ -103,7 +103,7 @@ static void R_SplitEntityOnNode( mnode_t *node )
|
||||
return; // no free fragments...
|
||||
}
|
||||
|
||||
clgame.free_efrags = clgame.free_efrags->entnext;
|
||||
clgame.free_efrags = ef->entnext;
|
||||
ef->entity = r_addent;
|
||||
|
||||
// add the entity link
|
||||
@@ -206,4 +206,4 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount )
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,7 +63,7 @@ void CL_CalcPlayerVelocity( int idx, vec3_t velocity )
|
||||
if( dt != 0.0 )
|
||||
{
|
||||
VectorSubtract( clgame.entities[idx].curstate.velocity, clgame.entities[idx].prevstate.velocity, delta );
|
||||
VectorScale( delta, 1.0 / dt, velocity );
|
||||
VectorScale( delta, 1.0f / dt, velocity );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -393,7 +393,7 @@ void CL_ParseEvent( sizebuf_t *msg )
|
||||
event_index = MSG_ReadUBitLong( msg, MAX_EVENT_BITS );
|
||||
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
packet_index = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
||||
packet_index = MSG_ReadUBitLong( msg, cls.legacymode ? MAX_LEGACY_ENTITY_BITS : MAX_ENTITY_BITS );
|
||||
else packet_index = -1;
|
||||
|
||||
if( MSG_ReadOneBit( msg ))
|
||||
@@ -492,4 +492,4 @@ void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, floa
|
||||
args.bparam2 = bparam2;
|
||||
|
||||
CL_QueueEvent( flags, eventindex, delay, &args );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ GNU General Public License for more details.
|
||||
#include "client.h"
|
||||
#include "net_encode.h"
|
||||
#include "entity_types.h"
|
||||
#include "gl_local.h"
|
||||
#include "pm_local.h"
|
||||
#include "cl_tent.h"
|
||||
#include "studio.h"
|
||||
@@ -102,7 +101,7 @@ qboolean CL_EntityTeleported( cl_entity_t *ent )
|
||||
VectorSubtract( ent->curstate.origin, ent->prevstate.origin, delta );
|
||||
|
||||
// compute potential max movement in units per frame and compare with entity movement
|
||||
maxlen = ( clgame.movevars.maxvelocity * ( 1.0 / GAME_FPS ));
|
||||
maxlen = ( clgame.movevars.maxvelocity * ( 1.0f / GAME_FPS ));
|
||||
len = VectorLength( delta );
|
||||
|
||||
return (len > maxlen);
|
||||
@@ -230,6 +229,33 @@ void CL_UpdateLatchedVars( cl_entity_t *ent )
|
||||
clgame.drawFuncs.CL_UpdateLatchedVars( ent, false );
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_GetStudioEstimatedFrame
|
||||
|
||||
====================
|
||||
*/
|
||||
float CL_GetStudioEstimatedFrame( cl_entity_t *ent )
|
||||
{
|
||||
studiohdr_t *pstudiohdr;
|
||||
mstudioseqdesc_t *pseqdesc;
|
||||
int sequence;
|
||||
|
||||
if( ent->model != NULL && ent->model->type == mod_studio )
|
||||
{
|
||||
pstudiohdr = (studiohdr_t *)Mod_StudioExtradata( ent->model );
|
||||
|
||||
if( pstudiohdr )
|
||||
{
|
||||
sequence = bound( 0, ent->curstate.sequence, pstudiohdr->numseq - 1 );
|
||||
pseqdesc = (mstudioseqdesc_t *)((byte *)pstudiohdr + pstudiohdr->seqindex) + sequence;
|
||||
return ref.dllFuncs.R_StudioEstimateFrame( ent, pseqdesc );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_ResetLatchedVars
|
||||
@@ -330,7 +356,7 @@ qboolean CL_FindInterpolationUpdates( cl_entity_t *ent, float targettime, positi
|
||||
for( i = 1; i < HISTORY_MAX - 1; i++ )
|
||||
{
|
||||
at = ent->ph[( imod - i ) & HISTORY_MASK].animtime;
|
||||
if( at == 0.0 ) break;
|
||||
if( at == 0.0f ) break;
|
||||
|
||||
if( targettime > at )
|
||||
{
|
||||
@@ -729,7 +755,10 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
||||
CL_WriteDemoJumpTime();
|
||||
|
||||
// sentinel count. save it for debug checking
|
||||
count = ( MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1 );
|
||||
if( cls.legacymode )
|
||||
count = MSG_ReadWord( msg );
|
||||
else count = MSG_ReadUBitLong( msg, MAX_VISIBLE_PACKET_BITS ) + 1;
|
||||
|
||||
newframe = &cl.frames[cl.parsecountmod];
|
||||
|
||||
// allocate parse entities
|
||||
@@ -803,9 +832,19 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
||||
if( newnum == LAST_EDICT ) break; // end of packet entities
|
||||
int lastedict;
|
||||
if( cls.legacymode )
|
||||
{
|
||||
newnum = MSG_ReadWord( msg );
|
||||
lastedict = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
||||
lastedict = LAST_EDICT;
|
||||
}
|
||||
|
||||
if( newnum == lastedict ) break; // end of packet entities
|
||||
if( MSG_CheckOverflow( msg ))
|
||||
Host_Error( "CL_ParsePacketEntities: overflow\n" );
|
||||
player = CL_IsPlayerIndex( newnum );
|
||||
@@ -934,10 +973,10 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
|
||||
|
||||
if( entityType == ET_BEAM )
|
||||
{
|
||||
CL_AddCustomBeam( ent );
|
||||
ref.dllFuncs.CL_AddCustomBeam( ent );
|
||||
return true;
|
||||
}
|
||||
else if( !R_AddEntity( ent, entityType ))
|
||||
else if( !ref.dllFuncs.R_AddEntity( ent, entityType ))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1109,7 +1148,7 @@ void CL_LinkPacketEntities( frame_t *frame )
|
||||
if( ent->curstate.rendermode == kRenderNormal )
|
||||
{
|
||||
// auto 'solid' faces
|
||||
if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && CL_IsQuakeCompatible( ))
|
||||
if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && Host_IsQuakeCompatible( ))
|
||||
{
|
||||
ent->curstate.rendermode = kRenderTransAlpha;
|
||||
ent->curstate.renderamt = 255;
|
||||
@@ -1186,7 +1225,7 @@ void CL_LinkPacketEntities( frame_t *frame )
|
||||
if( ent->model->type == mod_studio )
|
||||
{
|
||||
if( interpolate && FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
|
||||
R_StudioLerpMovement( ent, cl.time, ent->origin, ent->angles );
|
||||
ref.dllFuncs.R_StudioLerpMovement( ent, cl.time, ent->origin, ent->angles );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1257,8 +1296,6 @@ void CL_EmitEntities( void )
|
||||
{
|
||||
if( cl.paused ) return; // don't waste time
|
||||
|
||||
R_ClearScene ();
|
||||
|
||||
// not in server yet, no entities to redraw
|
||||
if( cls.state != ca_active || !cl.validsequence )
|
||||
return;
|
||||
@@ -1268,7 +1305,7 @@ void CL_EmitEntities( void )
|
||||
return;
|
||||
|
||||
// animate lightestyles
|
||||
CL_RunLightStyles ();
|
||||
ref.dllFuncs.CL_RunLightStyles ();
|
||||
|
||||
// decay dynamic lights
|
||||
CL_DecayLights ();
|
||||
@@ -1279,9 +1316,7 @@ void CL_EmitEntities( void )
|
||||
// set client ideal pitch when mlook is disabled
|
||||
CL_SetIdealPitch ();
|
||||
|
||||
// clear the scene befor start new frame
|
||||
if( clgame.drawFuncs.R_ClearScene != NULL )
|
||||
clgame.drawFuncs.R_ClearScene();
|
||||
ref.dllFuncs.R_ClearScene ();
|
||||
|
||||
// link all the visible clients first
|
||||
CL_LinkPlayers ( &cl.frames[cl.parsecountmod] );
|
||||
@@ -1325,11 +1360,11 @@ qboolean CL_GetEntitySpatialization( channel_t *ch )
|
||||
|
||||
if(( ch->entnum - 1 ) == cl.playernum )
|
||||
{
|
||||
VectorCopy( RI.vieworg, ch->origin );
|
||||
VectorCopy( refState.vieworg, ch->origin );
|
||||
return true;
|
||||
}
|
||||
|
||||
valid_origin = VectorIsNull( ch->origin ) ? false : true;
|
||||
valid_origin = VectorIsNull( ch->origin ) ? false : true;
|
||||
ent = CL_GetEntityByIndex( ch->entnum );
|
||||
|
||||
// entity is not present on the client but has valid origin
|
||||
@@ -1341,20 +1376,10 @@ qboolean CL_GetEntitySpatialization( channel_t *ch )
|
||||
if( ent->curstate.messagenum != cl.parsecount )
|
||||
return valid_origin;
|
||||
#endif
|
||||
ch->movetype = ent->curstate.movetype;
|
||||
|
||||
// setup origin
|
||||
VectorAverage( ent->curstate.mins, ent->curstate.maxs, ch->origin );
|
||||
VectorAdd( ch->origin, ent->curstate.origin, ch->origin );
|
||||
|
||||
// setup mins\maxs
|
||||
VectorAdd( ent->curstate.mins, ent->curstate.origin, ch->absmin );
|
||||
VectorAdd( ent->curstate.maxs, ent->curstate.origin, ch->absmax );
|
||||
|
||||
// setup radius
|
||||
if( ent->model != NULL && ent->model->radius ) ch->radius = ent->model->radius;
|
||||
else ch->radius = RadiusFromBounds( ent->curstate.mins, ent->curstate.maxs );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1363,7 +1388,7 @@ qboolean CL_GetMovieSpatialization( rawchan_t *ch )
|
||||
cl_entity_t *ent;
|
||||
qboolean valid_origin;
|
||||
|
||||
valid_origin = VectorIsNull( ch->origin ) ? false : true;
|
||||
valid_origin = VectorIsNull( ch->origin ) ? false : true;
|
||||
ent = CL_GetEntityByIndex( ch->entnum );
|
||||
|
||||
// entity is not present on the client but has valid origin
|
||||
@@ -1385,4 +1410,4 @@ void CL_ExtraUpdate( void )
|
||||
{
|
||||
clgame.dllFuncs.IN_Accumulate();
|
||||
S_ExtraUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,11 +16,11 @@ GNU General Public License for more details.
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "const.h"
|
||||
#include "gl_local.h"
|
||||
#include "library.h"
|
||||
#include "input.h"
|
||||
#include "server.h" // !!svgame.hInstance
|
||||
#include "vid_common.h"
|
||||
|
||||
static MENUAPI GetMenuAPI;
|
||||
static void UI_UpdateUserinfo( void );
|
||||
|
||||
gameui_static_t gameui;
|
||||
@@ -47,7 +47,7 @@ void UI_UpdateMenu( float realtime )
|
||||
gameui.globals->frametime = host.realframetime;
|
||||
gameui.globals->demoplayback = cls.demoplayback;
|
||||
gameui.globals->demorecording = cls.demorecording;
|
||||
gameui.globals->allow_console = host.allow_console;
|
||||
gameui.globals->developer = host.allow_console;
|
||||
|
||||
gameui.dllFuncs.pfnRedraw( realtime );
|
||||
UI_UpdateUserinfo();
|
||||
@@ -135,6 +135,161 @@ qboolean UI_IsVisible( void )
|
||||
return gameui.dllFuncs.pfnIsVisible();
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
UI_AddTouchButtonToList
|
||||
|
||||
send button parameters to menu
|
||||
=======================
|
||||
*/
|
||||
void UI_AddTouchButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnAddTouchButtonToList )
|
||||
{
|
||||
gameui.dllFuncs2.pfnAddTouchButtonToList( name, texture, command, color, flags );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_ResetPing
|
||||
|
||||
notify gameui dll about latency reset
|
||||
=================
|
||||
*/
|
||||
void UI_ResetPing( void )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnResetPing )
|
||||
{
|
||||
gameui.dllFuncs2.pfnResetPing( );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_ShowConnectionWarning
|
||||
|
||||
show connection warning dialog implemented by gameui dll
|
||||
=================
|
||||
*/
|
||||
void UI_ShowConnectionWarning( void )
|
||||
{
|
||||
if( cls.state != ca_connected )
|
||||
return;
|
||||
|
||||
if( Host_IsLocalClient() )
|
||||
return;
|
||||
|
||||
if( ++cl.lostpackets == 8 )
|
||||
{
|
||||
CL_Disconnect();
|
||||
if( gameui.dllFuncs2.pfnShowConnectionWarning )
|
||||
{
|
||||
gameui.dllFuncs2.pfnShowConnectionWarning();
|
||||
}
|
||||
Con_DPrintf( S_WARN "Too many lost packets! Showing Network options menu\n" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_ShowConnectionWarning
|
||||
|
||||
show update dialog
|
||||
=================
|
||||
*/
|
||||
void UI_ShowUpdateDialog( qboolean preferStore )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnShowUpdateDialog )
|
||||
{
|
||||
gameui.dllFuncs2.pfnShowUpdateDialog( preferStore );
|
||||
}
|
||||
|
||||
Con_Printf( S_WARN "This version is not supported anymore. To continue, install latest engine version\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_ShowConnectionWarning
|
||||
|
||||
show message box
|
||||
=================
|
||||
*/
|
||||
void UI_ShowMessageBox( const char *text )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnShowMessageBox )
|
||||
{
|
||||
gameui.dllFuncs2.pfnShowMessageBox( text );
|
||||
}
|
||||
}
|
||||
|
||||
void UI_ConnectionProgress_Disconnect( void )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnConnectionProgress_Disconnect )
|
||||
{
|
||||
gameui.dllFuncs2.pfnConnectionProgress_Disconnect( );
|
||||
}
|
||||
}
|
||||
|
||||
void UI_ConnectionProgress_Download( const char *pszFileName, const char *pszServerName, const char *pszServerPath, int iCurrent, int iTotal, const char *comment )
|
||||
{
|
||||
if( !gameui.dllFuncs2.pfnConnectionProgress_Download )
|
||||
return;
|
||||
|
||||
if( pszServerPath )
|
||||
{
|
||||
char serverpath[MAX_SYSPATH];
|
||||
|
||||
Q_snprintf( serverpath, sizeof( serverpath ), "%s%s", pszServerName, pszServerPath );
|
||||
gameui.dllFuncs2.pfnConnectionProgress_Download( pszFileName, serverpath, iCurrent, iTotal, comment );
|
||||
}
|
||||
else
|
||||
{
|
||||
gameui.dllFuncs2.pfnConnectionProgress_Download( pszFileName, pszServerName, iCurrent, iTotal, comment );
|
||||
}
|
||||
}
|
||||
|
||||
void UI_ConnectionProgress_DownloadEnd( void )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnConnectionProgress_DownloadEnd )
|
||||
{
|
||||
gameui.dllFuncs2.pfnConnectionProgress_DownloadEnd( );
|
||||
}
|
||||
}
|
||||
|
||||
void UI_ConnectionProgress_Precache( void )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnConnectionProgress_Precache )
|
||||
{
|
||||
gameui.dllFuncs2.pfnConnectionProgress_Precache( );
|
||||
}
|
||||
}
|
||||
|
||||
void UI_ConnectionProgress_Connect( const char *server ) // NULL for local server
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnConnectionProgress_Connect )
|
||||
{
|
||||
gameui.dllFuncs2.pfnConnectionProgress_Connect( server );
|
||||
}
|
||||
}
|
||||
|
||||
void UI_ConnectionProgress_ChangeLevel( void )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnConnectionProgress_ChangeLevel )
|
||||
{
|
||||
gameui.dllFuncs2.pfnConnectionProgress_ChangeLevel( );
|
||||
}
|
||||
}
|
||||
|
||||
void UI_ConnectionProgress_ParseServerInfo( const char *server )
|
||||
{
|
||||
if( gameui.dllFuncs2.pfnConnectionProgress_ParseServerInfo )
|
||||
{
|
||||
gameui.dllFuncs2.pfnConnectionProgress_ParseServerInfo( server );
|
||||
}
|
||||
}
|
||||
|
||||
static void UI_DrawLogo( const char *filename, float x, float y, float width, float height )
|
||||
{
|
||||
static float cin_time;
|
||||
@@ -201,7 +356,7 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
|
||||
redraw = true;
|
||||
}
|
||||
|
||||
R_DrawStretchRaw( x, y, width, height, gameui.logo_xres, gameui.logo_yres, cin_data, redraw );
|
||||
ref.dllFuncs.R_DrawStretchRaw( x, y, width, height, gameui.logo_xres, gameui.logo_yres, cin_data, redraw );
|
||||
}
|
||||
|
||||
static int UI_GetLogoWidth( void )
|
||||
@@ -358,8 +513,8 @@ static void PIC_DrawGeneric( float x, float y, float width, float height, const
|
||||
return;
|
||||
|
||||
PicAdjustSize( &x, &y, &width, &height );
|
||||
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, gameui.ds.gl_texturenum );
|
||||
pglColor4ub( 255, 255, 255, 255 );
|
||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, gameui.ds.gl_texturenum );
|
||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -374,13 +529,13 @@ pfnPIC_Load
|
||||
|
||||
=========
|
||||
*/
|
||||
static HIMAGE pfnPIC_Load( const char *szPicName, const byte *image_buf, long image_size, long flags )
|
||||
static HIMAGE pfnPIC_Load( const char *szPicName, const byte *image_buf, int image_size, int flags )
|
||||
{
|
||||
HIMAGE tx;
|
||||
|
||||
if( !COM_CheckString( szPicName ))
|
||||
{
|
||||
Con_Reportf( S_ERROR "CL_LoadImage: bad name!\n" );
|
||||
Con_Reportf( S_ERROR "CL_LoadImage: refusing to load image with empty name\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -388,7 +543,7 @@ static HIMAGE pfnPIC_Load( const char *szPicName, const byte *image_buf, long im
|
||||
SetBits( flags, TF_IMAGE );
|
||||
|
||||
Image_SetForceFlags( IL_LOAD_DECAL ); // allow decal images for menu
|
||||
tx = GL_LoadTexture( szPicName, image_buf, image_size, flags );
|
||||
tx = ref.dllFuncs.GL_LoadTexture( szPicName, image_buf, image_size, flags );
|
||||
Image_ClearForceFlags();
|
||||
|
||||
return tx;
|
||||
@@ -437,7 +592,7 @@ void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a )
|
||||
g = bound( 0, g, 255 );
|
||||
b = bound( 0, b, 255 );
|
||||
a = bound( 0, a, 255 );
|
||||
pglColor4ub( r, g, b, a );
|
||||
ref.dllFuncs.Color4ub( r, g, b, a );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -448,7 +603,7 @@ pfnPIC_Draw
|
||||
*/
|
||||
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
}
|
||||
|
||||
@@ -460,7 +615,7 @@ pfnPIC_DrawTrans
|
||||
*/
|
||||
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
}
|
||||
|
||||
@@ -472,7 +627,7 @@ pfnPIC_DrawHoles
|
||||
*/
|
||||
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
GL_SetRenderMode( kRenderTransAlpha );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAlpha );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
}
|
||||
|
||||
@@ -484,7 +639,7 @@ pfnPIC_DrawAdditive
|
||||
*/
|
||||
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
GL_SetRenderMode( kRenderTransAdd );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
}
|
||||
|
||||
@@ -536,10 +691,10 @@ static void pfnFillRGBA( int x, int y, int width, int height, int r, int g, int
|
||||
g = bound( 0, g, 255 );
|
||||
b = bound( 0, b, 255 );
|
||||
a = bound( 0, a, 255 );
|
||||
pglColor4ub( r, g, b, a );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, tr.whiteTexture );
|
||||
pglColor4ub( 255, 255, 255, 255 );
|
||||
ref.dllFuncs.Color4ub( r, g, b, a );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, R_GetBuiltinTexture( REF_WHITE_TEXTURE ) );
|
||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -597,7 +752,7 @@ static void pfnDrawCharacter( int ix, int iy, int iwidth, int iheight, int ch, i
|
||||
color[0] = (ulRGBA & 0xFF0000) >> 16;
|
||||
color[1] = (ulRGBA & 0xFF00) >> 8;
|
||||
color[2] = (ulRGBA & 0xFF) >> 0;
|
||||
pglColor4ubv( color );
|
||||
ref.dllFuncs.Color4ub( color[0], color[1], color[2], color[3] );
|
||||
|
||||
col = (ch & 15) * 0.0625f + (0.5f / 256.0f);
|
||||
row = (ch >> 4) * 0.0625f + (0.5f / 256.0f);
|
||||
@@ -612,9 +767,9 @@ static void pfnDrawCharacter( int ix, int iy, int iwidth, int iheight, int ch, i
|
||||
if( gameui.ds.scissor_test && !PIC_Scissor( &x, &y, &width, &height, &s1, &t1, &s2, &t2 ))
|
||||
return;
|
||||
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, hFont );
|
||||
pglColor4ub( 255, 255, 255, 255 );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
|
||||
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, hFont );
|
||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -685,8 +840,8 @@ for drawing playermodel previews
|
||||
*/
|
||||
static void pfnClearScene( void )
|
||||
{
|
||||
R_PushScene();
|
||||
R_ClearScene();
|
||||
ref.dllFuncs.R_PushScene();
|
||||
ref.dllFuncs.R_ClearScene();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -698,17 +853,21 @@ for drawing playermodel previews
|
||||
*/
|
||||
static void pfnRenderScene( const ref_viewpass_t *rvp )
|
||||
{
|
||||
ref_viewpass_t copy;
|
||||
|
||||
// to avoid division by zero
|
||||
if( !rvp || rvp->fov_x <= 0.0f || rvp->fov_y <= 0.0f )
|
||||
return;
|
||||
|
||||
// don't allow special modes from menu
|
||||
((ref_viewpass_t *)&rvp)->flags = 0;
|
||||
copy = *rvp;
|
||||
|
||||
R_Set2DMode( false );
|
||||
R_RenderFrame( rvp );
|
||||
R_Set2DMode( true );
|
||||
R_PopScene();
|
||||
// don't allow special modes from menu
|
||||
copy.flags = 0;
|
||||
|
||||
ref.dllFuncs.R_Set2DMode( false );
|
||||
GL_RenderFrame( © );
|
||||
ref.dllFuncs.R_Set2DMode( true );
|
||||
ref.dllFuncs.R_PopScene();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -720,7 +879,7 @@ adding player model into visible list
|
||||
*/
|
||||
static int pfnAddEntity( int entityType, cl_entity_t *ent )
|
||||
{
|
||||
if( !R_AddEntity( ent, entityType ))
|
||||
if( !ref.dllFuncs.R_AddEntity( ent, entityType ))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -867,15 +1026,27 @@ pfnCheckGameDll
|
||||
*/
|
||||
int pfnCheckGameDll( void )
|
||||
{
|
||||
string dllpath;
|
||||
void *hInst;
|
||||
|
||||
if( SV_Initialized( )) return true;
|
||||
#if TARGET_OS_IPHONE
|
||||
// loading server library drains too many ram
|
||||
// so 512MB iPod Touch cannot even connect to
|
||||
// to servers in cstrike
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if(( hInst = COM_LoadLibrary( GI->game_dll, true, false )) != NULL )
|
||||
if( svgame.hInstance )
|
||||
return true;
|
||||
|
||||
COM_GetCommonLibraryPath( LIBRARY_SERVER, dllpath, sizeof( dllpath ));
|
||||
|
||||
if(( hInst = COM_LoadLibrary( dllpath, true, false )) != NULL )
|
||||
{
|
||||
COM_FreeLibrary( hInst );
|
||||
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
|
||||
return true;
|
||||
}
|
||||
Con_Reportf( S_WARN "Could not load server library:\n%s", COM_GetLibraryError() );
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -902,7 +1073,7 @@ pfnHostEndGame
|
||||
static void pfnHostEndGame( const char *szFinalMessage )
|
||||
{
|
||||
if( !szFinalMessage ) szFinalMessage = "";
|
||||
Host_EndGame( false, szFinalMessage );
|
||||
Host_EndGame( false, "%s", szFinalMessage );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -916,6 +1087,26 @@ static void pfnStartBackgroundTrack( const char *introTrack, const char *mainTra
|
||||
S_StartBackgroundTrack( introTrack, mainTrack, 0, false );
|
||||
}
|
||||
|
||||
static void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
|
||||
{
|
||||
ref.dllFuncs.GL_ProcessTexture( texnum, gamma, topColor, bottomColor );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_ShellExecute
|
||||
=================
|
||||
*/
|
||||
static void UI_ShellExecute( const char *path, const char *parms, int shouldExit )
|
||||
{
|
||||
Platform_ShellExecute( path, parms );
|
||||
|
||||
if( shouldExit )
|
||||
Sys_Quit();
|
||||
}
|
||||
|
||||
|
||||
// engine callbacks
|
||||
static ui_enginefuncs_t gEngfuncs =
|
||||
{
|
||||
@@ -988,7 +1179,7 @@ static ui_enginefuncs_t gEngfuncs =
|
||||
CL_GetDemoComment,
|
||||
pfnCheckGameDll,
|
||||
pfnGetClipboardData,
|
||||
Sys_ShellExecute,
|
||||
UI_ShellExecute,
|
||||
Host_WriteServerConfig,
|
||||
pfnChangeInstance,
|
||||
pfnStartBackgroundTrack,
|
||||
@@ -1000,8 +1191,36 @@ static ui_enginefuncs_t gEngfuncs =
|
||||
GL_ProcessTexture,
|
||||
COM_CompareFileTime,
|
||||
VID_GetModeString,
|
||||
COM_SaveFile,
|
||||
FS_Delete,
|
||||
(void*)COM_SaveFile,
|
||||
(void*)FS_Delete
|
||||
};
|
||||
|
||||
static void pfnEnableTextInput( int enable )
|
||||
{
|
||||
Key_EnableTextInput( enable, false );
|
||||
}
|
||||
|
||||
static int pfnGetRenderers( unsigned int num, char *shortName, size_t size1, char *readableName, size_t size2 )
|
||||
{
|
||||
if( num >= ref.numRenderers )
|
||||
return 0;
|
||||
|
||||
if( shortName && size1 )
|
||||
Q_strncpy( shortName, ref.shortNames[num], size1 );
|
||||
|
||||
if( readableName && size2 )
|
||||
Q_strncpy( readableName, ref.readableNames[num], size2 );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static ui_extendedfuncs_t gExtendedfuncs =
|
||||
{
|
||||
pfnEnableTextInput,
|
||||
Con_UtfProcessChar,
|
||||
Con_UtfMoveLeft,
|
||||
Con_UtfMoveRight,
|
||||
pfnGetRenderers
|
||||
};
|
||||
|
||||
void UI_UnloadProgs( void )
|
||||
@@ -1024,7 +1243,12 @@ void UI_UnloadProgs( void )
|
||||
qboolean UI_LoadProgs( void )
|
||||
{
|
||||
static ui_enginefuncs_t gpEngfuncs;
|
||||
static ui_extendedfuncs_t gpExtendedfuncs;
|
||||
static ui_globalvars_t gpGlobals;
|
||||
UIEXTENEDEDAPI GetExtAPI;
|
||||
UITEXTAPI GiveTextApi;
|
||||
MENUAPI GetMenuAPI;
|
||||
string dllpath;
|
||||
int i;
|
||||
|
||||
if( gameui.hInstance ) UI_UnloadProgs();
|
||||
@@ -1032,12 +1256,27 @@ qboolean UI_LoadProgs( void )
|
||||
// setup globals
|
||||
gameui.globals = &gpGlobals;
|
||||
|
||||
if(( gameui.hInstance = COM_LoadLibrary( va( "%s/menu.dll", GI->dll_path ), false, false )) == NULL )
|
||||
COM_GetCommonLibraryPath( LIBRARY_GAMEUI, dllpath, sizeof( dllpath ));
|
||||
|
||||
if(!( gameui.hInstance = COM_LoadLibrary( dllpath, false, false )))
|
||||
{
|
||||
if(( gameui.hInstance = COM_LoadLibrary( "menu.dll", false, true )) == NULL )
|
||||
string path = OS_LIB_PREFIX "menu." OS_LIB_EXT;
|
||||
|
||||
FS_AllowDirectPaths( true );
|
||||
|
||||
// no use to load it from engine directory, as library loader
|
||||
// that implements internal gamelibs already knows how to load it
|
||||
#ifndef XASH_INTERNAL_GAMELIBS
|
||||
if(!( gameui.hInstance = COM_LoadLibrary( path, false, true )))
|
||||
#endif
|
||||
{
|
||||
FS_AllowDirectPaths( false );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
FS_AllowDirectPaths( false );
|
||||
|
||||
if(( GetMenuAPI = (MENUAPI)COM_GetProcAddress( gameui.hInstance, "GetMenuAPI" )) == NULL )
|
||||
{
|
||||
COM_FreeLibrary( gameui.hInstance );
|
||||
@@ -1046,6 +1285,9 @@ qboolean UI_LoadProgs( void )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
gameui.use_text_api = false;
|
||||
|
||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||
memcpy( &gpEngfuncs, &gEngfuncs, sizeof( gpEngfuncs ));
|
||||
|
||||
@@ -1060,6 +1302,41 @@ qboolean UI_LoadProgs( void )
|
||||
return false;
|
||||
}
|
||||
|
||||
// make local copy of engfuncs to prevent overwrite it with user dll
|
||||
memcpy( &gpExtendedfuncs, &gExtendedfuncs, sizeof( gExtendedfuncs ));
|
||||
memset( &gameui.dllFuncs2, 0, sizeof( gameui.dllFuncs2 ));
|
||||
|
||||
// try to initialize new extended API
|
||||
if( ( GetExtAPI = (UIEXTENEDEDAPI)COM_GetProcAddress( gameui.hInstance, "GetExtAPI" ) ) )
|
||||
{
|
||||
Con_Reportf( "UI_LoadProgs: extended Menu API found\n" );
|
||||
if( GetExtAPI( MENU_EXTENDED_API_VERSION, &gameui.dllFuncs2, &gpExtendedfuncs ) )
|
||||
{
|
||||
Con_Reportf( "UI_LoadProgs: extended Menu API initialized\n" );
|
||||
gameui.use_text_api = true;
|
||||
}
|
||||
}
|
||||
else // otherwise, fallback to old and deprecated extensions
|
||||
{
|
||||
if( ( GiveTextApi = (UITEXTAPI)COM_GetProcAddress( gameui.hInstance, "GiveTextAPI" ) ) )
|
||||
{
|
||||
Con_Reportf( "UI_LoadProgs: extended text API found\n" );
|
||||
Con_Reportf( S_WARN "Text API is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
|
||||
if( GiveTextApi( &gpExtendedfuncs ) ) // they are binary compatible, so we can just pass extended funcs API to menu
|
||||
{
|
||||
Con_Reportf( "UI_LoadProgs: extended text API initialized\n" );
|
||||
gameui.use_text_api = true;
|
||||
}
|
||||
}
|
||||
|
||||
gameui.dllFuncs2.pfnAddTouchButtonToList = (ADDTOUCHBUTTONTOLIST)COM_GetProcAddress( gameui.hInstance, "AddTouchButtonToList" );
|
||||
if( gameui.dllFuncs2.pfnAddTouchButtonToList )
|
||||
{
|
||||
Con_Reportf( "UI_LoadProgs: AddTouchButtonToList call found\n" );
|
||||
Con_Reportf( S_WARN "AddTouchButtonToList is deprecated! If you are mod developer, consider moving to Extended Menu API!\n" );
|
||||
}
|
||||
}
|
||||
|
||||
Cvar_FullSet( "host_gameuiloaded", "1", FCVAR_READ_ONLY );
|
||||
|
||||
// setup gameinfo
|
||||
@@ -1072,10 +1349,10 @@ qboolean UI_LoadProgs( void )
|
||||
UI_ConvertGameInfo( &gameui.gameInfo, SI.GameInfo ); // current gameinfo
|
||||
|
||||
// setup globals
|
||||
gameui.globals->allow_console = host.allow_console;
|
||||
gameui.globals->developer = host.allow_console;
|
||||
|
||||
// initialize game
|
||||
gameui.dllFuncs.pfnInit();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,11 @@ GNU General Public License for more details.
|
||||
#include "client.h"
|
||||
#include "net_encode.h"
|
||||
#include "cl_tent.h"
|
||||
#include "gl_local.h"
|
||||
#include "input.h"
|
||||
#include "../cl_dll/kbutton.h"
|
||||
#include "kbutton.h"
|
||||
#include "vgui_draw.h"
|
||||
#include "library.h"
|
||||
#include "vid_common.h"
|
||||
|
||||
#define MAX_TOTAL_CMDS 32
|
||||
#define MAX_CMD_BUFFER 8000
|
||||
@@ -56,6 +57,7 @@ convar_t *cl_nosmooth;
|
||||
convar_t *cl_smoothtime;
|
||||
convar_t *cl_clockreset;
|
||||
convar_t *cl_fixtimerate;
|
||||
convar_t *hud_scale;
|
||||
convar_t *cl_solid_players;
|
||||
convar_t *cl_draw_beams;
|
||||
convar_t *cl_updaterate;
|
||||
@@ -63,7 +65,13 @@ convar_t *cl_showevents;
|
||||
convar_t *cl_cmdrate;
|
||||
convar_t *cl_interp;
|
||||
convar_t *cl_dlmax;
|
||||
convar_t *cl_upmax;
|
||||
|
||||
convar_t *cl_lw;
|
||||
convar_t *cl_charset;
|
||||
convar_t *cl_trace_messages;
|
||||
convar_t *hud_utf8;
|
||||
convar_t *ui_renderworld;
|
||||
|
||||
//
|
||||
// userinfo
|
||||
@@ -78,8 +86,10 @@ client_t cl;
|
||||
client_static_t cls;
|
||||
clgame_static_t clgame;
|
||||
|
||||
void CL_InternetServers_f( void );
|
||||
|
||||
//======================================================================
|
||||
qboolean CL_Active( void )
|
||||
int CL_Active( void )
|
||||
{
|
||||
return ( cls.state == ca_active );
|
||||
}
|
||||
@@ -146,19 +156,6 @@ qboolean CL_IsBackgroundMap( void )
|
||||
return ( cl.background && !cls.demoplayback );
|
||||
}
|
||||
|
||||
qboolean CL_IsQuakeCompatible( void )
|
||||
{
|
||||
// feature set
|
||||
if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
|
||||
return true;
|
||||
|
||||
// quake demo playing
|
||||
if( cls.demoplayback == DEMO_QUAKE1 )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
char *CL_Userinfo( void )
|
||||
{
|
||||
return cls.userinfo;
|
||||
@@ -203,12 +200,18 @@ void CL_CheckClientState( void )
|
||||
}
|
||||
}
|
||||
|
||||
int CL_GetFragmentSize( void *unused )
|
||||
int CL_GetFragmentSize( void *unused, fragsize_t mode )
|
||||
{
|
||||
if( mode == FRAGSIZE_SPLIT )
|
||||
return 0;
|
||||
|
||||
if( mode == FRAGSIZE_UNRELIABLE )
|
||||
return NET_MAX_MESSAGE;
|
||||
|
||||
if( Netchan_IsLocal( &cls.netchan ))
|
||||
return FRAGMENT_LOCAL_SIZE;
|
||||
|
||||
return FRAGMENT_MIN_SIZE;
|
||||
return cl_upmax->value;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -269,13 +272,13 @@ static float CL_LerpPoint( void )
|
||||
|
||||
if( frac < 0.0f )
|
||||
{
|
||||
if( frac < -0.01 )
|
||||
if( frac < -0.01f )
|
||||
cl.time = cl.mtime[1];
|
||||
frac = 0.0f;
|
||||
}
|
||||
else if( frac > 1.0f )
|
||||
{
|
||||
if( frac > 1.01 )
|
||||
if( frac > 1.01f )
|
||||
cl.time = cl.mtime[0];
|
||||
frac = 1.0f;
|
||||
}
|
||||
@@ -640,7 +643,7 @@ void CL_CreateCmd( void )
|
||||
|
||||
if( !cls.demoplayback )
|
||||
{
|
||||
pcmd->senttime = host.realtime;
|
||||
pcmd->senttime = host.realtime;
|
||||
memset( &pcmd->cmd, 0, sizeof( pcmd->cmd ));
|
||||
pcmd->receivedtime = -1.0;
|
||||
pcmd->heldback = false;
|
||||
@@ -648,7 +651,9 @@ void CL_CreateCmd( void )
|
||||
}
|
||||
|
||||
active = (( cls.signon == SIGNONS ) && !cl.paused && !cls.demoplayback );
|
||||
Platform_PreCreateMove();
|
||||
clgame.dllFuncs.CL_CreateMove( host.frametime, &pcmd->cmd, active );
|
||||
IN_EngineAppendMove( host.frametime, &pcmd->cmd, active );
|
||||
|
||||
CL_PopPMStates();
|
||||
|
||||
@@ -802,7 +807,7 @@ void CL_WritePacket( void )
|
||||
newcmds = ( cls.netchan.outgoing_sequence - cls.lastoutgoingcommand );
|
||||
|
||||
// put an upper/lower bound on this
|
||||
newcmds = bound( 0, newcmds, MAX_TOTAL_CMDS );
|
||||
newcmds = bound( 0, newcmds, cls.legacymode?MAX_LEGACY_TOTAL_CMDS:MAX_TOTAL_CMDS );
|
||||
if( cls.state == ca_connected ) newcmds = 0;
|
||||
|
||||
MSG_WriteByte( &buf, newcmds );
|
||||
@@ -904,7 +909,7 @@ CL_BeginUpload_f
|
||||
*/
|
||||
void CL_BeginUpload_f( void )
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
resource_t custResource;
|
||||
byte *buf = NULL;
|
||||
int size = 0;
|
||||
@@ -991,38 +996,6 @@ void CL_Drop( void )
|
||||
CL_Disconnect();
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
CL_GetCDKeyHash()
|
||||
|
||||
Connections will now use a hashed cd key value
|
||||
=======================
|
||||
*/
|
||||
char *CL_GetCDKeyHash( void )
|
||||
{
|
||||
const char *keyBuffer;
|
||||
static char szHashedKeyBuffer[256];
|
||||
int nKeyLength = 0;
|
||||
byte digest[17]; // The MD5 Hash
|
||||
MD5Context_t ctx;
|
||||
|
||||
keyBuffer = Sys_GetMachineKey( &nKeyLength );
|
||||
|
||||
// now get the md5 hash of the key
|
||||
memset( &ctx, 0, sizeof( ctx ));
|
||||
memset( digest, 0, sizeof( digest ));
|
||||
|
||||
MD5Init( &ctx );
|
||||
MD5Update( &ctx, (byte *)keyBuffer, nKeyLength );
|
||||
MD5Final( digest, &ctx );
|
||||
digest[16] = '\0';
|
||||
|
||||
memset( szHashedKeyBuffer, 0, 256 );
|
||||
Q_strncpy( szHashedKeyBuffer, MD5_Print( digest ), sizeof( szHashedKeyBuffer ));
|
||||
|
||||
return szHashedKeyBuffer;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
CL_SendConnectPacket
|
||||
@@ -1034,8 +1007,8 @@ connect.
|
||||
void CL_SendConnectPacket( void )
|
||||
{
|
||||
char protinfo[MAX_INFO_STRING];
|
||||
char *qport;
|
||||
char *key;
|
||||
const char *qport;
|
||||
const char *key;
|
||||
netadr_t adr;
|
||||
|
||||
if( !NET_StringToAdr( cls.servername, &adr ))
|
||||
@@ -1047,13 +1020,63 @@ void CL_SendConnectPacket( void )
|
||||
|
||||
if( adr.port == 0 ) adr.port = MSG_BigShort( PORT_SERVER );
|
||||
qport = Cvar_VariableString( "net_qport" );
|
||||
key = CL_GetCDKeyHash();
|
||||
key = ID_GetMD5();
|
||||
|
||||
memset( protinfo, 0, sizeof( protinfo ));
|
||||
Info_SetValueForKey( protinfo, "uuid", key, sizeof( protinfo ));
|
||||
Info_SetValueForKey( protinfo, "qport", qport, sizeof( protinfo ));
|
||||
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "connect %i %i \"%s\" \"%s\"\n", PROTOCOL_VERSION, cls.challenge, protinfo, cls.userinfo );
|
||||
if( adr.type == NA_LOOPBACK )
|
||||
{
|
||||
IN_LockInputDevices( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
int input_devices;
|
||||
|
||||
input_devices = IN_CollectInputDevices();
|
||||
IN_LockInputDevices( true );
|
||||
|
||||
Info_SetValueForKey( protinfo, "d", va( "%d", input_devices ), sizeof( protinfo ) );
|
||||
Info_SetValueForKey( protinfo, "v", XASH_VERSION, sizeof( protinfo ) );
|
||||
Info_SetValueForKey( protinfo, "b", va( "%d", Q_buildnum() ), sizeof( protinfo ) );
|
||||
Info_SetValueForKey( protinfo, "o", Q_buildos(), sizeof( protinfo ) );
|
||||
Info_SetValueForKey( protinfo, "a", Q_buildarch(), sizeof( protinfo ) );
|
||||
}
|
||||
|
||||
if( cls.legacymode )
|
||||
{
|
||||
// set related userinfo keys
|
||||
if( cl_dlmax->value >= 40000 || cl_dlmax->value < 100 )
|
||||
Info_SetValueForKey( cls.userinfo, "cl_maxpacket", "1400", sizeof( cls.userinfo ) );
|
||||
else
|
||||
Info_SetValueForKey( cls.userinfo, "cl_maxpacket", cl_dlmax->string, sizeof( cls.userinfo ) );
|
||||
|
||||
if( !*Info_ValueForKey( cls.userinfo,"cl_maxpayload") )
|
||||
Info_SetValueForKey( cls.userinfo, "cl_maxpayload", "1000", sizeof( cls.userinfo ) );
|
||||
|
||||
Info_SetValueForKey( protinfo, "i", key, sizeof( protinfo ) );
|
||||
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "connect %i %i %i \"%s\" %d \"%s\"\n",
|
||||
PROTOCOL_LEGACY_VERSION, Q_atoi( qport ), cls.challenge, cls.userinfo, NET_LEGACY_EXT_SPLIT, protinfo );
|
||||
Con_Printf( "Trying to connect by legacy protocol\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
int extensions = NET_EXT_SPLITSIZE;
|
||||
|
||||
if( cl_dlmax->value > FRAGMENT_MAX_SIZE || cl_dlmax->value < FRAGMENT_MIN_SIZE )
|
||||
Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE );
|
||||
|
||||
Info_RemoveKey( cls.userinfo, "cl_maxpacket" );
|
||||
Info_RemoveKey( cls.userinfo, "cl_maxpayload" );
|
||||
|
||||
Info_SetValueForKey( protinfo, "uuid", key, sizeof( protinfo ));
|
||||
Info_SetValueForKey( protinfo, "qport", qport, sizeof( protinfo ));
|
||||
Info_SetValueForKey( protinfo, "ext", va("%d", extensions), sizeof( protinfo ));
|
||||
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "connect %i %i \"%s\" \"%s\"\n", PROTOCOL_VERSION, cls.challenge, protinfo, cls.userinfo );
|
||||
Con_Printf( "Trying to connect by modern protocol\n" );
|
||||
}
|
||||
|
||||
cls.timestart = Sys_DoubleTime();
|
||||
}
|
||||
|
||||
@@ -1067,6 +1090,10 @@ Resend a connect message if the last one has timed out
|
||||
void CL_CheckForResend( void )
|
||||
{
|
||||
netadr_t adr;
|
||||
int res;
|
||||
|
||||
if( cls.internetservers_wait )
|
||||
CL_InternetServers_f();
|
||||
|
||||
// if the local server is running and we aren't then connect
|
||||
if( cls.state == ca_disconnected && SV_Active( ))
|
||||
@@ -1074,6 +1101,8 @@ void CL_CheckForResend( void )
|
||||
cls.signon = 0;
|
||||
cls.state = ca_connecting;
|
||||
Q_strncpy( cls.servername, "localhost", sizeof( cls.servername ));
|
||||
cls.serveradr.type = NA_LOOPBACK;
|
||||
|
||||
// we don't need a challenge on the localhost
|
||||
CL_SendConnectPacket();
|
||||
return;
|
||||
@@ -1091,12 +1120,20 @@ void CL_CheckForResend( void )
|
||||
if(( host.realtime - cls.connect_time ) < cl_resend.value )
|
||||
return;
|
||||
|
||||
if( !NET_StringToAdr( cls.servername, &adr ))
|
||||
res = NET_StringToAdrNB( cls.servername, &adr );
|
||||
|
||||
if( !res )
|
||||
{
|
||||
CL_Disconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
if( res == 2 )
|
||||
{
|
||||
cls.connect_time = MAX_HEARTBEAT;
|
||||
return;
|
||||
}
|
||||
|
||||
// only retry so many times before failure.
|
||||
if( cls.connect_retry >= CL_CONNECTION_RETRIES )
|
||||
{
|
||||
@@ -1118,15 +1155,17 @@ void CL_CheckForResend( void )
|
||||
return;
|
||||
}
|
||||
|
||||
cls.serveradr = adr;
|
||||
cls.max_fragment_size = Q_max( FRAGMENT_MAX_SIZE, cls.max_fragment_size >> Q_min( 1, cls.connect_retry ));
|
||||
cls.connect_time = host.realtime; // for retransmit requests
|
||||
cls.connect_retry++;
|
||||
|
||||
Con_Printf( "Connecting to %s... [retry #%i]\n", cls.servername, cls.connect_retry );
|
||||
|
||||
if( cl_test_bandwidth.value )
|
||||
if( !cls.legacymode && cl_test_bandwidth.value )
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "bandwidth %i %i\n", PROTOCOL_VERSION, cls.max_fragment_size );
|
||||
else Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
|
||||
else
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "getchallenge\n" );
|
||||
}
|
||||
|
||||
resource_t *CL_AddResource( resourcetype_t type, const char *name, int size, qboolean bFatalIfMissing, int index )
|
||||
@@ -1191,8 +1230,14 @@ CL_Connect_f
|
||||
void CL_Connect_f( void )
|
||||
{
|
||||
string server;
|
||||
qboolean legacyconnect = false;
|
||||
|
||||
if( Cmd_Argc() != 2 )
|
||||
// hidden hint to connect by using legacy protocol
|
||||
if( Cmd_Argc() == 3 )
|
||||
{
|
||||
legacyconnect = !Q_strcmp( Cmd_Argv( 2 ), "legacy" );
|
||||
}
|
||||
else if( Cmd_Argc() != 2 )
|
||||
{
|
||||
Con_Printf( S_USAGE "connect <server>\n" );
|
||||
return;
|
||||
@@ -1212,6 +1257,7 @@ void CL_Connect_f( void )
|
||||
Key_SetKeyDest( key_console );
|
||||
|
||||
cls.state = ca_connecting;
|
||||
cls.legacymode = legacyconnect;
|
||||
Q_strncpy( cls.servername, server, sizeof( cls.servername ));
|
||||
cls.connect_time = MAX_HEARTBEAT; // CL_CheckForResend() will fire immediately
|
||||
cls.max_fragment_size = FRAGMENT_MAX_SIZE; // guess a we can establish connection with maximum fragment size
|
||||
@@ -1322,6 +1368,7 @@ void CL_ClearState( void )
|
||||
Cvar_SetValue( "scr_download", -1.0f );
|
||||
Cvar_SetValue( "scr_loading", 0.0f );
|
||||
host.allow_console = host.allow_console_init;
|
||||
HTTP_ClearCustomServers();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1351,6 +1398,24 @@ void CL_SendDisconnectMessage( void )
|
||||
Netchan_TransmitBits( &cls.netchan, MSG_GetNumBitsWritten( &buf ), MSG_GetData( &buf ));
|
||||
}
|
||||
|
||||
int CL_GetSplitSize( void )
|
||||
{
|
||||
int splitsize;
|
||||
|
||||
if( Host_IsDedicated() )
|
||||
return 0;
|
||||
|
||||
if( !(cls.extensions & NET_EXT_SPLITSIZE) )
|
||||
return 1400;
|
||||
|
||||
splitsize = cl_dlmax->value;
|
||||
|
||||
if( splitsize < FRAGMENT_MIN_SIZE || splitsize > FRAGMENT_MAX_SIZE )
|
||||
Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE );
|
||||
|
||||
return cl_dlmax->value;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_Reconnect
|
||||
@@ -1363,6 +1428,28 @@ void CL_Reconnect( qboolean setup_netchan )
|
||||
if( setup_netchan )
|
||||
{
|
||||
Netchan_Setup( NS_CLIENT, &cls.netchan, net_from, Cvar_VariableInteger( "net_qport" ), NULL, CL_GetFragmentSize );
|
||||
|
||||
if( cls.legacymode )
|
||||
{
|
||||
unsigned int extensions = Q_atoi( Cmd_Argv( 1 ) );
|
||||
|
||||
if( extensions & NET_LEGACY_EXT_SPLIT )
|
||||
{
|
||||
// only enable incoming split for legacy mode
|
||||
cls.netchan.split = true;
|
||||
Con_Reportf( "^2NET_EXT_SPLIT enabled^7 (packet sizes is %d/%d)\n", (int)cl_dlmax->value, 65536 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cls.extensions = Q_atoi( Info_ValueForKey( Cmd_Argv( 1 ), "ext" ));
|
||||
|
||||
if( cls.extensions & NET_EXT_SPLITSIZE )
|
||||
{
|
||||
Con_Reportf( "^2NET_EXT_SPLITSIZE enabled^7 (packet size is %d)\n", (int)cl_dlmax->value );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1397,6 +1484,8 @@ This is also called on Host_Error, so it shouldn't cause any errors
|
||||
*/
|
||||
void CL_Disconnect( void )
|
||||
{
|
||||
cls.legacymode = false;
|
||||
|
||||
if( cls.state == ca_disconnected )
|
||||
return;
|
||||
|
||||
@@ -1415,7 +1504,10 @@ void CL_Disconnect( void )
|
||||
// clear the network channel, too.
|
||||
Netchan_Clear( &cls.netchan );
|
||||
|
||||
IN_LockInputDevices( false ); // unlock input devices
|
||||
|
||||
cls.state = ca_disconnected;
|
||||
memset( &cls.serveradr, 0, sizeof( cls.serveradr ) );
|
||||
cls.set_lastdemo = false;
|
||||
cls.connect_retry = 0;
|
||||
cls.signon = 0;
|
||||
@@ -1463,7 +1555,8 @@ void CL_LocalServers_f( void )
|
||||
|
||||
Con_Printf( "Scanning for servers on the local network area...\n" );
|
||||
NET_Config( true ); // allow remote
|
||||
|
||||
cls.legacyservercount = 0;
|
||||
|
||||
// send a broadcast packet
|
||||
adr.type = NA_BROADCAST;
|
||||
adr.port = MSG_BigShort( PORT_SERVER );
|
||||
@@ -1471,6 +1564,8 @@ void CL_LocalServers_f( void )
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, adr, "info %i", PROTOCOL_VERSION );
|
||||
}
|
||||
|
||||
#define MS_SCAN_REQUEST "1\xFF" "0.0.0.0:0\0"
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_InternetServers_f
|
||||
@@ -1479,28 +1574,27 @@ CL_InternetServers_f
|
||||
void CL_InternetServers_f( void )
|
||||
{
|
||||
char fullquery[512] = MS_SCAN_REQUEST;
|
||||
char *info = fullquery + sizeof( MS_SCAN_REQUEST ) - 1;
|
||||
int remaining = sizeof( fullquery ) - sizeof( MS_SCAN_REQUEST );
|
||||
netadr_t adr;
|
||||
char *info = fullquery + sizeof( MS_SCAN_REQUEST ) - 1;
|
||||
const size_t remaining = sizeof( fullquery ) - sizeof( MS_SCAN_REQUEST );
|
||||
|
||||
NET_Config( true ); // allow remote
|
||||
|
||||
if( !NET_StringToAdr( MASTERSERVER_ADR, &adr ) )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "Can't resolve adr: %s\n", MASTERSERVER_ADR );
|
||||
return;
|
||||
}
|
||||
|
||||
Con_Printf( "Scanning for servers on the internet area...\n" );
|
||||
Info_SetValueForKey( info, "gamedir", GI->gamefolder, remaining );
|
||||
Info_SetValueForKey( info, "clver", XASH_VERSION, remaining ); // let master know about client version
|
||||
// Info_SetValueForKey( info, "nat", cl_nat->string, remaining );
|
||||
cls.legacyservercount = 0;
|
||||
|
||||
NET_SendPacket( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strlen( info ), fullquery, adr );
|
||||
cls.internetservers_wait = NET_SendToMasters( NS_CLIENT, sizeof( MS_SCAN_REQUEST ) + Q_strlen( info ), fullquery );
|
||||
cls.internetservers_pending = true;
|
||||
|
||||
// now we clearing the vgui request
|
||||
if( clgame.master_request != NULL )
|
||||
memset( clgame.master_request, 0, sizeof( net_request_t ));
|
||||
clgame.request_type = NET_REQUEST_GAMEUI;
|
||||
if( !cls.internetservers_wait )
|
||||
{
|
||||
// now we clearing the vgui request
|
||||
if( clgame.master_request != NULL )
|
||||
memset( clgame.master_request, 0, sizeof( net_request_t ));
|
||||
clgame.request_type = NET_REQUEST_GAMEUI;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1612,15 +1706,35 @@ void CL_ParseStatusMessage( netadr_t from, sizebuf_t *msg )
|
||||
{
|
||||
static char infostring[MAX_INFO_STRING+8];
|
||||
char *s = MSG_ReadString( msg );
|
||||
int i;
|
||||
|
||||
CL_FixupColorStringsForInfoString( s, infostring );
|
||||
|
||||
if( Q_strstr( infostring, "wrong version" ) )
|
||||
{
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, from, "info %i", PROTOCOL_LEGACY_VERSION );
|
||||
Con_Printf( "^1Server^7: %s, Info: %s\n", NET_AdrToString( from ), infostring );
|
||||
if( cls.legacyservercount < MAX_LEGACY_SERVERS )
|
||||
cls.legacyservers[cls.legacyservercount++] = from;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !COM_CheckString( Info_ValueForKey( infostring, "gamedir" )))
|
||||
{
|
||||
Con_Printf( "^1Server^7: %s, Info: %s\n", NET_AdrToString( from ), infostring );
|
||||
return; // unsupported proto
|
||||
}
|
||||
|
||||
for( i = 0; i < cls.legacyservercount; i++ )
|
||||
{
|
||||
if( NET_CompareAdr( cls.legacyservers[i], from ) )
|
||||
{
|
||||
Info_SetValueForKey( infostring, "legacy", "1", sizeof( infostring ) );
|
||||
Con_Print("Legacy: ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// more info about servers
|
||||
Con_Printf( "^2Server^7: %s, Game: %s\n", NET_AdrToString( from ), Info_ValueForKey( infostring, "gamedir" ));
|
||||
|
||||
@@ -1640,7 +1754,7 @@ void CL_ParseNETInfoMessage( netadr_t from, sizebuf_t *msg, const char *s )
|
||||
static char infostring[MAX_INFO_STRING+8];
|
||||
int i, context, type;
|
||||
int errorBits = 0;
|
||||
char *val;
|
||||
const char *val;
|
||||
|
||||
context = Q_atoi( Cmd_Argv( 1 ));
|
||||
type = Q_atoi( Cmd_Argv( 2 ));
|
||||
@@ -1729,7 +1843,7 @@ void CL_SetupOverviewParams( void )
|
||||
|
||||
// calculate nearest aspect
|
||||
mapAspect = world.size[!ov->rotated] / world.size[ov->rotated];
|
||||
screenAspect = (float)glState.width / (float)glState.height;
|
||||
screenAspect = (float)refState.width / (float)refState.height;
|
||||
aspect = Q_max( mapAspect, screenAspect );
|
||||
|
||||
ov->zNear = world.maxs[2];
|
||||
@@ -1751,6 +1865,19 @@ void CL_SetupOverviewParams( void )
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_IsFromConnectingServer
|
||||
|
||||
Used for connectionless packets, when netchan may not be ready.
|
||||
=================
|
||||
*/
|
||||
static qboolean CL_IsFromConnectingServer( netadr_t from )
|
||||
{
|
||||
return NET_IsLocalAddress( from ) ||
|
||||
NET_CompareAdr( cls.serveradr, from );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_ConnectionlessPacket
|
||||
@@ -1761,7 +1888,8 @@ Responses to broadcasts, etc
|
||||
void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
{
|
||||
char *args;
|
||||
char *c, buf[MAX_SYSPATH];
|
||||
const char *c;
|
||||
char buf[MAX_SYSPATH];
|
||||
int len = sizeof( buf );
|
||||
int dataoffset = 0;
|
||||
netadr_t servadr;
|
||||
@@ -1779,6 +1907,9 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
// server connection
|
||||
if( !Q_strcmp( c, "client_connect" ))
|
||||
{
|
||||
if( !CL_IsFromConnectingServer( from ))
|
||||
return;
|
||||
|
||||
if( cls.state == ca_connected )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "dup connect received. ignored\n");
|
||||
@@ -1807,8 +1938,9 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
return;
|
||||
}
|
||||
|
||||
ShowWindow( host.hWnd, SW_RESTORE );
|
||||
SetForegroundWindow ( host.hWnd );
|
||||
#if XASH_SDL == 2
|
||||
SDL_ShowWindow( host.hWnd );
|
||||
#endif
|
||||
args = MSG_ReadString( msg );
|
||||
Cbuf_AddText( args );
|
||||
Cbuf_AddText( "\n" );
|
||||
@@ -1821,10 +1953,16 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
else if( !Q_strcmp( c, "testpacket" ))
|
||||
{
|
||||
byte recv_buf[NET_MAX_FRAGMENT];
|
||||
dword crcValue = MSG_ReadLong( msg );
|
||||
int realsize = MSG_GetMaxBytes( msg ) - MSG_GetNumBytesRead( msg );
|
||||
dword crcValue;
|
||||
int realsize;
|
||||
dword crcValue2 = 0;
|
||||
|
||||
if( !CL_IsFromConnectingServer( from ))
|
||||
return;
|
||||
|
||||
crcValue = MSG_ReadLong( msg );
|
||||
realsize = MSG_GetMaxBytes( msg ) - MSG_GetNumBytesRead( msg );
|
||||
|
||||
if( cls.max_fragment_size != MSG_GetMaxBytes( msg ))
|
||||
{
|
||||
if( cls.connect_retry >= CL_TEST_RETRIES )
|
||||
@@ -1832,7 +1970,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
// too many fails use default connection method
|
||||
Con_Printf( "hi-speed connection is failed, use default method\n" );
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
|
||||
Cvar_SetValue( "cl_dlmax", FRAGMENT_MIN_SIZE );
|
||||
Cvar_SetValue( "cl_dlmax", FRAGMENT_DEFAULT_SIZE );
|
||||
cls.connect_time = host.realtime;
|
||||
return;
|
||||
}
|
||||
@@ -1851,7 +1989,8 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
if( crcValue == crcValue2 )
|
||||
{
|
||||
// packet was sucessfully delivered, adjust the fragment size and get challenge
|
||||
Con_DPrintf( "CRC %p is matched, get challenge, fragment size %d\n", crcValue, cls.max_fragment_size );
|
||||
|
||||
Con_DPrintf( "CRC %x is matched, get challenge, fragment size %d\n", crcValue, cls.max_fragment_size );
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, from, "getchallenge\n" );
|
||||
Cvar_SetValue( "cl_dlmax", cls.max_fragment_size );
|
||||
cls.connect_time = host.realtime;
|
||||
@@ -1868,6 +2007,8 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
return;
|
||||
}
|
||||
|
||||
Msg( "got testpacket, CRC mismatched 0x%08x should be 0x%08x, trying next fragment size %d\n", crcValue2, crcValue, cls.max_fragment_size >> 1 );
|
||||
|
||||
// trying the next size of packet
|
||||
cls.connect_time = MAX_HEARTBEAT;
|
||||
}
|
||||
@@ -1879,6 +2020,9 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
}
|
||||
else if( !Q_strcmp( c, "challenge" ))
|
||||
{
|
||||
if( !CL_IsFromConnectingServer( from ))
|
||||
return;
|
||||
|
||||
// challenge from the server we are connecting to
|
||||
cls.challenge = Q_atoi( Cmd_Argv( 1 ));
|
||||
CL_SendConnectPacket();
|
||||
@@ -1886,14 +2030,68 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
}
|
||||
else if( !Q_strcmp( c, "echo" ))
|
||||
{
|
||||
if( !CL_IsFromConnectingServer( from ))
|
||||
return;
|
||||
|
||||
// echo request from server
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, from, "%s", Cmd_Argv( 1 ));
|
||||
}
|
||||
else if( !Q_strcmp( c, "disconnect" ))
|
||||
{
|
||||
if( !CL_IsFromConnectingServer( from ))
|
||||
return;
|
||||
|
||||
// a disconnect message from the server, which will happen if the server
|
||||
// dropped the connection but it is still getting packets from us
|
||||
CL_Disconnect_f();
|
||||
|
||||
if( NET_CompareAdr( from, cls.legacyserver ))
|
||||
{
|
||||
Cbuf_AddText( va( "connect %s legacy\n", NET_AdrToString( from )));
|
||||
memset( &cls.legacyserver, 0, sizeof( cls.legacyserver ));
|
||||
}
|
||||
}
|
||||
else if( !Q_strcmp( c, "errormsg" ))
|
||||
{
|
||||
if( !CL_IsFromConnectingServer( from ))
|
||||
return;
|
||||
|
||||
args = MSG_ReadString( msg );
|
||||
|
||||
if( !Q_strcmp( args, "Server uses protocol version 48.\n" ))
|
||||
{
|
||||
cls.legacyserver = from;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( UI_IsVisible() )
|
||||
UI_ShowMessageBox( va("^3Server message^7\n%s", args ) );
|
||||
Msg( "%s", args );
|
||||
}
|
||||
}
|
||||
else if( !Q_strcmp( c, "updatemsg" ))
|
||||
{
|
||||
// got an update message from master server
|
||||
// show update dialog from menu
|
||||
netadr_t adr;
|
||||
qboolean preferStore = true;
|
||||
|
||||
if( !Q_strcmp( Cmd_Argv( 1 ), "nostore" ) )
|
||||
preferStore = false;
|
||||
|
||||
// trust only hardcoded master server
|
||||
if( NET_StringToAdr( MASTERSERVER_ADR, &adr ) )
|
||||
{
|
||||
if( NET_CompareAdr( from, adr ))
|
||||
{
|
||||
UI_ShowUpdateDialog( preferStore );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// in case we don't have master anymore
|
||||
UI_ShowUpdateDialog( preferStore );
|
||||
}
|
||||
}
|
||||
else if( !Q_strcmp( c, "f" ))
|
||||
{
|
||||
@@ -1924,7 +2122,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
nr->pfnFunc( &nr->resp );
|
||||
|
||||
// throw the list, now it will be stored in user area
|
||||
prev = &((net_adrlist_t *)nr->resp.response);
|
||||
prev = (net_adrlist_t**)&nr->resp.response;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
@@ -1959,11 +2157,17 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
|
||||
Netchan_OutOfBandPrint( NS_CLIENT, servadr, "info %i", PROTOCOL_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
if( cls.internetservers_pending )
|
||||
{
|
||||
UI_ResetPing();
|
||||
cls.internetservers_pending = false;
|
||||
}
|
||||
}
|
||||
else if( clgame.dllFuncs.pfnConnectionlessPacket( &from, args, buf, &len ))
|
||||
{
|
||||
// user out of band message (must be handled in CL_ConnectionlessPacket)
|
||||
if( len > 0 ) Netchan_OutOfBand( NS_SERVER, from, len, buf );
|
||||
if( len > 0 ) Netchan_OutOfBand( NS_SERVER, from, len, (byte *)buf );
|
||||
}
|
||||
else Con_DPrintf( S_ERROR "bad connectionless packet from %s:\n%s\n", NET_AdrToString( from ), args );
|
||||
}
|
||||
@@ -2000,6 +2204,11 @@ void CL_ReadNetMessage( void )
|
||||
|
||||
while( CL_GetMessage( net_message_buffer, &curSize ))
|
||||
{
|
||||
if( cls.legacymode && *((int *)&net_message_buffer) == 0xFFFFFFFE )
|
||||
// Will rewrite existing packet by merged
|
||||
if( !NetSplit_GetLong( &cls.netchan.netsplit, &net_from, net_message_buffer, &curSize ) )
|
||||
continue;
|
||||
|
||||
MSG_Init( &net_message, "ServerData", net_message_buffer, curSize );
|
||||
|
||||
// check for connectionless packet (0xffffffff) first
|
||||
@@ -2031,6 +2240,7 @@ void CL_ReadNetMessage( void )
|
||||
// run special handler for quake demos
|
||||
if( cls.demoplayback == DEMO_QUAKE1 )
|
||||
CL_ParseQuakeMessage( &net_message, true );
|
||||
else if( cls.legacymode ) CL_ParseLegacyServerMessage( &net_message, true );
|
||||
else CL_ParseServerMessage( &net_message, true );
|
||||
cl.send_reply = true;
|
||||
}
|
||||
@@ -2112,7 +2322,7 @@ void CL_ReadPackets( void )
|
||||
|
||||
// if in the debugger last frame, don't timeout
|
||||
if( host.frametime > 5.0f ) cls.netchan.last_received = Sys_DoubleTime();
|
||||
|
||||
|
||||
// check timeout
|
||||
if( cls.state >= ca_connected && cls.state != ca_cinematic && !cls.demoplayback )
|
||||
{
|
||||
@@ -2201,6 +2411,17 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename )
|
||||
{
|
||||
Con_Printf( S_ERROR "server failed to transmit file '%s'\n", CL_CleanFileName( filename ));
|
||||
}
|
||||
if( cls.legacymode )
|
||||
{
|
||||
if( host.downloadcount > 0 )
|
||||
host.downloadcount--;
|
||||
if( !host.downloadcount )
|
||||
{
|
||||
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||
MSG_WriteString( &cls.netchan.message, "continueloading" );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
pfilename = filename;
|
||||
|
||||
@@ -2250,7 +2471,7 @@ void CL_ProcessFile( qboolean successfully_received, const char *filename )
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n",
|
||||
Con_Printf( "Downloaded %i bytes for purported %i byte file, ignoring download\n",
|
||||
cls.netchan.tempbuffersize, p->nDownloadSize );
|
||||
}
|
||||
|
||||
@@ -2445,7 +2666,7 @@ qboolean CL_PrecacheResources( void )
|
||||
{
|
||||
if( FBitSet( pRes->ucFlags, RES_WASMISSING ))
|
||||
{
|
||||
Con_Printf( S_ERROR "%s%s couldn't load\n", DEFAULT_SOUNDPATH, pRes->szFileName );
|
||||
Con_Printf( S_ERROR "Could not load sound %s%s\n", DEFAULT_SOUNDPATH, pRes->szFileName );
|
||||
cl.sound_precache[pRes->nIndex][0] = 0;
|
||||
cl.sound_index[pRes->nIndex] = 0;
|
||||
}
|
||||
@@ -2573,6 +2794,7 @@ void CL_InitLocal( void )
|
||||
{
|
||||
cls.state = ca_disconnected;
|
||||
cls.signon = 0;
|
||||
memset( &cls.serveradr, 0, sizeof( cls.serveradr ) );
|
||||
|
||||
cl.resourcesneeded.pNext = cl.resourcesneeded.pPrev = &cl.resourcesneeded;
|
||||
cl.resourcesonhand.pNext = cl.resourcesonhand.pPrev = &cl.resourcesonhand;
|
||||
@@ -2594,16 +2816,21 @@ void CL_InitLocal( void )
|
||||
cl_solid_players = Cvar_Get( "cl_solid_players", "1", 0, "Make all players not solid (can't traceline them)" );
|
||||
cl_interp = Cvar_Get( "ex_interp", "0.1", FCVAR_ARCHIVE, "Interpolate object positions starting this many seconds in past" );
|
||||
cl_timeout = Cvar_Get( "cl_timeout", "60", 0, "connect timeout (in-seconds)" );
|
||||
cl_charset = Cvar_Get( "cl_charset", "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
|
||||
hud_utf8 = Cvar_Get( "hud_utf8", "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
|
||||
|
||||
rcon_client_password = Cvar_Get( "rcon_password", "", 0, "remote control client password" );
|
||||
rcon_address = Cvar_Get( "rcon_address", "", 0, "remote control address" );
|
||||
|
||||
cl_trace_messages = Cvar_Get( "cl_trace_messages", "0", FCVAR_ARCHIVE|FCVAR_CHEAT, "enable message names tracing (good for developers)");
|
||||
|
||||
// userinfo
|
||||
cl_nopred = Cvar_Get( "cl_nopred", "0", FCVAR_ARCHIVE|FCVAR_USERINFO, "disable client movement prediction" );
|
||||
name = Cvar_Get( "name", Sys_GetCurrentUser(), FCVAR_USERINFO|FCVAR_ARCHIVE|FCVAR_PRINTABLEONLY, "player name" );
|
||||
model = Cvar_Get( "model", "", FCVAR_USERINFO|FCVAR_ARCHIVE, "player model ('player' is a singleplayer model)" );
|
||||
cl_updaterate = Cvar_Get( "cl_updaterate", "20", FCVAR_USERINFO|FCVAR_ARCHIVE, "refresh rate of server messages" );
|
||||
cl_dlmax = Cvar_Get( "cl_dlmax", "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "max allowed fragment size on download resources" );
|
||||
cl_dlmax = Cvar_Get( "cl_dlmax", "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "max allowed outcoming fragment size" );
|
||||
cl_upmax = Cvar_Get( "cl_upmax", "1200", FCVAR_ARCHIVE, "max allowed incoming fragment size" );
|
||||
rate = Cvar_Get( "rate", "3500", FCVAR_USERINFO|FCVAR_ARCHIVE, "player network rate" );
|
||||
topcolor = Cvar_Get( "topcolor", "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "player top color" );
|
||||
bottomcolor = Cvar_Get( "bottomcolor", "0", FCVAR_USERINFO|FCVAR_ARCHIVE, "player bottom color" );
|
||||
@@ -2626,10 +2853,11 @@ void CL_InitLocal( void )
|
||||
cl_bmodelinterp = Cvar_Get( "cl_bmodelinterp", "1", FCVAR_ARCHIVE, "enable bmodel interpolation" );
|
||||
cl_clockreset = Cvar_Get( "cl_clockreset", "0.1", FCVAR_ARCHIVE, "frametime delta maximum value before reset" );
|
||||
cl_fixtimerate = Cvar_Get( "cl_fixtimerate", "7.5", FCVAR_ARCHIVE, "time in msec to client clock adjusting" );
|
||||
Cvar_Get( "hud_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
|
||||
hud_scale = Cvar_Get( "hud_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "scale hud at current resolution" );
|
||||
Cvar_Get( "cl_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" );
|
||||
cl_showevents = Cvar_Get( "cl_showevents", "0", FCVAR_ARCHIVE, "show events playback" );
|
||||
Cvar_Get( "lastdemo", "", FCVAR_ARCHIVE, "last played demo" );
|
||||
ui_renderworld = Cvar_Get( "ui_renderworld", "0", FCVAR_ARCHIVE, "render world when UI is visible" );
|
||||
|
||||
// these two added to shut up CS 1.5 about 'unknown' commands
|
||||
Cvar_Get( "lightgamma", "1", FCVAR_ARCHIVE, "ambient lighting level (legacy, unused)" );
|
||||
@@ -2688,6 +2916,8 @@ void CL_InitLocal( void )
|
||||
Cmd_AddCommand ("reconnect", CL_Reconnect_f, "reconnect to current level" );
|
||||
|
||||
Cmd_AddCommand ("rcon", CL_Rcon_f, "sends a command to the server console (rcon_password and rcon_address required)" );
|
||||
Cmd_AddCommand ("precache", CL_LegacyPrecache_f, "legacy server compatibility" );
|
||||
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
@@ -2709,12 +2939,13 @@ void CL_AdjustClock( void )
|
||||
|
||||
if( fabs( cl.timedelta ) >= 0.001f )
|
||||
{
|
||||
double msec, adjust, sign;
|
||||
double msec, adjust;
|
||||
float sign;
|
||||
|
||||
msec = ( cl.timedelta * 1000.0 );
|
||||
sign = ( msec < 0 ) ? 1.0 : -1.0;
|
||||
msec = ( cl.timedelta * 1000.0f );
|
||||
sign = ( msec < 0 ) ? 1.0f : -1.0f;
|
||||
msec = fabs( msec );
|
||||
adjust = sign * ( cl_fixtimerate->value / 1000.0 );
|
||||
adjust = sign * ( cl_fixtimerate->value / 1000.0f );
|
||||
|
||||
if( fabs( adjust ) < fabs( cl.timedelta ))
|
||||
{
|
||||
@@ -2824,19 +3055,26 @@ CL_Init
|
||||
*/
|
||||
void CL_Init( void )
|
||||
{
|
||||
string libpath;
|
||||
|
||||
if( host.type == HOST_DEDICATED )
|
||||
return; // nothing running on the client
|
||||
|
||||
CL_InitLocal();
|
||||
|
||||
R_Init(); // init renderer
|
||||
VID_Init(); // init video
|
||||
S_Init(); // init sound
|
||||
|
||||
// unreliable buffer. unsed for unreliable commands and voice stream
|
||||
MSG_Init( &cls.datagram, "cls.datagram", cls.datagram_buf, sizeof( cls.datagram_buf ));
|
||||
|
||||
if( !CL_LoadProgs( va( "%s/client.dll", GI->dll_path )))
|
||||
Host_Error( "can't initialize client.dll\n" );
|
||||
// IN_TouchInit();
|
||||
Con_LoadHistory();
|
||||
|
||||
COM_GetCommonLibraryPath( LIBRARY_CLIENT, libpath, sizeof( libpath ));
|
||||
|
||||
if( !CL_LoadProgs( libpath ) )
|
||||
Host_Error( "can't initialize %s: %s\n", libpath, COM_GetLibraryError() );
|
||||
|
||||
cls.initialized = true;
|
||||
cl.maxclients = 1; // allow to drawing player in menu
|
||||
@@ -2858,11 +3096,18 @@ void CL_Shutdown( void )
|
||||
|
||||
Con_Printf( "CL_Shutdown()\n" );
|
||||
|
||||
Host_WriteOpenGLConfig ();
|
||||
Host_WriteVideoConfig ();
|
||||
if( !host.crashed )
|
||||
{
|
||||
Host_WriteOpenGLConfig ();
|
||||
Host_WriteVideoConfig ();
|
||||
Touch_WriteConfig();
|
||||
}
|
||||
|
||||
CL_CloseDemoHeader();
|
||||
// IN_TouchShutdown ();
|
||||
Joy_Shutdown ();
|
||||
CL_CloseDemoHeader ();
|
||||
IN_Shutdown ();
|
||||
Mobile_Shutdown ();
|
||||
SCR_Shutdown ();
|
||||
CL_UnloadProgs ();
|
||||
|
||||
@@ -2872,4 +3117,4 @@ void CL_Shutdown( void )
|
||||
R_Shutdown ();
|
||||
|
||||
Con_Shutdown ();
|
||||
}
|
||||
}
|
||||
|
||||
136
engine/client/cl_mobile.c
Normal file
136
engine/client/cl_mobile.c
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
cl_mobile.c - common mobile interface
|
||||
Copyright (C) 2015 a1batross
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "mobility_int.h"
|
||||
#include "library.h"
|
||||
#include "input.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
mobile_engfuncs_t *gMobileEngfuncs;
|
||||
|
||||
convar_t *vibration_length;
|
||||
convar_t *vibration_enable;
|
||||
|
||||
static void pfnVibrate( float life, char flags )
|
||||
{
|
||||
if( !vibration_enable->value )
|
||||
return;
|
||||
|
||||
if( life < 0.0f )
|
||||
{
|
||||
Con_Reportf( S_WARN "Negative vibrate time: %f\n", life );
|
||||
return;
|
||||
}
|
||||
|
||||
//Con_Reportf( "Vibrate: %f %d\n", life, flags );
|
||||
|
||||
// here goes platform-specific backends
|
||||
Platform_Vibrate( life * vibration_length->value, flags );
|
||||
}
|
||||
|
||||
static void Vibrate_f( void )
|
||||
{
|
||||
if( Cmd_Argc() != 2 )
|
||||
{
|
||||
Msg( S_USAGE "vibrate <time>\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
pfnVibrate( Q_atof( Cmd_Argv(1) ), VIBRATE_NORMAL );
|
||||
}
|
||||
|
||||
static void pfnEnableTextInput( int enable )
|
||||
{
|
||||
Key_EnableTextInput( enable, false );
|
||||
}
|
||||
|
||||
static int pfnDrawScaledCharacter( int x, int y, int number, int r, int g, int b, float scale )
|
||||
{
|
||||
int width = clgame.scrInfo.charWidths[number] * scale * hud_scale->value;
|
||||
int height = clgame.scrInfo.iCharHeight * scale * hud_scale->value;
|
||||
|
||||
if( !cls.creditsFont.valid )
|
||||
return 0;
|
||||
|
||||
x *= hud_scale->value;
|
||||
y *= hud_scale->value;
|
||||
|
||||
number &= 255;
|
||||
number = Con_UtfProcessChar( number );
|
||||
|
||||
if( number < 32 )
|
||||
return 0;
|
||||
|
||||
if( y < -height )
|
||||
return 0;
|
||||
|
||||
pfnPIC_Set( cls.creditsFont.hFontTexture, r, g, b, 255 );
|
||||
pfnPIC_DrawAdditive( x, y, width, height, &cls.creditsFont.fontRc[number] );
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
static void *pfnGetNativeObject( const char *obj )
|
||||
{
|
||||
if( !obj )
|
||||
return NULL;
|
||||
|
||||
// Backend should consider that obj is case-sensitive
|
||||
return Platform_GetNativeObject( obj );
|
||||
}
|
||||
|
||||
|
||||
static mobile_engfuncs_t gpMobileEngfuncs =
|
||||
{
|
||||
MOBILITY_API_VERSION,
|
||||
pfnVibrate,
|
||||
pfnEnableTextInput,
|
||||
Touch_AddClientButton,
|
||||
Touch_AddDefaultButton,
|
||||
Touch_HideButtons,
|
||||
Touch_RemoveButton,
|
||||
(void*)Touch_SetClientOnly,
|
||||
Touch_ResetDefaultButtons,
|
||||
pfnDrawScaledCharacter,
|
||||
Sys_Warn,
|
||||
pfnGetNativeObject,
|
||||
ID_SetCustomClientID
|
||||
};
|
||||
|
||||
qboolean Mobile_Init( void )
|
||||
{
|
||||
qboolean success = false;
|
||||
pfnMobilityInterface ExportToClient;
|
||||
|
||||
// find a mobility interface
|
||||
ExportToClient = COM_GetProcAddress( clgame.hInstance, MOBILITY_CLIENT_EXPORT );
|
||||
gMobileEngfuncs = &gpMobileEngfuncs;
|
||||
|
||||
if( ExportToClient && !ExportToClient( gMobileEngfuncs ) )
|
||||
success = true;
|
||||
|
||||
Cmd_AddCommand( "vibrate", (xcommand_t)Vibrate_f, "Vibrate for specified time");
|
||||
vibration_length = Cvar_Get( "vibration_length", "1.0", FCVAR_ARCHIVE, "Vibration length");
|
||||
vibration_enable = Cvar_Get( "vibration_enable", "1", FCVAR_ARCHIVE, "Enable vibration");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void Mobile_Shutdown( void )
|
||||
{
|
||||
Cmd_RemoveCommand( "vibrate" );
|
||||
}
|
||||
@@ -15,14 +15,17 @@ GNU General Public License for more details.
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
#if XASH_LOW_MEMORY
|
||||
#define NET_TIMINGS 1024
|
||||
#else
|
||||
#define NET_TIMINGS 64
|
||||
#endif
|
||||
#define NET_TIMINGS_MASK (NET_TIMINGS - 1)
|
||||
#define LATENCY_AVG_FRAC 0.5
|
||||
#define FRAMERATE_AVG_FRAC 0.5
|
||||
#define PACKETLOSS_AVG_FRAC 0.5
|
||||
#define PACKETCHOKE_AVG_FRAC 0.5
|
||||
#define LATENCY_AVG_FRAC 0.5f
|
||||
#define FRAMERATE_AVG_FRAC 0.5f
|
||||
#define PACKETLOSS_AVG_FRAC 0.5f
|
||||
#define PACKETCHOKE_AVG_FRAC 0.5f
|
||||
#define NETGRAPH_LERP_HEIGHT 24
|
||||
#define NETGRAPH_NET_COLORS 5
|
||||
#define NUM_LATENCY_SAMPLES 8
|
||||
@@ -75,12 +78,12 @@ NetGraph_FillRGBA shortcut
|
||||
*/
|
||||
static void NetGraph_DrawRect( wrect_t *rect, byte colors[4] )
|
||||
{
|
||||
pglColor4ubv( colors ); // color for this quad
|
||||
ref.dllFuncs.Color4ub( colors[0], colors[1], colors[2], colors[3] ); // color for this quad
|
||||
|
||||
pglVertex2f( rect->left, rect->top );
|
||||
pglVertex2f( rect->left + rect->right, rect->top );
|
||||
pglVertex2f( rect->left + rect->right, rect->top + rect->bottom );
|
||||
pglVertex2f( rect->left, rect->top + rect->bottom );
|
||||
ref.dllFuncs.Vertex3f( rect->left, rect->top, 0 );
|
||||
ref.dllFuncs.Vertex3f( rect->left + rect->right, rect->top, 0 );
|
||||
ref.dllFuncs.Vertex3f( rect->left + rect->right, rect->top + rect->bottom, 0 );
|
||||
ref.dllFuncs.Vertex3f( rect->left, rect->top + rect->bottom, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -204,7 +207,7 @@ void NetGraph_GetFrameData( float *latency, int *latency_count )
|
||||
else
|
||||
{
|
||||
int frame_latency = Q_min( 1.0f, f->latency );
|
||||
p->latency = (( frame_latency + 0.1 ) / 1.1 ) * ( net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2 );
|
||||
p->latency = (( frame_latency + 0.1f ) / 1.1f ) * ( net_graphheight->value - NETGRAPH_LERP_HEIGHT - 2 );
|
||||
|
||||
if( i > cls.netchan.incoming_sequence - NUM_LATENCY_SAMPLES )
|
||||
{
|
||||
@@ -230,12 +233,12 @@ void NetGraph_GetFrameData( float *latency, int *latency_count )
|
||||
}
|
||||
|
||||
// packet loss
|
||||
loss = 100.0 * (float)loss_count / CL_UPDATE_BACKUP;
|
||||
packet_loss = PACKETLOSS_AVG_FRAC * packet_loss + ( 1.0 - PACKETLOSS_AVG_FRAC ) * loss;
|
||||
loss = 100.0f * (float)loss_count / CL_UPDATE_BACKUP;
|
||||
packet_loss = PACKETLOSS_AVG_FRAC * packet_loss + ( 1.0f - PACKETLOSS_AVG_FRAC ) * loss;
|
||||
|
||||
// packet choke
|
||||
choke = 100.0 * (float)choke_count / CL_UPDATE_BACKUP;
|
||||
packet_choke = PACKETCHOKE_AVG_FRAC * packet_choke + ( 1.0 - PACKETCHOKE_AVG_FRAC ) * choke;
|
||||
choke = 100.0f * (float)choke_count / CL_UPDATE_BACKUP;
|
||||
packet_choke = PACKETCHOKE_AVG_FRAC * packet_choke + ( 1.0f - PACKETCHOKE_AVG_FRAC ) * choke;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -366,12 +369,12 @@ void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, floa
|
||||
avg -= 1000.0f / cl_updaterate->value;
|
||||
|
||||
// can't be below zero
|
||||
avg = Q_max( 0.0, avg );
|
||||
avg = Q_max( 0.0f, avg );
|
||||
}
|
||||
else avg = 0.0;
|
||||
|
||||
// move rolling average
|
||||
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0 - FRAMERATE_AVG_FRAC ) * framerate;
|
||||
framerate = FRAMERATE_AVG_FRAC * host.frametime + ( 1.0f - FRAMERATE_AVG_FRAC ) * framerate;
|
||||
Con_SetFont( 0 );
|
||||
|
||||
if( framerate > 0.0f )
|
||||
@@ -397,8 +400,8 @@ void NetGraph_DrawTextFields( int x, int y, int w, wrect_t rect, int count, floa
|
||||
|
||||
if( net_graph->value > 2 )
|
||||
{
|
||||
int loss = (int)(( packet_loss + PACKETLOSS_AVG_FRAC ) - 0.01 );
|
||||
int choke = (int)(( packet_choke + PACKETCHOKE_AVG_FRAC ) - 0.01 );
|
||||
int loss = (int)(( packet_loss + PACKETLOSS_AVG_FRAC ) - 0.01f );
|
||||
int choke = (int)(( packet_choke + PACKETCHOKE_AVG_FRAC ) - 0.01f );
|
||||
|
||||
Con_DrawString( x, y, va( "loss: %i choke: %i", loss, choke ), colors );
|
||||
}
|
||||
@@ -595,8 +598,8 @@ NetGraph_GetScreenPos
|
||||
void NetGraph_GetScreenPos( wrect_t *rect, int *w, int *x, int *y )
|
||||
{
|
||||
rect->left = rect->top = 0;
|
||||
rect->right = glState.width;
|
||||
rect->bottom = glState.height;
|
||||
rect->right = refState.width;
|
||||
rect->bottom = refState.height;
|
||||
|
||||
*w = Q_min( NET_TIMINGS, net_graphwidth->value );
|
||||
if( rect->right < *w + 10 )
|
||||
@@ -652,20 +655,17 @@ void SCR_DrawNetGraph( void )
|
||||
|
||||
if( net_graph->value < 3 )
|
||||
{
|
||||
pglEnable( GL_BLEND );
|
||||
pglDisable( GL_TEXTURE_2D );
|
||||
pglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
||||
pglBegin( GL_QUADS ); // draw all the fills as a long solid sequence of quads for speedup reasons
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderTransAdd );
|
||||
|
||||
ref.dllFuncs.Begin( TRI_QUADS ); // draw all the fills as a long solid sequence of quads for speedup reasons
|
||||
|
||||
// NOTE: fill colors without texture at this point
|
||||
NetGraph_DrawDataUsage( x, y, w );
|
||||
NetGraph_DrawTimes( rect, x, w );
|
||||
|
||||
pglEnd();
|
||||
pglColor4ub( 255, 255, 255, 255 );
|
||||
pglEnable( GL_TEXTURE_2D );
|
||||
pglDisable( GL_BLEND );
|
||||
ref.dllFuncs.End();
|
||||
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -680,4 +680,4 @@ void CL_InitNetgraph( void )
|
||||
packet_loss = packet_choke = 0.0;
|
||||
|
||||
NetGraph_InitColors();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -216,7 +216,7 @@ qboolean CL_PlayerTeleported( local_state_t *from, local_state_t *to )
|
||||
VectorSubtract( to->playerstate.origin, from->playerstate.origin, delta );
|
||||
|
||||
// compute potential max movement in units per frame and compare with entity movement
|
||||
maxlen = ( clgame.movevars.maxvelocity * ( 1.0 / GAME_FPS ));
|
||||
maxlen = ( clgame.movevars.maxvelocity * ( 1.0f / GAME_FPS ));
|
||||
len = VectorLength( delta );
|
||||
|
||||
return (len > maxlen);
|
||||
@@ -755,7 +755,7 @@ static pmtrace_t pfnPlayerTrace( float *start, float *end, int traceFlags, int i
|
||||
return PM_PlayerTraceExt( clgame.pmove, start, end, traceFlags, clgame.pmove->numphysent, clgame.pmove->physents, ignore_pe, NULL );
|
||||
}
|
||||
|
||||
static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
|
||||
pmtrace_t *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe )
|
||||
{
|
||||
static pmtrace_t tr;
|
||||
int old_usehull;
|
||||
@@ -887,17 +887,6 @@ static pmtrace_t *pfnTraceLineEx( float *start, float *end, int flags, int usehu
|
||||
return &tr;
|
||||
}
|
||||
|
||||
static struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
if( ground < 0 || ground >= clgame.pmove->numphysent )
|
||||
return NULL; // bad ground
|
||||
|
||||
pe = &clgame.pmove->physents[ground];
|
||||
return PM_TraceSurface( pe, vstart, vend );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_InitClientMove
|
||||
@@ -928,7 +917,7 @@ void CL_InitClientMove( void )
|
||||
|
||||
// common utilities
|
||||
clgame.pmove->PM_Info_ValueForKey = Info_ValueForKey;
|
||||
clgame.pmove->PM_Particle = CL_Particle;
|
||||
clgame.pmove->PM_Particle = CL_Particle; // ref should be initialized here already
|
||||
clgame.pmove->PM_TestPlayerPosition = pfnTestPlayerPosition;
|
||||
clgame.pmove->Con_NPrintf = Con_NPrintf;
|
||||
clgame.pmove->Con_DPrintf = Con_DPrintf;
|
||||
@@ -939,12 +928,12 @@ void CL_InitClientMove( void )
|
||||
clgame.pmove->PM_TruePointContents = pfnTruePointContents;
|
||||
clgame.pmove->PM_HullPointContents = pfnHullPointContents;
|
||||
clgame.pmove->PM_PlayerTrace = pfnPlayerTrace;
|
||||
clgame.pmove->PM_TraceLine = pfnTraceLine;
|
||||
clgame.pmove->PM_TraceLine = PM_TraceLine;
|
||||
clgame.pmove->RandomLong = COM_RandomLong;
|
||||
clgame.pmove->RandomFloat = COM_RandomFloat;
|
||||
clgame.pmove->PM_GetModelType = pfnGetModelType;
|
||||
clgame.pmove->PM_GetModelBounds = pfnGetModelBounds;
|
||||
clgame.pmove->PM_HullForBsp = pfnHullForBsp;
|
||||
clgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp;
|
||||
clgame.pmove->PM_TraceModel = pfnTraceModel;
|
||||
clgame.pmove->COM_FileSize = COM_FileSize;
|
||||
clgame.pmove->COM_LoadFile = COM_LoadFile;
|
||||
@@ -1337,14 +1326,14 @@ void CL_PredictMovement( qboolean repredicting )
|
||||
cls.correction_time -= host.frametime;
|
||||
|
||||
// Make sure smoothtime is postive
|
||||
if( cl_smoothtime->value <= 0.0 )
|
||||
if( cl_smoothtime->value <= 0.0f )
|
||||
Cvar_DirectSet( cl_smoothtime, "0.1" );
|
||||
|
||||
// Clamp from 0 to cl_smoothtime.value
|
||||
cls.correction_time = bound( 0.0, cls.correction_time, cl_smoothtime->value );
|
||||
|
||||
// Compute backward interpolation fraction along full correction
|
||||
frac = 1.0 - cls.correction_time / cl_smoothtime->value;
|
||||
frac = 1.0f - cls.correction_time / cl_smoothtime->value;
|
||||
|
||||
// Determine how much error we still have to make up for
|
||||
VectorSubtract( cl.simorg, cl.local.lastorigin, delta );
|
||||
@@ -1359,4 +1348,4 @@ void CL_PredictMovement( qboolean repredicting )
|
||||
|
||||
VectorCopy( cl.simorg, cl.local.lastorigin );
|
||||
cl.local.repredicting = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ GNU General Public License for more details.
|
||||
#include "client.h"
|
||||
#include "net_encode.h"
|
||||
#include "particledef.h"
|
||||
#include "gl_local.h"
|
||||
#include "cl_tent.h"
|
||||
#include "shake.h"
|
||||
#include "hltv.h"
|
||||
@@ -86,7 +85,7 @@ static qboolean CL_QuakeEntityTeleported( cl_entity_t *ent, entity_state_t *news
|
||||
VectorSubtract( newstate->origin, ent->prevstate.origin, delta );
|
||||
|
||||
// compute potential max movement in units per frame and compare with entity movement
|
||||
maxlen = ( clgame.movevars.maxvelocity * ( 1.0 / GAME_FPS ));
|
||||
maxlen = ( clgame.movevars.maxvelocity * ( 1.0f / GAME_FPS ));
|
||||
len = VectorLength( delta );
|
||||
|
||||
return (len > maxlen);
|
||||
@@ -303,8 +302,8 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
|
||||
|
||||
// get splash name
|
||||
if( cls.demoplayback && ( cls.demonum != -1 ))
|
||||
Cvar_Set( "cl_levelshot_name", va( "levelshots/%s_%s", cls.demoname, glState.wideScreen ? "16x9" : "4x3" ));
|
||||
else Cvar_Set( "cl_levelshot_name", va( "levelshots/%s_%s", clgame.mapname, glState.wideScreen ? "16x9" : "4x3" ));
|
||||
Cvar_Set( "cl_levelshot_name", va( "levelshots/%s_%s", cls.demoname, refState.wideScreen ? "16x9" : "4x3" ));
|
||||
else Cvar_Set( "cl_levelshot_name", va( "levelshots/%s_%s", clgame.mapname, refState.wideScreen ? "16x9" : "4x3" ));
|
||||
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
|
||||
|
||||
if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background )
|
||||
@@ -350,8 +349,8 @@ static void CL_ParseQuakeClientData( sizebuf_t *msg )
|
||||
// this is the frame update that this message corresponds to
|
||||
i = cls.netchan.incoming_sequence;
|
||||
|
||||
cl.parsecount = i; // ack'd incoming messages.
|
||||
cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window.
|
||||
cl.parsecount = i; // ack'd incoming messages.
|
||||
cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window.
|
||||
frame = &cl.frames[cl.parsecountmod]; // frame at index.
|
||||
frame->time = cl.mtime[0]; // mark network received time
|
||||
frame->receivedtime = host.realtime; // time now that we are parsing.
|
||||
@@ -677,7 +676,7 @@ static void CL_ParseQuakeStaticEntity( sizebuf_t *msg )
|
||||
if( ent->model != NULL )
|
||||
{
|
||||
// auto 'solid' faces
|
||||
if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && CL_IsQuakeCompatible( ))
|
||||
if( FBitSet( ent->model->flags, MODEL_TRANSPARENT ) && Host_IsQuakeCompatible())
|
||||
{
|
||||
ent->curstate.rendermode = kRenderTransAlpha;
|
||||
ent->curstate.renderamt = 255;
|
||||
@@ -1130,4 +1129,4 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
|
||||
|
||||
// check deferred cmds
|
||||
CL_QuakeExecStuff();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ GNU General Public License for more details.
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
#include "studio.h"
|
||||
|
||||
/*
|
||||
@@ -78,7 +77,9 @@ byte *CL_CreateRawTextureFromPixels( texture_t *tx, size_t *size, int topcolor,
|
||||
// fill header
|
||||
if( !pin.name[0] ) Q_strncpy( pin.name, "#raw_remap_image.mdl", sizeof( pin.name ));
|
||||
pin.flags = STUDIO_NF_COLORMAP; // just in case :-)
|
||||
pin.index = (int)(tx + 1); // pointer to pixels
|
||||
//pin.index = (int)(tx + 1); // pointer to pixels
|
||||
// no more pointer-to-int-to-pointer casts
|
||||
Image_SetMDLPointer( (byte*)((texture_t *)tx + 1) );
|
||||
pin.width = tx->width;
|
||||
pin.height = tx->height;
|
||||
|
||||
@@ -99,22 +100,23 @@ Dupliacte texture with remap pixels
|
||||
*/
|
||||
void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
{
|
||||
gl_texture_t *glt;
|
||||
const char *name;
|
||||
texture_t *tx = NULL;
|
||||
char texname[128];
|
||||
int i, size, index;
|
||||
int i, index;
|
||||
size_t size;
|
||||
byte paletteBackup[768];
|
||||
byte *raw, *pal;
|
||||
|
||||
// save off the real texture index
|
||||
index = ptexture->index;
|
||||
glt = R_GetTexture( index );
|
||||
Q_snprintf( texname, sizeof( texname ), "#%i_%s", RI.currententity->curstate.number, glt->name + 1 );
|
||||
name = ref.dllFuncs.GL_TextureName( index );
|
||||
Q_snprintf( texname, sizeof( texname ), "#%i_%s", refState.currententity->curstate.number, name + 1 );
|
||||
|
||||
// search for pixels
|
||||
for( i = 0; i < RI.currentmodel->numtextures; i++ )
|
||||
for( i = 0; i < refState.currentmodel->numtextures; i++ )
|
||||
{
|
||||
tx = RI.currentmodel->textures[i];
|
||||
tx = refState.currentmodel->textures[i];
|
||||
if( tx->gl_texturenum == index )
|
||||
break; // found
|
||||
}
|
||||
@@ -126,7 +128,7 @@ void CL_DuplicateTexture( mstudiotexture_t *ptexture, int topcolor, int bottomco
|
||||
memcpy( paletteBackup, pal, 768 );
|
||||
|
||||
raw = CL_CreateRawTextureFromPixels( tx, &size, topcolor, bottomcolor );
|
||||
ptexture->index = GL_LoadTexture( texname, raw, size, TF_FORCE_COLOR ); // do copy
|
||||
ptexture->index = ref.dllFuncs.GL_LoadTexture( texname, raw, size, TF_FORCE_COLOR ); // do copy
|
||||
|
||||
// restore original palette
|
||||
memcpy( pal, paletteBackup, 768 );
|
||||
@@ -141,30 +143,31 @@ Update texture top and bottom colors
|
||||
*/
|
||||
void CL_UpdateStudioTexture( mstudiotexture_t *ptexture, int topcolor, int bottomcolor )
|
||||
{
|
||||
gl_texture_t *glt;
|
||||
rgbdata_t *pic;
|
||||
texture_t *tx = NULL;
|
||||
char texname[128], name[128], mdlname[128];
|
||||
int i, size, index;
|
||||
const char *origtexname;
|
||||
int i, index;
|
||||
size_t size;
|
||||
byte paletteBackup[768];
|
||||
byte *raw, *pal;
|
||||
|
||||
// save off the real texture index
|
||||
glt = R_GetTexture( ptexture->index );
|
||||
origtexname = ref.dllFuncs.GL_TextureName( ptexture->index );
|
||||
|
||||
// build name of original texture
|
||||
Q_strncpy( mdlname, RI.currentmodel->name, sizeof( mdlname ));
|
||||
Q_strncpy( mdlname, refState.currentmodel->name, sizeof( mdlname ));
|
||||
COM_FileBase( ptexture->name, name );
|
||||
COM_StripExtension( mdlname );
|
||||
|
||||
Q_snprintf( texname, sizeof( texname ), "#%s/%s.mdl", mdlname, name );
|
||||
index = GL_FindTexture( texname );
|
||||
index = ref.dllFuncs.GL_FindTexture( texname );
|
||||
if( !index ) return; // couldn't find texture
|
||||
|
||||
// search for pixels
|
||||
for( i = 0; i < RI.currentmodel->numtextures; i++ )
|
||||
for( i = 0; i < refState.currentmodel->numtextures; i++ )
|
||||
{
|
||||
tx = RI.currentmodel->textures[i];
|
||||
tx = refState.currentmodel->textures[i];
|
||||
if( tx->gl_texturenum == index )
|
||||
break; // found
|
||||
}
|
||||
@@ -176,14 +179,14 @@ void CL_UpdateStudioTexture( mstudiotexture_t *ptexture, int topcolor, int botto
|
||||
memcpy( paletteBackup, pal, 768 );
|
||||
|
||||
raw = CL_CreateRawTextureFromPixels( tx, &size, topcolor, bottomcolor );
|
||||
pic = FS_LoadImage( glt->name, raw, size );
|
||||
pic = FS_LoadImage( origtexname, raw, size );
|
||||
if( !pic )
|
||||
{
|
||||
Con_DPrintf( S_ERROR "Couldn't update texture %s\n", glt->name );
|
||||
Con_DPrintf( S_ERROR "Couldn't update texture %s\n", origtexname );
|
||||
return;
|
||||
}
|
||||
|
||||
index = GL_UpdateTextureInternal( glt->name, pic, 0 );
|
||||
index = GL_UpdateTextureInternal( origtexname, pic, 0 );
|
||||
FS_FreeImage( pic );
|
||||
|
||||
// restore original palette
|
||||
@@ -205,15 +208,15 @@ void CL_UpdateAliasTexture( unsigned short *texture, int skinnum, int topcolor,
|
||||
rgbdata_t skin, *pic;
|
||||
texture_t *tx;
|
||||
|
||||
if( !texture || !RI.currentmodel->textures )
|
||||
if( !texture || !refState.currentmodel->textures )
|
||||
return; // no remapinfo in model
|
||||
|
||||
tx = RI.currentmodel->textures[skinnum];
|
||||
tx = refState.currentmodel->textures[skinnum];
|
||||
if( !tx ) return; // missing texture ?
|
||||
|
||||
if( *texture == 0 )
|
||||
{
|
||||
Q_snprintf( texname, sizeof( texname ), "%s:remap%i_%i", RI.currentmodel->name, skinnum, RI.currententity->index );
|
||||
Q_snprintf( texname, sizeof( texname ), "%s:remap%i_%i", refState.currentmodel->name, skinnum, refState.currententity->index );
|
||||
skin.width = tx->width;
|
||||
skin.height = tx->height;
|
||||
skin.depth = skin.numMips = 1;
|
||||
@@ -228,7 +231,7 @@ void CL_UpdateAliasTexture( unsigned short *texture, int skinnum, int topcolor,
|
||||
}
|
||||
|
||||
// and now we can remap with internal routines
|
||||
GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor );
|
||||
ref.dllFuncs.GL_ProcessTexture( *texture, -1.0f, topcolor, bottomcolor );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -247,10 +250,10 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
||||
mstudiotexture_t *src, *dst;
|
||||
int i, size;
|
||||
|
||||
if( !RI.currententity ) return;
|
||||
i = ( RI.currententity == &clgame.viewent ) ? clgame.maxEntities : RI.currententity->curstate.number;
|
||||
if( !refState.currententity ) return;
|
||||
i = ( refState.currententity == &clgame.viewent ) ? clgame.maxEntities : refState.currententity->curstate.number;
|
||||
|
||||
if( !RI.currentmodel || ( RI.currentmodel->type != mod_alias && RI.currentmodel->type != mod_studio ))
|
||||
if( !refState.currentmodel || ( refState.currentmodel->type != mod_alias && refState.currentmodel->type != mod_studio ))
|
||||
{
|
||||
// entity has changed model by another type, release remap info
|
||||
if( clgame.remap_info[i] )
|
||||
@@ -262,7 +265,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
||||
}
|
||||
|
||||
// model doesn't contains remap textures
|
||||
if( RI.currentmodel->numtextures <= 0 )
|
||||
if( refState.currentmodel->numtextures <= 0 )
|
||||
{
|
||||
// entity has changed model with no remap textures
|
||||
if( clgame.remap_info[i] )
|
||||
@@ -273,16 +276,16 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
||||
return;
|
||||
}
|
||||
|
||||
if( RI.currentmodel->type == mod_studio )
|
||||
if( refState.currentmodel->type == mod_studio )
|
||||
{
|
||||
phdr = (studiohdr_t *)Mod_StudioExtradata( RI.currentmodel );
|
||||
phdr = (studiohdr_t *)Mod_StudioExtradata( refState.currentmodel );
|
||||
if( !phdr ) return; // bad model?
|
||||
|
||||
src = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex);
|
||||
dst = (clgame.remap_info[i] ? clgame.remap_info[i]->ptexture : NULL);
|
||||
|
||||
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
|
||||
if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != RI.currentmodel )
|
||||
if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != refState.currentmodel )
|
||||
{
|
||||
// this code catches studiomodel change with another studiomodel with remap textures
|
||||
// e.g. playermodel 'barney' with playermodel 'gordon'
|
||||
@@ -314,13 +317,13 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
||||
CL_DuplicateTexture( &dst[i], topcolor, bottomcolor );
|
||||
}
|
||||
}
|
||||
else if( RI.currentmodel->type == mod_alias )
|
||||
else if( refState.currentmodel->type == mod_alias )
|
||||
{
|
||||
ahdr = (aliashdr_t *)Mod_AliasExtradata( RI.currentmodel );
|
||||
ahdr = (aliashdr_t *)Mod_AliasExtradata( refState.currentmodel );
|
||||
if( !ahdr ) return; // bad model?
|
||||
|
||||
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
|
||||
if( !clgame.remap_info[i] || clgame.remap_info[i]->model != RI.currentmodel )
|
||||
if( !clgame.remap_info[i] || clgame.remap_info[i]->model != refState.currentmodel )
|
||||
{
|
||||
// this code catches studiomodel change with another studiomodel with remap textures
|
||||
// e.g. playermodel 'barney' with playermodel 'gordon'
|
||||
@@ -333,7 +336,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
||||
return;
|
||||
}
|
||||
|
||||
info->numtextures = RI.currentmodel->numtextures;
|
||||
info->numtextures = refState.currentmodel->numtextures;
|
||||
|
||||
// alias remapping is easy
|
||||
CL_UpdateRemapInfo( topcolor, bottomcolor );
|
||||
@@ -344,7 +347,7 @@ void CL_AllocRemapInfo( int topcolor, int bottomcolor )
|
||||
return;
|
||||
}
|
||||
|
||||
info->model = RI.currentmodel;
|
||||
info->model = refState.currentmodel;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -359,7 +362,7 @@ void CL_UpdateRemapInfo( int topcolor, int bottomcolor )
|
||||
remap_info_t *info;
|
||||
int i;
|
||||
|
||||
i = ( RI.currententity == &clgame.viewent ) ? clgame.maxEntities : RI.currententity->curstate.number;
|
||||
i = ( refState.currententity == &clgame.viewent ) ? clgame.maxEntities : refState.currententity->curstate.number;
|
||||
info = clgame.remap_info[i];
|
||||
if( !info ) return; // no remap info
|
||||
|
||||
@@ -399,11 +402,11 @@ void CL_FreeRemapInfo( remap_info_t *info )
|
||||
if( info->ptexture != NULL )
|
||||
{
|
||||
if( FBitSet( info->ptexture[i].flags, STUDIO_NF_COLORMAP ))
|
||||
GL_FreeTexture( info->ptexture[i].index );
|
||||
ref.dllFuncs.GL_FreeTexture( info->ptexture[i].index );
|
||||
}
|
||||
|
||||
if( info->textures[i] != 0 )
|
||||
GL_FreeTexture( info->textures[i] );
|
||||
ref.dllFuncs.GL_FreeTexture( info->textures[i] );
|
||||
}
|
||||
|
||||
Mem_Free( info ); // release struct
|
||||
@@ -430,4 +433,4 @@ void CL_ClearAllRemaps( void )
|
||||
Mem_Free( clgame.remap_info );
|
||||
}
|
||||
clgame.remap_info = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
345
engine/client/cl_render.c
Normal file
345
engine/client/cl_render.c
Normal file
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
cl_render.c - RenderAPI loader & implementation
|
||||
Copyright (C) 2019 a1batross
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "library.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis )
|
||||
{
|
||||
return Mod_FatPVS( org, radius, visbuffer, world.visbytes, merge, fullvis );
|
||||
}
|
||||
|
||||
lightstyle_t *CL_GetLightStyle( int number )
|
||||
{
|
||||
Assert( number >= 0 && number < MAX_LIGHTSTYLES );
|
||||
return &cl.lightstyles[number];
|
||||
}
|
||||
|
||||
const ref_overview_t *GL_GetOverviewParms( void )
|
||||
{
|
||||
return &clgame.overView;
|
||||
}
|
||||
|
||||
static void *R_Mem_Alloc( size_t cb, const char *filename, const int fileline )
|
||||
{
|
||||
return _Mem_Alloc( cls.mempool, cb, true, filename, fileline );
|
||||
}
|
||||
|
||||
static void R_Mem_Free( void *mem, const char *filename, const int fileline )
|
||||
{
|
||||
if( !mem ) return;
|
||||
_Mem_Free( mem, filename, fileline );
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
pfnGetFilesList
|
||||
|
||||
=========
|
||||
*/
|
||||
static char **pfnGetFilesList( const char *pattern, int *numFiles, int gamedironly )
|
||||
{
|
||||
static search_t *t = NULL;
|
||||
|
||||
if( t ) Mem_Free( t ); // release prev search
|
||||
|
||||
t = FS_Search( pattern, true, gamedironly );
|
||||
|
||||
if( !t )
|
||||
{
|
||||
if( numFiles ) *numFiles = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( numFiles ) *numFiles = t->numfilenames;
|
||||
return t->filenames;
|
||||
}
|
||||
|
||||
static uint pfnFileBufferCRC32( const void *buffer, const int length )
|
||||
{
|
||||
uint modelCRC = 0;
|
||||
|
||||
if( !buffer || length <= 0 )
|
||||
return modelCRC;
|
||||
|
||||
CRC32_Init( &modelCRC );
|
||||
CRC32_ProcessBuffer( &modelCRC, buffer, length );
|
||||
return CRC32_Final( modelCRC );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_EnvShot
|
||||
|
||||
=================
|
||||
*/
|
||||
static void R_EnvShot( const float *vieworg, const char *name, qboolean skyshot, int shotsize )
|
||||
{
|
||||
static vec3_t viewPoint;
|
||||
|
||||
if( !COM_CheckString( name ))
|
||||
return;
|
||||
|
||||
if( cls.scrshot_action != scrshot_inactive )
|
||||
{
|
||||
if( cls.scrshot_action != scrshot_skyshot && cls.scrshot_action != scrshot_envshot )
|
||||
Con_Printf( S_ERROR "R_%sShot: subsystem is busy, try for next frame.\n", skyshot ? "Sky" : "Env" );
|
||||
return;
|
||||
}
|
||||
|
||||
cls.envshot_vieworg = NULL; // use client view
|
||||
Q_strncpy( cls.shotname, name, sizeof( cls.shotname ));
|
||||
|
||||
if( vieworg )
|
||||
{
|
||||
// make sure what viewpoint don't temporare
|
||||
VectorCopy( vieworg, viewPoint );
|
||||
cls.envshot_vieworg = viewPoint;
|
||||
cls.envshot_disable_vis = true;
|
||||
}
|
||||
|
||||
// make request for envshot
|
||||
if( skyshot ) cls.scrshot_action = scrshot_skyshot;
|
||||
else cls.scrshot_action = scrshot_envshot;
|
||||
|
||||
// catch negative values
|
||||
cls.envshot_viewsize = max( 0, shotsize );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
CL_GenericHandle
|
||||
|
||||
=============
|
||||
*/
|
||||
const char *CL_GenericHandle( int fileindex )
|
||||
{
|
||||
if( fileindex < 0 || fileindex >= MAX_CUSTOM )
|
||||
return 0;
|
||||
return cl.files_precache[fileindex];
|
||||
}
|
||||
|
||||
int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef )
|
||||
{
|
||||
switch( parm )
|
||||
{
|
||||
case PARM_BSP2_SUPPORTED:
|
||||
#ifdef SUPPORT_BSP2_FORMAT
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
case PARM_SKY_SPHERE:
|
||||
return FBitSet( world.flags, FWORLD_SKYSPHERE ) && !FBitSet( world.flags, FWORLD_CUSTOM_SKYBOX );
|
||||
case PARAM_GAMEPAUSED:
|
||||
return cl.paused;
|
||||
case PARM_CLIENT_INGAME:
|
||||
return CL_IsInGame();
|
||||
case PARM_MAX_ENTITIES:
|
||||
return clgame.maxEntities;
|
||||
case PARM_FEATURES:
|
||||
return host.features;
|
||||
case PARM_MAP_HAS_DELUXE:
|
||||
return FBitSet( world.flags, FWORLD_HAS_DELUXEMAP );
|
||||
case PARM_CLIENT_ACTIVE:
|
||||
return (cls.state == ca_active);
|
||||
case PARM_DEDICATED_SERVER:
|
||||
return (host.type == HOST_DEDICATED);
|
||||
case PARM_WATER_ALPHA:
|
||||
return FBitSet( world.flags, FWORLD_WATERALPHA );
|
||||
case PARM_DELUXEDATA:
|
||||
return *(int *)&world.deluxedata;
|
||||
case PARM_SHADOWDATA:
|
||||
return *(int *)&world.shadowdata;
|
||||
default:
|
||||
// indicates call from client.dll
|
||||
if( checkRef )
|
||||
{
|
||||
return ref.dllFuncs.RefGetParm( parm, arg );
|
||||
}
|
||||
// call issued from ref_dll, check extensions here
|
||||
else switch( parm )
|
||||
{
|
||||
case PARM_DEV_OVERVIEW:
|
||||
return CL_IsDevOverviewMode();
|
||||
case PARM_THIRDPERSON:
|
||||
return CL_IsThirdPerson();
|
||||
case PARM_QUAKE_COMPATIBLE:
|
||||
return Host_IsQuakeCompatible();
|
||||
case PARM_PLAYER_INDEX:
|
||||
return cl.playernum + 1;
|
||||
case PARM_VIEWENT_INDEX:
|
||||
return cl.viewentity;
|
||||
case PARM_CONNSTATE:
|
||||
return (int)cls.state;
|
||||
case PARM_PLAYING_DEMO:
|
||||
return cls.demoplayback;
|
||||
case PARM_WATER_LEVEL:
|
||||
return cl.local.waterlevel;
|
||||
case PARM_MAX_CLIENTS:
|
||||
return cl.maxclients;
|
||||
case PARM_LOCAL_HEALTH:
|
||||
return cl.local.health;
|
||||
case PARM_LOCAL_GAME:
|
||||
return Host_IsLocalGame();
|
||||
case PARM_NUMENTITIES:
|
||||
return pfnNumberOfEntities();
|
||||
case PARM_NUMMODELS:
|
||||
return cl.nummodels;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pfnRenderGetParm( int parm, int arg )
|
||||
{
|
||||
return CL_RenderGetParm( parm, arg, true );
|
||||
}
|
||||
|
||||
static render_api_t gRenderAPI =
|
||||
{
|
||||
pfnRenderGetParm, // GL_RenderGetParm,
|
||||
NULL, // R_GetDetailScaleForTexture,
|
||||
NULL, // R_GetExtraParmsForTexture,
|
||||
CL_GetLightStyle,
|
||||
CL_GetDynamicLight,
|
||||
CL_GetEntityLight,
|
||||
LightToTexGamma,
|
||||
NULL, // R_GetFrameTime,
|
||||
NULL, // R_SetCurrentEntity,
|
||||
NULL, // R_SetCurrentModel,
|
||||
R_FatPVS,
|
||||
R_StoreEfrags,
|
||||
NULL, // GL_FindTexture,
|
||||
NULL, // GL_TextureName,
|
||||
NULL, // GL_TextureData,
|
||||
NULL, // GL_LoadTexture,
|
||||
NULL, // GL_CreateTexture,
|
||||
NULL, // GL_LoadTextureArray,
|
||||
NULL, // GL_CreateTextureArray,
|
||||
NULL, // GL_FreeTexture,
|
||||
NULL, // DrawSingleDecal,
|
||||
NULL, // R_DecalSetupVerts,
|
||||
NULL, // R_EntityRemoveDecals,
|
||||
(void*)AVI_LoadVideo,
|
||||
(void*)AVI_GetVideoInfo,
|
||||
(void*)AVI_GetVideoFrameNumber,
|
||||
(void*)AVI_GetVideoFrame,
|
||||
NULL, // R_UploadStretchRaw,
|
||||
(void*)AVI_FreeVideo,
|
||||
(void*)AVI_IsActive,
|
||||
S_StreamAviSamples,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, // GL_Bind,
|
||||
NULL, // GL_SelectTexture,
|
||||
NULL, // GL_LoadTexMatrixExt,
|
||||
NULL, // GL_LoadIdentityTexMatrix,
|
||||
NULL, // GL_CleanUpTextureUnits,
|
||||
NULL, // GL_TexGen,
|
||||
NULL, // GL_TextureTarget,
|
||||
NULL, // GL_SetTexCoordArrayMode,
|
||||
GL_GetProcAddress,
|
||||
NULL, // GL_UpdateTexSize,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL, // CL_DrawParticlesExternal,
|
||||
R_EnvShot,
|
||||
pfnSPR_LoadExt,
|
||||
NULL, // R_LightVec,
|
||||
NULL, // R_StudioGetTexture,
|
||||
GL_GetOverviewParms,
|
||||
CL_GenericHandle,
|
||||
COM_SaveFile,
|
||||
NULL,
|
||||
R_Mem_Alloc,
|
||||
R_Mem_Free,
|
||||
pfnGetFilesList,
|
||||
pfnFileBufferCRC32,
|
||||
COM_CompareFileTime,
|
||||
Host_Error,
|
||||
(void*)CL_ModelHandle,
|
||||
pfnTime,
|
||||
Cvar_Set,
|
||||
S_FadeMusicVolume,
|
||||
COM_SetRandomSeed,
|
||||
};
|
||||
|
||||
static void R_FillRenderAPIFromRef( render_api_t *to, const ref_interface_t *from )
|
||||
{
|
||||
to->GetDetailScaleForTexture = from->GetDetailScaleForTexture;
|
||||
to->GetExtraParmsForTexture = from->GetExtraParmsForTexture;
|
||||
to->GetFrameTime = from->GetFrameTime;
|
||||
to->R_SetCurrentEntity = from->R_SetCurrentEntity;
|
||||
to->R_SetCurrentModel = from->R_SetCurrentModel;
|
||||
to->GL_FindTexture = from->GL_FindTexture;
|
||||
to->GL_TextureName = from->GL_TextureName;
|
||||
to->GL_TextureData = from->GL_TextureData;
|
||||
to->GL_LoadTexture = from->GL_LoadTexture;
|
||||
to->GL_CreateTexture = from->GL_CreateTexture;
|
||||
to->GL_LoadTextureArray = from->GL_LoadTextureArray;
|
||||
to->GL_CreateTextureArray = from->GL_CreateTextureArray;
|
||||
to->GL_FreeTexture = from->GL_FreeTexture;
|
||||
to->DrawSingleDecal = from->DrawSingleDecal;
|
||||
to->R_DecalSetupVerts = from->R_DecalSetupVerts;
|
||||
to->R_EntityRemoveDecals = from->R_EntityRemoveDecals;
|
||||
to->AVI_UploadRawFrame = from->AVI_UploadRawFrame;
|
||||
to->GL_Bind = from->GL_Bind;
|
||||
to->GL_SelectTexture = from->GL_SelectTexture;
|
||||
to->GL_LoadTextureMatrix = from->GL_LoadTextureMatrix;
|
||||
to->GL_TexMatrixIdentity = from->GL_TexMatrixIdentity;
|
||||
to->GL_CleanUpTextureUnits = from->GL_CleanUpTextureUnits;
|
||||
to->GL_TexGen = from->GL_TexGen;
|
||||
to->GL_TextureTarget = from->GL_TextureTarget;
|
||||
to->GL_TexCoordArrayMode = from->GL_TexCoordArrayMode;
|
||||
to->GL_UpdateTexSize = from->GL_UpdateTexSize;
|
||||
to->GL_DrawParticles = from->GL_DrawParticles;
|
||||
to->LightVec = from->LightVec;
|
||||
to->StudioGetTexture = from->StudioGetTexture;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_InitRenderAPI
|
||||
|
||||
Initialize client external rendering
|
||||
===============
|
||||
*/
|
||||
qboolean R_InitRenderAPI( void )
|
||||
{
|
||||
// make sure what render functions is cleared
|
||||
memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
|
||||
|
||||
// fill missing functions from renderer
|
||||
R_FillRenderAPIFromRef( &gRenderAPI, &ref.dllFuncs );
|
||||
|
||||
if( clgame.dllFuncs.pfnGetRenderInterface )
|
||||
{
|
||||
if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs ))
|
||||
{
|
||||
Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
|
||||
return true;
|
||||
}
|
||||
|
||||
// make sure what render functions is cleared
|
||||
memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
|
||||
|
||||
return false; // just tell user about problems
|
||||
}
|
||||
|
||||
// render interface is missed
|
||||
return true;
|
||||
}
|
||||
@@ -15,10 +15,10 @@ GNU General Public License for more details.
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
#include "vgui_draw.h"
|
||||
#include "qfont.h"
|
||||
#include "input.h"
|
||||
#include "library.h"
|
||||
|
||||
convar_t *scr_centertime;
|
||||
convar_t *scr_loading;
|
||||
@@ -96,10 +96,10 @@ void SCR_DrawFPS( int height )
|
||||
Q_snprintf( fpsstring, sizeof( fpsstring ), "fps: ^1%4i min, ^3%4i cur, ^2%4i max", minfps, curfps, maxfps );
|
||||
else Q_snprintf( fpsstring, sizeof( fpsstring ), "%4i fps", curfps );
|
||||
MakeRGBA( color, 255, 255, 255, 255 );
|
||||
}
|
||||
}
|
||||
|
||||
Con_DrawStringLen( fpsstring, &offset, NULL );
|
||||
Con_DrawString( glState.width - offset - 4, height, fpsstring, color );
|
||||
Con_DrawString( refState.width - offset - 4, height, fpsstring, color );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -148,7 +148,7 @@ void SCR_NetSpeeds( void )
|
||||
Q_snprintf( msg, sizeof( msg ), "sv fps: ^1%4i min, ^3%4i cur, ^2%4i max\ncl fps: ^1%4i min, ^3%4i cur, ^2%4i max\nGame Time: %02d:%02d\nTotal received from server: %s\nTotal sent to server: %s\n",
|
||||
min_svfps, cur_svfps, max_svfps, min_clfps, cur_clfps, max_clfps, (int)(time / 60.0f ), (int)fmod( time, 60.0f ), Q_memprint( cls.netchan.total_received ), Q_memprint( cls.netchan.total_sended ));
|
||||
|
||||
x = glState.width - 320;
|
||||
x = refState.width - 320;
|
||||
y = 384;
|
||||
|
||||
Con_DrawStringLen( NULL, NULL, &height );
|
||||
@@ -181,13 +181,13 @@ void SCR_RSpeeds( void )
|
||||
if( !host.allow_console )
|
||||
return;
|
||||
|
||||
if( R_SpeedsMessage( msg, sizeof( msg )))
|
||||
if( ref.dllFuncs.R_SpeedsMessage( msg, sizeof( msg )))
|
||||
{
|
||||
int x, y, height;
|
||||
char *p, *start, *end;
|
||||
rgba_t color;
|
||||
|
||||
x = glState.width - 340;
|
||||
x = refState.width - 340;
|
||||
y = 64;
|
||||
|
||||
Con_DrawStringLen( NULL, NULL, &height );
|
||||
@@ -227,6 +227,37 @@ void SCR_MakeLevelShot( void )
|
||||
Cbuf_AddText( "levelshot\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
VID_WriteOverviewScript
|
||||
|
||||
Create overview script file
|
||||
===============
|
||||
*/
|
||||
void VID_WriteOverviewScript( void )
|
||||
{
|
||||
ref_overview_t *ov = &clgame.overView;
|
||||
string filename;
|
||||
file_t *f;
|
||||
|
||||
Q_snprintf( filename, sizeof( filename ), "overviews/%s.txt", clgame.mapname );
|
||||
|
||||
f = FS_Open( filename, "w", false );
|
||||
if( !f ) return;
|
||||
|
||||
FS_Printf( f, "// overview description file for %s.bsp\n\n", clgame.mapname );
|
||||
FS_Print( f, "global\n{\n" );
|
||||
FS_Printf( f, "\tZOOM\t%.2f\n", ov->flZoom );
|
||||
FS_Printf( f, "\tORIGIN\t%.2f\t%.2f\t%.2f\n", ov->origin[0], ov->origin[1], ov->origin[2] );
|
||||
FS_Printf( f, "\tROTATED\t%i\n", ov->rotated ? 1 : 0 );
|
||||
FS_Print( f, "}\n\nlayer\n{\n" );
|
||||
FS_Printf( f, "\tIMAGE\t\"overviews/%s.bmp\"\n", clgame.mapname );
|
||||
FS_Printf( f, "\tHEIGHT\t%.2f\n", ov->zFar ); // ???
|
||||
FS_Print( f, "}\n" );
|
||||
|
||||
FS_Close( f );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SCR_MakeScreenShot
|
||||
@@ -246,25 +277,27 @@ void SCR_MakeScreenShot( void )
|
||||
switch( cls.scrshot_action )
|
||||
{
|
||||
case scrshot_normal:
|
||||
iRet = VID_ScreenShot( cls.shotname, VID_SCREENSHOT );
|
||||
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_SCREENSHOT );
|
||||
break;
|
||||
case scrshot_snapshot:
|
||||
iRet = VID_ScreenShot( cls.shotname, VID_SNAPSHOT );
|
||||
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_SNAPSHOT );
|
||||
break;
|
||||
case scrshot_plaque:
|
||||
iRet = VID_ScreenShot( cls.shotname, VID_LEVELSHOT );
|
||||
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_LEVELSHOT );
|
||||
break;
|
||||
case scrshot_savegame:
|
||||
iRet = VID_ScreenShot( cls.shotname, VID_MINISHOT );
|
||||
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_MINISHOT );
|
||||
break;
|
||||
case scrshot_envshot:
|
||||
iRet = VID_CubemapShot( cls.shotname, viewsize, cls.envshot_vieworg, false );
|
||||
iRet = ref.dllFuncs.VID_CubemapShot( cls.shotname, viewsize, cls.envshot_vieworg, false );
|
||||
break;
|
||||
case scrshot_skyshot:
|
||||
iRet = VID_CubemapShot( cls.shotname, viewsize, cls.envshot_vieworg, true );
|
||||
iRet = ref.dllFuncs.VID_CubemapShot( cls.shotname, viewsize, cls.envshot_vieworg, true );
|
||||
break;
|
||||
case scrshot_mapshot:
|
||||
iRet = VID_ScreenShot( cls.shotname, VID_MAPSHOT );
|
||||
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_MAPSHOT );
|
||||
if( iRet )
|
||||
VID_WriteOverviewScript(); // store overview script too
|
||||
break;
|
||||
case scrshot_inactive:
|
||||
return;
|
||||
@@ -295,9 +328,9 @@ void SCR_DrawPlaque( void )
|
||||
{
|
||||
if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background )
|
||||
{
|
||||
int levelshot = GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE );
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
R_DrawStretchPic( 0, 0, glState.width, glState.height, 0, 0, 1, 1, levelshot );
|
||||
int levelshot = ref.dllFuncs.GL_LoadTexture( cl_levelshot_name->string, NULL, 0, TF_IMAGE );
|
||||
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
|
||||
ref.dllFuncs.R_DrawStretchPic( 0, 0, refState.width, refState.height, 0, 0, 1, 1, levelshot );
|
||||
if( !cl.background ) CL_DrawHUD( CL_LOADING );
|
||||
}
|
||||
}
|
||||
@@ -373,7 +406,7 @@ SCR_DirtyScreen
|
||||
void SCR_DirtyScreen( void )
|
||||
{
|
||||
SCR_AddDirtyPoint( 0, 0 );
|
||||
SCR_AddDirtyPoint( glState.width - 1, glState.height - 1 );
|
||||
SCR_AddDirtyPoint( refState.width - 1, refState.height - 1 );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -425,7 +458,7 @@ void SCR_TileClear( void )
|
||||
{
|
||||
// clear above view screen
|
||||
i = clear.y2 < top-1 ? clear.y2 : top - 1;
|
||||
R_DrawTileClear( clear.x1, clear.y1, clear.x2 - clear.x1 + 1, i - clear.y1 + 1 );
|
||||
ref.dllFuncs.R_DrawTileClear( cls.tileImage, clear.x1, clear.y1, clear.x2 - clear.x1 + 1, i - clear.y1 + 1 );
|
||||
clear.y1 = top;
|
||||
}
|
||||
|
||||
@@ -433,7 +466,7 @@ void SCR_TileClear( void )
|
||||
{
|
||||
// clear below view screen
|
||||
i = clear.y1 > bottom + 1 ? clear.y1 : bottom + 1;
|
||||
R_DrawTileClear( clear.x1, i, clear.x2 - clear.x1 + 1, clear.y2 - i + 1 );
|
||||
ref.dllFuncs.R_DrawTileClear( cls.tileImage, clear.x1, i, clear.x2 - clear.x1 + 1, clear.y2 - i + 1 );
|
||||
clear.y2 = bottom;
|
||||
}
|
||||
|
||||
@@ -441,7 +474,7 @@ void SCR_TileClear( void )
|
||||
{
|
||||
// clear left of view screen
|
||||
i = clear.x2 < left - 1 ? clear.x2 : left - 1;
|
||||
R_DrawTileClear( clear.x1, clear.y1, i - clear.x1 + 1, clear.y2 - clear.y1 + 1 );
|
||||
ref.dllFuncs.R_DrawTileClear( cls.tileImage, clear.x1, clear.y1, i - clear.x1 + 1, clear.y2 - clear.y1 + 1 );
|
||||
clear.x1 = left;
|
||||
}
|
||||
|
||||
@@ -449,7 +482,7 @@ void SCR_TileClear( void )
|
||||
{
|
||||
// clear left of view screen
|
||||
i = clear.x1 > right + 1 ? clear.x1 : right + 1;
|
||||
R_DrawTileClear( i, clear.y1, clear.x2 - i + 1, clear.y2 - clear.y1 + 1 );
|
||||
ref.dllFuncs.R_DrawTileClear( cls.tileImage, i, clear.y1, clear.x2 - i + 1, clear.y2 - clear.y1 + 1 );
|
||||
clear.x2 = right;
|
||||
}
|
||||
}
|
||||
@@ -501,7 +534,7 @@ qboolean SCR_LoadFixedWidthFont( const char *fontname )
|
||||
if( !FS_FileExists( fontname, false ))
|
||||
return false;
|
||||
|
||||
cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE|TF_KEEP_SOURCE );
|
||||
cls.creditsFont.hFontTexture = ref.dllFuncs.GL_LoadTexture( fontname, NULL, 0, TF_IMAGE|TF_KEEP_SOURCE );
|
||||
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
|
||||
cls.creditsFont.charHeight = clgame.scrInfo.iCharHeight = fontWidth / 16;
|
||||
cls.creditsFont.type = FONT_FIXED;
|
||||
@@ -524,7 +557,7 @@ qboolean SCR_LoadVariableWidthFont( const char *fontname )
|
||||
{
|
||||
int i, fontWidth;
|
||||
byte *buffer;
|
||||
size_t length;
|
||||
fs_offset_t length;
|
||||
qfont_t *src;
|
||||
|
||||
if( cls.creditsFont.valid )
|
||||
@@ -533,7 +566,7 @@ qboolean SCR_LoadVariableWidthFont( const char *fontname )
|
||||
if( !FS_FileExists( fontname, false ))
|
||||
return false;
|
||||
|
||||
cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE );
|
||||
cls.creditsFont.hFontTexture = ref.dllFuncs.GL_LoadTexture( fontname, NULL, 0, TF_IMAGE );
|
||||
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
|
||||
|
||||
// half-life font with variable chars witdh
|
||||
@@ -571,7 +604,18 @@ INTERNAL RESOURCE
|
||||
*/
|
||||
void SCR_LoadCreditsFont( void )
|
||||
{
|
||||
if( !SCR_LoadVariableWidthFont( "gfx.wad/creditsfont.fnt" ))
|
||||
const char *path = "gfx/creditsfont.fnt";
|
||||
dword crc;
|
||||
|
||||
// replace default gfx.wad textures by current charset's font
|
||||
if( !CRC32_File( &crc, "gfx.wad" ) || crc == 0x49eb9f16 )
|
||||
{
|
||||
const char *path2 = va("creditsfont_%s.fnt", Cvar_VariableString( "con_charset" ) );
|
||||
if( FS_FileExists( path2, false ) )
|
||||
path = path2;
|
||||
}
|
||||
|
||||
if( !SCR_LoadVariableWidthFont( path ))
|
||||
{
|
||||
if( !SCR_LoadFixedWidthFont( "gfx/conchars" ))
|
||||
Con_DPrintf( S_ERROR "failed to load HUD font\n" );
|
||||
@@ -631,24 +675,24 @@ void SCR_RegisterTextures( void )
|
||||
// register gfx.wad images
|
||||
|
||||
if( FS_FileExists( "gfx/paused.lmp", false ))
|
||||
cls.pauseIcon = GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE );
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/paused.lmp", NULL, 0, TF_IMAGE );
|
||||
else if( FS_FileExists( "gfx/pause.lmp", false ))
|
||||
cls.pauseIcon = GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE );
|
||||
cls.pauseIcon = ref.dllFuncs.GL_LoadTexture( "gfx/pause.lmp", NULL, 0, TF_IMAGE );
|
||||
|
||||
if( FS_FileExists( "gfx/lambda.lmp", false ))
|
||||
{
|
||||
if( cl_allow_levelshots->value )
|
||||
cls.loadingBar = GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||
else cls.loadingBar = GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE );
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/lambda.lmp", NULL, 0, TF_IMAGE );
|
||||
}
|
||||
else if( FS_FileExists( "gfx/loading.lmp", false ))
|
||||
{
|
||||
if( cl_allow_levelshots->value )
|
||||
cls.loadingBar = GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||
else cls.loadingBar = GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE );
|
||||
cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE|TF_LUMINANCE );
|
||||
else cls.loadingBar = ref.dllFuncs.GL_LoadTexture( "gfx/loading.lmp", NULL, 0, TF_IMAGE );
|
||||
}
|
||||
|
||||
cls.tileImage = GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
|
||||
cls.tileImage = ref.dllFuncs.GL_LoadTexture( "gfx/backtile.lmp", NULL, 0, TF_NOMIPMAP );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -683,15 +727,21 @@ SCR_VidInit
|
||||
*/
|
||||
void SCR_VidInit( void )
|
||||
{
|
||||
if( !ref.initialized ) // don't call VidInit too soon
|
||||
return;
|
||||
|
||||
memset( &clgame.ds, 0, sizeof( clgame.ds )); // reset a draw state
|
||||
memset( &gameui.ds, 0, sizeof( gameui.ds )); // reset a draw state
|
||||
memset( &clgame.centerPrint, 0, sizeof( clgame.centerPrint ));
|
||||
|
||||
// update screen sizes for menu
|
||||
gameui.globals->scrWidth = glState.width;
|
||||
gameui.globals->scrHeight = glState.height;
|
||||
if( gameui.globals )
|
||||
{
|
||||
gameui.globals->scrWidth = refState.width;
|
||||
gameui.globals->scrHeight = refState.height;
|
||||
}
|
||||
|
||||
VGui_Startup ();
|
||||
VGui_Startup( NULL, refState.width, refState.height ); // initialized already, so pass NULL
|
||||
|
||||
CL_ClearSpriteTextures(); // now all hud sprites are invalid
|
||||
|
||||
@@ -723,7 +773,6 @@ void SCR_Init( void )
|
||||
scr_viewsize = Cvar_Get( "viewsize", "120", FCVAR_ARCHIVE, "screen size" );
|
||||
|
||||
// register our commands
|
||||
Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" );
|
||||
Cmd_AddCommand( "skyname", CL_SetSky_f, "set new skybox by basename" );
|
||||
Cmd_AddCommand( "loadsky", CL_SetSky_f, "set new skybox by basename" );
|
||||
Cmd_AddCommand( "viewpos", SCR_Viewpos_f, "prints current player origin" );
|
||||
@@ -732,7 +781,7 @@ void SCR_Init( void )
|
||||
|
||||
if( !UI_LoadProgs( ))
|
||||
{
|
||||
Con_Printf( S_ERROR "can't initialize gameui.dll\n" ); // there is non fatal for us
|
||||
Con_Printf( S_ERROR "can't initialize gameui DLL: %s\n", COM_GetLibraryError() ); // there is non fatal for us
|
||||
host.allow_console = true; // we need console, because menu is missing
|
||||
}
|
||||
|
||||
@@ -761,4 +810,4 @@ void SCR_Shutdown( void )
|
||||
UI_UnloadProgs();
|
||||
|
||||
scr_init = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ GNU General Public License for more details.
|
||||
#include "triangleapi.h"
|
||||
#include "cl_tent.h"
|
||||
#include "pm_local.h"
|
||||
#include "gl_local.h"
|
||||
#include "studio.h"
|
||||
#include "wadfile.h" // acess decal size
|
||||
#include "sound.h"
|
||||
@@ -151,7 +150,7 @@ void CL_AddClientResources( void )
|
||||
int i;
|
||||
|
||||
// don't request resources from localhost or in quake-compatibility mode
|
||||
if( cl.maxclients <= 1 || CL_IsQuakeCompatible( ))
|
||||
if( cl.maxclients <= 1 || Host_IsQuakeCompatible( ))
|
||||
return;
|
||||
|
||||
// check sprites first
|
||||
@@ -197,125 +196,6 @@ void CL_AddClientResources( void )
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_FxBlend
|
||||
===============
|
||||
*/
|
||||
int CL_FxBlend( cl_entity_t *e )
|
||||
{
|
||||
int blend = 0;
|
||||
float offset, dist;
|
||||
vec3_t tmp;
|
||||
|
||||
offset = ((int)e->index ) * 363.0f; // Use ent index to de-sync these fx
|
||||
|
||||
switch( e->curstate.renderfx )
|
||||
{
|
||||
case kRenderFxPulseSlowWide:
|
||||
blend = e->curstate.renderamt + 0x40 * sin( cl.time * 2 + offset );
|
||||
break;
|
||||
case kRenderFxPulseFastWide:
|
||||
blend = e->curstate.renderamt + 0x40 * sin( cl.time * 8 + offset );
|
||||
break;
|
||||
case kRenderFxPulseSlow:
|
||||
blend = e->curstate.renderamt + 0x10 * sin( cl.time * 2 + offset );
|
||||
break;
|
||||
case kRenderFxPulseFast:
|
||||
blend = e->curstate.renderamt + 0x10 * sin( cl.time * 8 + offset );
|
||||
break;
|
||||
case kRenderFxFadeSlow:
|
||||
if( RP_NORMALPASS( ))
|
||||
{
|
||||
if( e->curstate.renderamt > 0 )
|
||||
e->curstate.renderamt -= 1;
|
||||
else e->curstate.renderamt = 0;
|
||||
}
|
||||
blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxFadeFast:
|
||||
if( RP_NORMALPASS( ))
|
||||
{
|
||||
if( e->curstate.renderamt > 3 )
|
||||
e->curstate.renderamt -= 4;
|
||||
else e->curstate.renderamt = 0;
|
||||
}
|
||||
blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxSolidSlow:
|
||||
if( RP_NORMALPASS( ))
|
||||
{
|
||||
if( e->curstate.renderamt < 255 )
|
||||
e->curstate.renderamt += 1;
|
||||
else e->curstate.renderamt = 255;
|
||||
}
|
||||
blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxSolidFast:
|
||||
if( RP_NORMALPASS( ))
|
||||
{
|
||||
if( e->curstate.renderamt < 252 )
|
||||
e->curstate.renderamt += 4;
|
||||
else e->curstate.renderamt = 255;
|
||||
}
|
||||
blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxStrobeSlow:
|
||||
blend = 20 * sin( cl.time * 4 + offset );
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxStrobeFast:
|
||||
blend = 20 * sin( cl.time * 16 + offset );
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxStrobeFaster:
|
||||
blend = 20 * sin( cl.time * 36 + offset );
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxFlickerSlow:
|
||||
blend = 20 * (sin( cl.time * 2 ) + sin( cl.time * 17 + offset ));
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxFlickerFast:
|
||||
blend = 20 * (sin( cl.time * 16 ) + sin( cl.time * 23 + offset ));
|
||||
if( blend < 0 ) blend = 0;
|
||||
else blend = e->curstate.renderamt;
|
||||
break;
|
||||
case kRenderFxHologram:
|
||||
case kRenderFxDistort:
|
||||
VectorCopy( e->origin, tmp );
|
||||
VectorSubtract( tmp, RI.vieworg, tmp );
|
||||
dist = DotProduct( tmp, RI.vforward );
|
||||
|
||||
// turn off distance fade
|
||||
if( e->curstate.renderfx == kRenderFxDistort )
|
||||
dist = 1;
|
||||
|
||||
if( dist <= 0 )
|
||||
{
|
||||
blend = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
e->curstate.renderamt = 180;
|
||||
if( dist <= 100 ) blend = e->curstate.renderamt;
|
||||
else blend = (int) ((1.0f - ( dist - 100 ) * ( 1.0f / 400.0f )) * e->curstate.renderamt );
|
||||
blend += COM_RandomLong( -32, 31 );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
blend = e->curstate.renderamt;
|
||||
break;
|
||||
}
|
||||
|
||||
blend = bound( 0, blend, 255 );
|
||||
|
||||
return blend;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
@@ -521,8 +401,7 @@ int CL_TempEntAddEntity( cl_entity_t *pEntity )
|
||||
VectorCopy( pEntity->origin, pEntity->latched.prevorigin );
|
||||
|
||||
// add to list
|
||||
if( CL_AddVisibleEntity( pEntity, ET_TEMPENTITY ))
|
||||
r_stats.c_active_tents_count++;
|
||||
CL_AddVisibleEntity( pEntity, ET_TEMPENTITY );
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -670,7 +549,7 @@ CL_TempEntAlloc
|
||||
|
||||
custom tempentity allocation
|
||||
==============
|
||||
*/
|
||||
*/
|
||||
TEMPENTITY *CL_TempEntAllocCustom( const vec3_t org, model_t *model, int high, void (*pfn)( TEMPENTITY*, float, float ))
|
||||
{
|
||||
TEMPENTITY *pTemp;
|
||||
@@ -2013,6 +1892,8 @@ void R_Sprite_WallPuff( TEMPENTITY *pTemp, float scale )
|
||||
pTemp->die = cl.time + 0.01f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_ParseTempEntity
|
||||
@@ -2024,7 +1905,7 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
||||
{
|
||||
sizebuf_t buf;
|
||||
byte pbuf[256];
|
||||
int iSize = MSG_ReadWord( msg );
|
||||
int iSize;
|
||||
int type, color, count, flags;
|
||||
int decalIndex, modelIndex, entityIndex;
|
||||
float scale, life, frameRate, vel, random;
|
||||
@@ -2035,6 +1916,10 @@ void CL_ParseTempEntity( sizebuf_t *msg )
|
||||
cl_entity_t *pEnt;
|
||||
dlight_t *dl;
|
||||
|
||||
if( cls.legacymode )
|
||||
iSize = MSG_ReadByte( msg );
|
||||
else iSize = MSG_ReadWord( msg );
|
||||
|
||||
decalIndex = modelIndex = entityIndex = 0;
|
||||
|
||||
// parse user message into buffer
|
||||
@@ -2717,6 +2602,18 @@ void CL_DecayLights( void )
|
||||
}
|
||||
}
|
||||
|
||||
dlight_t *CL_GetDynamicLight( int number )
|
||||
{
|
||||
Assert( number >= 0 && number < MAX_DLIGHTS );
|
||||
return &cl_dlights[number];
|
||||
}
|
||||
|
||||
dlight_t *CL_GetEntityLight( int number )
|
||||
{
|
||||
Assert( number >= 0 && number < MAX_ELIGHTS );
|
||||
return &cl_elights[number];
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
CL_UpdateFlashlight
|
||||
@@ -2801,7 +2698,7 @@ void CL_AddEntityEffects( cl_entity_t *ent )
|
||||
|
||||
if( FBitSet( ent->curstate.effects, EF_DIMLIGHT ))
|
||||
{
|
||||
if( ent->player && !CL_IsQuakeCompatible( ))
|
||||
if( ent->player && !Host_IsQuakeCompatible( ))
|
||||
{
|
||||
CL_UpdateFlashlight( ent );
|
||||
}
|
||||
@@ -2948,7 +2845,7 @@ void CL_TestLights( void )
|
||||
|
||||
numLights = bound( 1, cl_testlights->value, MAX_DLIGHTS );
|
||||
AngleVectors( cl.viewangles, forward, right, NULL );
|
||||
|
||||
|
||||
for( i = 0; i < numLights; i++ )
|
||||
{
|
||||
dl = &cl_dlights[i];
|
||||
@@ -2974,18 +2871,6 @@ DECAL MANAGEMENT
|
||||
|
||||
==============================================================
|
||||
*/
|
||||
/*
|
||||
===============
|
||||
CL_DecalShoot
|
||||
|
||||
normal temporary decal
|
||||
===============
|
||||
*/
|
||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags )
|
||||
{
|
||||
R_DecalShoot( textureIndex, entityIndex, modelIndex, pos, flags, 1.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_FireCustomDecal
|
||||
@@ -2995,7 +2880,19 @@ custom temporary decal
|
||||
*/
|
||||
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale )
|
||||
{
|
||||
R_DecalShoot( textureIndex, entityIndex, modelIndex, pos, flags, scale );
|
||||
ref.dllFuncs.R_DecalShoot( textureIndex, entityIndex, modelIndex, pos, flags, scale );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_DecalShoot
|
||||
|
||||
normal temporary decal
|
||||
===============
|
||||
*/
|
||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags )
|
||||
{
|
||||
CL_FireCustomDecal( textureIndex, entityIndex, modelIndex, pos, flags, 1.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3026,7 +2923,7 @@ void CL_PlayerDecal( int playernum, int customIndex, int entityIndex, float *pos
|
||||
}
|
||||
}
|
||||
|
||||
R_DecalShoot( textureIndex, entityIndex, 0, pos, FDECAL_CUSTOM, 1.0f );
|
||||
CL_DecalShoot( textureIndex, entityIndex, 0, pos, FDECAL_CUSTOM );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3066,7 +2963,7 @@ int CL_DecalIndex( int id )
|
||||
if( cl.decal_index[id] == 0 )
|
||||
{
|
||||
Image_SetForceFlags( IL_LOAD_DECAL );
|
||||
cl.decal_index[id] = GL_LoadTexture( host.draw_decals[id], NULL, 0, TF_DECAL );
|
||||
cl.decal_index[id] = ref.dllFuncs.GL_LoadTexture( host.draw_decals[id], NULL, 0, TF_DECAL );
|
||||
Image_ClearForceFlags();
|
||||
}
|
||||
|
||||
@@ -3083,7 +2980,7 @@ remove all decals with specified texture
|
||||
void CL_DecalRemoveAll( int textureIndex )
|
||||
{
|
||||
int id = bound( 0, textureIndex, MAX_DECALS - 1 );
|
||||
R_DecalRemoveAll( cl.decal_index[id] );
|
||||
ref.dllFuncs.R_DecalRemoveAll( cl.decal_index[id] );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3112,6 +3009,29 @@ void CL_ClearEfrags( void )
|
||||
clgame.free_efrags[i].entnext = &clgame.free_efrags[i+1];
|
||||
clgame.free_efrags[i].entnext = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
R_ClearStaticEntities
|
||||
|
||||
e.g. by demo request
|
||||
=======================
|
||||
*/
|
||||
void CL_ClearStaticEntities( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
if( host.type == HOST_DEDICATED )
|
||||
return;
|
||||
|
||||
// clear out efrags in case the level hasn't been reloaded
|
||||
for( i = 0; i < cl.worldmodel->numleafs; i++ )
|
||||
cl.worldmodel->leafs[i+1].efrags = NULL;
|
||||
|
||||
clgame.numStatics = 0;
|
||||
|
||||
CL_ClearEfrags ();
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
@@ -3126,4 +3046,5 @@ void CL_ClearEffects( void )
|
||||
CL_ClearViewBeams ();
|
||||
CL_ClearParticles ();
|
||||
CL_ClearLightStyles ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ GNU General Public License for more details.
|
||||
#ifndef CL_TENT_H
|
||||
#define CL_TENT_H
|
||||
|
||||
#include "triangleapi.h"
|
||||
|
||||
// EfxAPI
|
||||
struct particle_s *R_AllocParticle( void (*callback)( struct particle_s*, float ));
|
||||
void R_Explosion( vec3_t pos, int model, float scale, float framerate, int flags );
|
||||
@@ -87,6 +89,9 @@ void CL_DecalRemoveAll( int textureIndex );
|
||||
int CL_DecalIndexFromName( const char *name );
|
||||
int CL_DecalIndex( int id );
|
||||
|
||||
// RefAPI
|
||||
struct particle_s *CL_AllocParticleFast( void );
|
||||
|
||||
// Beams
|
||||
struct beam_s *R_BeamLightning( vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed );
|
||||
struct beam_s *R_BeamEnts( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b );
|
||||
@@ -99,22 +104,18 @@ void R_BeamKill( int deadEntity );
|
||||
|
||||
|
||||
// TriAPI
|
||||
void TriBegin( int mode );
|
||||
void TriTexCoord2f( float u, float v );
|
||||
void TriVertex3fv( const float *v );
|
||||
void TriVertex3f( float x, float y, float z );
|
||||
int TriBoxInPVS( float *mins, float *maxs );
|
||||
void TriRenderMode( int mode );
|
||||
void TriColor4f( float r, float g, float b, float a );
|
||||
int TriSpriteTexture( model_t *pSpriteModel, int frame );
|
||||
void TriColor4fRendermode( float r, float g, float b, float a, int rendermode );
|
||||
int TriWorldToScreen( float *world, float *screen );
|
||||
void TriColor4ub( byte r, byte g, byte b, byte a );
|
||||
void TriBrightness( float brightness );
|
||||
void TriRenderMode( int mode );
|
||||
void TriCullFace( int mode );
|
||||
void TriEnd( void );
|
||||
void TriCullFace( TRICULLSTYLE mode );
|
||||
int TriWorldToScreen( const float *world, float *screen );
|
||||
int TriBoxInPVS( float *mins, float *maxs );
|
||||
void TriLightAtPoint( float *pos, float *value );
|
||||
void TriColor4fRendermode( float r, float g, float b, float a, int rendermode );
|
||||
int TriSpriteTexture( model_t *pSpriteModel, int frame );
|
||||
|
||||
extern model_t *cl_sprite_dot;
|
||||
extern model_t *cl_sprite_shell;
|
||||
|
||||
#endif//CL_TENT_H
|
||||
#endif//CL_TENT_H
|
||||
|
||||
@@ -15,7 +15,6 @@ GNU General Public License for more details.
|
||||
|
||||
#include "common.h"
|
||||
#include "client.h"
|
||||
#include "gl_local.h"
|
||||
|
||||
/*
|
||||
=================================================================
|
||||
@@ -25,7 +24,7 @@ AVI PLAYING
|
||||
=================================================================
|
||||
*/
|
||||
|
||||
static long xres, yres;
|
||||
static int xres, yres;
|
||||
static float video_duration;
|
||||
static float cin_time;
|
||||
static int cin_frame;
|
||||
@@ -85,7 +84,8 @@ void SCR_CreateStartupVids( void )
|
||||
void SCR_CheckStartupVids( void )
|
||||
{
|
||||
int c = 0;
|
||||
char *afile, *pfile;
|
||||
byte *afile;
|
||||
char *pfile;
|
||||
string token;
|
||||
|
||||
if( Sys_CheckParm( "-nointro" ) || host_developer.value || cls.demonum != -1 || GameState->nextstate != STATE_RUNFRAME )
|
||||
@@ -102,7 +102,7 @@ void SCR_CheckStartupVids( void )
|
||||
afile = FS_LoadFile( DEFAULT_VIDEOLIST_PATH, NULL, false );
|
||||
if( !afile ) return; // something bad happens
|
||||
|
||||
pfile = afile;
|
||||
pfile = (char *)afile;
|
||||
|
||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
||||
{
|
||||
@@ -180,7 +180,7 @@ qboolean SCR_DrawCinematic( void )
|
||||
qboolean redraw = false;
|
||||
byte *frame = NULL;
|
||||
|
||||
if( !glw_state.initialized || cin_time <= 0.0f )
|
||||
if( !ref.initialized || cin_time <= 0.0f )
|
||||
return false;
|
||||
|
||||
if( cin_frame != last_frame )
|
||||
@@ -190,7 +190,7 @@ qboolean SCR_DrawCinematic( void )
|
||||
redraw = true;
|
||||
}
|
||||
|
||||
R_DrawStretchRaw( 0, 0, glState.width, glState.height, xres, yres, frame, redraw );
|
||||
ref.dllFuncs.R_DrawStretchRaw( 0, 0, refState.width, refState.height, xres, yres, frame, redraw );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -242,7 +242,7 @@ qboolean SCR_PlayCinematic( const char *arg )
|
||||
return true;
|
||||
}
|
||||
|
||||
long SCR_GetAudioChunk( char *rawdata, long length )
|
||||
int SCR_GetAudioChunk( char *rawdata, int length )
|
||||
{
|
||||
int r;
|
||||
|
||||
@@ -307,4 +307,4 @@ void SCR_FreeCinematic( void )
|
||||
AVI_CloseVideo( cin_state );
|
||||
|
||||
AVI_Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,10 @@ GNU General Public License for more details.
|
||||
#include "client.h"
|
||||
#include "const.h"
|
||||
#include "entity_types.h"
|
||||
#include "gl_local.h"
|
||||
#include "vgui_draw.h"
|
||||
#include "sound.h"
|
||||
#include "input.h" // touch
|
||||
#include "platform/platform.h" // GL_UpdateSwapInterval
|
||||
|
||||
/*
|
||||
===============
|
||||
@@ -44,7 +45,7 @@ void V_CalcViewRect( void )
|
||||
sb_lines = 24; // no inventory
|
||||
else sb_lines = 48;
|
||||
|
||||
if( scr_viewsize->value >= 100.0 )
|
||||
if( scr_viewsize->value >= 100.0f )
|
||||
{
|
||||
full = true;
|
||||
size = 100.0f;
|
||||
@@ -57,19 +58,19 @@ void V_CalcViewRect( void )
|
||||
sb_lines = 0;
|
||||
full = true;
|
||||
}
|
||||
size /= 100.0;
|
||||
size /= 100.0f;
|
||||
|
||||
clgame.viewport[2] = glState.width * size;
|
||||
clgame.viewport[3] = glState.height * size;
|
||||
clgame.viewport[2] = refState.width * size;
|
||||
clgame.viewport[3] = refState.height * size;
|
||||
|
||||
if( clgame.viewport[3] > glState.height - sb_lines )
|
||||
clgame.viewport[3] = glState.height - sb_lines;
|
||||
if( clgame.viewport[3] > glState.height )
|
||||
clgame.viewport[3] = glState.height;
|
||||
if( clgame.viewport[3] > refState.height - sb_lines )
|
||||
clgame.viewport[3] = refState.height - sb_lines;
|
||||
if( clgame.viewport[3] > refState.height )
|
||||
clgame.viewport[3] = refState.height;
|
||||
|
||||
clgame.viewport[0] = ( glState.width - clgame.viewport[2] ) / 2;
|
||||
clgame.viewport[0] = ( refState.width - clgame.viewport[2] ) / 2;
|
||||
if( full ) clgame.viewport[1] = 0;
|
||||
else clgame.viewport[1] = ( glState.height - sb_lines - clgame.viewport[3] ) / 2;
|
||||
else clgame.viewport[1] = ( refState.height - sb_lines - clgame.viewport[3] ) / 2;
|
||||
|
||||
}
|
||||
|
||||
@@ -113,8 +114,8 @@ void V_SetRefParams( ref_params_t *fd )
|
||||
memset( fd, 0, sizeof( ref_params_t ));
|
||||
|
||||
// probably this is not needs
|
||||
VectorCopy( RI.vieworg, fd->vieworg );
|
||||
VectorCopy( RI.viewangles, fd->viewangles );
|
||||
VectorCopy( refState.vieworg, fd->vieworg );
|
||||
VectorCopy( refState.viewangles, fd->viewangles );
|
||||
|
||||
fd->frametime = host.frametime;
|
||||
fd->time = cl.time;
|
||||
@@ -183,7 +184,7 @@ void V_RefApplyOverview( ref_viewpass_t *rvp )
|
||||
return;
|
||||
|
||||
// NOTE: Xash3D may use 16:9 or 16:10 aspects
|
||||
aspect = (float)glState.width / (float)glState.height;
|
||||
aspect = (float)refState.width / (float)refState.height;
|
||||
|
||||
size_x = fabs( 8192.0f / ov->flZoom );
|
||||
size_y = fabs( 8192.0f / (ov->flZoom * aspect ));
|
||||
@@ -216,7 +217,7 @@ void V_RefApplyOverview( ref_viewpass_t *rvp )
|
||||
|
||||
SetBits( rvp->flags, RF_DRAW_OVERVIEW );
|
||||
|
||||
Mod_SetOrthoBounds( mins, maxs );
|
||||
ref.dllFuncs.GL_OrthoBounds( mins, maxs );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -254,7 +255,7 @@ void V_GetRefParams( ref_params_t *fd, ref_viewpass_t *rvp )
|
||||
rvp->fov_y = V_CalcFov( &rvp->fov_x, clgame.viewport[2], clgame.viewport[3] );
|
||||
|
||||
// adjust FOV for widescreen
|
||||
if( glState.wideScreen && r_adjust_fov->value )
|
||||
if( refState.wideScreen && r_adjust_fov->value )
|
||||
V_AdjustFov( &rvp->fov_x, &rvp->fov_y, clgame.viewport[2], clgame.viewport[3], false );
|
||||
|
||||
rvp->flags = 0;
|
||||
@@ -273,7 +274,7 @@ V_PreRender
|
||||
qboolean V_PreRender( void )
|
||||
{
|
||||
// too early
|
||||
if( !glw_state.initialized )
|
||||
if( !ref.initialized )
|
||||
return false;
|
||||
|
||||
if( host.status == HOST_NOFOCUS )
|
||||
@@ -292,8 +293,10 @@ qboolean V_PreRender( void )
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
||||
|
||||
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
||||
|
||||
GL_UpdateSwapInterval( );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -312,15 +315,15 @@ void V_RenderView( void )
|
||||
ref_viewpass_t rvp;
|
||||
int viewnum = 0;
|
||||
|
||||
if( !cl.video_prepped || ( UI_IsVisible() && !cl.background ))
|
||||
if( !cl.video_prepped || ( !ui_renderworld->value && UI_IsVisible() && !cl.background ))
|
||||
return; // still loading
|
||||
|
||||
V_CalcViewRect (); // compute viewport rectangle
|
||||
V_SetRefParams( &rp );
|
||||
V_SetupViewModel ();
|
||||
R_Set2DMode( false );
|
||||
ref.dllFuncs.R_Set2DMode( false );
|
||||
SCR_DirtyScreen();
|
||||
GL_BackendStartFrame ();
|
||||
ref.dllFuncs.GL_BackendStartFrame ();
|
||||
|
||||
do
|
||||
{
|
||||
@@ -330,11 +333,10 @@ void V_RenderView( void )
|
||||
|
||||
if( viewnum == 0 && FBitSet( rvp.flags, RF_ONLY_CLIENTDRAW ))
|
||||
{
|
||||
pglClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
|
||||
pglClear( GL_COLOR_BUFFER_BIT );
|
||||
ref.dllFuncs.R_ClearScreen();
|
||||
}
|
||||
|
||||
R_RenderFrame( &rvp );
|
||||
GL_RenderFrame( &rvp );
|
||||
S_UpdateFrame( &rvp );
|
||||
viewnum++;
|
||||
|
||||
@@ -342,7 +344,101 @@ void V_RenderView( void )
|
||||
|
||||
// draw debug triangles on a server
|
||||
SV_DrawDebugTriangles ();
|
||||
GL_BackendEndFrame ();
|
||||
ref.dllFuncs.GL_BackendEndFrame ();
|
||||
}
|
||||
|
||||
#define POINT_SIZE 16.0f
|
||||
#define NODE_INTERVAL_X(x) (x * 16.0f)
|
||||
#define NODE_INTERVAL_Y(x) (x * 16.0f)
|
||||
|
||||
void R_DrawLeafNode( float x, float y, float scale )
|
||||
{
|
||||
float downScale = scale * 0.25f;// * POINT_SIZE;
|
||||
|
||||
ref.dllFuncs.R_DrawStretchPic( x - downScale * 0.5f, y - downScale * 0.5f, downScale, downScale, 0, 0, 1, 1, R_GetBuiltinTexture( REF_PARTICLE_TEXTURE ) );
|
||||
}
|
||||
|
||||
void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
||||
{
|
||||
ref.dllFuncs.Begin( TRI_LINES );
|
||||
ref.dllFuncs.Vertex3f( x, y, 0 );
|
||||
ref.dllFuncs.Vertex3f( x2, y2, 0 );
|
||||
ref.dllFuncs.End( );
|
||||
}
|
||||
|
||||
void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes, mleaf_t *viewleaf )
|
||||
{
|
||||
float downScale = scale * 0.8f;
|
||||
|
||||
downScale = Q_max( downScale, 1.0f );
|
||||
|
||||
if( !node ) return;
|
||||
|
||||
world.recursion_level++;
|
||||
|
||||
if( node->contents < 0 )
|
||||
{
|
||||
mleaf_t *leaf = (mleaf_t *)node;
|
||||
|
||||
if( world.recursion_level > world.max_recursion )
|
||||
world.max_recursion = world.recursion_level;
|
||||
|
||||
if( shownodes == 1 )
|
||||
{
|
||||
if( cl.worldmodel->leafs == leaf )
|
||||
ref.dllFuncs.Color4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
else if( viewleaf && viewleaf == leaf )
|
||||
ref.dllFuncs.Color4f( 1.0f, 0.0f, 0.0f, 1.0f );
|
||||
else ref.dllFuncs.Color4f( 0.0f, 1.0f, 0.0f, 1.0f );
|
||||
R_DrawLeafNode( x, y, scale );
|
||||
}
|
||||
world.recursion_level--;
|
||||
return;
|
||||
}
|
||||
|
||||
if( shownodes == 1 )
|
||||
{
|
||||
ref.dllFuncs.Color4f( 0.0f, 0.0f, 1.0f, 1.0f );
|
||||
R_DrawLeafNode( x, y, scale );
|
||||
}
|
||||
else if( shownodes == 2 )
|
||||
{
|
||||
R_DrawNodeConnection( x, y, x - scale, y + scale );
|
||||
R_DrawNodeConnection( x, y, x + scale, y + scale );
|
||||
}
|
||||
|
||||
R_ShowTree_r( node->children[1], x - scale, y + scale, downScale, shownodes, viewleaf );
|
||||
R_ShowTree_r( node->children[0], x + scale, y + scale, downScale, shownodes, viewleaf );
|
||||
|
||||
world.recursion_level--;
|
||||
}
|
||||
|
||||
void R_ShowTree( void )
|
||||
{
|
||||
float x = (float)((refState.width - (int)POINT_SIZE) >> 1);
|
||||
float y = NODE_INTERVAL_Y(1.0f);
|
||||
mleaf_t *viewleaf;
|
||||
|
||||
if( !cl.worldmodel || !CVAR_TO_BOOL( r_showtree ))
|
||||
return;
|
||||
|
||||
world.recursion_level = 0;
|
||||
viewleaf = Mod_PointInLeaf( refState.vieworg, cl.worldmodel->nodes );
|
||||
|
||||
//pglEnable( GL_BLEND );
|
||||
//pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
//pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
|
||||
//pglLineWidth( 2.0f );
|
||||
ref.dllFuncs.Color4f( 1, 0.7f, 0, 1.0f );
|
||||
//pglDisable( GL_TEXTURE_2D );
|
||||
R_ShowTree_r( cl.worldmodel->nodes, x, y, world.max_recursion * 3.5f, 2, viewleaf );
|
||||
//pglEnable( GL_TEXTURE_2D );
|
||||
//pglLineWidth( 1.0f );
|
||||
|
||||
R_ShowTree_r( cl.worldmodel->nodes, x, y, world.max_recursion * 3.5f, 1, viewleaf );
|
||||
|
||||
Con_NPrintf( 0, "max recursion %d\n", world.max_recursion );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -356,14 +452,14 @@ void V_PostRender( void )
|
||||
static double oldtime;
|
||||
qboolean draw_2d = false;
|
||||
|
||||
R_AllowFog( false );
|
||||
R_Set2DMode( true );
|
||||
ref.dllFuncs.R_AllowFog( false );
|
||||
ref.dllFuncs.R_Set2DMode( true );
|
||||
|
||||
if( cls.state == ca_active && cls.signon == SIGNONS && cls.scrshot_action != scrshot_mapshot )
|
||||
{
|
||||
SCR_TileClear();
|
||||
CL_DrawHUD( CL_ACTIVE );
|
||||
VGui_Paint( true );
|
||||
VGui_Paint();
|
||||
}
|
||||
|
||||
switch( cls.scrshot_action )
|
||||
@@ -383,17 +479,19 @@ void V_PostRender( void )
|
||||
SV_DrawOrthoTriangles();
|
||||
CL_DrawDemoRecording();
|
||||
CL_DrawHUD( CL_CHANGELEVEL );
|
||||
R_ShowTextures();
|
||||
ref.dllFuncs.R_ShowTextures();
|
||||
R_ShowTree();
|
||||
Con_DrawConsole();
|
||||
UI_UpdateMenu( host.realtime );
|
||||
Con_DrawVersion();
|
||||
Con_DrawDebug(); // must be last
|
||||
Touch_Draw();
|
||||
OSK_Draw();
|
||||
|
||||
S_ExtraUpdate();
|
||||
}
|
||||
|
||||
SCR_MakeScreenShot();
|
||||
R_AllowFog( true );
|
||||
R_EndFrame();
|
||||
}
|
||||
ref.dllFuncs.R_AllowFog( true );
|
||||
ref.dllFuncs.R_EndFrame();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ GNU General Public License for more details.
|
||||
#ifndef CLIENT_H
|
||||
#define CLIENT_H
|
||||
|
||||
#include "xash3d_types.h"
|
||||
#include "mathlib.h"
|
||||
#include "cdll_int.h"
|
||||
#include "menu_int.h"
|
||||
@@ -31,35 +32,13 @@ GNU General Public License for more details.
|
||||
#include "netchan.h"
|
||||
#include "net_api.h"
|
||||
#include "world.h"
|
||||
|
||||
#define MAX_DEMOS 32
|
||||
#define MAX_MOVIES 8
|
||||
#define MAX_CDTRACKS 32
|
||||
#define MAX_CLIENT_SPRITES 256 // SpriteTextures
|
||||
#define MAX_EFRAGS 8192 // Arcane Dimensions required
|
||||
#define MAX_REQUESTS 64
|
||||
|
||||
// screenshot types
|
||||
#define VID_SCREENSHOT 0
|
||||
#define VID_LEVELSHOT 1
|
||||
#define VID_MINISHOT 2
|
||||
#define VID_MAPSHOT 3 // special case for overview layer
|
||||
#define VID_SNAPSHOT 4 // save screenshot into root dir and no gamma correction
|
||||
#include "ref_common.h"
|
||||
|
||||
// client sprite types
|
||||
#define SPR_CLIENT 0 // client sprite for temp-entities or user-textures
|
||||
#define SPR_HUDSPRITE 1 // hud sprite
|
||||
#define SPR_MAPSPRITE 2 // contain overview.bmp that diced into frames 128x128
|
||||
|
||||
typedef int sound_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DEMO_INACTIVE = 0,
|
||||
DEMO_XASH3D,
|
||||
DEMO_QUAKE1
|
||||
} demo_mode;
|
||||
|
||||
//=============================================================================
|
||||
typedef struct netbandwithgraph_s
|
||||
{
|
||||
@@ -116,7 +95,11 @@ typedef struct
|
||||
#define ANGLE_MASK (ANGLE_BACKUP - 1)
|
||||
|
||||
#define CL_UPDATE_MASK (CL_UPDATE_BACKUP - 1)
|
||||
#if XASH_LOW_MEMORY == 2
|
||||
#define CL_UPDATE_BACKUP SINGLEPLAYER_BACKUP
|
||||
#else
|
||||
extern int CL_UPDATE_BACKUP;
|
||||
#endif
|
||||
|
||||
#define SIGNONS 2 // signon messages to receive before connected
|
||||
#define INVALID_HANDLE 0xFFFF // for XashXT cache system
|
||||
@@ -166,13 +149,6 @@ typedef struct
|
||||
float weaponstarttime;
|
||||
} cl_local_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[MAX_OSPATH];
|
||||
char modelname[MAX_OSPATH];
|
||||
model_t *model;
|
||||
} player_model_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
qboolean bUsed;
|
||||
@@ -237,7 +213,6 @@ typedef struct
|
||||
float timedelta; // floating delta between two updates
|
||||
|
||||
char serverinfo[MAX_SERVERINFO_STRING];
|
||||
player_model_t player_models[MAX_CLIENTS]; // cache of player models
|
||||
player_info_t players[MAX_CLIENTS]; // collected info about all other players include himself
|
||||
double lastresourcecheck;
|
||||
string downloadUrl;
|
||||
@@ -293,6 +268,8 @@ typedef struct
|
||||
short decal_index[MAX_DECALS];
|
||||
|
||||
model_t *worldmodel; // pointer to world
|
||||
|
||||
int lostpackets; // count lost packets and show dialog in menu
|
||||
} client_t;
|
||||
|
||||
/*
|
||||
@@ -303,16 +280,6 @@ of server connections
|
||||
|
||||
==================================================================
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ca_disconnected = 0,// not talking to a server
|
||||
ca_connecting, // sending request packets to the server
|
||||
ca_connected, // netchan_t established, waiting for svc_serverdata
|
||||
ca_validate, // download resources, validating, auth on server
|
||||
ca_active, // game views should be displayed
|
||||
ca_cinematic, // playing a cinematic, not connected to a server
|
||||
} connstate_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
scrshot_inactive,
|
||||
@@ -378,7 +345,7 @@ typedef struct
|
||||
qboolean adjust_size; // allow to adjust scale for fonts
|
||||
|
||||
int renderMode; // override kRenderMode from TriAPI
|
||||
int cullMode; // override CULL FACE from TriAPI
|
||||
TRICULLSTYLE cullMode; // override CULL FACE from TriAPI
|
||||
|
||||
// holds text color
|
||||
rgba_t textColor;
|
||||
@@ -446,16 +413,6 @@ typedef struct
|
||||
float applied_angle;
|
||||
} screen_shake_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short textures[MAX_SKINS];// alias textures
|
||||
struct mstudiotex_s *ptexture; // array of textures with local copy of remapped textures
|
||||
short numtextures; // textures count
|
||||
short topcolor; // cached value
|
||||
short bottomcolor; // cached value
|
||||
model_t *model; // for catch model changes
|
||||
} remap_info_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NET_REQUEST_CANCEL = 0, // request was cancelled for some reasons
|
||||
@@ -530,12 +487,15 @@ typedef struct
|
||||
|
||||
efrag_t *free_efrags; // linked efrags
|
||||
cl_entity_t viewent; // viewmodel
|
||||
|
||||
qboolean client_dll_uses_sdl;
|
||||
} clgame_static_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *hInstance; // pointer to client.dll
|
||||
UI_FUNCTIONS dllFuncs; // dll exported funcs
|
||||
UI_EXTENDED_FUNCTIONS dllFuncs2; // fwgs extension
|
||||
byte *mempool; // client edicts pool
|
||||
|
||||
cl_entity_t playermodel; // uiPlayerSetup drawing model
|
||||
@@ -548,9 +508,11 @@ typedef struct
|
||||
ui_globalvars_t *globals;
|
||||
|
||||
qboolean drawLogo; // set to TRUE if logo.avi missed or corrupted
|
||||
long logo_xres;
|
||||
long logo_yres;
|
||||
int logo_xres;
|
||||
int logo_yres;
|
||||
float logo_length;
|
||||
|
||||
qboolean use_text_api;
|
||||
} gameui_static_t;
|
||||
|
||||
typedef struct
|
||||
@@ -602,7 +564,7 @@ typedef struct
|
||||
double packet_loss_recalc_time;
|
||||
int starting_count; // message num readed bits
|
||||
|
||||
float nextcmdtime; // when can we send the next command packet?
|
||||
float nextcmdtime; // when can we send the next command packet?
|
||||
int lastoutgoingcommand; // sequence number of last outgoing command
|
||||
int lastupdate_sequence; // prediction stuff
|
||||
|
||||
@@ -648,7 +610,7 @@ typedef struct
|
||||
|
||||
// demo recording info must be here, so it isn't clearing on level change
|
||||
qboolean demorecording;
|
||||
qboolean demoplayback;
|
||||
int demoplayback;
|
||||
qboolean demowaiting; // don't record until a non-delta message is received
|
||||
qboolean timedemo;
|
||||
string demoname; // for demo looping
|
||||
@@ -657,6 +619,17 @@ typedef struct
|
||||
|
||||
file_t *demofile;
|
||||
file_t *demoheader; // contain demo startup info in case we record a demo on this level
|
||||
qboolean internetservers_wait; // internetservers is waiting for dns request
|
||||
qboolean internetservers_pending; // internetservers is waiting for dns request
|
||||
|
||||
// legacy mode support
|
||||
qboolean legacymode; // one-way 48 protocol compatibility
|
||||
netadr_t legacyserver;
|
||||
netadr_t legacyservers[MAX_LEGACY_SERVERS];
|
||||
int legacyservercount;
|
||||
int extensions;
|
||||
|
||||
netadr_t serveradr;
|
||||
} client_static_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -704,10 +677,14 @@ extern convar_t *cl_levelshot_name;
|
||||
extern convar_t *cl_draw_beams;
|
||||
extern convar_t *cl_clockreset;
|
||||
extern convar_t *cl_fixtimerate;
|
||||
extern convar_t *hud_scale;
|
||||
extern convar_t *gl_showtextures;
|
||||
extern convar_t *cl_bmodelinterp;
|
||||
extern convar_t *cl_righthand;
|
||||
extern convar_t *cl_lw; // local weapons
|
||||
extern convar_t *cl_charset;
|
||||
extern convar_t *cl_trace_messages;
|
||||
extern convar_t *hud_utf8;
|
||||
extern convar_t *cl_showevents;
|
||||
extern convar_t *scr_centertime;
|
||||
extern convar_t *scr_viewsize;
|
||||
@@ -715,12 +692,17 @@ extern convar_t *scr_loading;
|
||||
extern convar_t *v_dark; // start from dark
|
||||
extern convar_t *net_graph;
|
||||
extern convar_t *rate;
|
||||
extern convar_t *m_ignore;
|
||||
extern convar_t *r_showtree;
|
||||
extern convar_t *ui_renderworld;
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void CL_SetLightstyle( int style, const char* s, float f );
|
||||
void CL_RunLightStyles( void );
|
||||
void CL_DecayLights( void );
|
||||
dlight_t *CL_GetDynamicLight( int number );
|
||||
dlight_t *CL_GetEntityLight( int number );
|
||||
|
||||
//=================================================
|
||||
|
||||
@@ -737,7 +719,6 @@ void CL_SaveShot_f( void );
|
||||
void CL_LevelShot_f( void );
|
||||
void CL_SetSky_f( void );
|
||||
void SCR_Viewpos_f( void );
|
||||
void SCR_TimeRefresh_f( void );
|
||||
|
||||
//
|
||||
// cl_custom.c
|
||||
@@ -757,6 +738,11 @@ void CL_ResetFrame( frame_t *frame );
|
||||
void CL_WriteMessageHistory( void );
|
||||
const char *CL_MsgInfo( int cmd );
|
||||
|
||||
//
|
||||
// cl_efx.c
|
||||
//
|
||||
void CL_Particle( const vec3_t org, int color, float life, int zpos, int zvel );
|
||||
|
||||
//
|
||||
// cl_main.c
|
||||
//
|
||||
@@ -765,7 +751,7 @@ void CL_SendCommand( void );
|
||||
void CL_Disconnect_f( void );
|
||||
void CL_ProcessFile( qboolean successfully_received, const char *filename );
|
||||
void CL_WriteUsercmd( sizebuf_t *msg, int from, int to );
|
||||
int CL_GetFragmentSize( void *unused );
|
||||
int CL_GetFragmentSize( void *unused , fragsize_t mode );
|
||||
qboolean CL_PrecacheResources( void );
|
||||
void CL_SetupOverviewParams( void );
|
||||
void CL_UpdateFrameLerp( void );
|
||||
@@ -844,10 +830,17 @@ model_t *CL_LoadModel( const char *modelname, int *index );
|
||||
HSPRITE pfnSPR_Load( const char *szPicName );
|
||||
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
|
||||
void PicAdjustSize( float *x, float *y, float *w, float *h );
|
||||
int CL_GetScreenInfo( SCREENINFO *pscrinfo );
|
||||
void CL_FillRGBA( int x, int y, int width, int height, int r, int g, int b, int a );
|
||||
void CL_PlayerTrace( float *start, float *end, int traceFlags, int ignore_pe, pmtrace_t *tr );
|
||||
void CL_PlayerTraceExt( float *start, float *end, int traceFlags, int (*pfnIgnore)( physent_t *pe ), pmtrace_t *tr );
|
||||
void CL_SetTraceHull( int hull );
|
||||
void CL_GetMousePosition( int *mx, int *my ); // TODO: move to input
|
||||
cl_entity_t* CL_GetViewModel( void );
|
||||
void pfnGetScreenFade( struct screenfade_s *fade );
|
||||
physent_t *pfnGetPhysent( int idx );
|
||||
struct msurface_s *pfnTraceSurface( int ground, float *vstart, float *vend );
|
||||
movevars_t *pfnGetMoveVars( void );
|
||||
|
||||
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||
{
|
||||
@@ -862,6 +855,9 @@ _inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||
// cl_parse.c
|
||||
//
|
||||
void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message );
|
||||
void CL_ParseLegacyServerMessage( sizebuf_t *msg, qboolean normal_message );
|
||||
void CL_LegacyPrecache_f( void );
|
||||
|
||||
void CL_ParseTempEntity( sizebuf_t *msg );
|
||||
void CL_StartResourceDownloading( const char *pszMessage, qboolean bCustom );
|
||||
qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf );
|
||||
@@ -935,14 +931,11 @@ void CL_SetUpPlayerPrediction( int dopred, int bIncludeLocalClient );
|
||||
//
|
||||
void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message );
|
||||
|
||||
//
|
||||
// cl_studio.c
|
||||
//
|
||||
void CL_InitStudioAPI( void );
|
||||
|
||||
//
|
||||
// cl_frame.c
|
||||
//
|
||||
struct channel_s;
|
||||
struct rawchan_s;
|
||||
int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta );
|
||||
qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType );
|
||||
void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset );
|
||||
@@ -962,31 +955,42 @@ void CL_EmitEntities( void );
|
||||
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
|
||||
void CL_AllocRemapInfo( int topcolor, int bottomcolor );
|
||||
void CL_FreeRemapInfo( remap_info_t *info );
|
||||
void R_StudioSetRemapColors( int top, int bottom );
|
||||
void CL_UpdateRemapInfo( int topcolor, int bottomcolor );
|
||||
void CL_ClearAllRemaps( void );
|
||||
|
||||
//
|
||||
// cl_render.c
|
||||
//
|
||||
qboolean R_InitRenderAPI( void );
|
||||
int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef );
|
||||
lightstyle_t *CL_GetLightStyle( int number );
|
||||
int R_FatPVS( const vec3_t org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
|
||||
const ref_overview_t *GL_GetOverviewParms( void );
|
||||
|
||||
//
|
||||
// cl_efrag.c
|
||||
//
|
||||
void R_StoreEfrags( efrag_t **ppefrag, int framecount );
|
||||
void R_AddEfrags( cl_entity_t *ent );
|
||||
void R_RemoveEfrags( cl_entity_t *ent );
|
||||
//
|
||||
// cl_tent.c
|
||||
//
|
||||
struct particle_s;
|
||||
int CL_AddEntity( int entityType, cl_entity_t *pEnt );
|
||||
void CL_WeaponAnim( int iAnim, int body );
|
||||
void CL_ClearEffects( void );
|
||||
void CL_ClearEfrags( void );
|
||||
void CL_TestLights( void );
|
||||
void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean trans_pass, float frametime );
|
||||
void CL_FireCustomDecal( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags, float scale );
|
||||
void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags );
|
||||
void CL_PlayerDecal( int playerIndex, int textureIndex, int entityIndex, float *pos );
|
||||
void R_FreeDeadParticles( struct particle_s **ppparticles );
|
||||
void CL_AddClientResource( const char *filename, int type );
|
||||
void CL_AddClientResources( void );
|
||||
int CL_FxBlend( cl_entity_t *e );
|
||||
void CL_InitParticles( void );
|
||||
void CL_ClearParticles( void );
|
||||
void CL_FreeParticles( void );
|
||||
void CL_DrawParticles( double frametime );
|
||||
void CL_DrawTracers( double frametime );
|
||||
void CL_InitTempEnts( void );
|
||||
void CL_ClearTempEnts( void );
|
||||
void CL_FreeTempEnts( void );
|
||||
@@ -994,12 +998,13 @@ void CL_TempEntUpdate( void );
|
||||
void CL_InitViewBeams( void );
|
||||
void CL_ClearViewBeams( void );
|
||||
void CL_FreeViewBeams( void );
|
||||
void CL_DrawBeams( int fTrans );
|
||||
void CL_AddCustomBeam( cl_entity_t *pEnvBeam );
|
||||
cl_entity_t *R_BeamGetEntity( int index );
|
||||
void CL_KillDeadBeams( cl_entity_t *pDeadEntity );
|
||||
void CL_ParseViewBeam( sizebuf_t *msg, int beamType );
|
||||
void CL_LoadClientSprites( void );
|
||||
void CL_ReadPointFile_f( void );
|
||||
void CL_DrawEFX( float time, qboolean fTrans );
|
||||
void CL_ThinkParticle( double frametime, particle_t *p );
|
||||
void CL_ReadLineFile_f( void );
|
||||
void CL_RunLightStyles( void );
|
||||
|
||||
@@ -1007,7 +1012,7 @@ void CL_RunLightStyles( void );
|
||||
// console.c
|
||||
//
|
||||
extern convar_t *con_fontsize;
|
||||
qboolean Con_Visible( void );
|
||||
int Con_Visible( void );
|
||||
qboolean Con_FixedFont( void );
|
||||
void Con_VidInit( void );
|
||||
void Con_Shutdown( void );
|
||||
@@ -1017,6 +1022,10 @@ void Con_DrawDebug( void );
|
||||
void Con_RunConsole( void );
|
||||
void Con_DrawConsole( void );
|
||||
void Con_DrawVersion( void );
|
||||
int Con_UtfProcessChar( int in );
|
||||
int Con_UtfProcessCharForce( int in );
|
||||
int Con_UtfMoveLeft( char *str, int pos );
|
||||
int Con_UtfMoveRight( char *str, int pos, int length );
|
||||
void Con_DrawStringLen( const char *pText, int *length, int *height );
|
||||
int Con_DrawString( int x, int y, const char *string, rgba_t setColor );
|
||||
int Con_DrawCharacter( int x, int y, int number, rgba_t color );
|
||||
@@ -1029,13 +1038,18 @@ void Con_RestoreFont( void );
|
||||
void Key_Console( int key );
|
||||
void Key_Message( int key );
|
||||
void Con_FastClose( void );
|
||||
void Con_Bottom( void );
|
||||
void Con_Top( void );
|
||||
void Con_PageDown( int lines );
|
||||
void Con_PageUp( int lines );
|
||||
void Con_LoadHistory( void );
|
||||
|
||||
//
|
||||
// s_main.c
|
||||
//
|
||||
void S_StreamRawSamples( int samples, int rate, int width, int channels, const byte *data );
|
||||
void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float synctime );
|
||||
void S_StartBackgroundTrack( const char *intro, const char *loop, long position, qboolean fullpath );
|
||||
void S_StartBackgroundTrack( const char *intro, const char *loop, int position, qboolean fullpath );
|
||||
void S_StopBackgroundTrack( void );
|
||||
void S_StreamSetPause( int pause );
|
||||
void S_StartStreaming( void );
|
||||
@@ -1069,12 +1083,29 @@ qboolean UI_CreditsActive( void );
|
||||
void UI_CharEvent( int key );
|
||||
qboolean UI_MouseInRect( void );
|
||||
qboolean UI_IsVisible( void );
|
||||
void UI_ResetPing( void );
|
||||
void UI_ShowUpdateDialog( qboolean preferStore );
|
||||
void UI_ShowMessageBox( const char *text );
|
||||
void UI_AddTouchButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags );
|
||||
void UI_ConnectionProgress_Disconnect( void );
|
||||
void UI_ConnectionProgress_Download( const char *pszFileName, const char *pszServerName, const char *pszServerPath, int iCurrent, int iTotal, const char *comment );
|
||||
void UI_ConnectionProgress_DownloadEnd( void );
|
||||
void UI_ConnectionProgress_Precache( void );
|
||||
void UI_ConnectionProgress_Connect( const char *server );
|
||||
void UI_ConnectionProgress_ChangeLevel( void );
|
||||
void UI_ConnectionProgress_ParseServerInfo( const char *server );
|
||||
void pfnPIC_Set( HIMAGE hPic, int r, int g, int b, int a );
|
||||
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void pfnPIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void pfnPIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc );
|
||||
void pfnPIC_DrawAdditive( int x, int y, int width, int height, const wrect_t *prc );
|
||||
|
||||
//
|
||||
// cl_mobile.c
|
||||
//
|
||||
qboolean Mobile_Init( void );
|
||||
void Mobile_Shutdown( void );
|
||||
|
||||
//
|
||||
// cl_video.c
|
||||
//
|
||||
@@ -1087,4 +1118,27 @@ void SCR_RunCinematic( void );
|
||||
void SCR_StopCinematic( void );
|
||||
void CL_PlayVideo_f( void );
|
||||
|
||||
#endif//CLIENT_H
|
||||
|
||||
//
|
||||
// keys.c
|
||||
//
|
||||
int Key_IsDown( int keynum );
|
||||
const char *Key_IsBind( int keynum );
|
||||
void Key_Event( int key, int down );
|
||||
void Key_Init( void );
|
||||
void Key_WriteBindings( file_t *f );
|
||||
const char *Key_GetBinding( int keynum );
|
||||
void Key_SetBinding( int keynum, const char *binding );
|
||||
void Key_ClearStates( void );
|
||||
const char *Key_KeynumToString( int keynum );
|
||||
int Key_StringToKeynum( const char *str );
|
||||
int Key_GetKey( const char *binding );
|
||||
void Key_EnumCmds_f( void );
|
||||
void Key_SetKeyDest( int key_dest );
|
||||
void Key_EnableTextInput( qboolean enable, qboolean force );
|
||||
int Key_ToUpper( int key );
|
||||
void OSK_Draw( void );
|
||||
|
||||
extern rgba_t g_color_table[8];
|
||||
|
||||
#endif//CLIENT_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
439
engine/client/in_joy.c
Normal file
439
engine/client/in_joy.c
Normal file
@@ -0,0 +1,439 @@
|
||||
/*
|
||||
joyinput.c - joystick common input code
|
||||
|
||||
Copyright (C) 2016 a1batross
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "input.h"
|
||||
#include "keydefs.h"
|
||||
#include "client.h"
|
||||
#include "platform/platform.h"
|
||||
|
||||
#ifndef SHRT_MAX
|
||||
#define SHRT_MAX 0x7FFF
|
||||
#endif
|
||||
|
||||
typedef enum engineAxis_e
|
||||
{
|
||||
JOY_AXIS_SIDE = 0,
|
||||
JOY_AXIS_FWD,
|
||||
JOY_AXIS_PITCH,
|
||||
JOY_AXIS_YAW,
|
||||
JOY_AXIS_RT,
|
||||
JOY_AXIS_LT,
|
||||
JOY_AXIS_NULL
|
||||
} engineAxis_t;
|
||||
|
||||
#define MAX_AXES JOY_AXIS_NULL
|
||||
|
||||
// index - axis num come from event
|
||||
// value - inner axis
|
||||
static engineAxis_t joyaxesmap[MAX_AXES] =
|
||||
{
|
||||
JOY_AXIS_SIDE, // left stick, x
|
||||
JOY_AXIS_FWD, // left stick, y
|
||||
JOY_AXIS_PITCH, // right stick, y
|
||||
JOY_AXIS_YAW, // right stick, x
|
||||
JOY_AXIS_RT, // right trigger
|
||||
JOY_AXIS_LT // left trigger
|
||||
};
|
||||
|
||||
static struct joy_axis_s
|
||||
{
|
||||
short val;
|
||||
short prevval;
|
||||
} joyaxis[MAX_AXES] = { 0 };
|
||||
static byte currentbinding; // add posibility to remap keys, to place it in joykeys[]
|
||||
convar_t *joy_enable;
|
||||
static convar_t *joy_pitch;
|
||||
static convar_t *joy_yaw;
|
||||
static convar_t *joy_forward;
|
||||
static convar_t *joy_side;
|
||||
static convar_t *joy_found;
|
||||
static convar_t *joy_index;
|
||||
static convar_t *joy_lt_threshold;
|
||||
static convar_t *joy_rt_threshold;
|
||||
static convar_t *joy_side_deadzone;
|
||||
static convar_t *joy_forward_deadzone;
|
||||
static convar_t *joy_side_key_threshold;
|
||||
static convar_t *joy_forward_key_threshold;
|
||||
static convar_t *joy_pitch_deadzone;
|
||||
static convar_t *joy_yaw_deadzone;
|
||||
static convar_t *joy_axis_binding;
|
||||
|
||||
/*
|
||||
============
|
||||
Joy_IsActive
|
||||
============
|
||||
*/
|
||||
qboolean Joy_IsActive( void )
|
||||
{
|
||||
return joy_found->value && joy_enable->value;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Joy_HatMotionEvent
|
||||
|
||||
DPad events
|
||||
============
|
||||
*/
|
||||
void Joy_HatMotionEvent( byte hat, byte value )
|
||||
{
|
||||
struct
|
||||
{
|
||||
int mask;
|
||||
int key;
|
||||
} keys[] =
|
||||
{
|
||||
{ JOY_HAT_UP, K_UPARROW },
|
||||
{ JOY_HAT_DOWN, K_DOWNARROW },
|
||||
{ JOY_HAT_LEFT, K_LEFTARROW },
|
||||
{ JOY_HAT_RIGHT, K_RIGHTARROW },
|
||||
};
|
||||
int i;
|
||||
|
||||
if( !joy_found->value )
|
||||
return;
|
||||
|
||||
for( i = 0; i < ARRAYSIZE( keys ); i++ )
|
||||
{
|
||||
if( value & keys[i].mask )
|
||||
{
|
||||
if( !Key_IsDown( keys[i].key ))
|
||||
Key_Event( keys[i].key, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Key_IsDown( keys[i].key ))
|
||||
Key_Event( keys[i].key, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Joy_ProcessTrigger
|
||||
=============
|
||||
*/
|
||||
static void Joy_ProcessTrigger( const engineAxis_t engineAxis, short value )
|
||||
{
|
||||
int trigButton = 0, trigThreshold = 0;
|
||||
|
||||
switch( engineAxis )
|
||||
{
|
||||
case JOY_AXIS_RT:
|
||||
trigButton = K_JOY2;
|
||||
trigThreshold = joy_rt_threshold->value;
|
||||
break;
|
||||
case JOY_AXIS_LT:
|
||||
trigButton = K_JOY1;
|
||||
trigThreshold = joy_lt_threshold->value;
|
||||
break;
|
||||
default:
|
||||
Con_Reportf( S_ERROR "Joy_ProcessTrigger: invalid axis = %i", engineAxis );
|
||||
break;
|
||||
}
|
||||
|
||||
// update axis values
|
||||
joyaxis[engineAxis].prevval = joyaxis[engineAxis].val;
|
||||
joyaxis[engineAxis].val = value;
|
||||
|
||||
if( joyaxis[engineAxis].val > trigThreshold &&
|
||||
joyaxis[engineAxis].prevval <= trigThreshold ) // ignore random press
|
||||
{
|
||||
Key_Event( trigButton, true );
|
||||
}
|
||||
else if( joyaxis[engineAxis].val < trigThreshold &&
|
||||
joyaxis[engineAxis].prevval >= trigThreshold ) // we're unpressing (inverted)
|
||||
{
|
||||
Key_Event( trigButton, false );
|
||||
}
|
||||
}
|
||||
|
||||
static int Joy_GetHatValueForAxis( const engineAxis_t engineAxis )
|
||||
{
|
||||
int threshold, negative, positive;
|
||||
|
||||
switch( engineAxis )
|
||||
{
|
||||
case JOY_AXIS_SIDE:
|
||||
threshold = joy_side_key_threshold->value;
|
||||
negative = JOY_HAT_LEFT;
|
||||
positive = JOY_HAT_RIGHT;
|
||||
break;
|
||||
case JOY_AXIS_FWD:
|
||||
threshold = joy_side_key_threshold->value;
|
||||
negative = JOY_HAT_UP;
|
||||
positive = JOY_HAT_DOWN;
|
||||
break;
|
||||
default:
|
||||
ASSERT( false ); // only fwd/side axes can emit key events
|
||||
return 0;
|
||||
}
|
||||
|
||||
// similar code in Joy_ProcessTrigger
|
||||
if( joyaxis[engineAxis].val > threshold &&
|
||||
joyaxis[engineAxis].prevval <= threshold ) // ignore random press
|
||||
{
|
||||
return positive;
|
||||
}
|
||||
if( joyaxis[engineAxis].val < -threshold &&
|
||||
joyaxis[engineAxis].prevval >= -threshold ) // we're unpressing (inverted)
|
||||
{
|
||||
return negative;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Joy_ProcessStick
|
||||
=============
|
||||
*/
|
||||
static void Joy_ProcessStick( const engineAxis_t engineAxis, short value )
|
||||
{
|
||||
int deadzone = 0;
|
||||
|
||||
switch( engineAxis )
|
||||
{
|
||||
case JOY_AXIS_FWD: deadzone = joy_forward_deadzone->value; break;
|
||||
case JOY_AXIS_SIDE: deadzone = joy_side_deadzone->value; break;
|
||||
case JOY_AXIS_PITCH: deadzone = joy_pitch_deadzone->value; break;
|
||||
case JOY_AXIS_YAW: deadzone = joy_yaw_deadzone->value; break;
|
||||
default:
|
||||
Con_Reportf( S_ERROR "Joy_ProcessStick: invalid axis = %i", engineAxis );
|
||||
break;
|
||||
}
|
||||
|
||||
if( value < deadzone && value > -deadzone )
|
||||
value = 0; // caught new event in deadzone, fill it with zero(no motion)
|
||||
|
||||
// update axis values
|
||||
joyaxis[engineAxis].prevval = joyaxis[engineAxis].val;
|
||||
joyaxis[engineAxis].val = value;
|
||||
|
||||
// fwd/side axis simulate hat movement
|
||||
if( ( engineAxis == JOY_AXIS_SIDE || engineAxis == JOY_AXIS_FWD ) &&
|
||||
( CL_IsInMenu() || CL_IsInConsole() ) )
|
||||
{
|
||||
int val = 0;
|
||||
|
||||
val |= Joy_GetHatValueForAxis( JOY_AXIS_SIDE );
|
||||
val |= Joy_GetHatValueForAxis( JOY_AXIS_FWD );
|
||||
|
||||
Joy_HatMotionEvent( 0, val );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Joy_AxisMotionEvent
|
||||
|
||||
Axis events
|
||||
=============
|
||||
*/
|
||||
void Joy_AxisMotionEvent( byte axis, short value )
|
||||
{
|
||||
byte engineAxis;
|
||||
|
||||
if( !joy_found->value )
|
||||
return;
|
||||
|
||||
if( axis >= MAX_AXES )
|
||||
{
|
||||
Con_Reportf( "Only 6 axes is supported\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
engineAxis = joyaxesmap[axis]; // convert to engine inner axis control
|
||||
|
||||
if( engineAxis == JOY_AXIS_NULL )
|
||||
return;
|
||||
|
||||
if( value == joyaxis[engineAxis].val )
|
||||
return; // it is not an update
|
||||
|
||||
if( engineAxis >= JOY_AXIS_RT )
|
||||
Joy_ProcessTrigger( engineAxis, value );
|
||||
else
|
||||
Joy_ProcessStick( engineAxis, value );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Joy_BallMotionEvent
|
||||
|
||||
Trackball events. UNDONE
|
||||
=============
|
||||
*/
|
||||
void Joy_BallMotionEvent( byte ball, short xrel, short yrel )
|
||||
{
|
||||
//if( !joy_found->value )
|
||||
// return;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Joy_ButtonEvent
|
||||
|
||||
Button events
|
||||
=============
|
||||
*/
|
||||
void Joy_ButtonEvent( byte button, byte down )
|
||||
{
|
||||
if( !joy_found->value )
|
||||
return;
|
||||
|
||||
// generic game button code.
|
||||
if( button > 32 )
|
||||
{
|
||||
int origbutton = button;
|
||||
button = ( button & 31 ) + K_AUX1;
|
||||
|
||||
Con_Reportf( "Only 32 joybuttons is supported, converting %i button ID to %s\n", origbutton, Key_KeynumToString( button ) );
|
||||
}
|
||||
else button += K_AUX1;
|
||||
|
||||
Key_Event( button, down );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Joy_RemoveEvent
|
||||
|
||||
Called when joystick is removed. For future expansion
|
||||
=============
|
||||
*/
|
||||
void Joy_RemoveEvent( void )
|
||||
{
|
||||
if( joy_found->value )
|
||||
Cvar_FullSet( "joy_found", "0", FCVAR_READ_ONLY );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Joy_RemoveEvent
|
||||
|
||||
Called when joystick is removed. For future expansion
|
||||
=============
|
||||
*/
|
||||
void Joy_AddEvent( void )
|
||||
{
|
||||
if( joy_enable->value && !joy_found->value )
|
||||
Cvar_FullSet( "joy_found", "1", FCVAR_READ_ONLY );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Joy_FinalizeMove
|
||||
|
||||
Append movement from axis. Called everyframe
|
||||
=============
|
||||
*/
|
||||
void Joy_FinalizeMove( float *fw, float *side, float *dpitch, float *dyaw )
|
||||
{
|
||||
if( !Joy_IsActive() )
|
||||
return;
|
||||
|
||||
if( FBitSet( joy_axis_binding->flags, FCVAR_CHANGED ) )
|
||||
{
|
||||
const char *bind = joy_axis_binding->string;
|
||||
size_t i;
|
||||
|
||||
for( i = 0; bind[i]; i++ )
|
||||
{
|
||||
switch( bind[i] )
|
||||
{
|
||||
case 's': joyaxesmap[i] = JOY_AXIS_SIDE; break;
|
||||
case 'f': joyaxesmap[i] = JOY_AXIS_FWD; break;
|
||||
case 'y': joyaxesmap[i] = JOY_AXIS_YAW; break;
|
||||
case 'p': joyaxesmap[i] = JOY_AXIS_PITCH; break;
|
||||
case 'r': joyaxesmap[i] = JOY_AXIS_RT; break;
|
||||
case 'l': joyaxesmap[i] = JOY_AXIS_LT; break;
|
||||
default : joyaxesmap[i] = JOY_AXIS_NULL; break;
|
||||
}
|
||||
}
|
||||
|
||||
ClearBits( joy_axis_binding->flags, FCVAR_CHANGED );
|
||||
}
|
||||
|
||||
*fw -= joy_forward->value * (float)joyaxis[JOY_AXIS_FWD ].val/(float)SHRT_MAX; // must be form -1.0 to 1.0
|
||||
*side += joy_side->value * (float)joyaxis[JOY_AXIS_SIDE].val/(float)SHRT_MAX;
|
||||
#if !defined(XASH_SDL)
|
||||
*dpitch += joy_pitch->value * (float)joyaxis[JOY_AXIS_PITCH].val/(float)SHRT_MAX * host.realframetime; // abs axis rotate is frametime related
|
||||
*dyaw -= joy_yaw->value * (float)joyaxis[JOY_AXIS_YAW ].val/(float)SHRT_MAX * host.realframetime;
|
||||
#else
|
||||
// HACKHACK: SDL have inverted look axis.
|
||||
*dpitch -= joy_pitch->value * (float)joyaxis[JOY_AXIS_PITCH].val/(float)SHRT_MAX * host.realframetime;
|
||||
*dyaw += joy_yaw->value * (float)joyaxis[JOY_AXIS_YAW ].val/(float)SHRT_MAX * host.realframetime;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Joy_Init
|
||||
|
||||
Main init procedure
|
||||
=============
|
||||
*/
|
||||
void Joy_Init( void )
|
||||
{
|
||||
joy_pitch = Cvar_Get( "joy_pitch", "100.0", FCVAR_ARCHIVE, "joystick pitch sensitivity" );
|
||||
joy_yaw = Cvar_Get( "joy_yaw", "100.0", FCVAR_ARCHIVE, "joystick yaw sensitivity" );
|
||||
joy_side = Cvar_Get( "joy_side", "1.0", FCVAR_ARCHIVE, "joystick side sensitivity. Values from -1.0 to 1.0" );
|
||||
joy_forward = Cvar_Get( "joy_forward", "1.0", FCVAR_ARCHIVE, "joystick forward sensitivity. Values from -1.0 to 1.0" );
|
||||
|
||||
joy_lt_threshold = Cvar_Get( "joy_lt_threshold", "-16384", FCVAR_ARCHIVE, "left trigger threshold. Value from -32768 to 32767");
|
||||
joy_rt_threshold = Cvar_Get( "joy_rt_threshold", "-16384", FCVAR_ARCHIVE, "right trigger threshold. Value from -32768 to 32767" );
|
||||
|
||||
// emit a key event at 75% axis move
|
||||
joy_side_key_threshold = Cvar_Get( "joy_side_key_threshold", "24576", FCVAR_ARCHIVE, "side axis key event emit threshold. Value from 0 to 32767" );
|
||||
joy_forward_key_threshold = Cvar_Get( "joy_forward_key_threshold", "24576", FCVAR_ARCHIVE, "forward axis key event emit threshold. Value from 0 to 32767");
|
||||
|
||||
// by default, we rely on deadzone detection come from system, but some glitchy devices report false deadzones
|
||||
joy_side_deadzone = Cvar_Get( "joy_side_deadzone", "0", FCVAR_ARCHIVE, "side axis deadzone. Value from 0 to 32767" );
|
||||
joy_forward_deadzone = Cvar_Get( "joy_forward_deadzone", "0", FCVAR_ARCHIVE, "forward axis deadzone. Value from 0 to 32767");
|
||||
joy_pitch_deadzone = Cvar_Get( "joy_pitch_deadzone", "0", FCVAR_ARCHIVE, "pitch axis deadzone. Value from 0 to 32767");
|
||||
joy_yaw_deadzone = Cvar_Get( "joy_yaw_deadzone", "0", FCVAR_ARCHIVE, "yaw axis deadzone. Value from 0 to 32767" );
|
||||
|
||||
joy_axis_binding = Cvar_Get( "joy_axis_binding", "sfpyrl", FCVAR_ARCHIVE, "axis hardware id to engine inner axis binding, "
|
||||
"s - side, f - forward, y - yaw, p - pitch, r - left trigger, l - right trigger" );
|
||||
joy_found = Cvar_Get( "joy_found", "0", FCVAR_READ_ONLY, "is joystick is connected" );
|
||||
// we doesn't loaded config.cfg yet, so this cvar is not archive.
|
||||
// change by +set joy_index in cmdline
|
||||
joy_index = Cvar_Get( "joy_index", "0", FCVAR_READ_ONLY, "current active joystick" );
|
||||
|
||||
joy_enable = Cvar_Get( "joy_enable", "1", FCVAR_ARCHIVE, "enable joystick" );
|
||||
|
||||
if( Sys_CheckParm( "-nojoy" ))
|
||||
{
|
||||
Cvar_FullSet( "joy_enable", "0", FCVAR_READ_ONLY );
|
||||
return;
|
||||
}
|
||||
|
||||
Cvar_FullSet( "joy_found", va( "%d", Platform_JoyInit( joy_index->value )), FCVAR_READ_ONLY );
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
Joy_Shutdown
|
||||
|
||||
Shutdown joystick code
|
||||
===========
|
||||
*/
|
||||
void Joy_Shutdown( void )
|
||||
{
|
||||
Cvar_FullSet( "joy_found", 0, FCVAR_READ_ONLY );
|
||||
}
|
||||
1975
engine/client/in_touch.c
Normal file
1975
engine/client/in_touch.c
Normal file
File diff suppressed because it is too large
Load Diff
699
engine/client/input.c
Normal file
699
engine/client/input.c
Normal file
@@ -0,0 +1,699 @@
|
||||
/*
|
||||
input.c - win32 input devices
|
||||
Copyright (C) 2007 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "input.h"
|
||||
#include "client.h"
|
||||
#include "vgui_draw.h"
|
||||
|
||||
#ifdef XASH_SDL
|
||||
#include <SDL.h>
|
||||
#endif
|
||||
|
||||
#include "platform/platform.h"
|
||||
|
||||
void* in_mousecursor;
|
||||
qboolean in_mouseactive; // false when not focus app
|
||||
qboolean in_mouseinitialized;
|
||||
qboolean in_mouse_suspended;
|
||||
POINT in_lastvalidpos;
|
||||
qboolean in_mouse_savedpos;
|
||||
static struct inputstate_s
|
||||
{
|
||||
float lastpitch, lastyaw;
|
||||
} inputstate;
|
||||
|
||||
extern convar_t *vid_fullscreen;
|
||||
convar_t *m_enginemouse;
|
||||
convar_t *m_pitch;
|
||||
convar_t *m_yaw;
|
||||
|
||||
convar_t *m_enginesens;
|
||||
convar_t *m_ignore;
|
||||
convar_t *cl_forwardspeed;
|
||||
convar_t *cl_sidespeed;
|
||||
convar_t *cl_backspeed;
|
||||
convar_t *look_filter;
|
||||
|
||||
/*
|
||||
================
|
||||
IN_CollectInputDevices
|
||||
|
||||
Returns a bit mask representing connected devices or, at least, enabled
|
||||
================
|
||||
*/
|
||||
uint IN_CollectInputDevices( void )
|
||||
{
|
||||
uint ret = 0;
|
||||
|
||||
if( !m_ignore->value ) // no way to check is mouse connected, so use cvar only
|
||||
ret |= INPUT_DEVICE_MOUSE;
|
||||
|
||||
if( CVAR_TO_BOOL(touch_enable) )
|
||||
ret |= INPUT_DEVICE_TOUCH;
|
||||
|
||||
if( Joy_IsActive() ) // connected or enabled
|
||||
ret |= INPUT_DEVICE_JOYSTICK;
|
||||
|
||||
Con_Reportf( "Connected devices: %s%s%s%s\n",
|
||||
FBitSet( ret, INPUT_DEVICE_MOUSE ) ? "mouse " : "",
|
||||
FBitSet( ret, INPUT_DEVICE_TOUCH ) ? "touch " : "",
|
||||
FBitSet( ret, INPUT_DEVICE_JOYSTICK ) ? "joy " : "",
|
||||
FBitSet( ret, INPUT_DEVICE_VR ) ? "vr " : "");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
IN_LockInputDevices
|
||||
|
||||
tries to lock any possibilty to connect another input device after
|
||||
player is connected to the server
|
||||
=================
|
||||
*/
|
||||
void IN_LockInputDevices( qboolean lock )
|
||||
{
|
||||
extern convar_t *joy_enable; // private to input system
|
||||
|
||||
if( lock )
|
||||
{
|
||||
SetBits( m_ignore->flags, FCVAR_READ_ONLY );
|
||||
SetBits( joy_enable->flags, FCVAR_READ_ONLY );
|
||||
SetBits( touch_enable->flags, FCVAR_READ_ONLY );
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearBits( m_ignore->flags, FCVAR_READ_ONLY );
|
||||
ClearBits( joy_enable->flags, FCVAR_READ_ONLY );
|
||||
ClearBits( touch_enable->flags, FCVAR_READ_ONLY );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_StartupMouse
|
||||
===========
|
||||
*/
|
||||
void IN_StartupMouse( void )
|
||||
{
|
||||
m_ignore = Cvar_Get( "m_ignore", DEFAULT_M_IGNORE, FCVAR_ARCHIVE , "ignore mouse events" );
|
||||
|
||||
m_enginemouse = Cvar_Get( "m_enginemouse", "0", FCVAR_ARCHIVE, "read mouse events in engine instead of client" );
|
||||
m_enginesens = Cvar_Get( "m_enginesens", "0.3", FCVAR_ARCHIVE, "mouse sensitivity, when m_enginemouse enabled" );
|
||||
m_pitch = Cvar_Get( "m_pitch", "0.022", FCVAR_ARCHIVE, "mouse pitch value" );
|
||||
m_yaw = Cvar_Get( "m_yaw", "0.022", FCVAR_ARCHIVE, "mouse yaw value" );
|
||||
look_filter = Cvar_Get( "look_filter", "0", FCVAR_ARCHIVE, "filter look events making it smoother" );
|
||||
|
||||
// You can use -nomouse argument to prevent using mouse from client
|
||||
// -noenginemouse will disable all mouse input
|
||||
if( Sys_CheckParm( "-noenginemouse" )) return;
|
||||
|
||||
in_mouseinitialized = true;
|
||||
}
|
||||
|
||||
static void IN_ActivateCursor( void )
|
||||
{
|
||||
if( cls.key_dest == key_menu )
|
||||
{
|
||||
#ifdef XASH_SDL
|
||||
SDL_SetCursor( in_mousecursor );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void IN_SetCursor( void *hCursor )
|
||||
{
|
||||
in_mousecursor = hCursor;
|
||||
|
||||
IN_ActivateCursor();
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_MouseSavePos
|
||||
|
||||
Save mouse pos before state change e.g. changelevel
|
||||
===========
|
||||
*/
|
||||
void IN_MouseSavePos( void )
|
||||
{
|
||||
if( !in_mouseactive )
|
||||
return;
|
||||
|
||||
Platform_GetMousePos( &in_lastvalidpos.x, &in_lastvalidpos.y );
|
||||
in_mouse_savedpos = true;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_MouseRestorePos
|
||||
|
||||
Restore right position for background
|
||||
===========
|
||||
*/
|
||||
void IN_MouseRestorePos( void )
|
||||
{
|
||||
if( !in_mouse_savedpos )
|
||||
return;
|
||||
|
||||
Platform_SetMousePos( in_lastvalidpos.x, in_lastvalidpos.y );
|
||||
|
||||
in_mouse_savedpos = false;
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_ToggleClientMouse
|
||||
|
||||
Called when key_dest is changed
|
||||
===========
|
||||
*/
|
||||
void IN_ToggleClientMouse( int newstate, int oldstate )
|
||||
{
|
||||
if( newstate == oldstate ) return;
|
||||
|
||||
if( oldstate == key_game )
|
||||
{
|
||||
if( cls.initialized )
|
||||
clgame.dllFuncs.IN_DeactivateMouse();
|
||||
}
|
||||
else if( newstate == key_game )
|
||||
{
|
||||
// reset mouse pos, so cancel effect in game
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
if( CVAR_TO_BOOL( touch_enable ) )
|
||||
{
|
||||
SDL_SetRelativeMouseMode( SDL_FALSE );
|
||||
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Platform_SetMousePos( host.window_center_x, host.window_center_y );
|
||||
#if XASH_SDL
|
||||
SDL_SetWindowGrab( host.hWnd, SDL_TRUE );
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
if( clgame.dllFuncs.pfnLookEvent )
|
||||
SDL_SetRelativeMouseMode( SDL_TRUE );
|
||||
#endif
|
||||
#endif // XASH_SDL
|
||||
}
|
||||
if( cls.initialized )
|
||||
clgame.dllFuncs.IN_ActivateMouse();
|
||||
}
|
||||
|
||||
if( ( newstate == key_menu || newstate == key_console || newstate == key_message ) && ( !CL_IsBackgroundMap() || CL_IsBackgroundDemo( )))
|
||||
{
|
||||
#ifdef XASH_SDL
|
||||
SDL_SetWindowGrab(host.hWnd, SDL_FALSE);
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
if( clgame.dllFuncs.pfnLookEvent )
|
||||
SDL_SetRelativeMouseMode( SDL_FALSE );
|
||||
#endif
|
||||
#endif // XASH_SDL
|
||||
#if XASH_ANDROID
|
||||
Android_ShowMouse( true );
|
||||
#endif
|
||||
#ifdef XASH_USE_EVDEV
|
||||
Evdev_SetGrab( false );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if XASH_ANDROID
|
||||
Android_ShowMouse( false );
|
||||
#endif
|
||||
#ifdef XASH_USE_EVDEV
|
||||
Evdev_SetGrab( true );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_ActivateMouse
|
||||
|
||||
Called when the window gains focus or changes in some way
|
||||
===========
|
||||
*/
|
||||
void IN_ActivateMouse( qboolean force )
|
||||
{
|
||||
int width, height;
|
||||
static int oldstate;
|
||||
|
||||
if( !in_mouseinitialized )
|
||||
return;
|
||||
|
||||
if( CL_Active() && host.mouse_visible && !force )
|
||||
return; // VGUI controls
|
||||
|
||||
if( cls.key_dest == key_menu && !Cvar_VariableInteger( "fullscreen" ))
|
||||
{
|
||||
// check for mouse leave-entering
|
||||
if( !in_mouse_suspended && !UI_MouseInRect( ))
|
||||
in_mouse_suspended = true;
|
||||
|
||||
if( oldstate != in_mouse_suspended )
|
||||
{
|
||||
if( in_mouse_suspended )
|
||||
{
|
||||
#ifdef XASH_SDL
|
||||
/// TODO: Platform_ShowCursor
|
||||
if( !touch_emulate )
|
||||
SDL_ShowCursor( SDL_FALSE );
|
||||
#endif
|
||||
UI_ShowCursor( false );
|
||||
}
|
||||
}
|
||||
|
||||
oldstate = in_mouse_suspended;
|
||||
|
||||
if( in_mouse_suspended )
|
||||
{
|
||||
in_mouse_suspended = false;
|
||||
in_mouseactive = false; // re-initialize mouse
|
||||
UI_ShowCursor( true );
|
||||
}
|
||||
}
|
||||
|
||||
if( in_mouseactive ) return;
|
||||
in_mouseactive = true;
|
||||
|
||||
if( UI_IsVisible( )) return;
|
||||
|
||||
if( cls.key_dest == key_game )
|
||||
{
|
||||
clgame.dllFuncs.IN_ActivateMouse();
|
||||
#ifdef XASH_SDL
|
||||
SDL_GetRelativeMouseState( 0, 0 ); // Reset mouse position
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_DeactivateMouse
|
||||
|
||||
Called when the window loses focus
|
||||
===========
|
||||
*/
|
||||
void IN_DeactivateMouse( void )
|
||||
{
|
||||
if( !in_mouseinitialized || !in_mouseactive )
|
||||
return;
|
||||
|
||||
if( cls.key_dest == key_game )
|
||||
{
|
||||
clgame.dllFuncs.IN_DeactivateMouse();
|
||||
}
|
||||
|
||||
in_mouseactive = false;
|
||||
#ifdef XASH_SDL
|
||||
SDL_SetWindowGrab( host.hWnd, SDL_FALSE );
|
||||
#endif // XASH_SDL
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
IN_MouseMove
|
||||
================
|
||||
*/
|
||||
void IN_MouseMove( void )
|
||||
{
|
||||
POINT current_pos;
|
||||
|
||||
if( !in_mouseinitialized || !in_mouseactive || !UI_IsVisible( ))
|
||||
return;
|
||||
|
||||
// find mouse movement
|
||||
Platform_GetMousePos( ¤t_pos.x, ¤t_pos.y );
|
||||
|
||||
VGui_MouseMove( current_pos.x, current_pos.y );
|
||||
|
||||
// HACKHACK: show cursor in UI, as mainui doesn't call
|
||||
// platform-dependent SetCursor anymore
|
||||
#ifdef XASH_SDL
|
||||
if( UI_IsVisible() )
|
||||
SDL_ShowCursor( SDL_TRUE );
|
||||
#endif
|
||||
|
||||
// if the menu is visible, move the menu cursor
|
||||
UI_MouseMove( current_pos.x, current_pos.y );
|
||||
|
||||
IN_ActivateCursor();
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_MouseEvent
|
||||
===========
|
||||
*/
|
||||
void IN_MouseEvent( void )
|
||||
{
|
||||
int i;
|
||||
|
||||
// touch emu: handle motion
|
||||
if( CVAR_TO_BOOL( touch_emulate ))
|
||||
{
|
||||
if( Key_IsDown( K_SHIFT ) )
|
||||
Touch_KeyEvent( K_MOUSE2, 2 );
|
||||
else
|
||||
Touch_KeyEvent( K_MOUSE1, 2 );
|
||||
}
|
||||
|
||||
if( !in_mouseinitialized || !in_mouseactive )
|
||||
return;
|
||||
|
||||
|
||||
if( m_ignore->value )
|
||||
return;
|
||||
|
||||
if( cls.key_dest == key_game )
|
||||
{
|
||||
#if defined( XASH_SDL )
|
||||
static qboolean ignore; // igonre mouse warp event
|
||||
int x, y;
|
||||
Platform_GetMousePos(&x, &y);
|
||||
if( host.mouse_visible )
|
||||
SDL_ShowCursor( SDL_TRUE );
|
||||
else if( !CVAR_TO_BOOL( touch_emulate ) )
|
||||
SDL_ShowCursor( SDL_FALSE );
|
||||
|
||||
if( x < host.window_center_x / 2 ||
|
||||
y < host.window_center_y / 2 ||
|
||||
x > host.window_center_x + host.window_center_x / 2 ||
|
||||
y > host.window_center_y + host.window_center_y / 2 )
|
||||
{
|
||||
Platform_SetMousePos( host.window_center_x, host.window_center_y );
|
||||
ignore = 1; // next mouse event will be mouse warp
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !ignore )
|
||||
{
|
||||
if( !m_enginemouse->value )
|
||||
{
|
||||
// a1ba: mouse keys are now separated
|
||||
// so pass 0 here
|
||||
clgame.dllFuncs.IN_MouseEvent( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_GetRelativeMouseState( 0, 0 ); // reset relative state
|
||||
ignore = 0;
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if XASH_SDL && !XASH_WIN32
|
||||
#if SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
SDL_SetRelativeMouseMode( SDL_FALSE );
|
||||
#endif // SDL_VERSION_ATLEAST( 2, 0, 0 )
|
||||
SDL_ShowCursor( SDL_TRUE );
|
||||
#endif // XASH_SDL && !XASH_WIN32
|
||||
IN_MouseMove();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Shutdown
|
||||
===========
|
||||
*/
|
||||
void IN_Shutdown( void )
|
||||
{
|
||||
IN_DeactivateMouse( );
|
||||
|
||||
#ifdef XASH_USE_EVDEV
|
||||
Evdev_Shutdown();
|
||||
#endif
|
||||
|
||||
Touch_Shutdown();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
IN_Init
|
||||
===========
|
||||
*/
|
||||
void IN_Init( void )
|
||||
{
|
||||
cl_forwardspeed = Cvar_Get( "cl_forwardspeed", "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL, "Default forward move speed" );
|
||||
cl_backspeed = Cvar_Get( "cl_backspeed", "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL, "Default back move speed" );
|
||||
cl_sidespeed = Cvar_Get( "cl_sidespeed", "400", FCVAR_ARCHIVE | FCVAR_CLIENTDLL, "Default side move speed" );
|
||||
|
||||
if( !Host_IsDedicated() )
|
||||
{
|
||||
IN_StartupMouse( );
|
||||
|
||||
Joy_Init(); // common joystick support init
|
||||
|
||||
Touch_Init();
|
||||
|
||||
#ifdef XASH_USE_EVDEV
|
||||
Evdev_Init();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
IN_JoyMove
|
||||
|
||||
Common function for engine joystick movement
|
||||
|
||||
-1 < forwardmove < 1, -1 < sidemove < 1
|
||||
|
||||
================
|
||||
*/
|
||||
|
||||
#define F (1U << 0) // Forward
|
||||
#define B (1U << 1) // Back
|
||||
#define L (1U << 2) // Left
|
||||
#define R (1U << 3) // Right
|
||||
#define T (1U << 4) // Forward stop
|
||||
#define S (1U << 5) // Side stop
|
||||
static void IN_JoyAppendMove( usercmd_t *cmd, float forwardmove, float sidemove )
|
||||
{
|
||||
static uint moveflags = T | S;
|
||||
|
||||
if( forwardmove ) cmd->forwardmove = forwardmove * cl_forwardspeed->value;
|
||||
if( sidemove ) cmd->sidemove = sidemove * cl_sidespeed->value;
|
||||
|
||||
if( forwardmove )
|
||||
{
|
||||
moveflags &= ~T;
|
||||
}
|
||||
else if( !( moveflags & T ) )
|
||||
{
|
||||
Cmd_ExecuteString( "-back" );
|
||||
Cmd_ExecuteString( "-forward" );
|
||||
moveflags |= T;
|
||||
}
|
||||
|
||||
if( sidemove )
|
||||
{
|
||||
moveflags &= ~S;
|
||||
}
|
||||
else if( !( moveflags & S ) )
|
||||
{
|
||||
Cmd_ExecuteString( "-moveleft" );
|
||||
Cmd_ExecuteString( "-moveright" );
|
||||
moveflags |= S;
|
||||
}
|
||||
|
||||
if ( forwardmove > 0.7f && !( moveflags & F ))
|
||||
{
|
||||
moveflags |= F;
|
||||
Cmd_ExecuteString( "+forward" );
|
||||
}
|
||||
else if ( forwardmove < 0.7f && ( moveflags & F ))
|
||||
{
|
||||
moveflags &= ~F;
|
||||
Cmd_ExecuteString( "-forward" );
|
||||
}
|
||||
|
||||
if ( forwardmove < -0.7f && !( moveflags & B ))
|
||||
{
|
||||
moveflags |= B;
|
||||
Cmd_ExecuteString( "+back" );
|
||||
}
|
||||
else if ( forwardmove > -0.7f && ( moveflags & B ))
|
||||
{
|
||||
moveflags &= ~B;
|
||||
Cmd_ExecuteString( "-back" );
|
||||
}
|
||||
|
||||
if ( sidemove > 0.9f && !( moveflags & R ))
|
||||
{
|
||||
moveflags |= R;
|
||||
Cmd_ExecuteString( "+moveright" );
|
||||
}
|
||||
else if ( sidemove < 0.9f && ( moveflags & R ))
|
||||
{
|
||||
moveflags &= ~R;
|
||||
Cmd_ExecuteString( "-moveright" );
|
||||
}
|
||||
|
||||
if ( sidemove < -0.9f && !( moveflags & L ))
|
||||
{
|
||||
moveflags |= L;
|
||||
Cmd_ExecuteString( "+moveleft" );
|
||||
}
|
||||
else if ( sidemove > -0.9f && ( moveflags & L ))
|
||||
{
|
||||
moveflags &= ~L;
|
||||
Cmd_ExecuteString( "-moveleft" );
|
||||
}
|
||||
}
|
||||
|
||||
void IN_CollectInput( float *forward, float *side, float *pitch, float *yaw, qboolean includeMouse, qboolean includeSdlMouse )
|
||||
{
|
||||
if( includeMouse )
|
||||
{
|
||||
#if XASH_INPUT == INPUT_SDL
|
||||
if( includeSdlMouse )
|
||||
{
|
||||
int x, y;
|
||||
SDL_GetRelativeMouseState( &x, &y );
|
||||
*pitch += y * m_pitch->value;
|
||||
*yaw -= x * m_yaw->value;
|
||||
}
|
||||
#endif // INPUT_SDL
|
||||
|
||||
#if XASH_INPUT == INPUT_ANDROID
|
||||
{
|
||||
float x, y;
|
||||
Android_MouseMove( &x, &y );
|
||||
*pitch += y * m_pitch->value;
|
||||
*yaw -= x * m_yaw->value;
|
||||
}
|
||||
#endif // ANDROID
|
||||
|
||||
#ifdef XASH_USE_EVDEV
|
||||
IN_EvdevMove( yaw, pitch );
|
||||
#endif
|
||||
}
|
||||
|
||||
Joy_FinalizeMove( forward, side, yaw, pitch );
|
||||
Touch_GetMove( forward, side, yaw, pitch );
|
||||
|
||||
if( look_filter->value )
|
||||
{
|
||||
*pitch = ( inputstate.lastpitch + *pitch ) / 2;
|
||||
*yaw = ( inputstate.lastyaw + *yaw ) / 2;
|
||||
inputstate.lastpitch = *pitch;
|
||||
inputstate.lastyaw = *yaw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
IN_EngineAppendMove
|
||||
|
||||
Called from cl_main.c after generating command in client
|
||||
================
|
||||
*/
|
||||
void IN_EngineAppendMove( float frametime, void *cmd1, qboolean active )
|
||||
{
|
||||
float forward, side, pitch, yaw;
|
||||
usercmd_t *cmd = cmd1;
|
||||
|
||||
if( clgame.dllFuncs.pfnLookEvent )
|
||||
return;
|
||||
|
||||
if( cls.key_dest != key_game || cl.paused || cl.intermission )
|
||||
return;
|
||||
|
||||
forward = side = pitch = yaw = 0;
|
||||
|
||||
if( active )
|
||||
{
|
||||
float sensitivity = 1;//( (float)cl.local.scr_fov / (float)90.0f );
|
||||
|
||||
IN_CollectInput( &forward, &side, &pitch, &yaw, in_mouseinitialized && !CVAR_TO_BOOL( m_ignore ), m_enginemouse->value );
|
||||
|
||||
IN_JoyAppendMove( cmd, forward, side );
|
||||
|
||||
if( pitch || yaw )
|
||||
{
|
||||
cmd->viewangles[YAW] += yaw * sensitivity;
|
||||
cmd->viewangles[PITCH] += pitch * sensitivity;
|
||||
cmd->viewangles[PITCH] = bound( -90, cmd->viewangles[PITCH], 90 );
|
||||
VectorCopy(cmd->viewangles, cl.viewangles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
Host_InputFrame
|
||||
|
||||
Called every frame, even if not generating commands
|
||||
==================
|
||||
*/
|
||||
void Host_InputFrame( void )
|
||||
{
|
||||
qboolean shutdownMouse = false;
|
||||
float forward = 0, side = 0, pitch = 0, yaw = 0;
|
||||
|
||||
Sys_SendKeyEvents ();
|
||||
|
||||
#ifdef XASH_USE_EVDEV
|
||||
IN_EvdevFrame();
|
||||
#endif
|
||||
|
||||
if( clgame.dllFuncs.pfnLookEvent )
|
||||
{
|
||||
IN_CollectInput( &forward, &side, &pitch, &yaw, in_mouseinitialized && !CVAR_TO_BOOL( m_ignore ), true );
|
||||
|
||||
if( cls.key_dest == key_game )
|
||||
{
|
||||
clgame.dllFuncs.pfnLookEvent( yaw, pitch );
|
||||
clgame.dllFuncs.pfnMoveEvent( forward, side );
|
||||
}
|
||||
}
|
||||
|
||||
Cbuf_Execute ();
|
||||
|
||||
if( !in_mouseinitialized )
|
||||
return;
|
||||
|
||||
if( host.status != HOST_FRAME )
|
||||
{
|
||||
IN_DeactivateMouse();
|
||||
return;
|
||||
}
|
||||
|
||||
// release mouse during pause or console typeing
|
||||
if( cl.paused && cls.key_dest == key_game )
|
||||
shutdownMouse = true;
|
||||
|
||||
if( shutdownMouse && !Cvar_VariableInteger( "fullscreen" ))
|
||||
{
|
||||
IN_DeactivateMouse();
|
||||
return;
|
||||
}
|
||||
|
||||
IN_ActivateMouse( false );
|
||||
IN_MouseMove();
|
||||
}
|
||||
109
engine/client/input.h
Normal file
109
engine/client/input.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
input.h - win32 input devices
|
||||
Copyright (C) 2007 Uncle Mike
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef INPUT_H
|
||||
#define INPUT_H
|
||||
|
||||
/*
|
||||
==============================================================
|
||||
|
||||
INPUT
|
||||
|
||||
==============================================================
|
||||
*/
|
||||
|
||||
#include "keydefs.h"
|
||||
|
||||
//
|
||||
// input.c
|
||||
//
|
||||
extern qboolean in_mouseinitialized;
|
||||
void IN_Init( void );
|
||||
void Host_InputFrame( void );
|
||||
void IN_Shutdown( void );
|
||||
void IN_MouseEvent( void );
|
||||
void IN_ActivateMouse( qboolean force );
|
||||
void IN_DeactivateMouse( void );
|
||||
void IN_MouseSavePos( void );
|
||||
void IN_MouseRestorePos( void );
|
||||
void IN_ToggleClientMouse( int newstate, int oldstate );
|
||||
void IN_SetCursor( void *hCursor );
|
||||
|
||||
uint IN_CollectInputDevices( void );
|
||||
void IN_LockInputDevices( qboolean lock );
|
||||
void IN_EngineAppendMove( float frametime, void *cmd, qboolean active );
|
||||
|
||||
extern convar_t *m_yaw;
|
||||
extern convar_t *m_pitch;
|
||||
//
|
||||
// in_touch.c
|
||||
//
|
||||
typedef enum
|
||||
{
|
||||
event_down = 0,
|
||||
event_up,
|
||||
event_motion
|
||||
} touchEventType;
|
||||
|
||||
extern convar_t *touch_enable;
|
||||
extern convar_t *touch_emulate;
|
||||
|
||||
void Touch_Draw( void );
|
||||
void Touch_SetClientOnly( qboolean state );
|
||||
void Touch_RemoveButton( const char *name );
|
||||
void Touch_HideButtons( const char *name, unsigned char hide );
|
||||
//void IN_TouchSetCommand( const char *name, const char *command );
|
||||
//void IN_TouchSetTexture( const char *name, const char *texture );
|
||||
//void IN_TouchSetColor( const char *name, byte *color );
|
||||
void Touch_AddClientButton( const char *name, const char *texture, const char *command, float x1, float y1, float x2, float y2, byte *color, int round, float aspect, int flags );
|
||||
void Touch_AddDefaultButton( const char *name, const char *texturefile, const char *command, float x1, float y1, float x2, float y2, byte *color, int round, float aspect, int flags );
|
||||
void Touch_WriteConfig( void );
|
||||
void Touch_Init( void );
|
||||
void Touch_Shutdown( void );
|
||||
void Touch_GetMove( float * forward, float *side, float *yaw, float *pitch );
|
||||
void Touch_ResetDefaultButtons( void );
|
||||
int IN_TouchEvent( touchEventType type, int fingerID, float x, float y, float dx, float dy );
|
||||
void Touch_KeyEvent( int key, int down );
|
||||
|
||||
//
|
||||
// in_joy.c
|
||||
//
|
||||
enum
|
||||
{
|
||||
JOY_HAT_CENTERED = 0,
|
||||
JOY_HAT_UP = BIT(0),
|
||||
JOY_HAT_RIGHT = BIT(1),
|
||||
JOY_HAT_DOWN = BIT(2),
|
||||
JOY_HAT_LEFT = BIT(3),
|
||||
JOY_HAT_RIGHTUP = JOY_HAT_RIGHT | JOY_HAT_UP,
|
||||
JOY_HAT_RIGHTDOWN = JOY_HAT_RIGHT | JOY_HAT_DOWN,
|
||||
JOY_HAT_LEFTUP = JOY_HAT_LEFT | JOY_HAT_UP,
|
||||
JOY_HAT_LEFTDOWN = JOY_HAT_LEFT | JOY_HAT_DOWN
|
||||
};
|
||||
|
||||
qboolean Joy_IsActive( void );
|
||||
void Joy_HatMotionEvent( byte hat, byte value );
|
||||
void Joy_AxisMotionEvent( byte axis, short value );
|
||||
void Joy_BallMotionEvent( byte ball, short xrel, short yrel );
|
||||
void Joy_ButtonEvent( byte button, byte down );
|
||||
void Joy_AddEvent( void );
|
||||
void Joy_RemoveEvent( void );
|
||||
void Joy_FinalizeMove( float *fw, float *side, float *dpitch, float *dyaw );
|
||||
void Joy_Init( void );
|
||||
void Joy_Shutdown( void );
|
||||
void Joy_EnableTextInput(qboolean enable, qboolean force);
|
||||
|
||||
|
||||
#endif//INPUT_H
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user