mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-04-22 14:33:41 +03:00
Compare commits
871 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
7976a21b51 | ||
|
ab6dbb860d | ||
|
365d560f12 | ||
|
6fbd411767 | ||
|
f79f07e915 | ||
|
cfe649e0e0 | ||
|
93d586a82e | ||
|
5bc5a3beec | ||
|
b03ffdcac4 | ||
|
66012e7c29 | ||
|
d4b66b16cd | ||
|
d51d44eb73 | ||
|
0ec851394f | ||
|
466183c4de | ||
|
17af09b3d1 | ||
|
b055d77663 | ||
|
10f08829e5 | ||
|
70a13c3306 | ||
|
468fa81f47 | ||
|
7220a6de28 | ||
|
ad423d1d07 | ||
|
a5c754dd00 | ||
|
8ef090c963 | ||
|
aa31835f36 | ||
|
0921f7409b | ||
|
ed476cbbe7 | ||
|
a72779a0e7 | ||
|
a00c8234e4 | ||
|
99c94f058b | ||
|
959af0b130 | ||
|
7b15e43302 | ||
|
de598346da | ||
|
a8d69e56e3 | ||
|
e0967dea69 | ||
|
e3ca25a9fc | ||
|
7da95edde1 | ||
|
b51c5c3f86 | ||
|
93bec9d7c0 | ||
|
138f51e791 | ||
|
e5d30605d5 | ||
|
0464bd7fd3 | ||
|
98816adacc | ||
|
038c66ef58 | ||
|
4efb50283d | ||
|
bdc34e4bad | ||
|
da44d97951 | ||
|
b59214ca72 | ||
|
e954f00f79 | ||
|
f5db760a66 | ||
|
b19f329d5f | ||
|
72bd5fe948 | ||
|
47aa8ac3f4 | ||
|
7ebb26c996 | ||
|
696036219e | ||
|
337b58eb3c | ||
|
ead5668dc8 | ||
|
359fcb7196 | ||
|
a999c794f7 | ||
|
df6adcc5e9 | ||
|
e9c45e5235 | ||
|
5d50335c02 | ||
|
102c7c3015 | ||
|
06596695a3 | ||
|
178a262032 | ||
|
4f14f0c5cc | ||
|
a736b0f96a | ||
|
41233cb475 | ||
|
5cf63d4eb6 | ||
|
cd6ec90a0f | ||
|
73988dcc7c | ||
|
33e047a442 | ||
|
24f3656632 | ||
|
a49cff34f9 | ||
|
2c001ff259 | ||
|
f370074d10 | ||
|
2113410f80 | ||
|
471a840ed9 | ||
|
7f0aec4371 | ||
|
6bd9bcba5d | ||
|
f86a967af2 | ||
|
f484aa7ebc | ||
|
8f7b70768e | ||
|
f8d8cf6d2f | ||
|
02f81094e5 | ||
|
11533fa292 | ||
|
782053e0b2 | ||
|
4e3f58f4b5 | ||
|
4c2823e814 | ||
|
4cea5d1123 | ||
|
47ddedb153 | ||
|
8505ab4579 | ||
|
de01ce6292 | ||
|
f1123ed1e7 | ||
|
a6f9d0a0e2 | ||
|
976eb23299 | ||
|
a02f3db05b | ||
|
19702d067d | ||
|
5afe4fa08b | ||
|
82bc30cc26 | ||
|
4adab15982 | ||
|
a96147a6d8 | ||
|
4e7814eeea | ||
|
a3fe8b5284 | ||
|
8b7c6952ba | ||
|
06b27acd74 | ||
|
14675578a8 | ||
|
7c5c90ebeb | ||
|
e1c890a011 | ||
|
3ce8a35567 | ||
|
a2a4aa3082 | ||
|
9070d9a844 | ||
|
85c1f7d113 | ||
|
3861c6a742 | ||
|
959332b343 | ||
|
591039439c | ||
|
dc8fe6021d | ||
|
869ec6d0dd | ||
|
a88091a4d9 | ||
|
fd149ff161 | ||
|
0d37ded0eb | ||
|
e44f60e8d8 | ||
|
02e232babf | ||
|
9e2bdaab58 | ||
|
9f34a64e63 | ||
|
eb46739ab5 | ||
|
146df3c961 | ||
|
e304b1a90e | ||
|
db0e0fc29e | ||
|
b97a58e9fa | ||
|
c86bf826e0 | ||
|
e34e0d3b10 | ||
|
5de0ee49bd | ||
|
a131bf42a6 | ||
|
6a0a0154c6 | ||
|
5fe4621eb6 | ||
|
424fcf0792 | ||
|
e7cdb69c58 | ||
|
650ddeeceb | ||
|
ecb58e4246 | ||
|
d981f6a005 | ||
|
c6ee15336f | ||
|
0e110b7823 | ||
|
aa03b6b51e | ||
|
032cfdaec3 | ||
|
d18b5a2144 | ||
|
cae8a7d28a | ||
|
8194d80831 | ||
|
bdef83449e | ||
|
c3f0509e72 | ||
|
715acf4ff5 | ||
|
db1b6872ca | ||
|
c406a6702f | ||
|
8e9020c741 | ||
|
8280197df3 | ||
|
9e6035bb1f | ||
|
323f9fc46a | ||
|
68ea86ec4f | ||
|
75e39c33fd | ||
|
8729bebe5f | ||
|
8c338156e0 | ||
|
9591e92fa1 | ||
|
6915787c80 | ||
|
2fe3adfe6e | ||
|
cbb119b0ad | ||
|
1876d1abf4 | ||
|
f8d3bea87e | ||
|
f4c2cb4795 | ||
|
ebe9a8eb3d | ||
|
1ff5d61d4f | ||
|
b5deefa088 | ||
|
e672c3521c | ||
|
54cd6f7eb3 | ||
|
172417867b | ||
|
63a9dce4d4 | ||
|
3f2f562a1e | ||
|
2d183a8e2a | ||
|
783c8e8fb7 | ||
|
f5837d068f | ||
|
53d6ae6848 | ||
|
4a77eb2a0d | ||
|
af6f9fe518 | ||
|
9e47b5a217 | ||
|
7011b893af | ||
|
f8591316fa | ||
|
2fb704a129 | ||
|
1aff4bb9b9 | ||
|
9df9233e54 | ||
|
81527d3be8 | ||
|
d771694d4b | ||
|
5e891f85a6 | ||
|
bbd8d86f87 | ||
|
390dd80e41 | ||
|
b2110d0354 | ||
|
a2e91759e0 | ||
|
d6f4ea38a2 | ||
|
76d981838d | ||
|
4cc1816b5c | ||
|
1ca7558421 | ||
|
cc0c90693d | ||
|
713c8e8cf3 | ||
|
c3e2ab3385 | ||
|
ac45061b36 | ||
|
e843aed912 | ||
|
da2315cfe7 | ||
|
760e1e6dd5 | ||
|
2b612a28f4 | ||
|
f5cf90dbc3 | ||
|
8da7734c0d | ||
|
db6305fcee | ||
|
6ceb808f93 | ||
|
2214301694 | ||
|
0b70acff08 | ||
|
0aca548e15 | ||
|
74faeaeb04 | ||
|
9b3977e30d | ||
|
a7c90b042d | ||
|
5cc53c10ee | ||
|
15f321d4e9 | ||
|
8d25fb72b1 | ||
|
fd4133485a | ||
|
12742b7815 | ||
|
63a888252f | ||
|
8039c9befa | ||
|
9db4259f18 | ||
|
21407c3394 | ||
|
b5ba3f69c7 | ||
|
00f00b508f | ||
|
64babc6387 | ||
|
3546bf9077 | ||
|
216ea46c25 | ||
|
924f2112b1 | ||
|
0c9883f5e2 | ||
|
3f5807f1fd | ||
|
03fffae585 | ||
|
e2569f6657 | ||
|
d93a2f0b17 | ||
|
b5428d5a77 | ||
|
a2cf90e3ac | ||
|
2272b75772 | ||
|
c2d2df8c42 | ||
|
a1ab1616c5 | ||
|
eb4d01a988 | ||
|
5e473aa618 | ||
|
1bf1225544 | ||
|
852d63ba6f | ||
|
ccdc1719ae | ||
|
7b836ece91 | ||
|
802463acfb | ||
|
d231606020 | ||
|
e9ade193dc | ||
|
6945ef2468 | ||
|
8cf06b2865 | ||
|
2ca2d7c80f | ||
|
7849b1440f | ||
|
9bf1fb4cea | ||
|
8e28451528 | ||
|
4aeaaa46c7 | ||
|
f5633dcc75 | ||
|
c31e48591f | ||
|
be6277c2c8 | ||
|
9eae9213c8 | ||
|
daf55037fe | ||
|
1426eccc68 | ||
|
3c7d0f86b3 | ||
|
deacb7df61 | ||
|
392746f725 | ||
|
1cff3a2cd0 | ||
|
5369953d60 | ||
|
8e90e6df58 | ||
|
a5770191bb | ||
|
9a939547c0 | ||
|
fa3d686067 | ||
|
697b92ea35 | ||
|
0cf49fbfa0 | ||
|
636898fd79 | ||
|
f43c4607f7 | ||
|
1f4d5b4361 | ||
|
6e6bb4d639 | ||
|
22f0b2c3cc | ||
|
04cff632a3 | ||
|
197a9be59c | ||
|
a9bd90f681 | ||
|
a4657d0cf1 | ||
|
fe518c9859 | ||
|
0615b367ca | ||
|
5536021e4f | ||
|
ebf24e98e3 | ||
|
f965afde16 | ||
|
b6b0583550 | ||
|
fca05c8be9 | ||
|
dc1eb02322 | ||
|
39ec4ee704 | ||
|
ad4adf90ca | ||
|
1143570f3e | ||
|
e7c61320a5 | ||
|
d525ca02b8 | ||
|
1f4f66fd28 | ||
|
1d1caaf7cb | ||
|
ea85fe20f6 | ||
|
e0821e404f | ||
|
b0689150e5 | ||
|
6413647d23 | ||
|
e22bbc97fb | ||
|
714c89cc49 | ||
|
033fd9662b | ||
|
32bbb0c231 | ||
|
08727cc322 | ||
|
4dbe8a7001 | ||
|
633e90fe16 | ||
|
daa4779978 | ||
|
b04fb3c43f | ||
|
d3978db574 | ||
|
655212ee62 | ||
|
a6a8a04b1f | ||
|
37019140bd | ||
|
31cd394cb7 | ||
|
fa41a327e7 | ||
|
a5ad82339e | ||
|
d871c6f8fd | ||
|
0ae65a5a64 | ||
|
13f422f4c4 | ||
|
179b7a5298 | ||
|
ee46bc4bd1 | ||
|
e77180547d | ||
|
f58b599020 | ||
|
332856e37e | ||
|
749f9ffae0 | ||
|
7877953b6c | ||
|
5a0c406dbf | ||
|
f9d88b15ac | ||
|
493ff43ffe | ||
|
c28349daaf | ||
|
f98445e33f | ||
|
f8a8d49be7 | ||
|
e4d5d946d2 | ||
|
bb2478f342 | ||
|
f79515fc11 | ||
|
670465dc58 | ||
|
dbb0ed6f46 | ||
|
2282aedfa6 | ||
|
2aa17fff22 | ||
|
4f7cac8178 | ||
|
5e444b2db9 | ||
|
f2f874939d | ||
|
4af6d0cdaa | ||
|
700ac4ed78 | ||
|
9c942903e9 | ||
|
6d3c53fe0f | ||
|
4b8f386c94 | ||
|
0ae9c8bc8e | ||
|
0afc503aff | ||
|
236a9a1468 | ||
|
439d3c75ab | ||
|
de8447dfc7 | ||
|
aac91b6487 | ||
|
8d54443b6a | ||
|
45191b97f8 | ||
|
abdd78e5e0 | ||
|
ed21bb3d1d | ||
|
06d2da3742 | ||
|
f448be8c2b | ||
|
ef19f1455d | ||
|
551de3fe19 | ||
|
4fdc0624a9 | ||
|
2be559d50d | ||
|
b113d189d6 | ||
|
9156ba84bd | ||
|
fa0f135c17 | ||
|
271f158f79 | ||
|
ea7a8cd565 | ||
|
214f79ebbc | ||
|
125eb70a80 | ||
|
eb05dba580 | ||
|
c1eae4a4f9 | ||
|
023512dcc3 | ||
|
192b6983ea | ||
|
6579e94305 | ||
|
0de9cf41eb | ||
|
c25053d1d2 | ||
|
483abff3b3 | ||
|
cea38f03ec | ||
|
4bc56b214b | ||
|
6b13b83231 | ||
|
9b84980a77 | ||
|
17e8558ca4 | ||
|
808ea9bb8c | ||
|
1130a40d1e | ||
|
79ff53ecdf | ||
|
4e3287842e | ||
|
d2fdfd3fe1 | ||
|
5090c8b743 | ||
|
b24b1054aa | ||
|
b3c3ecb8a5 | ||
|
37c3cd5e1c | ||
|
fecddb3ecc | ||
|
1d768e4816 | ||
|
db0b51bf76 | ||
|
013da89b27 | ||
|
7dab039099 | ||
|
ebfd715843 | ||
|
4ac5a2f331 | ||
|
049c513cce | ||
|
751fa218e5 | ||
|
4d0ca13efb | ||
|
dc6d4e0963 | ||
|
045cc293f3 | ||
|
1b1218f5fe | ||
|
3a3d9a45b6 | ||
|
71e44f7198 | ||
|
777f45a323 | ||
|
450e6a2ff2 | ||
|
f975e7d10d | ||
|
91978b2934 | ||
|
abc34c0c85 | ||
|
41d799bbdf | ||
|
6755a4d3f6 | ||
|
0139390c3e | ||
|
5855c634de | ||
|
b9a46bc4e0 | ||
|
2d5e6f4adb | ||
|
2ca681431b | ||
|
72e846ec27 | ||
|
61bbe331dd | ||
|
1c3b374d9e | ||
|
13ee304ce0 | ||
|
76af96e3ae | ||
|
7161dee1a3 | ||
|
301309f76b | ||
|
c1f28c4550 | ||
|
5a8c6350bb | ||
|
ad9e02885e | ||
|
4fbb9bc602 | ||
|
3d3ef7e587 | ||
|
0d9fefb7dd | ||
|
aaeb5f5835 | ||
|
49befe0f77 | ||
|
86a5ace57b | ||
|
28c968ad4f | ||
|
3a297d0d16 | ||
|
e46dc3a2bd | ||
|
8652b31ed1 | ||
|
c8f48407c1 | ||
|
188293b93c | ||
|
400d572c03 | ||
|
c27dac6f8e | ||
|
4b295c17e8 | ||
|
2f8e920c3e | ||
|
7e96be39b2 | ||
|
b2116d07e9 | ||
|
653d48d2c4 | ||
|
e30bde782a | ||
|
9ab5cb13e2 | ||
|
47a0bb0fde | ||
|
c925a01712 | ||
|
47ed1914cc | ||
|
b1f64f7d21 | ||
|
18b49c3778 | ||
|
25a2bab5ce | ||
|
2dbd04e3d6 | ||
|
3f9c5eba11 | ||
|
b22eb9fb06 | ||
|
35ca2ab5a6 | ||
|
435b84f96b | ||
|
17d8accd69 | ||
|
03da4d6b58 | ||
|
49cb43d6e7 | ||
|
0f3fd075c2 | ||
|
b7749dd92e | ||
|
a6d5c079d3 | ||
|
447c185079 | ||
|
67d5d8b20c | ||
|
276d9ff24f | ||
|
6d48f52d12 | ||
|
c3176b34d0 | ||
|
0ce4251ba3 | ||
|
97a6934061 | ||
|
a2c2fe09d5 | ||
|
2c55c6cea7 | ||
|
440c8b5121 | ||
|
847db9c3e3 | ||
|
ece1a612ce | ||
|
dfa7e6c0c2 | ||
|
26c05ee685 | ||
|
833f0b0823 | ||
|
0e8b870e7d | ||
|
2eb12bcd5d | ||
|
65478e754d | ||
|
74d219add4 | ||
|
b2c0ab41c0 | ||
|
a5c0091588 | ||
|
3cd6f2e581 | ||
|
ade8fe0d02 | ||
|
c53070b322 | ||
|
1c6b0679f8 | ||
|
3d5f73b8be | ||
|
2638dd1d1c | ||
|
a8f0af7925 | ||
|
fcc815512f | ||
|
6490e89256 | ||
|
4cfa6dd22c | ||
|
b9f3ac03fa | ||
|
3431f21f4d | ||
|
f63213afc3 | ||
|
046296569d | ||
|
138d6c52aa | ||
|
525e3214f2 | ||
|
35f941d6d0 | ||
|
f880e95e47 | ||
|
cc32c62964 | ||
|
495d534307 | ||
|
7894c8ad87 | ||
|
690299b39c | ||
|
bf24798ee8 | ||
|
2fa658cd57 | ||
|
7702ce96d4 | ||
|
6d04c46dc0 | ||
|
a1bc5196f2 | ||
|
5fa7648693 | ||
|
15f4d582f2 | ||
|
f638009797 | ||
|
78f7ae6b8d | ||
|
4f140abd19 | ||
|
da68635013 | ||
|
59825cb6c1 | ||
|
f61b933ed3 | ||
|
85097e119e | ||
|
24e6ab3767 | ||
|
6c8e54b31e | ||
|
416912d61b | ||
|
84695e744d | ||
|
d6822c66f9 | ||
|
4eae5f4e16 | ||
|
394501826c | ||
|
5998158ac2 | ||
|
256cdfb7af | ||
|
5d484bfa5f | ||
|
f11d7e0be8 | ||
|
8341a65a89 | ||
|
14a2285862 | ||
|
f1bd6fcf81 | ||
|
8985ad2fe4 | ||
|
e39e1e0cca | ||
|
fc93d736ee | ||
|
f278491d86 | ||
|
4d4296dac2 | ||
|
08dcf3ffff | ||
|
0368abaf29 | ||
|
d629fac2b5 | ||
|
97928611aa | ||
|
5896fb73c8 | ||
|
62f4d6f872 | ||
|
55e75529bb | ||
|
ca80915b54 | ||
|
80251f67ec | ||
|
e27f4df8e5 | ||
|
0b96d525d5 | ||
|
cbdc3b4de8 | ||
|
4787ce01f3 | ||
|
0faa6d9b1a | ||
|
8e8c34f958 | ||
|
4e6f4cb2ea | ||
|
f1a8638a34 | ||
|
3e9d3deda2 | ||
|
99a8bdcb37 | ||
|
41cde5ccf7 | ||
|
22557f3751 | ||
|
5a11d51db4 | ||
|
2b1a8762bd | ||
|
04687e03e9 | ||
|
632bd3d0ba | ||
|
7fde10fef6 | ||
|
cc9f5ff7d6 | ||
|
4ab87250b2 | ||
|
3656ea3082 | ||
|
4957311523 | ||
|
d9accd2d7a | ||
|
eae3881a03 | ||
|
2f4ea05c8a | ||
|
3ab83ba1c2 | ||
|
f67a1b95e5 | ||
|
20f29c5552 | ||
|
2bc8631db1 | ||
|
2ffec5bbcf | ||
|
9b795b3c51 | ||
|
7ce328cbb9 | ||
|
24c03f45c2 | ||
|
1b534af69d | ||
|
7ad12764fa | ||
|
37099741a1 | ||
|
b41d49c639 | ||
|
bb95574ad6 | ||
|
5bc783b381 | ||
|
29635bac52 | ||
|
0fb0a3319c | ||
|
29075a2c90 | ||
|
ea7d1afa08 | ||
|
5f42182c45 | ||
|
e989cf63c5 | ||
|
f6a750e4b3 | ||
|
06c7f7040d | ||
|
7d2970eacd | ||
|
0f2b08f238 | ||
|
e52835520c | ||
|
0d9a5349b0 | ||
|
1de46132d8 | ||
|
e28813de7f | ||
|
adada8f56e | ||
|
dcd7b95b62 | ||
|
764f0c09e1 | ||
|
be71cb487f | ||
|
3287643c24 | ||
|
c48428b678 | ||
|
7a87bfdf5e | ||
|
78ef9f2019 | ||
|
098486fbe4 | ||
|
8ad19cbf0a | ||
|
6f515a2d34 | ||
|
6392d9ab7c | ||
|
051a217670 | ||
|
0bd1f5fb59 | ||
|
184be1a794 | ||
|
c62d86e340 | ||
|
c37f8eefb7 | ||
|
3b51405cac | ||
|
b95c72eb3f | ||
|
8bf258eb75 | ||
|
59cb73d1c1 | ||
|
3cd50a6ed4 | ||
|
54c43dd6ce | ||
|
0f6fd0a5a4 | ||
|
d0b6998637 | ||
|
036fbda906 | ||
|
a75b0b7d58 | ||
|
dddcf642aa | ||
|
5e2d1cccca | ||
|
5782574711 | ||
|
5bc2d7cb83 | ||
|
f458ac1223 | ||
|
ae4e26f03b | ||
|
5eda2f692f | ||
|
a92ca7ceac | ||
|
7f423759d5 | ||
|
425057453b | ||
|
45ca64863a | ||
|
200001fdb9 | ||
|
2a24e9782c | ||
|
ea98b2cd1a | ||
|
46b6f456af | ||
|
bb030629bb | ||
|
69fa4a0064 | ||
|
60aacf6df7 | ||
|
e5ffd26fda | ||
|
ee8bee588a | ||
|
591572cfda | ||
|
62a6481d0d | ||
|
bb250dbae6 | ||
|
caaf8836a4 | ||
|
4cf360b259 | ||
|
48508c4e5c | ||
|
4a07831c1a | ||
|
c5ed394330 | ||
|
15d04c0b9b | ||
|
ebec14d2b6 | ||
|
0b14f5fbcc | ||
|
30bc88375a | ||
|
e31c45dee3 | ||
|
62c6c3cb6b | ||
|
8b699441e9 | ||
|
fc9d699fed | ||
|
491b258f70 | ||
|
b718f19d45 | ||
|
138a25c53c | ||
|
f580801a33 | ||
|
d7a06e863e | ||
|
9510c03ab3 | ||
|
d4311587c3 | ||
|
1a6f1f0cab | ||
|
bec712f3f9 | ||
|
80c26ea186 | ||
|
aa4d02fcbf | ||
|
28e87ce3d2 | ||
|
761f065d55 | ||
|
e0091261ed | ||
|
718186f165 | ||
|
a5fb07d6ac | ||
|
49836ab50a | ||
|
38be2ca932 | ||
|
6ed8b31091 | ||
|
8bcb6263f5 | ||
|
a05503e42b | ||
|
4e09f4bdf5 | ||
|
4b8da761ce | ||
|
4d3f51a720 | ||
|
264ee2b04f | ||
|
ec995b68c9 | ||
|
58bc8b7101 | ||
|
c66e9c78a0 | ||
|
a1332a442d | ||
|
4884d02481 | ||
|
fb30f64d30 | ||
|
e9cc3cb134 | ||
|
4f7793ae12 | ||
|
3579404668 | ||
|
6cfcc66cec | ||
|
2fbef62553 | ||
|
303b0552e9 | ||
|
3bb9a92ed8 | ||
|
97116a5eca | ||
|
8d807b5b0b | ||
|
92ec640db3 | ||
|
7221aab090 | ||
|
d953468bc1 | ||
|
36a459d21c | ||
|
c7657b1547 | ||
|
9432ecc40c | ||
|
c17d32d7a4 | ||
|
57774c2a79 | ||
|
e10a4d6613 | ||
|
24ac080608 | ||
|
8966462fee | ||
|
efec7ab4db | ||
|
8033c0dad4 | ||
|
d4a91fe027 | ||
|
d6b959899c | ||
|
d081a0cee3 | ||
|
251725c987 | ||
|
92866ca2fa | ||
|
8f7d3ac03b | ||
|
15ae789b89 | ||
|
c4abb0b07f | ||
|
a4a292975b | ||
|
302885d39c | ||
|
bf182e1c5d | ||
|
bd3b9c3807 | ||
|
201a7ad1d1 | ||
|
fd600b53aa | ||
|
14d3ee19d0 | ||
|
fa45fffa39 | ||
|
2ee7845e8d | ||
|
fa37adb1d5 | ||
|
a11cb93c42 | ||
|
763c836d45 | ||
|
f484653f41 | ||
|
6595b96418 | ||
|
01f830a72d | ||
|
4441911f92 | ||
|
e3550438b9 | ||
|
eb2e8d5238 | ||
|
b4717f3321 | ||
|
b720ec4c84 | ||
|
8e283f3738 | ||
|
d23729e6e1 | ||
|
2087f90cd5 | ||
|
8af9c0dc61 | ||
|
a3decd7bbe | ||
|
e55bfa0036 | ||
|
dd848acba8 | ||
|
ef7d9ccc0f | ||
|
5529127d68 | ||
|
55cbdf49aa | ||
|
4861893235 | ||
|
cb7cee6283 | ||
|
5e254d19c0 | ||
|
f70c066a8e | ||
|
6f0781b5b8 | ||
|
6ba3cd4c03 | ||
|
54cca19672 | ||
|
e0185f94f6 | ||
|
87cd9b24bb | ||
|
6d45d9591e | ||
|
782721edd4 | ||
|
046391ef25 | ||
|
eb014cce6c | ||
|
3b5b3a9ccb | ||
|
0b5a0c8e2f | ||
|
dbd583b07c | ||
|
599a93e7bc | ||
|
add157197f | ||
|
5c2051864a | ||
|
5e21095851 | ||
|
80822cdc11 | ||
|
f8f47e4791 | ||
|
88cebe3eac | ||
|
d13f2a3e71 | ||
|
8672b7bb3f | ||
|
0087e6d734 | ||
|
c448f194ae | ||
|
f9ba141a31 | ||
|
63323222fe | ||
|
b0739b8296 | ||
|
57848d7e3b | ||
|
f636089003 | ||
|
bc6a35a99c | ||
|
dfa67fb9de | ||
|
faf4928ba5 | ||
|
f219b14420 | ||
|
418a9dcccc | ||
|
d2ef54f1aa | ||
|
1f69727efc | ||
|
1d4dfe7d4c | ||
|
e9cbcd173d | ||
|
ae1162d907 | ||
|
eca6fd8864 | ||
|
5ba311b9e6 | ||
|
9d0f5197bd | ||
|
4d45c32be9 | ||
|
77fada1ca2 | ||
|
2c60bd368d | ||
|
d72d817eac | ||
|
48fb4ab56c | ||
|
5b2547a6ff | ||
|
0c0a26dea6 | ||
|
49b7b92e28 | ||
|
a7e23e46e9 | ||
|
ea0c830a62 | ||
|
03632df565 | ||
|
0094d707b9 | ||
|
7d2c6315b5 | ||
|
66a44d0739 | ||
|
05303c9e66 | ||
|
07eb28ffe8 | ||
|
b0549a894d | ||
|
859447ee69 | ||
|
14efc92e33 | ||
|
82b0460d8f | ||
|
4225e9d570 | ||
|
528a2815e4 | ||
|
cd31f9db15 | ||
|
1ebb257648 | ||
|
8316cf05ec | ||
|
76db66f70a | ||
|
c88da172d7 | ||
|
30032b70c9 | ||
|
4966b79f84 | ||
|
0f80bfad11 | ||
|
eb63b7b6a6 | ||
|
c12418e1ce | ||
|
6ad2745a5e | ||
|
1f8e32ef66 | ||
|
daae8caf20 | ||
|
c06bf1e1c4 | ||
|
3c6c5c1d81 | ||
|
2363a22e3e | ||
|
897534aec6 | ||
|
d657e2b713 | ||
|
18012de594 | ||
|
4320ae71e7 | ||
|
2dbaa2c4a6 | ||
|
1210dee374 | ||
|
33e7a45657 | ||
|
e816832994 | ||
|
f3dbcaf480 | ||
|
dc8ee0a7dd | ||
|
3ad34f31a5 | ||
|
d52196a0b1 | ||
|
3bdbef4169 | ||
|
9223601321 | ||
|
d840c57b4a | ||
|
af85131deb | ||
|
c5f3fa0778 | ||
|
b8611071c5 | ||
|
dc7f20acc8 | ||
|
a1dba884a3 | ||
|
4f7fc0382a | ||
|
27b026c5d9 | ||
|
0f695ee664 | ||
|
756caa92e4 | ||
|
8ebe43d5d4 | ||
|
dd9f5ac766 | ||
|
031e383fb5 | ||
|
3d464bc051 |
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -36,11 +36,11 @@ vpc_osx binary
|
|||||||
*.inl text
|
*.inl text
|
||||||
*.asm text
|
*.asm text
|
||||||
|
|
||||||
|
.github/CONTRIBUTING.md text
|
||||||
.gitignore text
|
.gitignore text
|
||||||
sourcesdk_def.mak text
|
sourcesdk_def.mak text
|
||||||
smdlexp.mak text
|
smdlexp.mak text
|
||||||
README text
|
README text
|
||||||
CONTRIBUTING text
|
|
||||||
LICENSE text
|
LICENSE text
|
||||||
|
|
||||||
*.exe binary
|
*.exe binary
|
||||||
|
66
.github/CONTRIBUTING.md
vendored
Normal file
66
.github/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
This file details how to contribute to the Mapbase project on GitHub:
|
||||||
|
https://github.com/mapbase-source/source-sdk-2013
|
||||||
|
|
||||||
|
For the original Source SDK 2013 contribution guidelines, click here:
|
||||||
|
https://github.com/ValveSoftware/source-sdk-2013/blob/master/CONTRIBUTING
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Mapbase is a project which many Source modders draw from, so it has its own unique standards
|
||||||
|
for contributions which differ from other projects, but it is still an open-source repository
|
||||||
|
that is always open to contributions.
|
||||||
|
|
||||||
|
Whenever you contribute to the Mapbase repository, you must keep in mind that any contributions
|
||||||
|
made could be deployed to all mods utilizing Mapbase, which can include everything from high-profile
|
||||||
|
Steam mods to amateur HL2 maps. Many contributions can also end up being available in both SP and MP
|
||||||
|
if the contributions are not obviously exclusive to one of the two.
|
||||||
|
|
||||||
|
All contributions must follow the following rules:
|
||||||
|
|
||||||
|
* A contribution must be aligned with Mapbase's goals and priorities and should not be "subjective"
|
||||||
|
or related to a specific mod or type of mod. For example, fixing an existing issue or adding a
|
||||||
|
new tool for mappers to use is usually fine, but adding a new custom weapon with its own assets
|
||||||
|
is usually not fit for Mapbase.
|
||||||
|
|
||||||
|
* All content in a contribution must be either already legally open-source or done with the
|
||||||
|
full permission of the content's original creator(s). If a license is involved, the contributor
|
||||||
|
should ensure Mapbase conforms to its terms.
|
||||||
|
* **NOTE:** Due to concerns with mods which do not wish to be open-source, content using GPL licenses (or any
|
||||||
|
license with similar open-source requirements) are currently not allowed to be distributed with Mapbase.
|
||||||
|
Contributions which can draw from them without actually distributing the licensed content may be excepted
|
||||||
|
from this rule.
|
||||||
|
|
||||||
|
* Contributions must not break existing maps/content or interfere with them in a negative or non-objective way.
|
||||||
|
|
||||||
|
* Code contributions are not obliged to follow Mapbase's preprocessor conventions (e.g. #ifdef MAPBASE),
|
||||||
|
although following them is usually acceptable.
|
||||||
|
|
||||||
|
* Code contributions which modify or add onto existing code should generally match its syntax and shouldn't
|
||||||
|
change the spacing unless necessary.
|
||||||
|
|
||||||
|
* If you are contributing a file you created yourself specifically for Mapbase, you are required to
|
||||||
|
use the custom "Mapbase - Source 2013" header used in other Mapbase files as of Mapbase v5.0.
|
||||||
|
You are encouraged to append an "Author(s)" part to that header in your file in order to clarify who wrote it.
|
||||||
|
|
||||||
|
* Do not modify the README to add attribution for your contribution. That is handled by Mapbase's maintainers.
|
||||||
|
|
||||||
|
Contributions which do not follow these guidelines cannot be accepted into Mapbase. Attempting to contribute content
|
||||||
|
which seriously violates the rules above can lead to being blocked from contributing, especially if done repeatedly.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Mapbase uses GitHub Actions to help manage issues and pull requests. Some of these workflows build the code of incoming
|
||||||
|
contributions to make sure they compile properly. The code is compiled separately for Visual Studio 2022 and GCC/G++ 9 (Linux)
|
||||||
|
and on both Debug and Release configurations.
|
||||||
|
|
||||||
|
If these workflows fail, don't freak out! Accidents can happen frequently due to compiler syntax differences and conflicts
|
||||||
|
from other contributions. You can look at a failed workflow's log by clicking "Details", which will include the build's output
|
||||||
|
in the "Build" step(s). Any errors must be resolved by you and/or by code reviewers before a pull request can be merged.
|
||||||
|
|
||||||
|
If your contribution is accepted, you may be listed in Mapbase's credits and the README's external content list:
|
||||||
|
https://github.com/mapbase-source/source-sdk-2013/wiki/Mapbase-Credits#Contributors
|
||||||
|
https://github.com/mapbase-source/source-sdk-2013/blob/master/README
|
||||||
|
|
||||||
|
You may also receive the "Contributor" or "Major Contributor" role on Mapbase's Discord server if you are
|
||||||
|
a member of it.
|
||||||
|
|
25
.github/ISSUE_TEMPLATE/bug-report---code.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug-report---code.md
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Bug report - Code
|
||||||
|
about: Create a bug report related to the source code itself. (e.g. a compile error)
|
||||||
|
title: "[CODE] "
|
||||||
|
labels: Bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Have '...' set to something
|
||||||
|
2. ???
|
||||||
|
3. See error
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context about the problem here.
|
25
.github/ISSUE_TEMPLATE/bug-report---game.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug-report---game.md
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Bug report - Game
|
||||||
|
about: Create a bug report related to game behavior.
|
||||||
|
title: "[GAME] "
|
||||||
|
labels: Bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Have '...' in the map
|
||||||
|
2. ???
|
||||||
|
3. See error
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context about the problem here.
|
25
.github/ISSUE_TEMPLATE/bug-report---misc.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug-report---misc.md
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Bug report - Miscellaneous
|
||||||
|
about: Create a bug report not related to any of the other subjects.
|
||||||
|
title: "[MISC] "
|
||||||
|
labels: Bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Do '...'
|
||||||
|
2. ???
|
||||||
|
3. See error
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context about the problem here.
|
25
.github/ISSUE_TEMPLATE/bug-report---npc.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug-report---npc.md
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Bug report - NPCs
|
||||||
|
about: Create a bug report related to NPCs.
|
||||||
|
title: "[NPCs] "
|
||||||
|
labels: Bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Have '...' do something
|
||||||
|
2. ???
|
||||||
|
3. See error
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context about the problem here.
|
25
.github/ISSUE_TEMPLATE/bug-report---tools.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug-report---tools.md
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Bug report - Tools
|
||||||
|
about: Create a bug report related to compile tools, editor stuff, etc.
|
||||||
|
title: "[TOOLS] "
|
||||||
|
labels: Bug, Tools
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Have '...' in the map
|
||||||
|
2. ???
|
||||||
|
3. See error
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context about the problem here.
|
29
.github/ISSUE_TEMPLATE/bug-report---visuals-graphics.md
vendored
Normal file
29
.github/ISSUE_TEMPLATE/bug-report---visuals-graphics.md
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
name: Bug report - Visuals/Graphics
|
||||||
|
about: Create a bug report related to visual issues. (e.g. shaders, projected textures,
|
||||||
|
etc.)
|
||||||
|
title: "[VISUAL] "
|
||||||
|
labels: Bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Have '...' in the map
|
||||||
|
2. ???
|
||||||
|
3. See error
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
### Media
|
||||||
|
Any related screenshots, videos, etc. which show the bug.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context about the problem here.
|
25
.github/ISSUE_TEMPLATE/bug-report---vscript.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/bug-report---vscript.md
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Bug report - VScript
|
||||||
|
about: Create a bug report related to VScript.
|
||||||
|
title: "[VSCRIPT] "
|
||||||
|
labels: Bug, VScript
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Have '...' in the script
|
||||||
|
2. ???
|
||||||
|
3. See error
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context about the problem here.
|
22
.github/ISSUE_TEMPLATE/feature-request---code.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature-request---code.md
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Feature request - Code
|
||||||
|
about: Suggest an idea related to the source code itself. (e.g. a new utility function)
|
||||||
|
title: "[CODE] "
|
||||||
|
labels: Enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Is your feature request related to a problem? Please describe.
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
### Describe the solution you'd like
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
### Describe alternatives you've considered
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context or screenshots about the feature request here.
|
22
.github/ISSUE_TEMPLATE/feature-request---game.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature-request---game.md
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Feature request - Game
|
||||||
|
about: Suggest an idea related to game behavior.
|
||||||
|
title: "[GAME] "
|
||||||
|
labels: Enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Is your feature request related to a problem? Please describe.
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
### Describe the solution you'd like
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
### Describe alternatives you've considered
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context or screenshots about the feature request here.
|
22
.github/ISSUE_TEMPLATE/feature-request---misc.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature-request---misc.md
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Feature request - Miscellaneous
|
||||||
|
about: Suggest an idea not related to any of the other subjects.
|
||||||
|
title: "[MISC] "
|
||||||
|
labels: Enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Is your feature request related to a problem? Please describe.
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
### Describe the solution you'd like
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
### Describe alternatives you've considered
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context or screenshots about the feature request here.
|
22
.github/ISSUE_TEMPLATE/feature-request---npc.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature-request---npc.md
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Feature request - NPCs
|
||||||
|
about: Suggest an idea related to NPCs.
|
||||||
|
title: "[NPCs] "
|
||||||
|
labels: Enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Is your feature request related to a problem? Please describe.
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
### Describe the solution you'd like
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
### Describe alternatives you've considered
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context or screenshots about the feature request here.
|
22
.github/ISSUE_TEMPLATE/feature-request---tools.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature-request---tools.md
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Feature request - Tools
|
||||||
|
about: Suggest an idea related to compile tools, editor stuff, etc.
|
||||||
|
title: "[TOOLS] "
|
||||||
|
labels: Enhancement, Tools
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Is your feature request related to a problem? Please describe.
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
### Describe the solution you'd like
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
### Describe alternatives you've considered
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context or screenshots about the feature request here.
|
23
.github/ISSUE_TEMPLATE/feature-request---visuals-graphics.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/feature-request---visuals-graphics.md
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: Feature request - Visuals/Graphics
|
||||||
|
about: Suggest an idea related to visuals or graphics. (e.g. shaders, projected textures,
|
||||||
|
etc.)
|
||||||
|
title: "[VISUAL] "
|
||||||
|
labels: Enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Is your feature request related to a problem? Please describe.
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
### Describe the solution you'd like
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
### Describe alternatives you've considered
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context or screenshots about the feature request here.
|
22
.github/ISSUE_TEMPLATE/feature-request---vscript.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature-request---vscript.md
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: Feature request - VScript
|
||||||
|
about: Suggest an idea related to VScript.
|
||||||
|
title: "[VSCRIPT] "
|
||||||
|
labels: Enhancement, VScript
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Is your feature request related to a problem? Please describe.
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
### Describe the solution you'd like
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
### Describe alternatives you've considered
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
(Optional) Add any other context or screenshots about the feature request here.
|
35
.github/labeler.yml
vendored
Normal file
35
.github/labeler.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#
|
||||||
|
# MAPBASE REPO AUTOMATION
|
||||||
|
#
|
||||||
|
# Automatically labels pull requests according to changed file paths.
|
||||||
|
# See mapbase_pr.yml for more information.
|
||||||
|
#
|
||||||
|
Repo:
|
||||||
|
- '*'
|
||||||
|
- '.github/**'
|
||||||
|
|
||||||
|
Project Generation:
|
||||||
|
- '**/src/vpc_scripts/**'
|
||||||
|
- '**/src/devtools/**'
|
||||||
|
- '**/src/create*'
|
||||||
|
|
||||||
|
Entities:
|
||||||
|
- '**/src/game/**/**logic**'
|
||||||
|
- '**/src/game/**/**point**'
|
||||||
|
|
||||||
|
Shaders:
|
||||||
|
- '**/src/materialsystem/**'
|
||||||
|
|
||||||
|
VScript:
|
||||||
|
- '**vscript**'
|
||||||
|
|
||||||
|
Tools:
|
||||||
|
- '**utils**'
|
||||||
|
|
||||||
|
NPCs:
|
||||||
|
- '**npc_**'
|
||||||
|
- '**ai_**'
|
||||||
|
|
||||||
|
VGUI:
|
||||||
|
- '**hud_**'
|
||||||
|
- '**vgui_**'
|
11
.github/pull-request-template.md
vendored
Normal file
11
.github/pull-request-template.md
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
(Describe your PR here and then fill out the checklist at the bottom)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
#### Does this PR close any issues?
|
||||||
|
* (Optional) Insert issue number(s) and any related info here
|
||||||
|
|
||||||
|
<!-- Replace [ ] with [x] for each item your PR satisfies -->
|
||||||
|
#### PR Checklist
|
||||||
|
- [ ] **My PR follows all guidelines in the CONTRIBUTING.md file**
|
||||||
|
- [ ] My PR targets a `develop` branch OR targets another branch with a specific goal in mind
|
70
.github/workflows/mapbase_build-base-dispatch.yml
vendored
Normal file
70
.github/workflows/mapbase_build-base-dispatch.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
#
|
||||||
|
# MAPBASE SOURCE 2013 CI
|
||||||
|
#
|
||||||
|
# This can be used to manually build the codebase.
|
||||||
|
#
|
||||||
|
# See mapbase_build-base.yml for more information on how this works.
|
||||||
|
|
||||||
|
name: Build Projects (Manual)
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
configuration:
|
||||||
|
description: 'Which configuration to build with'
|
||||||
|
default: 'Release'
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- Release
|
||||||
|
- Debug
|
||||||
|
branch:
|
||||||
|
description: 'Which Source 2013 engine branch to compile for'
|
||||||
|
default: 'sp'
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- sp
|
||||||
|
- mp
|
||||||
|
game:
|
||||||
|
description: 'Name of the game to build (if relevant)'
|
||||||
|
default: 'episodic'
|
||||||
|
required: false
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- episodic
|
||||||
|
- hl2
|
||||||
|
project-group:
|
||||||
|
description: 'Which group of projects to compile'
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- all
|
||||||
|
- game
|
||||||
|
- shaders
|
||||||
|
- maptools
|
||||||
|
solution-name:
|
||||||
|
description: 'Name of the solution/makefile'
|
||||||
|
required: true
|
||||||
|
type: choice
|
||||||
|
options:
|
||||||
|
- everything
|
||||||
|
- games
|
||||||
|
- shaders
|
||||||
|
- maptools
|
||||||
|
build-on-linux:
|
||||||
|
description: 'Build on Ubuntu/Linux?'
|
||||||
|
default: true
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_manual:
|
||||||
|
uses: ./.github/workflows/mapbase_build-base.yml
|
||||||
|
with:
|
||||||
|
configuration: '${{ github.event.inputs.configuration }}'
|
||||||
|
branch: '${{ github.event.inputs.branch }}'
|
||||||
|
game: '${{ github.event.inputs.game }}'
|
||||||
|
project-group: '${{ github.event.inputs.project-group }}'
|
||||||
|
solution-name: '${{ github.event.inputs.solution-name }}'
|
||||||
|
build-on-linux: "${{ github.event.inputs.build-on-linux == 'true' }}"
|
195
.github/workflows/mapbase_build-base.yml
vendored
Normal file
195
.github/workflows/mapbase_build-base.yml
vendored
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
#
|
||||||
|
# MAPBASE SOURCE 2013 CI
|
||||||
|
#
|
||||||
|
# This workflow script automatically builds the Source SDK 2013 codebase on Windows and Linux using GitHub Actions.
|
||||||
|
#
|
||||||
|
# This is useful in a number of ways:
|
||||||
|
#
|
||||||
|
# 1. It ensures pull requests compile correctly on multiple platforms and provides binaries that can be used to test them.
|
||||||
|
# 2. It can be used to compile code for releases without having to pull and prepare a local development environment.
|
||||||
|
# 3. It opens potential for scripts that can employ more principles of CI/CD. (e.g. automatically publishing a release)
|
||||||
|
#
|
||||||
|
# This is based on a workflow originally created by z33ky.
|
||||||
|
|
||||||
|
name: Build Projects
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
configuration:
|
||||||
|
description: 'Which configuration to build with'
|
||||||
|
default: 'Release'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
branch:
|
||||||
|
description: 'Which Source 2013 engine branch to compile for'
|
||||||
|
default: 'sp'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
game:
|
||||||
|
description: 'The name of the game to build (if relevant)'
|
||||||
|
default: 'episodic'
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
project-group:
|
||||||
|
description: 'Which group of projects to compile'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
solution-name:
|
||||||
|
description: 'The name of the solution/makefile'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
build-on-linux:
|
||||||
|
description: 'Build on Ubuntu/Linux?'
|
||||||
|
default: true
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build_windows:
|
||||||
|
name: Windows (VS2022)
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Add MSBuild to PATH
|
||||||
|
uses: compnerd/gha-setup-vsdevenv@v6
|
||||||
|
|
||||||
|
- name: Enable VS2022
|
||||||
|
working-directory: '${{inputs.branch}}/src/vpc_scripts'
|
||||||
|
shell: bash
|
||||||
|
run: sed -i 's/^\($Conditional[ ]\+VS2022[ ]\+\).*/\1"1"/' newer_vs_toolsets.vpc
|
||||||
|
|
||||||
|
- name: Pick game
|
||||||
|
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
|
||||||
|
working-directory: '${{inputs.branch}}/src'
|
||||||
|
shell: bash
|
||||||
|
run: sed -i 's/\/hl2 \/episodic/\/${{inputs.game}}/' create${{inputs.project-group}}projects.bat
|
||||||
|
|
||||||
|
- name: Create project files
|
||||||
|
working-directory: '${{inputs.branch}}/src'
|
||||||
|
shell: cmd
|
||||||
|
# https://github.com/ValveSoftware/source-sdk-2013/issues/72
|
||||||
|
run: |
|
||||||
|
reg add "HKLM\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\Projects\{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}" /v DefaultProjectExtension /t REG_SZ /d vcproj /f
|
||||||
|
create${{inputs.project-group}}projects.bat
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
#if: steps.filter.outputs.game == 'true'
|
||||||
|
working-directory: '${{inputs.branch}}/src'
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
devenv ${{inputs.solution-name}}.sln /upgrade
|
||||||
|
msbuild -m -t:Rebuild -p:Configuration=${{inputs.configuration}};Platform=x86 ${{inputs.solution-name}}.sln
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
|
- name: Publish game binaries
|
||||||
|
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: '${{inputs.project-group}}_${{inputs.game}}_win32_${{ inputs.configuration }}'
|
||||||
|
path: |
|
||||||
|
${{inputs.branch}}/game/mod_${{inputs.game}}/bin/*.dll
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Publish map tools
|
||||||
|
if: inputs.project-group == 'maptools'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: '${{inputs.project-group}}_win32_${{ inputs.configuration }}'
|
||||||
|
path: |
|
||||||
|
${{inputs.branch}}/game/bin/*.exe
|
||||||
|
${{inputs.branch}}/game/bin/*.dll
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
- name: Publish everything
|
||||||
|
if: inputs.project-group == 'all'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'everything_win32_${{ inputs.configuration }}'
|
||||||
|
path: |
|
||||||
|
${{inputs.branch}}/game/bin
|
||||||
|
${{inputs.branch}}/game/mod_*/bin
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
build_ubuntu:
|
||||||
|
if: inputs.build-on-linux == true && inputs.project-group != 'maptools' # No Linux map tools for now
|
||||||
|
name: Ubuntu (GCC/G++)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
config: ${{ inputs.configuration }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install GCC/G++ multilib
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-multilib g++-multilib
|
||||||
|
|
||||||
|
- name: Pick game
|
||||||
|
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
|
||||||
|
working-directory: '${{inputs.branch}}/src'
|
||||||
|
shell: bash
|
||||||
|
run: sed -i 's/\/hl2 \/episodic/\/${{inputs.game}}/' create${{inputs.project-group}}projects
|
||||||
|
|
||||||
|
- name: Set configuration
|
||||||
|
working-directory: '${{inputs.branch}}/src'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
config=${{inputs.configuration}}
|
||||||
|
export CFG=${config,,}
|
||||||
|
echo "config=${CFG}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Create project files
|
||||||
|
working-directory: '${{inputs.branch}}/src'
|
||||||
|
run: ./create${{inputs.project-group}}projects
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
working-directory: '${{inputs.branch}}/src'
|
||||||
|
run: make CFG=${{env.config}} -f ${{inputs.solution-name}}.mak
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
|
- name: Publish game binaries
|
||||||
|
if: inputs.project-group == 'game' || inputs.project-group == 'shaders'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: '${{inputs.project-group}}_${{inputs.game}}_linux32_${{ inputs.configuration }}'
|
||||||
|
path: |
|
||||||
|
${{inputs.branch}}/game/mod_${{inputs.game}}/bin/*.so
|
||||||
|
!${{inputs.branch}}/game/mod_${{inputs.game}}/bin/*_srv.so
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
#- name: Publish map tools
|
||||||
|
# if: inputs.project-group == 'maptools'
|
||||||
|
# uses: actions/upload-artifact@v4
|
||||||
|
# with:
|
||||||
|
# name: '${{inputs.project-group}}_linux32_${{ inputs.configuration }}'
|
||||||
|
# path: |
|
||||||
|
# ${{inputs.branch}}/game/bin/vbsp
|
||||||
|
# ${{inputs.branch}}/game/bin/vvis
|
||||||
|
# ${{inputs.branch}}/game/bin/vvis_dll.so
|
||||||
|
# ${{inputs.branch}}/game/bin/vrad
|
||||||
|
# ${{inputs.branch}}/game/bin/vrad_dll.so
|
||||||
|
# if-no-files-found: error
|
||||||
|
|
||||||
|
# For now, don't publish the .dbg files even though we publish .pdb files on Windows
|
||||||
|
# (they're too big)
|
||||||
|
- name: Publish everything
|
||||||
|
if: inputs.project-group == 'all'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'everything_linux32_${{ inputs.configuration }}'
|
||||||
|
path: |
|
||||||
|
${{inputs.branch}}/game/bin/*.so
|
||||||
|
!${{inputs.branch}}/game/bin/*_srv.so
|
||||||
|
${{inputs.branch}}/game/mod_*/bin/*.so
|
||||||
|
!${{inputs.branch}}/game/mod_*/bin/*_srv.so
|
||||||
|
if-no-files-found: error
|
31
.github/workflows/mapbase_build-master.yml
vendored
Normal file
31
.github/workflows/mapbase_build-master.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#
|
||||||
|
# MAPBASE SOURCE 2013 CI
|
||||||
|
#
|
||||||
|
# Builds all projects when a pull request to the master branch is opened.
|
||||||
|
# If you're using a fork of Mapbase, feel free to configure this to meet your repository's needs.
|
||||||
|
#
|
||||||
|
# The "mapbase_build-sp" set of workflows can build specific projects depending on what files are changed.
|
||||||
|
# They are designed around a "develop" branch, but can be configured to target "master" and replace this
|
||||||
|
# instead (or target a similar branch with a different name)
|
||||||
|
#
|
||||||
|
# See mapbase_build-base.yml for more information on how this works.
|
||||||
|
|
||||||
|
name: Build All Projects #(SP Release)
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
everything:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
configuration: [Release, Debug]
|
||||||
|
uses: ./.github/workflows/mapbase_build-base.yml
|
||||||
|
with:
|
||||||
|
configuration: ${{ matrix.configuration }}
|
||||||
|
branch: 'sp'
|
||||||
|
project-group: 'all'
|
||||||
|
solution-name: 'everything'
|
||||||
|
build-on-linux: true # Disable this if you don't want to compile for Linux
|
38
.github/workflows/mapbase_build-sp-games.yml
vendored
Normal file
38
.github/workflows/mapbase_build-sp-games.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#
|
||||||
|
# MAPBASE SOURCE 2013 CI
|
||||||
|
#
|
||||||
|
# Builds game projects every time a pull request which modifies the game code is opened.
|
||||||
|
# If you're using a fork of Mapbase, feel free to configure this to meet your repository's needs.
|
||||||
|
#
|
||||||
|
# See mapbase_build-base.yml for more information on how this works.
|
||||||
|
|
||||||
|
name: Build Game Projects #(SP Release)
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/mapbase_build-base.yml'
|
||||||
|
- '.github/workflows/mapbase_build-sp-rel-games.yml'
|
||||||
|
- 'sp/src/vpc_scripts/**'
|
||||||
|
- 'sp/src/game/**'
|
||||||
|
- 'sp/src/mathlib/**'
|
||||||
|
- 'sp/src/responserules/runtime/**'
|
||||||
|
- 'sp/src/tier1/**'
|
||||||
|
- 'sp/src/vgui2/vgui_controls/**'
|
||||||
|
- 'sp/src/vscript/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
games:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
configuration: [Release, Debug]
|
||||||
|
uses: ./.github/workflows/mapbase_build-base.yml
|
||||||
|
with:
|
||||||
|
configuration: ${{ matrix.configuration }}
|
||||||
|
branch: 'sp'
|
||||||
|
game: 'episodic' # Change this if your mod is not using HL2/Episodic game projects
|
||||||
|
project-group: 'game'
|
||||||
|
solution-name: 'games'
|
||||||
|
build-on-linux: true # Disable this if you don't want to compile for Linux
|
38
.github/workflows/mapbase_build-sp-maptools.yml
vendored
Normal file
38
.github/workflows/mapbase_build-sp-maptools.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#
|
||||||
|
# MAPBASE SOURCE 2013 CI
|
||||||
|
#
|
||||||
|
# Builds map tool projects every time a pull request which modifies the map tool code is opened.
|
||||||
|
# If you're using a fork of Mapbase, feel free to configure this to meet your repository's needs.
|
||||||
|
#
|
||||||
|
# See mapbase_build-base.yml for more information on how this works.
|
||||||
|
|
||||||
|
name: Build Map Tool Projects #(SP Release)
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/mapbase_build-sp-rel-maptools.yml'
|
||||||
|
- 'sp/src/vpc_scripts/**'
|
||||||
|
- 'sp/src/utils/vbsp/**'
|
||||||
|
- 'sp/src/utils/vvis/**'
|
||||||
|
- 'sp/src/utils/vvis_launcher/**'
|
||||||
|
- 'sp/src/utils/vrad/**'
|
||||||
|
- 'sp/src/utils/vrad_launcher/**'
|
||||||
|
- 'sp/src/mathlib/**'
|
||||||
|
- 'sp/src/tier1/**'
|
||||||
|
- 'sp/src/vgui2/vgui_controls/**'
|
||||||
|
- 'sp/src/vscript/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
maptools:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
configuration: [Release, Debug]
|
||||||
|
uses: ./.github/workflows/mapbase_build-base.yml
|
||||||
|
with:
|
||||||
|
configuration: ${{ matrix.configuration }}
|
||||||
|
branch: 'sp'
|
||||||
|
project-group: 'maptools'
|
||||||
|
solution-name: 'maptools'
|
33
.github/workflows/mapbase_build-sp-shaders.yml
vendored
Normal file
33
.github/workflows/mapbase_build-sp-shaders.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#
|
||||||
|
# MAPBASE SOURCE 2013 CI
|
||||||
|
#
|
||||||
|
# Builds shader projects every time a pull request which modifies the shader code is opened.
|
||||||
|
# If you're using a fork of Mapbase, feel free to configure this to meet your repository's needs.
|
||||||
|
#
|
||||||
|
# See mapbase_build-base.yml for more information on how this works.
|
||||||
|
|
||||||
|
name: Build Shader Projects #(SP Release)
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/mapbase_build-sp-rel-shaders.yml'
|
||||||
|
- 'sp/src/vpc_scripts/**'
|
||||||
|
- 'sp/src/materialsystem/**'
|
||||||
|
- 'sp/src/mathlib/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
shaders:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
configuration: [Release, Debug]
|
||||||
|
uses: ./.github/workflows/mapbase_build-base.yml
|
||||||
|
with:
|
||||||
|
configuration: ${{ matrix.configuration }}
|
||||||
|
branch: 'sp'
|
||||||
|
game: 'episodic' # Change this if your mod is not using HL2/Episodic game projects
|
||||||
|
project-group: 'shaders'
|
||||||
|
solution-name: 'shaders'
|
||||||
|
build-on-linux: true # Disable this if you don't want to compile for Linux
|
23
.github/workflows/mapbase_pr.yml
vendored
Normal file
23
.github/workflows/mapbase_pr.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#
|
||||||
|
# MAPBASE REPO AUTOMATION
|
||||||
|
#
|
||||||
|
# Automatically labels pull requests according to changed file paths.
|
||||||
|
#
|
||||||
|
# https://github.com/actions/labeler
|
||||||
|
|
||||||
|
name: Pull Request Automation
|
||||||
|
on: [pull_request] # pull_request_target
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
label:
|
||||||
|
|
||||||
|
if: github.repository_owner == 'mapbase-source' # ${{ vars.MAPBASE_LABELS == 'true' }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/labeler@v4
|
||||||
|
with:
|
||||||
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
33
.gitignore
vendored
33
.gitignore
vendored
@ -26,6 +26,7 @@ ipch
|
|||||||
*.xcodeproj/
|
*.xcodeproj/
|
||||||
obj*/
|
obj*/
|
||||||
!devtools/*.mak
|
!devtools/*.mak
|
||||||
|
sp/src/devtools/makefile_base_posix.mak.link
|
||||||
!utils/smdlexp/smdlexp.mak
|
!utils/smdlexp/smdlexp.mak
|
||||||
|
|
||||||
# Specific Source build products
|
# Specific Source build products
|
||||||
@ -53,8 +54,40 @@ config.cfg
|
|||||||
|
|
||||||
# shader files
|
# shader files
|
||||||
*.tmp
|
*.tmp
|
||||||
|
*.vcs
|
||||||
|
|
||||||
|
# Unnecessary files
|
||||||
*.lib
|
*.lib
|
||||||
*.filters
|
*.filters
|
||||||
*.vpc_crc
|
*.vpc_crc
|
||||||
*.sentinel
|
*.sentinel
|
||||||
|
|
||||||
|
# Backup files
|
||||||
|
*.bak
|
||||||
|
|
||||||
|
# Build folders
|
||||||
|
sp/src/.vs/
|
||||||
|
sp/src/game/client/Debug_mod_episodic/
|
||||||
|
sp/src/game/client/Debug_mod_hl2/
|
||||||
|
sp/src/game/client/Release_mod_episodic/
|
||||||
|
sp/src/game/client/Release_mod_hl2/
|
||||||
|
sp/src/game/server/Debug_mod_episodic/
|
||||||
|
sp/src/game/server/Debug_mod_hl2/
|
||||||
|
sp/src/game/server/Release_mod_episodic/
|
||||||
|
sp/src/game/server/Release_mod_hl2/
|
||||||
|
sp/src/*/Debug/
|
||||||
|
sp/src/*/Release/
|
||||||
|
sp/game/*.dll
|
||||||
|
sp/game/*.pdb
|
||||||
|
sp/game/*.exe
|
||||||
|
sp/src/utils/*.dll
|
||||||
|
sp/src/utils/*.pdb
|
||||||
|
sp/src/utils/*.exe
|
||||||
|
sp/src/utils/*.res
|
||||||
|
sp/src/materialsystem/*.dll
|
||||||
|
sp/src/materialsystem/*.pdb
|
||||||
|
sp/src/vgui2/*.dll
|
||||||
|
sp/src/vgui2/*.pdb
|
||||||
|
|
||||||
|
# Build support files
|
||||||
|
sp/src/devtools/gcc9+support.o
|
||||||
|
39
CONTRIBUTING
39
CONTRIBUTING
@ -1,39 +0,0 @@
|
|||||||
Thanks for your interest in the Source SDK 2013 project. When you make a
|
|
||||||
contribution to the project (e.g. create an Issue or submit a Pull Request)
|
|
||||||
(a "Contribution"), Valve wants to be able to use your Contribution to improve
|
|
||||||
the SDK and other Valve products.
|
|
||||||
|
|
||||||
As a condition of providing a Contribution, you agree that:
|
|
||||||
- You grant Valve a non-exclusive, irrevocable, royalty-free, worldwide license
|
|
||||||
to make, use, sell, reproduce, modify, distribute (directly and indirectly),
|
|
||||||
and publicly display and perform the Contribution, and any derivative works
|
|
||||||
that Valve may make from the Contribution, under any intellectual property you
|
|
||||||
own or have the right to license.
|
|
||||||
- You warrant and represent that the Contribution is your original creation,
|
|
||||||
that you have the authority to grant this license to Valve, and that this
|
|
||||||
license does not require the permission of any third party. Otherwise, you
|
|
||||||
provide your Contribution "as is" without warranties.
|
|
||||||
|
|
||||||
Should you wish to submit a suggestion or work that is not your original
|
|
||||||
creation, you may submit it to Valve separate from any Contribution,
|
|
||||||
explicitly identifying it as sourced from a third party, stating the details
|
|
||||||
of its origin, and informing Valve of any license or other restriction of
|
|
||||||
which you are personally aware.
|
|
||||||
|
|
||||||
|
|
||||||
Valve is happy to accept pull requests and issues in the source-sdk-2013
|
|
||||||
repository in these cases:
|
|
||||||
* Changes that fix bugs in the SDK deployment process itself. The repository
|
|
||||||
should build out of the box, and anything that prevents that is a pull
|
|
||||||
request we want.
|
|
||||||
* High priority bugs in HL2, the Episodes, or HL2MP that can be fixed in
|
|
||||||
client.dll or server.dll.
|
|
||||||
|
|
||||||
For other changes we suggest that you issue a pull request to one of these
|
|
||||||
fine community-maintained repositories instead:
|
|
||||||
https://developer.valvesoftware.com/wiki/Source-sdk-2013-community-repos
|
|
||||||
|
|
||||||
If you are going to make a pull request, please keep them as granular as
|
|
||||||
possible. Pull requests with 3-4 unrelated changes in them aren't going to
|
|
||||||
be accepted.
|
|
||||||
|
|
227
README
227
README
@ -1,3 +1,230 @@
|
|||||||
|
//=========================================================================================================================
|
||||||
|
|
||||||
|
Mapbase v7.3 - Source 2013
|
||||||
|
https://github.com/mapbase-source/source-sdk-2013
|
||||||
|
https://www.moddb.com/mods/mapbase
|
||||||
|
|
||||||
|
//=========================================================================================================================
|
||||||
|
|
||||||
|
This repository contains code from Mapbase, a modification of the Source 2013 SDK which serves as a combined package
|
||||||
|
of general-purpose improvements, fixes, and utility features for mods.
|
||||||
|
|
||||||
|
Mapbase's main content in this repository may include:
|
||||||
|
|
||||||
|
- 80+ custom entities (new logic entities, filters, etc.)
|
||||||
|
- Hundreds of Inputs/Outputs/KeyValues additions and modifications
|
||||||
|
- Custom SDK_ shaders with improvements adapted from Alien Swarm SDK code, including projected texture fixes and radial fog
|
||||||
|
- Custom VScript implementation based on public Squirrel API and Alien Swarm SDK interfaces/descriptions
|
||||||
|
- Additional gameplay control for Half-Life 2 mods, including grenade features for more NPCs and singleplayer respawning
|
||||||
|
- More map-specific capabilities for maps unable to branch into their own mods, e.g. MP mods or map compilations
|
||||||
|
- View rendering changes for drawing 3D skyboxes and RT-based entities
|
||||||
|
- Countless other fixes and improvements
|
||||||
|
|
||||||
|
For more information, view this page:
|
||||||
|
https://github.com/mapbase-source/source-sdk-2013/wiki/Introduction-to-Mapbase
|
||||||
|
|
||||||
|
//=========================================================================================================================
|
||||||
|
|
||||||
|
Mapbase is an open-source project and its contents can be distributed and used at the discretion of its users. However, this project contains content from
|
||||||
|
a vast number of different sources which have their own licensing or attribution requirements. We try to handle most of that ourselves, but users who plan on
|
||||||
|
distributing Mapbase content are expected to comply with certain rules.
|
||||||
|
|
||||||
|
Up-to-date information about Mapbase content usage and credit are addressed in this article on Mapbase's wiki:
|
||||||
|
https://github.com/mapbase-source/source-sdk-2013/wiki/Using-Mapbase-Content
|
||||||
|
|
||||||
|
//=========================================================================================================================
|
||||||
|
|
||||||
|
>>>>>>>> EXTERNAL CONTENT USED IN MAPBASE <<<<<<<<
|
||||||
|
|
||||||
|
The Mapbase project is a combination of original code from its creators, code contributed by other Source modders, and code borrowed from open-source articles
|
||||||
|
and repositories (especially ones which are specifically published as free source code). One of Mapbase's goals is to make the most popular fixes and the most obscure
|
||||||
|
or complicated code changes accessible and easy to use for level designers and other kinds of Source modders who would otherwise have no idea how to implement them.
|
||||||
|
|
||||||
|
*** DISCLAIMER: Mapbase has a strict no-leak-content policy and only allows content created directly by contributors or content originating from open-source repositories.
|
||||||
|
If you believe any content in Mapbase originates from any leak or unauthorized source (Valve or otherwise), please contact Blixibon immediately.
|
||||||
|
Mapbase is intended to be usable by everyone, including licensed Source projects and Steam mods. ***
|
||||||
|
|
||||||
|
Mapbase uses content from the following non-Source SDK 2013 Valve games or SDKs:
|
||||||
|
|
||||||
|
-- Alien Swarm SDK (Used to backport features and code from newer branches of Source into a Source 2013/Half-Life 2 environment)
|
||||||
|
-- Source SDK 2007 Code (Used to implement some of Tony Sergi's code changes)
|
||||||
|
|
||||||
|
-- Alien Swarm (Used to port assets from the aforementioned SDK code features, e.g. game instructor icons)
|
||||||
|
-- Left 4 Dead (Used to port certain animations as well as assets from the aforementioned SDK code features, e.g. particle rain)
|
||||||
|
-- Half-Life: Source (Used to port friction tool textures)
|
||||||
|
|
||||||
|
Valve allows assets from these titles to be distributed for modding purposes. Note that ported assets are only used in the release build, not the code repository.
|
||||||
|
|
||||||
|
Mapbase may also contain new third-party software distributed under specific licensing. Please see the bottom of thirdpartylegalnotices.txt for more information.
|
||||||
|
|
||||||
|
Here's a list of Mapbase's other external code sources:
|
||||||
|
|
||||||
|
- https://github.com/95Navigator/insolence-2013 (Initial custom shader code and projected texture improvements; also used to implement ASW SDK particle precipitation code)
|
||||||
|
-- https://github.com/Biohazard90/g-string_2013 (Custom shadow filters, included indirectly via Insolence repo)
|
||||||
|
-- https://github.com/KyleGospo/City-17-Episode-One-Source (Brush phong and projected texture changes, included indirectly via Insolence repo)
|
||||||
|
- https://github.com/DownFall-Team/DownFall (Multiple skybox code and fix for ent_fire delay not using floats; Also used as a guide to port certain Alien Swarm SDK changes to Source 2013,
|
||||||
|
including radial fog, rope code, and treesway)
|
||||||
|
- https://github.com/momentum-mod/game (Used as a guide to port postprocess_controller and env_dof_controller to Source 2013 from the Alien Swarm SDK)
|
||||||
|
- https://github.com/DeathByNukes/source-sdk-2013 (VBSP manifest fixes)
|
||||||
|
- https://github.com/entropy-zero/source-sdk-2013 (skill_changed game event)
|
||||||
|
- https://github.com/Nbc66/source-sdk-2013-ce/tree/v142 (Base for VS2019 toolset support)
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Valve Developer Community (VDC) sources:
|
||||||
|
|
||||||
|
- https://developer.valvesoftware.com/wiki/Dynamic_RTT_shadow_angles_in_Source_2007 (Dynamic RTT shadow angles by Saul Rennison)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Parallax_Corrected_Cubemaps (Parallax corrected cubemaps implementation from Brian Charles)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Adding_the_Game_Instructor (ASW SDK game instructor adapted to Source 2013 by Kolesias123; was implemented based on a translated article)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Brush_ladders (Functional func_ladders in Source 2013)
|
||||||
|
- https://developer.valvesoftware.com/wiki/CAreaPortalOneWay (func_areaportal_oneway)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Implementing_Discord_RPC (Discord RPC implementation; Mapbase has its own framework originally based on this article)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Rain_splashes (NOTE: This code is not completely used in Mapbase, but may still exist in its codebase)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Hand_Viewmodels (NOTE: This code is not completely supported by default because Mapbase does not yet have weapon viewmodels which support
|
||||||
|
interchangeable arms; this may change in the future)
|
||||||
|
|
||||||
|
- https://developer.valvesoftware.com/wiki/General_SDK_Snippets_%26_Fixes (Various snippets on the article, including the dropship gun fix)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Memory_Leak_Fixes (Most of these snippets were applied in later SDK updates, but some were not and have been added to Mapbase)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Env_projectedtexture/fixes (Misc. env_projectedtexture fixes; Some of these are superceded by Alien Swarm-based changes and not used)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Scenes.image (Original raw VCD file support; Code was improved for Mapbase and the article was later updated with it)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Extending_Prop_Sphere (prop_sphere customization)
|
||||||
|
- https://developer.valvesoftware.com/wiki/TF2_Glow_Effect_(2013_SDK) (Glow effect)
|
||||||
|
- https://developer.valvesoftware.com/wiki/CFuncMoveLinear_ParentingFix (func_movelinear parenting fix; Code was improved for Mapbase and the article was later updated with it)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Viewmodel_Prediction_Fix (Viewmodel prediction fix)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Owner#Collisions_with_owner (FSOLID_COLLIDE_WITH_OWNER flag)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Npc_clawscanner#Strider_Scout_Issue (npc_clawscanner strider scout fix)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Ambient_generic:_stop_and_toggle_fix (Fixes for stopping/toggling ambient_generic)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Func_clip_vphysics ("Start Disabled" keyvalue fix)
|
||||||
|
- https://developer.valvesoftware.com/wiki/Importing_CSS_Weapons_Into_HL2 (CS:S viewmodel chirality)
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Direct contributions:
|
||||||
|
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/3 ("playvideo" command playback fix from Avanate)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/5 (Custom VScript implementation by ReDucTor; was placed into feature branch before being merged in a subsequent PR)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/60 (Adjustment by RoyaleNoir to one of Saul's VDC changes)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/84 (CS:S viewmodel chirality from 1upD)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/116 (vgui_movie_display mute keyvalue from Alivebyte/rzkid)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/140 (logic_substring entity and icon created by moofemp)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/143 (Propper features for VBSP from Matty-64)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/174 (Fix for multiply defined symbols in later toolsets from und)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/issues/201 (env_projectedtexture shadow filter keyvalue from celisej567)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/193 (RTB:R info_particle_system_coordinate by arbabf and Iridium77)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/193 (Infinite prop_interactable cooldown by arbabf)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/229 (Extended point_bugbait functionality by arbabf)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/236 (Toggleable prop sprinting by Crimson-X1)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/237 (Commander goal trace fix by Agrimar)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/245 (ViewPunch random fix by Mr0maks)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/248 (soundlevel_t conversation warning fix by Mechami)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/266 ("OnPhysGunPull" output in CPhysicsProp by rlenhub)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/292 (env_headcrabcanister random spawn type by arbabf)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/294 (SDK_LightmappedGeneric editor blend swap fix by azzyr)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/308 (BlurFilterY fix by Wikot235)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/312 (Zombie improvements by Wikot235)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/315 (env_flare crash fix by Wikot235)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/324 (server-only info/func_null by SirYodaJedi)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/333 (Cvar to transition levels while in MOVETYPE_NOCLIP by Wikot235)
|
||||||
|
- https://github.com/mapbase-source/source-sdk-2013/pull/342 (NaN particle cull radius fix by celisej567)
|
||||||
|
- https://github.com/mapbase-source/mapbase-game-src/pull/1 (Advanced video options duplicate field name fix by arbabf; This is asset-based and not reflected in the code)
|
||||||
|
- https://github.com/mapbase-source/mapbase-game-src/pull/2 (gameinfo.txt typo fix by CarePackage17; This is asset-based and not reflected in the code)
|
||||||
|
- https://github.com/mapbase-source/mapbase-game-src/pull/3 (HudMessage cutoff fix by arbabf; This is asset-based and not reflected in the code)
|
||||||
|
- Demo autorecord code provided by Klems
|
||||||
|
- cc_emit crash fix provided by 1upD
|
||||||
|
- Custom HL2 ammo crate models created by Rykah (Textures created by Blixibon; This is asset-based and, aside from the SLAM crate, not reflected in the code)
|
||||||
|
- Combine lock hardware on door01_left.mdl created by Kralich (This is asset-based and not reflected in the code)
|
||||||
|
- npc_vehicledriver fixes provided by CrAzY
|
||||||
|
- npc_combine cover behavior patches provided by iohnnyboy
|
||||||
|
- logic_playmovie icon created by URAKOLOUY5 (This is asset-based and not reflected in the code)
|
||||||
|
- Dropship APC save/load fix provided by Cvoxulary
|
||||||
|
|
||||||
|
== Contributions from samisalreadytaken:
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/47 (VScript utility/consistency changes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/59 (New VScript functions and singletons based on API documentation in later Source/Source 2 games)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/80 (More VScript changes, including support for extremely flexible client/server messaging)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/105 (VScript fixes and optimizations, Vector class extensions, custom convars/commands)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/114 (VScript fixes and extensions)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/122 (Minor VScript-related adjustments)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/148 (Minor fixup)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/167 (Security fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/168 (Squirrel update)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/169 (VScript VGUI)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/171 (VScript documentation sorting)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/173 (VScript fixes and optimizations)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/192 (VScript hook manager and fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/206 (Fix CScriptNetMsgHelper::WriteEntity())
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/213 (VScript HUD visibility control, optimizations for 3D skybox angles/fake worldportals)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/229 (VScript VGUI HUD viewport parenting, game_text and vgui_text_display VScript font fallback)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/260 (CScriptNetPropManager rewrite)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/261 (Misc VScript additions)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/279 (weapon_custom_scripted fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/332 (Fix OOB access)
|
||||||
|
|
||||||
|
== Contributions from z33ky:
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/21 (Various GCC/Linux compilation fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/95 (Additional GCC/Linux compilation fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/117 (Additional GCC/Linux compilation fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/124 (Memory error fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/130 (Memory error fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/131 (env_projectedtexture target shadows fix)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/132 (Console error fix)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/152 (Additional GCC/Linux compilation fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/159 (Additional GCC/Linux compilation fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/162 (VS2019 exception specification fix)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/170 (HL2 non-Episodic build fix)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/322 (Small Mapbase fixes)
|
||||||
|
|
||||||
|
== Contributions from Petercov:
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/182 (NPCs load dynamic interactions from all animation MDLs)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/184 (Projected texture horizontal FOV shadow fix)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/185 (Fix enemyfinders becoming visible when they wake)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/186 (Fix for brightly glowing teeth)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/183 (Enhanced custom weapons support)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/230 (Caption fixes)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/231 (Sentence source bug fix)
|
||||||
|
=-- https://github.com/mapbase-source/source-sdk-2013/pull/264 (Outputs for vgui_screen)
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Other sources:
|
||||||
|
|
||||||
|
- Various code from Source SDK 2013 pull requests on the GitHub repository (https://github.com/ValveSoftware/source-sdk-2013/pulls):
|
||||||
|
-- https://github.com/ValveSoftware/source-sdk-2013/pull/441 (Smooth scrape sound oversight fix)
|
||||||
|
-- https://github.com/ValveSoftware/source-sdk-2013/pull/436 (VRAD debug counter fix + thread bump)
|
||||||
|
-- https://github.com/ValveSoftware/source-sdk-2013/pull/416 (Ragdoll null pointer dereference fix)
|
||||||
|
-- https://github.com/ValveSoftware/source-sdk-2013/pull/401 (func_rot_button "Starts locked" flag fix)
|
||||||
|
-- https://github.com/ValveSoftware/source-sdk-2013/pull/391 (VBSP func_detail smoothing group fix)
|
||||||
|
-- https://github.com/ValveSoftware/source-sdk-2013/pull/362 (npc_manhack npc_maker fix; Adjusted for formatting and save/restore in Mapbase)
|
||||||
|
-- https://github.com/Petercov/Source-PlusPlus/commit/ecdf50c48cd31dec4dbdb7fea2d0780e7f0dd8ec (used as a guide for porting the Alien Swarm SDK response system)
|
||||||
|
- https://github.com/momentum-mod/game/blob/1d066180b3bf74830c51e6914d46c40b0bea1fc2/mp/src/game/server/player.cpp#L6543 (spec_goto fix)
|
||||||
|
- Poison zombie barnacle crash fix implemented based on a snippet from HL2: Plus posted by Agent Agrimar on Discord (Mapbase makes the barnacle recognize it as poison just like poison headcrabs)
|
||||||
|
- https://gamebanana.com/skins/172192 (Airboat handling fix; This is asset-based and not reflected in the code)
|
||||||
|
- Vortigaunt LOS fix originally created by dky.tehkingd.u for HL2:CE
|
||||||
|
- https://combineoverwiki.net/wiki/File:Combine_main_symbol.svg ("icon_combine" instructor icon in "materials/vgui/hud/gameinstructor_hl2_1"; This is asset-based and not reflected in the code)
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
If there is anything missing from this list, please contact Blixibon.
|
||||||
|
|
||||||
|
//=========================================================================================================================
|
||||||
|
|
||||||
|
Aside from the content list above, Mapbase has more descriptive and up-to-date credits on this wiki article:
|
||||||
|
https://github.com/mapbase-source/source-sdk-2013/wiki/Mapbase-Credits
|
||||||
|
|
||||||
|
Other relevant articles:
|
||||||
|
* https://github.com/mapbase-source/source-sdk-2013/wiki/Mapbase-Disclaimers
|
||||||
|
* https://github.com/mapbase-source/source-sdk-2013/wiki/Frequently-Asked-Questions-(FAQ)
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
In memory of Holly Liberatore (moofemp)
|
||||||
|
|
||||||
|
//=========================================================================================================================
|
||||||
|
|
||||||
|
Please see the Source SDK 2013 license below:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SOURCE 1 SDK LICENSE
|
SOURCE 1 SDK LICENSE
|
||||||
|
|
||||||
Source SDK Copyright(c) Valve Corp.
|
Source SDK Copyright(c) Valve Corp.
|
||||||
|
@ -1471,6 +1471,25 @@ void CDetailObjectSystem::LevelInitPreEntity()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( m_DetailObjects.Count() || m_DetailSpriteDict.Count() )
|
||||||
|
{
|
||||||
|
// There are detail objects in the level, so precache the material
|
||||||
|
PrecacheMaterial( DETAIL_SPRITE_MATERIAL );
|
||||||
|
IMaterial *pMat = m_DetailSpriteMaterial;
|
||||||
|
// adjust for non-square textures (cropped)
|
||||||
|
float flRatio = (float)( pMat->GetMappingWidth() ) / pMat->GetMappingHeight();
|
||||||
|
if ( flRatio > 1.0 )
|
||||||
|
{
|
||||||
|
for( int i = 0; i<m_DetailSpriteDict.Count(); i++ )
|
||||||
|
{
|
||||||
|
m_DetailSpriteDict[i].m_TexUL.y *= flRatio;
|
||||||
|
m_DetailSpriteDict[i].m_TexLR.y *= flRatio;
|
||||||
|
m_DetailSpriteDictFlipped[i].m_TexUL.y *= flRatio;
|
||||||
|
m_DetailSpriteDictFlipped[i].m_TexLR.y *= flRatio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int detailPropLightingLump;
|
int detailPropLightingLump;
|
||||||
if( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE )
|
if( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE )
|
||||||
{
|
{
|
||||||
@ -1493,30 +1512,13 @@ void CDetailObjectSystem::LevelInitPreEntity()
|
|||||||
|
|
||||||
void CDetailObjectSystem::LevelInitPostEntity()
|
void CDetailObjectSystem::LevelInitPostEntity()
|
||||||
{
|
{
|
||||||
if ( m_DetailObjects.Count() || m_DetailSpriteDict.Count() )
|
const char *pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL;
|
||||||
|
C_World *pWorld = GetClientWorldEntity();
|
||||||
|
if ( pWorld && pWorld->GetDetailSpriteMaterial() && *(pWorld->GetDetailSpriteMaterial()) )
|
||||||
{
|
{
|
||||||
const char *pDetailSpriteMaterial = DETAIL_SPRITE_MATERIAL;
|
pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial();
|
||||||
C_World *pWorld = GetClientWorldEntity();
|
|
||||||
if ( pWorld && pWorld->GetDetailSpriteMaterial() && *(pWorld->GetDetailSpriteMaterial()) )
|
|
||||||
pDetailSpriteMaterial = pWorld->GetDetailSpriteMaterial();
|
|
||||||
|
|
||||||
m_DetailSpriteMaterial.Init( pDetailSpriteMaterial, TEXTURE_GROUP_OTHER );
|
|
||||||
PrecacheMaterial( pDetailSpriteMaterial );
|
|
||||||
IMaterial *pMat = m_DetailSpriteMaterial;
|
|
||||||
|
|
||||||
// adjust for non-square textures (cropped)
|
|
||||||
float flRatio = pMat->GetMappingWidth() / pMat->GetMappingHeight();
|
|
||||||
if ( flRatio > 1.0 )
|
|
||||||
{
|
|
||||||
for( int i = 0; i<m_DetailSpriteDict.Count(); i++ )
|
|
||||||
{
|
|
||||||
m_DetailSpriteDict[i].m_TexUL.y *= flRatio;
|
|
||||||
m_DetailSpriteDict[i].m_TexLR.y *= flRatio;
|
|
||||||
m_DetailSpriteDictFlipped[i].m_TexUL.y *= flRatio;
|
|
||||||
m_DetailSpriteDictFlipped[i].m_TexLR.y *= flRatio;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
m_DetailSpriteMaterial.Init( pDetailSpriteMaterial, TEXTURE_GROUP_OTHER );
|
||||||
|
|
||||||
if ( GetDetailController() )
|
if ( GetDetailController() )
|
||||||
{
|
{
|
||||||
|
@ -146,6 +146,8 @@ CParticleEffectBinding::CParticleEffectBinding()
|
|||||||
m_LastMin = m_Min;
|
m_LastMin = m_Min;
|
||||||
m_LastMax = m_Max;
|
m_LastMax = m_Max;
|
||||||
|
|
||||||
|
m_flParticleCullRadius = 0.0f;
|
||||||
|
|
||||||
SetParticleCullRadius( 0.0f );
|
SetParticleCullRadius( 0.0f );
|
||||||
m_nActiveParticles = 0;
|
m_nActiveParticles = 0;
|
||||||
|
|
||||||
|
@ -2565,7 +2565,7 @@ void CNPC_Combine::SpeakSentence( int sentenceType )
|
|||||||
//=========================================================
|
//=========================================================
|
||||||
// PainSound
|
// PainSound
|
||||||
//=========================================================
|
//=========================================================
|
||||||
void CNPC_Combine::PainSound ( const CTakeDamageInfo &info )
|
void CNPC_Combine::PainSound ( void )
|
||||||
{
|
{
|
||||||
// NOTE: The response system deals with this at the moment
|
// NOTE: The response system deals with this at the moment
|
||||||
if ( GetFlags() & FL_DISSOLVING )
|
if ( GetFlags() & FL_DISSOLVING )
|
||||||
|
@ -126,7 +126,7 @@ public:
|
|||||||
// Sounds
|
// Sounds
|
||||||
// -------------
|
// -------------
|
||||||
void DeathSound( void );
|
void DeathSound( void );
|
||||||
void PainSound( const CTakeDamageInfo &info );
|
void PainSound( void );
|
||||||
void IdleSound( void );
|
void IdleSound( void );
|
||||||
void AlertSound( void );
|
void AlertSound( void );
|
||||||
void LostEnemySound( void );
|
void LostEnemySound( void );
|
||||||
|
@ -22,10 +22,10 @@ void CPointEntity::Spawn( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CNullEntity : public CBaseEntity
|
class CNullEntity : public CServerOnlyEntity
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DECLARE_CLASS( CNullEntity, CBaseEntity );
|
DECLARE_CLASS( CNullEntity, CServerOnlyEntity );
|
||||||
|
|
||||||
void Spawn( void );
|
void Spawn( void );
|
||||||
};
|
};
|
||||||
|
@ -206,7 +206,7 @@ bool CHalfLife2::Damage_IsTimeBased( int iDmgType )
|
|||||||
// Damage types that are time-based.
|
// Damage types that are time-based.
|
||||||
#ifdef HL2_EPISODIC
|
#ifdef HL2_EPISODIC
|
||||||
// This makes me think EP2 should have its own rules, but they are #ifdef all over in here.
|
// This makes me think EP2 should have its own rules, but they are #ifdef all over in here.
|
||||||
return ( ( iDmgType & ( DMG_PARALYZE | DMG_NERVEGAS | DMG_POISON | DMG_ACID | DMG_RADIATION | DMG_DROWNRECOVER | DMG_SLOWBURN ) ) != 0 );
|
return ( ( iDmgType & ( DMG_PARALYZE | DMG_NERVEGAS | DMG_POISON | DMG_RADIATION | DMG_DROWNRECOVER | DMG_SLOWBURN ) ) != 0 );
|
||||||
#else
|
#else
|
||||||
return BaseClass::Damage_IsTimeBased( iDmgType );
|
return BaseClass::Damage_IsTimeBased( iDmgType );
|
||||||
#endif
|
#endif
|
||||||
|
@ -208,7 +208,7 @@ void CWeaponAR2::DelayedAttack( void )
|
|||||||
|
|
||||||
// pOwner->SnapEyeAngles( angles );
|
// pOwner->SnapEyeAngles( angles );
|
||||||
|
|
||||||
pOwner->ViewPunch( QAngle( SharedRandomInt( "ar2pax", -8, -12 ), SharedRandomInt( "ar2pay", 1, 2 ), 0 ) );
|
pOwner->ViewPunch( QAngle( SharedRandomInt( "ar2pax", -12, -8 ), SharedRandomInt( "ar2pay", 1, 2 ), 0 ) );
|
||||||
|
|
||||||
// Decrease ammo
|
// Decrease ammo
|
||||||
pOwner->RemoveAmmo( 1, m_iSecondaryAmmoType );
|
pOwner->RemoveAmmo( 1, m_iSecondaryAmmoType );
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
// Purpose: Half-Life 2 mod game definition file (.fgd)
|
|
||||||
// Defines new entities for bullsquid
|
|
||||||
//
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
@include "base.fgd"
|
|
||||||
@include "halflife2.fgd"
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// NPCs
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
@NPCClass base(BaseNPC) studio(" "models/bullsquid.mdl" ) = npc_bullsquid : "Bullsquid"
|
|
||||||
[
|
|
||||||
]
|
|
@ -1,256 +0,0 @@
|
|||||||
// ===========
|
|
||||||
// NPCs
|
|
||||||
// ============
|
|
||||||
// Barnacle
|
|
||||||
sk_barnacle_health "35"
|
|
||||||
|
|
||||||
// Barney
|
|
||||||
sk_barney_health "35"
|
|
||||||
|
|
||||||
// Bullseye
|
|
||||||
sk_bullseye_health "35"
|
|
||||||
|
|
||||||
// Bullsquid
|
|
||||||
//sk_bullsquid_health "120"
|
|
||||||
//sk_bullsquid_dmg_bite "15"
|
|
||||||
//sk_bullsquid_dmg_whip "25"
|
|
||||||
|
|
||||||
// Citizen
|
|
||||||
sk_citizen_health "40"
|
|
||||||
|
|
||||||
// Combine Soldier
|
|
||||||
sk_combine_s_health "50"
|
|
||||||
sk_combine_s_kick "10"
|
|
||||||
|
|
||||||
// Combine Guard
|
|
||||||
sk_combine_guard_health "70"
|
|
||||||
sk_combine_guard_kick "15"
|
|
||||||
|
|
||||||
// strider
|
|
||||||
sk_strider_health "350"
|
|
||||||
sk_strider_num_missiles1 "5"
|
|
||||||
sk_strider_num_missiles2 "7"
|
|
||||||
sk_strider_num_missiles3 "7"
|
|
||||||
|
|
||||||
// Headcrab
|
|
||||||
sk_headcrab_health "10"
|
|
||||||
sk_headcrab_melee_dmg "5"
|
|
||||||
|
|
||||||
// Fast Headcrab
|
|
||||||
sk_headcrab_fast_health "10"
|
|
||||||
|
|
||||||
// Poison Headcrab
|
|
||||||
sk_headcrab_poison_health "35"
|
|
||||||
|
|
||||||
// Houndeye
|
|
||||||
//sk_houndeye_health "80"
|
|
||||||
//sk_houndeye_dmg_blast "25"
|
|
||||||
|
|
||||||
// Manhack
|
|
||||||
sk_manhack_health "25"
|
|
||||||
sk_manhack_melee_dmg "20"
|
|
||||||
|
|
||||||
// Metropolice
|
|
||||||
sk_metropolice_health "40"
|
|
||||||
sk_metropolice_stitch_reaction "1.0"
|
|
||||||
sk_metropolice_stitch_tight_hitcount "2"
|
|
||||||
sk_metropolice_stitch_at_hitcount "1"
|
|
||||||
sk_metropolice_stitch_behind_hitcount "3"
|
|
||||||
sk_metropolice_stitch_along_hitcount "2"
|
|
||||||
|
|
||||||
// Rollermine
|
|
||||||
sk_rollermine_shock "10"
|
|
||||||
sk_rollermine_stun_delay "3"
|
|
||||||
sk_rollermine_vehicle_intercept "1"
|
|
||||||
|
|
||||||
// Scanner (City)
|
|
||||||
sk_scanner_health "30"
|
|
||||||
sk_scanner_dmg_dive "25"
|
|
||||||
|
|
||||||
// Stalker
|
|
||||||
sk_stalker_health "50"
|
|
||||||
sk_stalker_melee_dmg "5"
|
|
||||||
|
|
||||||
// Vortigaunt
|
|
||||||
sk_vortigaunt_health "100"
|
|
||||||
sk_vortigaunt_dmg_claw "10"
|
|
||||||
sk_vortigaunt_dmg_rake "25"
|
|
||||||
sk_vortigaunt_dmg_zap "50"
|
|
||||||
sk_vortigaunt_armor_charge "30"
|
|
||||||
|
|
||||||
// Zombie
|
|
||||||
sk_zombie_health "50"
|
|
||||||
sk_zombie_dmg_one_slash "10"
|
|
||||||
sk_zombie_dmg_both_slash "25"
|
|
||||||
|
|
||||||
// Poison Zombie
|
|
||||||
sk_zombie_poison_health "175"
|
|
||||||
sk_zombie_poison_dmg_spit "20"
|
|
||||||
|
|
||||||
//Antlion
|
|
||||||
sk_antlion_health "30"
|
|
||||||
sk_antlion_swipe_damage "5"
|
|
||||||
sk_antlion_jump_damage "5"
|
|
||||||
|
|
||||||
//Antlion Guard
|
|
||||||
sk_antlionguard_health "500"
|
|
||||||
sk_antlionguard_dmg_charge "20"
|
|
||||||
sk_antlionguard_dmg_shove "10"
|
|
||||||
|
|
||||||
//Antlion Grub
|
|
||||||
//sk_antliongrub_health "5"
|
|
||||||
|
|
||||||
//Ichthyosaur
|
|
||||||
sk_ichthyosaur_health "200"
|
|
||||||
sk_ichthyosaur_melee_dmg "8"
|
|
||||||
|
|
||||||
// Combine Gunship
|
|
||||||
sk_gunship_burst_size "15"
|
|
||||||
sk_gunship_health_increments "5"
|
|
||||||
sk_npc_dmg_gunship "40"
|
|
||||||
sk_npc_dmg_gunship_to_plr "3"
|
|
||||||
|
|
||||||
// Combine Helicopter
|
|
||||||
sk_npc_dmg_helicopter "6"
|
|
||||||
sk_npc_dmg_helicopter_to_plr "3"
|
|
||||||
sk_helicopter_grenadedamage "30"
|
|
||||||
sk_helicopter_grenaderadius "275"
|
|
||||||
sk_helicopter_grenadeforce "55000"
|
|
||||||
|
|
||||||
// Combine Dropship
|
|
||||||
sk_npc_dmg_dropship "2"
|
|
||||||
|
|
||||||
// Combine APC
|
|
||||||
sk_apc_health "750"
|
|
||||||
|
|
||||||
|
|
||||||
// =================
|
|
||||||
// WEAPONS
|
|
||||||
// =================
|
|
||||||
|
|
||||||
sk_plr_dmg_ar2 "8"
|
|
||||||
sk_npc_dmg_ar2 "3"
|
|
||||||
sk_max_ar2 "60"
|
|
||||||
sk_max_ar2_altfire "3"
|
|
||||||
|
|
||||||
sk_plr_dmg_alyxgun "5"
|
|
||||||
sk_npc_dmg_alyxgun "3"
|
|
||||||
sk_max_alyxgun "150"
|
|
||||||
|
|
||||||
sk_plr_dmg_pistol "5"
|
|
||||||
sk_npc_dmg_pistol "3"
|
|
||||||
sk_max_pistol "150"
|
|
||||||
|
|
||||||
sk_plr_dmg_smg1 "4"
|
|
||||||
sk_npc_dmg_smg1 "3"
|
|
||||||
sk_max_smg1 "225"
|
|
||||||
|
|
||||||
sk_plr_dmg_buckshot "8"
|
|
||||||
sk_npc_dmg_buckshot "3"
|
|
||||||
sk_max_buckshot "30"
|
|
||||||
|
|
||||||
sk_plr_dmg_rpg_round "100"
|
|
||||||
sk_npc_dmg_rpg_round "50"
|
|
||||||
sk_max_rpg_round "3"
|
|
||||||
|
|
||||||
sk_plr_dmg_smg1_grenade "100"
|
|
||||||
sk_npc_dmg_smg1_grenade "50"
|
|
||||||
sk_max_smg1_grenade "3"
|
|
||||||
sk_smg1_grenade_radius "250"
|
|
||||||
|
|
||||||
//sk_plr_dmg_gauss "25"
|
|
||||||
//sk_plr_max_dmg_gauss "30"
|
|
||||||
|
|
||||||
sk_plr_dmg_sniper_round "20"
|
|
||||||
sk_npc_dmg_sniper_round "100"
|
|
||||||
sk_max_sniper_round "30"
|
|
||||||
|
|
||||||
sk_plr_dmg_357 "40"
|
|
||||||
sk_npc_dmg_357 "30"
|
|
||||||
sk_max_357 "12"
|
|
||||||
|
|
||||||
sk_plr_dmg_crossbow "100"
|
|
||||||
sk_npc_dmg_crossbow "10"
|
|
||||||
sk_max_crossbow "10"
|
|
||||||
|
|
||||||
sk_plr_dmg_airboat "3"
|
|
||||||
sk_npc_dmg_airboat "3"
|
|
||||||
|
|
||||||
//sk_dmg_sniper_penetrate_plr "10"
|
|
||||||
//sk_dmg_sniper_penetrate_npc "100"
|
|
||||||
|
|
||||||
sk_plr_dmg_grenade "150"
|
|
||||||
sk_npc_dmg_grenade "75"
|
|
||||||
sk_max_grenade "5"
|
|
||||||
|
|
||||||
sk_plr_dmg_crowbar "10"
|
|
||||||
sk_npc_dmg_crowbar "5"
|
|
||||||
|
|
||||||
sk_plr_dmg_stunstick "10"
|
|
||||||
sk_npc_dmg_stunstick "40" // Kill a citizen in one hit
|
|
||||||
|
|
||||||
//sk_plr_dmg_satchel "150"
|
|
||||||
//sk_npc_dmg_satchel "75"
|
|
||||||
//sk_satchel_radius "150"
|
|
||||||
|
|
||||||
// Mortar Synth projectile
|
|
||||||
//sk_dmg_energy_grenade "2"
|
|
||||||
//sk_energy_grenade_radius "100"
|
|
||||||
|
|
||||||
sk_dmg_homer_grenade "20"
|
|
||||||
sk_homer_grenade_radius "100"
|
|
||||||
|
|
||||||
// Bullsquid spit
|
|
||||||
//sk_dmg_spit_grenade "5"
|
|
||||||
//sk_spit_grenade_radius "50"
|
|
||||||
|
|
||||||
//sk_plr_dmg_tripmine "150"
|
|
||||||
//sk_npc_dmg_tripmine "125"
|
|
||||||
//sk_tripmine_radius "200"
|
|
||||||
|
|
||||||
sk_plr_dmg_fraggrenade "125"
|
|
||||||
sk_npc_dmg_fraggrenade "75"
|
|
||||||
sk_fraggrenade_radius "250"
|
|
||||||
|
|
||||||
// HEALTH/SUIT CHARGE DISTRIBUTION
|
|
||||||
sk_suitcharger "75"
|
|
||||||
sk_suitcharger_citadel "500"
|
|
||||||
sk_suitcharger_citadel_maxarmor "200"
|
|
||||||
sk_battery "15"
|
|
||||||
sk_healthcharger "50"
|
|
||||||
sk_healthkit "25"
|
|
||||||
sk_healthvial "10"
|
|
||||||
|
|
||||||
// Combine balls
|
|
||||||
sk_combineball_seek_angle "15"
|
|
||||||
sk_combineball_guidefactor "1.0"
|
|
||||||
|
|
||||||
// NPC damage adjusters
|
|
||||||
sk_npc_head "3"
|
|
||||||
sk_npc_chest "1"
|
|
||||||
sk_npc_stomach "1"
|
|
||||||
sk_npc_arm "1"
|
|
||||||
sk_npc_leg "1"
|
|
||||||
|
|
||||||
// player damage adjusters
|
|
||||||
sk_player_head "3"
|
|
||||||
sk_player_chest "1"
|
|
||||||
sk_player_stomach "1"
|
|
||||||
sk_player_arm "1"
|
|
||||||
sk_player_leg "1"
|
|
||||||
|
|
||||||
// Allies
|
|
||||||
sk_ally_regen_time "0.2"
|
|
||||||
|
|
||||||
// Jeep
|
|
||||||
sk_max_gauss_round "30"
|
|
||||||
|
|
||||||
// =================
|
|
||||||
// RTSL
|
|
||||||
// =================
|
|
||||||
//Max health
|
|
||||||
sk_mechacrab_health "40"
|
|
||||||
//Damage inflicted by the mechacrab
|
|
||||||
sk_mechacrab_melee_dmg "10"
|
|
||||||
//Damage taken by crowbar hits
|
|
||||||
sk_mechacrab_crowbar_dmg "20"
|
|
@ -7,5 +7,3 @@ sk_apc_missile_damage "50"
|
|||||||
// Antlion air attack
|
// Antlion air attack
|
||||||
sk_antlion_air_attack_dmg "10"
|
sk_antlion_air_attack_dmg "10"
|
||||||
|
|
||||||
sk_lostsoul_health "25"
|
|
||||||
sk_lostsoul_melee_dmg "5"
|
|
@ -1,11 +0,0 @@
|
|||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
// Purpose: Half-Life 2 mod game definition file (.fgd)
|
|
||||||
// Defines new entities for the flaregun weapon
|
|
||||||
//
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
@include "halflife2.fgd"
|
|
||||||
|
|
||||||
@PointClass base(Item) studio("models/items/boxflares.mdl")= item_box_flare_rounds : "Box of Flare Rounds" []
|
|
||||||
@PointClass base(Weapon) studio("models/weapons/w_pistol.mdl") = weapon_flaregun : "Flaregun" []
|
|
File diff suppressed because it is too large
Load Diff
@ -1,69 +0,0 @@
|
|||||||
//=============================================================================
|
|
||||||
//
|
|
||||||
// Purpose: Half-Life 2 mod game definition file (.fgd)
|
|
||||||
// Defines new entities for Halloween themed mods
|
|
||||||
//
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
@include "base.fgd"
|
|
||||||
@include "halflife2.fgd"
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// NPCs
|
|
||||||
//
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
@NPCClass base(BaseNPC) studioprop() = npc_shadow_walker : "Shadow Walker"
|
|
||||||
[
|
|
||||||
additionalequipment(choices) : "Weapons" : "0" : "It is recommended that the Shadow Walker be equipped with a melee weapon such as the crowbar or stunstick. The shotgun and Annabelle also work surprisingly well, but firing patterns have not been set up for automatic weapons." =
|
|
||||||
[
|
|
||||||
"0" : "Custom Melee Weapon"
|
|
||||||
"weapon_crowbar" : "Crow Bar"
|
|
||||||
"weapon_stunstick" : "Stun Stick"
|
|
||||||
"weapon_shotgun" : "Shotgun"
|
|
||||||
"weapon_annabelle" : "Annabelle"
|
|
||||||
"weapon_pistol" : "Pistol"
|
|
||||||
"weapon_ar2" : "AR2"
|
|
||||||
"weapon_smg1" : "SMG1"
|
|
||||||
"weapon_alyxgun" : "Alyx Gun"
|
|
||||||
]
|
|
||||||
|
|
||||||
model(studio) : "World Model" : "models/monster/subject.mdl" : "You may specify any model for this NPC. However, the NPC was written with standard human animations in mind. Missing animations may cause errors. Be aware the animations of the model you choose will affect the NPC's behavior."
|
|
||||||
WeaponModel(studio) : "Weapon Model Override" : "models/props_canal/mattpipe.mdl" : "If the Shadow Walker is set to use 'Custom Melee Weapon', you may supply a world model to use. I would recommend using the pipe model, the crowbar model, or the stunstick model."
|
|
||||||
|
|
||||||
Health(integer) : "Health" : 75 : "Starting health of the NPC."
|
|
||||||
|
|
||||||
FearSound(sound) : "Fear Sound" : "NPC_ShadowWalker.Fear" : "The NPC will play this sound when retreating."
|
|
||||||
DeathSound(sound) : "Death Sound" : "NPC_ShadowWalker.Death" : "The NPC will play this sound on death."
|
|
||||||
IdleSound(sound) : "Idle Sound" : "NPC_ShadowWalker.Idle" : "The NPC will play this sound while wandering idly."
|
|
||||||
PainSound(sound) : "Pain Sound" : "NPC_ShadowWalker.Pain" : "The NPC will play this sound when damaged."
|
|
||||||
AlertSound(sound) : "Alert Sound" : "NPC_ShadowWalker.Alert" : "The NPC will play this sound while in an alert state."
|
|
||||||
LostEnemySound(sound) : "Lost Enemy Sound" : "NPC_ShadowWalker.LostEnemy" : "The NPC will play this sound if it loses sight of its enemy."
|
|
||||||
FoundEnemySound(sound) : "Found Enemy Sound" : "NPC_ShadowWalker.FoundEnemy" : "The NPC will play this sound if it finds an enemy again after previously losing it."
|
|
||||||
UseBothSquadSlots(choices) : "Use Both Squad Slots" : 0 : "When in a squad, how many shadow walkers should be able to chase the player at one time? Additional squadmates will run away from the player in the hopes of setting up an ambush." =
|
|
||||||
[
|
|
||||||
0 : "Use One Squad Slot"
|
|
||||||
1 : "Use Both Squad Slots"
|
|
||||||
]
|
|
||||||
CannotOpenDoors(choices) : "Can Open Doors?" : 0 : "Is this NPC able to open doors? You can change this after spawning with EnableOpenDoors and DisableOpenDoors, but it doesn't always seem to work well with pathfinding." =
|
|
||||||
[
|
|
||||||
0 : "Can Open Doors"
|
|
||||||
1 : "Cannot Open Doors"
|
|
||||||
]
|
|
||||||
// // Weapon pickup feature not working yet
|
|
||||||
// CanPickupWeapons(choices) : "Can Pick Up Guns?" : 0 : "Is this NPC able to pick up guns? You can change this after spawning with EnablePickupWeapons and DisablePickupWeapons." =
|
|
||||||
// [
|
|
||||||
// 0 : "Cannot Pick Up Guns"
|
|
||||||
// 1 : "Can Pick Up Guns"
|
|
||||||
// ]
|
|
||||||
input SetSpeedModifier(float) : "Set a float value to multiple distance traveled by."
|
|
||||||
input EnableOpenDoors(void) : "Allow this NPC to open doors. (Warning: Doesn't always seem to update pathfinding / AI)"
|
|
||||||
input DisableOpenDoors(void) : "Prevent this NPC from opening doors."
|
|
||||||
// input EnablePickupWeapons(void) : "Allow this NPC to pick up any weapon off of the ground."
|
|
||||||
// input DisablePickupWeapons(void) : "Prevent this NPC from picking up weapons."
|
|
||||||
|
|
||||||
]
|
|
||||||
|
|
||||||
@NPCClass base(npc_manhack) studio("models/skeleton/skeleton_torso3.mdl") = npc_lost_soul : "Lost Soul"
|
|
||||||
[
|
|
||||||
]
|
|
Binary file not shown.
@ -1,129 +0,0 @@
|
|||||||
game_sounds_manifest
|
|
||||||
{
|
|
||||||
|
|
||||||
"precache_file" "scripts/game_sounds.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_ui.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_player.txt"
|
|
||||||
|
|
||||||
// Weapon sounds
|
|
||||||
"precache_file" "scripts/game_sounds_weapons.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_weapons_ep2.txt"
|
|
||||||
|
|
||||||
// HL2 World, Ambient Generic, Items, Physics, Vehicles
|
|
||||||
"precache_file" "scripts/game_sounds_world.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_ambient_generic.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_items.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_physics.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_vehicles.txt"
|
|
||||||
|
|
||||||
// E3 level sounds
|
|
||||||
"precache_file" "scripts/level_sounds_e3_c17.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_e3_town.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_e3_bugbait.txt"
|
|
||||||
|
|
||||||
// Episodic content sounds
|
|
||||||
"precache_file" "scripts/npc_sounds_alyx_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_strider_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_strider_episodic2.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_turret_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_soldier_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_ministrider_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_roller_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_combine_ball_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_citizen_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_citizen_episodic2.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_citizen_ep1.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_zombine.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_dog_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_antlion_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_antlionguard_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_antlionguard_episodic2.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_advisor.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_advisor_episodic2.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_hunter.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_antlion_grub_episodic.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_attackheli_episodic2.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_fastzombie_episodic2.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_addendum_ep2.txt"
|
|
||||||
|
|
||||||
|
|
||||||
"precache_file" "scripts/level_sounds_music_episodic.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_music_episodic2.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_weapons_episodic.txt"
|
|
||||||
"precache_file" "scripts/level_voices_episode_01.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_aftermath_episodic.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_outland_episodic.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_c17_02a.txt"
|
|
||||||
|
|
||||||
"precache_file" "scripts/level_voices_episode_02.txt"
|
|
||||||
"precache_file" "scripts/game_sounds_vehicles_ep2.txt"
|
|
||||||
|
|
||||||
// EP2 content sounds
|
|
||||||
"precache_file" "scripts/game_sounds_physics_ep2.txt"
|
|
||||||
|
|
||||||
// Game level sounds
|
|
||||||
"precache_file" "scripts/level_sounds_eli_lab.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_trainyard.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_k_lab.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_k_lab2.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_coast.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_novaprospekt.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_streetwar.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_streetwar2.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_breencast.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_citadel.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_canals.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_ravenholm.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_ravenholm2.txt"
|
|
||||||
"precache_file" "scripts/level_sounds_canals2.txt"
|
|
||||||
|
|
||||||
//Music Tracks
|
|
||||||
"precache_file" "scripts/level_sounds_music.txt"
|
|
||||||
|
|
||||||
// NPC Sounds
|
|
||||||
"precache_file" "scripts/npc_sounds_eli.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_alyx.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_dog.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_citizen.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_barney.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_soldier.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_strider.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_zombie.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_vortigaunt.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_turret.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_scanner.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_rollermine.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_poisonzombie.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_metropolice.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_combinecamera.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_manhack.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_ichthyosaur.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_blackheadcrab.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_fastheadcrab.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_headcrab.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_fastzombie.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_birds.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_gunship.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_dropship.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_barnacle.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_attackheli.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_antlionguard.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_antlion.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_env_headcrabcanister.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_combine_ball.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_combine_mine.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_sniper.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_stalker.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_gman.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_combine_cannon.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_alyx_episodic2.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_turret_episodic2.txt"
|
|
||||||
|
|
||||||
// 1upD's Custom NPCs
|
|
||||||
"precache_file" "scripts/npc_sounds_shadow_walker.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_lost_soul.txt"
|
|
||||||
"precache_file" "scripts/npc_sounds_bullsquid.txt"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,98 +0,0 @@
|
|||||||
// Bullsquid
|
|
||||||
"NPC_Bullsquid.Idle"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "1.0"
|
|
||||||
"soundlevel" "SNDLVL_75dB"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "bullchicken/bc_idle1.wav"
|
|
||||||
"wave" "bullchicken/bc_idle2.wav"
|
|
||||||
"wave" "bullchicken/bc_idle3.wav"
|
|
||||||
"wave" "bullchicken/bc_idle4.wav"
|
|
||||||
"wave" "bullchicken/bc_idle5.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_Bullsquid.Pain"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "1.0"
|
|
||||||
"soundlevel" "SNDLVL_85dB"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "bullchicken/bc_pain1.wav"
|
|
||||||
"wave" "bullchicken/bc_pain2.wav"
|
|
||||||
"wave" "bullchicken/bc_pain3.wav"
|
|
||||||
"wave" "bullchicken/bc_pain4.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"npc_bullsquid.Alert"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "1.0"
|
|
||||||
"soundlevel" "SNDLVL_85dB"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "bullchicken/bc_idle1.wav"
|
|
||||||
"wave" "bullchicken/bc_idle2.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_Bullsquid.Die"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "1.0"
|
|
||||||
"soundlevel" "SNDLVL_85dB"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "bullchicken/bc_die1.wav"
|
|
||||||
"wave" "bullchicken/bc_die2.wav"
|
|
||||||
"wave" "bullchicken/bc_die3.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_Bullsquid.Attack1"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "1.0"
|
|
||||||
"soundlevel" "SNDLVL_100dB"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "bullchicken/bc_attack2.wav"
|
|
||||||
"wave" "bullchicken/bc_attack3.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_Bullsquid.Bite"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "1.0"
|
|
||||||
"soundlevel" "SNDLVL_85dB"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "bullchicken/bc_bite2.wav"
|
|
||||||
"wave" "bullchicken/bc_bite3.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_Bullsquid.Growl"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "1.0"
|
|
||||||
"soundlevel" "SNDLVL_80dB"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "bullchicken/bc_attackgrowl.wav"
|
|
||||||
"wave" "bullchicken/bc_attackgrowl2.wav"
|
|
||||||
"wave" "bullchicken/bc_attackgrowl3.wav"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,100 +0,0 @@
|
|||||||
// Default sound scripts for npc_lost_soul
|
|
||||||
// Author: 1upD
|
|
||||||
|
|
||||||
"NPC_LostSoul.Die"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_BODY"
|
|
||||||
"volume" "VOL_NORM"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"wave" "physics/flesh/flesh_bloody_break.wav"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
"NPC_LostSoul.Burn"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_ITEM"
|
|
||||||
"volume" "VOL_NORM"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_70dB"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "player/pl_burnpain1.wav"
|
|
||||||
"wave" "player/pl_burnpain2.wav"
|
|
||||||
"wave" "player/pl_burnpain3.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_LostSoul.Bat"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_ITEM"
|
|
||||||
"volume" "VOL_NORM"
|
|
||||||
"pitch" "150, 175"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_70dB"
|
|
||||||
|
|
||||||
"wave" "npc\stalker\stalker_alert3b.wav"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
"NPC_LostSoul.Float"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_ITEM"
|
|
||||||
"volume" "VOL_NORM"
|
|
||||||
"pitch" "PITCH_NORM"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "ambient\levels\citadel\datatransfmalevx01.wav"
|
|
||||||
"wave" "ambient\levels\citadel\datatransmalevx01.wav"
|
|
||||||
"wave" "ambient\levels\citadel\datatransmalevx02.wav"
|
|
||||||
"wave" "ambient\levels\citadel\datatransmalevx02.wav"
|
|
||||||
"wave" "ambient\levels\citadel\datatransrandom03.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
"NPC_LostSoul.ChargeAnnounce"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_WEAPON"
|
|
||||||
"volume" "VOL_NORM"
|
|
||||||
"pitch" "150, 175"
|
|
||||||
//"pitch" "120, 125"
|
|
||||||
"soundlevel" "SNDLVL_70dB"
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "npc/zombie_poison/pz_alert1.wav"
|
|
||||||
"wave" "npc/zombie_poison/pz_alert1.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_LostSoul.ChargeEnd"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_WEAPON"
|
|
||||||
"volume" "VOL_NORM"
|
|
||||||
"pitch" "150, 175"
|
|
||||||
//"pitch" "120, 125"
|
|
||||||
"soundlevel" "SNDLVL_70dB"
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "npc/zombie_poison/pz_warn1.wav"
|
|
||||||
"wave" "npc/zombie_poison/pz_warn1.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_LostSoul.Stunned"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.80"
|
|
||||||
"pitch" "145,150"
|
|
||||||
"soundlevel" "SNDLVL_70dB"
|
|
||||||
"wave" "NPC_Antlion.PoisonBurstScream"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,200 +0,0 @@
|
|||||||
// Default sound scripts for npc_shadow_walker
|
|
||||||
// Author: 1upD
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.Pain"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "65, 70"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "npc\stalker\stalker_pain1.wav"
|
|
||||||
"wave" "npc\stalker\stalker_pain2.wav"
|
|
||||||
"wave" "npc\stalker\stalker_pain3.wav"
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.Idle"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "80, 90"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "npc\stalker\stalker_scream1.wav"
|
|
||||||
"wave" "npc\stalker\stalker_scream2.wav"
|
|
||||||
"wave" "npc\stalker\stalker_scream3.wav"
|
|
||||||
"wave" "npc\stalker\stalker_scream4.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.Vocal.Idle"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "62, 62"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "vo\episode_1\citadel\al_stalk_pleasestopscreaming01.wav"
|
|
||||||
"wave" "vo\episode_1\citadel\al_stalk_pleasestopscreaming02.wav"
|
|
||||||
"wave" "vo\episode_1\citadel\al_stalk_pleasestopscreaming03.wav"
|
|
||||||
"wave" "vo\episode_1\citadel\al_stalk_pleasestopscreaming04.wav"
|
|
||||||
"wave" "vo\episode_1\citadel\al_stalk_pleasestopscreaming05.wav"
|
|
||||||
"wave" "vo\k_lab2\al_optimism.wav"
|
|
||||||
"wave" "vo\episode_1\c17\al_elev_whereselev.wav"
|
|
||||||
"wave" "vo\episode_1\intro\al_wheredoeshethink.wav"
|
|
||||||
"wave" "vo\outland_02\griggs_everywhere.wav"
|
|
||||||
"wave" "vo\outland_11a\silo\kl_silo_wheredata01.wav"
|
|
||||||
"wave" "vo\episode_1\intro\al_cantbelieveit.wav"
|
|
||||||
"wave" "vo\episode_1\npc\alyx\al_deaf_canthearanything.wav"
|
|
||||||
"wave" "vo\episode_1\npc\alyx\al_deaf_canthearyou.wav"
|
|
||||||
"wave" "vo\k_lab\ba_cantlook.wav"
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.Fear"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "62, 62"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
// Replace these
|
|
||||||
"wave" "npc\stalker\stalker_die2.wav"
|
|
||||||
"wave" "npc\stalker\stalker_pain1.wav"
|
|
||||||
"wave" "npc\stalker\stalker_pain2.wav"
|
|
||||||
"wave" "npc\stalker\stalker_pain3.wav"
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.Alert"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "80, 90"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "npc\stalker\stalker_alert1b.wav"
|
|
||||||
"wave" "npc\stalker\stalker_alert2b.wav"
|
|
||||||
"wave" "npc\stalker\stalker_alert3b.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.Vocal.Alert"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "62, 62"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "vo\citadel\al_bitofit.wav"
|
|
||||||
"wave" "vo\outland_01\intro\al_rbed_notalone.wav"
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.LostEnemy"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "80, 90"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "npc\zombie_poison\pz_alert2.wav"
|
|
||||||
"wave" "npc\stalker\stalker_die2.wav"
|
|
||||||
"wave" "npc\stalker\stalker_scream4.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.Vocal.LostEnemy"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "62, 62"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "vo\citadel\al_notagain02.wav"
|
|
||||||
"wave" "vo\episode_1\npc\alyx\al_light_lost05.wav"
|
|
||||||
"wave" "vo\episode_1\npc\alyx\al_light_lost11.wav"
|
|
||||||
"wave" "vo\citadel\al_wonderwhere.wav"
|
|
||||||
"wave" "vo\outland_12a\launch\al_launch_damnit.wav"
|
|
||||||
"wave" "vo\streetwar\alyx_gate\al_no.wav"
|
|
||||||
"wave" "vo\k_lab\kl_thenwhere.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.FoundEnemy"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "75, 85"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "npc\stalker\go_alert2.wav"
|
|
||||||
"wave" "npc\stalker\go_alert2a.wav"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.Vocal.FoundEnemy"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "62, 62"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "npc\stalker\stalker_scream1.wav"
|
|
||||||
"wave" "vo\citadel\al_thatshim.wav"
|
|
||||||
"wave" "vo\citadel\al_thereheis.wav"
|
|
||||||
"wave" "vo\episode_1\npc\alyx\al_rejoin02.wav"
|
|
||||||
"wave" "vo\episode_1\npc\alyx\al_seemanyfoe03.wav"
|
|
||||||
"wave" "vo\episode_1\npc\alyx\al_zombie_liveone02.wav"
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"NPC_ShadowWalker.Death"
|
|
||||||
{
|
|
||||||
"channel" "CHAN_VOICE"
|
|
||||||
"volume" "0.95"
|
|
||||||
"pitch" "60, 65"
|
|
||||||
|
|
||||||
"soundlevel" "SNDLVL_NORM"
|
|
||||||
|
|
||||||
"rndwave"
|
|
||||||
{
|
|
||||||
"wave" "ambient\creatures\town_child_scream1.wav"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
// Custom melee weapon - used by npc_shadow_walker for weapon model overrides
|
|
||||||
WeaponData
|
|
||||||
{
|
|
||||||
// This will be replaced in code
|
|
||||||
"playermodel" "models/weapons/w_crowbar.mdl"
|
|
||||||
|
|
||||||
"anim_prefix" "crowbar"
|
|
||||||
|
|
||||||
"clip_size" "-1"
|
|
||||||
"primary_ammo" "None"
|
|
||||||
"secondary_ammo" "None"
|
|
||||||
|
|
||||||
"weight" "0"
|
|
||||||
"item_flags" "0"
|
|
||||||
|
|
||||||
// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
|
|
||||||
SoundData
|
|
||||||
{
|
|
||||||
"melee_hit_world" "Weapon_Crowbar.Melee_HitWorld"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
// Pistol
|
|
||||||
|
|
||||||
WeaponData
|
|
||||||
{
|
|
||||||
// Weapon data is loaded by both the Game and Client DLLs.
|
|
||||||
"printname" "#HL2_Flaregun"
|
|
||||||
"viewmodel" "models/weapons/v_flaregun.mdl"
|
|
||||||
"playermodel" "models/weapons/w_flaregun.mdl"
|
|
||||||
"anim_prefix" "pistol"
|
|
||||||
"bucket" "1"
|
|
||||||
"bucket_position" "2"
|
|
||||||
"bucket_360" "0"
|
|
||||||
"bucket_position_360" "0"
|
|
||||||
|
|
||||||
"clip_size" "1"
|
|
||||||
"primary_ammo" "FlareRound"
|
|
||||||
"secondary_ammo" "None"
|
|
||||||
|
|
||||||
"weight" "2"
|
|
||||||
"rumble" "1"
|
|
||||||
"item_flags" "0"
|
|
||||||
|
|
||||||
// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
|
|
||||||
SoundData
|
|
||||||
{
|
|
||||||
|
|
||||||
"reload" "Weapon_FlareGun.Reload"
|
|
||||||
"reload_npc" "Weapon_FlareGun.Reload"
|
|
||||||
"empty" "Weapon_Pistol.Empty"
|
|
||||||
"single_shot" "Weapon_FlareGun.Single"
|
|
||||||
"single_shot_npc" "Weapon_FlareGun.Single"
|
|
||||||
"special1" "Weapon_Pistol.Special1"
|
|
||||||
"special2" "Weapon_Pistol.Special2"
|
|
||||||
"burst" "Weapon_Pistol.Burst"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Weapon Sprite data is loaded by the Client DLL.
|
|
||||||
TextureData
|
|
||||||
{
|
|
||||||
"weapon"
|
|
||||||
{
|
|
||||||
"font" "WeaponIcons"
|
|
||||||
"character" "d"
|
|
||||||
}
|
|
||||||
"weapon_s"
|
|
||||||
{
|
|
||||||
"font" "WeaponIconsSelected"
|
|
||||||
"character" "d"
|
|
||||||
}
|
|
||||||
"weapon_small"
|
|
||||||
{
|
|
||||||
"font" "WeaponIconsSmall"
|
|
||||||
"character" "d"
|
|
||||||
}
|
|
||||||
"ammo"
|
|
||||||
{
|
|
||||||
"font" "WeaponIconsSmall"
|
|
||||||
"character" "p"
|
|
||||||
}
|
|
||||||
"crosshair"
|
|
||||||
{
|
|
||||||
"font" "Crosshairs"
|
|
||||||
"character" "Q"
|
|
||||||
}
|
|
||||||
"autoaim"
|
|
||||||
{
|
|
||||||
"file" "sprites/crosshairs"
|
|
||||||
"x" "0"
|
|
||||||
"y" "48"
|
|
||||||
"width" "24"
|
|
||||||
"height" "24"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
weapon_manifest
|
|
||||||
{
|
|
||||||
"file" "scripts/weapon_357.txt"
|
|
||||||
"file" "scripts/weapon_alyxgun.txt"
|
|
||||||
"file" "scripts/weapon_annabelle.txt"
|
|
||||||
"file" "scripts/weapon_ar2.txt"
|
|
||||||
"file" "scripts/weapon_bugbait.txt"
|
|
||||||
"file" "scripts/weapon_citizenpackage.txt"
|
|
||||||
"file" "scripts/weapon_citizensuitcase.txt"
|
|
||||||
"file" "scripts/weapon_crossbow.txt"
|
|
||||||
"file" "scripts/weapon_crowbar.txt"
|
|
||||||
"file" "scripts/weapon_cubemap.txt"
|
|
||||||
"file" "scripts/weapon_frag.txt"
|
|
||||||
"file" "scripts/weapon_physcannon.txt"
|
|
||||||
"file" "scripts/weapon_physgun.txt"
|
|
||||||
"file" "scripts/weapon_pistol.txt"
|
|
||||||
"file" "scripts/weapon_rpg.txt"
|
|
||||||
"file" "scripts/weapon_shotgun.txt"
|
|
||||||
"file" "scripts/weapon_smg1.txt"
|
|
||||||
"file" "scripts/weapon_stunstick.txt"
|
|
||||||
|
|
||||||
// Custom
|
|
||||||
"file" "scripts/weapon_custommelee.txt"
|
|
||||||
"file" "scripts/weapon_flaregun.txt"
|
|
||||||
}
|
|
5
sp/src/createmaptoolsprojects
Executable file
5
sp/src/createmaptoolsprojects
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pushd `dirname $0`
|
||||||
|
devtools/bin/vpc /hl2 /episodic +maptools /mksln maptools
|
||||||
|
popd
|
1
sp/src/createmaptoolsprojects.bat
Normal file
1
sp/src/createmaptoolsprojects.bat
Normal file
@ -0,0 +1 @@
|
|||||||
|
devtools\bin\vpc.exe +maptools /mksln maptools.sln
|
5
sp/src/createshadersprojects
Executable file
5
sp/src/createshadersprojects
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
pushd `dirname $0`
|
||||||
|
devtools/bin/vpc /hl2 /episodic +shaders /mksln shaders
|
||||||
|
popd
|
1
sp/src/createshadersprojects.bat
Normal file
1
sp/src/createshadersprojects.bat
Normal file
@ -0,0 +1 @@
|
|||||||
|
devtools\bin\vpc.exe /hl2 /episodic +shaders /mksln shaders.sln
|
59
sp/src/devtools/gcc9+support.cpp
Normal file
59
sp/src/devtools/gcc9+support.cpp
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
// compatibility with old ABI
|
||||||
|
#if __GNUC__ >= 9
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
extern "C" double __pow_finite(double a, double b)
|
||||||
|
{
|
||||||
|
return pow(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" double __log_finite(double a)
|
||||||
|
{
|
||||||
|
return log(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" double __exp_finite(double a)
|
||||||
|
{
|
||||||
|
return exp(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" double __atan2_finite(double a, double b)
|
||||||
|
{
|
||||||
|
return atan2(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" double __atan2f_finite(double a, double b)
|
||||||
|
{
|
||||||
|
return atan2f(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" float __powf_finite(float a, float b)
|
||||||
|
{
|
||||||
|
return powf(a, b);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" float __logf_finite(float a)
|
||||||
|
{
|
||||||
|
return logf(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" float __expf_finite(float a)
|
||||||
|
{
|
||||||
|
return expf(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" float __acosf_finite(float a)
|
||||||
|
{
|
||||||
|
return acosf(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" double __asin_finite(double a)
|
||||||
|
{
|
||||||
|
return asin(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" double __acos_finite(double a)
|
||||||
|
{
|
||||||
|
return acos(a);
|
||||||
|
}
|
||||||
|
#endif
|
@ -1,509 +1,16 @@
|
|||||||
#
|
SRCROOT?=..
|
||||||
# Base makefile for Linux and OSX
|
|
||||||
#
|
THISFILE:=$(SRCROOT)/devtools/makefile_base_posix.mak
|
||||||
# !!!!! Note to future editors !!!!!
|
MAKEFILE_BASE:=$(notdir $(THISFILE))
|
||||||
#
|
MAKEFILE_LINK:=$(THISFILE).link
|
||||||
# before you make changes, make sure you grok:
|
|
||||||
# 1. the difference between =, :=, +=, and ?=
|
-include $(MAKEFILE_LINK)
|
||||||
# 2. how and when this base makefile gets included in the generated makefile(s)
|
|
||||||
# ( see http://www.gnu.org/software/make/manual/make.html#Flavors )
|
# depend on CXX so the correct makefile can be selected when the system is updated
|
||||||
#
|
$(MAKEFILE_LINK): $(shell which $(CXX)) $(THISFILE) $(SRCROOT)/devtools/gcc9+support.cpp
|
||||||
# Command line prefixes:
|
@ if [ "$(shell printf "$(shell $(CXX) -dumpversion)\n8" | sort -Vr | head -1)" = 8 ]; then \
|
||||||
# - errors are ignored
|
ln -sf $(MAKEFILE_BASE).default $@ ;\
|
||||||
# @ command is not printed to stdout before being executed
|
else \
|
||||||
# + command is executed even if Make is invoked in "do not exec" mode
|
$(COMPILE.cpp) -m32 -o $(SRCROOT)/devtools/gcc9+support.o $(SRCROOT)/devtools/gcc9+support.cpp &&\
|
||||||
|
ln -sf $(MAKEFILE_BASE).gcc8 $@ ;\
|
||||||
OS := $(shell uname)
|
fi
|
||||||
HOSTNAME := $(shell hostname)
|
|
||||||
|
|
||||||
-include $(SRCROOT)/devtools/steam_def.mak
|
|
||||||
-include $(SRCROOT)/devtools/sourcesdk_def.mak
|
|
||||||
|
|
||||||
# To build with clang, set the following in your environment:
|
|
||||||
# CC = clang
|
|
||||||
# CXX = clang++
|
|
||||||
|
|
||||||
ifeq ($(CFG), release)
|
|
||||||
# With gcc 4.6.3, engine.so went from 7,383,765 to 8,429,109 when building with -O3.
|
|
||||||
# There also was no speed difference running at 1280x1024. May 2012, mikesart.
|
|
||||||
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
|
|
||||||
# -fno-omit-frame-pointer: need this for stack traces with perf.
|
|
||||||
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize -fpredictive-commoning -funswitch-loops
|
|
||||||
else
|
|
||||||
OptimizerLevel_CompilerSpecific = -O0
|
|
||||||
#-O1 -finline-functions
|
|
||||||
endif
|
|
||||||
|
|
||||||
# CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags"
|
|
||||||
ARCH_FLAGS =
|
|
||||||
BUILDING_MULTI_ARCH = 0
|
|
||||||
CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) ))
|
|
||||||
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
|
|
||||||
# In -std=gnu++0x mode we get lots of errors about "error: narrowing conversion". -fpermissive
|
|
||||||
# turns these into warnings in gcc, and -Wno-c++11-narrowing suppresses them entirely in clang 3.1+.
|
|
||||||
ifeq ($(CXX),clang++)
|
|
||||||
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
|
|
||||||
else
|
|
||||||
CXXFLAGS = $(CFLAGS) -std=gnu++0x -fpermissive
|
|
||||||
endif
|
|
||||||
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
|
|
||||||
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
|
|
||||||
GENDEP_CXXFLAGS = -MD -MP -MF $(@:.o=.P)
|
|
||||||
MAP_FLAGS =
|
|
||||||
Srv_GAMEOUTPUTFILE =
|
|
||||||
COPY_DLL_TO_SRV = 0
|
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(STEAM_BRANCH),1)
|
|
||||||
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
|
|
||||||
else
|
|
||||||
WARN_FLAGS = -Wno-write-strings -Wno-multichar
|
|
||||||
endif
|
|
||||||
|
|
||||||
WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type -fdiagnostics-show-option -Wformat -Wformat-security
|
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(OS),Linux)
|
|
||||||
# We should always specify -Wl,--build-id, as documented at:
|
|
||||||
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
|
|
||||||
LDFLAGS += -Wl,--build-id
|
|
||||||
# Set USE_VALVE_BINDIR to build with /Steam/tools/linux in the /valve/bin path.
|
|
||||||
# Dedicated server uses this.
|
|
||||||
ifeq ($(USE_VALVE_BINDIR),1)
|
|
||||||
# dedicated server flags
|
|
||||||
ifeq ($(TARGET_PLATFORM),linux64)
|
|
||||||
VALVE_BINDIR = /valve/bin64/
|
|
||||||
MARCH_TARGET = nocona
|
|
||||||
else
|
|
||||||
VALVE_BINDIR = /valve/bin/
|
|
||||||
MARCH_TARGET = pentium4
|
|
||||||
endif
|
|
||||||
STRIP_FLAGS =
|
|
||||||
else
|
|
||||||
# linux desktop client flags
|
|
||||||
VALVE_BINDIR =
|
|
||||||
# If the steam-runtime is available, use it. We should just default to using it when
|
|
||||||
# buildbot and everyone has a bit of time to get it installed.
|
|
||||||
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
|
|
||||||
# The steam-runtime is incompatible with clang at this point, so disable it
|
|
||||||
# if clang is enabled.
|
|
||||||
ifneq ($(CXX),clang++)
|
|
||||||
VALVE_BINDIR = /valve/steam-runtime/bin/
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
GCC_VER =
|
|
||||||
MARCH_TARGET = pentium4
|
|
||||||
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
|
|
||||||
# So symbols like _Z16ClearMultiDamagev should show up when you do "nm server_srv.so" in TF2.
|
|
||||||
STRIP_FLAGS = -x
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CXX),clang++)
|
|
||||||
# Clang does not support -mfpmath=sse because it uses whatever
|
|
||||||
# instruction set extensions are available by default.
|
|
||||||
SSE_GEN_FLAGS = -msse2
|
|
||||||
else
|
|
||||||
SSE_GEN_FLAGS = -msse2 -mfpmath=sse
|
|
||||||
endif
|
|
||||||
|
|
||||||
CCACHE := $(SRCROOT)/devtools/bin/linux/ccache
|
|
||||||
|
|
||||||
ifeq ($(origin GCC_VER), undefined)
|
|
||||||
GCC_VER=-4.6
|
|
||||||
endif
|
|
||||||
ifeq ($(origin AR), default)
|
|
||||||
AR = $(VALVE_BINDIR)ar crs
|
|
||||||
endif
|
|
||||||
ifeq ($(origin CC),default)
|
|
||||||
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
|
|
||||||
endif
|
|
||||||
ifeq ($(origin CXX), default)
|
|
||||||
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
|
|
||||||
endif
|
|
||||||
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
|
|
||||||
# a ccache quirk. Could also upgrade ccache.
|
|
||||||
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
|
|
||||||
ifeq ($(CC),clang)
|
|
||||||
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
|
|
||||||
endif
|
|
||||||
ifeq ($(CXX),clang++)
|
|
||||||
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
|
|
||||||
endif
|
|
||||||
LINK ?= $(CC)
|
|
||||||
|
|
||||||
ifeq ($(TARGET_PLATFORM),linux64)
|
|
||||||
# nocona = pentium4 + 64bit + MMX, SSE, SSE2, SSE3 - no SSSE3 (that's three s's - added in core2)
|
|
||||||
ARCH_FLAGS += -march=$(MARCH_TARGET) -mtune=core2
|
|
||||||
LD_SO = ld-linux-x86_64.so.2
|
|
||||||
LIBSTDCXX := $(shell $(CXX) -print-file-name=libstdc++.a)
|
|
||||||
LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a)
|
|
||||||
else
|
|
||||||
# pentium4 = MMX, SSE, SSE2 - no SSE3 (added in prescott) # -msse3 -mfpmath=sse
|
|
||||||
ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS)
|
|
||||||
LD_SO = ld-linux.so.2
|
|
||||||
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
|
|
||||||
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
|
|
||||||
LDFLAGS += -m32
|
|
||||||
endif
|
|
||||||
|
|
||||||
GEN_SYM ?= $(SRCROOT)/devtools/gendbg.sh
|
|
||||||
ifeq ($(CFG),release)
|
|
||||||
STRIP ?= strip $(STRIP_FLAGS) -S
|
|
||||||
# CFLAGS += -ffunction-sections -fdata-sections
|
|
||||||
# LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections
|
|
||||||
else
|
|
||||||
STRIP ?= true
|
|
||||||
endif
|
|
||||||
VSIGN ?= true
|
|
||||||
|
|
||||||
ifeq ($(SOURCE_SDK), 1)
|
|
||||||
Srv_GAMEOUTPUTFILE := $(GAMEOUTPUTFILE:.so=_srv.so)
|
|
||||||
COPY_DLL_TO_SRV := 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
LINK_MAP_FLAGS = -Wl,-Map,$(@:.so=).map
|
|
||||||
|
|
||||||
SHLIBLDFLAGS = -shared $(LDFLAGS) -Wl,--no-undefined
|
|
||||||
|
|
||||||
_WRAP := -Xlinker --wrap=
|
|
||||||
PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRAP)access $(_WRAP)__xstat \
|
|
||||||
$(_WRAP)stat $(_WRAP)lstat $(_WRAP)fopen64 $(_WRAP)open64 $(_WRAP)opendir $(_WRAP)__lxstat \
|
|
||||||
$(_WRAP)chmod $(_WRAP)chown $(_WRAP)lchown $(_WRAP)symlink $(_WRAP)link $(_WRAP)__lxstat64 \
|
|
||||||
$(_WRAP)mknod $(_WRAP)utimes $(_WRAP)unlink $(_WRAP)rename $(_WRAP)utime $(_WRAP)__xstat64 \
|
|
||||||
$(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath
|
|
||||||
|
|
||||||
LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group
|
|
||||||
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread
|
|
||||||
|
|
||||||
LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group
|
|
||||||
LIB_END_SHLIB = -Wl,--end-group -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OS),Darwin)
|
|
||||||
CCACHE := $(SRCROOT)/devtools/bin/osx32/ccache
|
|
||||||
MAC_SDK_VER ?= 10.6
|
|
||||||
MAC_SDK := macosx$(MAC_SDK_VER)
|
|
||||||
SYSROOT := $(shell xcodebuild -sdk $(MAC_SDK) -version Path)
|
|
||||||
|
|
||||||
ifneq ($(origin MAC_SDK_VER), file)
|
|
||||||
$(warning Attempting build with SDK version $(MAC_SDK_VER), only 10.6 is supported and recommended!)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(SYSROOT),)
|
|
||||||
FIRSTSDK := $(firstword $(sort $(shell xcodebuild -showsdks | grep macosx | sed 's/.*macosx//')))
|
|
||||||
$(error Could not find SDK version $(MAC_SDK_VER). Install and configure Xcode 4.3, or build with: make MAC_SDK_VER=$(FIRSTSDK))
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(origin CC), default)
|
|
||||||
# Test to see if you have a compiler in the right place, if you
|
|
||||||
# don't abort with an error
|
|
||||||
CLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang)
|
|
||||||
ifeq ($(wildcard $(CLANG)),)
|
|
||||||
$(error Unable to find C compiler, install and configure Xcode 4.3)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CC := $(CCACHE) $(CLANG) -Qunused-arguments
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(origin CXX), default)
|
|
||||||
CXXLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang++)
|
|
||||||
ifeq ($(wildcard $(CXXLANG)),)
|
|
||||||
$(error Unable to find C++ compiler, install and configure Xcode 4.3)
|
|
||||||
endif
|
|
||||||
|
|
||||||
CXX := $(CCACHE) $(CXXLANG) -Qunused-arguments
|
|
||||||
endif
|
|
||||||
LINK ?= $(CXX)
|
|
||||||
|
|
||||||
ifeq ($(origin AR), default)
|
|
||||||
AR := $(shell xcrun -sdk $(MAC_SDK) -find libtool) -static -o
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(TARGET_PLATFORM),osx64)
|
|
||||||
ARCH_FLAGS += -arch x86_64 -m64 -march=core2
|
|
||||||
else ifeq (,$(findstring -arch x86_64,$(GCC_ExtraCompilerFlags)))
|
|
||||||
ARCH_FLAGS += -arch i386 -m32 -march=prescott -momit-leaf-frame-pointer -mtune=core2
|
|
||||||
else
|
|
||||||
# dirty hack to build a universal binary - don't specify the architecture
|
|
||||||
ARCH_FLAGS += -arch i386 -Xarch_i386 -march=prescott -Xarch_i386 -mtune=core2 -Xarch_i386 -momit-leaf-frame-pointer -Xarch_x86_64 -march=core2
|
|
||||||
endif
|
|
||||||
|
|
||||||
GEN_SYM ?= $(shell xcrun -sdk $(MAC_SDK) -find dsymutil)
|
|
||||||
ifeq ($(CFG),release)
|
|
||||||
STRIP ?= strip -S
|
|
||||||
else
|
|
||||||
STRIP ?= true
|
|
||||||
endif
|
|
||||||
ifeq ($(SOURCE_SDK), 1)
|
|
||||||
VSIGN ?= true
|
|
||||||
else
|
|
||||||
VSIGN ?= $(SRCROOT)/devtools/bin/vsign
|
|
||||||
endif
|
|
||||||
|
|
||||||
CPPFLAGS += -I$(SYSROOT)/usr/include/malloc
|
|
||||||
CFLAGS += -isysroot $(SYSROOT) -mmacosx-version-min=10.5 -fasm-blocks
|
|
||||||
|
|
||||||
LIB_START_EXE = -lm -ldl -lpthread
|
|
||||||
LIB_END_EXE =
|
|
||||||
|
|
||||||
LIB_START_SHLIB =
|
|
||||||
LIB_END_SHLIB =
|
|
||||||
|
|
||||||
SHLIBLDFLAGS = $(LDFLAGS) -bundle -flat_namespace -undefined suppress -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
|
||||||
|
|
||||||
ifeq (lib,$(findstring lib,$(GAMEOUTPUTFILE)))
|
|
||||||
SHLIBLDFLAGS = $(LDFLAGS) -dynamiclib -current_version 1.0 -compatibility_version 1.0 -install_name @rpath/$(basename $(notdir $(GAMEOUTPUTFILE))).dylib $(SystemLibraries) -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
#
|
|
||||||
# Profile-directed optimizations.
|
|
||||||
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
|
|
||||||
#
|
|
||||||
# First, uncomment these, build, and test. It will generate .gcda and .gcno files where the .o files are.
|
|
||||||
# PROFILE_LINKER_FLAG=-fprofile-arcs
|
|
||||||
# PROFILE_COMPILER_FLAG=-fprofile-arcs
|
|
||||||
#
|
|
||||||
# Then, comment the above flags out again and rebuild with this flag uncommented:
|
|
||||||
# PROFILE_COMPILER_FLAG=-fprofile-use
|
|
||||||
#
|
|
||||||
|
|
||||||
#############################################################################
|
|
||||||
# The compiler command lne for each src code file to compile
|
|
||||||
#############################################################################
|
|
||||||
|
|
||||||
OBJ_DIR = ./obj_$(NAME)_$(TARGET_PLATFORM)$(TARGET_PLATFORM_EXT)/$(CFG)
|
|
||||||
CPP_TO_OBJ = $(CPPFILES:.cpp=.o)
|
|
||||||
CXX_TO_OBJ = $(CPP_TO_OBJ:.cxx=.o)
|
|
||||||
CC_TO_OBJ = $(CXX_TO_OBJ:.cc=.o)
|
|
||||||
MM_TO_OBJ = $(CC_TO_OBJ:.mm=.o)
|
|
||||||
C_TO_OBJ = $(MM_TO_OBJ:.c=.o)
|
|
||||||
OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_TO_OBJ)))
|
|
||||||
|
|
||||||
ifeq ($(MAKE_VERBOSE),1)
|
|
||||||
QUIET_PREFIX =
|
|
||||||
QUIET_ECHO_POSTFIX =
|
|
||||||
else
|
|
||||||
QUIET_PREFIX = @
|
|
||||||
QUIET_ECHO_POSTFIX = > /dev/null
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(MAKE_CC_VERBOSE),1)
|
|
||||||
CC += -v
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFTYPE),lib)
|
|
||||||
LIB_File = $(OUTPUTFILE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFTYPE),dll)
|
|
||||||
SO_File = $(OUTPUTFILE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFTYPE),exe)
|
|
||||||
EXE_File = $(OUTPUTFILE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# we generate dependencies as a side-effect of compilation now
|
|
||||||
GEN_DEP_FILE=
|
|
||||||
|
|
||||||
PRE_COMPILE_FILE =
|
|
||||||
|
|
||||||
POST_COMPILE_FILE =
|
|
||||||
|
|
||||||
ifeq ($(BUILDING_MULTI_ARCH),1)
|
|
||||||
SINGLE_ARCH_CXXFLAGS=$(subst -arch x86_64,,$(CXXFLAGS))
|
|
||||||
COMPILE_FILE = \
|
|
||||||
$(QUIET_PREFIX) \
|
|
||||||
echo "---- $(lastword $(subst /, ,$<)) as MULTIARCH----";\
|
|
||||||
mkdir -p $(OBJ_DIR) && \
|
|
||||||
$(CXX) $(SINGLE_ARCH_CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $< && \
|
|
||||||
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
|
||||||
else
|
|
||||||
COMPILE_FILE = \
|
|
||||||
$(QUIET_PREFIX) \
|
|
||||||
echo "---- $(lastword $(subst /, ,$<)) ----";\
|
|
||||||
mkdir -p $(OBJ_DIR) && \
|
|
||||||
$(CXX) $(CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $<
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq "$(origin VALVE_NO_AUTO_P4)" "undefined"
|
|
||||||
P4_EDIT_START = chmod -R +w
|
|
||||||
P4_EDIT_END = || true
|
|
||||||
P4_REVERT_START = true
|
|
||||||
P4_REVERT_END =
|
|
||||||
else
|
|
||||||
ifndef P4_EDIT_CHANGELIST
|
|
||||||
# You can use an environment variable to specify what changelist to check the Linux Binaries out into. Normally the default
|
|
||||||
# setting is best, but here is an alternate example:
|
|
||||||
# export P4_EDIT_CHANGELIST_CMD="echo 1424335"
|
|
||||||
# ?= means that if P4_EDIT_CHANGELIST_CMD is already set it won't be changed.
|
|
||||||
P4_EDIT_CHANGELIST_CMD ?= p4 changes -c `p4 client -o | grep ^Client | cut -f 2` -s pending | fgrep 'POSIX Auto Checkout' | cut -d' ' -f 2 | tail -n 1
|
|
||||||
P4_EDIT_CHANGELIST := $(shell $(P4_EDIT_CHANGELIST_CMD))
|
|
||||||
endif
|
|
||||||
ifeq ($(P4_EDIT_CHANGELIST),)
|
|
||||||
# If we haven't found a changelist to check out to then create one. The name must match the one from a few
|
|
||||||
# lines above or else a new changelist will be created each time.
|
|
||||||
# Warning: the behavior of 'echo' is not consistent. In bash you need the "-e" option in order for \n to be
|
|
||||||
# interpreted as a line-feed, but in dash you do not, and if "-e" is passed along then it is printed, which
|
|
||||||
# confuses p4. So, if you run this command from the bash shell don't forget to add "-e" to the echo command.
|
|
||||||
P4_EDIT_CHANGELIST = $(shell echo "Change: new\nDescription: POSIX Auto Checkout" | p4 change -i | cut -f 2 -d ' ')
|
|
||||||
endif
|
|
||||||
|
|
||||||
P4_EDIT_START := for f in
|
|
||||||
P4_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - edit -c $(P4_EDIT_CHANGELIST); else p4 edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
|
|
||||||
P4_REVERT_START := for f in
|
|
||||||
P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - revert; else p4 revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(CONFTYPE),dll)
|
|
||||||
all: $(OTHER_DEPENDENCIES) $(OBJS) $(GAMEOUTPUTFILE)
|
|
||||||
@echo $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX)
|
|
||||||
else
|
|
||||||
all: $(OTHER_DEPENDENCIES) $(OBJS) $(OUTPUTFILE)
|
|
||||||
@echo $(OUTPUTFILE) $(QUIET_ECHO_POSTFIX)
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: clean cleantargets cleanandremove rebuild relink RemoveOutputFile SingleFile
|
|
||||||
|
|
||||||
|
|
||||||
rebuild :
|
|
||||||
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) cleanandremove
|
|
||||||
$(MAKE) -f $(firstword $(MAKEFILE_LIST))
|
|
||||||
|
|
||||||
|
|
||||||
# Use the relink target to force to relink the project.
|
|
||||||
relink: RemoveOutputFile all
|
|
||||||
|
|
||||||
RemoveOutputFile:
|
|
||||||
rm -f $(OUTPUTFILE)
|
|
||||||
|
|
||||||
|
|
||||||
# This rule is so you can say "make SingleFile SingleFilename=/home/myname/valve_main/src/engine/language.cpp" and have it only build that file.
|
|
||||||
# It basically just translates the full filename to create a dependency on the appropriate .o file so it'll build that.
|
|
||||||
SingleFile : RemoveSingleFile $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
|
|
||||||
@echo ""
|
|
||||||
|
|
||||||
RemoveSingleFile:
|
|
||||||
$(QUIET_PREFIX) rm -f $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
|
|
||||||
|
|
||||||
clean:
|
|
||||||
ifneq "$(OBJ_DIR)" ""
|
|
||||||
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
|
|
||||||
$(QUIET_PREFIX) rm -rf $(OBJ_DIR)
|
|
||||||
endif
|
|
||||||
ifneq "$(OUTPUTFILE)" ""
|
|
||||||
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
|
|
||||||
echo "p4 revert $(OUTPUTFILE)"; \
|
|
||||||
$(P4_REVERT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END); \
|
|
||||||
fi;
|
|
||||||
endif
|
|
||||||
ifneq "$(OTHER_DEPENDENCIES)" ""
|
|
||||||
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
|
|
||||||
$(QUIET_PREFIX) rm -f $(OTHER_DEPENDENCIES)
|
|
||||||
endif
|
|
||||||
ifneq "$(GAMEOUTPUTFILE)" ""
|
|
||||||
$(QUIET_PREFIX) echo "p4 revert $(GAMEOUTPUTFILE)"
|
|
||||||
$(QUIET_PREFIX) $(P4_REVERT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# Do the above cleaning, except with p4 edit and rm. Reason being ar crs adds and replaces obj files to the
|
|
||||||
# archive. However if you've renamed or deleted a source file, $(AR) won't remove it. This can leave
|
|
||||||
# us with archive files that have extra unused symbols, and also potentially cause compilation errors
|
|
||||||
# when you rename a file and have many duplicate symbols.
|
|
||||||
cleanandremove:
|
|
||||||
ifneq "$(OBJ_DIR)" ""
|
|
||||||
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
|
|
||||||
$(QUIET_PREFIX) -rm -rf $(OBJ_DIR)
|
|
||||||
endif
|
|
||||||
ifneq "$(OUTPUTFILE)" ""
|
|
||||||
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
|
|
||||||
echo "p4 edit and rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT)"; \
|
|
||||||
$(P4_EDIT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); \
|
|
||||||
fi;
|
|
||||||
$(QUIET_PREFIX) -rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT);
|
|
||||||
endif
|
|
||||||
ifneq "$(OTHER_DEPENDENCIES)" ""
|
|
||||||
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
|
|
||||||
$(QUIET_PREFIX) -rm -f $(OTHER_DEPENDENCIES)
|
|
||||||
endif
|
|
||||||
ifneq "$(GAMEOUTPUTFILE)" ""
|
|
||||||
$(QUIET_PREFIX) echo "p4 edit and rm -f $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT)"
|
|
||||||
$(QUIET_PREFIX) $(P4_EDIT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END)
|
|
||||||
$(QUIET_PREFIX) -rm -f $(GAMEOUTPUTFILE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
|
|
||||||
# This just deletes the final targets so it'll do a relink next time we build.
|
|
||||||
cleantargets:
|
|
||||||
$(QUIET_PREFIX) rm -f $(OUTPUTFILE) $(GAMEOUTPUTFILE)
|
|
||||||
|
|
||||||
|
|
||||||
$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS)
|
|
||||||
$(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END);
|
|
||||||
$(QUIET_PREFIX) $(AR) $(LIB_File) $(OBJS) $(LIBFILES);
|
|
||||||
|
|
||||||
SO_GameOutputFile = $(GAMEOUTPUTFILE)
|
|
||||||
|
|
||||||
# Remove the target before installing a file over it; this prevents existing
|
|
||||||
# instances of the game from crashing due to the overwrite.
|
|
||||||
$(SO_GameOutputFile): $(SO_File)
|
|
||||||
$(QUIET_PREFIX) \
|
|
||||||
$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END) && \
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
|
||||||
echo "---- COPYING TO $@ [$(CFG)] ----";\
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);
|
|
||||||
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END);
|
|
||||||
$(QUIET_PREFIX) -mkdir -p `dirname $(GAMEOUTPUTFILE)` > /dev/null;
|
|
||||||
$(QUIET_PREFIX) rm -f $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
|
|
||||||
$(QUIET_PREFIX) cp -v $(OUTPUTFILE) $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
|
|
||||||
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
|
|
||||||
$(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE);
|
|
||||||
$(QUIET_PREFIX) -$(STRIP) $(GAMEOUTPUTFILE);
|
|
||||||
$(QUIET_PREFIX) $(VSIGN) -signvalve $(GAMEOUTPUTFILE);
|
|
||||||
$(QUIET_PREFIX) if [ "$(COPY_DLL_TO_SRV)" = "1" ]; then\
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
|
||||||
echo "---- COPYING TO $(Srv_GAMEOUTPUTFILE) ----";\
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
|
||||||
cp -v $(GAMEOUTPUTFILE) $(Srv_GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);\
|
|
||||||
cp -v $(GAMEOUTPUTFILE)$(SYM_EXT) $(Srv_GAMEOUTPUTFILE)$(SYM_EXT) $(QUIET_ECHO_POSTFIX);\
|
|
||||||
fi;
|
|
||||||
$(QUIET_PREFIX) if [ "$(IMPORTLIBRARY)" != "" ]; then\
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
|
||||||
echo "---- COPYING TO IMPORT LIBRARY $(IMPORTLIBRARY) ----";\
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
|
||||||
$(P4_EDIT_START) $(IMPORTLIBRARY) $(P4_EDIT_END) && \
|
|
||||||
mkdir -p `dirname $(IMPORTLIBRARY)` > /dev/null && \
|
|
||||||
cp -v $(OUTPUTFILE) $(IMPORTLIBRARY); \
|
|
||||||
fi;
|
|
||||||
|
|
||||||
|
|
||||||
$(SO_File): $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
|
|
||||||
$(QUIET_PREFIX) \
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
|
||||||
echo "---- LINKING $@ [$(CFG)] ----";\
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
|
||||||
\
|
|
||||||
$(LINK) $(LINK_MAP_FLAGS) $(SHLIBLDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_SHLIB) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_SHLIB);
|
|
||||||
$(VSIGN) -signvalve $(OUTPUTFILE);
|
|
||||||
|
|
||||||
|
|
||||||
$(EXE_File) : $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
|
|
||||||
$(QUIET_PREFIX) \
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
|
||||||
echo "---- LINKING EXE $@ [$(CFG)] ----";\
|
|
||||||
echo "----" $(QUIET_ECHO_POSTFIX);\
|
|
||||||
\
|
|
||||||
$(P4_EDIT_START) $(OUTPUTFILE) $(P4_EDIT_END);\
|
|
||||||
$(LINK) $(LINK_MAP_FLAGS) $(LDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_EXE) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_EXE);
|
|
||||||
$(QUIET_PREFIX) -$(P4_EDIT_START) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
|
|
||||||
$(QUIET_PREFIX) $(GEN_SYM) $(OUTPUTFILE);
|
|
||||||
$(QUIET_PREFIX) -$(STRIP) $(OUTPUTFILE);
|
|
||||||
$(QUIET_PREFIX) $(VSIGN) -signvalve $(OUTPUTFILE);
|
|
||||||
|
|
||||||
|
|
||||||
tags:
|
|
||||||
etags -a -C -o $(SRCROOT)/TAGS *.cpp *.cxx *.h *.hxx
|
|
||||||
|
509
sp/src/devtools/makefile_base_posix.mak.default
Normal file
509
sp/src/devtools/makefile_base_posix.mak.default
Normal file
@ -0,0 +1,509 @@
|
|||||||
|
#
|
||||||
|
# Base makefile for Linux and OSX
|
||||||
|
#
|
||||||
|
# !!!!! Note to future editors !!!!!
|
||||||
|
#
|
||||||
|
# before you make changes, make sure you grok:
|
||||||
|
# 1. the difference between =, :=, +=, and ?=
|
||||||
|
# 2. how and when this base makefile gets included in the generated makefile(s)
|
||||||
|
# ( see http://www.gnu.org/software/make/manual/make.html#Flavors )
|
||||||
|
#
|
||||||
|
# Command line prefixes:
|
||||||
|
# - errors are ignored
|
||||||
|
# @ command is not printed to stdout before being executed
|
||||||
|
# + command is executed even if Make is invoked in "do not exec" mode
|
||||||
|
|
||||||
|
OS := $(shell uname)
|
||||||
|
HOSTNAME := $(shell hostname)
|
||||||
|
|
||||||
|
-include $(SRCROOT)/devtools/steam_def.mak
|
||||||
|
-include $(SRCROOT)/devtools/sourcesdk_def.mak
|
||||||
|
|
||||||
|
# To build with clang, set the following in your environment:
|
||||||
|
# CC = clang
|
||||||
|
# CXX = clang++
|
||||||
|
|
||||||
|
ifeq ($(CFG), release)
|
||||||
|
# With gcc 4.6.3, engine.so went from 7,383,765 to 8,429,109 when building with -O3.
|
||||||
|
# There also was no speed difference running at 1280x1024. May 2012, mikesart.
|
||||||
|
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
|
||||||
|
# -fno-omit-frame-pointer: need this for stack traces with perf.
|
||||||
|
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize -fpredictive-commoning -funswitch-loops
|
||||||
|
else
|
||||||
|
OptimizerLevel_CompilerSpecific = -O0
|
||||||
|
#-O1 -finline-functions
|
||||||
|
endif
|
||||||
|
|
||||||
|
# CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags"
|
||||||
|
ARCH_FLAGS =
|
||||||
|
BUILDING_MULTI_ARCH = 0
|
||||||
|
CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) ))
|
||||||
|
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
|
||||||
|
# In -std=gnu++0x mode we get lots of errors about "error: narrowing conversion". -fpermissive
|
||||||
|
# turns these into warnings in gcc, and -Wno-c++11-narrowing suppresses them entirely in clang 3.1+.
|
||||||
|
ifeq ($(CXX),clang++)
|
||||||
|
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
|
||||||
|
else
|
||||||
|
CXXFLAGS = $(CFLAGS) -std=gnu++0x -fpermissive
|
||||||
|
endif
|
||||||
|
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
|
||||||
|
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
|
||||||
|
GENDEP_CXXFLAGS = -MD -MP -MF $(@:.o=.P)
|
||||||
|
MAP_FLAGS =
|
||||||
|
Srv_GAMEOUTPUTFILE =
|
||||||
|
COPY_DLL_TO_SRV = 0
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(STEAM_BRANCH),1)
|
||||||
|
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
|
||||||
|
else
|
||||||
|
WARN_FLAGS = -Wno-write-strings -Wno-multichar
|
||||||
|
endif
|
||||||
|
|
||||||
|
WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type -fdiagnostics-show-option -Wformat -Wformat-security
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(OS),Linux)
|
||||||
|
# We should always specify -Wl,--build-id, as documented at:
|
||||||
|
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
|
||||||
|
LDFLAGS += -Wl,--build-id
|
||||||
|
# Set USE_VALVE_BINDIR to build with /Steam/tools/linux in the /valve/bin path.
|
||||||
|
# Dedicated server uses this.
|
||||||
|
ifeq ($(USE_VALVE_BINDIR),1)
|
||||||
|
# dedicated server flags
|
||||||
|
ifeq ($(TARGET_PLATFORM),linux64)
|
||||||
|
VALVE_BINDIR = /valve/bin64/
|
||||||
|
MARCH_TARGET = nocona
|
||||||
|
else
|
||||||
|
VALVE_BINDIR = /valve/bin/
|
||||||
|
MARCH_TARGET = pentium4
|
||||||
|
endif
|
||||||
|
STRIP_FLAGS =
|
||||||
|
else
|
||||||
|
# linux desktop client flags
|
||||||
|
VALVE_BINDIR =
|
||||||
|
# If the steam-runtime is available, use it. We should just default to using it when
|
||||||
|
# buildbot and everyone has a bit of time to get it installed.
|
||||||
|
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
|
||||||
|
# The steam-runtime is incompatible with clang at this point, so disable it
|
||||||
|
# if clang is enabled.
|
||||||
|
ifneq ($(CXX),clang++)
|
||||||
|
VALVE_BINDIR = /valve/steam-runtime/bin/
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
GCC_VER =
|
||||||
|
MARCH_TARGET = pentium4
|
||||||
|
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
|
||||||
|
# So symbols like _Z16ClearMultiDamagev should show up when you do "nm server_srv.so" in TF2.
|
||||||
|
STRIP_FLAGS = -x
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CXX),clang++)
|
||||||
|
# Clang does not support -mfpmath=sse because it uses whatever
|
||||||
|
# instruction set extensions are available by default.
|
||||||
|
SSE_GEN_FLAGS = -msse2
|
||||||
|
else
|
||||||
|
SSE_GEN_FLAGS = -msse2 -mfpmath=sse
|
||||||
|
endif
|
||||||
|
|
||||||
|
CCACHE := $(SRCROOT)/devtools/bin/linux/ccache
|
||||||
|
|
||||||
|
ifeq ($(origin GCC_VER), undefined)
|
||||||
|
GCC_VER=-4.6
|
||||||
|
endif
|
||||||
|
ifeq ($(origin AR), default)
|
||||||
|
AR = $(VALVE_BINDIR)ar crs
|
||||||
|
endif
|
||||||
|
ifeq ($(origin CC),default)
|
||||||
|
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
|
||||||
|
endif
|
||||||
|
ifeq ($(origin CXX), default)
|
||||||
|
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
|
||||||
|
endif
|
||||||
|
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
|
||||||
|
# a ccache quirk. Could also upgrade ccache.
|
||||||
|
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
|
||||||
|
ifeq ($(CC),clang)
|
||||||
|
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
|
||||||
|
endif
|
||||||
|
ifeq ($(CXX),clang++)
|
||||||
|
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
|
||||||
|
endif
|
||||||
|
LINK ?= $(CC)
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),linux64)
|
||||||
|
# nocona = pentium4 + 64bit + MMX, SSE, SSE2, SSE3 - no SSSE3 (that's three s's - added in core2)
|
||||||
|
ARCH_FLAGS += -march=$(MARCH_TARGET) -mtune=core2
|
||||||
|
LD_SO = ld-linux-x86_64.so.2
|
||||||
|
LIBSTDCXX := $(shell $(CXX) -print-file-name=libstdc++.a)
|
||||||
|
LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a)
|
||||||
|
else
|
||||||
|
# pentium4 = MMX, SSE, SSE2 - no SSE3 (added in prescott) # -msse3 -mfpmath=sse
|
||||||
|
ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS)
|
||||||
|
LD_SO = ld-linux.so.2
|
||||||
|
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
|
||||||
|
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
|
||||||
|
LDFLAGS += -m32
|
||||||
|
endif
|
||||||
|
|
||||||
|
GEN_SYM ?= $(SRCROOT)/devtools/gendbg.sh
|
||||||
|
ifeq ($(CFG),release)
|
||||||
|
STRIP ?= strip $(STRIP_FLAGS) -S
|
||||||
|
# CFLAGS += -ffunction-sections -fdata-sections
|
||||||
|
# LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections
|
||||||
|
else
|
||||||
|
STRIP ?= true
|
||||||
|
endif
|
||||||
|
VSIGN ?= true
|
||||||
|
|
||||||
|
ifeq ($(SOURCE_SDK), 1)
|
||||||
|
Srv_GAMEOUTPUTFILE := $(GAMEOUTPUTFILE:.so=_srv.so)
|
||||||
|
COPY_DLL_TO_SRV := 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
LINK_MAP_FLAGS = -Wl,-Map,$(@:.so=).map
|
||||||
|
|
||||||
|
SHLIBLDFLAGS = -shared $(LDFLAGS) -Wl,--no-undefined
|
||||||
|
|
||||||
|
_WRAP := -Xlinker --wrap=
|
||||||
|
PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRAP)access $(_WRAP)__xstat \
|
||||||
|
$(_WRAP)stat $(_WRAP)lstat $(_WRAP)fopen64 $(_WRAP)open64 $(_WRAP)opendir $(_WRAP)__lxstat \
|
||||||
|
$(_WRAP)chmod $(_WRAP)chown $(_WRAP)lchown $(_WRAP)symlink $(_WRAP)link $(_WRAP)__lxstat64 \
|
||||||
|
$(_WRAP)mknod $(_WRAP)utimes $(_WRAP)unlink $(_WRAP)rename $(_WRAP)utime $(_WRAP)__xstat64 \
|
||||||
|
$(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath
|
||||||
|
|
||||||
|
LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group
|
||||||
|
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread
|
||||||
|
|
||||||
|
LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group
|
||||||
|
LIB_END_SHLIB = -Wl,--end-group -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OS),Darwin)
|
||||||
|
CCACHE := $(SRCROOT)/devtools/bin/osx32/ccache
|
||||||
|
MAC_SDK_VER ?= 10.6
|
||||||
|
MAC_SDK := macosx$(MAC_SDK_VER)
|
||||||
|
SYSROOT := $(shell xcodebuild -sdk $(MAC_SDK) -version Path)
|
||||||
|
|
||||||
|
ifneq ($(origin MAC_SDK_VER), file)
|
||||||
|
$(warning Attempting build with SDK version $(MAC_SDK_VER), only 10.6 is supported and recommended!)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(SYSROOT),)
|
||||||
|
FIRSTSDK := $(firstword $(sort $(shell xcodebuild -showsdks | grep macosx | sed 's/.*macosx//')))
|
||||||
|
$(error Could not find SDK version $(MAC_SDK_VER). Install and configure Xcode 4.3, or build with: make MAC_SDK_VER=$(FIRSTSDK))
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(origin CC), default)
|
||||||
|
# Test to see if you have a compiler in the right place, if you
|
||||||
|
# don't abort with an error
|
||||||
|
CLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang)
|
||||||
|
ifeq ($(wildcard $(CLANG)),)
|
||||||
|
$(error Unable to find C compiler, install and configure Xcode 4.3)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC := $(CCACHE) $(CLANG) -Qunused-arguments
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(origin CXX), default)
|
||||||
|
CXXLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang++)
|
||||||
|
ifeq ($(wildcard $(CXXLANG)),)
|
||||||
|
$(error Unable to find C++ compiler, install and configure Xcode 4.3)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CXX := $(CCACHE) $(CXXLANG) -Qunused-arguments
|
||||||
|
endif
|
||||||
|
LINK ?= $(CXX)
|
||||||
|
|
||||||
|
ifeq ($(origin AR), default)
|
||||||
|
AR := $(shell xcrun -sdk $(MAC_SDK) -find libtool) -static -o
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),osx64)
|
||||||
|
ARCH_FLAGS += -arch x86_64 -m64 -march=core2
|
||||||
|
else ifeq (,$(findstring -arch x86_64,$(GCC_ExtraCompilerFlags)))
|
||||||
|
ARCH_FLAGS += -arch i386 -m32 -march=prescott -momit-leaf-frame-pointer -mtune=core2
|
||||||
|
else
|
||||||
|
# dirty hack to build a universal binary - don't specify the architecture
|
||||||
|
ARCH_FLAGS += -arch i386 -Xarch_i386 -march=prescott -Xarch_i386 -mtune=core2 -Xarch_i386 -momit-leaf-frame-pointer -Xarch_x86_64 -march=core2
|
||||||
|
endif
|
||||||
|
|
||||||
|
GEN_SYM ?= $(shell xcrun -sdk $(MAC_SDK) -find dsymutil)
|
||||||
|
ifeq ($(CFG),release)
|
||||||
|
STRIP ?= strip -S
|
||||||
|
else
|
||||||
|
STRIP ?= true
|
||||||
|
endif
|
||||||
|
ifeq ($(SOURCE_SDK), 1)
|
||||||
|
VSIGN ?= true
|
||||||
|
else
|
||||||
|
VSIGN ?= $(SRCROOT)/devtools/bin/vsign
|
||||||
|
endif
|
||||||
|
|
||||||
|
CPPFLAGS += -I$(SYSROOT)/usr/include/malloc
|
||||||
|
CFLAGS += -isysroot $(SYSROOT) -mmacosx-version-min=10.5 -fasm-blocks
|
||||||
|
|
||||||
|
LIB_START_EXE = -lm -ldl -lpthread
|
||||||
|
LIB_END_EXE =
|
||||||
|
|
||||||
|
LIB_START_SHLIB =
|
||||||
|
LIB_END_SHLIB =
|
||||||
|
|
||||||
|
SHLIBLDFLAGS = $(LDFLAGS) -bundle -flat_namespace -undefined suppress -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
||||||
|
|
||||||
|
ifeq (lib,$(findstring lib,$(GAMEOUTPUTFILE)))
|
||||||
|
SHLIBLDFLAGS = $(LDFLAGS) -dynamiclib -current_version 1.0 -compatibility_version 1.0 -install_name @rpath/$(basename $(notdir $(GAMEOUTPUTFILE))).dylib $(SystemLibraries) -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
|
# Profile-directed optimizations.
|
||||||
|
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
|
||||||
|
#
|
||||||
|
# First, uncomment these, build, and test. It will generate .gcda and .gcno files where the .o files are.
|
||||||
|
# PROFILE_LINKER_FLAG=-fprofile-arcs
|
||||||
|
# PROFILE_COMPILER_FLAG=-fprofile-arcs
|
||||||
|
#
|
||||||
|
# Then, comment the above flags out again and rebuild with this flag uncommented:
|
||||||
|
# PROFILE_COMPILER_FLAG=-fprofile-use
|
||||||
|
#
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# The compiler command lne for each src code file to compile
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
OBJ_DIR = ./obj_$(NAME)_$(TARGET_PLATFORM)$(TARGET_PLATFORM_EXT)/$(CFG)
|
||||||
|
CPP_TO_OBJ = $(CPPFILES:.cpp=.o)
|
||||||
|
CXX_TO_OBJ = $(CPP_TO_OBJ:.cxx=.o)
|
||||||
|
CC_TO_OBJ = $(CXX_TO_OBJ:.cc=.o)
|
||||||
|
MM_TO_OBJ = $(CC_TO_OBJ:.mm=.o)
|
||||||
|
C_TO_OBJ = $(MM_TO_OBJ:.c=.o)
|
||||||
|
OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_TO_OBJ)))
|
||||||
|
|
||||||
|
ifeq ($(MAKE_VERBOSE),1)
|
||||||
|
QUIET_PREFIX =
|
||||||
|
QUIET_ECHO_POSTFIX =
|
||||||
|
else
|
||||||
|
QUIET_PREFIX = @
|
||||||
|
QUIET_ECHO_POSTFIX = > /dev/null
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MAKE_CC_VERBOSE),1)
|
||||||
|
CC += -v
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFTYPE),lib)
|
||||||
|
LIB_File = $(OUTPUTFILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFTYPE),dll)
|
||||||
|
SO_File = $(OUTPUTFILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFTYPE),exe)
|
||||||
|
EXE_File = $(OUTPUTFILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# we generate dependencies as a side-effect of compilation now
|
||||||
|
GEN_DEP_FILE=
|
||||||
|
|
||||||
|
PRE_COMPILE_FILE =
|
||||||
|
|
||||||
|
POST_COMPILE_FILE =
|
||||||
|
|
||||||
|
ifeq ($(BUILDING_MULTI_ARCH),1)
|
||||||
|
SINGLE_ARCH_CXXFLAGS=$(subst -arch x86_64,,$(CXXFLAGS))
|
||||||
|
COMPILE_FILE = \
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
echo "---- $(lastword $(subst /, ,$<)) as MULTIARCH----";\
|
||||||
|
mkdir -p $(OBJ_DIR) && \
|
||||||
|
$(CXX) $(SINGLE_ARCH_CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $< && \
|
||||||
|
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||||
|
else
|
||||||
|
COMPILE_FILE = \
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
echo "---- $(lastword $(subst /, ,$<)) ----";\
|
||||||
|
mkdir -p $(OBJ_DIR) && \
|
||||||
|
$(CXX) $(CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $<
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq "$(origin VALVE_NO_AUTO_P4)" "undefined"
|
||||||
|
P4_EDIT_START = chmod -R +w
|
||||||
|
P4_EDIT_END = || true
|
||||||
|
P4_REVERT_START = true
|
||||||
|
P4_REVERT_END =
|
||||||
|
else
|
||||||
|
ifndef P4_EDIT_CHANGELIST
|
||||||
|
# You can use an environment variable to specify what changelist to check the Linux Binaries out into. Normally the default
|
||||||
|
# setting is best, but here is an alternate example:
|
||||||
|
# export P4_EDIT_CHANGELIST_CMD="echo 1424335"
|
||||||
|
# ?= means that if P4_EDIT_CHANGELIST_CMD is already set it won't be changed.
|
||||||
|
P4_EDIT_CHANGELIST_CMD ?= p4 changes -c `p4 client -o | grep ^Client | cut -f 2` -s pending | fgrep 'POSIX Auto Checkout' | cut -d' ' -f 2 | tail -n 1
|
||||||
|
P4_EDIT_CHANGELIST := $(shell $(P4_EDIT_CHANGELIST_CMD))
|
||||||
|
endif
|
||||||
|
ifeq ($(P4_EDIT_CHANGELIST),)
|
||||||
|
# If we haven't found a changelist to check out to then create one. The name must match the one from a few
|
||||||
|
# lines above or else a new changelist will be created each time.
|
||||||
|
# Warning: the behavior of 'echo' is not consistent. In bash you need the "-e" option in order for \n to be
|
||||||
|
# interpreted as a line-feed, but in dash you do not, and if "-e" is passed along then it is printed, which
|
||||||
|
# confuses p4. So, if you run this command from the bash shell don't forget to add "-e" to the echo command.
|
||||||
|
P4_EDIT_CHANGELIST = $(shell echo "Change: new\nDescription: POSIX Auto Checkout" | p4 change -i | cut -f 2 -d ' ')
|
||||||
|
endif
|
||||||
|
|
||||||
|
P4_EDIT_START := for f in
|
||||||
|
P4_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - edit -c $(P4_EDIT_CHANGELIST); else p4 edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
|
||||||
|
P4_REVERT_START := for f in
|
||||||
|
P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - revert; else p4 revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFTYPE),dll)
|
||||||
|
all: $(OTHER_DEPENDENCIES) $(OBJS) $(GAMEOUTPUTFILE)
|
||||||
|
@echo $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX)
|
||||||
|
else
|
||||||
|
all: $(OTHER_DEPENDENCIES) $(OBJS) $(OUTPUTFILE)
|
||||||
|
@echo $(OUTPUTFILE) $(QUIET_ECHO_POSTFIX)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: clean cleantargets cleanandremove rebuild relink RemoveOutputFile SingleFile
|
||||||
|
|
||||||
|
|
||||||
|
rebuild :
|
||||||
|
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) cleanandremove
|
||||||
|
$(MAKE) -f $(firstword $(MAKEFILE_LIST))
|
||||||
|
|
||||||
|
|
||||||
|
# Use the relink target to force to relink the project.
|
||||||
|
relink: RemoveOutputFile all
|
||||||
|
|
||||||
|
RemoveOutputFile:
|
||||||
|
rm -f $(OUTPUTFILE)
|
||||||
|
|
||||||
|
|
||||||
|
# This rule is so you can say "make SingleFile SingleFilename=/home/myname/valve_main/src/engine/language.cpp" and have it only build that file.
|
||||||
|
# It basically just translates the full filename to create a dependency on the appropriate .o file so it'll build that.
|
||||||
|
SingleFile : RemoveSingleFile $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
|
||||||
|
@echo ""
|
||||||
|
|
||||||
|
RemoveSingleFile:
|
||||||
|
$(QUIET_PREFIX) rm -f $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
|
||||||
|
|
||||||
|
clean:
|
||||||
|
ifneq "$(OBJ_DIR)" ""
|
||||||
|
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
|
||||||
|
$(QUIET_PREFIX) rm -rf $(OBJ_DIR)
|
||||||
|
endif
|
||||||
|
ifneq "$(OUTPUTFILE)" ""
|
||||||
|
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
|
||||||
|
echo "p4 revert $(OUTPUTFILE)"; \
|
||||||
|
$(P4_REVERT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END); \
|
||||||
|
fi;
|
||||||
|
endif
|
||||||
|
ifneq "$(OTHER_DEPENDENCIES)" ""
|
||||||
|
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
|
||||||
|
$(QUIET_PREFIX) rm -f $(OTHER_DEPENDENCIES)
|
||||||
|
endif
|
||||||
|
ifneq "$(GAMEOUTPUTFILE)" ""
|
||||||
|
$(QUIET_PREFIX) echo "p4 revert $(GAMEOUTPUTFILE)"
|
||||||
|
$(QUIET_PREFIX) $(P4_REVERT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# Do the above cleaning, except with p4 edit and rm. Reason being ar crs adds and replaces obj files to the
|
||||||
|
# archive. However if you've renamed or deleted a source file, $(AR) won't remove it. This can leave
|
||||||
|
# us with archive files that have extra unused symbols, and also potentially cause compilation errors
|
||||||
|
# when you rename a file and have many duplicate symbols.
|
||||||
|
cleanandremove:
|
||||||
|
ifneq "$(OBJ_DIR)" ""
|
||||||
|
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
|
||||||
|
$(QUIET_PREFIX) -rm -rf $(OBJ_DIR)
|
||||||
|
endif
|
||||||
|
ifneq "$(OUTPUTFILE)" ""
|
||||||
|
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
|
||||||
|
echo "p4 edit and rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT)"; \
|
||||||
|
$(P4_EDIT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); \
|
||||||
|
fi;
|
||||||
|
$(QUIET_PREFIX) -rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT);
|
||||||
|
endif
|
||||||
|
ifneq "$(OTHER_DEPENDENCIES)" ""
|
||||||
|
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
|
||||||
|
$(QUIET_PREFIX) -rm -f $(OTHER_DEPENDENCIES)
|
||||||
|
endif
|
||||||
|
ifneq "$(GAMEOUTPUTFILE)" ""
|
||||||
|
$(QUIET_PREFIX) echo "p4 edit and rm -f $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT)"
|
||||||
|
$(QUIET_PREFIX) $(P4_EDIT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END)
|
||||||
|
$(QUIET_PREFIX) -rm -f $(GAMEOUTPUTFILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# This just deletes the final targets so it'll do a relink next time we build.
|
||||||
|
cleantargets:
|
||||||
|
$(QUIET_PREFIX) rm -f $(OUTPUTFILE) $(GAMEOUTPUTFILE)
|
||||||
|
|
||||||
|
|
||||||
|
$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS)
|
||||||
|
$(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END);
|
||||||
|
$(QUIET_PREFIX) $(AR) $(LIB_File) $(OBJS) $(LIBFILES);
|
||||||
|
|
||||||
|
SO_GameOutputFile = $(GAMEOUTPUTFILE)
|
||||||
|
|
||||||
|
# Remove the target before installing a file over it; this prevents existing
|
||||||
|
# instances of the game from crashing due to the overwrite.
|
||||||
|
$(SO_GameOutputFile): $(SO_File)
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END) && \
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- COPYING TO $@ [$(CFG)] ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);
|
||||||
|
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END);
|
||||||
|
$(QUIET_PREFIX) -mkdir -p `dirname $(GAMEOUTPUTFILE)` > /dev/null;
|
||||||
|
$(QUIET_PREFIX) rm -f $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
|
||||||
|
$(QUIET_PREFIX) cp -v $(OUTPUTFILE) $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
|
||||||
|
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
|
||||||
|
$(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) -$(STRIP) $(GAMEOUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) $(VSIGN) -signvalve $(GAMEOUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) if [ "$(COPY_DLL_TO_SRV)" = "1" ]; then\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- COPYING TO $(Srv_GAMEOUTPUTFILE) ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
cp -v $(GAMEOUTPUTFILE) $(Srv_GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);\
|
||||||
|
cp -v $(GAMEOUTPUTFILE)$(SYM_EXT) $(Srv_GAMEOUTPUTFILE)$(SYM_EXT) $(QUIET_ECHO_POSTFIX);\
|
||||||
|
fi;
|
||||||
|
$(QUIET_PREFIX) if [ "$(IMPORTLIBRARY)" != "" ]; then\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- COPYING TO IMPORT LIBRARY $(IMPORTLIBRARY) ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
$(P4_EDIT_START) $(IMPORTLIBRARY) $(P4_EDIT_END) && \
|
||||||
|
mkdir -p `dirname $(IMPORTLIBRARY)` > /dev/null && \
|
||||||
|
cp -v $(OUTPUTFILE) $(IMPORTLIBRARY); \
|
||||||
|
fi;
|
||||||
|
|
||||||
|
|
||||||
|
$(SO_File): $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- LINKING $@ [$(CFG)] ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
\
|
||||||
|
$(LINK) $(LINK_MAP_FLAGS) $(SHLIBLDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_SHLIB) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_SHLIB);
|
||||||
|
$(VSIGN) -signvalve $(OUTPUTFILE);
|
||||||
|
|
||||||
|
|
||||||
|
$(EXE_File) : $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- LINKING EXE $@ [$(CFG)] ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
\
|
||||||
|
$(P4_EDIT_START) $(OUTPUTFILE) $(P4_EDIT_END);\
|
||||||
|
$(LINK) $(LINK_MAP_FLAGS) $(LDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_EXE) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_EXE);
|
||||||
|
$(QUIET_PREFIX) -$(P4_EDIT_START) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
|
||||||
|
$(QUIET_PREFIX) $(GEN_SYM) $(OUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) -$(STRIP) $(OUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) $(VSIGN) -signvalve $(OUTPUTFILE);
|
||||||
|
|
||||||
|
|
||||||
|
tags:
|
||||||
|
etags -a -C -o $(SRCROOT)/TAGS *.cpp *.cxx *.h *.hxx
|
507
sp/src/devtools/makefile_base_posix.mak.gcc8
Normal file
507
sp/src/devtools/makefile_base_posix.mak.gcc8
Normal file
@ -0,0 +1,507 @@
|
|||||||
|
#
|
||||||
|
# Base makefile for Linux and OSX
|
||||||
|
#
|
||||||
|
# !!!!! Note to future editors !!!!!
|
||||||
|
#
|
||||||
|
# before you make changes, make sure you grok:
|
||||||
|
# 1. the difference between =, :=, +=, and ?=
|
||||||
|
# 2. how and when this base makefile gets included in the generated makefile(s)
|
||||||
|
# ( see http://www.gnu.org/software/make/manual/make.html#Flavors )
|
||||||
|
#
|
||||||
|
# Command line prefixes:
|
||||||
|
# - errors are ignored
|
||||||
|
# @ command is not printed to stdout before being executed
|
||||||
|
# + command is executed even if Make is invoked in "do not exec" mode
|
||||||
|
|
||||||
|
OS := $(shell uname)
|
||||||
|
HOSTNAME := $(shell hostname)
|
||||||
|
|
||||||
|
-include $(SRCROOT)/devtools/steam_def.mak
|
||||||
|
-include $(SRCROOT)/devtools/sourcesdk_def.mak
|
||||||
|
|
||||||
|
# To build with clang, set the following in your environment:
|
||||||
|
# CC = clang
|
||||||
|
# CXX = clang++
|
||||||
|
|
||||||
|
ifeq ($(CFG), release)
|
||||||
|
# With gcc 4.6.3, engine.so went from 7,383,765 to 8,429,109 when building with -O3.
|
||||||
|
# There also was no speed difference running at 1280x1024. May 2012, mikesart.
|
||||||
|
# tonyp: The size increase was likely caused by -finline-functions and -fipa-cp-clone getting switched on with -O3.
|
||||||
|
# -fno-omit-frame-pointer: need this for stack traces with perf.
|
||||||
|
OptimizerLevel_CompilerSpecific = -O2 -fno-strict-aliasing -ffast-math -fno-omit-frame-pointer -ftree-vectorize -fpredictive-commoning -funswitch-loops
|
||||||
|
else
|
||||||
|
OptimizerLevel_CompilerSpecific = -Og
|
||||||
|
#-O1 -finline-functions
|
||||||
|
endif
|
||||||
|
|
||||||
|
# CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags"
|
||||||
|
ARCH_FLAGS = -fabi-compat-version=2 -fabi-version=2 -fpic -fno-plt -fcf-protection=none -fno-stack-protector -fno-stack-clash-protection
|
||||||
|
BUILDING_MULTI_ARCH = 0
|
||||||
|
CPPFLAGS = $(DEFINES) $(addprefix -I, $(abspath $(INCLUDEDIRS) ))
|
||||||
|
CFLAGS = $(ARCH_FLAGS) $(CPPFLAGS) $(WARN_FLAGS) -fvisibility=$(SymbolVisibility) $(OptimizerLevel) -pipe $(GCC_ExtraCompilerFlags) -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
|
||||||
|
# In -std=gnu++0x mode we get lots of errors about "error: narrowing conversion". -fpermissive
|
||||||
|
# turns these into warnings in gcc, and -Wno-c++11-narrowing suppresses them entirely in clang 3.1+.
|
||||||
|
ifeq ($(CXX),clang++)
|
||||||
|
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else
|
||||||
|
else
|
||||||
|
CXXFLAGS = $(CFLAGS) -std=gnu++0x -Wno-narrowing -fpermissive
|
||||||
|
endif
|
||||||
|
DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE -D_GLIBCXX_USE_CXX11_ABI=0
|
||||||
|
LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel) -fuse-ld=gold
|
||||||
|
GENDEP_CXXFLAGS = -MD -MP -MF $(@:.o=.P)
|
||||||
|
MAP_FLAGS =
|
||||||
|
Srv_GAMEOUTPUTFILE =
|
||||||
|
COPY_DLL_TO_SRV = 0
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(STEAM_BRANCH),1)
|
||||||
|
WARN_FLAGS = -Wall -Wextra -Wshadow -Wno-invalid-offsetof
|
||||||
|
else
|
||||||
|
WARN_FLAGS = -Wno-write-strings -Wno-multichar
|
||||||
|
endif
|
||||||
|
|
||||||
|
WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type -fdiagnostics-show-option -Wformat -Wformat-security
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(OS),Linux)
|
||||||
|
# We should always specify -Wl,--build-id, as documented at:
|
||||||
|
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
|
||||||
|
LDFLAGS += -Wl,--build-id
|
||||||
|
# Set USE_VALVE_BINDIR to build with /Steam/tools/linux in the /valve/bin path.
|
||||||
|
# Dedicated server uses this.
|
||||||
|
ifeq ($(USE_VALVE_BINDIR),1)
|
||||||
|
# dedicated server flags
|
||||||
|
ifeq ($(TARGET_PLATFORM),linux64)
|
||||||
|
VALVE_BINDIR = /valve/bin64/
|
||||||
|
else
|
||||||
|
VALVE_BINDIR = /valve/bin/
|
||||||
|
endif
|
||||||
|
STRIP_FLAGS =
|
||||||
|
else
|
||||||
|
# linux desktop client flags
|
||||||
|
VALVE_BINDIR =
|
||||||
|
# If the steam-runtime is available, use it. We should just default to using it when
|
||||||
|
# buildbot and everyone has a bit of time to get it installed.
|
||||||
|
ifneq "$(wildcard /valve/steam-runtime/bin/)" ""
|
||||||
|
# The steam-runtime is incompatible with clang at this point, so disable it
|
||||||
|
# if clang is enabled.
|
||||||
|
ifneq ($(CXX),clang++)
|
||||||
|
VALVE_BINDIR = /valve/steam-runtime/bin/
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
GCC_VER =
|
||||||
|
# On dedicated servers, some plugins depend on global variable symbols in addition to functions.
|
||||||
|
# So symbols like _Z16ClearMultiDamagev should show up when you do "nm server_srv.so" in TF2.
|
||||||
|
STRIP_FLAGS = -x
|
||||||
|
endif
|
||||||
|
# nocona = MMX, SSE, SSE2, SSE3
|
||||||
|
MARCH_TARGET = nocona
|
||||||
|
MTUNE_TARGET = generic
|
||||||
|
|
||||||
|
ifeq ($(CXX),clang++)
|
||||||
|
# Clang does not support -mfpmath=sse because it uses whatever
|
||||||
|
# instruction set extensions are available by default.
|
||||||
|
SSE_GEN_FLAGS = -msse2
|
||||||
|
else
|
||||||
|
SSE_GEN_FLAGS = -msse2 -mfpmath=sse
|
||||||
|
endif
|
||||||
|
|
||||||
|
CCACHE := $(SRCROOT)/devtools/bin/linux/ccache
|
||||||
|
|
||||||
|
ifeq ($(origin GCC_VER), undefined)
|
||||||
|
GCC_VER=-4.6
|
||||||
|
endif
|
||||||
|
ifeq ($(origin AR), default)
|
||||||
|
AR = $(VALVE_BINDIR)ar crs
|
||||||
|
endif
|
||||||
|
ifeq ($(origin CC),default)
|
||||||
|
CC = $(CCACHE) $(VALVE_BINDIR)gcc$(GCC_VER)
|
||||||
|
endif
|
||||||
|
ifeq ($(origin CXX), default)
|
||||||
|
CXX = $(CCACHE) $(VALVE_BINDIR)g++$(GCC_VER)
|
||||||
|
endif
|
||||||
|
# Support ccache with clang. Add -Qunused-arguments to avoid excessive warnings due to
|
||||||
|
# a ccache quirk. Could also upgrade ccache.
|
||||||
|
# http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html
|
||||||
|
ifeq ($(CC),clang)
|
||||||
|
CC = $(CCACHE) $(VALVE_BINDIR)clang -Qunused-arguments
|
||||||
|
endif
|
||||||
|
ifeq ($(CXX),clang++)
|
||||||
|
CXX = $(CCACHE) $(VALVE_BINDIR)clang++ -Qunused-arguments
|
||||||
|
endif
|
||||||
|
LINK ?= $(CC)
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),linux64)
|
||||||
|
ARCH_FLAGS += -march=$(MARCH_TARGET) -mtune=$(MTUNE_TARGET)
|
||||||
|
LD_SO = ld-linux-x86_64.so.2
|
||||||
|
LIBSTDCXX := $(shell $(CXX) -print-file-name=libstdc++.a)
|
||||||
|
LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a)
|
||||||
|
else
|
||||||
|
ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=$(MTUNE_TARGET)
|
||||||
|
LD_SO = ld-linux.so.2
|
||||||
|
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
|
||||||
|
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
|
||||||
|
LDFLAGS += -m32
|
||||||
|
endif
|
||||||
|
|
||||||
|
GEN_SYM ?= $(SRCROOT)/devtools/gendbg.sh
|
||||||
|
ifeq ($(CFG),release)
|
||||||
|
STRIP ?= strip $(STRIP_FLAGS) -S
|
||||||
|
# CFLAGS += -ffunction-sections -fdata-sections
|
||||||
|
# LDFLAGS += -Wl,--gc-sections -Wl,--print-gc-sections
|
||||||
|
else
|
||||||
|
STRIP ?= true
|
||||||
|
endif
|
||||||
|
VSIGN ?= true
|
||||||
|
|
||||||
|
ifeq ($(SOURCE_SDK), 1)
|
||||||
|
Srv_GAMEOUTPUTFILE := $(GAMEOUTPUTFILE:.so=_srv.so)
|
||||||
|
COPY_DLL_TO_SRV := 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
LINK_MAP_FLAGS = -Wl,-Map,$(@:.so=).map
|
||||||
|
|
||||||
|
SHLIBLDFLAGS = -shared $(LDFLAGS) -Wl,--no-undefined
|
||||||
|
|
||||||
|
_WRAP := -Xlinker --wrap=
|
||||||
|
PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRAP)access $(_WRAP)__xstat \
|
||||||
|
$(_WRAP)stat $(_WRAP)lstat $(_WRAP)fopen64 $(_WRAP)open64 $(_WRAP)opendir $(_WRAP)__lxstat \
|
||||||
|
$(_WRAP)chmod $(_WRAP)chown $(_WRAP)lchown $(_WRAP)symlink $(_WRAP)link $(_WRAP)__lxstat64 \
|
||||||
|
$(_WRAP)mknod $(_WRAP)utimes $(_WRAP)unlink $(_WRAP)rename $(_WRAP)utime $(_WRAP)__xstat64 \
|
||||||
|
$(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath
|
||||||
|
|
||||||
|
LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group
|
||||||
|
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread
|
||||||
|
|
||||||
|
LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group
|
||||||
|
LIB_END_SHLIB = -Wl,--end-group $(SRCROOT)/devtools/gcc9+support.o -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OS),Darwin)
|
||||||
|
CCACHE := $(SRCROOT)/devtools/bin/osx32/ccache
|
||||||
|
MAC_SDK_VER ?= 10.6
|
||||||
|
MAC_SDK := macosx$(MAC_SDK_VER)
|
||||||
|
SYSROOT := $(shell xcodebuild -sdk $(MAC_SDK) -version Path)
|
||||||
|
|
||||||
|
ifneq ($(origin MAC_SDK_VER), file)
|
||||||
|
$(warning Attempting build with SDK version $(MAC_SDK_VER), only 10.6 is supported and recommended!)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(SYSROOT),)
|
||||||
|
FIRSTSDK := $(firstword $(sort $(shell xcodebuild -showsdks | grep macosx | sed 's/.*macosx//')))
|
||||||
|
$(error Could not find SDK version $(MAC_SDK_VER). Install and configure Xcode 4.3, or build with: make MAC_SDK_VER=$(FIRSTSDK))
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(origin CC), default)
|
||||||
|
# Test to see if you have a compiler in the right place, if you
|
||||||
|
# don't abort with an error
|
||||||
|
CLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang)
|
||||||
|
ifeq ($(wildcard $(CLANG)),)
|
||||||
|
$(error Unable to find C compiler, install and configure Xcode 4.3)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CC := $(CCACHE) $(CLANG) -Qunused-arguments
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(origin CXX), default)
|
||||||
|
CXXLANG := $(shell xcrun -sdk $(MAC_SDK) -find clang++)
|
||||||
|
ifeq ($(wildcard $(CXXLANG)),)
|
||||||
|
$(error Unable to find C++ compiler, install and configure Xcode 4.3)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CXX := $(CCACHE) $(CXXLANG) -Qunused-arguments
|
||||||
|
endif
|
||||||
|
LINK ?= $(CXX)
|
||||||
|
|
||||||
|
ifeq ($(origin AR), default)
|
||||||
|
AR := $(shell xcrun -sdk $(MAC_SDK) -find libtool) -static -o
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TARGET_PLATFORM),osx64)
|
||||||
|
ARCH_FLAGS += -arch x86_64 -m64 -march=core2
|
||||||
|
else ifeq (,$(findstring -arch x86_64,$(GCC_ExtraCompilerFlags)))
|
||||||
|
ARCH_FLAGS += -arch i386 -m32 -march=prescott -momit-leaf-frame-pointer -mtune=core2
|
||||||
|
else
|
||||||
|
# dirty hack to build a universal binary - don't specify the architecture
|
||||||
|
ARCH_FLAGS += -arch i386 -Xarch_i386 -march=prescott -Xarch_i386 -mtune=core2 -Xarch_i386 -momit-leaf-frame-pointer -Xarch_x86_64 -march=core2
|
||||||
|
endif
|
||||||
|
|
||||||
|
GEN_SYM ?= $(shell xcrun -sdk $(MAC_SDK) -find dsymutil)
|
||||||
|
ifeq ($(CFG),release)
|
||||||
|
STRIP ?= strip -S
|
||||||
|
else
|
||||||
|
STRIP ?= true
|
||||||
|
endif
|
||||||
|
ifeq ($(SOURCE_SDK), 1)
|
||||||
|
VSIGN ?= true
|
||||||
|
else
|
||||||
|
VSIGN ?= $(SRCROOT)/devtools/bin/vsign
|
||||||
|
endif
|
||||||
|
|
||||||
|
CPPFLAGS += -I$(SYSROOT)/usr/include/malloc
|
||||||
|
CFLAGS += -isysroot $(SYSROOT) -mmacosx-version-min=10.5 -fasm-blocks
|
||||||
|
|
||||||
|
LIB_START_EXE = -lm -ldl -lpthread
|
||||||
|
LIB_END_EXE =
|
||||||
|
|
||||||
|
LIB_START_SHLIB =
|
||||||
|
LIB_END_SHLIB =
|
||||||
|
|
||||||
|
SHLIBLDFLAGS = $(LDFLAGS) -bundle -flat_namespace -undefined suppress -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
||||||
|
|
||||||
|
ifeq (lib,$(findstring lib,$(GAMEOUTPUTFILE)))
|
||||||
|
SHLIBLDFLAGS = $(LDFLAGS) -dynamiclib -current_version 1.0 -compatibility_version 1.0 -install_name @rpath/$(basename $(notdir $(GAMEOUTPUTFILE))).dylib $(SystemLibraries) -Wl,-dead_strip -Wl,-no_dead_strip_inits_and_terms
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
#
|
||||||
|
# Profile-directed optimizations.
|
||||||
|
# Note: Last time these were tested 3/5/08, it actually slowed down the server benchmark by 5%!
|
||||||
|
#
|
||||||
|
# First, uncomment these, build, and test. It will generate .gcda and .gcno files where the .o files are.
|
||||||
|
# PROFILE_LINKER_FLAG=-fprofile-arcs
|
||||||
|
# PROFILE_COMPILER_FLAG=-fprofile-arcs
|
||||||
|
#
|
||||||
|
# Then, comment the above flags out again and rebuild with this flag uncommented:
|
||||||
|
# PROFILE_COMPILER_FLAG=-fprofile-use
|
||||||
|
#
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# The compiler command lne for each src code file to compile
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
OBJ_DIR = ./obj_$(NAME)_$(TARGET_PLATFORM)$(TARGET_PLATFORM_EXT)/$(CFG)
|
||||||
|
CPP_TO_OBJ = $(CPPFILES:.cpp=.o)
|
||||||
|
CXX_TO_OBJ = $(CPP_TO_OBJ:.cxx=.o)
|
||||||
|
CC_TO_OBJ = $(CXX_TO_OBJ:.cc=.o)
|
||||||
|
MM_TO_OBJ = $(CC_TO_OBJ:.mm=.o)
|
||||||
|
C_TO_OBJ = $(MM_TO_OBJ:.c=.o)
|
||||||
|
OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_TO_OBJ)))
|
||||||
|
|
||||||
|
ifeq ($(MAKE_VERBOSE),1)
|
||||||
|
QUIET_PREFIX =
|
||||||
|
QUIET_ECHO_POSTFIX =
|
||||||
|
else
|
||||||
|
QUIET_PREFIX = @
|
||||||
|
QUIET_ECHO_POSTFIX = > /dev/null
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MAKE_CC_VERBOSE),1)
|
||||||
|
CC += -v
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFTYPE),lib)
|
||||||
|
LIB_File = $(OUTPUTFILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFTYPE),dll)
|
||||||
|
SO_File = $(OUTPUTFILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFTYPE),exe)
|
||||||
|
EXE_File = $(OUTPUTFILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# we generate dependencies as a side-effect of compilation now
|
||||||
|
GEN_DEP_FILE=
|
||||||
|
|
||||||
|
PRE_COMPILE_FILE =
|
||||||
|
|
||||||
|
POST_COMPILE_FILE =
|
||||||
|
|
||||||
|
ifeq ($(BUILDING_MULTI_ARCH),1)
|
||||||
|
SINGLE_ARCH_CXXFLAGS=$(subst -arch x86_64,,$(CXXFLAGS))
|
||||||
|
COMPILE_FILE = \
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
echo "---- $(lastword $(subst /, ,$<)) as MULTIARCH----";\
|
||||||
|
mkdir -p $(OBJ_DIR) && \
|
||||||
|
$(CXX) $(SINGLE_ARCH_CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $< && \
|
||||||
|
$(CXX) $(CXXFLAGS) -o $@ -c $<
|
||||||
|
else
|
||||||
|
COMPILE_FILE = \
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
echo "---- $(lastword $(subst /, ,$<)) ----";\
|
||||||
|
mkdir -p $(OBJ_DIR) && \
|
||||||
|
$(CXX) $(CXXFLAGS) $(GENDEP_CXXFLAGS) -o $@ -c $<
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq "$(origin VALVE_NO_AUTO_P4)" "undefined"
|
||||||
|
P4_EDIT_START = chmod -R +w
|
||||||
|
P4_EDIT_END = || true
|
||||||
|
P4_REVERT_START = true
|
||||||
|
P4_REVERT_END =
|
||||||
|
else
|
||||||
|
ifndef P4_EDIT_CHANGELIST
|
||||||
|
# You can use an environment variable to specify what changelist to check the Linux Binaries out into. Normally the default
|
||||||
|
# setting is best, but here is an alternate example:
|
||||||
|
# export P4_EDIT_CHANGELIST_CMD="echo 1424335"
|
||||||
|
# ?= means that if P4_EDIT_CHANGELIST_CMD is already set it won't be changed.
|
||||||
|
P4_EDIT_CHANGELIST_CMD ?= p4 changes -c `p4 client -o | grep ^Client | cut -f 2` -s pending | fgrep 'POSIX Auto Checkout' | cut -d' ' -f 2 | tail -n 1
|
||||||
|
P4_EDIT_CHANGELIST := $(shell $(P4_EDIT_CHANGELIST_CMD))
|
||||||
|
endif
|
||||||
|
ifeq ($(P4_EDIT_CHANGELIST),)
|
||||||
|
# If we haven't found a changelist to check out to then create one. The name must match the one from a few
|
||||||
|
# lines above or else a new changelist will be created each time.
|
||||||
|
# Warning: the behavior of 'echo' is not consistent. In bash you need the "-e" option in order for \n to be
|
||||||
|
# interpreted as a line-feed, but in dash you do not, and if "-e" is passed along then it is printed, which
|
||||||
|
# confuses p4. So, if you run this command from the bash shell don't forget to add "-e" to the echo command.
|
||||||
|
P4_EDIT_CHANGELIST = $(shell echo "Change: new\nDescription: POSIX Auto Checkout" | p4 change -i | cut -f 2 -d ' ')
|
||||||
|
endif
|
||||||
|
|
||||||
|
P4_EDIT_START := for f in
|
||||||
|
P4_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - edit -c $(P4_EDIT_CHANGELIST); else p4 edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
|
||||||
|
P4_REVERT_START := for f in
|
||||||
|
P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | p4 -x - revert; else p4 revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(CONFTYPE),dll)
|
||||||
|
all: $(OTHER_DEPENDENCIES) $(OBJS) $(GAMEOUTPUTFILE)
|
||||||
|
@echo $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX)
|
||||||
|
else
|
||||||
|
all: $(OTHER_DEPENDENCIES) $(OBJS) $(OUTPUTFILE)
|
||||||
|
@echo $(OUTPUTFILE) $(QUIET_ECHO_POSTFIX)
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: clean cleantargets cleanandremove rebuild relink RemoveOutputFile SingleFile
|
||||||
|
|
||||||
|
|
||||||
|
rebuild :
|
||||||
|
$(MAKE) -f $(firstword $(MAKEFILE_LIST)) cleanandremove
|
||||||
|
$(MAKE) -f $(firstword $(MAKEFILE_LIST))
|
||||||
|
|
||||||
|
|
||||||
|
# Use the relink target to force to relink the project.
|
||||||
|
relink: RemoveOutputFile all
|
||||||
|
|
||||||
|
RemoveOutputFile:
|
||||||
|
rm -f $(OUTPUTFILE)
|
||||||
|
|
||||||
|
|
||||||
|
# This rule is so you can say "make SingleFile SingleFilename=/home/myname/valve_main/src/engine/language.cpp" and have it only build that file.
|
||||||
|
# It basically just translates the full filename to create a dependency on the appropriate .o file so it'll build that.
|
||||||
|
SingleFile : RemoveSingleFile $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
|
||||||
|
@echo ""
|
||||||
|
|
||||||
|
RemoveSingleFile:
|
||||||
|
$(QUIET_PREFIX) rm -f $(OBJ_DIR)/$(basename $(notdir $(SingleFilename))).o
|
||||||
|
|
||||||
|
clean:
|
||||||
|
ifneq "$(OBJ_DIR)" ""
|
||||||
|
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
|
||||||
|
$(QUIET_PREFIX) rm -rf $(OBJ_DIR)
|
||||||
|
endif
|
||||||
|
ifneq "$(OUTPUTFILE)" ""
|
||||||
|
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
|
||||||
|
echo "p4 revert $(OUTPUTFILE)"; \
|
||||||
|
$(P4_REVERT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END); \
|
||||||
|
fi;
|
||||||
|
endif
|
||||||
|
ifneq "$(OTHER_DEPENDENCIES)" ""
|
||||||
|
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
|
||||||
|
$(QUIET_PREFIX) rm -f $(OTHER_DEPENDENCIES)
|
||||||
|
endif
|
||||||
|
ifneq "$(GAMEOUTPUTFILE)" ""
|
||||||
|
$(QUIET_PREFIX) echo "p4 revert $(GAMEOUTPUTFILE)"
|
||||||
|
$(QUIET_PREFIX) $(P4_REVERT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_REVERT_END)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# Do the above cleaning, except with p4 edit and rm. Reason being ar crs adds and replaces obj files to the
|
||||||
|
# archive. However if you've renamed or deleted a source file, $(AR) won't remove it. This can leave
|
||||||
|
# us with archive files that have extra unused symbols, and also potentially cause compilation errors
|
||||||
|
# when you rename a file and have many duplicate symbols.
|
||||||
|
cleanandremove:
|
||||||
|
ifneq "$(OBJ_DIR)" ""
|
||||||
|
$(QUIET_PREFIX) echo "rm -rf $(OBJ_DIR)"
|
||||||
|
$(QUIET_PREFIX) -rm -rf $(OBJ_DIR)
|
||||||
|
endif
|
||||||
|
ifneq "$(OUTPUTFILE)" ""
|
||||||
|
$(QUIET_PREFIX) if [ -e $(OUTPUTFILE) ]; then \
|
||||||
|
echo "p4 edit and rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT)"; \
|
||||||
|
$(P4_EDIT_START) $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END); \
|
||||||
|
fi;
|
||||||
|
$(QUIET_PREFIX) -rm -f $(OUTPUTFILE) $(OUTPUTFILE)$(SYM_EXT);
|
||||||
|
endif
|
||||||
|
ifneq "$(OTHER_DEPENDENCIES)" ""
|
||||||
|
$(QUIET_PREFIX) echo "rm -f $(OTHER_DEPENDENCIES)"
|
||||||
|
$(QUIET_PREFIX) -rm -f $(OTHER_DEPENDENCIES)
|
||||||
|
endif
|
||||||
|
ifneq "$(GAMEOUTPUTFILE)" ""
|
||||||
|
$(QUIET_PREFIX) echo "p4 edit and rm -f $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT)"
|
||||||
|
$(QUIET_PREFIX) $(P4_EDIT_START) $(GAMEOUTPUTFILE) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END)
|
||||||
|
$(QUIET_PREFIX) -rm -f $(GAMEOUTPUTFILE)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# This just deletes the final targets so it'll do a relink next time we build.
|
||||||
|
cleantargets:
|
||||||
|
$(QUIET_PREFIX) rm -f $(OUTPUTFILE) $(GAMEOUTPUTFILE)
|
||||||
|
|
||||||
|
|
||||||
|
$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS)
|
||||||
|
$(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END);
|
||||||
|
$(QUIET_PREFIX) $(AR) $(LIB_File) $(OBJS) $(LIBFILES);
|
||||||
|
|
||||||
|
SO_GameOutputFile = $(GAMEOUTPUTFILE)
|
||||||
|
|
||||||
|
# Remove the target before installing a file over it; this prevents existing
|
||||||
|
# instances of the game from crashing due to the overwrite.
|
||||||
|
$(SO_GameOutputFile): $(SO_File)
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END) && \
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- COPYING TO $@ [$(CFG)] ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);
|
||||||
|
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE) $(P4_EDIT_END);
|
||||||
|
$(QUIET_PREFIX) -mkdir -p `dirname $(GAMEOUTPUTFILE)` > /dev/null;
|
||||||
|
$(QUIET_PREFIX) rm -f $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
|
||||||
|
$(QUIET_PREFIX) cp -v $(OUTPUTFILE) $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
|
||||||
|
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
|
||||||
|
$(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) -$(STRIP) $(GAMEOUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) $(VSIGN) -signvalve $(GAMEOUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) if [ "$(COPY_DLL_TO_SRV)" = "1" ]; then\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- COPYING TO $(Srv_GAMEOUTPUTFILE) ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
cp -v $(GAMEOUTPUTFILE) $(Srv_GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);\
|
||||||
|
cp -v $(GAMEOUTPUTFILE)$(SYM_EXT) $(Srv_GAMEOUTPUTFILE)$(SYM_EXT) $(QUIET_ECHO_POSTFIX);\
|
||||||
|
fi;
|
||||||
|
$(QUIET_PREFIX) if [ "$(IMPORTLIBRARY)" != "" ]; then\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- COPYING TO IMPORT LIBRARY $(IMPORTLIBRARY) ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
$(P4_EDIT_START) $(IMPORTLIBRARY) $(P4_EDIT_END) && \
|
||||||
|
mkdir -p `dirname $(IMPORTLIBRARY)` > /dev/null && \
|
||||||
|
cp -v $(OUTPUTFILE) $(IMPORTLIBRARY); \
|
||||||
|
fi;
|
||||||
|
|
||||||
|
|
||||||
|
$(SO_File): $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- LINKING $@ [$(CFG)] ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
\
|
||||||
|
$(LINK) $(LINK_MAP_FLAGS) $(SHLIBLDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_SHLIB) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_SHLIB);
|
||||||
|
$(VSIGN) -signvalve $(OUTPUTFILE);
|
||||||
|
|
||||||
|
|
||||||
|
$(EXE_File) : $(OTHER_DEPENDENCIES) $(OBJS) $(LIBFILENAMES)
|
||||||
|
$(QUIET_PREFIX) \
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
echo "---- LINKING EXE $@ [$(CFG)] ----";\
|
||||||
|
echo "----" $(QUIET_ECHO_POSTFIX);\
|
||||||
|
\
|
||||||
|
$(P4_EDIT_START) $(OUTPUTFILE) $(P4_EDIT_END);\
|
||||||
|
$(LINK) $(LINK_MAP_FLAGS) $(LDFLAGS) $(PROFILE_LINKER_FLAG) -o $(OUTPUTFILE) $(LIB_START_EXE) $(OBJS) $(LIBFILES) $(SystemLibraries) $(LIB_END_EXE);
|
||||||
|
$(QUIET_PREFIX) -$(P4_EDIT_START) $(OUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
|
||||||
|
$(QUIET_PREFIX) $(GEN_SYM) $(OUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) -$(STRIP) $(OUTPUTFILE);
|
||||||
|
$(QUIET_PREFIX) $(VSIGN) -signvalve $(OUTPUTFILE);
|
||||||
|
|
||||||
|
|
||||||
|
tags:
|
||||||
|
etags -a -C -o $(SRCROOT)/TAGS *.cpp *.cxx *.h *.hxx
|
@ -12,6 +12,9 @@
|
|||||||
#include "filesystem_tools.h"
|
#include "filesystem_tools.h"
|
||||||
#include "tier1/strtools.h"
|
#include "tier1/strtools.h"
|
||||||
#include "utlmap.h"
|
#include "utlmap.h"
|
||||||
|
#ifdef MAPBASE
|
||||||
|
#include "fmtstr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
@ -579,6 +582,34 @@ GDclass *GameData::BeginInstanceRemap( const char *pszClassName, const char *psz
|
|||||||
return m_InstanceClass;
|
return m_InstanceClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Sets up for additional instance remap fixes from Mapbase
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void GameData::SetupInstanceRemapParams( int iStartNodes, int iStartBrushSide, bool bRemapVecLines )
|
||||||
|
{
|
||||||
|
// Set the numer of nodes in the level
|
||||||
|
m_InstanceStartAINodes = iStartNodes;
|
||||||
|
|
||||||
|
// If we have a "nodeid" key, set it to ivNodeDest so it's properly recognized
|
||||||
|
// during AI node remapping
|
||||||
|
GDinputvariable *var = m_InstanceClass->VarForName( "nodeid" );
|
||||||
|
if ( var )
|
||||||
|
{
|
||||||
|
var->ForceSetType( ivNodeDest );
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------
|
||||||
|
|
||||||
|
// Set the number of brush sides in the level
|
||||||
|
m_InstanceStartSide = iStartBrushSide;
|
||||||
|
|
||||||
|
//---------------------------------------------
|
||||||
|
|
||||||
|
m_bRemapVecLines = bRemapVecLines;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
enum tRemapOperation
|
enum tRemapOperation
|
||||||
{
|
{
|
||||||
@ -586,6 +617,13 @@ enum tRemapOperation
|
|||||||
REMAP_POSITION,
|
REMAP_POSITION,
|
||||||
REMAP_ANGLE,
|
REMAP_ANGLE,
|
||||||
REMAP_ANGLE_NEGATIVE_PITCH,
|
REMAP_ANGLE_NEGATIVE_PITCH,
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Remaps the node ID for instance/manifest AI node support
|
||||||
|
REMAP_NODE_ID,
|
||||||
|
|
||||||
|
// Remaps brush sides and sidelists
|
||||||
|
REMAP_SIDES,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -624,6 +662,12 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *
|
|||||||
RemapOperation.Insert( ivOrigin, REMAP_POSITION );
|
RemapOperation.Insert( ivOrigin, REMAP_POSITION );
|
||||||
RemapOperation.Insert( ivAxis, REMAP_ANGLE );
|
RemapOperation.Insert( ivAxis, REMAP_ANGLE );
|
||||||
RemapOperation.Insert( ivAngleNegativePitch, REMAP_ANGLE_NEGATIVE_PITCH );
|
RemapOperation.Insert( ivAngleNegativePitch, REMAP_ANGLE_NEGATIVE_PITCH );
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RemapOperation.Insert( ivNodeDest, REMAP_NODE_ID );
|
||||||
|
RemapOperation.Insert( ivSide, REMAP_SIDES );
|
||||||
|
RemapOperation.Insert( ivSideList, REMAP_SIDES );
|
||||||
|
RemapOperation.Insert( ivVecLine, REMAP_POSITION );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !m_InstanceClass )
|
if ( !m_InstanceClass )
|
||||||
@ -657,6 +701,12 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *
|
|||||||
|
|
||||||
case REMAP_POSITION:
|
case REMAP_POSITION:
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Only remap ivVecLine if the keyvalue is enabled
|
||||||
|
if (KVType == ivVecLine && !m_bRemapVecLines)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
Vector inPoint( 0.0f, 0.0f, 0.0f ), outPoint;
|
Vector inPoint( 0.0f, 0.0f, 0.0f ), outPoint;
|
||||||
|
|
||||||
sscanf ( pszInValue, "%f %f %f", &inPoint.x, &inPoint.y, &inPoint.z );
|
sscanf ( pszInValue, "%f %f %f", &inPoint.x, &inPoint.y, &inPoint.z );
|
||||||
@ -697,6 +747,54 @@ bool GameData::RemapKeyValue( const char *pszKey, const char *pszInValue, char *
|
|||||||
sprintf( pszOutValue, "%g", -outAngles.x ); // just the pitch
|
sprintf( pszOutValue, "%g", -outAngles.x ); // just the pitch
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
case REMAP_NODE_ID:
|
||||||
|
{
|
||||||
|
int value = atoi( pszInValue );
|
||||||
|
if (value == -1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
//Warning( " %s %s: Remapped %i to %i", m_InstanceClass->GetName(), KVVar->GetName(), value, value + m_InstanceStartAINodes );
|
||||||
|
|
||||||
|
value += m_InstanceStartAINodes;
|
||||||
|
|
||||||
|
sprintf( pszOutValue, "%i", value );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case REMAP_SIDES:
|
||||||
|
{
|
||||||
|
CUtlStringList sideList;
|
||||||
|
V_SplitString( pszInValue, " ", sideList );
|
||||||
|
|
||||||
|
// Convert sides
|
||||||
|
CUtlStringList newSideList;
|
||||||
|
for (int i = 0; i < sideList.Count(); i++)
|
||||||
|
{
|
||||||
|
int iSide = atoi( sideList[i] );
|
||||||
|
|
||||||
|
//Warning( " %s %s: Remapped %i to %i", m_InstanceClass->GetName(), KVVar->GetName(), iSide, iSide + m_InstanceStartSide );
|
||||||
|
|
||||||
|
iSide += m_InstanceStartSide;
|
||||||
|
|
||||||
|
newSideList.AddToTail( const_cast<char*>( CNumStr( iSide ).String() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initial side
|
||||||
|
strcpy( pszOutValue, newSideList[0] );
|
||||||
|
|
||||||
|
// Start at 1 for subsequent sides
|
||||||
|
for (int i = 1; i < newSideList.Count(); i++)
|
||||||
|
{
|
||||||
|
// Any subsequent sides are spaced
|
||||||
|
sprintf( pszOutValue, "%s %s", pszOutValue, newSideList[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
//Warning("Old side list: \"%s\", new side list: \"%s\"\n", pszInValue, pszOutValue);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( strcmpi( pszInValue, pszOutValue ) != 0 );
|
return ( strcmpi( pszInValue, pszOutValue ) != 0 );
|
||||||
@ -715,7 +813,11 @@ bool GameData::RemapNameField( const char *pszInValue, char *pszOutValue, TNameF
|
|||||||
{
|
{
|
||||||
strcpy( pszOutValue, pszInValue );
|
strcpy( pszOutValue, pszInValue );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( pszInValue[ 0 ] && pszInValue[ 0 ] != '@' && pszInValue[ 0 ] != '!' )
|
||||||
|
#else
|
||||||
if ( pszInValue[ 0 ] && pszInValue[ 0 ] != '@' )
|
if ( pszInValue[ 0 ] && pszInValue[ 0 ] != '@' )
|
||||||
|
#endif
|
||||||
{ // ! at the start of a value means it is global and should not be remaped
|
{ // ! at the start of a value means it is global and should not be remaped
|
||||||
switch( NameFixup )
|
switch( NameFixup )
|
||||||
{
|
{
|
||||||
|
@ -14,6 +14,105 @@
|
|||||||
#include "c_baseentity.h"
|
#include "c_baseentity.h"
|
||||||
#include "basetypes.h"
|
#include "basetypes.h"
|
||||||
|
|
||||||
|
#ifdef ASW_PROJECTED_TEXTURES
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class C_EnvProjectedTexture : public C_BaseEntity
|
||||||
|
{
|
||||||
|
DECLARE_CLASS( C_EnvProjectedTexture, C_BaseEntity );
|
||||||
|
public:
|
||||||
|
DECLARE_CLIENTCLASS();
|
||||||
|
|
||||||
|
void SetMaterial( IMaterial *pMaterial );
|
||||||
|
void SetLightColor( byte r, byte g, byte b, byte a );
|
||||||
|
void SetSize( float flSize );
|
||||||
|
void SetRotation( float flRotation );
|
||||||
|
|
||||||
|
virtual void OnDataChanged( DataUpdateType_t updateType );
|
||||||
|
void ShutDownLightHandle( void );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
virtual void Simulate();
|
||||||
|
#else
|
||||||
|
virtual bool Simulate();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void UpdateLight( void );
|
||||||
|
|
||||||
|
C_EnvProjectedTexture();
|
||||||
|
~C_EnvProjectedTexture();
|
||||||
|
|
||||||
|
static void SetVisibleBBoxMinHeight( float flVisibleBBoxMinHeight ) { m_flVisibleBBoxMinHeight = flVisibleBBoxMinHeight; }
|
||||||
|
static float GetVisibleBBoxMinHeight( void ) { return m_flVisibleBBoxMinHeight; }
|
||||||
|
static C_EnvProjectedTexture *Create( );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
inline bool IsBBoxVisible( void );
|
||||||
|
bool IsBBoxVisible( Vector vecExtentsMin,
|
||||||
|
Vector vecExtentsMax );
|
||||||
|
|
||||||
|
ClientShadowHandle_t m_LightHandle;
|
||||||
|
bool m_bForceUpdate;
|
||||||
|
|
||||||
|
EHANDLE m_hTargetEntity;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
bool m_bDontFollowTarget;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool m_bState;
|
||||||
|
bool m_bAlwaysUpdate;
|
||||||
|
float m_flLightFOV;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float m_flLightHorFOV;
|
||||||
|
#endif
|
||||||
|
bool m_bEnableShadows;
|
||||||
|
bool m_bLightOnlyTarget;
|
||||||
|
bool m_bLightWorld;
|
||||||
|
bool m_bCameraSpace;
|
||||||
|
float m_flBrightnessScale;
|
||||||
|
color32 m_LightColor;
|
||||||
|
Vector m_CurrentLinearFloatLightColor;
|
||||||
|
float m_flCurrentLinearFloatLightAlpha;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float m_flCurrentBrightnessScale;
|
||||||
|
#endif
|
||||||
|
float m_flColorTransitionTime;
|
||||||
|
float m_flAmbient;
|
||||||
|
float m_flNearZ;
|
||||||
|
float m_flFarZ;
|
||||||
|
char m_SpotlightTextureName[ MAX_PATH ];
|
||||||
|
CTextureReference m_SpotlightTexture;
|
||||||
|
int m_nSpotlightTextureFrame;
|
||||||
|
int m_nShadowQuality;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float m_flConstantAtten;
|
||||||
|
float m_flLinearAtten;
|
||||||
|
float m_flQuadraticAtten;
|
||||||
|
float m_flShadowAtten;
|
||||||
|
float m_flShadowFilter;
|
||||||
|
|
||||||
|
bool m_bAlwaysDraw;
|
||||||
|
//bool m_bProjectedTextureVersion;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Vector m_vecExtentsMin;
|
||||||
|
Vector m_vecExtentsMax;
|
||||||
|
|
||||||
|
static float m_flVisibleBBoxMinHeight;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool C_EnvProjectedTexture::IsBBoxVisible( void )
|
||||||
|
{
|
||||||
|
return IsBBoxVisible( GetAbsOrigin() + m_vecExtentsMin, GetAbsOrigin() + m_vecExtentsMax );
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -62,4 +161,6 @@ public:
|
|||||||
|
|
||||||
C_EnvProjectedTexture* GetEnvProjectedTextureList();
|
C_EnvProjectedTexture* GetEnvProjectedTextureList();
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // C_ENVPROJECTEDTEXTURE_H
|
#endif // C_ENVPROJECTEDTEXTURE_H
|
||||||
|
@ -54,6 +54,9 @@
|
|||||||
#include "replay/replay_ragdoll.h"
|
#include "replay/replay_ragdoll.h"
|
||||||
#include "studio_stats.h"
|
#include "studio_stats.h"
|
||||||
#include "tier1/callqueue.h"
|
#include "tier1/callqueue.h"
|
||||||
|
#ifdef MAPBASE
|
||||||
|
#include "viewrender.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TF_CLIENT_DLL
|
#ifdef TF_CLIENT_DLL
|
||||||
#include "c_tf_player.h"
|
#include "c_tf_player.h"
|
||||||
@ -256,6 +259,9 @@ LINK_ENTITY_TO_CLASS( client_ragdoll, C_ClientRagdoll );
|
|||||||
BEGIN_DATADESC( C_ClientRagdoll )
|
BEGIN_DATADESC( C_ClientRagdoll )
|
||||||
DEFINE_FIELD( m_bFadeOut, FIELD_BOOLEAN ),
|
DEFINE_FIELD( m_bFadeOut, FIELD_BOOLEAN ),
|
||||||
DEFINE_FIELD( m_bImportant, FIELD_BOOLEAN ),
|
DEFINE_FIELD( m_bImportant, FIELD_BOOLEAN ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
DEFINE_FIELD( m_flForcedRetireTime, FIELD_FLOAT ),
|
||||||
|
#endif
|
||||||
DEFINE_FIELD( m_iCurrentFriction, FIELD_INTEGER ),
|
DEFINE_FIELD( m_iCurrentFriction, FIELD_INTEGER ),
|
||||||
DEFINE_FIELD( m_iMinFriction, FIELD_INTEGER ),
|
DEFINE_FIELD( m_iMinFriction, FIELD_INTEGER ),
|
||||||
DEFINE_FIELD( m_iMaxFriction, FIELD_INTEGER ),
|
DEFINE_FIELD( m_iMaxFriction, FIELD_INTEGER ),
|
||||||
@ -278,6 +284,94 @@ BEGIN_DATADESC( C_ClientRagdoll )
|
|||||||
|
|
||||||
END_DATADESC()
|
END_DATADESC()
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
BEGIN_ENT_SCRIPTDESC( C_ClientRagdoll, C_BaseAnimating, "Client-side ragdolls" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( SUB_Remove, "FadeOut", "Fades out the ragdoll and removes it from the client." )
|
||||||
|
|
||||||
|
// TODO: Proper shared ragdoll funcs?
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRagdollObject, "GetRagdollObject", "Gets the ragdoll object of the specified index." )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRagdollObjectCount, "GetRagdollObjectCount", "Gets the number of ragdoll objects on this ragdoll." )
|
||||||
|
|
||||||
|
END_SCRIPTDESC();
|
||||||
|
|
||||||
|
ScriptHook_t C_BaseAnimating::g_Hook_OnClientRagdoll;
|
||||||
|
ScriptHook_t C_BaseAnimating::g_Hook_FireEvent;
|
||||||
|
//ScriptHook_t C_BaseAnimating::g_Hook_BuildTransformations;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BEGIN_ENT_SCRIPTDESC( C_BaseAnimating, C_BaseEntity, "Animating models client-side" )
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetPoseParameter, "GetPoseParameter", "Get the specified pose parameter's value" )
|
||||||
|
#endif
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetPoseParameter, "SetPoseParameter", "Set the specified pose parameter to the specified value" )
|
||||||
|
DEFINE_SCRIPTFUNC( IsSequenceFinished, "Ask whether the main sequence is done playing" )
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptLookupAttachment, "LookupAttachment", "Get the named attachement id" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAttachmentOrigin, "GetAttachmentOrigin", "Get the attachement id's origin vector" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAttachmentAngles, "GetAttachmentAngles", "Get the attachement id's angles as a p,y,r vector" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAttachmentMatrix, "GetAttachmentMatrix", "Get the attachement id's matrix transform" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( LookupBone, "Get the named bone id" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoneTransform, "GetBoneTransform", "Get the transform for the specified bone" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetBoneTransform, "SetBoneTransform", "Set the transform for the specified bone" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptAttachEntityToBone, "AttachEntityToBone", "Attaches this entity to the specified target and bone. Also allows for optional local position offset" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptRemoveBoneAttachment, "RemoveBoneAttachment", "Removes the specified bone attachment" )
|
||||||
|
//DEFINE_SCRIPTFUNC( RemoveBoneAttachments, "Removes all bone attachments" )
|
||||||
|
DEFINE_SCRIPTFUNC( DestroyBoneAttachments, "Destroys all bone attachments" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetNumBoneAttachments, "Gets the number of bone attachments" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoneAttachment, "GetBoneAttachment", "Gets the specified bone attachment" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( SetBodygroup, "Sets a bodygroup")
|
||||||
|
DEFINE_SCRIPTFUNC( GetBodygroup, "Gets a bodygroup" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetBodygroupName, "Gets a bodygroup name" )
|
||||||
|
DEFINE_SCRIPTFUNC( FindBodygroupByName, "Finds a bodygroup by name" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetBodygroupCount, "Gets the number of models in a bodygroup" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetNumBodyGroups, "Gets the number of bodygroups" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetSequence, "Gets the current sequence" )
|
||||||
|
DEFINE_SCRIPTFUNC( SetSequence, "Sets the current sequence" )
|
||||||
|
DEFINE_SCRIPTFUNC( SequenceLoops, "Does the current sequence loop?" )
|
||||||
|
DEFINE_SCRIPTFUNC( LookupSequence, "Gets the index of the specified sequence name" )
|
||||||
|
DEFINE_SCRIPTFUNC( LookupActivity, "Gets the ID of the specified activity name" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetSequenceName, "Gets the name of the specified sequence index" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetSequenceActivityName, "Gets the activity name of the specified sequence index" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetSequenceMoveDist, "GetSequenceMoveDist", "Gets the move distance of the specified sequence" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetSequenceActivity, "GetSequenceActivity", "Gets the activity ID of the specified sequence index" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSelectWeightedSequence, "SelectWeightedSequence", "Selects a sequence for the specified activity ID" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetPlaybackRate, "" )
|
||||||
|
DEFINE_SCRIPTFUNC( SetPlaybackRate, "" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetCycle, "" )
|
||||||
|
DEFINE_SCRIPTFUNC( SetCycle, "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetSkin, "GetSkin", "Gets the model's skin" )
|
||||||
|
DEFINE_SCRIPTFUNC( SetSkin, "Sets the model's skin" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetForceBone, "Gets the entity's force bone, which is used to determine which bone a ragdoll should apply its force to." )
|
||||||
|
DEFINE_SCRIPTFUNC( SetForceBone, "Sets the entity's force bone, which is used to determine which bone a ragdoll should apply its force to." )
|
||||||
|
DEFINE_SCRIPTFUNC( GetRagdollForce, "Gets the entity's ragdoll force, which is used to apply velocity to a ragdoll." )
|
||||||
|
DEFINE_SCRIPTFUNC( SetRagdollForce, "Sets the entity's ragdoll force, which is used to apply velocity to a ragdoll." )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptBecomeRagdollOnClient, "BecomeRagdollOnClient", "" )
|
||||||
|
DEFINE_SCRIPTFUNC( IsRagdoll, "" )
|
||||||
|
|
||||||
|
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_OnClientRagdoll, "OnClientRagdoll", FIELD_VOID, "Called when this entity turns into a client-side ragdoll." )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "ragdoll", FIELD_HSCRIPT )
|
||||||
|
END_SCRIPTHOOK()
|
||||||
|
|
||||||
|
BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_FireEvent, "FireEvent", FIELD_BOOLEAN, "Called when handling animation events. Return false to cancel base handling." )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "origin", FIELD_VECTOR )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "angles", FIELD_VECTOR )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "event", FIELD_INTEGER )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "options", FIELD_CSTRING )
|
||||||
|
END_SCRIPTHOOK()
|
||||||
|
|
||||||
|
//BEGIN_SCRIPTHOOK( C_BaseAnimating::g_Hook_BuildTransformations, "BuildTransformations", FIELD_VOID, "Called when building bone transformations. Allows VScript to read/write any bone with Get/SetBoneTransform." )
|
||||||
|
//END_SCRIPTHOOK()
|
||||||
|
#endif
|
||||||
|
END_SCRIPTDESC();
|
||||||
|
|
||||||
C_ClientRagdoll::C_ClientRagdoll( bool bRestoring )
|
C_ClientRagdoll::C_ClientRagdoll( bool bRestoring )
|
||||||
{
|
{
|
||||||
m_iCurrentFriction = 0;
|
m_iCurrentFriction = 0;
|
||||||
@ -286,6 +380,9 @@ C_ClientRagdoll::C_ClientRagdoll( bool bRestoring )
|
|||||||
m_bFadeOut = false;
|
m_bFadeOut = false;
|
||||||
m_bFadingOut = false;
|
m_bFadingOut = false;
|
||||||
m_bImportant = false;
|
m_bImportant = false;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
m_flForcedRetireTime = 0.0f;
|
||||||
|
#endif
|
||||||
m_bNoModelParticles = false;
|
m_bNoModelParticles = false;
|
||||||
|
|
||||||
SetClassname("client_ragdoll");
|
SetClassname("client_ragdoll");
|
||||||
@ -366,7 +463,11 @@ void C_ClientRagdoll::OnRestore( void )
|
|||||||
|
|
||||||
if ( m_bFadeOut == true )
|
if ( m_bFadeOut == true )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
s_RagdollLRU.MoveToTopOfLRU( this, m_bImportant, m_flForcedRetireTime );
|
||||||
|
#else
|
||||||
s_RagdollLRU.MoveToTopOfLRU( this, m_bImportant );
|
s_RagdollLRU.MoveToTopOfLRU( this, m_bImportant );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteRagdollCreationTick( this );
|
NoteRagdollCreationTick( this );
|
||||||
@ -638,6 +739,24 @@ void C_ClientRagdoll::Release( void )
|
|||||||
BaseClass::Release();
|
BaseClass::Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
HSCRIPT C_ClientRagdoll::ScriptGetRagdollObject( int iIndex )
|
||||||
|
{
|
||||||
|
if (iIndex < 0 || iIndex > m_pRagdoll->RagdollBoneCount())
|
||||||
|
{
|
||||||
|
Warning("%s GetRagdollObject: Index %i not valid (%i objects)\n", GetDebugName(), iIndex, m_pRagdoll->RagdollBoneCount());
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_pScriptVM->RegisterInstance( m_pRagdoll->GetElement(iIndex) );
|
||||||
|
}
|
||||||
|
|
||||||
|
int C_ClientRagdoll::ScriptGetRagdollObjectCount()
|
||||||
|
{
|
||||||
|
return m_pRagdoll->RagdollBoneCount();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Incremented each frame in InvalidateModelBones. Models compare this value to what it
|
// Incremented each frame in InvalidateModelBones. Models compare this value to what it
|
||||||
// was last time they setup their bones to determine if they need to re-setup their bones.
|
// was last time they setup their bones to determine if they need to re-setup their bones.
|
||||||
@ -675,6 +794,10 @@ C_BaseAnimating::C_BaseAnimating() :
|
|||||||
m_nPrevSequence = -1;
|
m_nPrevSequence = -1;
|
||||||
m_nRestoreSequence = -1;
|
m_nRestoreSequence = -1;
|
||||||
m_pRagdoll = NULL;
|
m_pRagdoll = NULL;
|
||||||
|
m_pClientsideRagdoll = NULL;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
m_pServerRagdoll = NULL;
|
||||||
|
#endif
|
||||||
m_builtRagdoll = false;
|
m_builtRagdoll = false;
|
||||||
m_hitboxBoneCacheHandle = 0;
|
m_hitboxBoneCacheHandle = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -1400,6 +1523,115 @@ float C_BaseAnimating::ClampCycle( float flCycle, bool isLooping )
|
|||||||
return flCycle;
|
return flCycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Returns the world location and world angles of an attachment to vscript caller
|
||||||
|
// Input : attachment name
|
||||||
|
// Output : location and angles
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
const Vector& C_BaseAnimating::ScriptGetAttachmentOrigin( int iAttachment )
|
||||||
|
{
|
||||||
|
|
||||||
|
static Vector absOrigin;
|
||||||
|
static QAngle qa;
|
||||||
|
|
||||||
|
C_BaseAnimating::GetAttachment( iAttachment, absOrigin, qa );
|
||||||
|
|
||||||
|
return absOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Vector& C_BaseAnimating::ScriptGetAttachmentAngles( int iAttachment )
|
||||||
|
{
|
||||||
|
|
||||||
|
static Vector absOrigin;
|
||||||
|
static Vector absAngles;
|
||||||
|
static QAngle qa;
|
||||||
|
|
||||||
|
C_BaseAnimating::GetAttachment( iAttachment, absOrigin, qa );
|
||||||
|
absAngles.x = qa.x;
|
||||||
|
absAngles.y = qa.y;
|
||||||
|
absAngles.z = qa.z;
|
||||||
|
return absAngles;
|
||||||
|
}
|
||||||
|
|
||||||
|
HSCRIPT C_BaseAnimating::ScriptGetAttachmentMatrix( int iAttachment )
|
||||||
|
{
|
||||||
|
static matrix3x4_t matrix;
|
||||||
|
|
||||||
|
C_BaseAnimating::GetAttachment( iAttachment, matrix );
|
||||||
|
return g_pScriptVM->RegisterInstance( &matrix );
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_BaseAnimating::ScriptGetBoneTransform( int iBone, HSCRIPT hTransform )
|
||||||
|
{
|
||||||
|
matrix3x4_t *matTransform = HScriptToClass<matrix3x4_t>( hTransform );
|
||||||
|
if (matTransform == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GetBoneTransform( iBone, *matTransform );
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_BaseAnimating::ScriptSetBoneTransform( int iBone, HSCRIPT hTransform )
|
||||||
|
{
|
||||||
|
matrix3x4_t *matTransform = HScriptToClass<matrix3x4_t>( hTransform );
|
||||||
|
if (matTransform == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
MatrixCopy( *matTransform, GetBoneForWrite( iBone ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_BaseAnimating::ScriptAttachEntityToBone( HSCRIPT attachTarget, int boneIndexAttached, const Vector &bonePosition, const QAngle &boneAngles )
|
||||||
|
{
|
||||||
|
C_BaseEntity *pTarget = ToEnt( attachTarget );
|
||||||
|
if (pTarget == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AttachEntityToBone( pTarget->GetBaseAnimating(), boneIndexAttached, bonePosition, boneAngles );
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_BaseAnimating::ScriptRemoveBoneAttachment( HSCRIPT boneAttachment )
|
||||||
|
{
|
||||||
|
C_BaseEntity *pTarget = ToEnt( boneAttachment );
|
||||||
|
if (pTarget == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RemoveBoneAttachment( pTarget->GetBaseAnimating() );
|
||||||
|
}
|
||||||
|
|
||||||
|
HSCRIPT C_BaseAnimating::ScriptGetBoneAttachment( int i )
|
||||||
|
{
|
||||||
|
return ToHScript( GetBoneAttachment( i ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
HSCRIPT C_BaseAnimating::ScriptBecomeRagdollOnClient()
|
||||||
|
{
|
||||||
|
C_BaseAnimating *pRagdoll = BecomeRagdollOnClient();
|
||||||
|
if (!pRagdoll)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return pRagdoll->GetScriptInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
float C_BaseAnimating::ScriptGetPoseParameter( const char* szName )
|
||||||
|
{
|
||||||
|
CStudioHdr* pHdr = GetModelPtr();
|
||||||
|
if (pHdr == NULL)
|
||||||
|
return 0.0f;
|
||||||
|
|
||||||
|
int iPoseParam = LookupPoseParameter( pHdr, szName );
|
||||||
|
return GetPoseParameter( iPoseParam );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void C_BaseAnimating::ScriptSetPoseParameter(const char* szName, float fValue)
|
||||||
|
{
|
||||||
|
CStudioHdr* pHdr = GetModelPtr();
|
||||||
|
if (pHdr == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int iPoseParam = LookupPoseParameter(pHdr, szName);
|
||||||
|
SetPoseParameter(pHdr, iPoseParam, fValue);
|
||||||
|
}
|
||||||
|
|
||||||
void C_BaseAnimating::GetCachedBoneMatrix( int boneIndex, matrix3x4_t &out )
|
void C_BaseAnimating::GetCachedBoneMatrix( int boneIndex, matrix3x4_t &out )
|
||||||
{
|
{
|
||||||
@ -1546,7 +1778,23 @@ void C_BaseAnimating::BuildTransformations( CStudioHdr *hdr, Vector *pos, Quater
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
//if (m_ScriptScope.IsInitialized() && g_Hook_BuildTransformations.CanRunInScope(m_ScriptScope))
|
||||||
|
//{
|
||||||
|
// int oldWritableBones = m_BoneAccessor.GetWritableBones();
|
||||||
|
// int oldReadableBones = m_BoneAccessor.GetReadableBones();
|
||||||
|
// m_BoneAccessor.SetWritableBones( BONE_USED_BY_ANYTHING );
|
||||||
|
// m_BoneAccessor.SetReadableBones( BONE_USED_BY_ANYTHING );
|
||||||
|
//
|
||||||
|
// // No parameters
|
||||||
|
// //ScriptVariant_t args[] = {};
|
||||||
|
// //ScriptVariant_t returnValue;
|
||||||
|
// g_Hook_BuildTransformations.Call( m_ScriptScope, NULL, NULL /*&returnValue, args*/ );
|
||||||
|
//
|
||||||
|
// m_BoneAccessor.SetWritableBones( oldWritableBones );
|
||||||
|
// m_BoneAccessor.SetReadableBones( oldReadableBones );
|
||||||
|
//}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1752,6 +2000,10 @@ CollideType_t C_BaseAnimating::GetCollideType( void )
|
|||||||
return BaseClass::GetCollideType();
|
return BaseClass::GetCollideType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
ConVar ai_death_pose_enabled( "ai_death_pose_enabled", "1", FCVAR_NONE, "Toggles the death pose fix code, which cancels sequence transitions while a NPC is ragdolling." );
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: if the active sequence changes, keep track of the previous ones and decay them based on their decay rate
|
// Purpose: if the active sequence changes, keep track of the previous ones and decay them based on their decay rate
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1768,6 +2020,14 @@ void C_BaseAnimating::MaintainSequenceTransitions( IBoneSetup &boneSetup, float
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( IsAboutToRagdoll() && ai_death_pose_enabled.GetBool() )
|
||||||
|
{
|
||||||
|
m_nPrevNewSequenceParity = m_nNewSequenceParity;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
m_SequenceTransitioner.CheckForSequenceChange(
|
m_SequenceTransitioner.CheckForSequenceChange(
|
||||||
boneSetup.GetStudioHdr(),
|
boneSetup.GetStudioHdr(),
|
||||||
GetSequence(),
|
GetSequence(),
|
||||||
@ -2547,14 +2807,29 @@ void C_BaseAnimating::CalculateIKLocks( float currentTime )
|
|||||||
|
|
||||||
// debugoverlay->AddBoxOverlay( origin, Vector( -1, -1, -1 ), Vector( 1, 1, 1 ), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 0 );
|
// debugoverlay->AddBoxOverlay( origin, Vector( -1, -1, -1 ), Vector( 1, 1, 1 ), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 0 );
|
||||||
|
|
||||||
float d = (pTarget->est.pos - origin).Length();
|
Vector vecDelta = (origin - pTarget->est.pos);
|
||||||
|
float d = vecDelta.Length();
|
||||||
|
|
||||||
if ( d >= flDist)
|
if ( d >= flDist)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
flDist = d;
|
flDist = d;
|
||||||
pTarget->SetPos( origin );
|
#ifdef MAPBASE
|
||||||
pTarget->SetAngles( angles );
|
// For blending purposes, IK attachments should obey weight
|
||||||
|
if ( pTarget->est.flWeight < 1.0f )
|
||||||
|
{
|
||||||
|
Quaternion qTarget;
|
||||||
|
AngleQuaternion( angles, qTarget );
|
||||||
|
|
||||||
|
QuaternionSlerp( pTarget->est.q, qTarget, pTarget->est.flWeight, pTarget->est.q );
|
||||||
|
pTarget->SetPos( pTarget->est.pos + (vecDelta * pTarget->est.flWeight) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
pTarget->SetPos( origin );
|
||||||
|
pTarget->SetAngles( angles );
|
||||||
|
}
|
||||||
// debugoverlay->AddBoxOverlay( pTarget->est.pos, Vector( -pTarget->est.radius, -pTarget->est.radius, -pTarget->est.radius ), Vector( pTarget->est.radius, pTarget->est.radius, pTarget->est.radius), QAngle( 0, 0, 0 ), 0, 255, 0, 0, 0 );
|
// debugoverlay->AddBoxOverlay( pTarget->est.pos, Vector( -pTarget->est.radius, -pTarget->est.radius, -pTarget->est.radius ), Vector( pTarget->est.radius, pTarget->est.radius, pTarget->est.radius), QAngle( 0, 0, 0 ), 0, 255, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3061,6 +3336,17 @@ int C_BaseAnimating::DrawModel( int flags )
|
|||||||
|
|
||||||
int drawn = 0;
|
int drawn = 0;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_iViewHideFlags > 0)
|
||||||
|
{
|
||||||
|
// Hide this entity if it's not supposed to be drawn in this view.
|
||||||
|
if (m_iViewHideFlags & (1 << CurrentViewID()))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TF_CLIENT_DLL
|
#ifdef TF_CLIENT_DLL
|
||||||
ValidateModelIndex();
|
ValidateModelIndex();
|
||||||
#endif
|
#endif
|
||||||
@ -3476,6 +3762,10 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
|
|||||||
gpGlobals->curtime );
|
gpGlobals->curtime );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
if (ScriptHookFireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() ) == false)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
|
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
|
||||||
}
|
}
|
||||||
@ -3508,6 +3798,11 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
|
|||||||
gpGlobals->curtime );
|
gpGlobals->curtime );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
if (ScriptHookFireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() ) == false)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
|
FireEvent( GetAbsOrigin(), GetAbsAngles(), pevent[ i ].event, pevent[ i ].pszOptions() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3515,6 +3810,26 @@ void C_BaseAnimating::DoAnimationEvents( CStudioHdr *pStudioHdr )
|
|||||||
m_flPrevEventCycle = flEventCycle;
|
m_flPrevEventCycle = flEventCycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool C_BaseAnimating::ScriptHookFireEvent( const Vector& origin, const QAngle& angles, int event, const char *options )
|
||||||
|
{
|
||||||
|
if (m_ScriptScope.IsInitialized() && g_Hook_FireEvent.CanRunInScope(m_ScriptScope))
|
||||||
|
{
|
||||||
|
// origin, angles, event, options
|
||||||
|
ScriptVariant_t args[] = { origin, angles, event, options };
|
||||||
|
ScriptVariant_t returnValue = true;
|
||||||
|
g_Hook_FireEvent.Call( m_ScriptScope, &returnValue, args );
|
||||||
|
|
||||||
|
return returnValue.m_bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Parses a muzzle effect event and sends it out for drawing
|
// Purpose: Parses a muzzle effect event and sends it out for drawing
|
||||||
// Input : *options - event parameters in text format
|
// Input : *options - event parameters in text format
|
||||||
@ -3528,7 +3843,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer
|
|||||||
int weaponType = 0;
|
int weaponType = 0;
|
||||||
|
|
||||||
// Get the first parameter
|
// Get the first parameter
|
||||||
p = nexttoken( token, p, ' ' );
|
p = nexttoken( token, p, ' ' , sizeof(token) );
|
||||||
|
|
||||||
// Find the weapon type
|
// Find the weapon type
|
||||||
if ( token )
|
if ( token )
|
||||||
@ -3572,7 +3887,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the second parameter
|
// Get the second parameter
|
||||||
p = nexttoken( token, p, ' ' );
|
p = nexttoken( token, p, ' ' , sizeof(token) );
|
||||||
|
|
||||||
int attachmentIndex = -1;
|
int attachmentIndex = -1;
|
||||||
|
|
||||||
@ -3683,7 +3998,7 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
|
|
||||||
// Get the particle effect name
|
// Get the particle effect name
|
||||||
const char *p = options;
|
const char *p = options;
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
if ( token )
|
if ( token )
|
||||||
{
|
{
|
||||||
const char* mtoken = ModifyEventParticles( token );
|
const char* mtoken = ModifyEventParticles( token );
|
||||||
@ -3693,7 +4008,7 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the attachment type
|
// Get the attachment type
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
if ( token )
|
if ( token )
|
||||||
{
|
{
|
||||||
iAttachType = GetAttachTypeFromString( token );
|
iAttachType = GetAttachTypeFromString( token );
|
||||||
@ -3705,7 +4020,7 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the attachment point index
|
// Get the attachment point index
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
if ( token )
|
if ( token )
|
||||||
{
|
{
|
||||||
iAttachment = atoi(token);
|
iAttachment = atoi(token);
|
||||||
@ -3727,6 +4042,92 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
case AE_CL_STOP_PARTICLE_EFFECT:
|
||||||
|
{
|
||||||
|
char token[256];
|
||||||
|
char szParticleEffect[256];
|
||||||
|
|
||||||
|
// Get the particle effect name
|
||||||
|
const char *p = options;
|
||||||
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
|
if ( token )
|
||||||
|
{
|
||||||
|
Q_strncpy( szParticleEffect, token, sizeof(szParticleEffect) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the attachment point index
|
||||||
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
|
bool bStopInstantly = ( token && !Q_stricmp( token, "instantly" ) );
|
||||||
|
|
||||||
|
ParticleProp()->StopParticlesNamed( szParticleEffect, bStopInstantly );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AE_CL_ADD_PARTICLE_EFFECT_CP:
|
||||||
|
{
|
||||||
|
int iControlPoint = 1;
|
||||||
|
int iAttachment = -1;
|
||||||
|
int iAttachType = PATTACH_ABSORIGIN_FOLLOW;
|
||||||
|
int iEffectIndex = -1;
|
||||||
|
char token[256];
|
||||||
|
char szParticleEffect[256];
|
||||||
|
|
||||||
|
// Get the particle effect name
|
||||||
|
const char *p = options;
|
||||||
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
|
if ( token )
|
||||||
|
{
|
||||||
|
Q_strncpy( szParticleEffect, token, sizeof(szParticleEffect) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the control point number
|
||||||
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
|
if ( token )
|
||||||
|
{
|
||||||
|
iControlPoint = atoi( token );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the attachment type
|
||||||
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
|
if ( token )
|
||||||
|
{
|
||||||
|
iAttachType = GetAttachTypeFromString( token );
|
||||||
|
if ( iAttachType == -1 )
|
||||||
|
{
|
||||||
|
Warning("Invalid attach type specified for particle effect anim event. Trying to spawn effect '%s' with attach type of '%s'\n", szParticleEffect, token );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the attachment point index
|
||||||
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
|
if ( token )
|
||||||
|
{
|
||||||
|
iAttachment = atoi(token);
|
||||||
|
|
||||||
|
// See if we can find any attachment points matching the name
|
||||||
|
if ( token[0] != '0' && iAttachment == 0 )
|
||||||
|
{
|
||||||
|
iAttachment = LookupAttachment( token );
|
||||||
|
if ( iAttachment == -1 )
|
||||||
|
{
|
||||||
|
Warning("Failed to find attachment point specified for particle effect anim event. Trying to spawn effect '%s' on attachment named '%s'\n", szParticleEffect, token );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
iEffectIndex = ParticleProp()->FindEffect( szParticleEffect );
|
||||||
|
if ( iEffectIndex == -1 )
|
||||||
|
{
|
||||||
|
Warning("Failed to find specified particle effect. Trying to add CP to '%s' on attachment named '%s'\n", szParticleEffect, token );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ParticleProp()->AddControlPoint( iEffectIndex, iControlPoint, this, (ParticleAttachment_t)iAttachType, iAttachment );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case AE_CL_PLAYSOUND:
|
case AE_CL_PLAYSOUND:
|
||||||
{
|
{
|
||||||
CLocalPlayerFilter filter;
|
CLocalPlayerFilter filter;
|
||||||
@ -3825,18 +4226,33 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
|
|
||||||
// Eject brass
|
// Eject brass
|
||||||
case CL_EVENT_EJECTBRASS1:
|
case CL_EVENT_EJECTBRASS1:
|
||||||
if ( m_Attachments.Count() > 0 )
|
|
||||||
{
|
{
|
||||||
if ( MainViewOrigin().DistToSqr( GetAbsOrigin() ) < (256 * 256) )
|
// Check if we're a weapon, if we belong to the local player, and if the local player is in third person - if all are true, don't do a muzzleflash in this instance, because
|
||||||
|
// we're using the view models dispatch for smoothness.
|
||||||
|
if ( dynamic_cast< C_BaseCombatWeapon *>(this) != NULL )
|
||||||
{
|
{
|
||||||
Vector attachOrigin;
|
C_BaseCombatWeapon *pWeapon = dynamic_cast< C_BaseCombatWeapon *>(this);
|
||||||
QAngle attachAngles;
|
if ( pWeapon && pWeapon->GetOwner() == C_BasePlayer::GetLocalPlayer() && ::input->CAM_IsThirdPerson() )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if( GetAttachment( 2, attachOrigin, attachAngles ) )
|
if ( ( prediction->InPrediction() && !prediction->IsFirstTimePredicted() ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ( m_Attachments.Count() > 0 )
|
||||||
|
{
|
||||||
|
if ( MainViewOrigin().DistToSqr( GetAbsOrigin() ) < (256 * 256) )
|
||||||
{
|
{
|
||||||
tempents->EjectBrass( attachOrigin, attachAngles, GetAbsAngles(), atoi( options ) );
|
Vector attachOrigin;
|
||||||
|
QAngle attachAngles;
|
||||||
|
|
||||||
|
if( GetAttachment( 2, attachOrigin, attachAngles ) )
|
||||||
|
{
|
||||||
|
tempents->EjectBrass( attachOrigin, attachAngles, GetAbsAngles(), atoi( options ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3850,6 +4266,36 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
case AE_NPC_MUZZLEFLASH:
|
case AE_NPC_MUZZLEFLASH:
|
||||||
{
|
{
|
||||||
// Send out the effect for an NPC
|
// Send out the effect for an NPC
|
||||||
|
#if defined ( HL2MP ) || defined ( SDK_DLL ) // works for the modified CSS weapons included in the new template sdk.
|
||||||
|
// HL2MP - Make third person muzzleflashes as reliable as the first person ones
|
||||||
|
// while in third person the view model dispatches the muzzleflash event - note: the weapon models dispatch them too, but not frequently.
|
||||||
|
if ( IsViewModel() )
|
||||||
|
{
|
||||||
|
C_BasePlayer *pPlayer = ToBasePlayer( dynamic_cast<C_BaseViewModel *>(this)->GetOwner() );
|
||||||
|
if ( pPlayer && pPlayer == C_BasePlayer::GetLocalPlayer())
|
||||||
|
{
|
||||||
|
if ( ::input->CAM_IsThirdPerson() )
|
||||||
|
{
|
||||||
|
// Dispatch on the weapon - the player model doesn't have the attachments in hl2mp.
|
||||||
|
C_BaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon();
|
||||||
|
if ( !pWeapon )
|
||||||
|
break;
|
||||||
|
pWeapon->DispatchMuzzleEffect( options, false );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we're a weapon, if we belong to the local player, and if the local player is in third person - if all are true, don't do a muzzleflash in this instance, because
|
||||||
|
// we're using the view models dispatch for smoothness.
|
||||||
|
if ( dynamic_cast< C_BaseCombatWeapon *>(this) != NULL )
|
||||||
|
{
|
||||||
|
C_BaseCombatWeapon *pWeapon = dynamic_cast< C_BaseCombatWeapon *>(this);
|
||||||
|
if ( pWeapon && pWeapon->GetOwner() == C_BasePlayer::GetLocalPlayer() && ::input->CAM_IsThirdPerson() )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
DispatchMuzzleEffect( options, false );
|
DispatchMuzzleEffect( options, false );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3910,14 +4356,14 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
const char *p = options;
|
const char *p = options;
|
||||||
|
|
||||||
// Bodygroup Name
|
// Bodygroup Name
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
if ( token )
|
if ( token )
|
||||||
{
|
{
|
||||||
Q_strncpy( szBodygroupName, token, sizeof(szBodygroupName) );
|
Q_strncpy( szBodygroupName, token, sizeof(szBodygroupName) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the desired value
|
// Get the desired value
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
if ( token )
|
if ( token )
|
||||||
{
|
{
|
||||||
value = atoi( token );
|
value = atoi( token );
|
||||||
@ -3931,6 +4377,22 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
case AE_VSCRIPT_RUN:
|
||||||
|
{
|
||||||
|
if (!RunScript( options ))
|
||||||
|
Warning( "%s failed to run AE_VSCRIPT_RUN on client with \"%s\"\n", GetDebugName(), options );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AE_VSCRIPT_RUN_FILE:
|
||||||
|
{
|
||||||
|
if (!RunScriptFile( options ))
|
||||||
|
Warning( "%s failed to run AE_VSCRIPT_RUN_FILE on client with \"%s\"\n", GetDebugName(), options );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3957,21 +4419,21 @@ void C_BaseAnimating::FireObsoleteEvent( const Vector& origin, const QAngle& ang
|
|||||||
|
|
||||||
const char *p = options;
|
const char *p = options;
|
||||||
|
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
|
|
||||||
if( token )
|
if( token )
|
||||||
{
|
{
|
||||||
Q_strncpy( effectFunc, token, sizeof(effectFunc) );
|
Q_strncpy( effectFunc, token, sizeof(effectFunc) );
|
||||||
}
|
}
|
||||||
|
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
|
|
||||||
if( token )
|
if( token )
|
||||||
{
|
{
|
||||||
iAttachment = atoi(token);
|
iAttachment = atoi(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
p = nexttoken(token, p, ' ');
|
p = nexttoken(token, p, ' ', sizeof(token));
|
||||||
|
|
||||||
if( token )
|
if( token )
|
||||||
{
|
{
|
||||||
@ -4550,12 +5012,18 @@ void C_BaseAnimating::GetRagdollInitBoneArrays( matrix3x4_t *pDeltaBones0, matri
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
C_ClientRagdoll *C_BaseAnimating::CreateClientRagdoll( bool bRestoring )
|
||||||
|
{
|
||||||
|
//DevMsg( "Creating ragdoll at tick %d\n", gpGlobals->tickcount );
|
||||||
|
return new C_ClientRagdoll( bRestoring );
|
||||||
|
}
|
||||||
|
|
||||||
C_BaseAnimating *C_BaseAnimating::CreateRagdollCopy()
|
C_BaseAnimating *C_BaseAnimating::CreateRagdollCopy()
|
||||||
{
|
{
|
||||||
//Adrian: We now create a separate entity that becomes this entity's ragdoll.
|
//Adrian: We now create a separate entity that becomes this entity's ragdoll.
|
||||||
//That way the server side version of this entity can go away.
|
//That way the server side version of this entity can go away.
|
||||||
//Plus we can hook save/restore code to these ragdolls so they don't fall on restore anymore.
|
//Plus we can hook save/restore code to these ragdolls so they don't fall on restore anymore.
|
||||||
C_ClientRagdoll *pRagdoll = new C_ClientRagdoll( false );
|
C_ClientRagdoll *pRagdoll = CreateClientRagdoll( false );
|
||||||
if ( pRagdoll == NULL )
|
if ( pRagdoll == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -4606,6 +5074,14 @@ C_BaseAnimating *C_BaseAnimating::CreateRagdollCopy()
|
|||||||
pRagdoll->m_nForceBone = m_nForceBone;
|
pRagdoll->m_nForceBone = m_nForceBone;
|
||||||
pRagdoll->SetNextClientThink( CLIENT_THINK_ALWAYS );
|
pRagdoll->SetNextClientThink( CLIENT_THINK_ALWAYS );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
pRagdoll->m_iViewHideFlags = m_iViewHideFlags;
|
||||||
|
|
||||||
|
pRagdoll->m_fadeMinDist = m_fadeMinDist;
|
||||||
|
pRagdoll->m_fadeMaxDist = m_fadeMaxDist;
|
||||||
|
pRagdoll->m_flFadeScale = m_flFadeScale;
|
||||||
|
#endif
|
||||||
|
|
||||||
pRagdoll->SetModelName( AllocPooledString(pModelName) );
|
pRagdoll->SetModelName( AllocPooledString(pModelName) );
|
||||||
pRagdoll->SetModelScale( GetModelScale() );
|
pRagdoll->SetModelScale( GetModelScale() );
|
||||||
return pRagdoll;
|
return pRagdoll;
|
||||||
@ -4615,15 +5091,26 @@ C_BaseAnimating *C_BaseAnimating::BecomeRagdollOnClient()
|
|||||||
{
|
{
|
||||||
MoveToLastReceivedPosition( true );
|
MoveToLastReceivedPosition( true );
|
||||||
GetAbsOrigin();
|
GetAbsOrigin();
|
||||||
C_BaseAnimating *pRagdoll = CreateRagdollCopy();
|
m_pClientsideRagdoll = CreateRagdollCopy();
|
||||||
|
|
||||||
matrix3x4_t boneDelta0[MAXSTUDIOBONES];
|
matrix3x4_t boneDelta0[MAXSTUDIOBONES];
|
||||||
matrix3x4_t boneDelta1[MAXSTUDIOBONES];
|
matrix3x4_t boneDelta1[MAXSTUDIOBONES];
|
||||||
matrix3x4_t currentBones[MAXSTUDIOBONES];
|
matrix3x4_t currentBones[MAXSTUDIOBONES];
|
||||||
const float boneDt = 0.1f;
|
const float boneDt = 0.1f;
|
||||||
GetRagdollInitBoneArrays( boneDelta0, boneDelta1, currentBones, boneDt );
|
GetRagdollInitBoneArrays( boneDelta0, boneDelta1, currentBones, boneDt );
|
||||||
pRagdoll->InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt );
|
m_pClientsideRagdoll->InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt );
|
||||||
return pRagdoll;
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
// Hook for ragdolling
|
||||||
|
if (m_ScriptScope.IsInitialized() && g_Hook_OnClientRagdoll.CanRunInScope( m_ScriptScope ))
|
||||||
|
{
|
||||||
|
// ragdoll
|
||||||
|
ScriptVariant_t args[] = { ScriptVariant_t( m_pClientsideRagdoll->GetScriptInstance() ) };
|
||||||
|
g_Hook_OnClientRagdoll.Call( m_ScriptScope, NULL, args );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return m_pClientsideRagdoll;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C_BaseAnimating::InitAsClientRagdoll( const matrix3x4_t *pDeltaBones0, const matrix3x4_t *pDeltaBones1, const matrix3x4_t *pCurrentBonePosition, float boneDt, bool bFixedConstraints )
|
bool C_BaseAnimating::InitAsClientRagdoll( const matrix3x4_t *pDeltaBones0, const matrix3x4_t *pDeltaBones1, const matrix3x4_t *pCurrentBonePosition, float boneDt, bool bFixedConstraints )
|
||||||
@ -5089,6 +5576,11 @@ void C_BaseAnimating::StudioFrameAdvance()
|
|||||||
|
|
||||||
if ( flNewCycle < 0.0f || flNewCycle >= 1.0f )
|
if ( flNewCycle < 0.0f || flNewCycle >= 1.0f )
|
||||||
{
|
{
|
||||||
|
if (flNewCycle >= 1.0f)
|
||||||
|
{
|
||||||
|
ReachedEndOfSequence();
|
||||||
|
}
|
||||||
|
|
||||||
if ( IsSequenceLooping( hdr, GetSequence() ) )
|
if ( IsSequenceLooping( hdr, GetSequence() ) )
|
||||||
{
|
{
|
||||||
flNewCycle -= (int)(flNewCycle);
|
flNewCycle -= (int)(flNewCycle);
|
||||||
|
@ -38,6 +38,7 @@ class C_BaseClientShader
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class IRagdoll;
|
class IRagdoll;
|
||||||
|
class C_ClientRagdoll;
|
||||||
class CIKContext;
|
class CIKContext;
|
||||||
class CIKState;
|
class CIKState;
|
||||||
class ConVar;
|
class ConVar;
|
||||||
@ -79,7 +80,7 @@ public:
|
|||||||
QAngle m_angRotation;
|
QAngle m_angRotation;
|
||||||
Vector m_vOriginVelocity;
|
Vector m_vOriginVelocity;
|
||||||
int m_nLastFramecount : 31;
|
int m_nLastFramecount : 31;
|
||||||
int m_bAnglesComputed : 1;
|
bool m_bAnglesComputed : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ public:
|
|||||||
DECLARE_CLIENTCLASS();
|
DECLARE_CLIENTCLASS();
|
||||||
DECLARE_PREDICTABLE();
|
DECLARE_PREDICTABLE();
|
||||||
DECLARE_INTERPOLATION();
|
DECLARE_INTERPOLATION();
|
||||||
|
DECLARE_ENT_SCRIPTDESC();
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -163,6 +165,17 @@ public:
|
|||||||
virtual void FireObsoleteEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
|
virtual void FireObsoleteEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
|
||||||
virtual const char* ModifyEventParticles( const char* token ) { return token; }
|
virtual const char* ModifyEventParticles( const char* token ) { return token; }
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
bool ScriptHookFireEvent( const Vector& origin, const QAngle& angles, int event, const char *options );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined ( SDK_DLL ) || defined ( HL2MP )
|
||||||
|
virtual void ResetEventsParity() { m_nPrevResetEventsParity = -1; } // used to force animation events to function on players so the muzzleflashes and other events occur
|
||||||
|
// so new functions don't have to be made to parse the models like CSS does in ProcessMuzzleFlashEvent
|
||||||
|
// allows the multiplayer world weapon models to declare the muzzleflashes, and other effects like sp
|
||||||
|
// without the need to script it and add extra parsing code.
|
||||||
|
#endif
|
||||||
|
|
||||||
// Parses and distributes muzzle flash events
|
// Parses and distributes muzzle flash events
|
||||||
virtual bool DispatchMuzzleEffect( const char *options, bool isFirstPerson );
|
virtual bool DispatchMuzzleEffect( const char *options, bool isFirstPerson );
|
||||||
|
|
||||||
@ -289,6 +302,7 @@ public:
|
|||||||
bool IsRagdoll() const;
|
bool IsRagdoll() const;
|
||||||
bool IsAboutToRagdoll() const;
|
bool IsAboutToRagdoll() const;
|
||||||
virtual C_BaseAnimating *BecomeRagdollOnClient();
|
virtual C_BaseAnimating *BecomeRagdollOnClient();
|
||||||
|
virtual C_ClientRagdoll *CreateClientRagdoll( bool bRestoring = false );
|
||||||
C_BaseAnimating *CreateRagdollCopy();
|
C_BaseAnimating *CreateRagdollCopy();
|
||||||
bool InitAsClientRagdoll( const matrix3x4_t *pDeltaBones0, const matrix3x4_t *pDeltaBones1, const matrix3x4_t *pCurrentBonePosition, float boneDt, bool bFixedConstraints=false );
|
bool InitAsClientRagdoll( const matrix3x4_t *pDeltaBones0, const matrix3x4_t *pDeltaBones1, const matrix3x4_t *pCurrentBonePosition, float boneDt, bool bFixedConstraints=false );
|
||||||
void IgniteRagdoll( C_BaseAnimating *pSource );
|
void IgniteRagdoll( C_BaseAnimating *pSource );
|
||||||
@ -342,6 +356,8 @@ public:
|
|||||||
void ClientSideAnimationChanged();
|
void ClientSideAnimationChanged();
|
||||||
virtual unsigned int ComputeClientSideAnimationFlags();
|
virtual unsigned int ComputeClientSideAnimationFlags();
|
||||||
|
|
||||||
|
virtual void ReachedEndOfSequence() { return; }
|
||||||
|
|
||||||
virtual void ResetClientsideFrame( void ) { SetCycle( 0 ); }
|
virtual void ResetClientsideFrame( void ) { SetCycle( 0 ); }
|
||||||
|
|
||||||
void SetCycle( float flCycle );
|
void SetCycle( float flCycle );
|
||||||
@ -445,6 +461,41 @@ public:
|
|||||||
|
|
||||||
virtual bool IsViewModel() const;
|
virtual bool IsViewModel() const;
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
int ScriptLookupAttachment( const char *pAttachmentName ) { return LookupAttachment( pAttachmentName ); }
|
||||||
|
const Vector& ScriptGetAttachmentOrigin(int iAttachment);
|
||||||
|
const Vector& ScriptGetAttachmentAngles(int iAttachment);
|
||||||
|
HSCRIPT ScriptGetAttachmentMatrix(int iAttachment);
|
||||||
|
|
||||||
|
void ScriptGetBoneTransform( int iBone, HSCRIPT hTransform );
|
||||||
|
void ScriptSetBoneTransform( int iBone, HSCRIPT hTransform );
|
||||||
|
|
||||||
|
void ScriptAttachEntityToBone( HSCRIPT attachTarget, int boneIndexAttached, const Vector &bonePosition, const QAngle &boneAngles );
|
||||||
|
void ScriptRemoveBoneAttachment( HSCRIPT boneAttachment );
|
||||||
|
HSCRIPT ScriptGetBoneAttachment( int i );
|
||||||
|
|
||||||
|
int ScriptGetSequenceActivity( int iSequence ) { return GetSequenceActivity( iSequence ); }
|
||||||
|
float ScriptGetSequenceMoveDist( int iSequence ) { return GetSequenceMoveDist( GetModelPtr(), iSequence ); }
|
||||||
|
int ScriptSelectWeightedSequence( int activity ) { return SelectWeightedSequence( (Activity)activity ); }
|
||||||
|
|
||||||
|
// For VScript
|
||||||
|
int ScriptGetSkin() { return GetSkin(); }
|
||||||
|
void SetSkin( int iSkin ) { m_nSkin = iSkin; }
|
||||||
|
|
||||||
|
int GetForceBone() { return m_nForceBone; }
|
||||||
|
void SetForceBone( int iBone ) { m_nForceBone = iBone; }
|
||||||
|
const Vector& GetRagdollForce() { return m_vecForce; }
|
||||||
|
void SetRagdollForce( const Vector &vecForce ) { m_vecForce = vecForce; }
|
||||||
|
|
||||||
|
HSCRIPT ScriptBecomeRagdollOnClient();
|
||||||
|
|
||||||
|
static ScriptHook_t g_Hook_OnClientRagdoll;
|
||||||
|
static ScriptHook_t g_Hook_FireEvent;
|
||||||
|
//static ScriptHook_t g_Hook_BuildTransformations; // UNDONE: Thread access issues
|
||||||
|
|
||||||
|
float ScriptGetPoseParameter(const char* szName);
|
||||||
|
#endif
|
||||||
|
void ScriptSetPoseParameter(const char* szName, float fValue);
|
||||||
protected:
|
protected:
|
||||||
// View models scale their attachment positions to account for FOV. To get the unmodified
|
// View models scale their attachment positions to account for FOV. To get the unmodified
|
||||||
// attachment position (like if you're rendering something else during the view model's DrawModel call),
|
// attachment position (like if you're rendering something else during the view model's DrawModel call),
|
||||||
@ -480,6 +531,10 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CRagdoll *m_pRagdoll;
|
CRagdoll *m_pRagdoll;
|
||||||
|
C_BaseAnimating *m_pClientsideRagdoll; // From Alien Swarm SDK
|
||||||
|
#ifdef MAPBASE
|
||||||
|
C_BaseAnimating *m_pServerRagdoll; // Not from Alien Swarm SDK (note that this can exist without the entity having died)
|
||||||
|
#endif
|
||||||
|
|
||||||
// Texture group to use
|
// Texture group to use
|
||||||
int m_nSkin;
|
int m_nSkin;
|
||||||
@ -651,6 +706,9 @@ public:
|
|||||||
C_ClientRagdoll( bool bRestoring = true );
|
C_ClientRagdoll( bool bRestoring = true );
|
||||||
DECLARE_CLASS( C_ClientRagdoll, C_BaseAnimating );
|
DECLARE_CLASS( C_ClientRagdoll, C_BaseAnimating );
|
||||||
DECLARE_DATADESC();
|
DECLARE_DATADESC();
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
DECLARE_ENT_SCRIPTDESC();
|
||||||
|
#endif
|
||||||
|
|
||||||
// inherited from IPVSNotify
|
// inherited from IPVSNotify
|
||||||
virtual void OnPVSStatusChanged( bool bInPVS );
|
virtual void OnPVSStatusChanged( bool bInPVS );
|
||||||
@ -672,8 +730,17 @@ public:
|
|||||||
void FadeOut( void );
|
void FadeOut( void );
|
||||||
virtual float LastBoneChangedTime();
|
virtual float LastBoneChangedTime();
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
HSCRIPT ScriptGetRagdollObject( int iIndex );
|
||||||
|
int ScriptGetRagdollObjectCount();
|
||||||
|
#endif
|
||||||
|
|
||||||
bool m_bFadeOut;
|
bool m_bFadeOut;
|
||||||
bool m_bImportant;
|
bool m_bImportant;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Required to save/restore Alien Swarm SDK ragdoll LRU forced fade
|
||||||
|
float m_flForcedRetireTime;
|
||||||
|
#endif
|
||||||
float m_flEffectTime;
|
float m_flEffectTime;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -34,6 +34,10 @@ C_BaseCombatCharacter::C_BaseCombatCharacter()
|
|||||||
m_pGlowEffect = NULL;
|
m_pGlowEffect = NULL;
|
||||||
m_bGlowEnabled = false;
|
m_bGlowEnabled = false;
|
||||||
m_bOldGlowEnabled = false;
|
m_bOldGlowEnabled = false;
|
||||||
|
m_GlowColor.Init( 0.76f, 0.76f, 0.76f );
|
||||||
|
m_OldGlowColor = m_GlowColor;
|
||||||
|
m_GlowAlpha = 1.0f;
|
||||||
|
m_OldGlowAlpha = 1.0f;
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +70,8 @@ void C_BaseCombatCharacter::OnPreDataChanged( DataUpdateType_t updateType )
|
|||||||
|
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
m_bOldGlowEnabled = m_bGlowEnabled;
|
m_bOldGlowEnabled = m_bGlowEnabled;
|
||||||
|
m_OldGlowColor = m_GlowColor;
|
||||||
|
m_OldGlowAlpha = m_GlowAlpha;
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +83,7 @@ void C_BaseCombatCharacter::OnDataChanged( DataUpdateType_t updateType )
|
|||||||
BaseClass::OnDataChanged( updateType );
|
BaseClass::OnDataChanged( updateType );
|
||||||
|
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
if ( m_bOldGlowEnabled != m_bGlowEnabled )
|
if ( m_bOldGlowEnabled != m_bGlowEnabled || m_OldGlowColor != m_GlowColor || m_OldGlowAlpha != m_GlowAlpha )
|
||||||
{
|
{
|
||||||
UpdateGlowEffect();
|
UpdateGlowEffect();
|
||||||
}
|
}
|
||||||
@ -106,11 +112,13 @@ void C_BaseCombatCharacter::DoMuzzleFlash()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b )
|
void C_BaseCombatCharacter::GetGlowEffectColor( float *r, float *g, float *b, float *a )
|
||||||
{
|
{
|
||||||
*r = 0.76f;
|
*r = m_GlowColor.x;
|
||||||
*g = 0.76f;
|
*g = m_GlowColor.y;
|
||||||
*b = 0.76f;
|
*b = m_GlowColor.z;
|
||||||
|
if (a)
|
||||||
|
*a = m_GlowAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -127,10 +135,10 @@ void C_BaseCombatCharacter::UpdateGlowEffect( void )
|
|||||||
// create a new effect
|
// create a new effect
|
||||||
if ( m_bGlowEnabled )
|
if ( m_bGlowEnabled )
|
||||||
{
|
{
|
||||||
float r, g, b;
|
float r, g, b, a;
|
||||||
GetGlowEffectColor( &r, &g, &b );
|
GetGlowEffectColor( &r, &g, &b, &a );
|
||||||
|
|
||||||
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), 1.0, true );
|
m_pGlowEffect = new CGlowObject( this, Vector( r, g, b ), a, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +169,8 @@ BEGIN_RECV_TABLE(C_BaseCombatCharacter, DT_BaseCombatCharacter)
|
|||||||
RecvPropArray3( RECVINFO_ARRAY(m_hMyWeapons), RecvPropEHandle( RECVINFO( m_hMyWeapons[0] ) ) ),
|
RecvPropArray3( RECVINFO_ARRAY(m_hMyWeapons), RecvPropEHandle( RECVINFO( m_hMyWeapons[0] ) ) ),
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
RecvPropBool( RECVINFO( m_bGlowEnabled ) ),
|
RecvPropBool( RECVINFO( m_bGlowEnabled ) ),
|
||||||
|
RecvPropVector( RECVINFO( m_GlowColor ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_GlowAlpha ) ),
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
|
|
||||||
#ifdef INVASION_CLIENT_DLL
|
#ifdef INVASION_CLIENT_DLL
|
||||||
@ -178,3 +188,39 @@ BEGIN_PREDICTION_DATA( C_BaseCombatCharacter )
|
|||||||
DEFINE_PRED_ARRAY( m_hMyWeapons, FIELD_EHANDLE, MAX_WEAPONS, FTYPEDESC_INSENDTABLE ),
|
DEFINE_PRED_ARRAY( m_hMyWeapons, FIELD_EHANDLE, MAX_WEAPONS, FTYPEDESC_INSENDTABLE ),
|
||||||
|
|
||||||
END_PREDICTION_DATA()
|
END_PREDICTION_DATA()
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
|
||||||
|
BEGIN_ENT_SCRIPTDESC( C_BaseCombatCharacter, C_BaseAnimating, "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAmmoCount, "GetAmmoCount", "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetActiveWeapon, "GetActiveWeapon", "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetWeapon, "GetWeapon", "" )
|
||||||
|
END_SCRIPTDESC();
|
||||||
|
|
||||||
|
|
||||||
|
int C_BaseCombatCharacter::ScriptGetAmmoCount( int i )
|
||||||
|
{
|
||||||
|
Assert( i == -1 || i < MAX_AMMO_SLOTS );
|
||||||
|
|
||||||
|
if ( i < 0 || i >= MAX_AMMO_SLOTS )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return GetAmmoCount( i );
|
||||||
|
}
|
||||||
|
|
||||||
|
HSCRIPT C_BaseCombatCharacter::ScriptGetActiveWeapon()
|
||||||
|
{
|
||||||
|
return ToHScript( GetActiveWeapon() );
|
||||||
|
}
|
||||||
|
|
||||||
|
HSCRIPT C_BaseCombatCharacter::ScriptGetWeapon( int i )
|
||||||
|
{
|
||||||
|
Assert( i >= 0 && i < MAX_WEAPONS );
|
||||||
|
|
||||||
|
if ( i < 0 || i >= MAX_WEAPONS )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return ToHScript( GetWeapon(i) );
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -29,6 +29,9 @@ class C_BaseCombatCharacter : public C_BaseFlex
|
|||||||
public:
|
public:
|
||||||
DECLARE_CLIENTCLASS();
|
DECLARE_CLIENTCLASS();
|
||||||
DECLARE_PREDICTABLE();
|
DECLARE_PREDICTABLE();
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
DECLARE_ENT_SCRIPTDESC();
|
||||||
|
#endif
|
||||||
|
|
||||||
C_BaseCombatCharacter( void );
|
C_BaseCombatCharacter( void );
|
||||||
virtual ~C_BaseCombatCharacter( void );
|
virtual ~C_BaseCombatCharacter( void );
|
||||||
@ -96,9 +99,15 @@ public:
|
|||||||
|
|
||||||
#ifdef GLOWS_ENABLE
|
#ifdef GLOWS_ENABLE
|
||||||
CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; }
|
CGlowObject *GetGlowObject( void ){ return m_pGlowEffect; }
|
||||||
virtual void GetGlowEffectColor( float *r, float *g, float *b );
|
virtual void GetGlowEffectColor( float *r, float *g, float *b, float *a = NULL );
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
int ScriptGetAmmoCount( int i );
|
||||||
|
HSCRIPT ScriptGetActiveWeapon();
|
||||||
|
HSCRIPT ScriptGetWeapon( int i );
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
float m_flNextAttack;
|
float m_flNextAttack;
|
||||||
@ -124,6 +133,10 @@ private:
|
|||||||
bool m_bGlowEnabled;
|
bool m_bGlowEnabled;
|
||||||
bool m_bOldGlowEnabled;
|
bool m_bOldGlowEnabled;
|
||||||
CGlowObject *m_pGlowEffect;
|
CGlowObject *m_pGlowEffect;
|
||||||
|
Vector m_GlowColor;
|
||||||
|
Vector m_OldGlowColor;
|
||||||
|
float m_GlowAlpha;
|
||||||
|
int m_OldGlowAlpha;
|
||||||
#endif // GLOWS_ENABLE
|
#endif // GLOWS_ENABLE
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
#include "tier1/KeyValues.h"
|
#include "tier1/KeyValues.h"
|
||||||
#include "toolframework/itoolframework.h"
|
#include "toolframework/itoolframework.h"
|
||||||
#include "toolframework_client.h"
|
#include "toolframework_client.h"
|
||||||
|
#ifdef MAPBASE
|
||||||
|
#include "viewrender.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
@ -82,6 +85,24 @@ static inline bool ShouldDrawLocalPlayerViewModel( void )
|
|||||||
{
|
{
|
||||||
#if defined( PORTAL )
|
#if defined( PORTAL )
|
||||||
return false;
|
return false;
|
||||||
|
#elif MAPBASE
|
||||||
|
// We shouldn't draw the viewmodel externally.
|
||||||
|
C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer();
|
||||||
|
if (localplayer)
|
||||||
|
{
|
||||||
|
if (localplayer->m_bDrawPlayerModelExternally)
|
||||||
|
{
|
||||||
|
// If this isn't the main view, draw the weapon.
|
||||||
|
view_id_t viewID = CurrentViewID();
|
||||||
|
if (viewID != VIEW_MAIN && viewID != VIEW_INTRO_CAMERA)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Since we already have the local player, check its own ShouldDrawThisPlayer() to avoid extra checks
|
||||||
|
return !localplayer->ShouldDrawThisPlayer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
#else
|
#else
|
||||||
return !C_BasePlayer::ShouldDrawLocalPlayer();
|
return !C_BasePlayer::ShouldDrawLocalPlayer();
|
||||||
#endif
|
#endif
|
||||||
@ -104,9 +125,15 @@ void C_BaseCombatWeapon::OnRestore()
|
|||||||
|
|
||||||
int C_BaseCombatWeapon::GetWorldModelIndex( void )
|
int C_BaseCombatWeapon::GetWorldModelIndex( void )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
int iIndex = GetOwner() ? m_iWorldModelIndex.Get() : m_iDroppedModelIndex.Get();
|
||||||
|
#else
|
||||||
|
int iIndex = m_iWorldModelIndex.Get();
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( GameRules() )
|
if ( GameRules() )
|
||||||
{
|
{
|
||||||
const char *pBaseName = modelinfo->GetModelName( modelinfo->GetModel( m_iWorldModelIndex ) );
|
const char *pBaseName = modelinfo->GetModelName( modelinfo->GetModel( iIndex ) );
|
||||||
const char *pTranslatedName = GameRules()->TranslateEffectForVisionFilter( "weapons", pBaseName );
|
const char *pTranslatedName = GameRules()->TranslateEffectForVisionFilter( "weapons", pBaseName );
|
||||||
|
|
||||||
if ( pTranslatedName != pBaseName )
|
if ( pTranslatedName != pBaseName )
|
||||||
@ -115,7 +142,7 @@ int C_BaseCombatWeapon::GetWorldModelIndex( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_iWorldModelIndex;
|
return iIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -156,11 +183,8 @@ void C_BaseCombatWeapon::OnDataChanged( DataUpdateType_t updateType )
|
|||||||
}
|
}
|
||||||
else // weapon carried by other player or not at all
|
else // weapon carried by other player or not at all
|
||||||
{
|
{
|
||||||
int overrideModelIndex = CalcOverrideModelIndex();
|
// See comment below
|
||||||
if( overrideModelIndex != -1 && overrideModelIndex != GetModelIndex() )
|
EnsureCorrectRenderingModel();
|
||||||
{
|
|
||||||
SetModelIndex( overrideModelIndex );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateVisibility();
|
UpdateVisibility();
|
||||||
@ -432,6 +456,12 @@ bool C_BaseCombatWeapon::ShouldDraw( void )
|
|||||||
if ( !ShouldDrawLocalPlayerViewModel() )
|
if ( !ShouldDrawLocalPlayerViewModel() )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// We're drawing this in non-main views, handle it in DrawModel()
|
||||||
|
if ( pLocalPlayer->m_bDrawPlayerModelExternally )
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
|
||||||
// don't draw active weapon if not in some kind of 3rd person mode, the viewmodel will do that
|
// don't draw active weapon if not in some kind of 3rd person mode, the viewmodel will do that
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -478,15 +508,44 @@ int C_BaseCombatWeapon::DrawModel( int flags )
|
|||||||
// check if local player chases owner of this weapon in first person
|
// check if local player chases owner of this weapon in first person
|
||||||
C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer();
|
C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer();
|
||||||
|
|
||||||
if ( localplayer && localplayer->IsObserver() && GetOwner() )
|
if ( localplayer )
|
||||||
{
|
{
|
||||||
// don't draw weapon if chasing this guy as spectator
|
#ifdef MAPBASE
|
||||||
// we don't check that in ShouldDraw() since this may change
|
if (localplayer->m_bDrawPlayerModelExternally)
|
||||||
// without notification
|
{
|
||||||
|
// If this isn't the main view, draw the weapon.
|
||||||
|
view_id_t viewID = CurrentViewID();
|
||||||
|
if ( (!localplayer->InFirstPersonView() || (viewID != VIEW_MAIN && viewID != VIEW_INTRO_CAMERA)) && (viewID != VIEW_SHADOW_DEPTH_TEXTURE || !localplayer->IsEffectActive(EF_DIMLIGHT)) )
|
||||||
|
{
|
||||||
|
// TODO: Is this inefficient?
|
||||||
|
int nModelIndex = GetModelIndex();
|
||||||
|
int nWorldModelIndex = GetWorldModelIndex();
|
||||||
|
if (nModelIndex != nWorldModelIndex)
|
||||||
|
{
|
||||||
|
SetModelIndex(nWorldModelIndex);
|
||||||
|
}
|
||||||
|
|
||||||
if ( localplayer->GetObserverMode() == OBS_MODE_IN_EYE &&
|
int iDraw = BaseClass::DrawModel(flags);
|
||||||
localplayer->GetObserverTarget() == GetOwner() )
|
|
||||||
return false;
|
if (nModelIndex != nWorldModelIndex)
|
||||||
|
{
|
||||||
|
SetModelIndex(nModelIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return iDraw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if ( localplayer->IsObserver() && GetOwner() )
|
||||||
|
{
|
||||||
|
// don't draw weapon if chasing this guy as spectator
|
||||||
|
// we don't check that in ShouldDraw() since this may change
|
||||||
|
// without notification
|
||||||
|
|
||||||
|
if ( localplayer->GetObserverMode() == OBS_MODE_IN_EYE &&
|
||||||
|
localplayer->GetObserverTarget() == GetOwner() )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return BaseClass::DrawModel( flags );
|
return BaseClass::DrawModel( flags );
|
||||||
@ -514,6 +573,35 @@ int C_BaseCombatWeapon::CalcOverrideModelIndex()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// If the local player is visible (thirdperson mode, tf2 taunts, etc., then make sure that we are using the
|
||||||
|
// w_ (world) model not the v_ (view) model or else the model can flicker, etc.
|
||||||
|
// Otherwise, if we're not the local player, always use the world model
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void C_BaseCombatWeapon::EnsureCorrectRenderingModel()
|
||||||
|
{
|
||||||
|
C_BasePlayer *localplayer = C_BasePlayer::GetLocalPlayer();
|
||||||
|
if ( localplayer &&
|
||||||
|
localplayer == GetOwner() &&
|
||||||
|
!ShouldDrawUsingViewModel() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BRJ 10/14/02
|
||||||
|
// FIXME: Remove when Yahn's client-side prediction is done
|
||||||
|
// It's a hacky workaround for the model indices fighting
|
||||||
|
// (GetRenderBounds uses the model index, which is for the view model)
|
||||||
|
SetModelIndex( GetWorldModelIndex() );
|
||||||
|
|
||||||
|
// Validate our current sequence just in case ( in theory the view and weapon models should have the same sequences for sequences that overlap at least )
|
||||||
|
CStudioHdr *pStudioHdr = GetModelPtr();
|
||||||
|
if ( pStudioHdr &&
|
||||||
|
GetSequence() >= pStudioHdr->GetNumSeq() )
|
||||||
|
{
|
||||||
|
SetSequence( 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// tool recording
|
// tool recording
|
||||||
|
@ -40,6 +40,14 @@
|
|||||||
#include "cdll_bounded_cvars.h"
|
#include "cdll_bounded_cvars.h"
|
||||||
#include "inetchannelinfo.h"
|
#include "inetchannelinfo.h"
|
||||||
#include "proto_version.h"
|
#include "proto_version.h"
|
||||||
|
#ifdef MAPBASE
|
||||||
|
#include "viewrender.h"
|
||||||
|
#endif
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
#include "vscript_client.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gamestringpool.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
@ -420,6 +428,148 @@ BEGIN_RECV_TABLE_NOBASE( C_BaseEntity, DT_AnimTimeMustBeFirst )
|
|||||||
RecvPropInt( RECVINFO(m_flAnimTime), 0, RecvProxy_AnimTime ),
|
RecvPropInt( RECVINFO(m_flAnimTime), 0, RecvProxy_AnimTime ),
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
ScriptHook_t C_BaseEntity::g_Hook_UpdateOnRemove;
|
||||||
|
ScriptHook_t C_BaseEntity::g_Hook_ModifyEmitSoundParams;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BEGIN_ENT_SCRIPTDESC_ROOT( C_BaseEntity, "Root class of all client-side entities" )
|
||||||
|
DEFINE_SCRIPT_INSTANCE_HELPER( &g_BaseEntityScriptInstanceHelper )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( GetAbsOrigin, "GetOrigin", "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetForward, "GetForwardVector", "Get the forward vector of the entity" )
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRight, "GetRightVector", "Get the right vector of the entity" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( GetTeamNumber, "GetTeam", "Gets this entity's team" )
|
||||||
|
#endif
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetLeft, "GetLeftVector", SCRIPT_HIDE )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( GetTeamNumber, "GetTeamNumber", SCRIPT_HIDE )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetUp, "GetUpVector", "Get the up vector of the entity" )
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
DEFINE_SCRIPTFUNC( ValidateScriptScope, "Ensure that an entity's script scope has been created" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetOrCreatePrivateScriptScope, "Create and retrieve the script-side data associated with an entity" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetScriptScope, "Retrieve the script-side data associated with an entity" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetHealth, "" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetMaxHealth, "" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetModelName, "GetModelName", "Returns the name of the model" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptStopSound, "StopSound", "Stops a sound from this entity." )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptEmitSound, "EmitSound", "Plays a sound from this entity." )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( VScriptPrecacheScriptSound, "PrecacheSoundScript", "Precache a sound for later playing." )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSoundDuration, "GetSoundDuration", "Returns float duration of the sound. Takes soundname and optional actormodelname." )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetClassname, "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( GetEntityName, "GetName", "" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( SetAbsOrigin, "SetOrigin", "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetForward, "SetForwardVector", "Set the orientation of the entity to have this forward vector" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetLocalOrigin, "GetLocalOrigin" )
|
||||||
|
DEFINE_SCRIPTFUNC( SetLocalOrigin, "SetLocalOrigin" )
|
||||||
|
DEFINE_SCRIPTFUNC( GetLocalAngles, "GetLocalAngles" )
|
||||||
|
DEFINE_SCRIPTFUNC( SetLocalAngles, "SetLocalAngles" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( WorldSpaceCenter, "GetCenter", "Get vector to center of object - absolute coords" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptEyePosition, "EyePosition", "Get vector to eye position - absolute coords" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptEyeAngles, "EyeAngles", "Get eye pitch, yaw, roll as a vector" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( GetAbsAngles, "GetAngles", "Get entity pitch, yaw, roll as a vector" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( SetAbsAngles, "SetAngles", "Set entity pitch, yaw, roll" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( SetSize, "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoundingMins, "GetBoundingMins", "Get a vector containing min bounds, centered on object" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetBoundingMaxs, "GetBoundingMaxs", "Get a vector containing max bounds, centered on object" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptEntityToWorldTransform, "EntityToWorldTransform", "Get the entity's transform" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetPhysicsObject, "GetPhysicsObject", "Get the entity's physics object if it has one" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptPhysicsInitNormal, "PhysicsInitNormal", "Initializes the entity's physics object with the specified solid type, solid flags, and whether to start asleep" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptPhysicsDestroyObject, "PhysicsDestroyObject", "Destroys the entity's physics object" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetWaterLevel, "Get current level of water submergence" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetParent, "SetParent", "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetMoveParent, "GetMoveParent", "If in hierarchy, retrieves the entity's parent" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRootMoveParent, "GetRootMoveParent", "If in hierarchy, walks up the hierarchy to find the root parent" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptFirstMoveChild, "FirstMoveChild", "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptNextMovePeer, "NextMovePeer", "" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptFollowEntity, "FollowEntity", "Begin following the specified entity. This makes this entity non-solid, parents it to the target entity, and teleports it to the specified entity's origin. The second parameter is whether or not to use bonemerging while following." )
|
||||||
|
DEFINE_SCRIPTFUNC( StopFollowingEntity, "Stops following an entity if we're following one." )
|
||||||
|
DEFINE_SCRIPTFUNC( IsFollowingEntity, "Returns true if this entity is following another entity." )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetFollowedEntity, "GetFollowedEntity", "Get the entity we're following." )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( GetScriptOwnerEntity, "GetOwner", "Gets this entity's owner" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( SetScriptOwnerEntity, "SetOwner", "Sets this entity's owner" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetGroundEntity, "GetGroundEntity", "Get the entity we're standing on." )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetGroundEntity, "SetGroundEntity", "Set the entity we're standing on." )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorVector, "GetRenderColorVector", "Get the render color as a vector" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorR, "GetRenderColorR", "Get the render color's R value" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorG, "GetRenderColorG", "Get the render color's G value" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetColorB, "GetRenderColorB", "Get the render color's B value" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetAlpha, "GetRenderAlpha", "Get the render color's alpha value" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorVector, "SetRenderColorVector", "Set the render color as a vector" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColor, "SetRenderColor", "Set the render color" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorR, "SetRenderColorR", "Set the render color's R value" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorG, "SetRenderColorG", "Set the render color's G value" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetColorB, "SetRenderColorB", "Set the render color's B value" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetAlpha, "SetRenderAlpha", "Set the render color's alpha value" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetRenderMode, "GetRenderMode", "Get render mode" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetRenderMode, "SetRenderMode", "Set render mode" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetEffects, "Get effects" )
|
||||||
|
DEFINE_SCRIPTFUNC( AddEffects, "Add effect(s)" )
|
||||||
|
DEFINE_SCRIPTFUNC( RemoveEffects, "Remove effect(s)" )
|
||||||
|
DEFINE_SCRIPTFUNC( ClearEffects, "Clear effect(s)" )
|
||||||
|
DEFINE_SCRIPTFUNC( SetEffects, "Set effect(s)" )
|
||||||
|
DEFINE_SCRIPTFUNC( IsEffectActive, "Check if an effect is active" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetFlags, "Get flags" )
|
||||||
|
DEFINE_SCRIPTFUNC( AddFlag, "Add flag" )
|
||||||
|
DEFINE_SCRIPTFUNC( RemoveFlag, "Remove flag" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetEFlags, "Get Eflags" )
|
||||||
|
DEFINE_SCRIPTFUNC( AddEFlags, "Add Eflags" )
|
||||||
|
DEFINE_SCRIPTFUNC( RemoveEFlags, "Remove Eflags" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptGetMoveType, "GetMoveType", "Get the move type" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetMoveType, "SetMoveType", "Set the move type" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetCollisionGroup, "Get the collision group" )
|
||||||
|
DEFINE_SCRIPTFUNC( SetCollisionGroup, "Set the collision group" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( GetSolidFlags, "Get solid flags" )
|
||||||
|
DEFINE_SCRIPTFUNC( AddSolidFlags, "Add solid flags" )
|
||||||
|
DEFINE_SCRIPTFUNC( RemoveSolidFlags, "Remove solid flags" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( IsPlayer, "Returns true if this entity is a player." )
|
||||||
|
DEFINE_SCRIPTFUNC( IsNPC, "Returns true if this entity is a NPC." )
|
||||||
|
//DEFINE_SCRIPTFUNC( IsCombatCharacter, "Returns true if this entity is a combat character (player or NPC)." )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( IsBaseCombatWeapon, "IsWeapon", "Returns true if this entity is a weapon." )
|
||||||
|
DEFINE_SCRIPTFUNC( IsWorld, "Returns true if this entity is the world." )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC( SetModel, "Set client-only entity model" )
|
||||||
|
//DEFINE_SCRIPTFUNC_NAMED( ScriptInitializeAsClientEntity, "InitializeAsClientEntity", "" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( Remove, "Destroy", "Remove clientside entity" )
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( GetEntityIndex, "entindex", "" )
|
||||||
|
|
||||||
|
DEFINE_SCRIPTFUNC_NAMED( ScriptSetContextThink, "SetContextThink", "Set a think function on this entity." )
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_SIMPLE_SCRIPTHOOK( C_BaseEntity::g_Hook_UpdateOnRemove, "UpdateOnRemove", FIELD_VOID, "Called when the entity is being removed." )
|
||||||
|
|
||||||
|
BEGIN_SCRIPTHOOK( C_BaseEntity::g_Hook_ModifyEmitSoundParams, "ModifyEmitSoundParams", FIELD_VOID, "Called every time a sound is emitted on this entity, allowing for its parameters to be modified." )
|
||||||
|
DEFINE_SCRIPTHOOK_PARAM( "params", FIELD_HSCRIPT )
|
||||||
|
END_SCRIPTHOOK()
|
||||||
|
|
||||||
|
#endif // MAPBASE_VSCRIPT
|
||||||
|
|
||||||
|
END_SCRIPTDESC();
|
||||||
|
|
||||||
#ifndef NO_ENTITY_PREDICTION
|
#ifndef NO_ENTITY_PREDICTION
|
||||||
BEGIN_RECV_TABLE_NOBASE( C_BaseEntity, DT_PredictableId )
|
BEGIN_RECV_TABLE_NOBASE( C_BaseEntity, DT_PredictableId )
|
||||||
@ -451,6 +601,10 @@ BEGIN_RECV_TABLE_NOBASE(C_BaseEntity, DT_BaseEntity)
|
|||||||
RecvPropInt(RECVINFO(m_nRenderMode)),
|
RecvPropInt(RECVINFO(m_nRenderMode)),
|
||||||
RecvPropInt(RECVINFO(m_nRenderFX)),
|
RecvPropInt(RECVINFO(m_nRenderFX)),
|
||||||
RecvPropInt(RECVINFO(m_clrRender)),
|
RecvPropInt(RECVINFO(m_clrRender)),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropInt(RECVINFO(m_iViewHideFlags)),
|
||||||
|
RecvPropBool(RECVINFO(m_bDisableFlashlight)),
|
||||||
|
#endif
|
||||||
RecvPropInt(RECVINFO(m_iTeamNum)),
|
RecvPropInt(RECVINFO(m_iTeamNum)),
|
||||||
RecvPropInt(RECVINFO(m_CollisionGroup)),
|
RecvPropInt(RECVINFO(m_CollisionGroup)),
|
||||||
RecvPropFloat(RECVINFO(m_flElasticity)),
|
RecvPropFloat(RECVINFO(m_flElasticity)),
|
||||||
@ -460,6 +614,8 @@ BEGIN_RECV_TABLE_NOBASE(C_BaseEntity, DT_BaseEntity)
|
|||||||
RecvPropInt( RECVINFO_NAME(m_hNetworkMoveParent, moveparent), 0, RecvProxy_IntToMoveParent ),
|
RecvPropInt( RECVINFO_NAME(m_hNetworkMoveParent, moveparent), 0, RecvProxy_IntToMoveParent ),
|
||||||
RecvPropInt( RECVINFO( m_iParentAttachment ) ),
|
RecvPropInt( RECVINFO( m_iParentAttachment ) ),
|
||||||
|
|
||||||
|
RecvPropString(RECVINFO(m_iName)),
|
||||||
|
|
||||||
RecvPropInt( "movetype", 0, SIZEOF_IGNORE, 0, RecvProxy_MoveType ),
|
RecvPropInt( "movetype", 0, SIZEOF_IGNORE, 0, RecvProxy_MoveType ),
|
||||||
RecvPropInt( "movecollide", 0, SIZEOF_IGNORE, 0, RecvProxy_MoveCollide ),
|
RecvPropInt( "movecollide", 0, SIZEOF_IGNORE, 0, RecvProxy_MoveCollide ),
|
||||||
RecvPropDataTable( RECVINFO_DT( m_Collision ), 0, &REFERENCE_RECV_TABLE(DT_CollisionProperty) ),
|
RecvPropDataTable( RECVINFO_DT( m_Collision ), 0, &REFERENCE_RECV_TABLE(DT_CollisionProperty) ),
|
||||||
@ -1089,6 +1245,8 @@ bool C_BaseEntity::Init( int entnum, int iSerialNum )
|
|||||||
|
|
||||||
m_nCreationTick = gpGlobals->tickcount;
|
m_nCreationTick = gpGlobals->tickcount;
|
||||||
|
|
||||||
|
m_hScriptInstance = NULL;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1159,6 +1317,7 @@ void C_BaseEntity::Term()
|
|||||||
g_Predictables.RemoveFromPredictablesList( GetClientHandle() );
|
g_Predictables.RemoveFromPredictablesList( GetClientHandle() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If it's play simulated, remove from simulation list if the player still exists...
|
// If it's play simulated, remove from simulation list if the player still exists...
|
||||||
if ( IsPlayerSimulated() && C_BasePlayer::GetLocalPlayer() )
|
if ( IsPlayerSimulated() && C_BasePlayer::GetLocalPlayer() )
|
||||||
{
|
{
|
||||||
@ -1195,6 +1354,27 @@ void C_BaseEntity::Term()
|
|||||||
RemoveFromLeafSystem();
|
RemoveFromLeafSystem();
|
||||||
|
|
||||||
RemoveFromAimEntsList();
|
RemoveFromAimEntsList();
|
||||||
|
|
||||||
|
if ( m_hScriptInstance )
|
||||||
|
{
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
if ( m_ScriptScope.IsInitialized() && g_Hook_UpdateOnRemove.CanRunInScope( m_ScriptScope ) )
|
||||||
|
{
|
||||||
|
g_Hook_UpdateOnRemove.Call( m_ScriptScope, NULL, NULL );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
g_pScriptVM->RemoveInstance( m_hScriptInstance );
|
||||||
|
m_hScriptInstance = NULL;
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
FOR_EACH_VEC( m_ScriptThinkFuncs, i )
|
||||||
|
{
|
||||||
|
HSCRIPT h = m_ScriptThinkFuncs[i]->m_hfnThink;
|
||||||
|
if ( h ) g_pScriptVM->ReleaseScript( h );
|
||||||
|
}
|
||||||
|
m_ScriptThinkFuncs.PurgeAndDeleteElements();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1544,6 +1724,11 @@ bool C_BaseEntity::ShouldReceiveProjectedTextures( int flags )
|
|||||||
if ( IsEffectActive( EF_NODRAW ) )
|
if ( IsEffectActive( EF_NODRAW ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( m_bDisableFlashlight )
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
if( flags & SHADOW_FLAGS_FLASHLIGHT )
|
if( flags & SHADOW_FLAGS_FLASHLIGHT )
|
||||||
{
|
{
|
||||||
if ( GetRenderMode() > kRenderNormal && GetRenderColor().a == 0 )
|
if ( GetRenderMode() > kRenderNormal && GetRenderColor().a == 0 )
|
||||||
@ -1978,6 +2163,17 @@ int C_BaseEntity::DrawModel( int flags )
|
|||||||
return drawn;
|
return drawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_iViewHideFlags > 0)
|
||||||
|
{
|
||||||
|
// Hide this entity if it's not supposed to be drawn in this view.
|
||||||
|
if (m_iViewHideFlags & (1 << CurrentViewID()))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int modelType = modelinfo->GetModelType( model );
|
int modelType = modelinfo->GetModelType( model );
|
||||||
switch ( modelType )
|
switch ( modelType )
|
||||||
{
|
{
|
||||||
@ -4741,9 +4937,15 @@ C_BaseEntity *C_BaseEntity::Instance( int iEnt )
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
|
#if _MSC_VER < 1900
|
||||||
#pragma warning( push )
|
#pragma warning( push )
|
||||||
#include <typeinfo.h>
|
#include <typeinfo.h>
|
||||||
#pragma warning( pop )
|
#pragma warning( pop )
|
||||||
|
#else
|
||||||
|
#include <typeinfo>
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -5981,6 +6183,9 @@ BEGIN_DATADESC_NO_BASE( C_BaseEntity )
|
|||||||
DEFINE_FIELD( m_angAbsRotation, FIELD_VECTOR ),
|
DEFINE_FIELD( m_angAbsRotation, FIELD_VECTOR ),
|
||||||
DEFINE_ARRAY( m_rgflCoordinateFrame, FIELD_FLOAT, 12 ), // NOTE: MUST BE IN LOCAL SPACE, NOT POSITION_VECTOR!!! (see CBaseEntity::Restore)
|
DEFINE_ARRAY( m_rgflCoordinateFrame, FIELD_FLOAT, 12 ), // NOTE: MUST BE IN LOCAL SPACE, NOT POSITION_VECTOR!!! (see CBaseEntity::Restore)
|
||||||
DEFINE_FIELD( m_fFlags, FIELD_INTEGER ),
|
DEFINE_FIELD( m_fFlags, FIELD_INTEGER ),
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
DEFINE_FIELD( m_iszScriptId, FIELD_STRING ),
|
||||||
|
#endif
|
||||||
END_DATADESC()
|
END_DATADESC()
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -6425,6 +6630,187 @@ int C_BaseEntity::GetCreationTick() const
|
|||||||
return m_nCreationTick;
|
return m_nCreationTick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
HSCRIPT C_BaseEntity::GetScriptInstance()
|
||||||
|
{
|
||||||
|
if (!m_hScriptInstance)
|
||||||
|
{
|
||||||
|
if (m_iszScriptId == NULL_STRING)
|
||||||
|
{
|
||||||
|
char* szName = (char*)stackalloc(1024);
|
||||||
|
g_pScriptVM->GenerateUniqueKey((m_iName != NULL_STRING) ? STRING(GetEntityName()) : GetClassname(), szName, 1024);
|
||||||
|
m_iszScriptId = AllocPooledString(szName);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_hScriptInstance = g_pScriptVM->RegisterInstance(GetScriptDesc(), this);
|
||||||
|
g_pScriptVM->SetInstanceUniqeId(m_hScriptInstance, STRING(m_iszScriptId));
|
||||||
|
}
|
||||||
|
return m_hScriptInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Using my edict, cook up a unique VScript scope that's private to me, and
|
||||||
|
// persistent.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool C_BaseEntity::ValidateScriptScope()
|
||||||
|
{
|
||||||
|
if (!m_ScriptScope.IsInitialized())
|
||||||
|
{
|
||||||
|
if (scriptmanager == NULL)
|
||||||
|
{
|
||||||
|
ExecuteOnce(DevMsg("Cannot execute script because scripting is disabled (-scripting)\n"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_pScriptVM == NULL)
|
||||||
|
{
|
||||||
|
ExecuteOnce(DevMsg(" Cannot execute script because there is no available VM\n"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force instance creation
|
||||||
|
GetScriptInstance();
|
||||||
|
|
||||||
|
EHANDLE hThis;
|
||||||
|
hThis.Set(this);
|
||||||
|
|
||||||
|
bool bResult = m_ScriptScope.Init(STRING(m_iszScriptId));
|
||||||
|
|
||||||
|
if (!bResult)
|
||||||
|
{
|
||||||
|
DevMsg("%s couldn't create ScriptScope!\n", GetDebugName());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
g_pScriptVM->SetValue(m_ScriptScope, "self", GetScriptInstance());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Returns true if the function was located and called. false otherwise.
|
||||||
|
// NOTE: Assumes the function takes no parameters at the moment.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool C_BaseEntity::CallScriptFunction( const char* pFunctionName, ScriptVariant_t* pFunctionReturn )
|
||||||
|
{
|
||||||
|
if (!ValidateScriptScope())
|
||||||
|
{
|
||||||
|
DevMsg("\n***\nFAILED to create private ScriptScope. ABORTING script\n***\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HSCRIPT hFunc = m_ScriptScope.LookupFunction(pFunctionName);
|
||||||
|
|
||||||
|
if (hFunc)
|
||||||
|
{
|
||||||
|
m_ScriptScope.Call(hFunc, pFunctionReturn);
|
||||||
|
m_ScriptScope.ReleaseFunction(hFunc);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Gets a function handle
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
HSCRIPT C_BaseEntity::LookupScriptFunction( const char* pFunctionName )
|
||||||
|
{
|
||||||
|
if (!m_ScriptScope.IsInitialized())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_ScriptScope.LookupFunction(pFunctionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Calls and releases a function handle (ASSUMES SCRIPT SCOPE AND FUNCTION ARE VALID!)
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool C_BaseEntity::CallScriptFunctionHandle( HSCRIPT hFunc, ScriptVariant_t* pFunctionReturn )
|
||||||
|
{
|
||||||
|
m_ScriptScope.Call(hFunc, pFunctionReturn);
|
||||||
|
m_ScriptScope.ReleaseFunction(hFunc);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Load, compile, and run a script file from disk.
|
||||||
|
// Input : *pScriptFile - The filename of the script file.
|
||||||
|
// bUseRootScope - If true, runs this script in the root scope, not
|
||||||
|
// in this entity's private scope.
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool C_BaseEntity::RunScriptFile( const char* pScriptFile, bool bUseRootScope )
|
||||||
|
{
|
||||||
|
if (!ValidateScriptScope())
|
||||||
|
{
|
||||||
|
DevMsg("\n***\nFAILED to create private ScriptScope. ABORTING script\n***\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bUseRootScope)
|
||||||
|
{
|
||||||
|
return VScriptRunScript(pScriptFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return VScriptRunScript(pScriptFile, m_ScriptScope, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose: Compile and execute a discrete string of script source code
|
||||||
|
// Input : *pScriptText - A string containing script code to compile and run
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool C_BaseEntity::RunScript( const char* pScriptText, const char* pDebugFilename )
|
||||||
|
{
|
||||||
|
if (!ValidateScriptScope())
|
||||||
|
{
|
||||||
|
DevMsg("\n***\nFAILED to create private ScriptScope. ABORTING script\n***\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_ScriptScope.Run(pScriptText, pDebugFilename) == SCRIPT_ERROR)
|
||||||
|
{
|
||||||
|
DevWarning(" Entity %s encountered an error in RunScript()\n", GetDebugName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
HSCRIPT C_BaseEntity::ScriptGetMoveParent( void )
|
||||||
|
{
|
||||||
|
return ToHScript( GetMoveParent() );
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
HSCRIPT C_BaseEntity::ScriptGetRootMoveParent()
|
||||||
|
{
|
||||||
|
return ToHScript( GetRootMoveParent() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
HSCRIPT C_BaseEntity::ScriptFirstMoveChild( void )
|
||||||
|
{
|
||||||
|
return ToHScript( FirstMoveChild() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
HSCRIPT C_BaseEntity::ScriptNextMovePeer( void )
|
||||||
|
{
|
||||||
|
return ToHScript( NextMovePeer() );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void CC_CL_Find_Ent( const CCommand& args )
|
void CC_CL_Find_Ent( const CCommand& args )
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,9 @@
|
|||||||
#include "toolframework/itoolentity.h"
|
#include "toolframework/itoolentity.h"
|
||||||
#include "tier0/threadtools.h"
|
#include "tier0/threadtools.h"
|
||||||
|
|
||||||
|
#include "vscript/ivscript.h"
|
||||||
|
#include "vscript_shared.h"
|
||||||
|
|
||||||
class C_Team;
|
class C_Team;
|
||||||
class IPhysicsObject;
|
class IPhysicsObject;
|
||||||
class IClientVehicle;
|
class IClientVehicle;
|
||||||
@ -158,6 +161,15 @@ struct thinkfunc_t
|
|||||||
int m_nLastThinkTick;
|
int m_nLastThinkTick;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
struct scriptthinkfunc_t
|
||||||
|
{
|
||||||
|
float m_flNextThink;
|
||||||
|
HSCRIPT m_hfnThink;
|
||||||
|
unsigned m_iContextHash;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CREATE_PREDICTED_ENTITY( className ) \
|
#define CREATE_PREDICTED_ENTITY( className ) \
|
||||||
C_BaseEntity::CreatePredictedEntityByName( className, __FILE__, __LINE__ );
|
C_BaseEntity::CreatePredictedEntityByName( className, __FILE__, __LINE__ );
|
||||||
|
|
||||||
@ -183,6 +195,8 @@ public:
|
|||||||
DECLARE_DATADESC();
|
DECLARE_DATADESC();
|
||||||
DECLARE_CLIENTCLASS();
|
DECLARE_CLIENTCLASS();
|
||||||
DECLARE_PREDICTABLE();
|
DECLARE_PREDICTABLE();
|
||||||
|
// script description
|
||||||
|
DECLARE_ENT_SCRIPTDESC();
|
||||||
|
|
||||||
C_BaseEntity();
|
C_BaseEntity();
|
||||||
virtual ~C_BaseEntity();
|
virtual ~C_BaseEntity();
|
||||||
@ -256,6 +270,40 @@ public:
|
|||||||
|
|
||||||
string_t m_iClassname;
|
string_t m_iClassname;
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
// VSCRIPT
|
||||||
|
bool ValidateScriptScope();
|
||||||
|
bool CallScriptFunction( const char* pFunctionName, ScriptVariant_t* pFunctionReturn );
|
||||||
|
|
||||||
|
HSCRIPT GetOrCreatePrivateScriptScope();
|
||||||
|
HSCRIPT GetScriptScope() { return m_ScriptScope; }
|
||||||
|
|
||||||
|
HSCRIPT LookupScriptFunction(const char* pFunctionName);
|
||||||
|
bool CallScriptFunctionHandle(HSCRIPT hFunc, ScriptVariant_t* pFunctionReturn);
|
||||||
|
|
||||||
|
bool RunScriptFile( const char* pScriptFile, bool bUseRootScope = false );
|
||||||
|
bool RunScript( const char* pScriptText, const char* pDebugFilename = "C_BaseEntity::RunScript" );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HSCRIPT GetScriptOwnerEntity();
|
||||||
|
virtual void SetScriptOwnerEntity(HSCRIPT pOwner);
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
HSCRIPT ScriptGetGroundEntity();
|
||||||
|
void ScriptSetGroundEntity( HSCRIPT hGroundEnt );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
HSCRIPT GetScriptInstance();
|
||||||
|
|
||||||
|
HSCRIPT m_hScriptInstance;
|
||||||
|
string_t m_iszScriptId;
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
CScriptScope m_ScriptScope;
|
||||||
|
|
||||||
|
static ScriptHook_t g_Hook_UpdateOnRemove;
|
||||||
|
static ScriptHook_t g_Hook_ModifyEmitSoundParams;
|
||||||
|
#endif
|
||||||
|
|
||||||
// IClientUnknown overrides.
|
// IClientUnknown overrides.
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -357,6 +405,11 @@ public:
|
|||||||
|
|
||||||
virtual int entindex( void ) const;
|
virtual int entindex( void ) const;
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
// "I don't know why but wrapping entindex() works, while calling it directly crashes."
|
||||||
|
inline int GetEntityIndex() const { return entindex(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// This works for client-only entities and returns the GetEntryIndex() of the entity's handle,
|
// This works for client-only entities and returns the GetEntryIndex() of the entity's handle,
|
||||||
// so the sound system can get an IClientEntity from it.
|
// so the sound system can get an IClientEntity from it.
|
||||||
int GetSoundSourceIndex() const;
|
int GetSoundSourceIndex() const;
|
||||||
@ -858,6 +911,7 @@ public:
|
|||||||
void SetSize( const Vector &vecMin, const Vector &vecMax ); // UTIL_SetSize( pev, mins, maxs );
|
void SetSize( const Vector &vecMin, const Vector &vecMax ); // UTIL_SetSize( pev, mins, maxs );
|
||||||
char const *GetClassname( void );
|
char const *GetClassname( void );
|
||||||
char const *GetDebugName( void );
|
char const *GetDebugName( void );
|
||||||
|
virtual const char *GetPlayerName() const { return NULL; }
|
||||||
static int PrecacheModel( const char *name );
|
static int PrecacheModel( const char *name );
|
||||||
static bool PrecacheSound( const char *name );
|
static bool PrecacheSound( const char *name );
|
||||||
static void PrefetchSound( const char *name );
|
static void PrefetchSound( const char *name );
|
||||||
@ -1000,6 +1054,7 @@ public:
|
|||||||
/////////////////
|
/////////////////
|
||||||
|
|
||||||
virtual bool IsPlayer( void ) const { return false; };
|
virtual bool IsPlayer( void ) const { return false; };
|
||||||
|
virtual bool IsBot( void ) const { return ((GetFlags() & FL_FAKECLIENT) == FL_FAKECLIENT) ? true : false; }
|
||||||
virtual bool IsBaseCombatCharacter( void ) { return false; };
|
virtual bool IsBaseCombatCharacter( void ) { return false; };
|
||||||
virtual C_BaseCombatCharacter *MyCombatCharacterPointer( void ) { return NULL; }
|
virtual C_BaseCombatCharacter *MyCombatCharacterPointer( void ) { return NULL; }
|
||||||
virtual bool IsNPC( void ) { return false; }
|
virtual bool IsNPC( void ) { return false; }
|
||||||
@ -1018,6 +1073,11 @@ public:
|
|||||||
virtual const QAngle& EyeAngles( void ); // Direction of eyes
|
virtual const QAngle& EyeAngles( void ); // Direction of eyes
|
||||||
virtual const QAngle& LocalEyeAngles( void ); // Direction of eyes in local space (pl.v_angle)
|
virtual const QAngle& LocalEyeAngles( void ); // Direction of eyes in local space (pl.v_angle)
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Created for script_intro and info_player_view_proxy
|
||||||
|
virtual void GetEyePosition( Vector &vecOrigin, QAngle &angAngles ) { vecOrigin = EyePosition(); angAngles = EyeAngles(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// position of ears
|
// position of ears
|
||||||
virtual Vector EarPosition( void );
|
virtual Vector EarPosition( void );
|
||||||
|
|
||||||
@ -1110,10 +1170,70 @@ public:
|
|||||||
bool IsFollowingEntity();
|
bool IsFollowingEntity();
|
||||||
CBaseEntity *GetFollowedEntity();
|
CBaseEntity *GetFollowedEntity();
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
void ScriptFollowEntity( HSCRIPT hBaseEntity, bool bBoneMerge );
|
||||||
|
HSCRIPT ScriptGetFollowedEntity();
|
||||||
|
#endif
|
||||||
|
|
||||||
// For shadows rendering the correct body + sequence...
|
// For shadows rendering the correct body + sequence...
|
||||||
virtual int GetBody() { return 0; }
|
virtual int GetBody() { return 0; }
|
||||||
virtual int GetSkin() { return 0; }
|
virtual int GetSkin() { return 0; }
|
||||||
|
|
||||||
|
const Vector& ScriptGetForward(void) { static Vector vecForward; GetVectors(&vecForward, NULL, NULL); return vecForward; }
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
const Vector& ScriptGetRight(void) { static Vector vecRight; GetVectors(NULL, &vecRight, NULL); return vecRight; }
|
||||||
|
#endif
|
||||||
|
const Vector& ScriptGetLeft(void) { static Vector vecRight; GetVectors(NULL, &vecRight, NULL); return vecRight; }
|
||||||
|
|
||||||
|
const Vector& ScriptGetUp(void) { static Vector vecUp; GetVectors(NULL, NULL, &vecUp); return vecUp; }
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
const char* ScriptGetModelName( void ) const { return STRING(GetModelName()); }
|
||||||
|
|
||||||
|
void ScriptStopSound(const char* soundname);
|
||||||
|
void ScriptEmitSound(const char* soundname);
|
||||||
|
float ScriptSoundDuration(const char* soundname, const char* actormodel);
|
||||||
|
|
||||||
|
void VScriptPrecacheScriptSound(const char* soundname);
|
||||||
|
|
||||||
|
const Vector& ScriptEyePosition(void) { static Vector vec; vec = EyePosition(); return vec; }
|
||||||
|
const QAngle& ScriptEyeAngles(void) { static QAngle ang; ang = EyeAngles(); return ang; }
|
||||||
|
void ScriptSetForward( const Vector& v ) { QAngle angles; VectorAngles( v, angles ); SetAbsAngles( angles ); }
|
||||||
|
|
||||||
|
const Vector& ScriptGetBoundingMins( void ) { return m_Collision.OBBMins(); }
|
||||||
|
const Vector& ScriptGetBoundingMaxs( void ) { return m_Collision.OBBMaxs(); }
|
||||||
|
|
||||||
|
HSCRIPT ScriptEntityToWorldTransform( void );
|
||||||
|
|
||||||
|
HSCRIPT ScriptGetPhysicsObject( void );
|
||||||
|
void ScriptPhysicsInitNormal( int nSolidType, int nSolidFlags, bool createAsleep );
|
||||||
|
void ScriptPhysicsDestroyObject() { VPhysicsDestroyObject(); }
|
||||||
|
|
||||||
|
void ScriptSetParent( HSCRIPT hParent, const char *szAttachment );
|
||||||
|
HSCRIPT ScriptGetMoveParent( void );
|
||||||
|
HSCRIPT ScriptGetRootMoveParent();
|
||||||
|
HSCRIPT ScriptFirstMoveChild( void );
|
||||||
|
HSCRIPT ScriptNextMovePeer( void );
|
||||||
|
|
||||||
|
const Vector& ScriptGetColorVector();
|
||||||
|
int ScriptGetColorR() { return m_clrRender.GetR(); }
|
||||||
|
int ScriptGetColorG() { return m_clrRender.GetG(); }
|
||||||
|
int ScriptGetColorB() { return m_clrRender.GetB(); }
|
||||||
|
int ScriptGetAlpha() { return m_clrRender.GetA(); }
|
||||||
|
void ScriptSetColorVector( const Vector& vecColor );
|
||||||
|
void ScriptSetColor( int r, int g, int b );
|
||||||
|
void ScriptSetColorR( int iVal ) { SetRenderColorR( iVal ); }
|
||||||
|
void ScriptSetColorG( int iVal ) { SetRenderColorG( iVal ); }
|
||||||
|
void ScriptSetColorB( int iVal ) { SetRenderColorB( iVal ); }
|
||||||
|
void ScriptSetAlpha( int iVal ) { SetRenderColorA( iVal ); }
|
||||||
|
|
||||||
|
int ScriptGetRenderMode() { return GetRenderMode(); }
|
||||||
|
void ScriptSetRenderMode( int nRenderMode ) { SetRenderMode( (RenderMode_t)nRenderMode ); }
|
||||||
|
|
||||||
|
int ScriptGetMoveType() { return GetMoveType(); }
|
||||||
|
void ScriptSetMoveType( int iMoveType ) { SetMoveType( (MoveType_t)iMoveType ); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// Stubs on client
|
// Stubs on client
|
||||||
void NetworkStateManualMode( bool activate ) { }
|
void NetworkStateManualMode( bool activate ) { }
|
||||||
void NetworkStateChanged() { }
|
void NetworkStateChanged() { }
|
||||||
@ -1151,7 +1271,7 @@ public:
|
|||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
void FunctionCheck( void *pFunction, const char *name );
|
void FunctionCheck( void *pFunction, const char *name );
|
||||||
|
|
||||||
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name )
|
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, const char *name )
|
||||||
{
|
{
|
||||||
//COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
//COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
||||||
m_pfnTouch = func;
|
m_pfnTouch = func;
|
||||||
@ -1261,6 +1381,7 @@ public:
|
|||||||
void SetRenderMode( RenderMode_t nRenderMode, bool bForceUpdate = false );
|
void SetRenderMode( RenderMode_t nRenderMode, bool bForceUpdate = false );
|
||||||
RenderMode_t GetRenderMode() const;
|
RenderMode_t GetRenderMode() const;
|
||||||
|
|
||||||
|
const char* GetEntityName();
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Determine what entity this corresponds to
|
// Determine what entity this corresponds to
|
||||||
@ -1275,6 +1396,11 @@ public:
|
|||||||
|
|
||||||
CNetworkColor32( m_clrRender );
|
CNetworkColor32( m_clrRender );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
int m_iViewHideFlags;
|
||||||
|
bool m_bDisableFlashlight;
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Model for rendering
|
// Model for rendering
|
||||||
@ -1413,6 +1539,15 @@ protected:
|
|||||||
CUtlVector< thinkfunc_t > m_aThinkFunctions;
|
CUtlVector< thinkfunc_t > m_aThinkFunctions;
|
||||||
int m_iCurrentThinkContext;
|
int m_iCurrentThinkContext;
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
public:
|
||||||
|
void ScriptSetContextThink( const char* szContext, HSCRIPT hFunc, float time );
|
||||||
|
void ScriptContextThink();
|
||||||
|
private:
|
||||||
|
CUtlVector< scriptthinkfunc_t* > m_ScriptThinkFuncs;
|
||||||
|
public:
|
||||||
|
#endif
|
||||||
|
|
||||||
// Object eye position
|
// Object eye position
|
||||||
Vector m_vecViewOffset;
|
Vector m_vecViewOffset;
|
||||||
|
|
||||||
@ -1640,6 +1775,8 @@ private:
|
|||||||
EHANDLE m_hOwnerEntity;
|
EHANDLE m_hOwnerEntity;
|
||||||
EHANDLE m_hEffectEntity;
|
EHANDLE m_hEffectEntity;
|
||||||
|
|
||||||
|
char m_iName[MAX_PATH];
|
||||||
|
|
||||||
// This is a random seed used by the networking code to allow client - side prediction code
|
// This is a random seed used by the networking code to allow client - side prediction code
|
||||||
// randon number generators to spit out the same random numbers on both sides for a particular
|
// randon number generators to spit out the same random numbers on both sides for a particular
|
||||||
// usercmd input.
|
// usercmd input.
|
||||||
@ -2194,6 +2331,12 @@ inline bool C_BaseEntity::ShouldRecordInTools() const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const char *C_BaseEntity::GetEntityName()
|
||||||
|
{
|
||||||
|
return m_iName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
C_BaseEntity *CreateEntityByName( const char *className );
|
C_BaseEntity *CreateEntityByName( const char *className );
|
||||||
|
|
||||||
#endif // C_BASEENTITY_H
|
#endif // C_BASEENTITY_H
|
||||||
|
@ -1149,7 +1149,9 @@ void C_BaseFlex::SetupWeights( const matrix3x4_t *pBoneToWorld, int nFlexWeightC
|
|||||||
{
|
{
|
||||||
// hack in an initialization
|
// hack in an initialization
|
||||||
LinkToGlobalFlexControllers( GetModelPtr() );
|
LinkToGlobalFlexControllers( GetModelPtr() );
|
||||||
m_iBlink = AddGlobalFlexController( "blink" );
|
#ifndef MAPBASE
|
||||||
|
m_iBlink = AddGlobalFlexController( "UH" );
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( SetupGlobalWeights( pBoneToWorld, nFlexWeightCount, pFlexWeights, pFlexDelayedWeights ) )
|
if ( SetupGlobalWeights( pBoneToWorld, nFlexWeightCount, pFlexWeights, pFlexDelayedWeights ) )
|
||||||
{
|
{
|
||||||
@ -1478,7 +1480,7 @@ bool C_BaseFlex::ClearSceneEvent( CSceneEventInfo *info, bool fastKill, bool can
|
|||||||
// expression -
|
// expression -
|
||||||
// duration -
|
// duration -
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void C_BaseFlex::AddSceneEvent( CChoreoScene *scene, CChoreoEvent *event, CBaseEntity *pTarget, bool bClientSide )
|
void C_BaseFlex::AddSceneEvent( CChoreoScene *scene, CChoreoEvent *event, CBaseEntity *pTarget, bool bClientSide, C_SceneEntity* pSceneEntity)
|
||||||
{
|
{
|
||||||
if ( !scene || !event )
|
if ( !scene || !event )
|
||||||
{
|
{
|
||||||
@ -1503,6 +1505,7 @@ void C_BaseFlex::AddSceneEvent( CChoreoScene *scene, CChoreoEvent *event, CBaseE
|
|||||||
info.m_hTarget = pTarget;
|
info.m_hTarget = pTarget;
|
||||||
info.m_bStarted = false;
|
info.m_bStarted = false;
|
||||||
info.m_bClientSide = bClientSide;
|
info.m_bClientSide = bClientSide;
|
||||||
|
info.m_hSceneEntity = pSceneEntity;
|
||||||
|
|
||||||
if (StartSceneEvent( &info, scene, event, actor, pTarget ))
|
if (StartSceneEvent( &info, scene, event, actor, pTarget ))
|
||||||
{
|
{
|
||||||
|
@ -214,7 +214,7 @@ public:
|
|||||||
virtual bool ClearSceneEvent( CSceneEventInfo *info, bool fastKill, bool canceled );
|
virtual bool ClearSceneEvent( CSceneEventInfo *info, bool fastKill, bool canceled );
|
||||||
|
|
||||||
// Add the event to the queue for this actor
|
// Add the event to the queue for this actor
|
||||||
void AddSceneEvent( CChoreoScene *scene, CChoreoEvent *event, C_BaseEntity *pTarget = NULL, bool bClientSide = false );
|
void AddSceneEvent( CChoreoScene *scene, CChoreoEvent *event, C_BaseEntity *pTarget = NULL, bool bClientSide = false, C_SceneEntity* pSceneEntity = NULL);
|
||||||
|
|
||||||
// Remove the event from the queue for this actor
|
// Remove the event from the queue for this actor
|
||||||
void RemoveSceneEvent( CChoreoScene *scene, CChoreoEvent *event, bool fastKill );
|
void RemoveSceneEvent( CChoreoScene *scene, CChoreoEvent *event, bool fastKill );
|
||||||
|
3895
sp/src/game/client/c_baselesson.cpp
Normal file
3895
sp/src/game/client/c_baselesson.cpp
Normal file
File diff suppressed because it is too large
Load Diff
460
sp/src/game/client/c_baselesson.h
Normal file
460
sp/src/game/client/c_baselesson.h
Normal file
@ -0,0 +1,460 @@
|
|||||||
|
//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============//
|
||||||
|
//
|
||||||
|
// Purpose: Client handler for instruction players how to play
|
||||||
|
//
|
||||||
|
//=============================================================================//
|
||||||
|
|
||||||
|
#ifndef _C_BASELESSON_H_
|
||||||
|
#define _C_BASELESSON_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameEventListener.h"
|
||||||
|
#include "hud_locator_target.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define DECLARE_LESSON( _lessonClassName, _baseLessonClassName ) \
|
||||||
|
typedef _baseLessonClassName BaseClass;\
|
||||||
|
typedef _lessonClassName ThisClass;\
|
||||||
|
_lessonClassName( const char *pchName, bool bIsDefaultHolder, bool bIsOpenOpportunity )\
|
||||||
|
: _baseLessonClassName( pchName, bIsDefaultHolder, bIsOpenOpportunity )\
|
||||||
|
{\
|
||||||
|
Init();\
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum LessonInstanceType
|
||||||
|
{
|
||||||
|
LESSON_INSTANCE_MULTIPLE,
|
||||||
|
LESSON_INSTANCE_SINGLE_OPEN,
|
||||||
|
LESSON_INSTANCE_FIXED_REPLACE,
|
||||||
|
LESSON_INSTANCE_SINGLE_ACTIVE,
|
||||||
|
|
||||||
|
LESSON_INSTANCE_TYPE_TOTAL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// This is used to solve a problem where bots can take the place of a player, where on or the other don't have valid entities on the client at the same time
|
||||||
|
#define MAX_DELAYED_PLAYER_SWAPS 8
|
||||||
|
|
||||||
|
struct delayed_player_swap_t
|
||||||
|
{
|
||||||
|
CHandle<C_BaseEntity> *phHandleToChange;
|
||||||
|
int iNewUserID;
|
||||||
|
|
||||||
|
delayed_player_swap_t( void )
|
||||||
|
{
|
||||||
|
phHandleToChange = NULL;
|
||||||
|
iNewUserID = -1;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
abstract_class CBaseLesson : public CGameEventListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CBaseLesson( const char *pchName, bool bIsDefaultHolder, bool bIsOpenOpportunity );
|
||||||
|
virtual ~CBaseLesson( void );
|
||||||
|
|
||||||
|
void AddPrerequisite( const char *pchLessonName );
|
||||||
|
|
||||||
|
const CGameInstructorSymbol& GetNameSymbol( void ) const { return m_stringName; }
|
||||||
|
const char * GetName( void ) const { return m_stringName.String(); }
|
||||||
|
int GetPriority( void ) const { return m_iPriority; }
|
||||||
|
const char * GetCloseReason( void ) const { return m_stringCloseReason.String(); }
|
||||||
|
void SetCloseReason( const char *pchReason ) { m_stringCloseReason = pchReason; }
|
||||||
|
|
||||||
|
CBaseLesson* GetRoot( void ) const { return m_pRoot; }
|
||||||
|
void SetRoot( CBaseLesson *pRoot );
|
||||||
|
const CUtlVector < CBaseLesson * >* GetChildren( void ) const { return &m_OpenOpportunities; }
|
||||||
|
|
||||||
|
float GetInitTime( void ) { return m_fInitTime; }
|
||||||
|
void SetStartTime( void ) { m_fStartTime = gpGlobals->curtime; }
|
||||||
|
void ResetStartTime( void ) { m_fStartTime = 0.0f; m_bHasPlayedSound = false; }
|
||||||
|
|
||||||
|
bool ShouldShowSpew( void );
|
||||||
|
bool NoPriority( void ) const;
|
||||||
|
bool IsDefaultHolder( void ) const { return m_bIsDefaultHolder; }
|
||||||
|
bool IsOpenOpportunity( void ) const { return m_bIsOpenOpportunity; }
|
||||||
|
bool IsLocked( void ) const;
|
||||||
|
bool CanOpenWhenDead( void ) const { return m_bCanOpenWhenDead; }
|
||||||
|
bool IsInstructing( void ) const { return ( m_fStartTime > 0.0f ); }
|
||||||
|
bool IsLearned( void ) const;
|
||||||
|
bool PrerequisitesHaveBeenMet( void ) const;
|
||||||
|
bool IsTimedOut( void );
|
||||||
|
|
||||||
|
int InstanceType( void ) const { return m_iInstanceType; }
|
||||||
|
const CGameInstructorSymbol& GetReplaceKeySymbol( void ) const { return m_stringReplaceKey; }
|
||||||
|
const char* GetReplaceKey( void ) const { return m_stringReplaceKey.String(); }
|
||||||
|
int GetFixedInstancesMax( void ) const { return m_iFixedInstancesMax; }
|
||||||
|
bool ShouldReplaceOnlyWhenStopped( void ) const { return m_bReplaceOnlyWhenStopped; }
|
||||||
|
void SetInstanceActive( bool bInstanceActive ) { m_bInstanceActive = bInstanceActive; }
|
||||||
|
bool IsInstanceActive( void ) const { return m_bInstanceActive; }
|
||||||
|
|
||||||
|
void ResetDisplaysAndSuccesses( void );
|
||||||
|
bool IncDisplayCount( void );
|
||||||
|
bool IncSuccessCount( void );
|
||||||
|
void SetDisplayCount( int iDisplayCount ) { m_iDisplayCount = iDisplayCount; }
|
||||||
|
void SetSuccessCount( int iSuccessCount ) { m_iSuccessCount = iSuccessCount; }
|
||||||
|
int GetDisplayCount( void ) const { return m_iDisplayCount; }
|
||||||
|
int GetSuccessCount( void ) const { return m_iSuccessCount; }
|
||||||
|
int GetDisplayLimit( void ) const { return m_iDisplayLimit; }
|
||||||
|
int GetSuccessLimit( void ) const { return m_iSuccessLimit; }
|
||||||
|
|
||||||
|
void Init( void ); // NOT virtual, each constructor calls their own
|
||||||
|
virtual void InitPrerequisites( void ) {};
|
||||||
|
virtual void Start( void ) = 0;
|
||||||
|
virtual void Stop( void ) = 0;
|
||||||
|
virtual void OnOpen( void ) {};
|
||||||
|
virtual void Update( void ) {};
|
||||||
|
virtual void UpdateInactive( void ) {};
|
||||||
|
|
||||||
|
virtual bool ShouldDisplay( void ) const { return true; }
|
||||||
|
virtual bool IsVisible( void ) const { return true; }
|
||||||
|
virtual bool WasDisplayed( void ) const { return m_bWasDisplayed ? true : false; }
|
||||||
|
virtual void SwapOutPlayers( int iOldUserID, int iNewUserID ) {}
|
||||||
|
virtual void TakePlaceOf( CBaseLesson *pLesson );
|
||||||
|
|
||||||
|
const char *GetGroup() { return m_szLessonGroup.String(); }
|
||||||
|
void SetEnabled( bool bEnabled ) { m_bDisabled = !bEnabled; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void MarkSucceeded( void );
|
||||||
|
void CloseOpportunity( const char *pchReason );
|
||||||
|
bool DoDelayedPlayerSwaps( void ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
CBaseLesson *m_pRoot;
|
||||||
|
CUtlVector < CBaseLesson * > m_OpenOpportunities;
|
||||||
|
CUtlVector < const CBaseLesson * > m_Prerequisites;
|
||||||
|
|
||||||
|
CGameInstructorSymbol m_stringCloseReason;
|
||||||
|
CGameInstructorSymbol m_stringName;
|
||||||
|
|
||||||
|
bool m_bInstanceActive : 1;
|
||||||
|
bool m_bSuccessCounted : 1;
|
||||||
|
bool m_bIsDefaultHolder : 1;
|
||||||
|
bool m_bIsOpenOpportunity : 1;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
LessonInstanceType m_iInstanceType;
|
||||||
|
|
||||||
|
int m_iPriority;
|
||||||
|
CGameInstructorSymbol m_stringReplaceKey;
|
||||||
|
int m_iFixedInstancesMax;
|
||||||
|
bool m_bReplaceOnlyWhenStopped;
|
||||||
|
int m_iTeam;
|
||||||
|
bool m_bOnlyKeyboard;
|
||||||
|
bool m_bOnlyGamepad;
|
||||||
|
|
||||||
|
int m_iDisplayLimit;
|
||||||
|
int m_iDisplayCount;
|
||||||
|
bool m_bWasDisplayed;
|
||||||
|
int m_iSuccessLimit;
|
||||||
|
int m_iSuccessCount;
|
||||||
|
|
||||||
|
float m_fLockDuration;
|
||||||
|
float m_fTimeout;
|
||||||
|
float m_fInitTime;
|
||||||
|
float m_fStartTime;
|
||||||
|
float m_fLockTime;
|
||||||
|
float m_fUpdateInterval;
|
||||||
|
bool m_bHasPlayedSound;
|
||||||
|
|
||||||
|
CGameInstructorSymbol m_szStartSound;
|
||||||
|
CGameInstructorSymbol m_szLessonGroup;
|
||||||
|
|
||||||
|
bool m_bCanOpenWhenDead;
|
||||||
|
bool m_bBumpWithTimeoutWhenLearned;
|
||||||
|
bool m_bCanTimeoutWhileInactive;
|
||||||
|
bool m_bDisabled;
|
||||||
|
|
||||||
|
// Right now we can only queue up 4 swaps...
|
||||||
|
// this number can be increased if more entity handle scripted variables are added
|
||||||
|
mutable delayed_player_swap_t m_pDelayedPlayerSwap[ MAX_DELAYED_PLAYER_SWAPS ];
|
||||||
|
mutable int m_iNumDelayedPlayerSwaps;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Colors for console spew in verbose mode
|
||||||
|
static Color m_rgbaVerboseHeader;
|
||||||
|
static Color m_rgbaVerbosePlain;
|
||||||
|
static Color m_rgbaVerboseName;
|
||||||
|
static Color m_rgbaVerboseOpen;
|
||||||
|
static Color m_rgbaVerboseClose;
|
||||||
|
static Color m_rgbaVerboseSuccess;
|
||||||
|
static Color m_rgbaVerboseUpdate;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CTextLesson : public CBaseLesson
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_LESSON( CTextLesson, CBaseLesson );
|
||||||
|
|
||||||
|
void Init( void ); // NOT virtual, each constructor calls their own
|
||||||
|
virtual void Start( void );
|
||||||
|
virtual void Stop( void );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
CGameInstructorSymbol m_szDisplayText;
|
||||||
|
CGameInstructorSymbol m_szDisplayParamText;
|
||||||
|
CGameInstructorSymbol m_szBinding;
|
||||||
|
CGameInstructorSymbol m_szGamepadBinding;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CIconLesson : public CTextLesson
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_LESSON( CIconLesson, CTextLesson );
|
||||||
|
|
||||||
|
void Init( void ); // NOT virtual, each constructor calls their own
|
||||||
|
virtual void Start( void );
|
||||||
|
virtual void Stop( void );
|
||||||
|
virtual void Update( void );
|
||||||
|
virtual void UpdateInactive( void );
|
||||||
|
|
||||||
|
virtual bool ShouldDisplay( void ) const;
|
||||||
|
virtual bool IsVisible( void ) const;
|
||||||
|
virtual void SwapOutPlayers( int iOldUserID, int iNewUserID );
|
||||||
|
virtual void TakePlaceOf( CBaseLesson *pLesson );
|
||||||
|
|
||||||
|
void SetLocatorBinding( CLocatorTarget * pLocatorTarget );
|
||||||
|
|
||||||
|
const char *GetCaptionColorString() { return m_szCaptionColor.String(); }
|
||||||
|
|
||||||
|
bool IsPresentComplete( void );
|
||||||
|
void PresentStart( void );
|
||||||
|
void PresentEnd( void );
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void UpdateLocatorTarget( CLocatorTarget *pLocatorTarget, C_BaseEntity *pIconTarget );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
Vector GetIconTargetPosition( C_BaseEntity *pIconTarget );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CHandle<C_BaseEntity> m_hIconTarget;
|
||||||
|
CGameInstructorSymbol m_szVguiTargetName;
|
||||||
|
CGameInstructorSymbol m_szVguiTargetLookup;
|
||||||
|
int m_nVguiTargetEdge;
|
||||||
|
float m_flUpOffset;
|
||||||
|
float m_flRelativeUpOffset;
|
||||||
|
float m_fFixedPositionX;
|
||||||
|
float m_fFixedPositionY;
|
||||||
|
|
||||||
|
int m_hLocatorTarget;
|
||||||
|
int m_iFlags;
|
||||||
|
|
||||||
|
float m_fRange;
|
||||||
|
float m_fCurrentDistance;
|
||||||
|
float m_fOnScreenStartTime;
|
||||||
|
float m_fUpdateDistanceTime;
|
||||||
|
|
||||||
|
CGameInstructorSymbol m_szOnscreenIcon;
|
||||||
|
CGameInstructorSymbol m_szOffscreenIcon;
|
||||||
|
CGameInstructorSymbol m_szCaptionColor;
|
||||||
|
|
||||||
|
bool m_bFixedPosition;
|
||||||
|
bool m_bNoIconTarget;
|
||||||
|
bool m_bAllowNodrawTarget;
|
||||||
|
bool m_bVisible;
|
||||||
|
bool m_bShowWhenOccluded;
|
||||||
|
bool m_bNoOffscreen;
|
||||||
|
bool m_bForceCaption;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
int m_iIconTargetPos;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
ICON_TARGET_EYE_POSITION,
|
||||||
|
ICON_TARGET_ORIGIN,
|
||||||
|
ICON_TARGET_CENTER,
|
||||||
|
};
|
||||||
|
|
||||||
|
CGameInstructorSymbol m_szHudHint;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
enum LessonAction
|
||||||
|
{
|
||||||
|
LESSON_ACTION_NONE,
|
||||||
|
|
||||||
|
LESSON_ACTION_SCOPE_IN,
|
||||||
|
LESSON_ACTION_SCOPE_OUT,
|
||||||
|
LESSON_ACTION_CLOSE,
|
||||||
|
LESSON_ACTION_SUCCESS,
|
||||||
|
LESSON_ACTION_LOCK,
|
||||||
|
LESSON_ACTION_PRESENT_COMPLETE,
|
||||||
|
LESSON_ACTION_PRESENT_START,
|
||||||
|
LESSON_ACTION_PRESENT_END,
|
||||||
|
|
||||||
|
LESSON_ACTION_REFERENCE_OPEN,
|
||||||
|
|
||||||
|
LESSON_ACTION_SET,
|
||||||
|
LESSON_ACTION_ADD,
|
||||||
|
LESSON_ACTION_SUBTRACT,
|
||||||
|
LESSON_ACTION_MULTIPLY,
|
||||||
|
LESSON_ACTION_IS,
|
||||||
|
LESSON_ACTION_LESS_THAN,
|
||||||
|
LESSON_ACTION_HAS_PREFIX,
|
||||||
|
LESSON_ACTION_HAS_BIT,
|
||||||
|
LESSON_ACTION_BIT_COUNT_IS,
|
||||||
|
LESSON_ACTION_BIT_COUNT_LESS_THAN,
|
||||||
|
|
||||||
|
LESSON_ACTION_GET_DISTANCE,
|
||||||
|
LESSON_ACTION_GET_ANGULAR_DISTANCE,
|
||||||
|
LESSON_ACTION_GET_PLAYER_DISPLAY_NAME,
|
||||||
|
LESSON_ACTION_CLASSNAME_IS,
|
||||||
|
LESSON_ACTION_MODELNAME_IS,
|
||||||
|
LESSON_ACTION_TEAM_IS,
|
||||||
|
LESSON_ACTION_HEALTH_LESS_THAN,
|
||||||
|
LESSON_ACTION_HEALTH_PERCENTAGE_LESS_THAN,
|
||||||
|
LESSON_ACTION_GET_ACTIVE_WEAPON,
|
||||||
|
LESSON_ACTION_WEAPON_IS,
|
||||||
|
LESSON_ACTION_WEAPON_HAS,
|
||||||
|
LESSON_ACTION_GET_ACTIVE_WEAPON_SLOT,
|
||||||
|
LESSON_ACTION_GET_WEAPON_SLOT,
|
||||||
|
LESSON_ACTION_GET_WEAPON_IN_SLOT,
|
||||||
|
LESSON_ACTION_CLIP_PERCENTAGE_LESS_THAN,
|
||||||
|
LESSON_ACTION_WEAPON_AMMO_LOW,
|
||||||
|
LESSON_ACTION_WEAPON_AMMO_FULL,
|
||||||
|
LESSON_ACTION_WEAPON_AMMO_EMPTY,
|
||||||
|
LESSON_ACTION_WEAPON_CAN_USE,
|
||||||
|
LESSON_ACTION_USE_TARGET_IS,
|
||||||
|
LESSON_ACTION_GET_USE_TARGET,
|
||||||
|
LESSON_ACTION_GET_POTENTIAL_USE_TARGET,
|
||||||
|
|
||||||
|
// Enum continued in Mod_LessonAction
|
||||||
|
LESSON_ACTION_MOD_START,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LessonElement_t
|
||||||
|
{
|
||||||
|
int iVariable;
|
||||||
|
int iParamVarIndex;
|
||||||
|
int iAction;
|
||||||
|
_fieldtypes paramType;
|
||||||
|
CGameInstructorSymbol szParam;
|
||||||
|
bool bNot : 1;
|
||||||
|
bool bOptionalParam : 1;
|
||||||
|
|
||||||
|
LessonElement_t( int p_iVariable, int p_iAction, bool p_bNot, bool p_bOptionalParam, const char *pchParam, int p_iParamVarIndex, _fieldtypes p_paramType )
|
||||||
|
{
|
||||||
|
iVariable = p_iVariable;
|
||||||
|
iAction = p_iAction;
|
||||||
|
bNot = p_bNot;
|
||||||
|
bOptionalParam = p_bOptionalParam;
|
||||||
|
szParam = pchParam;
|
||||||
|
iParamVarIndex = p_iParamVarIndex;
|
||||||
|
paramType = p_paramType;
|
||||||
|
}
|
||||||
|
|
||||||
|
LessonElement_t( const LessonElement_t &p_LessonElement )
|
||||||
|
{
|
||||||
|
iVariable = p_LessonElement.iVariable;
|
||||||
|
iAction = p_LessonElement.iAction;
|
||||||
|
bNot = p_LessonElement.bNot;
|
||||||
|
bOptionalParam = p_LessonElement.bOptionalParam;
|
||||||
|
szParam = p_LessonElement.szParam;
|
||||||
|
iParamVarIndex = p_LessonElement.iParamVarIndex;
|
||||||
|
paramType = p_LessonElement.paramType;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LessonEvent_t
|
||||||
|
{
|
||||||
|
CUtlVector< LessonElement_t > elements;
|
||||||
|
CGameInstructorSymbol szEventName;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CScriptedIconLesson : public CIconLesson
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_LESSON( CScriptedIconLesson, CIconLesson )
|
||||||
|
|
||||||
|
virtual ~CScriptedIconLesson( void );
|
||||||
|
|
||||||
|
static void PreReadLessonsFromFile( void );
|
||||||
|
static void Mod_PreReadLessonsFromFile( void );
|
||||||
|
|
||||||
|
void Init( void ); // NOT virtual, each constructor calls their own
|
||||||
|
virtual void InitPrerequisites( void );
|
||||||
|
virtual void OnOpen( void );
|
||||||
|
virtual void Update( void );
|
||||||
|
|
||||||
|
virtual void SwapOutPlayers( int iOldUserID, int iNewUserID );
|
||||||
|
|
||||||
|
virtual void FireGameEvent( IGameEvent *event );
|
||||||
|
virtual void ProcessOpenGameEvents( const CScriptedIconLesson *pRootLesson, const char *name, IGameEvent *event );
|
||||||
|
virtual void ProcessCloseGameEvents( const CScriptedIconLesson *pRootLesson, const char *name, IGameEvent *event );
|
||||||
|
virtual void ProcessSuccessGameEvents( const CScriptedIconLesson *pRootLesson, const char *name, IGameEvent *event );
|
||||||
|
|
||||||
|
CUtlVector< LessonEvent_t >& GetOpenEvents( void ) { return m_OpenEvents; }
|
||||||
|
CUtlVector< LessonEvent_t >& GetCloseEvents( void ) { return m_CloseEvents; }
|
||||||
|
CUtlVector< LessonEvent_t >& GetSuccessEvents( void ) { return m_SuccessEvents; }
|
||||||
|
CUtlVector< LessonEvent_t >& GetOnOpenEvents( void ) { return m_OnOpenEvents; }
|
||||||
|
CUtlVector< LessonEvent_t >& GetUpdateEvents( void ) { return m_UpdateEvents; }
|
||||||
|
|
||||||
|
bool ProcessElements( IGameEvent *event, const CUtlVector< LessonElement_t > *pElements );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void InitElementsFromKeys( CUtlVector< LessonElement_t > *pLessonElements, KeyValues *pKey );
|
||||||
|
void InitElementsFromElements( CUtlVector< LessonElement_t > *pLessonElements, const CUtlVector< LessonElement_t > *pLessonElements2 );
|
||||||
|
|
||||||
|
void InitFromKeys( KeyValues *pKey );
|
||||||
|
|
||||||
|
bool ProcessElement( IGameEvent *event, const LessonElement_t *pLessonElement, bool bInFailedScope );
|
||||||
|
|
||||||
|
bool ProcessElementAction( int iAction, bool bNot, const char *pchVarName, float &bVar, const CGameInstructorSymbol *pchParamName, float fParam );
|
||||||
|
bool ProcessElementAction( int iAction, bool bNot, const char *pchVarName, int &bVar, const CGameInstructorSymbol *pchParamName, float fParam );
|
||||||
|
bool ProcessElementAction( int iAction, bool bNot, const char *pchVarName, bool &bVar, const CGameInstructorSymbol *pchParamName, float fParam );
|
||||||
|
bool ProcessElementAction( int iAction, bool bNot, const char *pchVarName, EHANDLE &hVar, const CGameInstructorSymbol *pchParamName, float fParam, C_BaseEntity *pParam, const char *pchParam );
|
||||||
|
bool ProcessElementAction( int iAction, bool bNot, const char *pchVarName, CGameInstructorSymbol *pchVar, const CGameInstructorSymbol *pchParamName, const char *pchParam );
|
||||||
|
|
||||||
|
// Implemented per mod so they can have custom actions
|
||||||
|
bool Mod_ProcessElementAction( int iAction, bool bNot, const char *pchVarName, EHANDLE &hVar, const CGameInstructorSymbol *pchParamName, float fParam, C_BaseEntity *pParam, const char *pchParam, bool &bModHandled );
|
||||||
|
|
||||||
|
LessonEvent_t * AddOpenEvent( void );
|
||||||
|
LessonEvent_t * AddCloseEvent( void );
|
||||||
|
LessonEvent_t * AddSuccessEvent( void );
|
||||||
|
LessonEvent_t * AddOnOpenEvent( void );
|
||||||
|
LessonEvent_t * AddUpdateEvent( void );
|
||||||
|
|
||||||
|
private:
|
||||||
|
static CUtlDict< int, int > LessonActionMap;
|
||||||
|
|
||||||
|
EHANDLE m_hLocalPlayer;
|
||||||
|
float m_fOutput;
|
||||||
|
CHandle<C_BaseEntity> m_hEntity1;
|
||||||
|
CHandle<C_BaseEntity> m_hEntity2;
|
||||||
|
CGameInstructorSymbol m_szString1;
|
||||||
|
CGameInstructorSymbol m_szString2;
|
||||||
|
int m_iInteger1;
|
||||||
|
int m_iInteger2;
|
||||||
|
float m_fFloat1;
|
||||||
|
float m_fFloat2;
|
||||||
|
|
||||||
|
CUtlVector< CGameInstructorSymbol > m_PrerequisiteNames;
|
||||||
|
CUtlVector< LessonEvent_t > m_OpenEvents;
|
||||||
|
CUtlVector< LessonEvent_t > m_CloseEvents;
|
||||||
|
CUtlVector< LessonEvent_t > m_SuccessEvents;
|
||||||
|
CUtlVector< LessonEvent_t > m_OnOpenEvents;
|
||||||
|
CUtlVector< LessonEvent_t > m_UpdateEvents;
|
||||||
|
|
||||||
|
float m_fUpdateEventTime;
|
||||||
|
CScriptedIconLesson *m_pDefaultHolder;
|
||||||
|
|
||||||
|
int m_iScopeDepth;
|
||||||
|
|
||||||
|
// Need this to get offsets to scripted variables
|
||||||
|
friend class LessonVariableInfo;
|
||||||
|
friend int LessonActionFromString( const char *pchName );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _C_BASELESSON_H_
|
@ -54,6 +54,10 @@
|
|||||||
#include "econ_wearable.h"
|
#include "econ_wearable.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
#include "viewrender.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// NVNT haptics system interface
|
// NVNT haptics system interface
|
||||||
#include "haptics/ihaptics.h"
|
#include "haptics/ihaptics.h"
|
||||||
|
|
||||||
@ -129,6 +133,16 @@ void RecvProxy_LocalVelocityZ( const CRecvProxyData *pData, void *pStruct, void
|
|||||||
void RecvProxy_ObserverTarget( const CRecvProxyData *pData, void *pStruct, void *pOut );
|
void RecvProxy_ObserverTarget( const CRecvProxyData *pData, void *pStruct, void *pOut );
|
||||||
void RecvProxy_ObserverMode ( const CRecvProxyData *pData, void *pStruct, void *pOut );
|
void RecvProxy_ObserverMode ( const CRecvProxyData *pData, void *pStruct, void *pOut );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Needs to shift bits back
|
||||||
|
void RecvProxy_ShiftPlayerSpawnflags( const CRecvProxyData *pData, void *pStruct, void *pOut )
|
||||||
|
{
|
||||||
|
C_BasePlayer *pPlayer = (C_BasePlayer *)pStruct;
|
||||||
|
|
||||||
|
pPlayer->m_spawnflags = (pData->m_Value.m_Int) << 16;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------- //
|
// -------------------------------------------------------------------------------- //
|
||||||
// RecvTable for CPlayerState.
|
// RecvTable for CPlayerState.
|
||||||
// -------------------------------------------------------------------------------- //
|
// -------------------------------------------------------------------------------- //
|
||||||
@ -176,6 +190,11 @@ BEGIN_RECV_TABLE_NOBASE( CPlayerLocalData, DT_Local )
|
|||||||
// 3d skybox data
|
// 3d skybox data
|
||||||
RecvPropInt(RECVINFO(m_skybox3d.scale)),
|
RecvPropInt(RECVINFO(m_skybox3d.scale)),
|
||||||
RecvPropVector(RECVINFO(m_skybox3d.origin)),
|
RecvPropVector(RECVINFO(m_skybox3d.origin)),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropVector(RECVINFO(m_skybox3d.angles)),
|
||||||
|
RecvPropEHandle(RECVINFO(m_skybox3d.skycamera)),
|
||||||
|
RecvPropInt( RECVINFO( m_skybox3d.skycolor ), 0, RecvProxy_IntToColor32 ),
|
||||||
|
#endif
|
||||||
RecvPropInt(RECVINFO(m_skybox3d.area)),
|
RecvPropInt(RECVINFO(m_skybox3d.area)),
|
||||||
|
|
||||||
// 3d skybox fog data
|
// 3d skybox fog data
|
||||||
@ -187,6 +206,9 @@ BEGIN_RECV_TABLE_NOBASE( CPlayerLocalData, DT_Local )
|
|||||||
RecvPropFloat( RECVINFO( m_skybox3d.fog.start ) ),
|
RecvPropFloat( RECVINFO( m_skybox3d.fog.start ) ),
|
||||||
RecvPropFloat( RECVINFO( m_skybox3d.fog.end ) ),
|
RecvPropFloat( RECVINFO( m_skybox3d.fog.end ) ),
|
||||||
RecvPropFloat( RECVINFO( m_skybox3d.fog.maxdensity ) ),
|
RecvPropFloat( RECVINFO( m_skybox3d.fog.maxdensity ) ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropFloat( RECVINFO( m_skybox3d.fog.farz ) ),
|
||||||
|
#endif
|
||||||
|
|
||||||
// fog data
|
// fog data
|
||||||
RecvPropEHandle( RECVINFO( m_PlayerFog.m_hCtrl ) ),
|
RecvPropEHandle( RECVINFO( m_PlayerFog.m_hCtrl ) ),
|
||||||
@ -203,6 +225,14 @@ BEGIN_RECV_TABLE_NOBASE( CPlayerLocalData, DT_Local )
|
|||||||
RecvPropInt( RECVINFO( m_audio.soundscapeIndex ) ),
|
RecvPropInt( RECVINFO( m_audio.soundscapeIndex ) ),
|
||||||
RecvPropInt( RECVINFO( m_audio.localBits ) ),
|
RecvPropInt( RECVINFO( m_audio.localBits ) ),
|
||||||
RecvPropEHandle( RECVINFO( m_audio.ent ) ),
|
RecvPropEHandle( RECVINFO( m_audio.ent ) ),
|
||||||
|
|
||||||
|
//Tony; tonemap stuff! -- TODO! Optimize this with bit sizes from env_tonemap_controller.
|
||||||
|
RecvPropFloat ( RECVINFO( m_TonemapParams.m_flTonemapScale ) ),
|
||||||
|
RecvPropFloat ( RECVINFO( m_TonemapParams.m_flTonemapRate ) ),
|
||||||
|
RecvPropFloat ( RECVINFO( m_TonemapParams.m_flBloomScale ) ),
|
||||||
|
|
||||||
|
RecvPropFloat ( RECVINFO( m_TonemapParams.m_flAutoExposureMin ) ),
|
||||||
|
RecvPropFloat ( RECVINFO( m_TonemapParams.m_flAutoExposureMax ) ),
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------- //
|
// -------------------------------------------------------------------------------- //
|
||||||
@ -245,6 +275,15 @@ END_RECV_TABLE()
|
|||||||
RecvPropInt ( RECVINFO( m_nWaterLevel ) ),
|
RecvPropInt ( RECVINFO( m_nWaterLevel ) ),
|
||||||
RecvPropFloat ( RECVINFO( m_flLaggedMovementValue )),
|
RecvPropFloat ( RECVINFO( m_flLaggedMovementValue )),
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Transmitted from the server for internal player spawnflags.
|
||||||
|
// See baseplayer_shared.h for more details.
|
||||||
|
RecvPropInt ( RECVINFO( m_spawnflags ), 0, RecvProxy_ShiftPlayerSpawnflags ),
|
||||||
|
|
||||||
|
RecvPropBool ( RECVINFO( m_bDrawPlayerModelExternally ) ),
|
||||||
|
RecvPropBool ( RECVINFO( m_bInTriggerFall ) ),
|
||||||
|
#endif
|
||||||
|
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
|
|
||||||
@ -293,6 +332,11 @@ END_RECV_TABLE()
|
|||||||
|
|
||||||
RecvPropString( RECVINFO(m_szLastPlaceName) ),
|
RecvPropString( RECVINFO(m_szLastPlaceName) ),
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
RecvPropEHandle( RECVINFO( m_hPostProcessCtrl ) ), // Send to everybody - for spectating
|
||||||
|
RecvPropEHandle( RECVINFO( m_hColorCorrectionCtrl ) ), // Send to everybody - for spectating
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined USES_ECON_ITEMS
|
#if defined USES_ECON_ITEMS
|
||||||
RecvPropUtlVector( RECVINFO_UTLVECTOR( m_hMyWearables ), MAX_WEARABLES_SENT_FROM_SERVER, RecvPropEHandle(NULL, 0, 0) ),
|
RecvPropUtlVector( RECVINFO_UTLVECTOR( m_hMyWearables ), MAX_WEARABLES_SENT_FROM_SERVER, RecvPropEHandle(NULL, 0, 0) ),
|
||||||
#endif
|
#endif
|
||||||
@ -396,7 +440,10 @@ BEGIN_PREDICTION_DATA( C_BasePlayer )
|
|||||||
|
|
||||||
END_PREDICTION_DATA()
|
END_PREDICTION_DATA()
|
||||||
|
|
||||||
|
// link this in each derived player class, like the server!!
|
||||||
|
#if 0
|
||||||
LINK_ENTITY_TO_CLASS( player, C_BasePlayer );
|
LINK_ENTITY_TO_CLASS( player, C_BasePlayer );
|
||||||
|
#endif
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------- //
|
// -------------------------------------------------------------------------------- //
|
||||||
// Functions.
|
// Functions.
|
||||||
@ -449,6 +496,13 @@ C_BasePlayer::~C_BasePlayer()
|
|||||||
if ( this == s_pLocalPlayer )
|
if ( this == s_pLocalPlayer )
|
||||||
{
|
{
|
||||||
s_pLocalPlayer = NULL;
|
s_pLocalPlayer = NULL;
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
if ( g_pScriptVM )
|
||||||
|
{
|
||||||
|
g_pScriptVM->SetValue( "player", SCRIPT_VARIANT_NULL );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_pFlashlight;
|
delete m_pFlashlight;
|
||||||
@ -805,6 +859,14 @@ void C_BasePlayer::PostDataUpdate( DataUpdateType_t updateType )
|
|||||||
// changed level, which would cause the snd_soundmixer to be left modified.
|
// changed level, which would cause the snd_soundmixer to be left modified.
|
||||||
ConVar *pVar = (ConVar *)cvar->FindVar( "snd_soundmixer" );
|
ConVar *pVar = (ConVar *)cvar->FindVar( "snd_soundmixer" );
|
||||||
pVar->Revert();
|
pVar->Revert();
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
// Moved here from LevelInitPostEntity, which is executed before local player is spawned.
|
||||||
|
if ( g_pScriptVM )
|
||||||
|
{
|
||||||
|
g_pScriptVM->SetValue( "player", GetScriptInstance() );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -945,6 +1007,16 @@ void C_BasePlayer::OnRestore()
|
|||||||
input->ClearInputButton( IN_ATTACK | IN_ATTACK2 );
|
input->ClearInputButton( IN_ATTACK | IN_ATTACK2 );
|
||||||
// GetButtonBits() has to be called for the above to take effect
|
// GetButtonBits() has to be called for the above to take effect
|
||||||
input->GetButtonBits( 0 );
|
input->GetButtonBits( 0 );
|
||||||
|
|
||||||
|
#ifdef MAPBASE_VSCRIPT
|
||||||
|
// HACK: (03/25/09) Then the player goes across a transition it doesn't spawn and register
|
||||||
|
// it's instance. We're hacking around this for now, but this will go away when we get around to
|
||||||
|
// having entities cross transitions and keep their script state.
|
||||||
|
if ( g_pScriptVM )
|
||||||
|
{
|
||||||
|
g_pScriptVM->SetValue( "player", GetScriptInstance() );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// For ammo history icons to current value so they don't flash on level transtions
|
// For ammo history icons to current value so they don't flash on level transtions
|
||||||
@ -1054,14 +1126,32 @@ void C_BasePlayer::DetermineVguiInputMode( CUserCmd *pCmd )
|
|||||||
|
|
||||||
// If we're in vgui mode *and* we're holding down mouse buttons,
|
// If we're in vgui mode *and* we're holding down mouse buttons,
|
||||||
// stay in vgui mode even if we're outside the screen bounds
|
// stay in vgui mode even if we're outside the screen bounds
|
||||||
|
#ifdef VGUI_SCREEN_FIX
|
||||||
|
if (m_pCurrentVguiScreen.Get() && (pCmd->buttons & (IN_ATTACK | IN_ATTACK2 | IN_VALIDVGUIINPUT)))
|
||||||
|
{
|
||||||
|
SetVGuiScreenButtonState( m_pCurrentVguiScreen.Get(), pCmd->buttons );
|
||||||
|
|
||||||
|
// Kill all attack inputs if we're in vgui screen mode
|
||||||
|
pCmd->buttons &= ~(IN_ATTACK | IN_ATTACK2 | IN_VALIDVGUIINPUT);
|
||||||
|
#ifdef MAPBASE
|
||||||
|
pCmd->buttons |= IN_VGUIMODE;
|
||||||
|
#endif // MAPBASE
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (m_pCurrentVguiScreen.Get() && (pCmd->buttons & (IN_ATTACK | IN_ATTACK2)) )
|
if (m_pCurrentVguiScreen.Get() && (pCmd->buttons & (IN_ATTACK | IN_ATTACK2)) )
|
||||||
{
|
{
|
||||||
SetVGuiScreenButtonState( m_pCurrentVguiScreen.Get(), pCmd->buttons );
|
SetVGuiScreenButtonState( m_pCurrentVguiScreen.Get(), pCmd->buttons );
|
||||||
|
|
||||||
// Kill all attack inputs if we're in vgui screen mode
|
// Kill all attack inputs if we're in vgui screen mode
|
||||||
pCmd->buttons &= ~(IN_ATTACK | IN_ATTACK2);
|
pCmd->buttons &= ~(IN_ATTACK | IN_ATTACK2);
|
||||||
|
#ifdef MAPBASE
|
||||||
|
pCmd->buttons &= ~(IN_USE | IN_ATTACK3);
|
||||||
|
pCmd->buttons |= IN_VGUIMODE;
|
||||||
|
#endif // MAPBASE
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// We're not in vgui input mode if we're moving, or have hit a key
|
// We're not in vgui input mode if we're moving, or have hit a key
|
||||||
// that will make us move...
|
// that will make us move...
|
||||||
@ -1123,6 +1213,10 @@ void C_BasePlayer::DetermineVguiInputMode( CUserCmd *pCmd )
|
|||||||
|
|
||||||
// Kill all attack inputs if we're in vgui screen mode
|
// Kill all attack inputs if we're in vgui screen mode
|
||||||
pCmd->buttons &= ~(IN_ATTACK | IN_ATTACK2);
|
pCmd->buttons &= ~(IN_ATTACK | IN_ATTACK2);
|
||||||
|
#ifdef MAPBASE
|
||||||
|
pCmd->buttons &= ~(IN_USE | IN_ATTACK3);
|
||||||
|
pCmd->buttons |= IN_VGUIMODE;
|
||||||
|
#endif // MAPBASE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1183,7 +1277,12 @@ bool C_BasePlayer::CreateMove( float flInputSampleTime, CUserCmd *pCmd )
|
|||||||
m_vecOldViewAngles = pCmd->viewangles;
|
m_vecOldViewAngles = pCmd->viewangles;
|
||||||
|
|
||||||
// Check to see if we're in vgui input mode...
|
// Check to see if we're in vgui input mode...
|
||||||
|
#ifdef VGUI_SCREEN_FIX
|
||||||
|
if(pCmd->buttons & IN_VALIDVGUIINPUT)
|
||||||
|
DetermineVguiInputMode( pCmd );
|
||||||
|
#else
|
||||||
DetermineVguiInputMode( pCmd );
|
DetermineVguiInputMode( pCmd );
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1279,6 +1378,10 @@ void C_BasePlayer::AddEntity( void )
|
|||||||
|
|
||||||
// Add in lighting effects
|
// Add in lighting effects
|
||||||
CreateLightEffects();
|
CreateLightEffects();
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
SetLocalAnglesDim( X_INDEX, 0 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
extern float UTIL_WaterLevel( const Vector &position, float minz, float maxz );
|
extern float UTIL_WaterLevel( const Vector &position, float minz, float maxz );
|
||||||
@ -1385,11 +1488,35 @@ bool C_BasePlayer::ShouldInterpolate()
|
|||||||
|
|
||||||
bool C_BasePlayer::ShouldDraw()
|
bool C_BasePlayer::ShouldDraw()
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// We have to "always draw" a player with m_bDrawPlayerModelExternally in order to show up in whatever rendering list all of the views use,
|
||||||
|
// but we can't put this in ShouldDrawThisPlayer() because we would have no way of knowing if it stomps the other checks that draw the player model anyway.
|
||||||
|
// As a result, we have to put it here in the central ShouldDraw() function. DrawModel() makes sure we only draw in non-main views and nothing's drawing the model anyway.
|
||||||
|
return (ShouldDrawThisPlayer() || m_bDrawPlayerModelExternally) && BaseClass::ShouldDraw();
|
||||||
|
#else
|
||||||
return ShouldDrawThisPlayer() && BaseClass::ShouldDraw();
|
return ShouldDrawThisPlayer() && BaseClass::ShouldDraw();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int C_BasePlayer::DrawModel( int flags )
|
int C_BasePlayer::DrawModel( int flags )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_bDrawPlayerModelExternally)
|
||||||
|
{
|
||||||
|
// Draw the player in any view except the main or "intro" view, both of which are default first-person views.
|
||||||
|
// HACKHACK: Also don't draw in shadow depth textures if the player's flashlight is on, as that causes the playermodel to block it.
|
||||||
|
view_id_t viewID = CurrentViewID();
|
||||||
|
if (viewID == VIEW_MAIN || viewID == VIEW_INTRO_CAMERA || (viewID == VIEW_SHADOW_DEPTH_TEXTURE && IsEffectActive(EF_DIMLIGHT)))
|
||||||
|
{
|
||||||
|
// Make sure the player model wouldn't draw anyway...
|
||||||
|
if (!ShouldDrawThisPlayer())
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BaseClass::DrawModel( flags );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PORTAL
|
#ifndef PORTAL
|
||||||
// In Portal this check is already performed as part of
|
// In Portal this check is already performed as part of
|
||||||
// C_Portal_Player::DrawModel()
|
// C_Portal_Player::DrawModel()
|
||||||
@ -1398,9 +1525,42 @@ int C_BasePlayer::DrawModel( int flags )
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return BaseClass::DrawModel( flags );
|
return BaseClass::DrawModel( flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
ConVar cl_player_allow_thirdperson_projtex( "cl_player_allow_thirdperson_projtex", "1", FCVAR_NONE, "Allows players to receive projected textures if they're non-local or in third person." );
|
||||||
|
ConVar cl_player_allow_thirdperson_rttshadows( "cl_player_allow_thirdperson_rttshadows", "0", FCVAR_NONE, "Allows players to cast RTT shadows if they're non-local or in third person." );
|
||||||
|
ConVar cl_player_allow_firstperson_projtex( "cl_player_allow_firstperson_projtex", "1", FCVAR_NONE, "Allows players to receive projected textures even if they're in first person." );
|
||||||
|
ConVar cl_player_allow_firstperson_rttshadows( "cl_player_allow_firstperson_rttshadows", "0", FCVAR_NONE, "Allows players to cast RTT shadows even if they're in first person." );
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
ShadowType_t C_BasePlayer::ShadowCastType()
|
||||||
|
{
|
||||||
|
if ( (!IsLocalPlayer() || ShouldDraw()) ? !cl_player_allow_thirdperson_rttshadows.GetBool() : !cl_player_allow_firstperson_rttshadows.GetBool() )
|
||||||
|
return SHADOWS_NONE;
|
||||||
|
|
||||||
|
if ( !IsVisible() )
|
||||||
|
return SHADOWS_NONE;
|
||||||
|
|
||||||
|
return SHADOWS_RENDER_TO_TEXTURE_DYNAMIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Should this object receive shadows?
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
bool C_BasePlayer::ShouldReceiveProjectedTextures( int flags )
|
||||||
|
{
|
||||||
|
if ( (!IsLocalPlayer() || ShouldDraw()) ? !cl_player_allow_thirdperson_projtex.GetBool() : !cl_player_allow_firstperson_projtex.GetBool() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return BaseClass::ShouldReceiveProjectedTextures( flags );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1522,7 +1682,14 @@ void C_BasePlayer::CalcChaseCamView(Vector& eyeOrigin, QAngle& eyeAngles, float&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( target && !target->IsPlayer() && target->IsNextBot() )
|
// SDK TODO
|
||||||
|
if ( target && target->IsBaseTrain() )
|
||||||
|
{
|
||||||
|
// if this is a train, we want to be back a little further so we can see more of it
|
||||||
|
flMaxDistance *= 2.5f;
|
||||||
|
m_flObserverChaseDistance = flMaxDistance;
|
||||||
|
}
|
||||||
|
else if ( target && !target->IsPlayer() && target->IsNextBot() )
|
||||||
{
|
{
|
||||||
// if this is a boss, we want to be back a little further so we can see more of it
|
// if this is a boss, we want to be back a little further so we can see more of it
|
||||||
flMaxDistance *= 2.5f;
|
flMaxDistance *= 2.5f;
|
||||||
@ -1855,6 +2022,12 @@ void C_BasePlayer::ThirdPersonSwitch( bool bThirdperson )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CBaseCombatWeapon *pWeapon = GetActiveWeapon();
|
||||||
|
if ( pWeapon )
|
||||||
|
pWeapon->ThirdPersonSwitch( bThirdperson );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2796,6 +2969,24 @@ void C_BasePlayer::UpdateFogBlend( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
C_PostProcessController* C_BasePlayer::GetActivePostProcessController() const
|
||||||
|
{
|
||||||
|
return m_hPostProcessCtrl.Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
C_ColorCorrection* C_BasePlayer::GetActiveColorCorrection() const
|
||||||
|
{
|
||||||
|
return m_hColorCorrectionCtrl.Get();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -23,6 +23,10 @@
|
|||||||
#include "hintsystem.h"
|
#include "hintsystem.h"
|
||||||
#include "SoundEmitterSystem/isoundemittersystembase.h"
|
#include "SoundEmitterSystem/isoundemittersystembase.h"
|
||||||
#include "c_env_fog_controller.h"
|
#include "c_env_fog_controller.h"
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
#include "c_postprocesscontroller.h"
|
||||||
|
#include "c_colorcorrection.h"
|
||||||
|
#endif
|
||||||
#include "igameevents.h"
|
#include "igameevents.h"
|
||||||
#include "GameEventListener.h"
|
#include "GameEventListener.h"
|
||||||
|
|
||||||
@ -37,6 +41,7 @@ class C_BaseViewModel;
|
|||||||
class C_FuncLadder;
|
class C_FuncLadder;
|
||||||
class CFlashlightEffect;
|
class CFlashlightEffect;
|
||||||
class C_EconWearable;
|
class C_EconWearable;
|
||||||
|
class C_PostProcessController;
|
||||||
|
|
||||||
extern int g_nKillCamMode;
|
extern int g_nKillCamMode;
|
||||||
extern int g_nKillCamTarget1;
|
extern int g_nKillCamTarget1;
|
||||||
@ -183,7 +188,7 @@ public:
|
|||||||
|
|
||||||
// Flashlight
|
// Flashlight
|
||||||
void Flashlight( void );
|
void Flashlight( void );
|
||||||
void UpdateFlashlight( void );
|
virtual void UpdateFlashlight( void );
|
||||||
|
|
||||||
// Weapon selection code
|
// Weapon selection code
|
||||||
virtual bool IsAllowedToSwitchWeapons( void ) { return !IsObserver(); }
|
virtual bool IsAllowedToSwitchWeapons( void ) { return !IsObserver(); }
|
||||||
@ -202,6 +207,11 @@ public:
|
|||||||
void SetMaxSpeed( float flMaxSpeed ) { m_flMaxspeed = flMaxSpeed; }
|
void SetMaxSpeed( float flMaxSpeed ) { m_flMaxspeed = flMaxSpeed; }
|
||||||
float MaxSpeed() const { return m_flMaxspeed; }
|
float MaxSpeed() const { return m_flMaxspeed; }
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// See c_baseplayer.cpp
|
||||||
|
virtual ShadowType_t ShadowCastType();
|
||||||
|
virtual bool ShouldReceiveProjectedTextures( int flags );
|
||||||
|
#else
|
||||||
// Should this object cast shadows?
|
// Should this object cast shadows?
|
||||||
virtual ShadowType_t ShadowCastType() { return SHADOWS_NONE; }
|
virtual ShadowType_t ShadowCastType() { return SHADOWS_NONE; }
|
||||||
|
|
||||||
@ -209,6 +219,7 @@ public:
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
bool IsLocalPlayer( void ) const;
|
bool IsLocalPlayer( void ) const;
|
||||||
@ -379,6 +390,11 @@ public:
|
|||||||
void UpdateFogController( void );
|
void UpdateFogController( void );
|
||||||
void UpdateFogBlend( void );
|
void UpdateFogBlend( void );
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
C_PostProcessController* GetActivePostProcessController() const;
|
||||||
|
C_ColorCorrection* GetActiveColorCorrection() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
float GetFOVTime( void ){ return m_flFOVTime; }
|
float GetFOVTime( void ){ return m_flFOVTime; }
|
||||||
|
|
||||||
virtual void OnAchievementAchieved( int iAchievement ) {}
|
virtual void OnAchievementAchieved( int iAchievement ) {}
|
||||||
@ -443,20 +459,35 @@ public:
|
|||||||
float m_flConstraintWidth;
|
float m_flConstraintWidth;
|
||||||
float m_flConstraintSpeedFactor;
|
float m_flConstraintSpeedFactor;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Transmitted from the server for internal player spawnflags.
|
||||||
|
// See baseplayer_shared.h for more details.
|
||||||
|
int m_spawnflags;
|
||||||
|
|
||||||
|
inline bool HasSpawnFlags( int flags ) { return (m_spawnflags & flags) != 0; }
|
||||||
|
inline void RemoveSpawnFlags( int flags ) { m_spawnflags &= ~flags; }
|
||||||
|
inline void AddSpawnFlags( int flags ) { m_spawnflags |= flags; }
|
||||||
|
|
||||||
|
// Allows the player's model to draw on non-main views, like monitors or mirrors.
|
||||||
|
bool m_bDrawPlayerModelExternally;
|
||||||
|
|
||||||
|
bool m_bInTriggerFall;
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void CalcPlayerView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
//Tony; made all of these virtual so mods can override.
|
||||||
void CalcVehicleView(IClientVehicle *pVehicle, Vector& eyeOrigin, QAngle& eyeAngles,
|
virtual void CalcPlayerView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
||||||
float& zNear, float& zFar, float& fov );
|
virtual void CalcVehicleView(IClientVehicle *pVehicle, Vector& eyeOrigin, QAngle& eyeAngles, float& zNear, float& zFar, float& fov );
|
||||||
virtual void CalcObserverView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
virtual void CalcObserverView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
||||||
virtual Vector GetChaseCamViewOffset( CBaseEntity *target );
|
virtual Vector GetChaseCamViewOffset( CBaseEntity *target );
|
||||||
void CalcChaseCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
virtual void CalcChaseCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
||||||
virtual void CalcInEyeCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
virtual void CalcInEyeCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
||||||
|
|
||||||
virtual float GetDeathCamInterpolationTime();
|
virtual float GetDeathCamInterpolationTime();
|
||||||
|
|
||||||
virtual void CalcDeathCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
virtual void CalcDeathCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
||||||
void CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float& fov);
|
virtual void CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float& fov);
|
||||||
virtual void CalcFreezeCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
virtual void CalcFreezeCamView( Vector& eyeOrigin, QAngle& eyeAngles, float& fov );
|
||||||
|
|
||||||
// Check to see if we're in vgui input mode...
|
// Check to see if we're in vgui input mode...
|
||||||
@ -628,6 +659,11 @@ private:
|
|||||||
// One for left and one for right side of step
|
// One for left and one for right side of step
|
||||||
StepSoundCache_t m_StepSoundCache[ 2 ];
|
StepSoundCache_t m_StepSoundCache[ 2 ];
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
CNetworkHandle( C_PostProcessController, m_hPostProcessCtrl ); // active postprocessing controller
|
||||||
|
CNetworkHandle( C_ColorCorrection, m_hColorCorrectionCtrl ); // active FXVolume color correction
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
const char *GetLastKnownPlaceName( void ) const { return m_szLastPlaceName; } // return the last nav place name the player occupied
|
const char *GetLastKnownPlaceName( void ) const { return m_szLastPlaceName; } // return the last nav place name the player occupied
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
#ifdef CSTRIKE_DLL
|
#if defined(CSTRIKE_DLL) || defined (MAPBASE)
|
||||||
ConVar cl_righthand( "cl_righthand", "1", FCVAR_ARCHIVE, "Use right-handed view models." );
|
ConVar cl_righthand( "cl_righthand", "1", FCVAR_ARCHIVE, "Use right-handed view models." );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -192,9 +192,9 @@ bool C_BaseViewModel::Interpolate( float currentTime )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool C_BaseViewModel::ShouldFlipViewModel()
|
bool C_BaseViewModel::ShouldFlipViewModel()
|
||||||
{
|
{
|
||||||
#ifdef CSTRIKE_DLL
|
#if defined(CSTRIKE_DLL) || defined (MAPBASE)
|
||||||
// If cl_righthand is set, then we want them all right-handed.
|
// If cl_righthand is set, then we want them all right-handed.
|
||||||
CBaseCombatWeapon *pWeapon = m_hWeapon.Get();
|
CBaseCombatWeapon *pWeapon = m_hWeapon.Get();
|
||||||
if ( pWeapon )
|
if ( pWeapon )
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
//===========================================================================//
|
//===========================================================================//
|
||||||
#include "cbase.h"
|
#include "cbase.h"
|
||||||
|
|
||||||
|
#include "c_colorcorrection.h"
|
||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "cdll_client_int.h"
|
#include "cdll_client_int.h"
|
||||||
#include "colorcorrectionmgr.h"
|
#include "colorcorrectionmgr.h"
|
||||||
@ -17,45 +18,27 @@
|
|||||||
|
|
||||||
static ConVar mat_colcorrection_disableentities( "mat_colcorrection_disableentities", "0", FCVAR_NONE, "Disable map color-correction entities" );
|
static ConVar mat_colcorrection_disableentities( "mat_colcorrection_disableentities", "0", FCVAR_NONE, "Disable map color-correction entities" );
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
//------------------------------------------------------------------------------
|
static ConVar mat_colcorrection_forceentitiesclientside( "mat_colcorrection_forceentitiesclientside", "0", FCVAR_CHEAT, "Forces color correction entities to be updated on the client" );
|
||||||
// Purpose : Color correction entity with radial falloff
|
#endif
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
class C_ColorCorrection : public C_BaseEntity
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS( C_ColorCorrection, C_BaseEntity );
|
|
||||||
|
|
||||||
DECLARE_CLIENTCLASS();
|
|
||||||
|
|
||||||
C_ColorCorrection();
|
|
||||||
virtual ~C_ColorCorrection();
|
|
||||||
|
|
||||||
void OnDataChanged(DataUpdateType_t updateType);
|
|
||||||
bool ShouldDraw();
|
|
||||||
|
|
||||||
void ClientThink();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Vector m_vecOrigin;
|
|
||||||
|
|
||||||
float m_minFalloff;
|
|
||||||
float m_maxFalloff;
|
|
||||||
float m_flCurWeight;
|
|
||||||
char m_netLookupFilename[MAX_PATH];
|
|
||||||
|
|
||||||
bool m_bEnabled;
|
|
||||||
|
|
||||||
ClientCCHandle_t m_CCHandle;
|
|
||||||
};
|
|
||||||
|
|
||||||
IMPLEMENT_CLIENTCLASS_DT(C_ColorCorrection, DT_ColorCorrection, CColorCorrection)
|
IMPLEMENT_CLIENTCLASS_DT(C_ColorCorrection, DT_ColorCorrection, CColorCorrection)
|
||||||
RecvPropVector( RECVINFO(m_vecOrigin) ),
|
RecvPropVector( RECVINFO(m_vecOrigin) ),
|
||||||
RecvPropFloat( RECVINFO(m_minFalloff) ),
|
RecvPropFloat( RECVINFO(m_minFalloff) ),
|
||||||
RecvPropFloat( RECVINFO(m_maxFalloff) ),
|
RecvPropFloat( RECVINFO(m_maxFalloff) ),
|
||||||
RecvPropFloat( RECVINFO(m_flCurWeight) ),
|
RecvPropFloat( RECVINFO(m_flCurWeight) ),
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
RecvPropFloat( RECVINFO(m_flMaxWeight) ),
|
||||||
|
RecvPropFloat( RECVINFO(m_flFadeInDuration) ),
|
||||||
|
RecvPropFloat( RECVINFO(m_flFadeOutDuration) ),
|
||||||
|
#endif
|
||||||
RecvPropString( RECVINFO(m_netLookupFilename) ),
|
RecvPropString( RECVINFO(m_netLookupFilename) ),
|
||||||
RecvPropBool( RECVINFO(m_bEnabled) ),
|
RecvPropBool( RECVINFO(m_bEnabled) ),
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
RecvPropBool( RECVINFO(m_bMaster) ),
|
||||||
|
RecvPropBool( RECVINFO(m_bClientSide) ),
|
||||||
|
RecvPropBool( RECVINFO(m_bExclusive) )
|
||||||
|
#endif
|
||||||
|
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
@ -65,14 +48,43 @@ END_RECV_TABLE()
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
C_ColorCorrection::C_ColorCorrection()
|
C_ColorCorrection::C_ColorCorrection()
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
m_minFalloff = -1.0f;
|
||||||
|
m_maxFalloff = -1.0f;
|
||||||
|
m_flFadeInDuration = 0.0f;
|
||||||
|
m_flFadeOutDuration = 0.0f;
|
||||||
|
m_flCurWeight = 0.0f;
|
||||||
|
m_flMaxWeight = 1.0f;
|
||||||
|
m_netLookupFilename[0] = '\0';
|
||||||
|
m_bEnabled = false;
|
||||||
|
m_bMaster = false;
|
||||||
|
m_bExclusive = false;
|
||||||
|
#endif
|
||||||
m_CCHandle = INVALID_CLIENT_CCHANDLE;
|
m_CCHandle = INVALID_CLIENT_CCHANDLE;
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
m_bFadingIn = false;
|
||||||
|
m_flFadeStartWeight = 0.0f;
|
||||||
|
m_flFadeStartTime = 0.0f;
|
||||||
|
m_flFadeDuration = 0.0f;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
C_ColorCorrection::~C_ColorCorrection()
|
C_ColorCorrection::~C_ColorCorrection()
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
g_pColorCorrectionMgr->RemoveColorCorrectionEntity( this, m_CCHandle );
|
||||||
|
#else
|
||||||
g_pColorCorrectionMgr->RemoveColorCorrection( m_CCHandle );
|
g_pColorCorrectionMgr->RemoveColorCorrection( m_CCHandle );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
bool C_ColorCorrection::IsClientSide() const
|
||||||
|
{
|
||||||
|
return m_bClientSide || mat_colcorrection_forceentitiesclientside.GetBool();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// Purpose :
|
// Purpose :
|
||||||
@ -87,11 +99,21 @@ void C_ColorCorrection::OnDataChanged(DataUpdateType_t updateType)
|
|||||||
{
|
{
|
||||||
if ( m_CCHandle == INVALID_CLIENT_CCHANDLE )
|
if ( m_CCHandle == INVALID_CLIENT_CCHANDLE )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
// forming a unique name without extension
|
||||||
|
char cleanName[MAX_PATH];
|
||||||
|
V_StripExtension( m_netLookupFilename, cleanName, sizeof( cleanName ) );
|
||||||
|
char name[MAX_PATH];
|
||||||
|
Q_snprintf( name, MAX_PATH, "%s_%d", cleanName, entindex() );
|
||||||
|
|
||||||
|
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrectionEntity( this, name, m_netLookupFilename );
|
||||||
|
#else
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
Q_strncpy( filename, m_netLookupFilename, MAX_PATH );
|
Q_strncpy( filename, m_netLookupFilename, MAX_PATH );
|
||||||
|
|
||||||
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrection( filename );
|
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrection( filename );
|
||||||
SetNextClientThink( ( m_CCHandle != INVALID_CLIENT_CCHANDLE ) ? CLIENT_THINK_ALWAYS : CLIENT_THINK_NEVER );
|
SetNextClientThink( ( m_CCHandle != INVALID_CLIENT_CCHANDLE ) ? CLIENT_THINK_ALWAYS : CLIENT_THINK_NEVER );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,6 +126,129 @@ bool C_ColorCorrection::ShouldDraw()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
void C_ColorCorrection::Update( C_BasePlayer *pPlayer, float ccScale )
|
||||||
|
{
|
||||||
|
Assert( m_CCHandle != INVALID_CLIENT_CCHANDLE );
|
||||||
|
|
||||||
|
if ( mat_colcorrection_disableentities.GetInt() )
|
||||||
|
{
|
||||||
|
// Allow the colorcorrectionui panel (or user) to turn off color-correction entities
|
||||||
|
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, 0.0f, m_bExclusive );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fade weight on client
|
||||||
|
if ( IsClientSide() )
|
||||||
|
{
|
||||||
|
m_flCurWeight = Lerp( GetFadeRatio(), m_flFadeStartWeight, m_bFadingIn ? m_flMaxWeight : 0.0f );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !m_bEnabled && m_flCurWeight == 0.0f )
|
||||||
|
{
|
||||||
|
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, 0.0f, m_bExclusive );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector playerOrigin = pPlayer->GetAbsOrigin();
|
||||||
|
|
||||||
|
float weight = 0;
|
||||||
|
if ( ( m_minFalloff != -1 ) && ( m_maxFalloff != -1 ) && m_minFalloff != m_maxFalloff )
|
||||||
|
{
|
||||||
|
float dist = (playerOrigin - m_vecOrigin).Length();
|
||||||
|
weight = (dist-m_minFalloff) / (m_maxFalloff-m_minFalloff);
|
||||||
|
if ( weight<0.0f ) weight = 0.0f;
|
||||||
|
if ( weight>1.0f ) weight = 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, m_flCurWeight * ( 1.0 - weight ) * ccScale, m_bExclusive );
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_ColorCorrection::EnableOnClient( bool bEnable, bool bSkipFade )
|
||||||
|
{
|
||||||
|
if ( !IsClientSide() )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bFadingIn = bEnable;
|
||||||
|
|
||||||
|
// initialize countdown timer
|
||||||
|
m_flFadeStartWeight = m_flCurWeight;
|
||||||
|
float flFadeTimeScale = 1.0f;
|
||||||
|
if ( m_flMaxWeight != 0.0f )
|
||||||
|
{
|
||||||
|
flFadeTimeScale = m_flCurWeight / m_flMaxWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_bFadingIn )
|
||||||
|
{
|
||||||
|
flFadeTimeScale = 1.0f - flFadeTimeScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( bSkipFade )
|
||||||
|
{
|
||||||
|
flFadeTimeScale = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
StartFade( flFadeTimeScale * ( m_bFadingIn ? m_flFadeInDuration : m_flFadeOutDuration ) );
|
||||||
|
|
||||||
|
// update the clientside weight once here, in case the fade duration is 0
|
||||||
|
m_flCurWeight = Lerp( GetFadeRatio(), m_flFadeStartWeight, m_bFadingIn ? m_flMaxWeight : 0.0f );
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector C_ColorCorrection::GetOrigin()
|
||||||
|
{
|
||||||
|
return m_vecOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
|
float C_ColorCorrection::GetMinFalloff()
|
||||||
|
{
|
||||||
|
return m_minFalloff;
|
||||||
|
}
|
||||||
|
|
||||||
|
float C_ColorCorrection::GetMaxFalloff()
|
||||||
|
{
|
||||||
|
return m_maxFalloff;
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_ColorCorrection::SetWeight( float fWeight )
|
||||||
|
{
|
||||||
|
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, fWeight, false );
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_ColorCorrection::StartFade( float flDuration )
|
||||||
|
{
|
||||||
|
m_flFadeStartTime = gpGlobals->curtime;
|
||||||
|
m_flFadeDuration = MAX( flDuration, 0.0f );
|
||||||
|
}
|
||||||
|
|
||||||
|
float C_ColorCorrection::GetFadeRatio() const
|
||||||
|
{
|
||||||
|
float flRatio = 1.0f;
|
||||||
|
|
||||||
|
if ( m_flFadeDuration != 0.0f )
|
||||||
|
{
|
||||||
|
flRatio = ( gpGlobals->curtime - m_flFadeStartTime ) / m_flFadeDuration;
|
||||||
|
flRatio = clamp( flRatio, 0.0f, 1.0f );
|
||||||
|
}
|
||||||
|
return flRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool C_ColorCorrection::IsFadeTimeElapsed() const
|
||||||
|
{
|
||||||
|
return ( ( gpGlobals->curtime - m_flFadeStartTime ) > m_flFadeDuration ) ||
|
||||||
|
( ( gpGlobals->curtime - m_flFadeStartTime ) < 0.0f );
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateColorCorrectionEntities( C_BasePlayer *pPlayer, float ccScale, C_ColorCorrection **pList, int listCount )
|
||||||
|
{
|
||||||
|
for ( int i = 0; i < listCount; i++ )
|
||||||
|
{
|
||||||
|
pList[i]->Update(pPlayer, ccScale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
void C_ColorCorrection::ClientThink()
|
void C_ColorCorrection::ClientThink()
|
||||||
{
|
{
|
||||||
if ( m_CCHandle == INVALID_CLIENT_CCHANDLE )
|
if ( m_CCHandle == INVALID_CLIENT_CCHANDLE )
|
||||||
@ -141,6 +286,7 @@ void C_ColorCorrection::ClientThink()
|
|||||||
|
|
||||||
BaseClass::ClientThink();
|
BaseClass::ClientThink();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
88
sp/src/game/client/c_colorcorrection.h
Normal file
88
sp/src/game/client/c_colorcorrection.h
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
//========= Mapbase - https://github.com/mapbase-source/source-sdk-2013 ============//
|
||||||
|
//
|
||||||
|
// Note that this header exists in the Alien Swarm SDK, but not in stock Source SDK 2013.
|
||||||
|
// Although technically a new Mapbase file, it only serves to move otherwise identical code,
|
||||||
|
// so most code and repo conventions will pretend it was always there.
|
||||||
|
//
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Purpose: Color correction entity with simple radial falloff
|
||||||
|
//
|
||||||
|
//=============================================================================//
|
||||||
|
|
||||||
|
#ifndef C_COLORCORRECTION_H
|
||||||
|
#define C_COLORCORRECTION_H
|
||||||
|
#ifdef _WIN32
|
||||||
|
#pragma once
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "colorcorrectionmgr.h"
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Purpose : Color correction entity with radial falloff
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
class C_ColorCorrection : public C_BaseEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS( C_ColorCorrection, C_BaseEntity );
|
||||||
|
|
||||||
|
DECLARE_CLIENTCLASS();
|
||||||
|
|
||||||
|
C_ColorCorrection();
|
||||||
|
virtual ~C_ColorCorrection();
|
||||||
|
|
||||||
|
void OnDataChanged(DataUpdateType_t updateType);
|
||||||
|
bool ShouldDraw();
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
virtual void Update(C_BasePlayer *pPlayer, float ccScale);
|
||||||
|
|
||||||
|
bool IsMaster() const { return m_bMaster; }
|
||||||
|
bool IsClientSide() const;
|
||||||
|
bool IsExclusive() const { return m_bExclusive; }
|
||||||
|
|
||||||
|
void EnableOnClient( bool bEnable, bool bSkipFade = false );
|
||||||
|
|
||||||
|
Vector GetOrigin();
|
||||||
|
float GetMinFalloff();
|
||||||
|
float GetMaxFalloff();
|
||||||
|
|
||||||
|
void SetWeight( float fWeight );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void StartFade( float flDuration );
|
||||||
|
float GetFadeRatio() const;
|
||||||
|
bool IsFadeTimeElapsed() const;
|
||||||
|
#else
|
||||||
|
void ClientThink();
|
||||||
|
|
||||||
|
private:
|
||||||
|
#endif
|
||||||
|
Vector m_vecOrigin;
|
||||||
|
|
||||||
|
float m_minFalloff;
|
||||||
|
float m_maxFalloff;
|
||||||
|
float m_flCurWeight;
|
||||||
|
char m_netLookupFilename[MAX_PATH];
|
||||||
|
|
||||||
|
bool m_bEnabled;
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
float m_flFadeInDuration;
|
||||||
|
float m_flFadeOutDuration;
|
||||||
|
float m_flMaxWeight;
|
||||||
|
|
||||||
|
bool m_bMaster;
|
||||||
|
bool m_bClientSide;
|
||||||
|
bool m_bExclusive;
|
||||||
|
|
||||||
|
bool m_bFadingIn;
|
||||||
|
float m_flFadeStartWeight;
|
||||||
|
float m_flFadeStartTime;
|
||||||
|
float m_flFadeDuration;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ClientCCHandle_t m_CCHandle;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -36,9 +36,26 @@ public:
|
|||||||
void OnDataChanged(DataUpdateType_t updateType);
|
void OnDataChanged(DataUpdateType_t updateType);
|
||||||
bool ShouldDraw();
|
bool ShouldDraw();
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
void Update( C_BasePlayer *pPlayer, float ccScale );
|
||||||
|
|
||||||
|
void StartTouch( C_BaseEntity *pOther );
|
||||||
|
void EndTouch( C_BaseEntity *pOther );
|
||||||
|
#else
|
||||||
void ClientThink();
|
void ClientThink();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
float m_LastEnterWeight;
|
||||||
|
float m_LastEnterTime;
|
||||||
|
|
||||||
|
float m_LastExitWeight;
|
||||||
|
float m_LastExitTime;
|
||||||
|
bool m_bEnabled;
|
||||||
|
float m_MaxWeight;
|
||||||
|
float m_FadeDuration;
|
||||||
|
#endif
|
||||||
float m_Weight;
|
float m_Weight;
|
||||||
char m_lookupFilename[MAX_PATH];
|
char m_lookupFilename[MAX_PATH];
|
||||||
|
|
||||||
@ -46,6 +63,11 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_CLIENTCLASS_DT(C_ColorCorrectionVolume, DT_ColorCorrectionVolume, CColorCorrectionVolume)
|
IMPLEMENT_CLIENTCLASS_DT(C_ColorCorrectionVolume, DT_ColorCorrectionVolume, CColorCorrectionVolume)
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
RecvPropBool( RECVINFO( m_bEnabled ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_MaxWeight ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_FadeDuration ) ),
|
||||||
|
#endif
|
||||||
RecvPropFloat( RECVINFO(m_Weight) ),
|
RecvPropFloat( RECVINFO(m_Weight) ),
|
||||||
RecvPropString( RECVINFO(m_lookupFilename) ),
|
RecvPropString( RECVINFO(m_lookupFilename) ),
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
@ -82,11 +104,21 @@ void C_ColorCorrectionVolume::OnDataChanged(DataUpdateType_t updateType)
|
|||||||
{
|
{
|
||||||
if ( m_CCHandle == INVALID_CLIENT_CCHANDLE )
|
if ( m_CCHandle == INVALID_CLIENT_CCHANDLE )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
// forming a unique name without extension
|
||||||
|
char cleanName[MAX_PATH];
|
||||||
|
V_StripExtension( m_lookupFilename, cleanName, sizeof( cleanName ) );
|
||||||
|
char name[MAX_PATH];
|
||||||
|
Q_snprintf( name, MAX_PATH, "%s_%d", cleanName, entindex() );
|
||||||
|
|
||||||
|
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrectionVolume( this, name, m_lookupFilename );
|
||||||
|
#else
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
Q_strncpy( filename, m_lookupFilename, MAX_PATH );
|
Q_strncpy( filename, m_lookupFilename, MAX_PATH );
|
||||||
|
|
||||||
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrection( filename );
|
m_CCHandle = g_pColorCorrectionMgr->AddColorCorrection( filename );
|
||||||
SetNextClientThink( ( m_CCHandle != INVALID_CLIENT_CCHANDLE ) ? CLIENT_THINK_ALWAYS : CLIENT_THINK_NEVER );
|
SetNextClientThink( ( m_CCHandle != INVALID_CLIENT_CCHANDLE ) ? CLIENT_THINK_ALWAYS : CLIENT_THINK_NEVER );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,11 +131,95 @@ bool C_ColorCorrectionVolume::ShouldDraw()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE // From Alien Swarm SDK
|
||||||
|
//--------------------------------------------------------------------------------------------------------
|
||||||
|
void C_ColorCorrectionVolume::StartTouch( CBaseEntity *pEntity )
|
||||||
|
{
|
||||||
|
m_LastEnterTime = gpGlobals->curtime;
|
||||||
|
m_LastEnterWeight = m_Weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------------
|
||||||
|
void C_ColorCorrectionVolume::EndTouch( CBaseEntity *pEntity )
|
||||||
|
{
|
||||||
|
m_LastExitTime = gpGlobals->curtime;
|
||||||
|
m_LastExitWeight = m_Weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void C_ColorCorrectionVolume::Update( C_BasePlayer *pPlayer, float ccScale )
|
||||||
|
{
|
||||||
|
if ( pPlayer )
|
||||||
|
{
|
||||||
|
bool isTouching = CollisionProp()->IsPointInBounds( pPlayer->EyePosition() );
|
||||||
|
bool wasTouching = m_LastEnterTime > m_LastExitTime;
|
||||||
|
|
||||||
|
if ( isTouching && !wasTouching )
|
||||||
|
{
|
||||||
|
StartTouch( pPlayer );
|
||||||
|
}
|
||||||
|
else if ( !isTouching && wasTouching )
|
||||||
|
{
|
||||||
|
EndTouch( pPlayer );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !m_bEnabled )
|
||||||
|
{
|
||||||
|
m_Weight = 0.0f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( m_LastEnterTime > m_LastExitTime )
|
||||||
|
{
|
||||||
|
// we most recently entered the volume
|
||||||
|
|
||||||
|
if( m_Weight < 1.0f )
|
||||||
|
{
|
||||||
|
float dt = gpGlobals->curtime - m_LastEnterTime;
|
||||||
|
float weight = m_LastEnterWeight + dt / ((1.0f-m_LastEnterWeight)*m_FadeDuration);
|
||||||
|
if( weight>1.0f )
|
||||||
|
weight = 1.0f;
|
||||||
|
|
||||||
|
m_Weight = weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// we most recently exitted the volume
|
||||||
|
|
||||||
|
if( m_Weight > 0.0f )
|
||||||
|
{
|
||||||
|
float dt = gpGlobals->curtime - m_LastExitTime;
|
||||||
|
float weight = (1.0f-m_LastExitWeight) + dt / (m_LastExitWeight*m_FadeDuration);
|
||||||
|
if( weight>1.0f )
|
||||||
|
weight = 1.0f;
|
||||||
|
|
||||||
|
m_Weight = 1.0f - weight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vector entityPosition = GetAbsOrigin();
|
||||||
|
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, m_Weight * ccScale );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void UpdateColorCorrectionVolumes( C_BasePlayer *pPlayer, float ccScale, C_ColorCorrectionVolume **pList, int listCount )
|
||||||
|
{
|
||||||
|
for ( int i = 0; i < listCount; i++ )
|
||||||
|
{
|
||||||
|
pList[i]->Update(pPlayer, ccScale);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
void C_ColorCorrectionVolume::ClientThink()
|
void C_ColorCorrectionVolume::ClientThink()
|
||||||
{
|
{
|
||||||
Vector entityPosition = GetAbsOrigin();
|
Vector entityPosition = GetAbsOrigin();
|
||||||
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, m_Weight );
|
g_pColorCorrectionMgr->SetColorCorrectionWeight( m_CCHandle, m_Weight );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
//=============================================================================//
|
//=============================================================================//
|
||||||
#include "cbase.h"
|
#include "cbase.h"
|
||||||
|
#include "c_effects.h"
|
||||||
#include "c_tracer.h"
|
#include "c_tracer.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "initializer.h"
|
#include "initializer.h"
|
||||||
@ -22,6 +23,7 @@
|
|||||||
#include "collisionutils.h"
|
#include "collisionutils.h"
|
||||||
#include "tier0/vprof.h"
|
#include "tier0/vprof.h"
|
||||||
#include "viewrender.h"
|
#include "viewrender.h"
|
||||||
|
#include "raytrace.h"
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
@ -35,6 +37,15 @@ float g_flSplashLifetime = 0.5f;
|
|||||||
float g_flSplashAlpha = 0.3f;
|
float g_flSplashAlpha = 0.3f;
|
||||||
ConVar r_RainSplashPercentage( "r_RainSplashPercentage", "20", FCVAR_CHEAT ); // N% chance of a rain particle making a splash.
|
ConVar r_RainSplashPercentage( "r_RainSplashPercentage", "20", FCVAR_CHEAT ); // N% chance of a rain particle making a splash.
|
||||||
|
|
||||||
|
ConVar r_RainParticleDensity( "r_RainParticleDensity", "1", FCVAR_NONE, "Density of Particle Rain 0-1" );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
ConVar r_RainParticleClampOffset_Rain( "r_RainParticleClampOffset_Rain", "120", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems using the 'Particle Rain' type." );
|
||||||
|
ConVar r_RainParticleClampOffset_Ash( "r_RainParticleClampOffset_Ash", "300", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems using the 'Particle Ash' type." );
|
||||||
|
ConVar r_RainParticleClampOffset_RainStorm( "r_RainParticleClampOffset_RainStorm", "112", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems using the 'Particle Rain Storm' type." );
|
||||||
|
ConVar r_RainParticleClampOffset_Snow( "r_RainParticleClampOffset_Snow", "300", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems using the 'Particle Snow' type." );
|
||||||
|
ConVar r_RainParticleClampDebug( "r_RainParticleClampDebug", "0", FCVAR_NONE, "Enables debug code for precipitation particle system clamping" );
|
||||||
|
#endif
|
||||||
|
|
||||||
float GUST_INTERVAL_MIN = 1;
|
float GUST_INTERVAL_MIN = 1;
|
||||||
float GUST_INTERVAL_MAX = 2;
|
float GUST_INTERVAL_MAX = 2;
|
||||||
@ -60,151 +71,14 @@ CLIENTEFFECT_MATERIAL( "particle/rain" )
|
|||||||
CLIENTEFFECT_MATERIAL( "particle/snow" )
|
CLIENTEFFECT_MATERIAL( "particle/snow" )
|
||||||
CLIENTEFFECT_REGISTER_END()
|
CLIENTEFFECT_REGISTER_END()
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
CUtlVector< RayTracingEnvironment* > g_RayTraceEnvironments;
|
||||||
// Precipitation particle type
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class CPrecipitationParticle
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
Vector m_Pos;
|
|
||||||
Vector m_Velocity;
|
|
||||||
float m_SpawnTime; // Note: Tweak with this to change lifetime
|
|
||||||
float m_Mass;
|
|
||||||
float m_Ramp;
|
|
||||||
|
|
||||||
float m_flCurLifetime;
|
|
||||||
float m_flMaxLifetime;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CClient_Precipitation;
|
|
||||||
static CUtlVector<CClient_Precipitation*> g_Precipitations;
|
|
||||||
|
|
||||||
//===========
|
|
||||||
// Snow fall
|
|
||||||
//===========
|
|
||||||
class CSnowFallManager;
|
|
||||||
static CSnowFallManager *s_pSnowFallMgr = NULL;
|
|
||||||
bool SnowFallManagerCreate( CClient_Precipitation *pSnowEntity );
|
|
||||||
void SnowFallManagerDestroy( void );
|
|
||||||
|
|
||||||
class AshDebrisEffect : public CSimpleEmitter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AshDebrisEffect( const char *pDebugName ) : CSimpleEmitter( pDebugName ) {}
|
|
||||||
|
|
||||||
static AshDebrisEffect* Create( const char *pDebugName );
|
|
||||||
|
|
||||||
virtual float UpdateAlpha( const SimpleParticle *pParticle );
|
|
||||||
virtual float UpdateRoll( SimpleParticle *pParticle, float timeDelta );
|
|
||||||
|
|
||||||
private:
|
|
||||||
AshDebrisEffect( const AshDebrisEffect & );
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Precipitation base entity
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class CClient_Precipitation : public C_BaseEntity
|
|
||||||
{
|
|
||||||
class CPrecipitationEffect;
|
|
||||||
friend class CClient_Precipitation::CPrecipitationEffect;
|
|
||||||
|
|
||||||
public:
|
|
||||||
DECLARE_CLASS( CClient_Precipitation, C_BaseEntity );
|
|
||||||
DECLARE_CLIENTCLASS();
|
|
||||||
|
|
||||||
CClient_Precipitation();
|
|
||||||
virtual ~CClient_Precipitation();
|
|
||||||
|
|
||||||
// Inherited from C_BaseEntity
|
|
||||||
virtual void Precache( );
|
|
||||||
|
|
||||||
void Render();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Creates a single particle
|
|
||||||
CPrecipitationParticle* CreateParticle();
|
|
||||||
|
|
||||||
virtual void OnDataChanged( DataUpdateType_t updateType );
|
|
||||||
virtual void ClientThink();
|
|
||||||
|
|
||||||
void Simulate( float dt );
|
|
||||||
|
|
||||||
// Renders the particle
|
|
||||||
void RenderParticle( CPrecipitationParticle* pParticle, CMeshBuilder &mb );
|
|
||||||
|
|
||||||
void CreateWaterSplashes();
|
|
||||||
|
|
||||||
// Emits the actual particles
|
|
||||||
void EmitParticles( float fTimeDelta );
|
|
||||||
|
|
||||||
// Computes where we're gonna emit
|
|
||||||
bool ComputeEmissionArea( Vector& origin, Vector2D& size );
|
|
||||||
|
|
||||||
// Gets the tracer width and speed
|
|
||||||
float GetWidth() const;
|
|
||||||
float GetLength() const;
|
|
||||||
float GetSpeed() const;
|
|
||||||
|
|
||||||
// Gets the remaining lifetime of the particle
|
|
||||||
float GetRemainingLifetime( CPrecipitationParticle* pParticle ) const;
|
|
||||||
|
|
||||||
// Computes the wind vector
|
|
||||||
static void ComputeWindVector( );
|
|
||||||
|
|
||||||
// simulation methods
|
|
||||||
bool SimulateRain( CPrecipitationParticle* pParticle, float dt );
|
|
||||||
bool SimulateSnow( CPrecipitationParticle* pParticle, float dt );
|
|
||||||
|
|
||||||
void CreateAshParticle( void );
|
|
||||||
void CreateRainOrSnowParticle( Vector vSpawnPosition, Vector vVelocity );
|
|
||||||
|
|
||||||
// Information helpful in creating and rendering particles
|
|
||||||
IMaterial *m_MatHandle; // material used
|
|
||||||
|
|
||||||
float m_Color[4]; // precip color
|
|
||||||
float m_Lifetime; // Precip lifetime
|
|
||||||
float m_InitialRamp; // Initial ramp value
|
|
||||||
float m_Speed; // Precip speed
|
|
||||||
float m_Width; // Tracer width
|
|
||||||
float m_Remainder; // particles we should render next time
|
|
||||||
PrecipitationType_t m_nPrecipType; // Precip type
|
|
||||||
float m_flHalfScreenWidth; // Precalculated each frame.
|
|
||||||
|
|
||||||
float m_flDensity;
|
|
||||||
|
|
||||||
// Some state used in rendering and simulation
|
|
||||||
// Used to modify the rain density and wind from the console
|
|
||||||
static ConVar s_raindensity;
|
|
||||||
static ConVar s_rainwidth;
|
|
||||||
static ConVar s_rainlength;
|
|
||||||
static ConVar s_rainspeed;
|
|
||||||
|
|
||||||
static Vector s_WindVector; // Stores the wind speed vector
|
|
||||||
|
|
||||||
CUtlLinkedList<CPrecipitationParticle> m_Particles;
|
|
||||||
CUtlVector<Vector> m_Splashes;
|
|
||||||
|
|
||||||
CSmartPtr<AshDebrisEffect> m_pAshEmitter;
|
|
||||||
TimedEvent m_tAshParticleTimer;
|
|
||||||
TimedEvent m_tAshParticleTraceTimer;
|
|
||||||
bool m_bActiveAshEmitter;
|
|
||||||
Vector m_vAshSpawnOrigin;
|
|
||||||
|
|
||||||
int m_iAshCount;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CClient_Precipitation( const CClient_Precipitation & ); // not defined, not accessible
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Just receive the normal data table stuff
|
// Just receive the normal data table stuff
|
||||||
IMPLEMENT_CLIENTCLASS_DT(CClient_Precipitation, DT_Precipitation, CPrecipitation)
|
IMPLEMENT_CLIENTCLASS_DT(CClient_Precipitation, DT_Precipitation, CPrecipitation)
|
||||||
RecvPropInt( RECVINFO( m_nPrecipType ) )
|
RecvPropInt( RECVINFO( m_nPrecipType ) ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropInt( RECVINFO( m_spawnflags ) ),
|
||||||
|
#endif
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
static ConVar r_SnowEnable( "r_SnowEnable", "1", FCVAR_CHEAT, "Snow Enable" );
|
static ConVar r_SnowEnable( "r_SnowEnable", "1", FCVAR_CHEAT, "Snow Enable" );
|
||||||
@ -396,6 +270,12 @@ inline bool CClient_Precipitation::SimulateSnow( CPrecipitationParticle* pPartic
|
|||||||
|
|
||||||
void CClient_Precipitation::Simulate( float dt )
|
void CClient_Precipitation::Simulate( float dt )
|
||||||
{
|
{
|
||||||
|
if ( IsParticleRainType(m_nPrecipType) )
|
||||||
|
{
|
||||||
|
CreateParticlePrecip();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// NOTE: When client-side prechaching works, we need to remove this
|
// NOTE: When client-side prechaching works, we need to remove this
|
||||||
Precache();
|
Precache();
|
||||||
|
|
||||||
@ -472,6 +352,9 @@ inline void CClient_Precipitation::RenderParticle( CPrecipitationParticle* pPart
|
|||||||
float scale;
|
float scale;
|
||||||
Vector start, delta;
|
Vector start, delta;
|
||||||
|
|
||||||
|
if ( IsParticleRainType(m_nPrecipType) )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( m_nPrecipType == PRECIPITATION_TYPE_ASH )
|
if ( m_nPrecipType == PRECIPITATION_TYPE_ASH )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -562,6 +445,9 @@ void CClient_Precipitation::Render()
|
|||||||
if ( !r_DrawRain.GetInt() )
|
if ( !r_DrawRain.GetInt() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ( IsParticleRainType(m_nPrecipType) )
|
||||||
|
return;
|
||||||
|
|
||||||
// Don't render in monitors or in reflections or refractions.
|
// Don't render in monitors or in reflections or refractions.
|
||||||
if ( CurrentViewID() == VIEW_MONITOR )
|
if ( CurrentViewID() == VIEW_MONITOR )
|
||||||
return;
|
return;
|
||||||
@ -633,6 +519,11 @@ CClient_Precipitation::CClient_Precipitation() : m_Remainder(0.0f)
|
|||||||
m_MatHandle = INVALID_MATERIAL_HANDLE;
|
m_MatHandle = INVALID_MATERIAL_HANDLE;
|
||||||
m_flHalfScreenWidth = 1;
|
m_flHalfScreenWidth = 1;
|
||||||
|
|
||||||
|
m_pParticlePrecipInnerNear = NULL;
|
||||||
|
m_pParticlePrecipInnerFar = NULL;
|
||||||
|
m_pParticlePrecipOuter = NULL;
|
||||||
|
m_bActiveParticlePrecipEmitter = false;
|
||||||
|
|
||||||
g_Precipitations.AddToTail( this );
|
g_Precipitations.AddToTail( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1011,6 +902,397 @@ void CClient_Precipitation::CreateAshParticle( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClient_Precipitation::PrecacheParticlePrecip( void )
|
||||||
|
{
|
||||||
|
if ( m_nPrecipType == PRECIPITATION_TYPE_PARTICLEASH )
|
||||||
|
{
|
||||||
|
PrecacheParticleSystem( "ash" );
|
||||||
|
PrecacheParticleSystem( "ash_outer" );
|
||||||
|
}
|
||||||
|
else if ( m_nPrecipType == PRECIPITATION_TYPE_PARTICLESNOW )
|
||||||
|
{
|
||||||
|
PrecacheParticleSystem( "snow" );
|
||||||
|
PrecacheParticleSystem( "snow_outer" );
|
||||||
|
}
|
||||||
|
else if ( m_nPrecipType == PRECIPITATION_TYPE_PARTICLERAINSTORM )
|
||||||
|
{
|
||||||
|
PrecacheParticleSystem( "rain_storm" );
|
||||||
|
PrecacheParticleSystem( "rain_storm_screen" );
|
||||||
|
PrecacheParticleSystem( "rain_storm_outer" );
|
||||||
|
}
|
||||||
|
else //default to rain
|
||||||
|
{
|
||||||
|
PrecacheParticleSystem( "rain" );
|
||||||
|
PrecacheParticleSystem( "rain_outer" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClient_Precipitation::CreateParticlePrecip( void )
|
||||||
|
{
|
||||||
|
if ( !m_bParticlePrecipInitialized )
|
||||||
|
{
|
||||||
|
PrecacheParticlePrecip();
|
||||||
|
InitializeParticlePrecip();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||||
|
|
||||||
|
if ( pPlayer == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Make sure the emitter is setup
|
||||||
|
if ( !m_bActiveParticlePrecipEmitter )
|
||||||
|
{
|
||||||
|
//Update 8 times per second.
|
||||||
|
m_tParticlePrecipTraceTimer.Init( 8 );
|
||||||
|
DestroyInnerParticlePrecip();
|
||||||
|
DestroyOuterParticlePrecip();
|
||||||
|
m_bActiveParticlePrecipEmitter = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
UpdateParticlePrecip( pPlayer );
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
void CClient_Precipitation::ClampParticlePosition( Vector &vPlayerPos, Vector &vOffsetPos, Vector &vOffsetPosNear, Vector &vOffsetPosFar )
|
||||||
|
{
|
||||||
|
Vector mins, maxs;
|
||||||
|
modelinfo->GetModelBounds( GetModel(), mins, maxs );
|
||||||
|
|
||||||
|
// Account for precipitation height
|
||||||
|
maxs.z += 180;
|
||||||
|
|
||||||
|
Vector vecOrigin; //= WorldSpaceCenter();
|
||||||
|
VectorLerp( mins, maxs, 0.5f, vecOrigin );
|
||||||
|
|
||||||
|
maxs -= vecOrigin;
|
||||||
|
mins -= vecOrigin;
|
||||||
|
|
||||||
|
//float flMax = r_RainParticleClampOffset.GetFloat();
|
||||||
|
float flMax = 0;
|
||||||
|
switch (m_nPrecipType)
|
||||||
|
{
|
||||||
|
case PRECIPITATION_TYPE_PARTICLERAIN:
|
||||||
|
flMax = r_RainParticleClampOffset_Rain.GetFloat();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PRECIPITATION_TYPE_PARTICLEASH:
|
||||||
|
flMax = r_RainParticleClampOffset_Ash.GetFloat();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PRECIPITATION_TYPE_PARTICLERAINSTORM:
|
||||||
|
flMax = r_RainParticleClampOffset_RainStorm.GetFloat();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PRECIPITATION_TYPE_PARTICLESNOW:
|
||||||
|
flMax = r_RainParticleClampOffset_Snow.GetFloat();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector addend( flMax, flMax, 0 );
|
||||||
|
mins += addend;
|
||||||
|
maxs -= addend;
|
||||||
|
|
||||||
|
if (flMax > 0)
|
||||||
|
{
|
||||||
|
// Unless this is extruding outwards, make sure the offset isn't inverting the bounds.
|
||||||
|
// This means precipitation triggers with bounds less than offset*2 will turn into a thin line
|
||||||
|
// and the involved precipitation will pretty much be spatial at all times, which is okay.
|
||||||
|
mins.x = clamp( mins.x, -FLT_MAX, -1 );
|
||||||
|
mins.y = clamp( mins.y, -FLT_MAX, -1 );
|
||||||
|
maxs.x = clamp( maxs.x, 1, FLT_MAX );
|
||||||
|
maxs.y = clamp( maxs.y, 1, FLT_MAX );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_RainParticleClampDebug.GetBool())
|
||||||
|
debugoverlay->AddBoxOverlay( vecOrigin, mins, maxs, vec3_angle, 255, 0, 0, 128, 0.15f );
|
||||||
|
|
||||||
|
maxs += vecOrigin;
|
||||||
|
mins += vecOrigin;
|
||||||
|
|
||||||
|
CalcClosestPointOnAABB( mins, maxs, vPlayerPos, vPlayerPos );
|
||||||
|
CalcClosestPointOnAABB( mins, maxs, vOffsetPos, vOffsetPos );
|
||||||
|
CalcClosestPointOnAABB( mins, maxs, vOffsetPosNear, vOffsetPosNear );
|
||||||
|
CalcClosestPointOnAABB( mins, maxs, vOffsetPosFar, vOffsetPosFar );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void CClient_Precipitation::UpdateParticlePrecip( C_BasePlayer *pPlayer )
|
||||||
|
{
|
||||||
|
if ( !pPlayer )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector vForward;
|
||||||
|
Vector vRight;
|
||||||
|
|
||||||
|
pPlayer->GetVectors( &vForward, &vRight, NULL );
|
||||||
|
vForward.z = 0.0f;
|
||||||
|
vForward.NormalizeInPlace();
|
||||||
|
Vector vForward45Right = vForward + vRight;
|
||||||
|
Vector vForward45Left = vForward - vRight;
|
||||||
|
vForward45Right.NormalizeInPlace();
|
||||||
|
vForward45Left.NormalizeInPlace();
|
||||||
|
fltx4 TMax = ReplicateX4( 320.0f );
|
||||||
|
SubFloat( TMax, 3 ) = FLT_MAX;
|
||||||
|
float curTime = gpGlobals->frametime;
|
||||||
|
|
||||||
|
while ( m_tParticlePrecipTraceTimer.NextEvent( curTime ) )
|
||||||
|
{
|
||||||
|
Vector vPlayerPos = pPlayer->EyePosition();
|
||||||
|
Vector vOffsetPos = vPlayerPos + Vector ( 0, 0, 180 );
|
||||||
|
Vector vOffsetPosNear = vPlayerPos + Vector ( 0, 0, 180 ) + ( vForward * 32 );
|
||||||
|
Vector vOffsetPosFar = vPlayerPos + Vector ( 0, 0, 180 ) + ( vForward * 100 );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_spawnflags & SF_PRECIP_PARTICLE_CLAMP)
|
||||||
|
{
|
||||||
|
ClampParticlePosition( vPlayerPos, vOffsetPos, vOffsetPosNear, vOffsetPosFar );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Vector vDensity = Vector( r_RainParticleDensity.GetFloat(), 0, 0 ) * m_flDensity;
|
||||||
|
|
||||||
|
// Get the rain volume Ray Tracing Environment. Currently hard coded to 0, should have this lookup
|
||||||
|
RayTracingEnvironment *RtEnv = g_RayTraceEnvironments.Element( 0 );
|
||||||
|
|
||||||
|
// Our 4 Rays are forward, off to the left and right, and directly up.
|
||||||
|
// Use the first three to determine if there's generally visible rain where we're looking.
|
||||||
|
// The forth, straight up, tells us if we're standing inside a rain volume
|
||||||
|
// (based on the normal that we hit or if we miss entirely)
|
||||||
|
FourRays frRays;
|
||||||
|
FourVectors fvDirection;
|
||||||
|
fvDirection = FourVectors( vForward, vForward45Left, vForward45Right, Vector( 0, 0, 1 ) );
|
||||||
|
frRays.direction = fvDirection;
|
||||||
|
frRays.origin.DuplicateVector( vPlayerPos );
|
||||||
|
RayTracingResult Result;
|
||||||
|
|
||||||
|
RtEnv->Trace4Rays( frRays, Four_Zeros, TMax, &Result );
|
||||||
|
|
||||||
|
i32x4 in4HitIds = LoadAlignedIntSIMD( Result.HitIds );
|
||||||
|
fltx4 fl4HitIds = SignedIntConvertToFltSIMD ( in4HitIds );
|
||||||
|
|
||||||
|
fltx4 fl4Tolerance = ReplicateX4( 300.0f );
|
||||||
|
// ignore upwards test for tolerance, as we may be below an area which is raining, but with it not visible in front of us
|
||||||
|
//SubFloat( fl4Tolerance, 3 ) = 0.0f;
|
||||||
|
|
||||||
|
bool bInside = ( Result.HitIds[3] != -1 && Result.surface_normal.Vec( 3 ).z < 0.0f );
|
||||||
|
bool bNearby = ( IsAnyNegative ( CmpGeSIMD ( fl4HitIds, Four_Zeros ) ) && IsAnyNegative( CmpGeSIMD( fl4Tolerance, Result.HitDistance ) ) );
|
||||||
|
|
||||||
|
if ( bInside || bNearby )
|
||||||
|
{
|
||||||
|
//We can see a rain volume, but it's farther than 180 units away, only use far effect.
|
||||||
|
if ( !bInside && SubFloat( FindLowestSIMD3( Result.HitDistance ), 0 ) >= m_flParticleInnerDist )
|
||||||
|
{
|
||||||
|
// Kill the inner rain if it's previously been in use
|
||||||
|
if ( m_pParticlePrecipInnerNear != NULL )
|
||||||
|
{
|
||||||
|
DestroyInnerParticlePrecip();
|
||||||
|
}
|
||||||
|
// Update if we've already got systems, otherwise, create them.
|
||||||
|
if ( m_pParticlePrecipOuter != NULL )
|
||||||
|
{
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 1, vOffsetPos );
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 3, vDensity );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DispatchOuterParticlePrecip( pPlayer, vForward );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else //We're close enough to use the near effect.
|
||||||
|
{
|
||||||
|
// Update if we've already got systems, otherwise, create them.
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// The outer can now be suppressed without interfering with other functionality
|
||||||
|
if ( m_pParticlePrecipOuter != NULL )
|
||||||
|
{
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 1, vOffsetPos );
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 3, vDensity );
|
||||||
|
}
|
||||||
|
if ( m_pParticlePrecipInnerNear != NULL && m_pParticlePrecipInnerFar != NULL )
|
||||||
|
{
|
||||||
|
m_pParticlePrecipInnerNear->SetControlPoint( 1, vOffsetPosNear );
|
||||||
|
m_pParticlePrecipInnerFar->SetControlPoint( 1, vOffsetPosFar );
|
||||||
|
m_pParticlePrecipInnerNear->SetControlPoint( 3, vDensity );
|
||||||
|
m_pParticlePrecipInnerFar->SetControlPoint( 3, vDensity );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if ( m_pParticlePrecipInnerNear != NULL && m_pParticlePrecipInnerFar != NULL && m_pParticlePrecipOuter != NULL )
|
||||||
|
{
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 1, vOffsetPos );
|
||||||
|
m_pParticlePrecipInnerNear->SetControlPoint( 1, vOffsetPosNear );
|
||||||
|
m_pParticlePrecipInnerFar->SetControlPoint( 1, vOffsetPosFar );
|
||||||
|
m_pParticlePrecipInnerNear->SetControlPoint( 3, vDensity );
|
||||||
|
m_pParticlePrecipInnerFar->SetControlPoint( 3, vDensity );
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 3, vDensity );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DispatchInnerParticlePrecip( pPlayer, vForward );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // No rain in the area, kill any leftover systems.
|
||||||
|
{
|
||||||
|
DestroyInnerParticlePrecip();
|
||||||
|
DestroyOuterParticlePrecip();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClient_Precipitation::InitializeParticlePrecip( void )
|
||||||
|
{
|
||||||
|
//Set up which type of precipitation particle we'll use
|
||||||
|
if ( m_nPrecipType == PRECIPITATION_TYPE_PARTICLEASH )
|
||||||
|
{
|
||||||
|
m_pParticleInnerNearDef = "ash";
|
||||||
|
m_pParticleInnerFarDef = "ash";
|
||||||
|
m_pParticleOuterDef = "ash_outer";
|
||||||
|
m_flParticleInnerDist = 280.0;
|
||||||
|
}
|
||||||
|
else if ( m_nPrecipType == PRECIPITATION_TYPE_PARTICLESNOW )
|
||||||
|
{
|
||||||
|
m_pParticleInnerNearDef = "snow";
|
||||||
|
m_pParticleInnerFarDef = "snow";
|
||||||
|
m_pParticleOuterDef = "snow_outer";
|
||||||
|
m_flParticleInnerDist = 280.0;
|
||||||
|
}
|
||||||
|
else if ( m_nPrecipType == PRECIPITATION_TYPE_PARTICLERAINSTORM )
|
||||||
|
{
|
||||||
|
m_pParticleInnerNearDef = "rain_storm";
|
||||||
|
m_pParticleInnerFarDef = "rain_storm_screen";
|
||||||
|
m_pParticleOuterDef = "rain_storm_outer";
|
||||||
|
m_flParticleInnerDist = 0.0;
|
||||||
|
}
|
||||||
|
else //default to rain
|
||||||
|
{
|
||||||
|
m_pParticleInnerNearDef = "rain";
|
||||||
|
m_pParticleInnerFarDef = "rain";
|
||||||
|
m_pParticleOuterDef = "rain_outer";
|
||||||
|
m_flParticleInnerDist = 180.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert( m_pParticleInnerFarDef != NULL );
|
||||||
|
|
||||||
|
//We'll want to change this if/when we add more raytrace environments.
|
||||||
|
g_RayTraceEnvironments.PurgeAndDeleteElements();
|
||||||
|
|
||||||
|
// Sets up ray tracing environments for all func_precipitations and func_precipitation_blockers
|
||||||
|
RayTracingEnvironment *rtEnvRainEmission = new RayTracingEnvironment();
|
||||||
|
g_RayTraceEnvironments.AddToTail( rtEnvRainEmission );
|
||||||
|
RayTracingEnvironment *rtEnvRainBlocker = new RayTracingEnvironment();
|
||||||
|
g_RayTraceEnvironments.AddToTail( rtEnvRainBlocker );
|
||||||
|
|
||||||
|
rtEnvRainEmission->Flags |= RTE_FLAGS_DONT_STORE_TRIANGLE_COLORS; // save some ram
|
||||||
|
rtEnvRainBlocker->Flags |= RTE_FLAGS_DONT_STORE_TRIANGLE_COLORS; // save some ram
|
||||||
|
|
||||||
|
int nTriCount = 1;
|
||||||
|
for ( int i=0; i<g_Precipitations.Count(); ++i )
|
||||||
|
{
|
||||||
|
CClient_Precipitation *volume = g_Precipitations[i];
|
||||||
|
|
||||||
|
vcollide_t *pCollide = modelinfo->GetVCollide( volume->GetModelIndex() );
|
||||||
|
|
||||||
|
if ( !pCollide || pCollide->solidCount <= 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Vector *outVerts;
|
||||||
|
int vertCount = physcollision->CreateDebugMesh( pCollide->solids[0], &outVerts );
|
||||||
|
|
||||||
|
if ( vertCount )
|
||||||
|
{
|
||||||
|
for ( int j = 0; j < vertCount; j += 3 )
|
||||||
|
{
|
||||||
|
rtEnvRainEmission->AddTriangle( nTriCount++, outVerts[j], outVerts[j + 1], outVerts[j + 2], Vector( 1, 1, 1 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
physcollision->DestroyDebugMesh( vertCount, outVerts );
|
||||||
|
}
|
||||||
|
rtEnvRainEmission->SetupAccelerationStructure();
|
||||||
|
|
||||||
|
m_bParticlePrecipInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClient_Precipitation::DestroyInnerParticlePrecip( void )
|
||||||
|
{
|
||||||
|
if ( m_pParticlePrecipInnerFar != NULL )
|
||||||
|
{
|
||||||
|
m_pParticlePrecipInnerFar->StopEmission();
|
||||||
|
m_pParticlePrecipInnerFar = NULL;
|
||||||
|
}
|
||||||
|
if ( m_pParticlePrecipInnerNear != NULL )
|
||||||
|
{
|
||||||
|
m_pParticlePrecipInnerNear->StopEmission();
|
||||||
|
m_pParticlePrecipInnerNear = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClient_Precipitation::DestroyOuterParticlePrecip( void )
|
||||||
|
{
|
||||||
|
if ( m_pParticlePrecipOuter != NULL )
|
||||||
|
{
|
||||||
|
m_pParticlePrecipOuter->StopEmission();
|
||||||
|
m_pParticlePrecipOuter = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClient_Precipitation::DispatchOuterParticlePrecip( C_BasePlayer *pPlayer, Vector vForward )
|
||||||
|
{
|
||||||
|
DestroyOuterParticlePrecip();
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_spawnflags & SF_PRECIP_PARTICLE_NO_OUTER)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Vector vDensity = Vector( r_RainParticleDensity.GetFloat(), 0, 0 ) * m_flDensity;
|
||||||
|
Vector vPlayerPos = pPlayer->EyePosition();
|
||||||
|
|
||||||
|
m_pParticlePrecipOuter = ParticleProp()->Create( m_pParticleOuterDef, PATTACH_ABSORIGIN_FOLLOW );
|
||||||
|
m_pParticlePrecipOuter->SetControlPointEntity( 2, pPlayer );
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 1, vPlayerPos + Vector (0, 0, 180 ) );
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 3, vDensity );
|
||||||
|
}
|
||||||
|
|
||||||
|
void CClient_Precipitation::DispatchInnerParticlePrecip( C_BasePlayer *pPlayer, Vector vForward )
|
||||||
|
{
|
||||||
|
DestroyInnerParticlePrecip();
|
||||||
|
DestroyOuterParticlePrecip();
|
||||||
|
Vector vPlayerPos = pPlayer->EyePosition();
|
||||||
|
Vector vOffsetPos = vPlayerPos + Vector ( 0, 0, 180 );
|
||||||
|
Vector vOffsetPosNear = vPlayerPos + Vector ( 0, 0, 180 ) + ( vForward * 32 );
|
||||||
|
Vector vOffsetPosFar = vPlayerPos + Vector ( 0, 0, 180 ) + ( vForward * m_flParticleInnerDist ); // 100.0
|
||||||
|
Vector vDensity = Vector( r_RainParticleDensity.GetFloat(), 0, 0 ) * m_flDensity;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_spawnflags & SF_PRECIP_PARTICLE_CLAMP)
|
||||||
|
{
|
||||||
|
ClampParticlePosition( vPlayerPos, vOffsetPos, vOffsetPosNear, vOffsetPosFar );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (!(m_spawnflags & SF_PRECIP_PARTICLE_NO_OUTER))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
m_pParticlePrecipOuter = ParticleProp()->Create( m_pParticleOuterDef, PATTACH_ABSORIGIN_FOLLOW );
|
||||||
|
m_pParticlePrecipOuter->SetControlPointEntity( 2, pPlayer );
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 1, vOffsetPos );
|
||||||
|
m_pParticlePrecipOuter->SetControlPoint( 3, vDensity );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_pParticlePrecipInnerNear = ParticleProp()->Create( m_pParticleInnerNearDef, PATTACH_ABSORIGIN_FOLLOW );
|
||||||
|
m_pParticlePrecipInnerFar = ParticleProp()->Create( m_pParticleInnerFarDef, PATTACH_ABSORIGIN_FOLLOW );
|
||||||
|
m_pParticlePrecipInnerNear->SetControlPointEntity( 2, pPlayer );
|
||||||
|
m_pParticlePrecipInnerFar->SetControlPointEntity( 2, pPlayer );
|
||||||
|
m_pParticlePrecipInnerNear->SetControlPoint( 1, vOffsetPosNear );
|
||||||
|
m_pParticlePrecipInnerFar->SetControlPoint( 1, vOffsetPosFar );
|
||||||
|
m_pParticlePrecipInnerNear->SetControlPoint( 3, vDensity );
|
||||||
|
m_pParticlePrecipInnerFar->SetControlPoint( 3, vDensity );
|
||||||
|
}
|
||||||
|
|
||||||
void CClient_Precipitation::CreateRainOrSnowParticle( Vector vSpawnPosition, Vector vVelocity )
|
void CClient_Precipitation::CreateRainOrSnowParticle( Vector vSpawnPosition, Vector vVelocity )
|
||||||
{
|
{
|
||||||
// Create the particle
|
// Create the particle
|
||||||
@ -1206,6 +1488,12 @@ BEGIN_RECV_TABLE_NOBASE(CEnvWindShared, DT_EnvWindShared)
|
|||||||
RecvPropFloat (RECVINFO(m_flStartTime)),
|
RecvPropFloat (RECVINFO(m_flStartTime)),
|
||||||
RecvPropFloat (RECVINFO(m_flGustDuration)),
|
RecvPropFloat (RECVINFO(m_flGustDuration)),
|
||||||
// RecvPropInt (RECVINFO(m_iszGustSound)),
|
// RecvPropInt (RECVINFO(m_iszGustSound)),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropFloat (RECVINFO(m_windRadius)),
|
||||||
|
RecvPropFloat (RECVINFO(m_windRadiusInner)),
|
||||||
|
RecvPropVector (RECVINFO(m_location)),
|
||||||
|
RecvPropFloat (RECVINFO(m_flTreeSwayScale)),
|
||||||
|
#endif
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_CLIENTCLASS_DT( C_EnvWind, DT_EnvWind, CEnvWind )
|
IMPLEMENT_CLIENTCLASS_DT( C_EnvWind, DT_EnvWind, CEnvWind )
|
||||||
@ -1540,8 +1828,12 @@ public:
|
|||||||
|
|
||||||
pParticle->m_vecVelocity *= flSpeed;
|
pParticle->m_vecVelocity *= flSpeed;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
Vector vecWindVelocity = GetWindspeedAtLocation( pParticle->m_Pos );
|
||||||
|
#else
|
||||||
Vector vecWindVelocity;
|
Vector vecWindVelocity;
|
||||||
GetWindspeedAtTime( gpGlobals->curtime, vecWindVelocity );
|
GetWindspeedAtTime( gpGlobals->curtime, vecWindVelocity );
|
||||||
|
#endif
|
||||||
pParticle->m_vecVelocity += ( vecWindVelocity * r_SnowWindScale.GetFloat() );
|
pParticle->m_vecVelocity += ( vecWindVelocity * r_SnowWindScale.GetFloat() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,9 +10,182 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "cbase.h"
|
||||||
|
#include "precipitation_shared.h"
|
||||||
|
|
||||||
// Draw rain effects.
|
// Draw rain effects.
|
||||||
void DrawPrecipitation();
|
void DrawPrecipitation();
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Precipitation particle type
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class CPrecipitationParticle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Vector m_Pos;
|
||||||
|
Vector m_Velocity;
|
||||||
|
float m_SpawnTime; // Note: Tweak with this to change lifetime
|
||||||
|
float m_Mass;
|
||||||
|
float m_Ramp;
|
||||||
|
|
||||||
|
float m_flCurLifetime;
|
||||||
|
float m_flMaxLifetime;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CClient_Precipitation;
|
||||||
|
static CUtlVector<CClient_Precipitation*> g_Precipitations;
|
||||||
|
|
||||||
|
//===========
|
||||||
|
// Snow fall
|
||||||
|
//===========
|
||||||
|
class CSnowFallManager;
|
||||||
|
static CSnowFallManager *s_pSnowFallMgr = NULL;
|
||||||
|
bool SnowFallManagerCreate( CClient_Precipitation *pSnowEntity );
|
||||||
|
void SnowFallManagerDestroy( void );
|
||||||
|
|
||||||
|
class AshDebrisEffect : public CSimpleEmitter
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AshDebrisEffect( const char *pDebugName ) : CSimpleEmitter( pDebugName ) {}
|
||||||
|
|
||||||
|
static AshDebrisEffect* Create( const char *pDebugName );
|
||||||
|
|
||||||
|
virtual float UpdateAlpha( const SimpleParticle *pParticle );
|
||||||
|
virtual float UpdateRoll( SimpleParticle *pParticle, float timeDelta );
|
||||||
|
|
||||||
|
private:
|
||||||
|
AshDebrisEffect( const AshDebrisEffect & );
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Precipitation base entity
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class CClient_Precipitation : public C_BaseEntity
|
||||||
|
{
|
||||||
|
class CPrecipitationEffect;
|
||||||
|
friend class CClient_Precipitation::CPrecipitationEffect;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS( CClient_Precipitation, C_BaseEntity );
|
||||||
|
DECLARE_CLIENTCLASS();
|
||||||
|
|
||||||
|
CClient_Precipitation();
|
||||||
|
virtual ~CClient_Precipitation();
|
||||||
|
|
||||||
|
// Inherited from C_BaseEntity
|
||||||
|
virtual void Precache( );
|
||||||
|
|
||||||
|
void Render();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Creates a single particle
|
||||||
|
CPrecipitationParticle* CreateParticle();
|
||||||
|
|
||||||
|
virtual void OnDataChanged( DataUpdateType_t updateType );
|
||||||
|
virtual void ClientThink();
|
||||||
|
|
||||||
|
void Simulate( float dt );
|
||||||
|
|
||||||
|
// Renders the particle
|
||||||
|
void RenderParticle( CPrecipitationParticle* pParticle, CMeshBuilder &mb );
|
||||||
|
|
||||||
|
void CreateWaterSplashes();
|
||||||
|
|
||||||
|
// Emits the actual particles
|
||||||
|
void EmitParticles( float fTimeDelta );
|
||||||
|
|
||||||
|
// Computes where we're gonna emit
|
||||||
|
bool ComputeEmissionArea( Vector& origin, Vector2D& size );
|
||||||
|
|
||||||
|
// Gets the tracer width and speed
|
||||||
|
float GetWidth() const;
|
||||||
|
float GetLength() const;
|
||||||
|
float GetSpeed() const;
|
||||||
|
|
||||||
|
// Gets the remaining lifetime of the particle
|
||||||
|
float GetRemainingLifetime( CPrecipitationParticle* pParticle ) const;
|
||||||
|
|
||||||
|
// Computes the wind vector
|
||||||
|
static void ComputeWindVector( );
|
||||||
|
|
||||||
|
// simulation methods
|
||||||
|
bool SimulateRain( CPrecipitationParticle* pParticle, float dt );
|
||||||
|
bool SimulateSnow( CPrecipitationParticle* pParticle, float dt );
|
||||||
|
|
||||||
|
void PrecacheParticlePrecip( void );
|
||||||
|
void CreateParticlePrecip( void );
|
||||||
|
void InitializeParticlePrecip( void );
|
||||||
|
void DispatchOuterParticlePrecip( C_BasePlayer *pPlayer, Vector vForward );
|
||||||
|
void DispatchInnerParticlePrecip( C_BasePlayer *pPlayer, Vector vForward );
|
||||||
|
void DestroyOuterParticlePrecip( void );
|
||||||
|
void DestroyInnerParticlePrecip( void );
|
||||||
|
|
||||||
|
void UpdateParticlePrecip( C_BasePlayer *pPlayer );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void CreateAshParticle( void );
|
||||||
|
void CreateRainOrSnowParticle( Vector vSpawnPosition, Vector vVelocity );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
void ClampParticlePosition( Vector &vPlayerPos, Vector &vOffsetPos, Vector &vOffsetPosNear, Vector &vOffsetPosFar );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Information helpful in creating and rendering particles
|
||||||
|
IMaterial *m_MatHandle; // material used
|
||||||
|
|
||||||
|
float m_Color[4]; // precip color
|
||||||
|
float m_Lifetime; // Precip lifetime
|
||||||
|
float m_InitialRamp; // Initial ramp value
|
||||||
|
float m_Speed; // Precip speed
|
||||||
|
float m_Width; // Tracer width
|
||||||
|
float m_Remainder; // particles we should render next time
|
||||||
|
PrecipitationType_t m_nPrecipType; // Precip type
|
||||||
|
float m_flHalfScreenWidth; // Precalculated each frame.
|
||||||
|
|
||||||
|
float m_flDensity;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
int m_spawnflags;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Some state used in rendering and simulation
|
||||||
|
// Used to modify the rain density and wind from the console
|
||||||
|
static ConVar s_raindensity;
|
||||||
|
static ConVar s_rainwidth;
|
||||||
|
static ConVar s_rainlength;
|
||||||
|
static ConVar s_rainspeed;
|
||||||
|
|
||||||
|
static Vector s_WindVector; // Stores the wind speed vector
|
||||||
|
|
||||||
|
CUtlLinkedList<CPrecipitationParticle> m_Particles;
|
||||||
|
CUtlVector<Vector> m_Splashes;
|
||||||
|
|
||||||
|
CSmartPtr<AshDebrisEffect> m_pAshEmitter;
|
||||||
|
TimedEvent m_tAshParticleTimer;
|
||||||
|
TimedEvent m_tAshParticleTraceTimer;
|
||||||
|
bool m_bActiveAshEmitter;
|
||||||
|
Vector m_vAshSpawnOrigin;
|
||||||
|
|
||||||
|
int m_iAshCount;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
float m_flParticleInnerDist; //The distance at which to start drawing the inner system
|
||||||
|
char *m_pParticleInnerNearDef; //Name of the first inner system
|
||||||
|
char *m_pParticleInnerFarDef; //Name of the second inner system
|
||||||
|
char *m_pParticleOuterDef; //Name of the outer system
|
||||||
|
HPARTICLEFFECT m_pParticlePrecipInnerNear;
|
||||||
|
HPARTICLEFFECT m_pParticlePrecipInnerFar;
|
||||||
|
HPARTICLEFFECT m_pParticlePrecipOuter;
|
||||||
|
TimedEvent m_tParticlePrecipTraceTimer;
|
||||||
|
bool m_bActiveParticlePrecipEmitter;
|
||||||
|
bool m_bParticlePrecipInitialized;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CClient_Precipitation( const CClient_Precipitation & ); // not defined, not accessible
|
||||||
|
};
|
||||||
|
|
||||||
#endif // C_EFFECTS_H
|
#endif // C_EFFECTS_H
|
||||||
|
88
sp/src/game/client/c_env_dof_controller.cpp
Normal file
88
sp/src/game/client/c_env_dof_controller.cpp
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
|
||||||
|
//
|
||||||
|
// Purpose: Depth of field controller entity
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
|
||||||
|
#include "cbase.h"
|
||||||
|
|
||||||
|
// NOTE: This has to be the last file included!
|
||||||
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern bool g_bDOFEnabled;
|
||||||
|
extern float g_flDOFNearBlurDepth;
|
||||||
|
extern float g_flDOFNearFocusDepth;
|
||||||
|
extern float g_flDOFFarFocusDepth;
|
||||||
|
extern float g_flDOFFarBlurDepth;
|
||||||
|
extern float g_flDOFNearBlurRadius;
|
||||||
|
extern float g_flDOFFarBlurRadius;
|
||||||
|
|
||||||
|
EHANDLE g_hDOFControllerInUse = NULL;
|
||||||
|
|
||||||
|
class C_EnvDOFController : public C_BaseEntity
|
||||||
|
{
|
||||||
|
DECLARE_CLASS( C_EnvDOFController, C_BaseEntity );
|
||||||
|
public:
|
||||||
|
DECLARE_CLIENTCLASS();
|
||||||
|
|
||||||
|
C_EnvDOFController();
|
||||||
|
~C_EnvDOFController();
|
||||||
|
virtual void OnDataChanged( DataUpdateType_t updateType );
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_bDOFEnabled;
|
||||||
|
float m_flNearBlurDepth;
|
||||||
|
float m_flNearFocusDepth;
|
||||||
|
float m_flFarFocusDepth;
|
||||||
|
float m_flFarBlurDepth;
|
||||||
|
float m_flNearBlurRadius;
|
||||||
|
float m_flFarBlurRadius;
|
||||||
|
|
||||||
|
private:
|
||||||
|
C_EnvDOFController( const C_EnvDOFController & );
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_CLIENTCLASS_DT( C_EnvDOFController, DT_EnvDOFController, CEnvDOFController )
|
||||||
|
RecvPropInt( RECVINFO(m_bDOFEnabled) ),
|
||||||
|
RecvPropFloat( RECVINFO(m_flNearBlurDepth) ),
|
||||||
|
RecvPropFloat( RECVINFO(m_flNearFocusDepth) ),
|
||||||
|
RecvPropFloat( RECVINFO(m_flFarFocusDepth) ),
|
||||||
|
RecvPropFloat( RECVINFO(m_flFarBlurDepth) ),
|
||||||
|
RecvPropFloat( RECVINFO(m_flNearBlurRadius) ),
|
||||||
|
RecvPropFloat( RECVINFO(m_flFarBlurRadius) )
|
||||||
|
END_RECV_TABLE()
|
||||||
|
|
||||||
|
C_EnvDOFController::C_EnvDOFController()
|
||||||
|
: m_bDOFEnabled( true ),
|
||||||
|
m_flNearBlurDepth( 20.0f ),
|
||||||
|
m_flNearFocusDepth( 100.0f ),
|
||||||
|
m_flFarFocusDepth( 250.0f ),
|
||||||
|
m_flFarBlurDepth( 1000.0f ),
|
||||||
|
m_flNearBlurRadius( 0.0f ), // no near blur by default
|
||||||
|
m_flFarBlurRadius( 5.0f )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
C_EnvDOFController::~C_EnvDOFController()
|
||||||
|
{
|
||||||
|
if ( g_hDOFControllerInUse == this )
|
||||||
|
{
|
||||||
|
g_bDOFEnabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_EnvDOFController::OnDataChanged( DataUpdateType_t updateType )
|
||||||
|
{
|
||||||
|
BaseClass::OnDataChanged( updateType );
|
||||||
|
|
||||||
|
g_bDOFEnabled = m_bDOFEnabled && ( ( m_flNearBlurRadius > 0.0f ) || ( m_flFarBlurRadius > 0.0f ) );
|
||||||
|
g_flDOFNearBlurDepth = m_flNearBlurDepth;
|
||||||
|
g_flDOFNearFocusDepth = m_flNearFocusDepth;
|
||||||
|
g_flDOFFarFocusDepth = m_flFarFocusDepth;
|
||||||
|
g_flDOFFarBlurDepth = m_flFarBlurDepth;
|
||||||
|
g_flDOFNearBlurRadius = m_flNearBlurRadius;
|
||||||
|
g_flDOFFarBlurRadius = m_flFarBlurRadius;
|
||||||
|
|
||||||
|
g_hDOFControllerInUse = this;
|
||||||
|
}
|
348
sp/src/game/client/c_env_global_light.cpp
Normal file
348
sp/src/game/client/c_env_global_light.cpp
Normal file
@ -0,0 +1,348 @@
|
|||||||
|
//========= Copyright 1996-2005, Valve Corporation, All rights reserved. ============//
|
||||||
|
//
|
||||||
|
// Purpose: Sunlight shadow control entity.
|
||||||
|
//
|
||||||
|
// $NoKeywords: $
|
||||||
|
//=============================================================================//
|
||||||
|
#include "cbase.h"
|
||||||
|
|
||||||
|
#include "c_baseplayer.h"
|
||||||
|
#include "tier0/vprof.h"
|
||||||
|
#ifdef MAPBASE
|
||||||
|
#include "materialsystem/itexture.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern ConVar cl_sunlight_ortho_size;
|
||||||
|
extern ConVar cl_sunlight_depthbias;
|
||||||
|
|
||||||
|
ConVar cl_globallight_freeze( "cl_globallight_freeze", "0" );
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// I imagine these values might've been designed for the ASW view.
|
||||||
|
// You can set these as KV anyway.
|
||||||
|
ConVar cl_globallight_xoffset( "cl_globallight_xoffset", "0" );
|
||||||
|
ConVar cl_globallight_yoffset( "cl_globallight_yoffset", "0" );
|
||||||
|
|
||||||
|
static ConVar cl_globallight_slopescaledepthbias_shadowmap( "cl_globallight_slopescaledepthbias_shadowmap", "16", FCVAR_CHEAT );
|
||||||
|
static ConVar cl_globallight_shadowfiltersize( "cl_globallight_shadowfiltersize", "0.1", FCVAR_CHEAT );
|
||||||
|
static ConVar cl_globallight_depthbias_shadowmap( "cl_globallight_depthbias_shadowmap", "0.00001", FCVAR_CHEAT );
|
||||||
|
static ConVar cl_globallight_depthres( "cl_globallight_depthres", "8192", FCVAR_CHEAT );
|
||||||
|
#else
|
||||||
|
ConVar cl_globallight_xoffset( "cl_globallight_xoffset", "-800" );
|
||||||
|
ConVar cl_globallight_yoffset( "cl_globallight_yoffset", "1600" );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Purpose : Sunlights shadow control entity
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
class C_GlobalLight : public C_BaseEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS( C_GlobalLight, C_BaseEntity );
|
||||||
|
|
||||||
|
DECLARE_CLIENTCLASS();
|
||||||
|
|
||||||
|
virtual ~C_GlobalLight();
|
||||||
|
|
||||||
|
void OnDataChanged( DataUpdateType_t updateType );
|
||||||
|
void Spawn();
|
||||||
|
bool ShouldDraw();
|
||||||
|
|
||||||
|
void ClientThink();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Vector m_shadowDirection;
|
||||||
|
bool m_bEnabled;
|
||||||
|
char m_TextureName[ MAX_PATH ];
|
||||||
|
#ifdef MAPBASE
|
||||||
|
int m_nSpotlightTextureFrame;
|
||||||
|
#endif
|
||||||
|
CTextureReference m_SpotlightTexture;
|
||||||
|
color32 m_LightColor;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float m_flBrightnessScale;
|
||||||
|
float m_flCurrentBrightnessScale;
|
||||||
|
#endif
|
||||||
|
Vector m_CurrentLinearFloatLightColor;
|
||||||
|
float m_flCurrentLinearFloatLightAlpha;
|
||||||
|
float m_flColorTransitionTime;
|
||||||
|
float m_flSunDistance;
|
||||||
|
float m_flFOV;
|
||||||
|
float m_flNearZ;
|
||||||
|
float m_flNorthOffset;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float m_flEastOffset;
|
||||||
|
float m_flForwardOffset;
|
||||||
|
float m_flOrthoSize;
|
||||||
|
#endif
|
||||||
|
bool m_bEnableShadows;
|
||||||
|
bool m_bOldEnableShadows;
|
||||||
|
|
||||||
|
static ClientShadowHandle_t m_LocalFlashlightHandle;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ClientShadowHandle_t C_GlobalLight::m_LocalFlashlightHandle = CLIENTSHADOW_INVALID_HANDLE;
|
||||||
|
|
||||||
|
|
||||||
|
IMPLEMENT_CLIENTCLASS_DT(C_GlobalLight, DT_GlobalLight, CGlobalLight)
|
||||||
|
RecvPropVector(RECVINFO(m_shadowDirection)),
|
||||||
|
RecvPropBool(RECVINFO(m_bEnabled)),
|
||||||
|
RecvPropString(RECVINFO(m_TextureName)),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropInt(RECVINFO(m_nSpotlightTextureFrame)),
|
||||||
|
#endif
|
||||||
|
/*RecvPropInt(RECVINFO(m_LightColor), 0, RecvProxy_Int32ToColor32),*/
|
||||||
|
RecvPropInt(RECVINFO(m_LightColor), 0, RecvProxy_IntToColor32),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropFloat(RECVINFO(m_flBrightnessScale)),
|
||||||
|
#endif
|
||||||
|
RecvPropFloat(RECVINFO(m_flColorTransitionTime)),
|
||||||
|
RecvPropFloat(RECVINFO(m_flSunDistance)),
|
||||||
|
RecvPropFloat(RECVINFO(m_flFOV)),
|
||||||
|
RecvPropFloat(RECVINFO(m_flNearZ)),
|
||||||
|
RecvPropFloat(RECVINFO(m_flNorthOffset)),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropFloat(RECVINFO(m_flEastOffset)),
|
||||||
|
RecvPropFloat(RECVINFO(m_flForwardOffset)),
|
||||||
|
RecvPropFloat(RECVINFO(m_flOrthoSize)),
|
||||||
|
#endif
|
||||||
|
RecvPropBool(RECVINFO(m_bEnableShadows)),
|
||||||
|
END_RECV_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
C_GlobalLight::~C_GlobalLight()
|
||||||
|
{
|
||||||
|
if ( m_LocalFlashlightHandle != CLIENTSHADOW_INVALID_HANDLE )
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->DestroyFlashlight( m_LocalFlashlightHandle );
|
||||||
|
m_LocalFlashlightHandle = CLIENTSHADOW_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_GlobalLight::OnDataChanged( DataUpdateType_t updateType )
|
||||||
|
{
|
||||||
|
if ( updateType == DATA_UPDATE_CREATED )
|
||||||
|
{
|
||||||
|
m_SpotlightTexture.Init( m_TextureName, TEXTURE_GROUP_OTHER, true );
|
||||||
|
}
|
||||||
|
#ifdef MAPBASE
|
||||||
|
else //if ( updateType == DATA_UPDATE_DATATABLE_CHANGED )
|
||||||
|
{
|
||||||
|
// It could've been changed via input
|
||||||
|
if( !FStrEq(m_SpotlightTexture->GetName(), m_TextureName) )
|
||||||
|
{
|
||||||
|
m_SpotlightTexture.Init( m_TextureName, TEXTURE_GROUP_OTHER, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BaseClass::OnDataChanged( updateType );
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_GlobalLight::Spawn()
|
||||||
|
{
|
||||||
|
BaseClass::Spawn();
|
||||||
|
|
||||||
|
m_bOldEnableShadows = m_bEnableShadows;
|
||||||
|
|
||||||
|
SetNextClientThink( CLIENT_THINK_ALWAYS );
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// We don't draw...
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
bool C_GlobalLight::ShouldDraw()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_GlobalLight::ClientThink()
|
||||||
|
{
|
||||||
|
VPROF("C_GlobalLight::ClientThink");
|
||||||
|
|
||||||
|
bool bSupressWorldLights = false;
|
||||||
|
|
||||||
|
if ( cl_globallight_freeze.GetBool() == true )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_bEnabled )
|
||||||
|
{
|
||||||
|
Vector vLinearFloatLightColor( m_LightColor.r, m_LightColor.g, m_LightColor.b );
|
||||||
|
float flLinearFloatLightAlpha = m_LightColor.a;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( m_CurrentLinearFloatLightColor != vLinearFloatLightColor || m_flCurrentLinearFloatLightAlpha != flLinearFloatLightAlpha || m_flCurrentBrightnessScale != m_flBrightnessScale )
|
||||||
|
{
|
||||||
|
if (m_flColorTransitionTime != 0.0f)
|
||||||
|
{
|
||||||
|
float flColorTransitionSpeed = gpGlobals->frametime * m_flColorTransitionTime * 255.0f;
|
||||||
|
|
||||||
|
m_CurrentLinearFloatLightColor.x = Approach( vLinearFloatLightColor.x, m_CurrentLinearFloatLightColor.x, flColorTransitionSpeed );
|
||||||
|
m_CurrentLinearFloatLightColor.y = Approach( vLinearFloatLightColor.y, m_CurrentLinearFloatLightColor.y, flColorTransitionSpeed );
|
||||||
|
m_CurrentLinearFloatLightColor.z = Approach( vLinearFloatLightColor.z, m_CurrentLinearFloatLightColor.z, flColorTransitionSpeed );
|
||||||
|
m_flCurrentLinearFloatLightAlpha = Approach( flLinearFloatLightAlpha, m_flCurrentLinearFloatLightAlpha, flColorTransitionSpeed );
|
||||||
|
m_flCurrentBrightnessScale = Approach( m_flBrightnessScale, m_flCurrentBrightnessScale, flColorTransitionSpeed );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Just do it instantly
|
||||||
|
m_CurrentLinearFloatLightColor.x = vLinearFloatLightColor.x;
|
||||||
|
m_CurrentLinearFloatLightColor.y = vLinearFloatLightColor.y;
|
||||||
|
m_CurrentLinearFloatLightColor.z = vLinearFloatLightColor.z;
|
||||||
|
m_flCurrentLinearFloatLightAlpha = flLinearFloatLightAlpha;
|
||||||
|
m_flCurrentBrightnessScale = m_flBrightnessScale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if ( m_CurrentLinearFloatLightColor != vLinearFloatLightColor || m_flCurrentLinearFloatLightAlpha != flLinearFloatLightAlpha )
|
||||||
|
{
|
||||||
|
float flColorTransitionSpeed = gpGlobals->frametime * m_flColorTransitionTime * 255.0f;
|
||||||
|
|
||||||
|
m_CurrentLinearFloatLightColor.x = Approach( vLinearFloatLightColor.x, m_CurrentLinearFloatLightColor.x, flColorTransitionSpeed );
|
||||||
|
m_CurrentLinearFloatLightColor.y = Approach( vLinearFloatLightColor.y, m_CurrentLinearFloatLightColor.y, flColorTransitionSpeed );
|
||||||
|
m_CurrentLinearFloatLightColor.z = Approach( vLinearFloatLightColor.z, m_CurrentLinearFloatLightColor.z, flColorTransitionSpeed );
|
||||||
|
m_flCurrentLinearFloatLightAlpha = Approach( flLinearFloatLightAlpha, m_flCurrentLinearFloatLightAlpha, flColorTransitionSpeed );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FlashlightState_t state;
|
||||||
|
|
||||||
|
Vector vDirection = m_shadowDirection;
|
||||||
|
VectorNormalize( vDirection );
|
||||||
|
|
||||||
|
//Vector vViewUp = Vector( 0.0f, 1.0f, 0.0f );
|
||||||
|
Vector vSunDirection2D = vDirection;
|
||||||
|
vSunDirection2D.z = 0.0f;
|
||||||
|
|
||||||
|
/*HACK_GETLOCALPLAYER_GUARD( "C_GlobalLight::ClientThink" );*/
|
||||||
|
|
||||||
|
if ( !C_BasePlayer::GetLocalPlayer() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector vPos;
|
||||||
|
QAngle EyeAngles;
|
||||||
|
float flZNear, flZFar, flFov;
|
||||||
|
|
||||||
|
C_BasePlayer::GetLocalPlayer()->CalcView( vPos, EyeAngles, flZNear, flZFar, flFov );
|
||||||
|
// Vector vPos = C_BasePlayer::GetLocalPlayer()->GetAbsOrigin();
|
||||||
|
|
||||||
|
// vPos = Vector( 0.0f, 0.0f, 500.0f );
|
||||||
|
vPos = ( vPos + vSunDirection2D * m_flNorthOffset ) - vDirection * m_flSunDistance;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
vPos += Vector( m_flEastOffset + cl_globallight_xoffset.GetFloat(), m_flForwardOffset + cl_globallight_yoffset.GetFloat(), 0.0f );
|
||||||
|
#else
|
||||||
|
vPos += Vector( cl_globallight_xoffset.GetFloat(), cl_globallight_yoffset.GetFloat(), 0.0f );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QAngle angAngles;
|
||||||
|
VectorAngles( vDirection, angAngles );
|
||||||
|
|
||||||
|
Vector vForward, vRight, vUp;
|
||||||
|
AngleVectors( angAngles, &vForward, &vRight, &vUp );
|
||||||
|
|
||||||
|
state.m_fHorizontalFOVDegrees = m_flFOV;
|
||||||
|
state.m_fVerticalFOVDegrees = m_flFOV;
|
||||||
|
|
||||||
|
state.m_vecLightOrigin = vPos;
|
||||||
|
BasisToQuaternion( vForward, vRight, vUp, state.m_quatOrientation );
|
||||||
|
|
||||||
|
state.m_fQuadraticAtten = 0.0f;
|
||||||
|
state.m_fLinearAtten = m_flSunDistance * 2.0f;
|
||||||
|
state.m_fConstantAtten = 0.0f;
|
||||||
|
state.m_FarZAtten = m_flSunDistance * 2.0f;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float flAlpha = m_flCurrentLinearFloatLightAlpha * (1.0f / 255.0f);
|
||||||
|
state.m_Color[0] = (m_CurrentLinearFloatLightColor.x * ( 1.0f / 255.0f ) * flAlpha) * m_flCurrentBrightnessScale;
|
||||||
|
state.m_Color[1] = (m_CurrentLinearFloatLightColor.y * ( 1.0f / 255.0f ) * flAlpha) * m_flCurrentBrightnessScale;
|
||||||
|
state.m_Color[2] = (m_CurrentLinearFloatLightColor.z * ( 1.0f / 255.0f ) * flAlpha) * m_flCurrentBrightnessScale;
|
||||||
|
#else
|
||||||
|
state.m_Color[0] = m_CurrentLinearFloatLightColor.x * ( 1.0f / 255.0f ) * m_flCurrentLinearFloatLightAlpha;
|
||||||
|
state.m_Color[1] = m_CurrentLinearFloatLightColor.y * ( 1.0f / 255.0f ) * m_flCurrentLinearFloatLightAlpha;
|
||||||
|
state.m_Color[2] = m_CurrentLinearFloatLightColor.z * ( 1.0f / 255.0f ) * m_flCurrentLinearFloatLightAlpha;
|
||||||
|
#endif
|
||||||
|
state.m_Color[3] = 0.0f; // fixme: need to make ambient work m_flAmbient;
|
||||||
|
state.m_NearZ = 4.0f;
|
||||||
|
state.m_FarZ = m_flSunDistance * 2.0f;
|
||||||
|
state.m_fBrightnessScale = 2.0f;
|
||||||
|
state.m_bGlobalLight = true;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float flOrthoSize = m_flOrthoSize;
|
||||||
|
#else
|
||||||
|
float flOrthoSize = 1000.0f;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( flOrthoSize > 0 )
|
||||||
|
{
|
||||||
|
state.m_bOrtho = true;
|
||||||
|
state.m_fOrthoLeft = -flOrthoSize;
|
||||||
|
state.m_fOrthoTop = -flOrthoSize;
|
||||||
|
state.m_fOrthoRight = flOrthoSize;
|
||||||
|
state.m_fOrthoBottom = flOrthoSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state.m_bOrtho = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
//state.m_bDrawShadowFrustum = true; // Don't draw that huge debug thing
|
||||||
|
state.m_flShadowMapResolution = cl_globallight_depthres.GetFloat();
|
||||||
|
state.m_flShadowFilterSize = cl_globallight_shadowfiltersize.GetFloat();
|
||||||
|
state.m_flShadowSlopeScaleDepthBias = cl_globallight_slopescaledepthbias_shadowmap.GetFloat();
|
||||||
|
state.m_flShadowDepthBias = cl_globallight_depthbias_shadowmap.GetFloat();
|
||||||
|
state.m_bEnableShadows = m_bEnableShadows;
|
||||||
|
state.m_pSpotlightTexture = m_SpotlightTexture;
|
||||||
|
state.m_nSpotlightTextureFrame = m_nSpotlightTextureFrame;
|
||||||
|
#else
|
||||||
|
state.m_bDrawShadowFrustum = true;
|
||||||
|
/*state.m_flShadowSlopeScaleDepthBias = g_pMaterialSystemHardwareConfig->GetShadowSlopeScaleDepthBias();;
|
||||||
|
state.m_flShadowDepthBias = g_pMaterialSystemHardwareConfig->GetShadowDepthBias();*/
|
||||||
|
state.m_bEnableShadows = m_bEnableShadows;
|
||||||
|
state.m_pSpotlightTexture = m_SpotlightTexture;
|
||||||
|
state.m_nSpotlightTextureFrame = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
state.m_nShadowQuality = 1; // Allow entity to affect shadow quality
|
||||||
|
// state.m_bShadowHighRes = true;
|
||||||
|
|
||||||
|
if ( m_bOldEnableShadows != m_bEnableShadows )
|
||||||
|
{
|
||||||
|
// If they change the shadow enable/disable, we need to make a new handle
|
||||||
|
if ( m_LocalFlashlightHandle != CLIENTSHADOW_INVALID_HANDLE )
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->DestroyFlashlight( m_LocalFlashlightHandle );
|
||||||
|
m_LocalFlashlightHandle = CLIENTSHADOW_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bOldEnableShadows = m_bEnableShadows;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_LocalFlashlightHandle == CLIENTSHADOW_INVALID_HANDLE )
|
||||||
|
{
|
||||||
|
m_LocalFlashlightHandle = g_pClientShadowMgr->CreateFlashlight( state );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->UpdateFlashlightState( m_LocalFlashlightHandle, state );
|
||||||
|
g_pClientShadowMgr->UpdateProjectedTexture( m_LocalFlashlightHandle, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
bSupressWorldLights = m_bEnableShadows;
|
||||||
|
}
|
||||||
|
else if ( m_LocalFlashlightHandle != CLIENTSHADOW_INVALID_HANDLE )
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->DestroyFlashlight( m_LocalFlashlightHandle );
|
||||||
|
m_LocalFlashlightHandle = CLIENTSHADOW_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pClientShadowMgr->SetShadowFromWorldLightsEnabled( !bSupressWorldLights );
|
||||||
|
|
||||||
|
BaseClass::ClientThink();
|
||||||
|
}
|
@ -5,6 +5,13 @@
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
#include "cbase.h"
|
#include "cbase.h"
|
||||||
|
#ifdef ASW_PROJECTED_TEXTURES
|
||||||
|
#include "C_Env_Projected_Texture.h"
|
||||||
|
#include "vprof.h"
|
||||||
|
#endif
|
||||||
|
#ifdef MAPBASE
|
||||||
|
#include "materialsystem/itexture.h"
|
||||||
|
#endif
|
||||||
#include "shareddefs.h"
|
#include "shareddefs.h"
|
||||||
#include "materialsystem/imesh.h"
|
#include "materialsystem/imesh.h"
|
||||||
#include "materialsystem/imaterial.h"
|
#include "materialsystem/imaterial.h"
|
||||||
@ -17,8 +24,480 @@
|
|||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
|
#ifdef ASW_PROJECTED_TEXTURES
|
||||||
|
extern ConVarRef mat_slopescaledepthbias_shadowmap;
|
||||||
|
extern ConVarRef mat_depthbias_shadowmap;
|
||||||
|
|
||||||
|
float C_EnvProjectedTexture::m_flVisibleBBoxMinHeight = -FLT_MAX;
|
||||||
|
|
||||||
|
|
||||||
|
IMPLEMENT_CLIENTCLASS_DT( C_EnvProjectedTexture, DT_EnvProjectedTexture, CEnvProjectedTexture )
|
||||||
|
RecvPropEHandle( RECVINFO( m_hTargetEntity ) ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropBool( RECVINFO( m_bDontFollowTarget )),
|
||||||
|
#endif
|
||||||
|
RecvPropBool( RECVINFO( m_bState ) ),
|
||||||
|
RecvPropBool( RECVINFO( m_bAlwaysUpdate ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flLightFOV ) ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropFloat( RECVINFO( m_flLightHorFOV ) ),
|
||||||
|
#endif
|
||||||
|
RecvPropBool( RECVINFO( m_bEnableShadows ) ),
|
||||||
|
RecvPropBool( RECVINFO( m_bLightOnlyTarget ) ),
|
||||||
|
RecvPropBool( RECVINFO( m_bLightWorld ) ),
|
||||||
|
RecvPropBool( RECVINFO( m_bCameraSpace ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flBrightnessScale ) ),
|
||||||
|
RecvPropInt( RECVINFO( m_LightColor ), 0, RecvProxy_IntToColor32 ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flColorTransitionTime ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flAmbient ) ),
|
||||||
|
RecvPropString( RECVINFO( m_SpotlightTextureName ) ),
|
||||||
|
RecvPropInt( RECVINFO( m_nSpotlightTextureFrame ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flNearZ ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flFarZ ) ),
|
||||||
|
RecvPropInt( RECVINFO( m_nShadowQuality ) ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropFloat( RECVINFO( m_flConstantAtten ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flLinearAtten ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flQuadraticAtten ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flShadowAtten ) ),
|
||||||
|
RecvPropFloat( RECVINFO( m_flShadowFilter ) ),
|
||||||
|
RecvPropBool( RECVINFO( m_bAlwaysDraw ) ),
|
||||||
|
|
||||||
|
// Not needed on the client right now, change when it actually is needed
|
||||||
|
//RecvPropBool( RECVINFO( m_bProjectedTextureVersion ) ),
|
||||||
|
#endif
|
||||||
|
END_RECV_TABLE()
|
||||||
|
|
||||||
|
C_EnvProjectedTexture *C_EnvProjectedTexture::Create( )
|
||||||
|
{
|
||||||
|
C_EnvProjectedTexture *pEnt = new C_EnvProjectedTexture();
|
||||||
|
|
||||||
|
pEnt->m_flNearZ = 4.0f;
|
||||||
|
pEnt->m_flFarZ = 2000.0f;
|
||||||
|
// strcpy( pEnt->m_SpotlightTextureName, "particle/rj" );
|
||||||
|
pEnt->m_bLightWorld = true;
|
||||||
|
pEnt->m_bLightOnlyTarget = false;
|
||||||
|
pEnt->m_nShadowQuality = 1;
|
||||||
|
pEnt->m_flLightFOV = 10.0f;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
pEnt->m_flLightHorFOV = 10.0f;
|
||||||
|
#endif
|
||||||
|
pEnt->m_LightColor.r = 255;
|
||||||
|
pEnt->m_LightColor.g = 255;
|
||||||
|
pEnt->m_LightColor.b = 255;
|
||||||
|
pEnt->m_LightColor.a = 255;
|
||||||
|
pEnt->m_bEnableShadows = false;
|
||||||
|
pEnt->m_flColorTransitionTime = 1.0f;
|
||||||
|
pEnt->m_bCameraSpace = false;
|
||||||
|
pEnt->SetAbsAngles( QAngle( 90, 0, 0 ) );
|
||||||
|
pEnt->m_bAlwaysUpdate = true;
|
||||||
|
pEnt->m_bState = true;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
pEnt->m_bAlwaysDraw = false;
|
||||||
|
pEnt->m_flConstantAtten = 0.0f;
|
||||||
|
pEnt->m_flLinearAtten = 100.0f;
|
||||||
|
pEnt->m_flQuadraticAtten = 0.0f;
|
||||||
|
pEnt->m_flShadowAtten = 0.0f;
|
||||||
|
pEnt->m_flShadowFilter = 0.5f;
|
||||||
|
//pEnt->m_bProjectedTextureVersion = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return pEnt;
|
||||||
|
}
|
||||||
|
|
||||||
|
C_EnvProjectedTexture::C_EnvProjectedTexture( void )
|
||||||
|
{
|
||||||
|
m_LightHandle = CLIENTSHADOW_INVALID_HANDLE;
|
||||||
|
m_bForceUpdate = true;
|
||||||
|
#ifndef MAPBASE
|
||||||
|
AddToEntityList( ENTITY_LIST_SIMULATE );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
C_EnvProjectedTexture::~C_EnvProjectedTexture( void )
|
||||||
|
{
|
||||||
|
ShutDownLightHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_EnvProjectedTexture::ShutDownLightHandle( void )
|
||||||
|
{
|
||||||
|
// Clear out the light
|
||||||
|
if( m_LightHandle != CLIENTSHADOW_INVALID_HANDLE )
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->DestroyFlashlight( m_LightHandle );
|
||||||
|
m_LightHandle = CLIENTSHADOW_INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void C_EnvProjectedTexture::SetLightColor( byte r, byte g, byte b, byte a )
|
||||||
|
{
|
||||||
|
m_LightColor.r = r;
|
||||||
|
m_LightColor.g = g;
|
||||||
|
m_LightColor.b = b;
|
||||||
|
m_LightColor.a = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
// Input : updateType -
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void C_EnvProjectedTexture::OnDataChanged( DataUpdateType_t updateType )
|
||||||
|
{
|
||||||
|
if ( updateType == DATA_UPDATE_CREATED )
|
||||||
|
{
|
||||||
|
m_SpotlightTexture.Init( m_SpotlightTextureName, TEXTURE_GROUP_OTHER, true );
|
||||||
|
}
|
||||||
|
#ifdef MAPBASE
|
||||||
|
else //if ( updateType == DATA_UPDATE_DATATABLE_CHANGED )
|
||||||
|
{
|
||||||
|
// It could've been changed via input
|
||||||
|
if( !FStrEq(m_SpotlightTexture->GetName(), m_SpotlightTextureName) )
|
||||||
|
{
|
||||||
|
m_SpotlightTexture.Init( m_SpotlightTextureName, TEXTURE_GROUP_OTHER, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_bForceUpdate = true;
|
||||||
|
UpdateLight();
|
||||||
|
BaseClass::OnDataChanged( updateType );
|
||||||
|
}
|
||||||
|
|
||||||
|
static ConVar asw_perf_wtf("asw_perf_wtf", "0", FCVAR_DEVELOPMENTONLY, "Disable updating of projected shadow textures from UpdateLight" );
|
||||||
|
void C_EnvProjectedTexture::UpdateLight( void )
|
||||||
|
{
|
||||||
|
VPROF("C_EnvProjectedTexture::UpdateLight");
|
||||||
|
bool bVisible = true;
|
||||||
|
|
||||||
|
Vector vLinearFloatLightColor( m_LightColor.r, m_LightColor.g, m_LightColor.b );
|
||||||
|
float flLinearFloatLightAlpha = m_LightColor.a;
|
||||||
|
|
||||||
|
if ( m_bAlwaysUpdate )
|
||||||
|
{
|
||||||
|
m_bForceUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( m_CurrentLinearFloatLightColor != vLinearFloatLightColor || m_flCurrentLinearFloatLightAlpha != flLinearFloatLightAlpha || m_flCurrentBrightnessScale != m_flBrightnessScale )
|
||||||
|
{
|
||||||
|
if (m_flColorTransitionTime != 0.0f)
|
||||||
|
{
|
||||||
|
float flColorTransitionSpeed = gpGlobals->frametime * m_flColorTransitionTime * 255.0f;
|
||||||
|
|
||||||
|
m_CurrentLinearFloatLightColor.x = Approach( vLinearFloatLightColor.x, m_CurrentLinearFloatLightColor.x, flColorTransitionSpeed );
|
||||||
|
m_CurrentLinearFloatLightColor.y = Approach( vLinearFloatLightColor.y, m_CurrentLinearFloatLightColor.y, flColorTransitionSpeed );
|
||||||
|
m_CurrentLinearFloatLightColor.z = Approach( vLinearFloatLightColor.z, m_CurrentLinearFloatLightColor.z, flColorTransitionSpeed );
|
||||||
|
m_flCurrentLinearFloatLightAlpha = Approach( flLinearFloatLightAlpha, m_flCurrentLinearFloatLightAlpha, flColorTransitionSpeed );
|
||||||
|
m_flCurrentBrightnessScale = Approach( m_flBrightnessScale, m_flCurrentBrightnessScale, flColorTransitionSpeed );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Just do it instantly
|
||||||
|
m_CurrentLinearFloatLightColor.x = vLinearFloatLightColor.x;
|
||||||
|
m_CurrentLinearFloatLightColor.y = vLinearFloatLightColor.y;
|
||||||
|
m_CurrentLinearFloatLightColor.z = vLinearFloatLightColor.z;
|
||||||
|
m_flCurrentLinearFloatLightAlpha = flLinearFloatLightAlpha;
|
||||||
|
m_flCurrentBrightnessScale = m_flBrightnessScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bForceUpdate = true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if ( m_CurrentLinearFloatLightColor != vLinearFloatLightColor || m_flCurrentLinearFloatLightAlpha != flLinearFloatLightAlpha )
|
||||||
|
{
|
||||||
|
float flColorTransitionSpeed = gpGlobals->frametime * m_flColorTransitionTime * 255.0f;
|
||||||
|
|
||||||
|
m_CurrentLinearFloatLightColor.x = Approach( vLinearFloatLightColor.x, m_CurrentLinearFloatLightColor.x, flColorTransitionSpeed );
|
||||||
|
m_CurrentLinearFloatLightColor.y = Approach( vLinearFloatLightColor.y, m_CurrentLinearFloatLightColor.y, flColorTransitionSpeed );
|
||||||
|
m_CurrentLinearFloatLightColor.z = Approach( vLinearFloatLightColor.z, m_CurrentLinearFloatLightColor.z, flColorTransitionSpeed );
|
||||||
|
m_flCurrentLinearFloatLightAlpha = Approach( flLinearFloatLightAlpha, m_flCurrentLinearFloatLightAlpha, flColorTransitionSpeed );
|
||||||
|
|
||||||
|
m_bForceUpdate = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( !m_bForceUpdate )
|
||||||
|
{
|
||||||
|
bVisible = IsBBoxVisible();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_bState == false || !bVisible )
|
||||||
|
{
|
||||||
|
// Spotlight's extents aren't in view
|
||||||
|
ShutDownLightHandle();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_LightHandle == CLIENTSHADOW_INVALID_HANDLE || m_hTargetEntity != NULL || m_bForceUpdate )
|
||||||
|
{
|
||||||
|
Vector vForward, vRight, vUp, vPos = GetAbsOrigin();
|
||||||
|
FlashlightState_t state;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( m_hTargetEntity != NULL && !m_bDontFollowTarget )
|
||||||
|
#else
|
||||||
|
if ( m_hTargetEntity != NULL )
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if ( m_bCameraSpace )
|
||||||
|
{
|
||||||
|
const QAngle &angles = GetLocalAngles();
|
||||||
|
|
||||||
|
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||||
|
if( pPlayer )
|
||||||
|
{
|
||||||
|
const QAngle playerAngles = pPlayer->GetAbsAngles();
|
||||||
|
|
||||||
|
Vector vPlayerForward, vPlayerRight, vPlayerUp;
|
||||||
|
AngleVectors( playerAngles, &vPlayerForward, &vPlayerRight, &vPlayerUp );
|
||||||
|
|
||||||
|
matrix3x4_t mRotMatrix;
|
||||||
|
AngleMatrix( angles, mRotMatrix );
|
||||||
|
|
||||||
|
VectorITransform( vPlayerForward, mRotMatrix, vForward );
|
||||||
|
VectorITransform( vPlayerRight, mRotMatrix, vRight );
|
||||||
|
VectorITransform( vPlayerUp, mRotMatrix, vUp );
|
||||||
|
|
||||||
|
float dist = (m_hTargetEntity->GetAbsOrigin() - GetAbsOrigin()).Length();
|
||||||
|
vPos = m_hTargetEntity->GetAbsOrigin() - vForward*dist;
|
||||||
|
|
||||||
|
VectorNormalize( vForward );
|
||||||
|
VectorNormalize( vRight );
|
||||||
|
VectorNormalize( vUp );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vForward = m_hTargetEntity->GetAbsOrigin() - GetAbsOrigin();
|
||||||
|
VectorNormalize( vForward );
|
||||||
|
|
||||||
|
// JasonM - unimplemented
|
||||||
|
Assert (0);
|
||||||
|
|
||||||
|
//Quaternion q = DirectionToOrientation( dir );
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// JasonM - set up vRight, vUp
|
||||||
|
//
|
||||||
|
|
||||||
|
// VectorNormalize( vRight );
|
||||||
|
// VectorNormalize( vUp );
|
||||||
|
|
||||||
|
VectorVectors( vForward, vRight, vUp );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AngleVectors( GetAbsAngles(), &vForward, &vRight, &vUp );
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float fHighFOV;
|
||||||
|
if( m_flLightFOV > m_flLightHorFOV )
|
||||||
|
fHighFOV = m_flLightFOV;
|
||||||
|
else
|
||||||
|
fHighFOV = m_flLightHorFOV;
|
||||||
|
|
||||||
|
state.m_fHorizontalFOVDegrees = m_flLightHorFOV;
|
||||||
|
#else
|
||||||
|
state.m_fHorizontalFOVDegrees = m_flLightFOV;
|
||||||
|
#endif
|
||||||
|
state.m_fVerticalFOVDegrees = m_flLightFOV;
|
||||||
|
|
||||||
|
state.m_vecLightOrigin = vPos;
|
||||||
|
BasisToQuaternion( vForward, vRight, vUp, state.m_quatOrientation );
|
||||||
|
state.m_NearZ = m_flNearZ;
|
||||||
|
state.m_FarZ = m_flFarZ;
|
||||||
|
|
||||||
|
// quickly check the proposed light's bbox against the view frustum to determine whether we
|
||||||
|
// should bother to create it, if it doesn't exist, or cull it, if it does.
|
||||||
|
// get the half-widths of the near and far planes,
|
||||||
|
// based on the FOV which is in degrees. Remember that
|
||||||
|
// on planet Valve, x is forward, y left, and z up.
|
||||||
|
#ifdef MAPBASE
|
||||||
|
const float tanHalfAngle = tan( fHighFOV * ( M_PI/180.0f ) * 0.5f );
|
||||||
|
#else
|
||||||
|
const float tanHalfAngle = tan( m_flLightFOV * ( M_PI/180.0f ) * 0.5f );
|
||||||
|
#endif
|
||||||
|
const float halfWidthNear = tanHalfAngle * m_flNearZ;
|
||||||
|
const float halfWidthFar = tanHalfAngle * m_flFarZ;
|
||||||
|
// now we can build coordinates in local space: the near rectangle is eg
|
||||||
|
// (0, -halfWidthNear, -halfWidthNear), (0, halfWidthNear, -halfWidthNear),
|
||||||
|
// (0, halfWidthNear, halfWidthNear), (0, -halfWidthNear, halfWidthNear)
|
||||||
|
|
||||||
|
VectorAligned vNearRect[4] = {
|
||||||
|
VectorAligned( m_flNearZ, -halfWidthNear, -halfWidthNear), VectorAligned( m_flNearZ, halfWidthNear, -halfWidthNear),
|
||||||
|
VectorAligned( m_flNearZ, halfWidthNear, halfWidthNear), VectorAligned( m_flNearZ, -halfWidthNear, halfWidthNear)
|
||||||
|
};
|
||||||
|
|
||||||
|
VectorAligned vFarRect[4] = {
|
||||||
|
VectorAligned( m_flFarZ, -halfWidthFar, -halfWidthFar), VectorAligned( m_flFarZ, halfWidthFar, -halfWidthFar),
|
||||||
|
VectorAligned( m_flFarZ, halfWidthFar, halfWidthFar), VectorAligned( m_flFarZ, -halfWidthFar, halfWidthFar)
|
||||||
|
};
|
||||||
|
|
||||||
|
matrix3x4_t matOrientation( vForward, -vRight, vUp, vPos );
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
kNEAR = 0,
|
||||||
|
kFAR = 1,
|
||||||
|
};
|
||||||
|
VectorAligned vOutRects[2][4];
|
||||||
|
|
||||||
|
for ( int i = 0 ; i < 4 ; ++i )
|
||||||
|
{
|
||||||
|
VectorTransform( vNearRect[i].Base(), matOrientation, vOutRects[0][i].Base() );
|
||||||
|
}
|
||||||
|
for ( int i = 0 ; i < 4 ; ++i )
|
||||||
|
{
|
||||||
|
VectorTransform( vFarRect[i].Base(), matOrientation, vOutRects[1][i].Base() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// now take the min and max extents for the bbox, and see if it is visible.
|
||||||
|
Vector mins = **vOutRects;
|
||||||
|
Vector maxs = **vOutRects;
|
||||||
|
for ( int i = 1; i < 8 ; ++i )
|
||||||
|
{
|
||||||
|
VectorMin( mins, *(*vOutRects+i), mins );
|
||||||
|
VectorMax( maxs, *(*vOutRects+i), maxs );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0 //for debugging the visibility frustum we just calculated
|
||||||
|
NDebugOverlay::Triangle( vOutRects[0][0], vOutRects[0][1], vOutRects[0][2], 255, 0, 0, 100, true, 0.0f ); //first tri
|
||||||
|
NDebugOverlay::Triangle( vOutRects[0][2], vOutRects[0][1], vOutRects[0][0], 255, 0, 0, 100, true, 0.0f ); //make it double sided
|
||||||
|
NDebugOverlay::Triangle( vOutRects[0][2], vOutRects[0][3], vOutRects[0][0], 255, 0, 0, 100, true, 0.0f ); //second tri
|
||||||
|
NDebugOverlay::Triangle( vOutRects[0][0], vOutRects[0][3], vOutRects[0][2], 255, 0, 0, 100, true, 0.0f ); //make it double sided
|
||||||
|
|
||||||
|
NDebugOverlay::Triangle( vOutRects[1][0], vOutRects[1][1], vOutRects[1][2], 0, 0, 255, 100, true, 0.0f ); //first tri
|
||||||
|
NDebugOverlay::Triangle( vOutRects[1][2], vOutRects[1][1], vOutRects[1][0], 0, 0, 255, 100, true, 0.0f ); //make it double sided
|
||||||
|
NDebugOverlay::Triangle( vOutRects[1][2], vOutRects[1][3], vOutRects[1][0], 0, 0, 255, 100, true, 0.0f ); //second tri
|
||||||
|
NDebugOverlay::Triangle( vOutRects[1][0], vOutRects[1][3], vOutRects[1][2], 0, 0, 255, 100, true, 0.0f ); //make it double sided
|
||||||
|
|
||||||
|
NDebugOverlay::Box( vec3_origin, mins, maxs, 0, 255, 0, 100, 0.0f );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool bVisible = IsBBoxVisible( mins, maxs );
|
||||||
|
if (!bVisible)
|
||||||
|
{
|
||||||
|
// Spotlight's extents aren't in view
|
||||||
|
if ( m_LightHandle != CLIENTSHADOW_INVALID_HANDLE )
|
||||||
|
{
|
||||||
|
ShutDownLightHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float flAlpha = m_flCurrentLinearFloatLightAlpha * ( 1.0f / 255.0f );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
state.m_fConstantAtten = m_flConstantAtten;
|
||||||
|
state.m_fLinearAtten = m_flLinearAtten;
|
||||||
|
state.m_fQuadraticAtten = m_flQuadraticAtten;
|
||||||
|
state.m_FarZAtten = m_flFarZ;
|
||||||
|
state.m_Color[0] = (m_CurrentLinearFloatLightColor.x * ( 1.0f / 255.0f ) * flAlpha) * m_flCurrentBrightnessScale;
|
||||||
|
state.m_Color[1] = (m_CurrentLinearFloatLightColor.y * ( 1.0f / 255.0f ) * flAlpha) * m_flCurrentBrightnessScale;
|
||||||
|
state.m_Color[2] = (m_CurrentLinearFloatLightColor.z * ( 1.0f / 255.0f ) * flAlpha) * m_flCurrentBrightnessScale;
|
||||||
|
state.m_Color[3] = 0.0f; // fixme: need to make ambient work m_flAmbient;
|
||||||
|
state.m_flShadowSlopeScaleDepthBias = mat_slopescaledepthbias_shadowmap.GetFloat();
|
||||||
|
state.m_flShadowDepthBias = mat_depthbias_shadowmap.GetFloat();
|
||||||
|
state.m_flShadowAtten = m_flShadowAtten;
|
||||||
|
state.m_flShadowFilterSize = m_flShadowFilter;
|
||||||
|
#else
|
||||||
|
state.m_fQuadraticAtten = 0.0;
|
||||||
|
state.m_fLinearAtten = 100;
|
||||||
|
state.m_fConstantAtten = 0.0f;
|
||||||
|
state.m_FarZAtten = m_flFarZ;
|
||||||
|
state.m_fBrightnessScale = m_flBrightnessScale;
|
||||||
|
state.m_Color[0] = m_CurrentLinearFloatLightColor.x * ( 1.0f / 255.0f ) * flAlpha;
|
||||||
|
state.m_Color[1] = m_CurrentLinearFloatLightColor.y * ( 1.0f / 255.0f ) * flAlpha;
|
||||||
|
state.m_Color[2] = m_CurrentLinearFloatLightColor.z * ( 1.0f / 255.0f ) * flAlpha;
|
||||||
|
state.m_Color[3] = 0.0f; // fixme: need to make ambient work m_flAmbient;
|
||||||
|
state.m_flShadowSlopeScaleDepthBias = g_pMaterialSystemHardwareConfig->GetShadowSlopeScaleDepthBias();
|
||||||
|
state.m_flShadowDepthBias = g_pMaterialSystemHardwareConfig->GetShadowDepthBias();
|
||||||
|
#endif
|
||||||
|
state.m_bEnableShadows = m_bEnableShadows;
|
||||||
|
state.m_pSpotlightTexture = m_SpotlightTexture;
|
||||||
|
state.m_nSpotlightTextureFrame = m_nSpotlightTextureFrame;
|
||||||
|
|
||||||
|
state.m_nShadowQuality = m_nShadowQuality; // Allow entity to affect shadow quality
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
state.m_bAlwaysDraw = m_bAlwaysDraw;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( m_LightHandle == CLIENTSHADOW_INVALID_HANDLE )
|
||||||
|
{
|
||||||
|
m_LightHandle = g_pClientShadowMgr->CreateFlashlight( state );
|
||||||
|
|
||||||
|
if ( m_LightHandle != CLIENTSHADOW_INVALID_HANDLE )
|
||||||
|
{
|
||||||
|
m_bForceUpdate = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->UpdateFlashlightState( m_LightHandle, state );
|
||||||
|
m_bForceUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pClientShadowMgr->GetFrustumExtents( m_LightHandle, m_vecExtentsMin, m_vecExtentsMax );
|
||||||
|
|
||||||
|
m_vecExtentsMin = m_vecExtentsMin - GetAbsOrigin();
|
||||||
|
m_vecExtentsMax = m_vecExtentsMax - GetAbsOrigin();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_bLightOnlyTarget )
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->SetFlashlightTarget( m_LightHandle, m_hTargetEntity );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->SetFlashlightTarget( m_LightHandle, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
g_pClientShadowMgr->SetFlashlightLightWorld( m_LightHandle, m_bLightWorld );
|
||||||
|
|
||||||
|
if ( !asw_perf_wtf.GetBool() && !m_bForceUpdate )
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->UpdateProjectedTexture( m_LightHandle, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_EnvProjectedTexture::Simulate( void )
|
||||||
|
{
|
||||||
|
UpdateLight();
|
||||||
|
|
||||||
|
BaseClass::Simulate();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool C_EnvProjectedTexture::IsBBoxVisible( Vector vecExtentsMin, Vector vecExtentsMax )
|
||||||
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_bAlwaysDraw)
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Z position clamped to the min height (but must be less than the max)
|
||||||
|
float flVisibleBBoxMinHeight = MIN( vecExtentsMax.z - 1.0f, m_flVisibleBBoxMinHeight );
|
||||||
|
vecExtentsMin.z = MAX( vecExtentsMin.z, flVisibleBBoxMinHeight );
|
||||||
|
|
||||||
|
// Check if the bbox is in the view
|
||||||
|
return !engine->CullBox( vecExtentsMin, vecExtentsMax );
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifndef MAPBASE
|
||||||
static ConVar mat_slopescaledepthbias_shadowmap( "mat_slopescaledepthbias_shadowmap", "16", FCVAR_CHEAT );
|
static ConVar mat_slopescaledepthbias_shadowmap( "mat_slopescaledepthbias_shadowmap", "16", FCVAR_CHEAT );
|
||||||
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.0005", FCVAR_CHEAT );
|
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.0005", FCVAR_CHEAT );
|
||||||
|
#else
|
||||||
|
static ConVar mat_slopescaledepthbias_shadowmap( "mat_slopescaledepthbias_shadowmap", "4", FCVAR_CHEAT );
|
||||||
|
static ConVar mat_depthbias_shadowmap( "mat_depthbias_shadowmap", "0.00001", FCVAR_CHEAT );
|
||||||
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
@ -34,7 +513,11 @@ public:
|
|||||||
|
|
||||||
virtual void Simulate();
|
virtual void Simulate();
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
void UpdateLight();
|
||||||
|
#else
|
||||||
void UpdateLight( bool bForceUpdate );
|
void UpdateLight( bool bForceUpdate );
|
||||||
|
#endif
|
||||||
|
|
||||||
C_EnvProjectedTexture();
|
C_EnvProjectedTexture();
|
||||||
~C_EnvProjectedTexture();
|
~C_EnvProjectedTexture();
|
||||||
@ -42,10 +525,16 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
ClientShadowHandle_t m_LightHandle;
|
ClientShadowHandle_t m_LightHandle;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
bool m_bForceUpdate;
|
||||||
|
#endif
|
||||||
|
|
||||||
EHANDLE m_hTargetEntity;
|
EHANDLE m_hTargetEntity;
|
||||||
|
|
||||||
bool m_bState;
|
bool m_bState;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
bool m_bAlwaysUpdate;
|
||||||
|
#endif
|
||||||
float m_flLightFOV;
|
float m_flLightFOV;
|
||||||
bool m_bEnableShadows;
|
bool m_bEnableShadows;
|
||||||
bool m_bLightOnlyTarget;
|
bool m_bLightOnlyTarget;
|
||||||
@ -63,6 +552,9 @@ private:
|
|||||||
IMPLEMENT_CLIENTCLASS_DT( C_EnvProjectedTexture, DT_EnvProjectedTexture, CEnvProjectedTexture )
|
IMPLEMENT_CLIENTCLASS_DT( C_EnvProjectedTexture, DT_EnvProjectedTexture, CEnvProjectedTexture )
|
||||||
RecvPropEHandle( RECVINFO( m_hTargetEntity ) ),
|
RecvPropEHandle( RECVINFO( m_hTargetEntity ) ),
|
||||||
RecvPropBool( RECVINFO( m_bState ) ),
|
RecvPropBool( RECVINFO( m_bState ) ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropBool( RECVINFO( m_bAlwaysUpdate ) ),
|
||||||
|
#endif
|
||||||
RecvPropFloat( RECVINFO( m_flLightFOV ) ),
|
RecvPropFloat( RECVINFO( m_flLightFOV ) ),
|
||||||
RecvPropBool( RECVINFO( m_bEnableShadows ) ),
|
RecvPropBool( RECVINFO( m_bEnableShadows ) ),
|
||||||
RecvPropBool( RECVINFO( m_bLightOnlyTarget ) ),
|
RecvPropBool( RECVINFO( m_bLightOnlyTarget ) ),
|
||||||
@ -103,12 +595,22 @@ void C_EnvProjectedTexture::ShutDownLightHandle( void )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void C_EnvProjectedTexture::OnDataChanged( DataUpdateType_t updateType )
|
void C_EnvProjectedTexture::OnDataChanged( DataUpdateType_t updateType )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
m_bForceUpdate = true;
|
||||||
|
UpdateLight();
|
||||||
|
#else
|
||||||
UpdateLight( true );
|
UpdateLight( true );
|
||||||
|
#endif
|
||||||
BaseClass::OnDataChanged( updateType );
|
BaseClass::OnDataChanged( updateType );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MAPBASE
|
||||||
void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
|
void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
|
||||||
|
#else
|
||||||
|
void C_EnvProjectedTexture::UpdateLight()
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifndef MAPBASE
|
||||||
if ( m_bState == false )
|
if ( m_bState == false )
|
||||||
{
|
{
|
||||||
if ( m_LightHandle != CLIENTSHADOW_INVALID_HANDLE )
|
if ( m_LightHandle != CLIENTSHADOW_INVALID_HANDLE )
|
||||||
@ -118,7 +620,25 @@ void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if ( m_bAlwaysUpdate )
|
||||||
|
{
|
||||||
|
m_bForceUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_bState == false )
|
||||||
|
{
|
||||||
|
// Spotlight's extents aren't in view
|
||||||
|
ShutDownLightHandle();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( m_LightHandle == CLIENTSHADOW_INVALID_HANDLE || m_hTargetEntity != NULL || m_bForceUpdate )
|
||||||
|
{
|
||||||
|
#endif
|
||||||
Vector vForward, vRight, vUp, vPos = GetAbsOrigin();
|
Vector vForward, vRight, vUp, vPos = GetAbsOrigin();
|
||||||
FlashlightState_t state;
|
FlashlightState_t state;
|
||||||
|
|
||||||
@ -153,8 +673,24 @@ void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifndef MAPBASE
|
||||||
vForward = m_hTargetEntity->GetAbsOrigin() - GetAbsOrigin();
|
vForward = m_hTargetEntity->GetAbsOrigin() - GetAbsOrigin();
|
||||||
VectorNormalize( vForward );
|
VectorNormalize( vForward );
|
||||||
|
#else
|
||||||
|
// VXP: Fixing targeting
|
||||||
|
Vector vecToTarget;
|
||||||
|
QAngle vecAngles;
|
||||||
|
if (m_hTargetEntity == NULL)
|
||||||
|
{
|
||||||
|
vecAngles = GetAbsAngles();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vecToTarget = m_hTargetEntity->GetAbsOrigin() - GetAbsOrigin();
|
||||||
|
VectorAngles(vecToTarget, vecAngles);
|
||||||
|
}
|
||||||
|
AngleVectors(vecAngles, &vForward, &vRight, &vUp);
|
||||||
|
#endif
|
||||||
|
|
||||||
// JasonM - unimplemented
|
// JasonM - unimplemented
|
||||||
Assert (0);
|
Assert (0);
|
||||||
@ -204,11 +740,19 @@ void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifndef MAPBASE
|
||||||
if ( m_hTargetEntity != NULL || bForceUpdate == true )
|
if ( m_hTargetEntity != NULL || bForceUpdate == true )
|
||||||
{
|
{
|
||||||
g_pClientShadowMgr->UpdateFlashlightState( m_LightHandle, state );
|
g_pClientShadowMgr->UpdateFlashlightState( m_LightHandle, state );
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
g_pClientShadowMgr->UpdateFlashlightState( m_LightHandle, state );
|
||||||
|
m_bForceUpdate = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef MAPBASE
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if( m_bLightOnlyTarget )
|
if( m_bLightOnlyTarget )
|
||||||
{
|
{
|
||||||
@ -221,25 +765,29 @@ void C_EnvProjectedTexture::UpdateLight( bool bForceUpdate )
|
|||||||
|
|
||||||
g_pClientShadowMgr->SetFlashlightLightWorld( m_LightHandle, m_bLightWorld );
|
g_pClientShadowMgr->SetFlashlightLightWorld( m_LightHandle, m_bLightWorld );
|
||||||
|
|
||||||
|
#ifndef MAPBASE
|
||||||
// The conditional to check if bForceUpdate == false is commented out based on a guide on VDC
|
if ( bForceUpdate == false )
|
||||||
// https://developer.valvesoftware.com/wiki/Env_projectedtexture/fixes
|
{
|
||||||
// This was done so that projected textures may be parented.
|
|
||||||
// Change made by Derek Dik on 9/4/2016
|
|
||||||
|
|
||||||
//if ( bForceUpdate == false )
|
|
||||||
//{
|
|
||||||
g_pClientShadowMgr->UpdateProjectedTexture( m_LightHandle, true );
|
g_pClientShadowMgr->UpdateProjectedTexture( m_LightHandle, true );
|
||||||
//}
|
}
|
||||||
|
#else
|
||||||
|
if ( !m_bForceUpdate )
|
||||||
|
{
|
||||||
|
g_pClientShadowMgr->UpdateProjectedTexture( m_LightHandle, true );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void C_EnvProjectedTexture::Simulate( void )
|
void C_EnvProjectedTexture::Simulate( void )
|
||||||
{
|
{
|
||||||
// According to VDC, we want to update the light based on when there is a movement parent
|
#ifndef MAPBASE
|
||||||
//https://developer.valvesoftware.com/wiki/Env_projectedtexture/fixes
|
UpdateLight( false );
|
||||||
// Change made by Derek Dik on 9/4/2016
|
#else
|
||||||
UpdateLight( GetMoveParent() != NULL );
|
UpdateLight();
|
||||||
|
#endif
|
||||||
|
|
||||||
BaseClass::Simulate();
|
BaseClass::Simulate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -48,6 +48,9 @@ protected:
|
|||||||
int m_iCachedDesiredOverlay;
|
int m_iCachedDesiredOverlay;
|
||||||
int m_iCurrentOverlay;
|
int m_iCurrentOverlay;
|
||||||
float m_flCurrentOverlayTime;
|
float m_flCurrentOverlayTime;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
int m_iOverlayIndex;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_CLIENTCLASS_DT( C_EnvScreenOverlay, DT_EnvScreenOverlay, CEnvScreenOverlay )
|
IMPLEMENT_CLIENTCLASS_DT( C_EnvScreenOverlay, DT_EnvScreenOverlay, CEnvScreenOverlay )
|
||||||
@ -56,6 +59,9 @@ IMPLEMENT_CLIENTCLASS_DT( C_EnvScreenOverlay, DT_EnvScreenOverlay, CEnvScreenOve
|
|||||||
RecvPropFloat( RECVINFO( m_flStartTime ) ),
|
RecvPropFloat( RECVINFO( m_flStartTime ) ),
|
||||||
RecvPropInt( RECVINFO( m_iDesiredOverlay ) ),
|
RecvPropInt( RECVINFO( m_iDesiredOverlay ) ),
|
||||||
RecvPropBool( RECVINFO( m_bIsActive ) ),
|
RecvPropBool( RECVINFO( m_bIsActive ) ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropInt( RECVINFO( m_iOverlayIndex ) ),
|
||||||
|
#endif
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -77,7 +83,11 @@ void C_EnvScreenOverlay::PostDataUpdate( DataUpdateType_t updateType )
|
|||||||
BaseClass::PostDataUpdate( updateType );
|
BaseClass::PostDataUpdate( updateType );
|
||||||
|
|
||||||
// If we have a start time now, start the overlays going
|
// If we have a start time now, start the overlays going
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( m_bIsActive && m_flStartTime > 0 && (view->GetScreenOverlayMaterial() == NULL || (m_iOverlayIndex != -1 && view->GetIndexedScreenOverlayMaterial(m_iOverlayIndex) == NULL)) )
|
||||||
|
#else
|
||||||
if ( m_bIsActive && m_flStartTime > 0 && view->GetScreenOverlayMaterial() == NULL )
|
if ( m_bIsActive && m_flStartTime > 0 && view->GetScreenOverlayMaterial() == NULL )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
StartOverlays();
|
StartOverlays();
|
||||||
}
|
}
|
||||||
@ -111,7 +121,16 @@ void C_EnvScreenOverlay::StopOverlays( void )
|
|||||||
|
|
||||||
if ( m_bWasActive && !m_bIsActive )
|
if ( m_bWasActive && !m_bIsActive )
|
||||||
{
|
{
|
||||||
view->SetScreenOverlayMaterial( NULL );
|
#ifdef MAPBASE
|
||||||
|
if (m_iOverlayIndex != -1)
|
||||||
|
{
|
||||||
|
view->SetIndexedScreenOverlayMaterial( m_iOverlayIndex, NULL );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
view->SetScreenOverlayMaterial( NULL );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +182,16 @@ void C_EnvScreenOverlay::StartCurrentOverlay( void )
|
|||||||
IMaterial *pMaterial = materials->FindMaterial( m_iszOverlayNames[m_iCurrentOverlay], TEXTURE_GROUP_CLIENT_EFFECTS, false );
|
IMaterial *pMaterial = materials->FindMaterial( m_iszOverlayNames[m_iCurrentOverlay], TEXTURE_GROUP_CLIENT_EFFECTS, false );
|
||||||
if ( !IsErrorMaterial( pMaterial ) )
|
if ( !IsErrorMaterial( pMaterial ) )
|
||||||
{
|
{
|
||||||
view->SetScreenOverlayMaterial( pMaterial );
|
#ifdef MAPBASE
|
||||||
|
if (m_iOverlayIndex != -1)
|
||||||
|
{
|
||||||
|
view->SetIndexedScreenOverlayMaterial( m_iOverlayIndex, pMaterial );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
view->SetScreenOverlayMaterial( pMaterial );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -191,6 +219,11 @@ enum
|
|||||||
SCREENEFFECT_EP2_ADVISOR_STUN,
|
SCREENEFFECT_EP2_ADVISOR_STUN,
|
||||||
SCREENEFFECT_EP1_INTRO,
|
SCREENEFFECT_EP1_INTRO,
|
||||||
SCREENEFFECT_EP2_GROGGY,
|
SCREENEFFECT_EP2_GROGGY,
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
SCREENEFFECT_MAPBASE_CHROMATIC_BLUR = 100, // Overlays 3 different frames of red, green, and blue tints respectively with different offsets
|
||||||
|
SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION, // Similar to above, except it stretches frames in addition to offsetting them
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@ -275,6 +308,21 @@ void C_EnvScreenEffect::ReceiveMessage( int classID, bf_read &msg )
|
|||||||
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "ep2_groggy", pKeys );
|
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "ep2_groggy", pKeys );
|
||||||
g_pScreenSpaceEffects->EnableScreenSpaceEffect( "ep2_groggy" );
|
g_pScreenSpaceEffects->EnableScreenSpaceEffect( "ep2_groggy" );
|
||||||
}
|
}
|
||||||
|
#ifdef MAPBASE
|
||||||
|
else if ( m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_BLUR || m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION )
|
||||||
|
{
|
||||||
|
if( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() < 80 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Set our keys
|
||||||
|
pKeys->SetFloat( "duration", m_flDuration );
|
||||||
|
pKeys->SetInt( "fadeout", 0 );
|
||||||
|
pKeys->SetInt( "stretch", m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION );
|
||||||
|
|
||||||
|
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "mapbase_chromatic_aberration", pKeys );
|
||||||
|
g_pScreenSpaceEffects->EnableScreenSpaceEffect( "mapbase_chromatic_aberration" );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
pKeys->deleteThis();
|
pKeys->deleteThis();
|
||||||
}
|
}
|
||||||
@ -321,6 +369,25 @@ void C_EnvScreenEffect::ReceiveMessage( int classID, bf_read &msg )
|
|||||||
|
|
||||||
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "ep2_groggy", pKeys );
|
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "ep2_groggy", pKeys );
|
||||||
}
|
}
|
||||||
|
#ifdef MAPBASE
|
||||||
|
else if ( m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_BLUR || m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION )
|
||||||
|
{
|
||||||
|
if( g_pMaterialSystemHardwareConfig->GetDXSupportLevel() < 80 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Create a keyvalue block to set these params
|
||||||
|
KeyValues *pKeys = new KeyValues( "keys" );
|
||||||
|
if ( pKeys == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Set our keys
|
||||||
|
pKeys->SetFloat( "duration", m_flDuration );
|
||||||
|
pKeys->SetInt( "fadeout", 1 );
|
||||||
|
pKeys->SetInt( "stretch", m_nType == SCREENEFFECT_MAPBASE_CHROMATIC_ABERRATION );
|
||||||
|
|
||||||
|
g_pScreenSpaceEffects->SetScreenSpaceEffectParams( "mapbase_chromatic_aberration", pKeys );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -88,8 +88,9 @@ void CDustEffect::RenderParticles( CParticleRenderIterator *pIterator )
|
|||||||
void CDustEffect::SimulateParticles( CParticleSimulateIterator *pIterator )
|
void CDustEffect::SimulateParticles( CParticleSimulateIterator *pIterator )
|
||||||
{
|
{
|
||||||
Vector vecWind;
|
Vector vecWind;
|
||||||
|
#ifndef MAPBASE
|
||||||
GetWindspeedAtTime( gpGlobals->curtime, vecWind );
|
GetWindspeedAtTime( gpGlobals->curtime, vecWind );
|
||||||
|
#endif
|
||||||
|
|
||||||
CFuncDustParticle *pParticle = (CFuncDustParticle*)pIterator->GetFirst();
|
CFuncDustParticle *pParticle = (CFuncDustParticle*)pIterator->GetFirst();
|
||||||
while ( pParticle )
|
while ( pParticle )
|
||||||
@ -105,6 +106,9 @@ void CDustEffect::SimulateParticles( CParticleSimulateIterator *pIterator )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
vecWind = GetWindspeedAtLocation( pParticle->m_Pos );
|
||||||
|
#endif
|
||||||
for ( int i = 0 ; i < 2 ; i++ )
|
for ( int i = 0 ; i < 2 ; i++ )
|
||||||
{
|
{
|
||||||
if ( pParticle->m_vVelocity[i] < vecWind[i] )
|
if ( pParticle->m_vVelocity[i] < vecWind[i] )
|
||||||
|
@ -30,6 +30,9 @@ public:
|
|||||||
// These are documented in the server-side entity.
|
// These are documented in the server-side entity.
|
||||||
public:
|
public:
|
||||||
float m_fDisappearDist;
|
float m_fDisappearDist;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
float m_fDisappearMaxDist;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -43,6 +46,9 @@ ConVar lod_TransitionDist("lod_TransitionDist", "800");
|
|||||||
// Datatable..
|
// Datatable..
|
||||||
IMPLEMENT_CLIENTCLASS_DT(C_Func_LOD, DT_Func_LOD, CFunc_LOD)
|
IMPLEMENT_CLIENTCLASS_DT(C_Func_LOD, DT_Func_LOD, CFunc_LOD)
|
||||||
RecvPropFloat(RECVINFO(m_fDisappearDist)),
|
RecvPropFloat(RECVINFO(m_fDisappearDist)),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropFloat(RECVINFO(m_fDisappearMaxDist)),
|
||||||
|
#endif
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
|
|
||||||
@ -54,6 +60,9 @@ END_RECV_TABLE()
|
|||||||
C_Func_LOD::C_Func_LOD()
|
C_Func_LOD::C_Func_LOD()
|
||||||
{
|
{
|
||||||
m_fDisappearDist = 5000.0f;
|
m_fDisappearDist = 5000.0f;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
m_fDisappearMaxDist = 0.0f;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -61,7 +70,11 @@ C_Func_LOD::C_Func_LOD()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
unsigned char C_Func_LOD::GetClientSideFade()
|
unsigned char C_Func_LOD::GetClientSideFade()
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
return UTIL_ComputeEntityFade( this, m_fDisappearDist, m_fDisappearDist + (m_fDisappearMaxDist != 0 ? m_fDisappearMaxDist : lod_TransitionDist.GetFloat()), 1.0f );
|
||||||
|
#else
|
||||||
return UTIL_ComputeEntityFade( this, m_fDisappearDist, m_fDisappearDist + lod_TransitionDist.GetFloat(), 1.0f );
|
return UTIL_ComputeEntityFade( this, m_fDisappearDist, m_fDisappearDist + lod_TransitionDist.GetFloat(), 1.0f );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
//===========================================================================//
|
//===========================================================================//
|
||||||
#include "cbase.h"
|
#include "cbase.h"
|
||||||
#include "view_shared.h"
|
#include "view_shared.h"
|
||||||
|
#ifdef MAPBASE
|
||||||
|
#include "viewrender.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
@ -23,10 +26,27 @@ public:
|
|||||||
|
|
||||||
virtual bool ShouldDraw();
|
virtual bool ShouldDraw();
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
virtual void OnDataChanged( DataUpdateType_t type );
|
||||||
|
ITexture *ReflectionRenderTarget();
|
||||||
|
ITexture *RefractionRenderTarget();
|
||||||
|
|
||||||
|
char m_iszReflectRenderTarget[64];
|
||||||
|
char m_iszRefractRenderTarget[64];
|
||||||
|
ITexture *m_pReflectRenderTarget;
|
||||||
|
ITexture *m_pRefractRenderTarget;
|
||||||
|
#endif
|
||||||
|
|
||||||
C_FuncReflectiveGlass *m_pNext;
|
C_FuncReflectiveGlass *m_pNext;
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_CLIENTCLASS_DT( C_FuncReflectiveGlass, DT_FuncReflectiveGlass, CFuncReflectiveGlass )
|
IMPLEMENT_CLIENTCLASS_DT( C_FuncReflectiveGlass, DT_FuncReflectiveGlass, CFuncReflectiveGlass )
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropString( RECVINFO( m_iszReflectRenderTarget ) ),
|
||||||
|
RecvPropString( RECVINFO( m_iszRefractRenderTarget ) ),
|
||||||
|
#endif
|
||||||
|
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
|
|
||||||
@ -47,6 +67,11 @@ C_FuncReflectiveGlass* GetReflectiveGlassList()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
C_FuncReflectiveGlass::C_FuncReflectiveGlass()
|
C_FuncReflectiveGlass::C_FuncReflectiveGlass()
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
m_iszReflectRenderTarget[0] = '\0';
|
||||||
|
m_iszRefractRenderTarget[0] = '\0';
|
||||||
|
#endif
|
||||||
|
|
||||||
g_ReflectiveGlassList.Insert( this );
|
g_ReflectiveGlassList.Insert( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,5 +139,111 @@ bool IsReflectiveGlassInView( const CViewSetup& view, cplane_t &plane )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Iterates through reflective glass instead of just picking one
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
C_BaseEntity *NextReflectiveGlass( C_BaseEntity *pStart, const CViewSetup& view, cplane_t &plane,
|
||||||
|
const Frustum_t &frustum, ITexture **pRenderTargets )
|
||||||
|
{
|
||||||
|
// Early out if no cameras
|
||||||
|
C_FuncReflectiveGlass *pReflectiveGlass = NULL;
|
||||||
|
if (!pStart)
|
||||||
|
pReflectiveGlass = GetReflectiveGlassList();
|
||||||
|
else
|
||||||
|
pReflectiveGlass = ((C_FuncReflectiveGlass*)pStart)->m_pNext;
|
||||||
|
|
||||||
|
cplane_t localPlane;
|
||||||
|
Vector vecOrigin, vecWorld, vecDelta;
|
||||||
|
for ( ; pReflectiveGlass != NULL; pReflectiveGlass = pReflectiveGlass->m_pNext )
|
||||||
|
{
|
||||||
|
if ( pReflectiveGlass->IsDormant() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( pReflectiveGlass->m_iViewHideFlags & (1 << CurrentViewID()) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Vector vecMins, vecMaxs;
|
||||||
|
pReflectiveGlass->GetRenderBoundsWorldspace( vecMins, vecMaxs );
|
||||||
|
if ( R_CullBox( vecMins, vecMaxs, frustum ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const model_t *pModel = pReflectiveGlass->GetModel();
|
||||||
|
const matrix3x4_t& mat = pReflectiveGlass->EntityToWorldTransform();
|
||||||
|
|
||||||
|
int nCount = modelinfo->GetBrushModelPlaneCount( pModel );
|
||||||
|
for ( int i = 0; i < nCount; ++i )
|
||||||
|
{
|
||||||
|
modelinfo->GetBrushModelPlane( pModel, i, localPlane, &vecOrigin );
|
||||||
|
|
||||||
|
MatrixTransformPlane( mat, localPlane, plane ); // Transform to world space
|
||||||
|
VectorTransform( vecOrigin, mat, vecWorld );
|
||||||
|
|
||||||
|
if ( view.origin.Dot( plane.normal ) <= plane.dist ) // Check for view behind plane
|
||||||
|
continue;
|
||||||
|
|
||||||
|
VectorSubtract( vecWorld, view.origin, vecDelta ); // Backface cull
|
||||||
|
if ( vecDelta.Dot( plane.normal ) >= 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (pRenderTargets != NULL)
|
||||||
|
{
|
||||||
|
pRenderTargets[0] = pReflectiveGlass->ReflectionRenderTarget();
|
||||||
|
pRenderTargets[1] = pReflectiveGlass->RefractionRenderTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pReflectiveGlass;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_FuncReflectiveGlass::OnDataChanged( DataUpdateType_t type )
|
||||||
|
{
|
||||||
|
// Reset render textures
|
||||||
|
m_pReflectRenderTarget = NULL;
|
||||||
|
m_pRefractRenderTarget = NULL;
|
||||||
|
|
||||||
|
return BaseClass::OnDataChanged( type );
|
||||||
|
}
|
||||||
|
|
||||||
|
ITexture *C_FuncReflectiveGlass::ReflectionRenderTarget()
|
||||||
|
{
|
||||||
|
if (m_iszReflectRenderTarget[0] != '\0')
|
||||||
|
{
|
||||||
|
if (!m_pReflectRenderTarget)
|
||||||
|
{
|
||||||
|
// We don't use a CTextureReference for this because we don't want to shut down the texture on removal/change
|
||||||
|
m_pReflectRenderTarget = materials->FindTexture( m_iszReflectRenderTarget, TEXTURE_GROUP_RENDER_TARGET );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pReflectRenderTarget)
|
||||||
|
return m_pReflectRenderTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
//return GetWaterReflectionTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
ITexture *C_FuncReflectiveGlass::RefractionRenderTarget()
|
||||||
|
{
|
||||||
|
if (m_iszRefractRenderTarget[0] != '\0')
|
||||||
|
{
|
||||||
|
if (!m_pRefractRenderTarget)
|
||||||
|
{
|
||||||
|
// We don't use a CTextureReference for this because we don't want to shut down the texture on removal/change
|
||||||
|
m_pRefractRenderTarget = materials->FindTexture( m_iszRefractRenderTarget, TEXTURE_GROUP_RENDER_TARGET );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pRefractRenderTarget)
|
||||||
|
return m_pRefractRenderTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
//return GetWaterRefractionTexture();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,11 @@ class CViewSetup;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool IsReflectiveGlassInView( const CViewSetup& view, cplane_t &plane );
|
bool IsReflectiveGlassInView( const CViewSetup& view, cplane_t &plane );
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
C_BaseEntity *NextReflectiveGlass( C_BaseEntity *pStart, const CViewSetup& view, cplane_t &plane,
|
||||||
|
const Frustum_t &frustum, ITexture **pRenderTargets = NULL );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif // C_FUNC_REFLECTIVE_GLASS
|
#endif // C_FUNC_REFLECTIVE_GLASS
|
||||||
|
|
||||||
|
1312
sp/src/game/client/c_gameinstructor.cpp
Normal file
1312
sp/src/game/client/c_gameinstructor.cpp
Normal file
File diff suppressed because it is too large
Load Diff
118
sp/src/game/client/c_gameinstructor.h
Normal file
118
sp/src/game/client/c_gameinstructor.h
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
//========= Copyright © 1996-2008, Valve Corporation, All rights reserved. ============//
|
||||||
|
//
|
||||||
|
// Purpose: Client handler for instruction players how to play
|
||||||
|
//
|
||||||
|
//=============================================================================//
|
||||||
|
|
||||||
|
#ifndef _C_GAMEINSTRUCTOR_H_
|
||||||
|
#define _C_GAMEINSTRUCTOR_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include "GameEventListener.h"
|
||||||
|
#include "vgui_controls/PHandle.h"
|
||||||
|
|
||||||
|
class CBaseLesson;
|
||||||
|
|
||||||
|
|
||||||
|
struct LessonGroupConVarToggle_t
|
||||||
|
{
|
||||||
|
ConVarRef var;
|
||||||
|
char szLessonGroupName[ 64 ];
|
||||||
|
|
||||||
|
LessonGroupConVarToggle_t( const char *pchConVarName ) :
|
||||||
|
var( pchConVarName )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class C_GameInstructor : public CAutoGameSystemPerFrame, public CGameEventListener
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
C_GameInstructor() : CAutoGameSystemPerFrame( "C_GameInstructor" )
|
||||||
|
{
|
||||||
|
m_bHasLoadedSaveData = false;
|
||||||
|
m_bDirtySaveData = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Methods of IGameSystem
|
||||||
|
virtual bool Init( void );
|
||||||
|
virtual void Shutdown( void );
|
||||||
|
virtual void Update( float frametime );
|
||||||
|
|
||||||
|
void UpdateHiddenByOtherElements( void );
|
||||||
|
bool Mod_HiddenByOtherElements( void );
|
||||||
|
|
||||||
|
virtual void FireGameEvent( IGameEvent *event );
|
||||||
|
|
||||||
|
void DefineLesson( CBaseLesson *pLesson );
|
||||||
|
|
||||||
|
const CBaseLesson * GetLesson( const char *pchLessonName );
|
||||||
|
bool IsLessonOfSameTypeOpen( const CBaseLesson *pLesson ) const;
|
||||||
|
|
||||||
|
bool ReadSaveData( void );
|
||||||
|
bool WriteSaveData( void );
|
||||||
|
void RefreshDisplaysAndSuccesses( void );
|
||||||
|
void ResetDisplaysAndSuccesses( void );
|
||||||
|
void MarkDisplayed( const char *pchLessonName );
|
||||||
|
void MarkSucceeded( const char *pchLessonName );
|
||||||
|
|
||||||
|
void PlaySound( const char *pchSoundName );
|
||||||
|
|
||||||
|
bool OpenOpportunity( CBaseLesson *pLesson );
|
||||||
|
|
||||||
|
void DumpOpenOpportunities( void );
|
||||||
|
|
||||||
|
KeyValues * GetScriptKeys( void );
|
||||||
|
C_BasePlayer * GetLocalPlayer( void );
|
||||||
|
|
||||||
|
void EvaluateLessonsForGameRules( void );
|
||||||
|
void SetLessonGroupEnabled( const char *pszGroup, bool bEnabled );
|
||||||
|
|
||||||
|
// Mapbase needs this to be public for map-specific file system
|
||||||
|
void ReadLessonsFromFile( const char *pchFileName );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void FindErrors( void );
|
||||||
|
|
||||||
|
bool UpdateActiveLesson( CBaseLesson *pLesson, const CBaseLesson *pRootLesson );
|
||||||
|
void UpdateInactiveLesson( CBaseLesson *pLesson );
|
||||||
|
|
||||||
|
CBaseLesson * GetLesson_Internal( const char *pchLessonName );
|
||||||
|
|
||||||
|
void StopAllLessons( void );
|
||||||
|
|
||||||
|
void CloseAllOpenOpportunities( void );
|
||||||
|
void CloseOpportunity( CBaseLesson *pLesson );
|
||||||
|
|
||||||
|
void InitLessonPrerequisites( void );
|
||||||
|
|
||||||
|
private:
|
||||||
|
CUtlVector < CBaseLesson* > m_Lessons;
|
||||||
|
CUtlVector < CBaseLesson* > m_OpenOpportunities;
|
||||||
|
|
||||||
|
CUtlVector < LessonGroupConVarToggle_t > m_LessonGroupConVarToggles;
|
||||||
|
|
||||||
|
KeyValues *m_pScriptKeys;
|
||||||
|
|
||||||
|
bool m_bNoDraw;
|
||||||
|
bool m_bHiddenDueToOtherElements;
|
||||||
|
|
||||||
|
int m_iCurrentPriority;
|
||||||
|
EHANDLE m_hLastSpectatedPlayer;
|
||||||
|
bool m_bSpectatedPlayerChanged;
|
||||||
|
|
||||||
|
char m_szPreviousStartSound[ 128 ];
|
||||||
|
float m_fNextStartSoundTime;
|
||||||
|
|
||||||
|
bool m_bHasLoadedSaveData;
|
||||||
|
bool m_bDirtySaveData;
|
||||||
|
};
|
||||||
|
|
||||||
|
C_GameInstructor &GetGameInstructor();
|
||||||
|
|
||||||
|
void GameInstructor_Init();
|
||||||
|
void GameInstructor_Shutdown();
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _C_GAMEINSTRUCTOR_H_
|
@ -95,18 +95,23 @@ extern PMaterialHandle g_Material_Spark;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void GetColorForSurface( trace_t *trace, Vector *color )
|
void GetColorForSurface( trace_t *trace, Vector *color )
|
||||||
{
|
{
|
||||||
Vector baseColor, diffuseColor;
|
Vector baseColor = vec3_invalid, diffuseColor;
|
||||||
Vector end = trace->startpos + ( ( Vector )trace->endpos - ( Vector )trace->startpos ) * 1.1f;
|
const char *kind;
|
||||||
|
|
||||||
if ( trace->DidHitWorld() )
|
if ( trace->DidHitWorld() )
|
||||||
{
|
{
|
||||||
if ( trace->hitbox == 0 )
|
if ( trace->hitbox == 0 )
|
||||||
{
|
{
|
||||||
|
kind = "World";
|
||||||
|
Vector end = trace->startpos + ( trace->endpos - trace->startpos ) * 1.1f;
|
||||||
// If we hit the world, then ask the world for the fleck color
|
// If we hit the world, then ask the world for the fleck color
|
||||||
engine->TraceLineMaterialAndLighting( trace->startpos, end, diffuseColor, baseColor );
|
if ( !engine->TraceLineMaterialAndLighting( trace->startpos, end, diffuseColor, baseColor ) ) {
|
||||||
|
baseColor = vec3_invalid; // Make sure this wasn't modified
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
kind = "Static Prop";
|
||||||
// In this case we hit a static prop.
|
// In this case we hit a static prop.
|
||||||
staticpropmgr->GetStaticPropMaterialColorAndLighting( trace, trace->hitbox - 1, diffuseColor, baseColor );
|
staticpropmgr->GetStaticPropMaterialColorAndLighting( trace, trace->hitbox - 1, diffuseColor, baseColor );
|
||||||
}
|
}
|
||||||
@ -117,20 +122,24 @@ void GetColorForSurface( trace_t *trace, Vector *color )
|
|||||||
C_BaseEntity *pEnt = trace->m_pEnt;
|
C_BaseEntity *pEnt = trace->m_pEnt;
|
||||||
if ( !pEnt )
|
if ( !pEnt )
|
||||||
{
|
{
|
||||||
Msg("Couldn't find surface in GetColorForSurface()\n");
|
kind = "Null-Entity";
|
||||||
color->x = 255;
|
} else {
|
||||||
color->y = 255;
|
kind = "Entity";
|
||||||
color->z = 255;
|
ICollideable *pCollide = pEnt->GetCollideable();
|
||||||
return;
|
int modelIndex = pCollide->GetCollisionModelIndex();
|
||||||
|
model_t* pModel = const_cast<model_t*>(modelinfo->GetModel( modelIndex ));
|
||||||
|
|
||||||
|
// Ask the model info about what we need to know
|
||||||
|
modelinfo->GetModelMaterialColorAndLighting( pModel, pCollide->GetCollisionOrigin(),
|
||||||
|
pCollide->GetCollisionAngles(), trace, diffuseColor, baseColor );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ICollideable *pCollide = pEnt->GetCollideable();
|
if ( baseColor == vec3_invalid )
|
||||||
int modelIndex = pCollide->GetCollisionModelIndex();
|
{
|
||||||
model_t* pModel = const_cast<model_t*>(modelinfo->GetModel( modelIndex ));
|
Warning( "Couldn't find surface color of %s\n", kind );
|
||||||
|
baseColor = Vector( .5f, .5f, .5f );
|
||||||
// Ask the model info about what we need to know
|
diffuseColor = engine->GetLightForPoint( trace->endpos, true );
|
||||||
modelinfo->GetModelMaterialColorAndLighting( pModel, pCollide->GetCollisionOrigin(),
|
|
||||||
pCollide->GetCollisionAngles(), trace, diffuseColor, baseColor );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get final light value
|
//Get final light value
|
||||||
|
@ -102,6 +102,10 @@ public:
|
|||||||
C_LightGlowOverlay m_Glow;
|
C_LightGlowOverlay m_Glow;
|
||||||
|
|
||||||
float m_flGlowProxySize;
|
float m_flGlowProxySize;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
bool m_bDisabled;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static void RecvProxy_HDRColorScale( const CRecvProxyData *pData, void *pStruct, void *pOut )
|
static void RecvProxy_HDRColorScale( const CRecvProxyData *pData, void *pStruct, void *pOut )
|
||||||
@ -123,6 +127,9 @@ IMPLEMENT_CLIENTCLASS_DT_NOBASE( C_LightGlow, DT_LightGlow, CLightGlow )
|
|||||||
RecvPropQAngles( RECVINFO_NAME( m_angNetworkAngles, m_angRotation ) ),
|
RecvPropQAngles( RECVINFO_NAME( m_angNetworkAngles, m_angRotation ) ),
|
||||||
RecvPropInt( RECVINFO_NAME(m_hNetworkMoveParent, moveparent), 0, RecvProxy_IntToMoveParent ),
|
RecvPropInt( RECVINFO_NAME(m_hNetworkMoveParent, moveparent), 0, RecvProxy_IntToMoveParent ),
|
||||||
RecvPropFloat(RECVINFO(m_flGlowProxySize)),
|
RecvPropFloat(RECVINFO(m_flGlowProxySize)),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropBool( RECVINFO( m_bDisabled ) ),
|
||||||
|
#endif
|
||||||
RecvPropFloat("HDRColorScale", 0, SIZEOF_IGNORE, 0, RecvProxy_HDRColorScale),
|
RecvPropFloat("HDRColorScale", 0, SIZEOF_IGNORE, 0, RecvProxy_HDRColorScale),
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
@ -202,7 +209,11 @@ void C_LightGlow::OnDataChanged( DataUpdateType_t updateType )
|
|||||||
void C_LightGlow::ClientThink( void )
|
void C_LightGlow::ClientThink( void )
|
||||||
{
|
{
|
||||||
Vector mins = GetAbsOrigin();
|
Vector mins = GetAbsOrigin();
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if ( engine->IsBoxVisible( mins, mins ) && !m_bDisabled )
|
||||||
|
#else
|
||||||
if ( engine->IsBoxVisible( mins, mins ) )
|
if ( engine->IsBoxVisible( mins, mins ) )
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_Glow.Activate();
|
m_Glow.Activate();
|
||||||
}
|
}
|
||||||
|
27
sp/src/game/client/c_movie_display.cpp
Normal file
27
sp/src/game/client/c_movie_display.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
//========= Copyright © 1996-2009, Valve Corporation, All rights reserved. ============//
|
||||||
|
//
|
||||||
|
// Purpose:
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//=====================================================================================//
|
||||||
|
#include "cbase.h"
|
||||||
|
#include "c_movie_display.h"
|
||||||
|
|
||||||
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
|
IMPLEMENT_CLIENTCLASS_DT( C_MovieDisplay, DT_MovieDisplay, CMovieDisplay )
|
||||||
|
RecvPropBool( RECVINFO( m_bEnabled ) ),
|
||||||
|
RecvPropBool( RECVINFO( m_bLooping ) ),
|
||||||
|
RecvPropBool( RECVINFO( m_bMuted ) ),
|
||||||
|
RecvPropString( RECVINFO( m_szMovieFilename ) ),
|
||||||
|
RecvPropString( RECVINFO( m_szGroupName ) ),
|
||||||
|
END_RECV_TABLE()
|
||||||
|
|
||||||
|
C_MovieDisplay::C_MovieDisplay()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
C_MovieDisplay::~C_MovieDisplay()
|
||||||
|
{
|
||||||
|
}
|
36
sp/src/game/client/c_movie_display.h
Normal file
36
sp/src/game/client/c_movie_display.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
//========= Copyright © 1996-2009, Valve Corporation, All rights reserved. ============//
|
||||||
|
//
|
||||||
|
// Purpose:
|
||||||
|
//
|
||||||
|
//=====================================================================================//
|
||||||
|
|
||||||
|
#ifndef C_MOVIE_DISPLAY_H
|
||||||
|
#define C_MOVIE_DISPLAY_H
|
||||||
|
|
||||||
|
#include "cbase.h"
|
||||||
|
|
||||||
|
class C_MovieDisplay : public C_BaseEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS( C_MovieDisplay, C_BaseEntity );
|
||||||
|
DECLARE_CLIENTCLASS();
|
||||||
|
|
||||||
|
C_MovieDisplay();
|
||||||
|
~C_MovieDisplay();
|
||||||
|
|
||||||
|
bool IsEnabled( void ) const { return m_bEnabled; }
|
||||||
|
bool IsLooping( void ) const { return m_bLooping; }
|
||||||
|
bool IsMuted(void) const { return m_bMuted; }
|
||||||
|
|
||||||
|
const char *GetMovieFilename( void ) const { return m_szMovieFilename; }
|
||||||
|
const char *GetGroupName( void ) const { return m_szGroupName; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_bEnabled;
|
||||||
|
bool m_bLooping;
|
||||||
|
bool m_bMuted;
|
||||||
|
char m_szMovieFilename[128];
|
||||||
|
char m_szGroupName[128];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //C_MOVIE_DISPLAY_H
|
@ -32,6 +32,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
int m_iEffectIndex;
|
int m_iEffectIndex;
|
||||||
bool m_bActive;
|
bool m_bActive;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
bool m_bDestroyImmediately;
|
||||||
|
#endif
|
||||||
bool m_bOldActive;
|
bool m_bOldActive;
|
||||||
float m_flStartTime; // Time at which the effect started
|
float m_flStartTime; // Time at which the effect started
|
||||||
|
|
||||||
@ -39,6 +42,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
EHANDLE m_hControlPointEnts[kMAXCONTROLPOINTS];
|
EHANDLE m_hControlPointEnts[kMAXCONTROLPOINTS];
|
||||||
|
Vector m_vControlPointVecs[kMAXCONTROLPOINTS];
|
||||||
// SendPropArray3( SENDINFO_ARRAY3(m_iControlPointParents), SendPropInt( SENDINFO_ARRAY(m_iControlPointParents), 3, SPROP_UNSIGNED ) ),
|
// SendPropArray3( SENDINFO_ARRAY3(m_iControlPointParents), SendPropInt( SENDINFO_ARRAY(m_iControlPointParents), 3, SPROP_UNSIGNED ) ),
|
||||||
unsigned char m_iControlPointParents[kMAXCONTROLPOINTS];
|
unsigned char m_iControlPointParents[kMAXCONTROLPOINTS];
|
||||||
|
|
||||||
@ -56,9 +60,13 @@ BEGIN_RECV_TABLE_NOBASE( C_ParticleSystem, DT_ParticleSystem )
|
|||||||
|
|
||||||
RecvPropInt( RECVINFO( m_iEffectIndex ) ),
|
RecvPropInt( RECVINFO( m_iEffectIndex ) ),
|
||||||
RecvPropBool( RECVINFO( m_bActive ) ),
|
RecvPropBool( RECVINFO( m_bActive ) ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropBool( RECVINFO( m_bDestroyImmediately ) ),
|
||||||
|
#endif
|
||||||
RecvPropFloat( RECVINFO( m_flStartTime ) ),
|
RecvPropFloat( RECVINFO( m_flStartTime ) ),
|
||||||
|
|
||||||
RecvPropArray3( RECVINFO_ARRAY(m_hControlPointEnts), RecvPropEHandle( RECVINFO( m_hControlPointEnts[0] ) ) ),
|
RecvPropArray3( RECVINFO_ARRAY(m_hControlPointEnts), RecvPropEHandle( RECVINFO( m_hControlPointEnts[0] ) ) ),
|
||||||
|
RecvPropArray3( RECVINFO_ARRAY(m_vControlPointVecs), RecvPropVector( RECVINFO( m_vControlPointVecs[0] ) ) ),
|
||||||
RecvPropArray3( RECVINFO_ARRAY(m_iControlPointParents), RecvPropInt( RECVINFO(m_iControlPointParents[0]))),
|
RecvPropArray3( RECVINFO_ARRAY(m_iControlPointParents), RecvPropInt( RECVINFO(m_iControlPointParents[0]))),
|
||||||
RecvPropBool( RECVINFO( m_bWeatherEffect ) ),
|
RecvPropBool( RECVINFO( m_bWeatherEffect ) ),
|
||||||
END_RECV_TABLE();
|
END_RECV_TABLE();
|
||||||
@ -108,9 +116,18 @@ void C_ParticleSystem::PostDataUpdate( DataUpdateType_t updateType )
|
|||||||
SetNextClientThink( gpGlobals->curtime );
|
SetNextClientThink( gpGlobals->curtime );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#ifdef MAPBASE
|
||||||
|
{
|
||||||
|
if (!m_bDestroyImmediately)
|
||||||
|
ParticleProp()->StopEmission();
|
||||||
|
else
|
||||||
|
ParticleProp()->StopEmissionAndDestroyImmediately();
|
||||||
|
}
|
||||||
|
#else
|
||||||
{
|
{
|
||||||
ParticleProp()->StopEmission();
|
ParticleProp()->StopEmission();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,21 +152,41 @@ void C_ParticleSystem::ClientThink( void )
|
|||||||
AssertMsg1( pEffect, "Particle system couldn't make %s", pszName );
|
AssertMsg1( pEffect, "Particle system couldn't make %s", pszName );
|
||||||
if (pEffect)
|
if (pEffect)
|
||||||
{
|
{
|
||||||
for ( int i = 0 ; i < kMAXCONTROLPOINTS ; ++i )
|
if (m_vControlPointVecs[0] != GetAbsOrigin() && m_hControlPointEnts[0] == NULL)
|
||||||
{
|
{
|
||||||
CBaseEntity *pOnEntity = m_hControlPointEnts[i].Get();
|
// we are using info_particle_system_coordinate
|
||||||
if ( pOnEntity )
|
for (int i = 0; i < kMAXCONTROLPOINTS; ++i)
|
||||||
{
|
{
|
||||||
ParticleProp()->AddControlPoint( pEffect, i + 1, pOnEntity, PATTACH_ABSORIGIN_FOLLOW );
|
ParticleProp()->AddControlPoint(pEffect, i + 1, this, PATTACH_WORLDORIGIN, 0, m_vControlPointVecs[i] - GetAbsOrigin());
|
||||||
|
|
||||||
|
AssertMsg2(m_iControlPointParents[i] >= 0 && m_iControlPointParents[i] <= kMAXCONTROLPOINTS,
|
||||||
|
"Particle system specified bogus control point parent (%d) for point %d.",
|
||||||
|
m_iControlPointParents[i], i);
|
||||||
|
|
||||||
|
if (m_iControlPointParents[i] != 0)
|
||||||
|
{
|
||||||
|
pEffect->SetControlPointParent(i + 1, m_iControlPointParents[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
AssertMsg2( m_iControlPointParents[i] >= 0 && m_iControlPointParents[i] <= kMAXCONTROLPOINTS ,
|
else
|
||||||
"Particle system specified bogus control point parent (%d) for point %d.",
|
{
|
||||||
m_iControlPointParents[i], i );
|
for ( int i = 0 ; i < kMAXCONTROLPOINTS ; ++i )
|
||||||
|
|
||||||
if (m_iControlPointParents[i] != 0)
|
|
||||||
{
|
{
|
||||||
pEffect->SetControlPointParent(i+1, m_iControlPointParents[i]);
|
CBaseEntity *pOnEntity = m_hControlPointEnts[i].Get();
|
||||||
|
if ( pOnEntity )
|
||||||
|
{
|
||||||
|
ParticleProp()->AddControlPoint( pEffect, i + 1, pOnEntity, PATTACH_ABSORIGIN_FOLLOW );
|
||||||
|
}
|
||||||
|
|
||||||
|
AssertMsg2( m_iControlPointParents[i] >= 0 && m_iControlPointParents[i] <= kMAXCONTROLPOINTS ,
|
||||||
|
"Particle system specified bogus control point parent (%d) for point %d.",
|
||||||
|
m_iControlPointParents[i], i );
|
||||||
|
|
||||||
|
if (m_iControlPointParents[i] != 0)
|
||||||
|
{
|
||||||
|
pEffect->SetControlPointParent(i+1, m_iControlPointParents[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,8 +429,10 @@ void CPixelVisibilityQuery::IssueQuery( IMatRenderContext *pRenderContext, float
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifndef MAPBASE // Mapbase can also query visibility several times via multiple point_cameras, etc.
|
||||||
#ifndef PORTAL // FIXME: In portal we query visibility multiple times per frame because of portal renders!
|
#ifndef PORTAL // FIXME: In portal we query visibility multiple times per frame because of portal renders!
|
||||||
Assert ( ( m_frameIssued != gpGlobals->framecount ) || UseVR() );
|
Assert ( ( m_frameIssued != gpGlobals->framecount ) || UseVR() );
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_frameIssued = gpGlobals->framecount;
|
m_frameIssued = gpGlobals->framecount;
|
||||||
|
@ -75,6 +75,9 @@ public:
|
|||||||
|
|
||||||
bool m_bSlowMovement;
|
bool m_bSlowMovement;
|
||||||
|
|
||||||
|
//Tony; added so tonemap controller can work in multiplayer with inputs.
|
||||||
|
tonemap_params_t m_TonemapParams;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // C_PLAYERLOCALDATA_H
|
#endif // C_PLAYERLOCALDATA_H
|
||||||
|
@ -25,6 +25,10 @@ IMPLEMENT_CLIENTCLASS_DT( C_PointCamera, DT_PointCamera, CPointCamera )
|
|||||||
RecvPropFloat( RECVINFO( m_flFogMaxDensity ) ),
|
RecvPropFloat( RECVINFO( m_flFogMaxDensity ) ),
|
||||||
RecvPropInt( RECVINFO( m_bActive ) ),
|
RecvPropInt( RECVINFO( m_bActive ) ),
|
||||||
RecvPropInt( RECVINFO( m_bUseScreenAspectRatio ) ),
|
RecvPropInt( RECVINFO( m_bUseScreenAspectRatio ) ),
|
||||||
|
#ifdef MAPBASE
|
||||||
|
RecvPropInt( RECVINFO( m_iSkyMode ) ),
|
||||||
|
RecvPropString( RECVINFO( m_iszRenderTarget ) ),
|
||||||
|
#endif
|
||||||
END_RECV_TABLE()
|
END_RECV_TABLE()
|
||||||
|
|
||||||
C_EntityClassList<C_PointCamera> g_PointCameraList;
|
C_EntityClassList<C_PointCamera> g_PointCameraList;
|
||||||
@ -40,6 +44,10 @@ C_PointCamera::C_PointCamera()
|
|||||||
m_bActive = false;
|
m_bActive = false;
|
||||||
m_bFogEnable = false;
|
m_bFogEnable = false;
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
m_iszRenderTarget[0] = '\0';
|
||||||
|
#endif
|
||||||
|
|
||||||
g_PointCameraList.Insert( this );
|
g_PointCameraList.Insert( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +61,16 @@ bool C_PointCamera::ShouldDraw()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void C_PointCamera::OnDataChanged( DataUpdateType_t type )
|
||||||
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Reset render texture
|
||||||
|
m_pRenderTarget = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return BaseClass::OnDataChanged( type );
|
||||||
|
}
|
||||||
|
|
||||||
float C_PointCamera::GetFOV()
|
float C_PointCamera::GetFOV()
|
||||||
{
|
{
|
||||||
return m_FOV;
|
return m_FOV;
|
||||||
@ -113,4 +131,31 @@ void C_PointCamera::GetToolRecordingState( KeyValues *msg )
|
|||||||
msg->SetPtr( "monitor", &state );
|
msg->SetPtr( "monitor", &state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
extern ITexture *GetCameraTexture( void );
|
||||||
|
extern void AddReleaseFunc( void );
|
||||||
|
|
||||||
|
ITexture *C_PointCamera::RenderTarget()
|
||||||
|
{
|
||||||
|
if (m_iszRenderTarget[0] != '\0')
|
||||||
|
{
|
||||||
|
if (!m_pRenderTarget)
|
||||||
|
{
|
||||||
|
// We don't use a CTextureReference for this because we don't want to shut down the texture on removal/change
|
||||||
|
m_pRenderTarget = materials->FindTexture( m_iszRenderTarget, TEXTURE_GROUP_RENDER_TARGET );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_pRenderTarget)
|
||||||
|
return m_pRenderTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetCameraTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLEMENT_CLIENTCLASS_DT( C_PointCameraOrtho, DT_PointCameraOrtho, CPointCameraOrtho )
|
||||||
|
RecvPropInt( RECVINFO( m_bOrtho ) ),
|
||||||
|
RecvPropArray( RecvPropFloat( RECVINFO( m_OrthoDimensions[0] ) ), m_OrthoDimensions ),
|
||||||
|
END_RECV_TABLE()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@ public:
|
|||||||
// C_BaseEntity.
|
// C_BaseEntity.
|
||||||
virtual bool ShouldDraw();
|
virtual bool ShouldDraw();
|
||||||
|
|
||||||
|
// Mapbase uses this for m_iszRenderTarget
|
||||||
|
virtual void OnDataChanged( DataUpdateType_t type );
|
||||||
|
|
||||||
float GetFOV();
|
float GetFOV();
|
||||||
float GetResolution();
|
float GetResolution();
|
||||||
bool IsFogEnabled();
|
bool IsFogEnabled();
|
||||||
@ -37,6 +40,14 @@ public:
|
|||||||
float GetFogMaxDensity();
|
float GetFogMaxDensity();
|
||||||
float GetFogEnd();
|
float GetFogEnd();
|
||||||
bool UseScreenAspectRatio() const { return m_bUseScreenAspectRatio; }
|
bool UseScreenAspectRatio() const { return m_bUseScreenAspectRatio; }
|
||||||
|
#ifdef MAPBASE
|
||||||
|
virtual bool IsOrtho() const { return false; }
|
||||||
|
virtual void GetOrthoDimensions(float &up, float &dn, float &lf, float &rt) const {}
|
||||||
|
|
||||||
|
SkyboxVisibility_t SkyMode() { return m_iSkyMode; }
|
||||||
|
|
||||||
|
ITexture *RenderTarget();
|
||||||
|
#endif
|
||||||
|
|
||||||
virtual void GetToolRecordingState( KeyValues *msg );
|
virtual void GetToolRecordingState( KeyValues *msg );
|
||||||
|
|
||||||
@ -50,11 +61,37 @@ private:
|
|||||||
float m_flFogMaxDensity;
|
float m_flFogMaxDensity;
|
||||||
bool m_bActive;
|
bool m_bActive;
|
||||||
bool m_bUseScreenAspectRatio;
|
bool m_bUseScreenAspectRatio;
|
||||||
|
#ifdef MAPBASE
|
||||||
|
SkyboxVisibility_t m_iSkyMode;
|
||||||
|
ITexture *m_pRenderTarget;
|
||||||
|
char m_iszRenderTarget[64];
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
C_PointCamera *m_pNext;
|
C_PointCamera *m_pNext;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
class C_PointCameraOrtho : public C_PointCamera
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DECLARE_CLASS( C_PointCameraOrtho, C_PointCamera );
|
||||||
|
DECLARE_CLIENTCLASS();
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool IsOrtho() const { return m_bOrtho; }
|
||||||
|
void GetOrthoDimensions( float &up, float &dn, float &lf, float &rt ) const
|
||||||
|
{
|
||||||
|
up = m_OrthoDimensions[0], dn = m_OrthoDimensions[1];
|
||||||
|
lf = m_OrthoDimensions[2], rt = m_OrthoDimensions[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_bOrtho;
|
||||||
|
float m_OrthoDimensions[4];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
C_PointCamera *GetPointCameraList();
|
C_PointCamera *GetPointCameraList();
|
||||||
|
|
||||||
#endif // C_POINTCAMERA_H
|
#endif // C_POINTCAMERA_H
|
||||||
|
File diff suppressed because it is too large
Load Diff
63
sp/src/game/client/c_postprocesscontroller.cpp
Normal file
63
sp/src/game/client/c_postprocesscontroller.cpp
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
|
||||||
|
//
|
||||||
|
// Purpose: stores map postprocess params
|
||||||
|
//
|
||||||
|
//=============================================================================
|
||||||
|
#include "cbase.h"
|
||||||
|
#include "c_postprocesscontroller.h"
|
||||||
|
|
||||||
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
|
IMPLEMENT_CLIENTCLASS_DT( C_PostProcessController, DT_PostProcessController, CPostProcessController )
|
||||||
|
RecvPropArray3( RECVINFO_NAME( m_PostProcessParameters.m_flParameters[0], m_flPostProcessParameters ), POST_PROCESS_PARAMETER_COUNT, RecvPropFloat( RECVINFO_NAME( m_PostProcessParameters.m_flParameters[0], m_flPostProcessParameters[0] ) ) ),
|
||||||
|
RecvPropBool( RECVINFO(m_bMaster) )
|
||||||
|
END_RECV_TABLE()
|
||||||
|
|
||||||
|
C_PostProcessController* C_PostProcessController::ms_pMasterController = nullptr;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
C_PostProcessController::C_PostProcessController()
|
||||||
|
: m_bMaster( false )
|
||||||
|
{
|
||||||
|
if ( ms_pMasterController == nullptr)
|
||||||
|
{
|
||||||
|
ms_pMasterController = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
C_PostProcessController::~C_PostProcessController()
|
||||||
|
{
|
||||||
|
if ( ms_pMasterController == this )
|
||||||
|
{
|
||||||
|
ms_pMasterController = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_PostProcessController::PostDataUpdate( DataUpdateType_t updateType )
|
||||||
|
{
|
||||||
|
BaseClass::PostDataUpdate( updateType );
|
||||||
|
|
||||||
|
if ( m_bMaster )
|
||||||
|
{
|
||||||
|
ms_pMasterController = this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
// Prevents parameters from fading after a save/restore
|
||||||
|
bool g_bPostProcessNeedsRestore = false;
|
||||||
|
|
||||||
|
void C_PostProcessController::OnRestore()
|
||||||
|
{
|
||||||
|
BaseClass::OnRestore();
|
||||||
|
|
||||||
|
C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
|
||||||
|
if ( pPlayer && pPlayer->GetActivePostProcessController() == this )
|
||||||
|
{
|
||||||
|
// Tell clientmode this is part of a save/restore
|
||||||
|
g_bPostProcessNeedsRestore = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user