Compare commits
684
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7d1eb398cf | ||
|
|
97df54a760 | ||
|
|
2edada8ce3 | ||
|
|
17e85df813 | ||
|
|
a3b5c4dff8 | ||
|
|
8c8fe976d7 | ||
|
|
8c43857bd3 | ||
|
|
380c8f65c8 | ||
|
|
5ec0af62d9 | ||
|
|
3762b18159 | ||
|
|
b6de9e03d7 | ||
|
|
486f386f35 | ||
|
|
848d84147f | ||
|
|
a980784771 | ||
|
|
0f675661a6 | ||
|
|
30deff7697 | ||
|
|
21c267b319 | ||
|
|
cce363c8c8 | ||
|
|
c081349f9b | ||
|
|
88b78a5bf7 | ||
|
|
cf9e7ff37b | ||
|
|
8775e5abc1 | ||
|
|
fe6b5a83f8 | ||
|
|
288bcbd419 | ||
|
|
4465b05bc8 | ||
|
|
537aa30cfe | ||
|
|
e16ef100b8 | ||
|
|
a277d70ce2 | ||
|
|
6932a52463 | ||
|
|
a686b29a7a | ||
|
|
c133f0d751 | ||
|
|
5ff125a429 | ||
|
|
b8cab84d2a | ||
|
|
d2975d2dcb | ||
|
|
e802ecf0b5 | ||
|
|
71378285b2 | ||
|
|
ffe9a89552 | ||
|
|
ac9926eb17 | ||
|
|
0b57389dcd | ||
|
|
e2b42b1647 | ||
|
|
ad39ade286 | ||
|
|
0ed21a171d | ||
|
|
ad65e3e968 | ||
|
|
d55d7e0efc | ||
|
|
ec7fa833d5 | ||
|
|
2e6c1d9df4 | ||
|
|
7d55c46979 | ||
|
|
af2b22e91f | ||
|
|
e983174559 | ||
|
|
3bde3b04ae | ||
|
|
9e070a6516 | ||
|
|
8d9c6ec65f | ||
|
|
ec263086d8 | ||
|
|
06ccb4f7b0 | ||
|
|
95daa7eacc | ||
|
|
d18afa1781 | ||
|
|
883c382a1d | ||
|
|
c82eb25628 | ||
|
|
8c0294898e | ||
|
|
d09c8bb8fd | ||
|
|
d397a07d96 | ||
|
|
96f842fd96 | ||
|
|
105b3f37eb | ||
|
|
24387b50bd | ||
|
|
0c4661c2a7 | ||
|
|
178c942dc6 | ||
|
|
47d41e2c2a | ||
|
|
4d7c223565 | ||
|
|
e3af2b0d58 | ||
|
|
f4ed9b43cd | ||
|
|
55cd0fa08f | ||
|
|
8cce4f3ccf | ||
|
|
1e21f6a378 | ||
|
|
a0af6f2461 | ||
|
|
390e3db25d | ||
|
|
3d9bb65e62 | ||
|
|
4f88a97739 | ||
|
|
de977167ca | ||
|
|
84028f52d8 | ||
|
|
f693ca8333 | ||
|
|
64dd17d75d | ||
|
|
b3ce832753 | ||
|
|
b9c89b381b | ||
|
|
c8a0a2bdae | ||
|
|
84d3d0d891 | ||
|
|
fe42f1bd3e | ||
|
|
b5803e8787 | ||
|
|
9f7aca5fe3 | ||
|
|
ac8e25865e | ||
|
|
02b411f7ee | ||
|
|
9dee892244 | ||
|
|
e5d832a642 | ||
|
|
b069c2cb3e | ||
|
|
7235f9864e | ||
|
|
e4e1f0c645 | ||
|
|
54747c6b53 | ||
|
|
9ed242cde2 | ||
|
|
9bcfe63e3e | ||
|
|
b38460473d | ||
|
|
fd77beabe1 | ||
|
|
5dfab42fcf | ||
|
|
72d94b77ac | ||
|
|
54d73206ca | ||
|
|
8f342110c9 | ||
|
|
1af9903439 | ||
|
|
b4269cba3e | ||
|
|
70a985e274 | ||
|
|
f15f24914d | ||
|
|
75d69dc90d | ||
|
|
7322d553ba | ||
|
|
9efd24e376 | ||
|
|
1eae8c6ea3 | ||
|
|
14881e968a | ||
|
|
5f0b2b0604 | ||
|
|
73ea95ae61 | ||
|
|
affa366f7d | ||
|
|
7d62b330d0 | ||
|
|
b398dacf29 | ||
|
|
a6a53f6b9c | ||
|
|
ccc1c07930 | ||
|
|
d39e9447f3 | ||
|
|
cd44e2d80c | ||
|
|
36a1662afb | ||
|
|
88d5ca0b8a | ||
|
|
ce00aef8b1 | ||
|
|
c7a24199c7 | ||
|
|
6e81cdcb01 | ||
|
|
2a05f630b3 | ||
|
|
bf9b738a0f | ||
|
|
50fced2867 | ||
|
|
6276243cc4 | ||
|
|
22c48f19ba | ||
|
|
9872640e77 | ||
|
|
80f7ddfb31 | ||
|
|
5215fa4747 | ||
|
|
7016b77ee8 | ||
|
|
5edb0d0e3d | ||
|
|
a2c1fa5e23 | ||
|
|
520f92e892 | ||
|
|
305d408e02 | ||
|
|
8ccb747dcd | ||
|
|
a1d5a2e1f9 | ||
|
|
2f56487290 | ||
|
|
2ebf66b99c | ||
|
|
bab120235d | ||
|
|
36404fd93d | ||
|
|
3b90038b62 | ||
|
|
40660f2379 | ||
|
|
7ab7193592 | ||
|
|
1fabc14ac9 | ||
|
|
d9492eee28 | ||
|
|
0dd4f3b3d3 | ||
|
|
49cefa92e2 | ||
|
|
2b13af2367 | ||
|
|
97a5c15c36 | ||
|
|
b1fa124032 | ||
|
|
a15de64160 | ||
|
|
af3a23ce66 | ||
|
|
b55c654a81 | ||
|
|
b97841b6fd | ||
|
|
ac64428abb | ||
|
|
1857ce5113 | ||
|
|
f4f3f6e29c | ||
|
|
9354a0ab88 | ||
|
|
6ef9c0b305 | ||
|
|
6b951d2773 | ||
|
|
064e9d58af | ||
|
|
1d5092cf22 | ||
|
|
861d35e8d3 | ||
|
|
6d94ff8d1f | ||
|
|
bfabdb7b6a | ||
|
|
7f9edddbcc | ||
|
|
883cd3f516 | ||
|
|
a3e2d3ec71 | ||
|
|
7213f0dd5d | ||
|
|
3bbdd1ea72 | ||
|
|
2b09e74dcf | ||
|
|
5dc76d07ec | ||
|
|
ebfafd7b6e | ||
|
|
24ca9fdafa | ||
|
|
8cdb920f54 | ||
|
|
cccf6449f9 | ||
|
|
9bd2da04e2 | ||
|
|
56563507b6 | ||
|
|
fa98b06dba | ||
|
|
a763d85122 | ||
|
|
db8b1ca0a3 | ||
|
|
5106c391bb | ||
|
|
0c2e285d2e | ||
|
|
f7df80f763 | ||
|
|
676265a92a | ||
|
|
f9ee18584e | ||
|
|
3d394bb621 | ||
|
|
913c0f4ae7 | ||
|
|
04bf086a9e | ||
|
|
2a25328ce0 | ||
|
|
af7393832a | ||
|
|
516bea6e8a | ||
|
|
82bd65eebd | ||
|
|
44b6c53452 | ||
|
|
28b294f48a | ||
|
|
56ed32d094 | ||
|
|
60d81037fd | ||
|
|
8abe40cc81 | ||
|
|
cd9df8065d | ||
|
|
b6d50da809 | ||
|
|
383cc71bb3 | ||
|
|
d75c16bab5 | ||
|
|
8efdbe40e4 | ||
|
|
ada779a97d | ||
|
|
37d28464ea | ||
|
|
816ad7c2fc | ||
|
|
c4d1f9c6a2 | ||
|
|
33e1cfc2ba | ||
|
|
bce9990826 | ||
|
|
923e0500df | ||
|
|
017646e704 | ||
|
|
4900177e8c | ||
|
|
ed97d28254 | ||
|
|
15185e0450 | ||
|
|
a29f8d5f38 | ||
|
|
8dc2d22996 | ||
|
|
4d355f99c0 | ||
|
|
aa0bf396e7 | ||
|
|
1db9bcd6c9 | ||
|
|
6f7a52a6a6 | ||
|
|
cd3e664e6a | ||
|
|
e7d3e03169 | ||
|
|
4e4871fe93 | ||
|
|
51067f2802 | ||
|
|
62a65c5c1d | ||
|
|
b9e23113c8 | ||
|
|
50f1a61182 | ||
|
|
ed9adfae68 | ||
|
|
cb4ef15c77 | ||
|
|
e4e18f0a62 | ||
|
|
ab8cbcb450 | ||
|
|
4103fac605 | ||
|
|
0a58797f78 | ||
|
|
5db7f5f2e7 | ||
|
|
47a3de8fe1 | ||
|
|
2b725560cc | ||
|
|
9f9cb833f0 | ||
|
|
f88290d34e | ||
|
|
157ff2df4f | ||
|
|
a9117573fb | ||
|
|
cea28c591f | ||
|
|
b963146faa | ||
|
|
181c948e86 | ||
|
|
d3b8e11783 | ||
|
|
b3b19eff49 | ||
|
|
67aa31439b | ||
|
|
ff895f3251 | ||
|
|
130c1aba67 | ||
|
|
a07c2f4c32 | ||
|
|
96b7a4efe6 | ||
|
|
124b2ff431 | ||
|
|
c1ec72e606 | ||
|
|
ef1faf9f68 | ||
|
|
02595b9ea6 | ||
|
|
c1514635b0 | ||
|
|
e5e7205c95 | ||
|
|
f8d1bf0811 | ||
|
|
a1f185b0f0 | ||
|
|
8981ae3117 | ||
|
|
2a948ca4c2 | ||
|
|
d9f0c55fee | ||
|
|
50d2bf5d8d | ||
|
|
d39fd5bb5c | ||
|
|
1a9865ebc4 | ||
|
|
a11227b15a | ||
|
|
38b52b826a | ||
|
|
51e367a61d | ||
|
|
165803c95c | ||
|
|
d01ed38895 | ||
|
|
cdfef0f884 | ||
|
|
ddc8e4a29e | ||
|
|
f74cd97c4b | ||
|
|
bb91d8e1e3 | ||
|
|
ee8fd22f36 | ||
|
|
c0d4599a35 | ||
|
|
5c5a5e200e | ||
|
|
864d747e3b | ||
|
|
d41b6c185a | ||
|
|
03e45f4590 | ||
|
|
ce31ceda65 | ||
|
|
c8737bd43f | ||
|
|
eff6b31ee8 | ||
|
|
03259aeca0 | ||
|
|
dbb5c1482b | ||
|
|
afa66d0418 | ||
|
|
7177b396e0 | ||
|
|
e796f7e81f | ||
|
|
890779713a | ||
|
|
c4c995a9a3 | ||
|
|
718fe7e8ae | ||
|
|
1d8be20962 | ||
|
|
a90c51ec0f | ||
|
|
077076532f | ||
|
|
7ca2051f84 | ||
|
|
8ff5cc7cbb | ||
|
|
92649a393d | ||
|
|
98db1a5757 | ||
|
|
e53c6bb4da | ||
|
|
5c8b318a93 | ||
|
|
029907a87a | ||
|
|
2f4a113685 | ||
|
|
f512a08051 | ||
|
|
338bcf0d2d | ||
|
|
8cb7396f33 | ||
|
|
b69bb85003 | ||
|
|
f9b1071539 | ||
|
|
7d47834e55 | ||
|
|
2e1120dc50 | ||
|
|
64a2fe1410 | ||
|
|
caa09cbcfb | ||
|
|
ba4329e623 | ||
|
|
575e46c3db | ||
|
|
45237c9298 | ||
|
|
7de32c74e6 | ||
|
|
01b942e1fc | ||
|
|
3388d35fe0 | ||
|
|
2f014bb505 | ||
|
|
f9f7090b63 | ||
|
|
0bc95e4b5e | ||
|
|
c5b70ccc4a | ||
|
|
8b94aded16 | ||
|
|
e105d8f51e | ||
|
|
30dc0abc25 | ||
|
|
a7a6e9edfc | ||
|
|
854cb7ee49 | ||
|
|
f7ca8fb943 | ||
|
|
54fda32591 | ||
|
|
5d44b44558 | ||
|
|
e321d759c0 | ||
|
|
bb3a65f8ff | ||
|
|
8da59dc288 | ||
|
|
8f0c5fb508 | ||
|
|
5e1d43b5af | ||
|
|
487018f146 | ||
|
|
3ade8b09c5 | ||
|
|
3180221a42 | ||
|
|
9c37a8472e | ||
|
|
136d9143e7 | ||
|
|
4aad4887fd | ||
|
|
ffc7832ec7 | ||
|
|
3910e66905 | ||
|
|
6fcfb9cf36 | ||
|
|
83d2ade699 | ||
|
|
fef98e478d | ||
|
|
f7ba260717 | ||
|
|
82f9f2f73f | ||
|
|
182500c2d2 | ||
|
|
aca48d45b3 | ||
|
|
b2823c81e4 | ||
|
|
761df3f2cf | ||
|
|
6f3443232e | ||
|
|
588dac343e | ||
|
|
aa222b6861 | ||
|
|
6d01ec4c55 | ||
|
|
f72c64d7d1 | ||
|
|
92a3e974b0 | ||
|
|
7d6cce5881 | ||
|
|
b3323b7c2d | ||
|
|
70e64d9471 | ||
|
|
cbc3f8e917 | ||
|
|
55dfdc723f | ||
|
|
27d6447a83 | ||
|
|
26480882c8 | ||
|
|
b23020435f | ||
|
|
267e2be69b | ||
|
|
2112be8ef7 | ||
|
|
e5ee978eb2 | ||
|
|
55fd31894b | ||
|
|
189d9adef5 | ||
|
|
44288a5865 | ||
|
|
66f89fb4ad | ||
|
|
eceb671ea8 | ||
|
|
a15615a229 | ||
|
|
8e10bcc739 | ||
|
|
22e65cd5e7 | ||
|
|
72383520cb | ||
|
|
38ef55b869 | ||
|
|
ca09a5dd46 | ||
|
|
11546cd906 | ||
|
|
4110130ca7 | ||
|
|
6b9900ad4e | ||
|
|
3d39f50388 | ||
|
|
f355b2269c | ||
|
|
da9c19bba4 | ||
|
|
3156851554 | ||
|
|
a19cb5f2bc | ||
|
|
2639f94dff | ||
|
|
2c769f8043 | ||
|
|
332f7db32f | ||
|
|
3381f6af3a | ||
|
|
45d33b951c | ||
|
|
1922b32799 | ||
|
|
6bb72c363f | ||
|
|
378382f3ad | ||
|
|
7e09493cf2 | ||
|
|
126fce9119 | ||
|
|
0b5879ffb3 | ||
|
|
0bd2c6220d | ||
|
|
a434ce2080 | ||
|
|
c8193380e7 | ||
|
|
e38580c9c2 | ||
|
|
c46ff7daff | ||
|
|
d2ca916043 | ||
|
|
09e901b31b | ||
|
|
4418653edb | ||
|
|
1d9bcaa786 | ||
|
|
8bd943eb71 | ||
|
|
b24c59ce55 | ||
|
|
0290c738e1 | ||
|
|
0acb8e6a63 | ||
|
|
27bfd0078c | ||
|
|
a98ab3d823 | ||
|
|
bbf4de4f5e | ||
|
|
f20297b5dd | ||
|
|
b4521643b2 | ||
|
|
67a75730d0 | ||
|
|
d12369f6f4 | ||
|
|
4a7ce87ac2 | ||
|
|
d8b36ef0da | ||
|
|
1341ec80bf | ||
|
|
9882291828 | ||
|
|
aa4fa1e42e | ||
|
|
8a641d3e37 | ||
|
|
317f5f8d48 | ||
|
|
92c0ddd068 | ||
|
|
4f037896db | ||
|
|
494a87feea | ||
|
|
4a3af6bc8a | ||
|
|
0c7851bd26 | ||
|
|
5b46ae2eb9 | ||
|
|
2034eedbe4 | ||
|
|
fde4f64b83 | ||
|
|
404927c53c | ||
|
|
e0796b0cf1 | ||
|
|
8df8749a9c | ||
|
|
1c2fb14f45 | ||
|
|
82f70ff75e | ||
|
|
46b2d5fbcd | ||
|
|
23b2e35dbd | ||
|
|
a576ddf0e4 | ||
|
|
df63b3ece0 | ||
|
|
3174d8fb1c | ||
|
|
bed0e65548 | ||
|
|
1357978596 | ||
|
|
c5765c20bc | ||
|
|
52cd614613 | ||
|
|
db04046cb3 | ||
|
|
5ec48f72e0 | ||
|
|
909307f5ce | ||
|
|
7c7582f09b | ||
|
|
6f6dff4897 | ||
|
|
8611e70ba3 | ||
|
|
7edce19c9c | ||
|
|
de52b1663d | ||
|
|
7a1c6bd9e4 | ||
|
|
d8fe3920b1 | ||
|
|
75af036fcf | ||
|
|
accc9890df | ||
|
|
a920556feb | ||
|
|
351cb4a1ac | ||
|
|
cb97973b1c | ||
|
|
331f09cdd9 | ||
|
|
939084d57b | ||
|
|
1cbfc71fc6 | ||
|
|
7b550200f0 | ||
|
|
665a11fa2b | ||
|
|
1a49b161cc | ||
|
|
99e4870a52 | ||
|
|
13ad27bc90 | ||
|
|
7ae361cb7c | ||
|
|
0e1bfbb0b5 | ||
|
|
3dec352245 | ||
|
|
8e273a1f19 | ||
|
|
1ab20814e9 | ||
|
|
37649a0d3c | ||
|
|
f3d1bf1106 | ||
|
|
93311c628e | ||
|
|
f8dfc954a0 | ||
|
|
dbe5f8a4ba | ||
|
|
a05c38b1fe | ||
|
|
91b6143f15 | ||
|
|
0eaedd4b5e | ||
|
|
727a31fdb5 | ||
|
|
3b64263dc6 | ||
|
|
83b6a63f13 | ||
|
|
f6f6600118 | ||
|
|
04c0bf2f17 | ||
|
|
4da9c5ac07 | ||
|
|
97cae4de59 | ||
|
|
9d1bef9ab9 | ||
|
|
74088c1d26 | ||
|
|
b03e74c366 | ||
|
|
cd9ee7d139 | ||
|
|
3080f2953d | ||
|
|
f7c7dae3a5 | ||
|
|
3f16f42adf | ||
|
|
feeb2d0f1a | ||
|
|
4c680808c1 | ||
|
|
13a5909c3f | ||
|
|
40be4d25a5 | ||
|
|
d84f887be8 | ||
|
|
7b2e763d07 | ||
|
|
bc29d77aff | ||
|
|
8db2e646db | ||
|
|
3b2e207b6b | ||
|
|
f061d66a16 | ||
|
|
8c295e8d5f | ||
|
|
c1b771fdc8 | ||
|
|
e5b12ece35 | ||
|
|
43c99f8851 | ||
|
|
7304988071 | ||
|
|
d0b0a7490a | ||
|
|
de4bcec782 | ||
|
|
0e843c2a96 | ||
|
|
9abd34baa3 | ||
|
|
4fca31049f | ||
|
|
13f6b62dc0 | ||
|
|
3a5b282b9b | ||
|
|
d763456655 | ||
|
|
b23fa084f1 | ||
|
|
216acf083a | ||
|
|
686a9f7237 | ||
|
|
5a206822c5 | ||
|
|
9805b03533 | ||
|
|
d519f9cf06 | ||
|
|
6265d0e38e | ||
|
|
55d9d64910 | ||
|
|
e2a651e553 | ||
|
|
e4343f0935 | ||
|
|
68090a55e1 | ||
|
|
00bdd684ed | ||
|
|
f4e498e559 | ||
|
|
39c33b1f59 | ||
|
|
55acbb208e | ||
|
|
208f96535e | ||
|
|
64bda53a78 | ||
|
|
e016777331 | ||
|
|
508cab4a0d | ||
|
|
b779be3574 | ||
|
|
fddcebc2d2 | ||
|
|
91c5dc3c19 | ||
|
|
9401eb1591 | ||
|
|
521bb88cda | ||
|
|
c1765258b2 | ||
|
|
6afcb06e08 | ||
|
|
1ae5bb9d27 | ||
|
|
252cd5cde5 | ||
|
|
12558740a4 | ||
|
|
e1fbe8d657 | ||
|
|
b29a3ecfba | ||
|
|
bd3a5ac284 | ||
|
|
7de8b2d881 | ||
|
|
3139dff6ba | ||
|
|
c4211045f2 | ||
|
|
6633dfe1e2 | ||
|
|
9e2a48cae1 | ||
|
|
43f8a0213a | ||
|
|
975978ca9c | ||
|
|
dad630f3eb | ||
|
|
11f8b974df | ||
|
|
00773a0c10 | ||
|
|
6f6066906e | ||
|
|
7730b69ef4 | ||
|
|
e3084cc28e | ||
|
|
b784fc58d0 | ||
|
|
8baa972bb2 | ||
|
|
3b2251017c | ||
|
|
f0e7dace72 | ||
|
|
4a837d3339 | ||
|
|
a2aa43e7fc | ||
|
|
3c0899263f | ||
|
|
91bb601ecb | ||
|
|
1bd0c5d9bf | ||
|
|
8b76426825 | ||
|
|
85464921ba | ||
|
|
9b6034853f | ||
|
|
0ab732c9b2 | ||
|
|
8662648ef5 | ||
|
|
51808b8ced | ||
|
|
2a7e442544 | ||
|
|
dbdd5b8b6e | ||
|
|
b8483376c4 | ||
|
|
70105ccefc | ||
|
|
3a9082a694 | ||
|
|
82c18be717 | ||
|
|
0d39c2a0f6 | ||
|
|
4240af23cf | ||
|
|
80697046d5 | ||
|
|
765dd72b38 | ||
|
|
403b60240f | ||
|
|
f973e6cd72 | ||
|
|
5aff1acea8 | ||
|
|
9e07ca0007 | ||
|
|
df97bef4b5 | ||
|
|
b402738428 | ||
|
|
2de9a6bb94 | ||
|
|
fb0c88cf55 | ||
|
|
1f6096e3ff | ||
|
|
a4e6b5d177 | ||
|
|
4477f5ab93 | ||
|
|
11992d2e08 | ||
|
|
802979b81d | ||
|
|
06d0f5b95b | ||
|
|
da06c84aa4 | ||
|
|
ecae607b59 | ||
|
|
f26717954e | ||
|
|
a4080980ec | ||
|
|
3db21bf778 | ||
|
|
66518ced75 | ||
|
|
5598526f52 | ||
|
|
14ec6e0674 | ||
|
|
549112822a | ||
|
|
e1cb858d9a | ||
|
|
1659c2e753 | ||
|
|
e2222f66a9 | ||
|
|
8a15b5e640 | ||
|
|
f499b11113 | ||
|
|
bec632800d | ||
|
|
a14c2f59b8 | ||
|
|
e66d215dd3 | ||
|
|
809ae20558 | ||
|
|
7b26ecb5f5 | ||
|
|
0c2ccc56cd | ||
|
|
525681b5a5 | ||
|
|
c9a3dfcac9 | ||
|
|
a05aab1c7b | ||
|
|
7dfc638305 | ||
|
|
3585969285 | ||
|
|
3361ebe3c5 | ||
|
|
ebfd7f3e4e | ||
|
|
e2c8a773be | ||
|
|
6816c6dd19 | ||
|
|
b9e26a7e2f | ||
|
|
52f1d727c0 | ||
|
|
80a29dc5a1 | ||
|
|
54cbfbe699 | ||
|
|
05f454157f | ||
|
|
86ea7dde40 | ||
|
|
0be25bd362 | ||
|
|
cb94235ac1 | ||
|
|
d0c50c49a7 | ||
|
|
7f1217b2ab | ||
|
|
3b01393a71 | ||
|
|
ef763487a5 | ||
|
|
03f5ac87fa | ||
|
|
b2cac97106 | ||
|
|
c3ce75055a | ||
|
|
90d64c4e15 | ||
|
|
595648a2b3 | ||
|
|
8e799ddd74 | ||
|
|
a754e9c08a | ||
|
|
112c9398e7 | ||
|
|
ccd691548e | ||
|
|
afd7b85005 | ||
|
|
f9e1cdb940 | ||
|
|
63fe657c7d | ||
|
|
63f649724e | ||
|
|
df10262ebb | ||
|
|
a87ac3e35e | ||
|
|
b71d9d2e68 | ||
|
|
cc44a5785d | ||
|
|
172d2bf545 | ||
|
|
7493b3d2ab | ||
|
|
31370741f2 | ||
|
|
e187f73044 | ||
|
|
3aa55ee9c3 | ||
|
|
8cfc8a5492 | ||
|
|
3f1c8db362 | ||
|
|
0d999d7a70 | ||
|
|
8bc081d937 | ||
|
|
42eb8d1af5 | ||
|
|
1a810bc923 | ||
|
|
065572ef64 | ||
|
|
e88702e10c | ||
|
|
ee2d934525 | ||
|
|
2a3a33226e | ||
|
|
539315710c | ||
|
|
191a6ca76f |
No files matched your search
@@ -28,6 +28,10 @@ exist.
|
||||
Returns the values of the given HUD item's `xoffset`/`yoffset` cvars.
|
||||
Available for any HUD item with offset cvars.
|
||||
|
||||
## patch = v.cachePatchRotated(name, rollangle)
|
||||
Like v.cachePatch, it caches a new patch with the corresponding name. Unlike v.cachePatch, however,
|
||||
a rollangle can be supplied to the function so that it returns a rotated patch instead.
|
||||
|
||||
## x, y, flags = v.getDrawInfo(item)
|
||||
|
||||
Returns the X, Y and flags where the given HUD item will be drawn for the current displayplayer.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
ifdef SILENT
|
||||
MAKEFLAGS+=--no-print-directory
|
||||
endif
|
||||
|
||||
all :
|
||||
|
||||
% ::
|
||||
@$(MAKE) -C src $(MAKECMDGOALS)
|
||||
@@ -76,7 +76,7 @@ Crashlogs now contain alot more informations. and even more if your build has de
|
||||
Also allows 64bit Windows builds to produce Crashlogs!
|
||||
|
||||
## MISC
|
||||
- Bird's Camara Tilting feature is no longer turned on by default
|
||||
- Bird's Camera Tilting feature is no longer turned on by default
|
||||
- Bird's warning on the title screen has been removed
|
||||
|
||||
## Bugs
|
||||
|
||||
+1
-1
@@ -487,7 +487,7 @@ if(${SRB2_CONFIG_HWRENDER})
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_gl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.h
|
||||
|
||||
+5
-75
@@ -31,18 +31,6 @@
|
||||
# compile all HW render and 3D sound DLLs for the set
|
||||
# opengl_dll
|
||||
# Pure Mingw only, compile OpenGL HW render DLL
|
||||
# minigl_dll
|
||||
# Pure Mingw only, compile MiniGL HW render DLL
|
||||
# ds3d_dll
|
||||
# Pure Mingw only, compile DirectX DirectSound HW sound DLL
|
||||
# fmod_dll
|
||||
# Pure Mingw only, compile FMOD HW sound DLL
|
||||
# openal_dll
|
||||
# Pure Mingw only, compile OpenAL HW sound DLL
|
||||
# fmod_so
|
||||
# Non-Mingw, compile FMOD HW sound SO
|
||||
# openal_so
|
||||
# Non-Mingw, compile OpenAL HW sound SO
|
||||
#
|
||||
#
|
||||
# Addon:
|
||||
@@ -69,10 +57,7 @@
|
||||
# Compile without SDL_Mixer, add 'NOMIXER=1'
|
||||
# Compile without BSD API, add 'NONET=1'
|
||||
# Compile without IPX/SPX, add 'NOIPX=1'
|
||||
# Compile Mingw/SDL with S_DS3S, add 'DS3D=1'
|
||||
# Compile without libopenmpt, add 'NOOPENMPT=1'
|
||||
# Compile with S_FMOD3D, add 'FMOD=1' (WIP)
|
||||
# Compile with S_OPENAL, add 'OPENAL=1' (WIP)
|
||||
# To link with the whole SDL_Image lib to load Icons, add 'SDL_IMAGE=1' but it isn't not realy needed
|
||||
# To link with SDLMain to hide console or make on a console-less binary, add 'SDLMAIN=1'
|
||||
#
|
||||
@@ -229,6 +214,7 @@ endif
|
||||
|
||||
ifdef LINUX
|
||||
UNIXCOMMON=1
|
||||
NOOBJDUMP=1
|
||||
ifndef NOGME
|
||||
HAVE_LIBGME=1
|
||||
endif
|
||||
@@ -297,7 +283,7 @@ else
|
||||
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o
|
||||
endif
|
||||
|
||||
OPTS += -DCOMPVERSION -fwrapv
|
||||
OPTS += -DCOMPVERSION
|
||||
|
||||
ifndef NONX86
|
||||
ifndef GCC29
|
||||
@@ -690,7 +676,7 @@ else
|
||||
dll : opengl_dll
|
||||
endif
|
||||
ifdef MINGW
|
||||
all_dll: opengl_dll ds3d_dll fmod_dll openal_dll
|
||||
all_dll: opengl_dll
|
||||
|
||||
opengl_dll: $(BIN)/r_opengl.dll
|
||||
$(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
|
||||
@@ -700,44 +686,13 @@ $(BIN)/r_opengl.dll: $(OBJDIR)/ogl_win.o $(OBJDIR)/r_opengl.o
|
||||
ifndef NOUPX
|
||||
-$(UPX) $(UPX_OPTS) $@
|
||||
endif
|
||||
|
||||
ds3d_dll: $(BIN)/s_ds3d.dll
|
||||
$(BIN)/s_ds3d.dll: $(OBJDIR)/s_ds3d.o
|
||||
@echo Linking S_DS3d.dll...
|
||||
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -ldsound -luuid
|
||||
|
||||
fmod_dll: $(BIN)/s_fmod.dll
|
||||
$(BIN)/s_fmod.dll: $(OBJDIR)/s_fmod.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking S_FMOD.dll...
|
||||
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lfmod
|
||||
|
||||
openal_dll: $(BIN)/s_openal.dll
|
||||
$(BIN)/s_openal.dll: $(OBJDIR)/s_openal.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking S_OpenAL.dll...
|
||||
$(CC) --shared $^ -o $@ -g -Wl,--add-stdcall-alias -lopenal32
|
||||
else
|
||||
all_dll: fmod_so openal_so
|
||||
|
||||
fmod_so: $(BIN)/s_fmod.so
|
||||
$(BIN)/s_fmod.so: $(OBJDIR)/s_fmod.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking S_FMOD.so...
|
||||
$(CC) --shared $^ -o $@ -g --nostartfiles -lm -lfmod
|
||||
|
||||
openal_so: $(BIN)/s_openal.so
|
||||
$(BIN)/s_openal.so: $(OBJDIR)/s_openal.o
|
||||
-$(MKDIR) $(BIN)
|
||||
@echo Linking S_OpenAL.so...
|
||||
$(CC) --shared $^ -o $@ -g --nostartfiles -lm -lopenal
|
||||
endif
|
||||
|
||||
else
|
||||
ifdef SDL
|
||||
ifdef MINGW
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h\
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
@@ -746,7 +701,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
else
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gl.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h \
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
@@ -822,31 +777,6 @@ $(OBJDIR)/win_dbg.o: win32/win_dbg.c
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
endif
|
||||
|
||||
ifdef STATICHS
|
||||
$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
|
||||
ifdef MINGW
|
||||
$(OBJDIR)/s_ds3d.o: hardware/s_ds3d/s_ds3d.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
endif
|
||||
else
|
||||
|
||||
$(OBJDIR)/s_fmod.o: hardware/s_fmod/s_fmod.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_fmod.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_fmod/s_fmod.c
|
||||
|
||||
$(OBJDIR)/s_openal.o: hardware/s_openal/s_openal.c hardware/hw3dsdrv.h \
|
||||
hardware/hw_dll.h
|
||||
$(CC) $(ARCHOPTS) -Os -o $(OBJDIR)/s_openal.o -DHW3SOUND -DUNIXCOMMON -shared -nostartfiles -c hardware/s_openal/s_openal.c
|
||||
endif
|
||||
|
||||
ifdef FILTERS
|
||||
$(OBJDIR)/%.o: $(INTERFACE)/filter/%.c
|
||||
@echo $< needs deps
|
||||
|
||||
+372
-111
@@ -1,8 +1,10 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
|
||||
// Copyright (C) 2024 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -26,43 +28,37 @@
|
||||
#endif
|
||||
|
||||
// For use if I do walls with outsides/insides
|
||||
static const UINT8 REDS = (8*16);
|
||||
static const UINT8 REDS = (2*16);
|
||||
static const UINT8 REDRANGE = 16;
|
||||
static const UINT8 GRAYS = (1*16);
|
||||
static const UINT8 GRAYSRANGE = 16;
|
||||
static const UINT8 BROWNS = (3*16);
|
||||
static const UINT8 YELLOWS = (7*16);
|
||||
static const UINT8 GREENS = (10*16);
|
||||
static const UINT8 BROWNS = (15*16);
|
||||
static const UINT8 YELLOWS = (5*16)+8;
|
||||
static const UINT8 GREENS = (6*16);
|
||||
static const UINT8 BLUES = (9*16);
|
||||
static const UINT8 DBLACK = 31;
|
||||
static const UINT8 DWHITE = 0;
|
||||
|
||||
static const UINT8 NOCLIMBREDS = 248;
|
||||
static const UINT8 NOCLIMBREDRANGE = 8;
|
||||
static const UINT8 NOCLIMBGRAYS = 204;
|
||||
static const UINT8 NOCLIMBBROWNS = (2*16);
|
||||
static const UINT8 NOCLIMBYELLOWS = (11*16);
|
||||
|
||||
// Automap colors
|
||||
#define BACKGROUND DBLACK
|
||||
#define WALLCOLORS (REDS + REDRANGE/2)
|
||||
#define WALLRANGE (REDRANGE/2)
|
||||
#define NOCLIMBWALLCOLORS (NOCLIMBREDS + NOCLIMBREDRANGE/2)
|
||||
#define NOCLIMBWALLRANGE (NOCLIMBREDRANGE/2)
|
||||
#define THOKWALLCOLORS REDS
|
||||
#define THOKWALLRANGE REDRANGE
|
||||
#define NOCLIMBTHOKWALLCOLORS NOCLIMBREDS
|
||||
#define NOCLIMBTHOKWALLRANGE NOCLIMBREDRANGE
|
||||
#define TSWALLCOLORS GRAYS
|
||||
#define TSWALLRANGE GRAYSRANGE
|
||||
#define NOCLIMBTSWALLCOLORS NOCLIMBGRAYS
|
||||
#define TSWALLCOLORS DWHITE
|
||||
#define TSFINISHLINE GRAYS
|
||||
#define TSFOFINFO (BLUES + 4)
|
||||
#define FDWALLCOLORS BROWNS
|
||||
#define NOCLIMBFDWALLCOLORS NOCLIMBBROWNS
|
||||
#define CDWALLCOLORS YELLOWS
|
||||
#define NOCLIMBCDWALLCOLORS NOCLIMBYELLOWS
|
||||
#define THINGCOLORS GREENS
|
||||
#define GRIDCOLORS (GRAYS + GRAYSRANGE/2)
|
||||
#define XHAIRCOLORS GRAYS
|
||||
|
||||
// Automap passes
|
||||
#define PASS_SOLID 1
|
||||
#define PASS_INTANGIBLE 2
|
||||
#define PASS_FOF 4
|
||||
|
||||
// controls
|
||||
#define AM_PANUPKEY KEY_UPARROW
|
||||
#define AM_PANDOWNKEY KEY_DOWNARROW
|
||||
@@ -110,11 +106,6 @@ typedef struct
|
||||
mpoint_t a, b;
|
||||
} mline_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t slp, islp;
|
||||
} islope_t;
|
||||
|
||||
//
|
||||
// The vector graphics for the automap.
|
||||
// A line drawing of the player pointing right,
|
||||
@@ -136,16 +127,14 @@ static const mline_t player_arrow[] = {
|
||||
#undef R
|
||||
#define NUMPLYRLINES (sizeof (player_arrow)/sizeof (mline_t))
|
||||
|
||||
#if 0
|
||||
#define R (FRACUNIT)
|
||||
static mline_t triangle_guy[] = {
|
||||
{ { (fixed_t)-.867f*R, (fixed_t)-.5f*R }, { (fixed_t) .867f*R, (fixed_t)-.5f*R } },
|
||||
{ { (fixed_t) .867f*R, (fixed_t)-.5f*R }, { (fixed_t) 0, (fixed_t) R } },
|
||||
{ { (fixed_t) 0, (fixed_t) R }, { (fixed_t)-.867f*R, (fixed_t)-.5f*R } }
|
||||
static const mline_t cross_mark[] =
|
||||
{
|
||||
{ { -R, 0 }, { R, 0} },
|
||||
{ { 0, -R }, { 0, R } },
|
||||
};
|
||||
#undef R
|
||||
#define NUMTRIANGLEGUYLINES (sizeof (triangle_guy)/sizeof (mline_t))
|
||||
#endif
|
||||
#define NUMCROSSMARKLINES (sizeof(cross_mark)/sizeof(mline_t))
|
||||
|
||||
#define R (FRACUNIT)
|
||||
static const mline_t thintriangle_guy[] = {
|
||||
@@ -162,10 +151,14 @@ static boolean draw_grid = false;
|
||||
boolean automapactive = false;
|
||||
boolean am_recalc = false; //added : 05-02-98 : true when screen size changes
|
||||
static boolean am_stopped = true;
|
||||
static boolean am_minigen = false;
|
||||
|
||||
static UINT8 *am_buf = NULL;
|
||||
|
||||
static INT32 f_x, f_y; // location of window on screen (always zero for both)
|
||||
static INT32 f_w, f_h; // size of window on screen (always the screen width and height respectively)
|
||||
|
||||
static boolean m_keydown[4]; // which window panning keys are being pressed down?
|
||||
static mpoint_t m_paninc; // how far the window pans each tic (map coords)
|
||||
static fixed_t mtof_zoommul; // how far the window zooms in each tic (map coords)
|
||||
static fixed_t ftom_zoommul; // how far the window zooms in each tic (fb coords)
|
||||
@@ -205,12 +198,13 @@ static fixed_t scale_ftom;
|
||||
|
||||
static player_t *plr; // the player represented by an arrow
|
||||
|
||||
static INT32 followplayer = true; // specifies whether to follow the player around
|
||||
static boolean followplayer = true; // specifies whether to follow the player around
|
||||
|
||||
// function for drawing lines, depends on rendermode
|
||||
typedef void (*AMDRAWFLINEFUNC) (const fline_t *fl, INT32 color);
|
||||
static AMDRAWFLINEFUNC AM_drawFline;
|
||||
|
||||
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc);
|
||||
static void AM_drawFline_soft(const fline_t *fl, INT32 color);
|
||||
|
||||
static void AM_activateNewScale(void)
|
||||
@@ -340,22 +334,23 @@ static void AM_initVariables(void)
|
||||
old_m_h = m_h;
|
||||
}
|
||||
|
||||
//
|
||||
// Called when the screen size changes.
|
||||
//
|
||||
static void AM_FrameBufferInit(void)
|
||||
{
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
am_buf = screens[0];
|
||||
}
|
||||
|
||||
//
|
||||
// should be called at the start of every level
|
||||
// right now, i figure it out myself
|
||||
//
|
||||
static void AM_LevelInit(void)
|
||||
{
|
||||
f_x = f_y = 0;
|
||||
f_w = vid.width;
|
||||
f_h = vid.height;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
AM_drawFline = HWR_drawAMline;
|
||||
#endif
|
||||
|
||||
AM_findMinMaxBoundaries();
|
||||
scale_mtof = FixedDiv(min_scale_mtof*10, 7*FRACUNIT);
|
||||
if (scale_mtof > max_scale_mtof)
|
||||
@@ -377,7 +372,7 @@ void AM_Stop(void)
|
||||
*
|
||||
* \sa AM_Stop
|
||||
*/
|
||||
static inline void AM_Start(void)
|
||||
void AM_Start(void)
|
||||
{
|
||||
static INT32 lastlevel = -1;
|
||||
|
||||
@@ -386,8 +381,12 @@ static inline void AM_Start(void)
|
||||
am_stopped = false;
|
||||
if (lastlevel != gamemap || am_recalc) // screen size changed
|
||||
{
|
||||
AM_LevelInit();
|
||||
lastlevel = gamemap;
|
||||
AM_FrameBufferInit();
|
||||
if (lastlevel != gamemap)
|
||||
{
|
||||
AM_LevelInit();
|
||||
lastlevel = gamemap;
|
||||
}
|
||||
am_recalc = false;
|
||||
}
|
||||
AM_initVariables();
|
||||
@@ -413,6 +412,27 @@ static void AM_maxOutWindowScale(void)
|
||||
AM_activateNewScale();
|
||||
}
|
||||
|
||||
//
|
||||
// set window panning
|
||||
//
|
||||
static void AM_setWindowPanning(void)
|
||||
{
|
||||
// up and down
|
||||
if (m_keydown[2]) // pan up
|
||||
m_paninc.y = FTOM(F_PANINC);
|
||||
else if (m_keydown[3]) // pan down
|
||||
m_paninc.y = -FTOM(F_PANINC);
|
||||
else
|
||||
m_paninc.y = 0;
|
||||
// left and right
|
||||
if (m_keydown[0]) // pan right
|
||||
m_paninc.x = FTOM(F_PANINC);
|
||||
else if (m_keydown[1]) // pan left
|
||||
m_paninc.x = -FTOM(F_PANINC);
|
||||
else
|
||||
m_paninc.x = 0;
|
||||
}
|
||||
|
||||
/** Responds to user inputs in automap mode.
|
||||
*
|
||||
* \param ev Event to possibly respond to.
|
||||
@@ -445,35 +465,49 @@ boolean AM_Responder(event_t *ev)
|
||||
{
|
||||
case AM_PANRIGHTKEY: // pan right
|
||||
if (!followplayer)
|
||||
m_paninc.x = FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[0] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANLEFTKEY: // pan left
|
||||
if (!followplayer)
|
||||
m_paninc.x = -FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[1] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANUPKEY: // pan up
|
||||
if (!followplayer)
|
||||
m_paninc.y = FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[2] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_PANDOWNKEY: // pan down
|
||||
if (!followplayer)
|
||||
m_paninc.y = -FTOM(F_PANINC);
|
||||
{
|
||||
m_keydown[3] = true;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
else
|
||||
rc = false;
|
||||
break;
|
||||
case AM_ZOOMOUTKEY: // zoom out
|
||||
mtof_zoommul = M_ZOOMOUT;
|
||||
ftom_zoommul = M_ZOOMIN;
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_ZOOMINKEY: // zoom in
|
||||
mtof_zoommul = M_ZOOMIN;
|
||||
ftom_zoommul = M_ZOOMOUT;
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_TOGGLEKEY:
|
||||
AM_Stop();
|
||||
@@ -487,6 +521,7 @@ boolean AM_Responder(event_t *ev)
|
||||
}
|
||||
else
|
||||
AM_restoreScaleAndLoc();
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_FOLLOWKEY:
|
||||
followplayer = !followplayer;
|
||||
@@ -506,14 +541,32 @@ boolean AM_Responder(event_t *ev)
|
||||
switch (ev->data1)
|
||||
{
|
||||
case AM_PANRIGHTKEY:
|
||||
if (!followplayer)
|
||||
{
|
||||
m_keydown[0] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANLEFTKEY:
|
||||
if (!followplayer)
|
||||
m_paninc.x = 0;
|
||||
{
|
||||
m_keydown[1] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANUPKEY:
|
||||
if (!followplayer)
|
||||
{
|
||||
m_keydown[2] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_PANDOWNKEY:
|
||||
if (!followplayer)
|
||||
m_paninc.y = 0;
|
||||
{
|
||||
m_keydown[3] = false;
|
||||
AM_setWindowPanning();
|
||||
}
|
||||
break;
|
||||
case AM_ZOOMOUTKEY:
|
||||
case AM_ZOOMINKEY:
|
||||
@@ -714,6 +767,16 @@ static boolean AM_clipMline(const mline_t *ml, fline_t *fl)
|
||||
}
|
||||
#undef DOOUTCODE
|
||||
|
||||
//
|
||||
// Draws a pixel.
|
||||
//
|
||||
static void AM_drawPixel(INT32 xx, INT32 yy, INT32 cc)
|
||||
{
|
||||
if (xx < 0 || yy < 0 || xx >= f_w || yy >= f_h)
|
||||
return; // off the screen
|
||||
am_buf[(yy*f_w) + xx] = cc;
|
||||
}
|
||||
|
||||
//
|
||||
// Classic Bresenham w/ whatever optimizations needed for speed
|
||||
//
|
||||
@@ -735,8 +798,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
}
|
||||
#endif
|
||||
|
||||
#define PUTDOT(xx,yy,cc) V_DrawFill(xx,yy,1,1,cc|V_NOSCALESTART);
|
||||
|
||||
dx = fl->b.x - fl->a.x;
|
||||
ax = 2 * (dx < 0 ? -dx : dx);
|
||||
sx = dx < 0 ? -1 : 1;
|
||||
@@ -753,7 +814,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d = ay - ax/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color)
|
||||
AM_drawPixel(x, y, color);
|
||||
if (x == fl->b.x)
|
||||
return;
|
||||
if (d >= 0)
|
||||
@@ -770,7 +831,7 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d = ax - ay/2;
|
||||
for (;;)
|
||||
{
|
||||
PUTDOT(x, y, color)
|
||||
AM_drawPixel(x, y, color);
|
||||
if (y == fl->b.y)
|
||||
return;
|
||||
if (d >= 0)
|
||||
@@ -782,8 +843,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d += ax;
|
||||
}
|
||||
}
|
||||
|
||||
#undef PUTDOT
|
||||
}
|
||||
|
||||
//
|
||||
@@ -805,17 +864,18 @@ static void AM_drawGrid(INT32 color)
|
||||
fixed_t x, y;
|
||||
fixed_t start, end;
|
||||
mline_t ml;
|
||||
fixed_t gridsize = (MAPBLOCKUNITS<<MAPBITS);
|
||||
|
||||
// Figure out start of vertical gridlines
|
||||
start = m_x;
|
||||
if ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS))
|
||||
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgx) % (MAPBLOCKUNITS<<FRACBITS));
|
||||
if ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize)
|
||||
start += gridsize - ((start - (bmaporgx>>FRACTOMAPBITS)) % gridsize);
|
||||
end = m_x + m_w;
|
||||
|
||||
// draw vertical gridlines
|
||||
ml.a.y = m_y;
|
||||
ml.b.y = m_y + m_h;
|
||||
for (x = start; x < end; x += (MAPBLOCKUNITS<<FRACBITS))
|
||||
for (x = start; x < end; x += gridsize)
|
||||
{
|
||||
ml.a.x = x;
|
||||
ml.b.x = x;
|
||||
@@ -824,14 +884,14 @@ static void AM_drawGrid(INT32 color)
|
||||
|
||||
// Figure out start of horizontal gridlines
|
||||
start = m_y;
|
||||
if ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS))
|
||||
start += (MAPBLOCKUNITS<<FRACBITS) - ((start - bmaporgy) % (MAPBLOCKUNITS<<FRACBITS));
|
||||
if ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize)
|
||||
start += gridsize - ((start - (bmaporgy>>FRACTOMAPBITS)) % gridsize);
|
||||
end = m_y + m_h;
|
||||
|
||||
// draw horizontal gridlines
|
||||
ml.a.x = m_x;
|
||||
ml.b.x = m_x + m_w;
|
||||
for (y = start; y < end; y += (MAPBLOCKUNITS<<FRACBITS))
|
||||
for (y = start; y < end; y += gridsize)
|
||||
{
|
||||
ml.a.y = y;
|
||||
ml.b.y = y;
|
||||
@@ -839,14 +899,63 @@ static void AM_drawGrid(INT32 color)
|
||||
}
|
||||
}
|
||||
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = (P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y) + FRACUNIT/2) >> FRACBITS; \
|
||||
end2 = (P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y) + FRACUNIT/2) >> FRACBITS; \
|
||||
} else \
|
||||
end1 = end2 = (normalheight + FRACUNIT/2) >> FRACBITS;
|
||||
|
||||
static ffloor_t *AM_CompareFOFs(size_t i, ffloor_t *rover, ffloor_t *secondarystore)
|
||||
{
|
||||
ffloor_t *secondaryrover = NULL;
|
||||
for (; rover; rover = rover->next)
|
||||
{
|
||||
fixed_t rovt1, rovt2;
|
||||
fixed_t rovb1, rovb2;
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
SLOPEPARAMS(*rover->t_slope, rovt1, rovt2, *rover->topheight)
|
||||
SLOPEPARAMS(*rover->b_slope, rovb1, rovb2, *rover->bottomheight)
|
||||
for (secondaryrover = secondarystore; secondaryrover; secondaryrover = secondaryrover->next)
|
||||
{
|
||||
fixed_t sect1, sect2;
|
||||
fixed_t secb1, secb2;
|
||||
if (!(secondaryrover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(secondaryrover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
if (secondaryrover->secnum == rover->secnum)
|
||||
break;
|
||||
SLOPEPARAMS(*secondaryrover->t_slope, sect1, sect2, *secondaryrover->topheight)
|
||||
SLOPEPARAMS(*secondaryrover->b_slope, secb1, secb2, *secondaryrover->bottomheight)
|
||||
if (rovt1 != sect1)
|
||||
continue;
|
||||
if (rovt2 != sect2)
|
||||
continue;
|
||||
if (rovb1 != secb1)
|
||||
continue;
|
||||
if (rovb2 != secb2)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
if (secondaryrover == NULL)
|
||||
break;
|
||||
}
|
||||
return rover;
|
||||
}
|
||||
|
||||
//
|
||||
// Determines visible lines, draws them.
|
||||
// This is LineDef based, not LineSeg based.
|
||||
//
|
||||
static inline void AM_drawWalls(void)
|
||||
static void AM_drawWalls(UINT8 pass)
|
||||
{
|
||||
size_t i;
|
||||
static mline_t l;
|
||||
const fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale)>>FRACBITS;
|
||||
fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends
|
||||
fixed_t backf1 = 0, backf2 = 0, backc1 = 0, backc2 = 0; // back floor ceiling ends
|
||||
|
||||
@@ -856,74 +965,143 @@ static inline void AM_drawWalls(void)
|
||||
l.a.y = lines[i].v1->y >> FRACTOMAPBITS;
|
||||
l.b.x = lines[i].v2->x >> FRACTOMAPBITS;
|
||||
l.b.y = lines[i].v2->y >> FRACTOMAPBITS;
|
||||
#define SLOPEPARAMS(slope, end1, end2, normalheight) \
|
||||
if (slope) { \
|
||||
end1 = P_GetZAt(slope, lines[i].v1->x, lines[i].v1->y); \
|
||||
end2 = P_GetZAt(slope, lines[i].v2->x, lines[i].v2->y); \
|
||||
} else \
|
||||
end1 = end2 = normalheight;
|
||||
|
||||
SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight)
|
||||
if (lines[i].backsector) {
|
||||
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
}
|
||||
#undef SLOPEPARAMS
|
||||
|
||||
if (!lines[i].backsector) // 1-sided
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBWALLCOLORS);
|
||||
else
|
||||
if (!(pass & PASS_SOLID))
|
||||
;
|
||||
else if (frontf1 != frontc1 || frontf2 != frontc2 || lines[i].frontsector->f_slope)
|
||||
{
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
else if (!am_minigen)
|
||||
{
|
||||
AM_drawMline(&l, WALLCOLORS);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight)
|
||||
SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight)
|
||||
if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier
|
||||
|| (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier
|
||||
{
|
||||
if (backf1 == backc1 && backf2 == backc2
|
||||
&& frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
else
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
if (!am_minigen && (pass & PASS_INTANGIBLE))
|
||||
{
|
||||
AM_drawMline(&l, GRIDCOLORS);
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (pass & PASS_SOLID)
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB)
|
||||
AM_drawMline(&l, NOCLIMBTHOKWALLCOLORS);
|
||||
else
|
||||
AM_drawMline(&l, THOKWALLCOLORS);
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lines[i].flags & ML_NOCLIMB) {
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
AM_drawMline(&l, NOCLIMBFDWALLCOLORS); // floor level change
|
||||
}
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
AM_drawMline(&l, NOCLIMBCDWALLCOLORS); // ceiling level change
|
||||
//dont think kart even supports those idk?
|
||||
/*if (lines[i].flags & (ML_IMPASSABLE|ML_BLOCKPLAYERS))
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // Completely solid course boundary
|
||||
}
|
||||
else if ((lines[i].flags & ML_MIDSOLID)
|
||||
&& sides[lines->sidenum[0]].midtexture)
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // solid midtexture, likely a course boundary
|
||||
}*/
|
||||
if ((backf1 != frontf1 && abs(backf1 - frontf1) > maxstep)
|
||||
|| (backf2 != frontf2 && abs(backf2 - frontf2) > maxstep))
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSWALLCOLORS); // floor-wall, likely a course boundary
|
||||
}
|
||||
/*else if (lines[i].special == 2001) // guh its a sector effect in kart idk how to make it work tbh lol
|
||||
{
|
||||
if (pass & PASS_SOLID)
|
||||
AM_drawMline(&l, TSFINISHLINE); // finish line
|
||||
}*/
|
||||
else if (backf1 != frontf1 || backf2 != frontf2)
|
||||
{
|
||||
if (pass & PASS_INTANGIBLE)
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floorlevel change
|
||||
}
|
||||
else if (backc1 != frontc1 || backc2 != frontc2)
|
||||
{
|
||||
if (!(pass & PASS_INTANGIBLE))
|
||||
;
|
||||
else if (abs(backc1 - frontc1) < maxstep
|
||||
|| abs(backc2 - frontc2) < maxstep)
|
||||
{
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceilinglevel change
|
||||
}
|
||||
else
|
||||
AM_drawMline(&l, NOCLIMBTSWALLCOLORS);
|
||||
{
|
||||
AM_drawMline(&l, GRIDCOLORS); // ceiling-wall, not likely to be a course boundary but flagged up just in case
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (backf1 != frontf1 || backf2 != frontf2) {
|
||||
AM_drawMline(&l, FDWALLCOLORS); // floor level change
|
||||
{
|
||||
ffloor_t *rover = NULL;
|
||||
|
||||
if (lines[i].frontsector->ffloors || lines[i].backsector->ffloors)
|
||||
{
|
||||
if (lines[i].backsector->ffloors == NULL)
|
||||
{
|
||||
// Check frontside for one solid
|
||||
for (rover = lines[i].frontsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (lines[i].frontsector->ffloors == NULL)
|
||||
{
|
||||
// Check backside for one solid
|
||||
for (rover = lines[i].backsector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
if (!(rover->flags & FF_BLOCKPLAYER))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check to see if any secnums exist in one but not the other.
|
||||
rover = AM_CompareFOFs(i, lines[i].frontsector->ffloors, lines[i].backsector->ffloors);
|
||||
if (rover == NULL)
|
||||
rover = AM_CompareFOFs(i, lines[i].backsector->ffloors, lines[i].frontsector->ffloors);
|
||||
}
|
||||
}
|
||||
if (rover != NULL)
|
||||
{
|
||||
if (pass & PASS_FOF)
|
||||
AM_drawMline(&l, TSFOFINFO); // a FOF is here but we don't know how to distinguish them yet
|
||||
}
|
||||
else if (!am_minigen)
|
||||
{
|
||||
if (pass & PASS_INTANGIBLE)
|
||||
AM_drawMline(&l, GRIDCOLORS); // likely low-relevance line
|
||||
}
|
||||
}
|
||||
else if (backc1 != frontc1 || backc2 != frontc2) {
|
||||
AM_drawMline(&l, CDWALLCOLORS); // ceiling level change
|
||||
}
|
||||
else
|
||||
AM_drawMline(&l, TSWALLCOLORS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef SLOPEPARAMS
|
||||
|
||||
//
|
||||
// Rotation in 2D.
|
||||
// Used to rotate player arrow line character.
|
||||
@@ -996,7 +1174,7 @@ static inline void AM_drawPlayers(void)
|
||||
|
||||
if (!multiplayer)
|
||||
{
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, plr->mo->angle, DWHITE, plr->mo->x, plr->mo->y);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1013,7 +1191,7 @@ static inline void AM_drawPlayers(void)
|
||||
if (p->skincolor > 0)
|
||||
color = R_GetTranslationColormap(TC_DEFAULT, p->skincolor, GTC_CACHE)[GREENS + 8];
|
||||
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 0, p->mo->angle, color, p->mo->x, p->mo->y);
|
||||
AM_drawLineCharacter(player_arrow, NUMPLYRLINES, 16<<FRACBITS, p->mo->angle, color, p->mo->x, p->mo->y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1033,13 +1211,27 @@ static inline void AM_drawThings(UINT8 colors)
|
||||
}
|
||||
}
|
||||
|
||||
/** Draws the crosshair, actually just a dot in software mode.
|
||||
/** Draws the crosshair.
|
||||
*
|
||||
* \param color Color for the crosshair.
|
||||
*/
|
||||
static inline void AM_drawCrosshair(UINT8 color)
|
||||
{
|
||||
V_DrawFill(f_w/2 + f_x, f_h/2 + f_y, 1, 1, color|V_NOSCALESTART);
|
||||
const fixed_t scale = 4<<FRACBITS;
|
||||
size_t i;
|
||||
fline_t fl;
|
||||
for (i = 0; i < NUMCROSSMARKLINES; i++)
|
||||
{
|
||||
fl.a.x = FixedMul(cross_mark[i].a.x, scale) >> FRACBITS;
|
||||
fl.a.y = FixedMul(cross_mark[i].a.y, scale) >> FRACBITS;
|
||||
fl.b.x = FixedMul(cross_mark[i].b.x, scale) >> FRACBITS;
|
||||
fl.b.y = FixedMul(cross_mark[i].b.y, scale) >> FRACBITS;
|
||||
fl.a.x += f_x + (f_w / 2);
|
||||
fl.a.y += f_y + (f_h / 2);
|
||||
fl.b.x += f_x + (f_w / 2);
|
||||
fl.b.y += f_y + (f_h / 2);
|
||||
AM_drawFline(&fl, color);
|
||||
}
|
||||
}
|
||||
|
||||
/** Draws the automap.
|
||||
@@ -1049,11 +1241,80 @@ void AM_Drawer(void)
|
||||
if (!automapactive)
|
||||
return;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft;
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
AM_drawFline = HWR_drawAMline;
|
||||
#endif
|
||||
|
||||
AM_clearFB(BACKGROUND);
|
||||
if (draw_grid) AM_drawGrid(GRIDCOLORS);
|
||||
AM_drawWalls();
|
||||
AM_drawWalls(PASS_FOF|PASS_INTANGIBLE|PASS_SOLID);
|
||||
AM_drawPlayers();
|
||||
AM_drawThings(THINGCOLORS);
|
||||
|
||||
AM_drawCrosshair(XHAIRCOLORS);
|
||||
if (!followplayer) AM_drawCrosshair(XHAIRCOLORS);
|
||||
}
|
||||
|
||||
minigen_t *AM_MinimapGenerate(INT32 mul)
|
||||
{
|
||||
static minigen_t ret = {0};
|
||||
|
||||
if (automapactive)
|
||||
return NULL;
|
||||
|
||||
am_minigen = true;
|
||||
|
||||
AM_drawFline = AM_drawFline_soft; // yes, even in GL
|
||||
|
||||
//AM_FrameBufferInit();
|
||||
f_x = f_y = 0;
|
||||
ret.w = f_w = minimapinfo.minimap_w * mul;
|
||||
ret.h = f_h = minimapinfo.minimap_h * mul;
|
||||
am_buf = ret.buf = NULL;
|
||||
|
||||
//AM_LevelInit();
|
||||
AM_findMinMaxBoundaries();
|
||||
scale_mtof = min_scale_mtof - (min_scale_mtof/20);
|
||||
scale_ftom = FixedDiv(FRACUNIT, scale_mtof);
|
||||
|
||||
//AM_initVariables();
|
||||
f_oldloc.x = INT32_MAX;
|
||||
|
||||
m_paninc.x = m_paninc.y = 0;
|
||||
ftom_zoommul = FRACUNIT;
|
||||
mtof_zoommul = FRACUNIT;
|
||||
|
||||
m_w = FTOM(f_w);
|
||||
m_h = FTOM(f_h);
|
||||
|
||||
//AM_changeWindowLoc();
|
||||
m_x = min_x - FixedMul(m_w, FRACUNIT/40);
|
||||
m_y = min_y - FixedMul(m_h, FRACUNIT/40);
|
||||
m_x2 = m_x + m_w;
|
||||
m_y2 = m_y + m_h;
|
||||
|
||||
// for saving & restoring
|
||||
old_m_x = m_x;
|
||||
old_m_y = m_y;
|
||||
old_m_w = m_w;
|
||||
old_m_h = m_h;
|
||||
|
||||
am_buf = ret.buf = malloc((f_w*f_h));
|
||||
|
||||
if (ret.buf == NULL)
|
||||
return NULL;
|
||||
|
||||
//AM_clearFB(BACKGROUND);
|
||||
memset(am_buf, 0xff, (f_w*f_h));
|
||||
AM_drawWalls(PASS_FOF);
|
||||
AM_drawWalls(PASS_INTANGIBLE);
|
||||
AM_drawWalls(PASS_SOLID);
|
||||
|
||||
am_buf = NULL;
|
||||
am_recalc = true;
|
||||
|
||||
am_minigen = false;
|
||||
|
||||
return &ret;
|
||||
}
|
||||
+17
-8
@@ -1,8 +1,10 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 2024 by Vivian "toastergrl" Grannell.
|
||||
// Copyright (C) 2024 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -26,11 +28,6 @@ typedef struct
|
||||
fpoint_t a, b;
|
||||
} fline_t;
|
||||
|
||||
// Used by ST StatusBar stuff.
|
||||
#define AM_MSGHEADER (('a'<<24)+('m'<<16))
|
||||
#define AM_MSGENTERED (AM_MSGHEADER | ('e'<<8))
|
||||
#define AM_MSGEXITED (AM_MSGHEADER | ('x'<<8))
|
||||
|
||||
extern boolean am_recalc; // true if screen size changes
|
||||
extern boolean automapactive; // In AutoMap mode?
|
||||
|
||||
@@ -43,7 +40,19 @@ void AM_Ticker(void);
|
||||
// Called by main loop, instead of view drawer if automap is active.
|
||||
void AM_Drawer(void);
|
||||
|
||||
// Enables the automap.
|
||||
void AM_Start(void);
|
||||
|
||||
// Called to force the automap to quit if the level is completed while it is up.
|
||||
void AM_Stop(void);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
INT32 w, h;
|
||||
UINT8 *buf;
|
||||
} minigen_t;
|
||||
|
||||
// Minimap generation
|
||||
minigen_t *AM_MinimapGenerate(INT32 mul);
|
||||
|
||||
#endif
|
||||
@@ -184,8 +184,6 @@ void I_OutputMsg(const char *fmt, ...)
|
||||
|
||||
void I_StartupMouse(void){}
|
||||
|
||||
void I_StartupMouse2(void){}
|
||||
|
||||
void I_StartupKeyboard(void){}
|
||||
|
||||
INT32 I_GetKey(void)
|
||||
@@ -242,8 +240,6 @@ void I_GetJoystickEvents(void){}
|
||||
|
||||
void I_GetJoystick2Events(void){}
|
||||
|
||||
void I_GetMouseEvents(void){}
|
||||
|
||||
char *I_GetEnv(const char *name)
|
||||
{
|
||||
LOGW("I_GetEnv() called?!");
|
||||
|
||||
+2
-5
@@ -36,7 +36,7 @@ static inline void B_BuildTailsTiccmd(mobj_t *sonic, mobj_t *tails, ticcmd_t *cm
|
||||
return;
|
||||
|
||||
// Lua can handle it!
|
||||
if (LUAh_BotAI(sonic, tails, cmd))
|
||||
if (LUA_HookBotAI(sonic, tails, cmd))
|
||||
return;
|
||||
|
||||
if (tails->player->pflags & (PF_MACESPIN|PF_ITEMHANG))
|
||||
@@ -118,11 +118,8 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd)
|
||||
return;
|
||||
}
|
||||
|
||||
// Bot AI isn't programmed in analog.
|
||||
//CV_SetValue(&cv_analog2, false);
|
||||
|
||||
// Let Lua scripts build ticcmds
|
||||
if (LUAh_BotTiccmd(player, cmd))
|
||||
if (LUA_HookTiccmd(player, cmd, HOOK(BotTiccmd)))
|
||||
return;
|
||||
|
||||
// We don't have any main character AI, sorry. D:
|
||||
|
||||
+28
-23
@@ -1,7 +1,7 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 by Sonic Team Junior.
|
||||
// Copyright (C) 1999-2024 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
@@ -11,6 +11,9 @@
|
||||
/// \brief Macros to read/write from/to a UINT8 *,
|
||||
/// used for packet creation and such
|
||||
|
||||
#ifndef __BYTEPTR_H__
|
||||
#define __BYTEPTR_H__
|
||||
|
||||
#if defined (__alpha__) || defined (__arm__) || defined (__mips__) || defined (__ia64__) || defined (__clang__)
|
||||
#define DEALIGNED
|
||||
#endif
|
||||
@@ -150,7 +153,7 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||
|
||||
#undef DEALIGNED
|
||||
|
||||
#define WRITESTRINGN(p, s, n) ({ \
|
||||
#define WRITESTRINGN(p, s, n) do { \
|
||||
size_t tmp_i; \
|
||||
\
|
||||
for (tmp_i = 0; tmp_i < n && s[tmp_i] != '\0'; tmp_i++) \
|
||||
@@ -158,70 +161,72 @@ FUNCINLINE static ATTRINLINE UINT32 readulong(void *ptr)
|
||||
\
|
||||
if (tmp_i < n) \
|
||||
WRITECHAR(p, '\0'); \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define WRITESTRINGL(p, s, n) ({ \
|
||||
#define WRITESTRINGL(p, s, n) do { \
|
||||
size_t tmp_i; \
|
||||
\
|
||||
for (tmp_i = 0; tmp_i < n - 1 && s[tmp_i] != '\0'; tmp_i++) \
|
||||
WRITECHAR(p, s[tmp_i]); \
|
||||
\
|
||||
WRITECHAR(p, '\0'); \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define WRITESTRING(p, s) ({ \
|
||||
#define WRITESTRING(p, s) do { \
|
||||
size_t tmp_i; \
|
||||
\
|
||||
for (tmp_i = 0; s[tmp_i] != '\0'; tmp_i++) \
|
||||
WRITECHAR(p, s[tmp_i]); \
|
||||
\
|
||||
WRITECHAR(p, '\0'); \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define WRITEMEM(p, s, n) ({ \
|
||||
memcpy(p, s, n); \
|
||||
p += n; \
|
||||
})
|
||||
#define WRITEMEM(p, s, n) do { \
|
||||
memcpy(p, s, n); \
|
||||
p += n; \
|
||||
} while (0)
|
||||
|
||||
#define SKIPSTRING(p) while (READCHAR(p) != '\0')
|
||||
|
||||
#define SKIPSTRINGN(p, n) ({ \
|
||||
#define SKIPSTRINGN(p, n) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while (tmp_i < n && READCHAR(p) != '\0') \
|
||||
tmp_i++; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define SKIPSTRINGL(p, n) SKIPSTRINGN(p, n)
|
||||
|
||||
#define READSTRINGN(p, s, n) ({ \
|
||||
#define READSTRINGN(p, s, n) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while (tmp_i < n && (s[tmp_i] = READCHAR(p)) != '\0') \
|
||||
tmp_i++; \
|
||||
\
|
||||
s[tmp_i] = '\0'; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define READSTRINGL(p, s, n) ({ \
|
||||
#define READSTRINGL(p, s, n) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while (tmp_i < n - 1 && (s[tmp_i] = READCHAR(p)) != '\0') \
|
||||
tmp_i++; \
|
||||
\
|
||||
s[tmp_i] = '\0'; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define READSTRING(p, s) ({ \
|
||||
#define READSTRING(p, s) do { \
|
||||
size_t tmp_i = 0; \
|
||||
\
|
||||
while ((s[tmp_i] = READCHAR(p)) != '\0') \
|
||||
tmp_i++; \
|
||||
\
|
||||
s[tmp_i] = '\0'; \
|
||||
})
|
||||
} while (0)
|
||||
|
||||
#define READMEM(p, s, n) ({ \
|
||||
memcpy(s, p, n); \
|
||||
p += n; \
|
||||
})
|
||||
#define READMEM(p, s, n) do { \
|
||||
memcpy(s, p, n); \
|
||||
p += n; \
|
||||
} while (0)
|
||||
|
||||
#endif // __BYTEPTR_H__
|
||||
+8
-2
@@ -608,7 +608,7 @@ static void CON_MoveConsole(void)
|
||||
}
|
||||
|
||||
// Not instant - Increment fracmovement fractionally
|
||||
fracmovement += FixedMul(cons_speed.value*vid.fdupy, renderdeltatics);
|
||||
fracmovement += FixedMul(cons_speed.value*vid.fdupy, (cv_uncappedhud.value ? renderdeltatics : FRACUNIT));
|
||||
|
||||
if (con_curlines < con_destlines) // Move the console downwards
|
||||
{
|
||||
@@ -1236,7 +1236,7 @@ void CONS_Printf(const char *fmt, ...)
|
||||
txt = malloc(8192);
|
||||
|
||||
va_start(argptr, fmt);
|
||||
vsprintf(txt, fmt, argptr);
|
||||
vsnprintf(txt, 8192, fmt, argptr);
|
||||
va_end(argptr);
|
||||
|
||||
// echo console prints to log file
|
||||
@@ -1466,7 +1466,10 @@ static void CON_DrawHudlines(void)
|
||||
{
|
||||
charflags = (*p & 0x7f) << V_CHARCOLORSHIFT;
|
||||
p++;
|
||||
c++;
|
||||
}
|
||||
if (c >= con_width)
|
||||
break;
|
||||
if (*p < HU_FONTSTART)
|
||||
;//charwidth = 4 * con_scalefactor;
|
||||
else
|
||||
@@ -1546,7 +1549,10 @@ static void CON_DrawConsole(void)
|
||||
{
|
||||
charflags = (*p & 0x7f) << V_CHARCOLORSHIFT;
|
||||
p++;
|
||||
c++;
|
||||
}
|
||||
if (c >= con_width)
|
||||
break;
|
||||
V_DrawCharacter(x, y, (INT32)(*p) | charflags | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
}
|
||||
}
|
||||
|
||||
+503
-366
File diff suppressed because it is too large.
Load diff
+18
-5
@@ -41,6 +41,15 @@ applications may follow different packet versions.
|
||||
#define BACKUPTICS 32
|
||||
#define TICQUEUE 512 // more than enough for most timeouts....
|
||||
#define MAXTEXTCMD 256
|
||||
|
||||
// No. of tics your controls can be delayed by.
|
||||
|
||||
// TODO: Instead of storing a ton of extra cmds for gentlemens' delay,
|
||||
// keep them in a linked-list, with timestamps to discard everything that's older than already sent.
|
||||
// That will support any amount of lag, and be less wasteful for clients who don't use it.
|
||||
// This just works as a quick implementation.
|
||||
#define MAXGENTLEMENDELAY TICRATE
|
||||
|
||||
//
|
||||
// Packet structure
|
||||
//
|
||||
@@ -576,6 +585,11 @@ extern UINT32 realpingtable[MAXPLAYERS];
|
||||
extern UINT32 playerpingtable[MAXPLAYERS];
|
||||
extern tic_t servermaxping;
|
||||
|
||||
extern boolean server_lagless;
|
||||
extern tic_t simulated_lag;
|
||||
extern tic_t lowest_lag;
|
||||
extern consvar_t cv_mindelay, cv_lagless;
|
||||
|
||||
extern consvar_t
|
||||
#ifdef VANILLAJOINNEXTROUND
|
||||
cv_joinnextround,
|
||||
@@ -600,10 +614,8 @@ void D_ClientServerInit(void);
|
||||
|
||||
// Initialise the other field
|
||||
void RegisterNetXCmd(netxcmd_t id, void (*cmd_f)(UINT8 **p, INT32 playernum));
|
||||
void SendNetXCmd(netxcmd_t id, const void *param, size_t nparam);
|
||||
void SendNetXCmd2(netxcmd_t id, const void *param, size_t nparam); // splitsreen player
|
||||
void SendNetXCmd3(netxcmd_t id, const void *param, size_t nparam); // splitsreen3 player
|
||||
void SendNetXCmd4(netxcmd_t id, const void *param, size_t nparam); // splitsreen4 player
|
||||
void SendNetXCmdForPlayer(UINT8 playerid, netxcmd_t id, const void *param, size_t nparam);
|
||||
#define SendNetXCmd(id, param, nparam) SendNetXCmdForPlayer(0, id, param, nparam) // Shortcut for P1
|
||||
|
||||
// Create any new ticcmds and broadcast to other players.
|
||||
void NetKeepAlive(void);
|
||||
@@ -647,10 +659,11 @@ extern char motd[254], server_context[8];
|
||||
extern UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
INT32 D_NumPlayers(void);
|
||||
|
||||
void D_ResetTiccmds(void);
|
||||
|
||||
tic_t GetLag(INT32 node);
|
||||
UINT8 GetFreeXCmdSize(void);
|
||||
//UINT8 GetFreeXCmdSize(UINT8 playerid);
|
||||
|
||||
extern UINT8 hu_resynching;
|
||||
#ifdef SATURNSYNCH
|
||||
|
||||
@@ -25,7 +25,6 @@ typedef enum
|
||||
ev_console,
|
||||
ev_mouse,
|
||||
ev_joystick,
|
||||
ev_mouse2,
|
||||
ev_joystick2,
|
||||
ev_joystick3,
|
||||
ev_joystick4,
|
||||
|
||||
+118
-92
@@ -15,6 +15,7 @@
|
||||
/// plus functions to parse command line parameters, configure game
|
||||
/// parameters, and call the startup functions.
|
||||
|
||||
#include "d_netcmd.h"
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@@ -84,10 +85,6 @@
|
||||
#include "hardware/hw_main.h" // 3D View Rendering
|
||||
#endif
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
#include "discord.h"
|
||||
#endif
|
||||
@@ -136,6 +133,7 @@ char srb2home[256] = ".";
|
||||
char srb2path[256] = ".";
|
||||
boolean usehome = true;
|
||||
const char *pandf = "%s" PATHSEP "%s";
|
||||
static char addonsdir[MAX_WADPATH];
|
||||
|
||||
//
|
||||
// EVENT HANDLING
|
||||
@@ -168,20 +166,65 @@ UINT8 ctrldown = 0; // 0x1 left, 0x2 right
|
||||
UINT8 altdown = 0; // 0x1 left, 0x2 right
|
||||
boolean capslock = 0; // gee i wonder what this does.
|
||||
|
||||
static inline void D_DeviceLEDTick(void)
|
||||
static void D_PadMenuScrollInput(int input)
|
||||
{
|
||||
event_t myev = {0, 0, 0, 0};
|
||||
myev.type = ev_keydown;
|
||||
myev.data1 = input;
|
||||
D_PostEvent(&myev); // put into eventlist
|
||||
}
|
||||
|
||||
#define SCROLLDELAY 19 // TICRATE * ( (k+2) (1 - [wz + h + j - q]^2 - [(gk + 2g + k + 1)(h + j) + h - z]^2 - [16(k + 1)^3(k + 2)(n + 1)^2 + 1 - f^2]^2 calculated by my butt
|
||||
|
||||
// this is absolutely awful and i hate it lmao
|
||||
// but le hAx0r to make dpad also be able to scroll in the menu
|
||||
static void D_GamePadMenuScrollTicker(void)
|
||||
{
|
||||
static SINT8 menuInputDelayTimer = 0;
|
||||
int key = 0; // butt-on output
|
||||
|
||||
if (dedicated)
|
||||
return;
|
||||
|
||||
// wish i had a switch ono
|
||||
if (DPADUPSCROLL)
|
||||
key = KEY_UPARROW;
|
||||
else if (DPADDOWNSCROLL)
|
||||
key = KEY_DOWNARROW;
|
||||
else if (DPADLEFTSCROLL)
|
||||
key = KEY_LEFTARROW;
|
||||
else if (DPADRIGHTSCROLL)
|
||||
key = KEY_RIGHTARROW;
|
||||
|
||||
if (key)
|
||||
{
|
||||
if (menuInputDelayTimer < SCROLLDELAY)
|
||||
menuInputDelayTimer++;
|
||||
|
||||
if (menuInputDelayTimer == SCROLLDELAY)
|
||||
D_PadMenuScrollInput(key);
|
||||
}
|
||||
else
|
||||
{
|
||||
menuInputDelayTimer = 0;
|
||||
}
|
||||
}
|
||||
#undef SCROLLDELAY
|
||||
|
||||
static void D_DeviceLEDTick(void)
|
||||
{
|
||||
UINT8 i;
|
||||
UINT16 color[MAXSPLITSCREENPLAYERS];
|
||||
UINT16 curcolor[MAXSPLITSCREENPLAYERS];
|
||||
static UINT16 color[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
|
||||
static UINT16 curcolor[MAXSPLITSCREENPLAYERS] = {0, 0, 0, 0};
|
||||
|
||||
if (I_NumJoys() == 0 || (cv_gamepadled[0].value == 0 && cv_gamepadled[1].value == 0 && cv_gamepadled[2].value == 0 && cv_gamepadled[3].value == 0))
|
||||
if (dedicated || numcontrollers == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (G_GetDeviceForPlayer(i) == 0)
|
||||
if (!cv_usejoystick[i].value || !cv_gamepadled[i].value)
|
||||
continue;
|
||||
|
||||
color[i] = G_GetSkinColor(i);
|
||||
@@ -292,7 +335,7 @@ static boolean D_Display(void)
|
||||
|
||||
if (rendermode == render_soft && !splitscreen)
|
||||
{
|
||||
R_InterpolateViewRollAngle(rendertimefrac);
|
||||
R_InterpolateViewRollAngle(rendertimefrac_unpaused);
|
||||
R_CheckViewMorph();
|
||||
}
|
||||
|
||||
@@ -310,6 +353,7 @@ static boolean D_Display(void)
|
||||
|
||||
// save the current screen if about to wipe
|
||||
wipe = (gamestate != wipegamestate);
|
||||
|
||||
if (wipe)
|
||||
{
|
||||
// set for all later
|
||||
@@ -443,12 +487,14 @@ static boolean D_Display(void)
|
||||
{
|
||||
PS_START_TIMING(ps_rendercalltime);
|
||||
|
||||
R_ApplyLevelInterpolators(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT);
|
||||
R_ApplyLevelInterpolators(rendertimefrac);
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD)
|
||||
if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD)
|
||||
{
|
||||
viewssnum = i;
|
||||
|
||||
if (i == 0) // Initialize for P1
|
||||
{
|
||||
viewwindowy = 0;
|
||||
@@ -458,11 +504,9 @@ static boolean D_Display(void)
|
||||
objectsdrawn = 0;
|
||||
}
|
||||
|
||||
viewssnum = i;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_RenderPlayerView(i, &players[displayplayers[i]]);
|
||||
HWR_RenderPlayerView();
|
||||
else
|
||||
#endif
|
||||
if (rendermode != render_none)
|
||||
@@ -516,7 +560,7 @@ static boolean D_Display(void)
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
V_DoPostProcessor(i, &players[displayplayers[i]], postimgparam[i]);
|
||||
V_DoPostProcessor(i, postimgparam[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -649,7 +693,6 @@ static boolean D_Display(void)
|
||||
// =========================================================================
|
||||
|
||||
tic_t rendergametic;
|
||||
static SINT8 menuInputDelayTimer = 0;
|
||||
|
||||
void D_SRB2Loop(void)
|
||||
{
|
||||
@@ -698,11 +741,9 @@ void D_SRB2Loop(void)
|
||||
precise_t enterprecise = I_GetPreciseTime();
|
||||
precise_t finishprecise = enterprecise;
|
||||
|
||||
{
|
||||
// Casting the return value of a function is bad practice (apparently)
|
||||
double budget = round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision());
|
||||
capbudget = (precise_t) budget;
|
||||
}
|
||||
// Casting the return value of a function is bad practice (apparently)
|
||||
double budget = ((R_GetFramerateCap() == 0) ? 0.0 : round((1.0 / R_GetFramerateCap()) * I_GetPrecisePrecision()));
|
||||
capbudget = (precise_t) budget;
|
||||
|
||||
boolean ranwipe = false;
|
||||
|
||||
@@ -731,13 +772,9 @@ void D_SRB2Loop(void)
|
||||
debugload--;
|
||||
#endif
|
||||
|
||||
interp = R_UsingFrameInterpolation() && !dedicated;
|
||||
interp = (R_UsingFrameInterpolation() && !dedicated);
|
||||
doDisplay = false;
|
||||
|
||||
#ifdef HW3SOUND
|
||||
HW3S_BeginFrameUpdate();
|
||||
#endif
|
||||
|
||||
renderisnewtic = (realtics > 0 || singletics);
|
||||
|
||||
refreshdirmenu = 0; // not sure where to put this, here as good as any?
|
||||
@@ -752,7 +789,7 @@ void D_SRB2Loop(void)
|
||||
// process tics (but maybe not if realtic == 0)
|
||||
TryRunTics(realtics);
|
||||
|
||||
if (lastdraw || singletics || gametic > rendergametic)
|
||||
if (lastdraw || singletics || (gametic > rendergametic))
|
||||
{
|
||||
rendergametic = gametic;
|
||||
rendertimeout = entertic + TICRATE/17;
|
||||
@@ -766,7 +803,7 @@ void D_SRB2Loop(void)
|
||||
{
|
||||
// Evaluate the chase cam once for every local realtic
|
||||
// This might actually be better suited inside G_Ticker or TryRunTics
|
||||
for (tic_t chasecamtics = 0; chasecamtics < realtics; chasecamtics++)
|
||||
for (tic_t chasecamtics = 0; (chasecamtics < realtics); chasecamtics++)
|
||||
{
|
||||
P_RunChaseCameras();
|
||||
}
|
||||
@@ -776,35 +813,10 @@ void D_SRB2Loop(void)
|
||||
doDisplay = true;
|
||||
}
|
||||
|
||||
#define DPADSCROLLINPUT(INPUT)\
|
||||
{\
|
||||
myev.data1 = INPUT;\
|
||||
M_Responder(&myev);\
|
||||
}
|
||||
// this is absolutely awful and i hate it lmao
|
||||
if (menuactive && (DPADUPSCROLL || DPADDOWNSCROLL || DPADLEFTSCROLL || DPADRIGHTSCROLL))
|
||||
if (menuactive)
|
||||
{
|
||||
event_t myev;
|
||||
myev.type = ev_keydown;
|
||||
|
||||
if (menuInputDelayTimer < 19)
|
||||
menuInputDelayTimer++;
|
||||
|
||||
if (menuInputDelayTimer == 19) // TICRATE * ( (k+2) (1 - [wz + h + j - q]^2 - [(gk + 2g + k + 1)(h + j) + h - z]^2 - [16(k + 1)^3(k + 2)(n + 1)^2 + 1 - f^2]^2 calculated by my butt
|
||||
{
|
||||
if (DPADUPSCROLL)
|
||||
DPADSCROLLINPUT(KEY_UPARROW)
|
||||
else if (DPADDOWNSCROLL)
|
||||
DPADSCROLLINPUT(KEY_DOWNARROW)
|
||||
else if (DPADLEFTSCROLL)
|
||||
DPADSCROLLINPUT(KEY_LEFTARROW)
|
||||
else if (DPADRIGHTSCROLL)
|
||||
DPADSCROLLINPUT(KEY_RIGHTARROW)
|
||||
}
|
||||
D_GamePadMenuScrollTicker();
|
||||
}
|
||||
else
|
||||
menuInputDelayTimer = 0;
|
||||
#undef DPADSCROLLINPUT
|
||||
|
||||
D_DeviceLEDTick();
|
||||
}
|
||||
@@ -822,7 +834,14 @@ void D_SRB2Loop(void)
|
||||
rendertimefrac = FRACUNIT;
|
||||
}
|
||||
|
||||
rendertimefrac_unpaused = g_time.timefrac;
|
||||
if ((deltatics < 1.0) && !hu_stopped)
|
||||
{
|
||||
rendertimefrac_unpaused = g_time.timefrac;
|
||||
}
|
||||
else
|
||||
{
|
||||
rendertimefrac_unpaused = FRACUNIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -845,14 +864,10 @@ void D_SRB2Loop(void)
|
||||
// consoleplayer -> displayplayers (hear sounds from viewpoint)
|
||||
S_UpdateSounds(); // move positional sounds
|
||||
|
||||
#ifdef HW3SOUND
|
||||
HW3S_EndFrameUpdate();
|
||||
#endif
|
||||
|
||||
LUA_Step();
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (! dedicated)
|
||||
if (!dedicated)
|
||||
{
|
||||
Discord_RunCallbacks();
|
||||
}
|
||||
@@ -874,7 +889,7 @@ void D_SRB2Loop(void)
|
||||
//
|
||||
// Wipes run an inner loop and artificially increase
|
||||
// the measured time.
|
||||
if (!ranwipe && frameskip < 3 && deltatics > 1.0)
|
||||
if (!ranwipe && (frameskip < 3) && (deltatics > 1.0))
|
||||
{
|
||||
frameskip++;
|
||||
}
|
||||
@@ -890,7 +905,7 @@ void D_SRB2Loop(void)
|
||||
// in the case of "match refresh rate" + vsync, don't sleep at all
|
||||
const boolean vsync_with_match_refresh = cv_vidwait.value && cv_fpscap.value == 0;
|
||||
|
||||
if (elapsed > 0 && (INT64)capbudget > elapsed && !vsync_with_match_refresh)
|
||||
if ((elapsed > 0) && ((INT64)capbudget > elapsed) && !vsync_with_match_refresh)
|
||||
{
|
||||
I_SleepDuration(capbudget - (finishprecise - enterprecise));
|
||||
}
|
||||
@@ -961,11 +976,10 @@ void D_StartTitle(void)
|
||||
//demosequence = -1;
|
||||
gametype = GT_RACE; // SRB2kart
|
||||
paused = false;
|
||||
F_StartTitleScreen();
|
||||
|
||||
// Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade
|
||||
/*if (rendermode != render_none)
|
||||
V_SetPaletteLump("PLAYPAL");*/
|
||||
S_ResetKeepAndSpecialMus(); // just in case
|
||||
|
||||
F_StartTitleScreen();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1183,19 +1197,22 @@ boolean found_extra_kart;
|
||||
boolean found_extra2_kart;
|
||||
boolean found_extra3_kart;
|
||||
|
||||
boolean xtra_speedo; // extra speedometer check
|
||||
boolean xtra_speedo_clr; // extra speedometer colour check
|
||||
boolean xtra_speedo3; // 80x 11 extra speedometer check
|
||||
boolean xtra_speedo_clr3; // 80x 11 extra speedometer colour check
|
||||
boolean achi_speedo; // achiiro speedometer check
|
||||
boolean achi_speedo_clr; // extra speedometer colour check
|
||||
boolean clr_hud; // colour hud check
|
||||
boolean big_lap; // bigger lap counter
|
||||
boolean big_lap_color; // bigger lap counter but colour
|
||||
boolean kartzspeedo; // kartZ speedo
|
||||
boolean statdp; // stat display for extended player setup
|
||||
boolean nametaggfx; // Nametag stuffs
|
||||
boolean driftgaugegfx;
|
||||
boolean xtra_speedo; // extra speedometer check
|
||||
boolean xtra_speedo_clr; // extra speedometer colour check
|
||||
boolean xtra_speedo3; // 80x 11 extra speedometer check
|
||||
boolean xtra_speedo_clr3; // 80x 11 extra speedometer colour check
|
||||
boolean achi_speedo; // achiiro speedometer check
|
||||
boolean achi_speedo_clr; // extra speedometer colour check
|
||||
boolean kartz_speedo; // kartZ speedo
|
||||
|
||||
boolean clr_hud; // colour hud check
|
||||
boolean big_lap; // bigger lap counter
|
||||
boolean big_lap_color; // bigger lap counter but colour
|
||||
boolean statdp; // stat display for extended player setup
|
||||
boolean nametaggfx; // Nametag stuffs
|
||||
boolean driftgaugegfx; // Driftgauge stuffs
|
||||
boolean multiitem_icon; // Extra icons for Sneakers, Banana and Jawz
|
||||
//
|
||||
|
||||
static void IdentifyVersion(void)
|
||||
{
|
||||
@@ -1421,8 +1438,6 @@ void D_SRB2Main(void)
|
||||
|
||||
// can't use sprintf since there is %u in savegamename
|
||||
strcatbf(savegamename, srb2home, PATHSEP);
|
||||
|
||||
I_mkdir(srb2home, 0700);
|
||||
#else
|
||||
snprintf(srb2home, sizeof srb2home, "%s", userhome);
|
||||
snprintf(downloaddir, sizeof downloaddir, "%s", userhome);
|
||||
@@ -1459,6 +1474,10 @@ void D_SRB2Main(void)
|
||||
}
|
||||
}
|
||||
|
||||
// Create addons dir
|
||||
snprintf(addonsdir, sizeof addonsdir, "%s%s%s", srb2home, PATHSEP, "addons");
|
||||
I_mkdir(addonsdir, 0755);
|
||||
|
||||
D_SetupProtocol();
|
||||
|
||||
// rand() needs seeded regardless of password
|
||||
@@ -1557,8 +1576,10 @@ void D_SRB2Main(void)
|
||||
|
||||
// Possible value that changes depending on whether required files for speedometer are found or not
|
||||
CV_PossibleValue_t speedo_cons_temp[NUMSPEEDOSTUFF] = {{1, "Default"}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}, {0, NULL}};
|
||||
CV_PossibleValue_t driftgaugestyle_cons_temp[NUMSPEEDOSTUFF] = {{1, "Default"}, {2, "Small"}, {3, "Big Numbers"}, {4, "Numbers Only"}, {0, NULL}, {0, NULL}}; // ugh i dont want this but bleh
|
||||
unsigned last_speedo_i = 0;
|
||||
#define PUSHSPEEDO(id, name) { ++last_speedo_i; speedo_cons_temp[last_speedo_i].value = id; speedo_cons_temp[last_speedo_i].strvalue = name; }
|
||||
unsigned last_driftgauge_i = 0;
|
||||
#define PUSHCONS(cons, i, id, name) { ++i; cons[i].value = id; cons[i].strvalue = name; }
|
||||
|
||||
if (found_extra_kart || found_extra2_kart || found_extra3_kart) // found the funny, add it in!
|
||||
{
|
||||
@@ -1574,7 +1595,7 @@ void D_SRB2Main(void)
|
||||
if (W_CheckMultipleLumps("SP_SMSTC", "K_TRNULL", "SP_MKMH", "SP_MMPH", "SP_MFRAC", "SP_MPERC", NULL))
|
||||
{
|
||||
xtra_speedo = true;
|
||||
PUSHSPEEDO(2, "Small");
|
||||
PUSHCONS(speedo_cons_temp, last_speedo_i, 2, "Small");
|
||||
}
|
||||
|
||||
if (W_LumpExists("SC_SMSTC"))
|
||||
@@ -1584,7 +1605,7 @@ void D_SRB2Main(void)
|
||||
if (W_CheckMultipleLumps("SP_AMSTC", "K_TRNULL", "SP_AKMH", "SP_AMPH", "SP_AFRAC", "SP_APERC", NULL))
|
||||
{
|
||||
achi_speedo = true;
|
||||
PUSHSPEEDO(3, "Achii");
|
||||
PUSHCONS(speedo_cons_temp, last_speedo_i, 3, "Achii");
|
||||
}
|
||||
|
||||
if (W_CheckMultipleLumps("SC_AMSTC", "K_TRNULL", "SC_AKMH", "SC_AMPH", "SC_AFRAC", "SC_APERC", NULL))
|
||||
@@ -1609,8 +1630,8 @@ void D_SRB2Main(void)
|
||||
"K_KZSP13", "K_KZSP14", "K_KZSP15", "K_KZSP16", "K_KZSP17", "K_KZSP18", "K_KZSP19", \
|
||||
"K_KZSP20", "K_KZSP21", "K_KZSP22", "K_KZSP23", "K_KZSP24", "K_KZSP25", NULL))
|
||||
{
|
||||
kartzspeedo = true;
|
||||
PUSHSPEEDO(4, "P-Meter");
|
||||
kartz_speedo = true;
|
||||
PUSHCONS(speedo_cons_temp, last_speedo_i, 4, "P-Meter");
|
||||
}
|
||||
|
||||
// stat display for extended player setup
|
||||
@@ -1625,13 +1646,18 @@ void D_SRB2Main(void)
|
||||
if (W_CheckMultipleLumps("K_DGAU","K_DCAU","K_DGSU","K_DCSU", NULL))
|
||||
driftgaugegfx = true;
|
||||
|
||||
// extra item icons
|
||||
if (W_CheckMultipleLumps("K_ITSHO2", "K_ITSHO3", "K_ITBAN2", "K_ITBAN3", "K_ITBAN4", "K_ITJAW2", NULL))
|
||||
multiitem_icon = true;
|
||||
|
||||
if (found_extra3_kart)
|
||||
{
|
||||
// 80x11 speedometer crap
|
||||
if (W_LumpExists("SP_SM3TC"))
|
||||
{
|
||||
xtra_speedo3 = true;
|
||||
PUSHSPEEDO(5, "Extra");
|
||||
PUSHCONS(speedo_cons_temp, last_speedo_i, 5, "Extra");
|
||||
PUSHCONS(driftgaugestyle_cons_temp, last_driftgauge_i, 5, "Extra");
|
||||
}
|
||||
|
||||
if (W_LumpExists("SC_SM3TC"))
|
||||
@@ -1639,8 +1665,9 @@ void D_SRB2Main(void)
|
||||
}
|
||||
}
|
||||
|
||||
#undef PUSHSPEEDO
|
||||
#undef PUSHCONS
|
||||
memcpy(speedo_cons_t, speedo_cons_temp, sizeof(speedo_cons_t));
|
||||
memcpy(driftgaugestyle_cons_t, driftgaugestyle_cons_temp, sizeof(driftgaugestyle_cons_t));
|
||||
|
||||
// Do it before P_InitMapData because PNG patch
|
||||
// conversion sometimes needs the palette
|
||||
@@ -1836,7 +1863,6 @@ void D_SRB2Main(void)
|
||||
}
|
||||
|
||||
S_InitMusicDefs();
|
||||
S_InitMTDefs();
|
||||
|
||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
ST_Init();
|
||||
@@ -2051,7 +2077,7 @@ void D_SRB2Main(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (! dedicated)
|
||||
if (!dedicated)
|
||||
{
|
||||
DRPC_Init();
|
||||
}
|
||||
|
||||
+17
-13
@@ -27,23 +27,27 @@ extern boolean usehome; //Alam: which path?
|
||||
extern const char *pandf; //Alam: how to path?
|
||||
extern char srb2path[256]; //Alam: SRB2's Home
|
||||
|
||||
// extra graphic patches for saturn specific thingies
|
||||
extern boolean found_extra_kart; // for use in k_kart.c
|
||||
extern boolean found_extra2_kart; // for use in k_kart.c
|
||||
extern boolean found_extra3_kart; // for use in k_kart.c
|
||||
|
||||
extern boolean xtra_speedo; // extra speedometer check
|
||||
extern boolean xtra_speedo_clr; // extra speedometer colour check
|
||||
extern boolean xtra_speedo3; // 80x11 extra speedometer check
|
||||
extern boolean xtra_speedo_clr3; // 80x11 extra speedometer colour check
|
||||
extern boolean achi_speedo; // achiiro speedometer check
|
||||
extern boolean achi_speedo_clr; // extra speedometer colour check
|
||||
extern boolean clr_hud; // colour hud check
|
||||
extern boolean big_lap; // bigger lap counter
|
||||
extern boolean big_lap_color; // bigger lap counter but colour
|
||||
extern boolean kartzspeedo; // kartZ speedo
|
||||
extern boolean statdp; // stat display for extended player setup
|
||||
extern boolean nametaggfx; // Nametag stuffs
|
||||
extern boolean driftgaugegfx;
|
||||
extern boolean xtra_speedo; // extra speedometer check
|
||||
extern boolean xtra_speedo_clr; // extra speedometer colour check
|
||||
extern boolean xtra_speedo3; // 80x11 extra speedometer check
|
||||
extern boolean xtra_speedo_clr3; // 80x11 extra speedometer colour check
|
||||
extern boolean achi_speedo; // achiiro speedometer check
|
||||
extern boolean achi_speedo_clr; // extra speedometer colour check
|
||||
extern boolean kartz_speedo; // kartZ speedo
|
||||
|
||||
extern boolean clr_hud; // colour hud check
|
||||
extern boolean big_lap; // bigger lap counter
|
||||
extern boolean big_lap_color; // bigger lap counter but colour
|
||||
extern boolean statdp; // stat display for extended player setup
|
||||
extern boolean nametaggfx; // Nametag stuffs
|
||||
extern boolean driftgaugegfx; // Driftgauge stuffs
|
||||
extern boolean multiitem_icon; // Extra icons for Sneakers, Banana and Jawz
|
||||
//
|
||||
|
||||
// autoload stuff
|
||||
extern boolean autoloading;
|
||||
|
||||
+4
-15
@@ -69,8 +69,6 @@ INT16 hardware_MAXPACKETLENGTH;
|
||||
|
||||
boolean (*I_NetGet)(void) = NULL;
|
||||
void (*I_NetSend)(void) = NULL;
|
||||
boolean (*I_NetCanSend)(void) = NULL;
|
||||
boolean (*I_NetCanGet)(void) = NULL;
|
||||
void (*I_NetCloseSocket)(void) = NULL;
|
||||
void (*I_NetFreeNodenum)(INT32 nodenum) = NULL;
|
||||
SINT8 (*I_NetMakeNodewPort)(const char *address, const char* port) = NULL;
|
||||
@@ -640,6 +638,7 @@ void Net_WaitAllAckReceived(UINT32 timeout)
|
||||
static void InitNode(node_t *node)
|
||||
{
|
||||
node->acktosend_head = node->acktosend_tail = 0;
|
||||
memset(node->acktosend, 0, sizeof(node->acktosend));
|
||||
node->firstacktosend = 0;
|
||||
node->nextacknum = 1;
|
||||
node->remotefirstack = 0;
|
||||
@@ -1087,15 +1086,7 @@ boolean HSendPacket(INT32 node, boolean reliable, UINT8 acknum, size_t packetlen
|
||||
netbuffer->ackreturn = 0;
|
||||
if (reliable)
|
||||
{
|
||||
if (I_NetCanSend && !I_NetCanSend())
|
||||
{
|
||||
if (netbuffer->packettype < PT_CANFAIL)
|
||||
GetFreeAcknum(&netbuffer->ack, true);
|
||||
|
||||
DEBFILE("HSendPacket: Out of bandwidth\n");
|
||||
return false;
|
||||
}
|
||||
else if (!GetFreeAcknum(&netbuffer->ack, false))
|
||||
if (!GetFreeAcknum(&netbuffer->ack, false))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -1292,7 +1283,6 @@ boolean D_CheckNetGame(void)
|
||||
|
||||
I_NetGet = Internal_Get;
|
||||
I_NetSend = Internal_Send;
|
||||
I_NetCanSend = NULL;
|
||||
I_NetCloseSocket = NULL;
|
||||
I_NetFreeNodenum = Internal_FreeNodenum;
|
||||
I_NetMakeNodewPort = NULL;
|
||||
@@ -1350,9 +1340,9 @@ boolean D_CheckNetGame(void)
|
||||
I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES);
|
||||
|
||||
netbuffer = (doomdata_t *)(void *)&doomcom->data;
|
||||
#ifdef HOLEPUNCH
|
||||
#ifdef HOLEPUNCH
|
||||
holepunchpacket = (holepunch_t *)(void *)&doomcom->data;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGFILE
|
||||
if (M_CheckParm("-debugfile"))
|
||||
@@ -1491,7 +1481,6 @@ void D_CloseConnection(void)
|
||||
|
||||
I_NetGet = Internal_Get;
|
||||
I_NetSend = Internal_Send;
|
||||
I_NetCanSend = NULL;
|
||||
I_NetCloseSocket = NULL;
|
||||
I_NetFreeNodenum = Internal_FreeNodenum;
|
||||
I_NetMakeNodewPort = NULL;
|
||||
|
||||
+274
-326
@@ -16,6 +16,7 @@
|
||||
|
||||
#include "console.h"
|
||||
#include "command.h"
|
||||
#include "dehacked.h"
|
||||
#include "i_time.h"
|
||||
#include "i_system.h"
|
||||
#include "g_game.h"
|
||||
@@ -141,6 +142,8 @@ static void Command_Addfile(void);
|
||||
static void Command_Addskins(void);
|
||||
static void Command_GLocalSkin(void);
|
||||
static void Command_ListWADS_f(void);
|
||||
static void Command_ListDoomednums_f(void);
|
||||
static void Command_ListUnusedSprites_f(void);
|
||||
static void Command_RunSOC(void);
|
||||
static void Command_Pause(void);
|
||||
static void Command_Respawn(void);
|
||||
@@ -206,13 +209,6 @@ void SendWeaponPref3(void);
|
||||
void SendWeaponPref4(void);
|
||||
|
||||
static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force"}, {0, NULL}};
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
static CV_PossibleValue_t mouse2port_cons_t[] = {{0, "/dev/gpmdata"}, {1, "/dev/ttyS0"},
|
||||
{2, "/dev/ttyS1"}, {3, "/dev/ttyS2"}, {4, "/dev/ttyS3"}, {0, NULL}};
|
||||
#else
|
||||
static CV_PossibleValue_t mouse2port_cons_t[] = {{1, "COM1"}, {2, "COM2"}, {3, "COM3"}, {4, "COM4"},
|
||||
{0, NULL}};
|
||||
#endif
|
||||
|
||||
#ifdef LJOYSTICK
|
||||
static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, {3, "/dev/js2"},
|
||||
@@ -295,22 +291,22 @@ consvar_t cv_skipmapcheck = {"skipmapcheck", "Off", CV_SAVE, CV_OnOff, NULL, 0,
|
||||
INT32 cv_debug;
|
||||
|
||||
consvar_t cv_usemouse = {"use_mouse", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usemouse2 = {"use_mouse2", "Off", CV_SAVE|CV_CALL,usemouse_cons_t, I_StartupMouse2, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
//WTF
|
||||
consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Lagless camera! Yay!
|
||||
consvar_t cv_laglesscam = {"laglesscamera", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_verticallook = {"verticallook", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#if defined(HAVE_SDL) || defined(_WINDOWS) //joystick 1 and 2
|
||||
consvar_t cv_usejoystick = {"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick2 = {"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick3 = {"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick4 = {"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t,
|
||||
I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_usejoystick[MAXSPLITSCREENPLAYERS] = {
|
||||
{"use_joystick", "1", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick1, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick2", "2", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick3", "3", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_cons_t, I_InitJoystick4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if (defined (LJOYSTICK) || defined (HAVE_SDL))
|
||||
@@ -318,19 +314,17 @@ consvar_t cv_usejoystick4 = {"use_joystick4", "4", CV_SAVE|CV_CALL, usejoystick_
|
||||
consvar_t cv_joyport = {"joyport", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyport2 = {"joyport2", "/dev/js0", CV_SAVE, joyport_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: for later
|
||||
#endif
|
||||
consvar_t cv_joyscale = {"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyscale2 = {"joyscale2", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale2, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyscale3 = {"joyscale3", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale3, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyscale4 = {"joyscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS] = {
|
||||
{"joyscale", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale2", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale2, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale3", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale3, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale4", "1", CV_SAVE|CV_CALL, NULL, I_JoyScale4, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#else
|
||||
consvar_t cv_joyscale = {"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: Dummy for save
|
||||
consvar_t cv_joyscale2 = {"joyscale2", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; //Alam: Dummy for save
|
||||
#endif
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
consvar_t cv_mouse2port = {"mouse2port", "/dev/gpmdata", CV_SAVE, mouse2port_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mouse2opt = {"mouse2opt", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
#else
|
||||
consvar_t cv_mouse2port = {"mouse2port", "COM2", CV_SAVE, mouse2port_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_joyscale[2] = { //Alam: Dummy for save
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"joyscale", "1", CV_SAVE|CV_HIDEN, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}
|
||||
};
|
||||
#endif
|
||||
|
||||
consvar_t cv_matchboxes = {"matchboxes", "Normal", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, matchboxes_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -399,18 +393,18 @@ static CV_PossibleValue_t kartvoices_cons_t[] = {{0, "Never"}, {1, "Tasteful"},
|
||||
consvar_t cv_kartvoices = {"kartvoices", "Tasteful", CV_SAVE, kartvoices_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_karthitemdialog = {"karthitemdialog", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_karteliminatelast = {"karteliminatelast", "Yes", CV_NETVAR|CV_CHEAT|CV_CALL|CV_NOSHOWHELP, CV_YesNo, KartEliminateLast_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_karteliminatelast = {"karteliminatelast", "Yes", CV_NETVAR|CV_CHEAT|CV_CALL, CV_YesNo, KartEliminateLast_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t kartdebugitem_cons_t[] = {{-1, "MIN"}, {NUMKARTITEMS-1, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_kartdebugitem = {"kartdebugitem", "0", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, kartdebugitem_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugitem = {"kartdebugitem", "0", CV_NETVAR|CV_CHEAT, kartdebugitem_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t kartdebugamount_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_kartdebugamount = {"kartdebugamount", "1", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, kartdebugamount_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugshrink = {"kartdebugshrink", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugdistribution = {"kartdebugdistribution", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebughuddrop = {"kartdebughuddrop", "Off", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugamount = {"kartdebugamount", "1", CV_NETVAR|CV_CHEAT, kartdebugamount_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugshrink = {"kartdebugshrink", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugdistribution = {"kartdebugdistribution", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebughuddrop = {"kartdebughuddrop", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_kartdebugcheckpoint = {"kartdebugcheckpoint", "Off", CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugnodes = {"kartdebugnodes", "Off", CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugcheckpoint = {"kartdebugcheckpoint", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugnodes = {"kartdebugnodes", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_kartdebugcolorize = {"kartdebugcolorize", "Off", CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t votetime_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, NULL}};
|
||||
@@ -485,12 +479,6 @@ consvar_t cv_pingstyle = {"pingstyle", "New", CV_SAVE, cv_pingstyle_cons_t, 0, 0
|
||||
|
||||
consvar_t cv_luaimmersion = {"luaimmersion", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_minihead = {"smallminimapplayers", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showminimapnames = {"showminimapnames", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showlapemblem = {"showlapemblem", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showviewpointtext = {"showviewpointtext", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_showdownloadprompt = {"showdownloadprompt", "On", CV_SAVE, CV_OnOff, 0, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -511,45 +499,6 @@ consvar_t cv_mute = {"mute", "Off", CV_NETVAR|CV_CALL, CV_OnOff, Mute_OnChange,
|
||||
|
||||
consvar_t cv_sleep = {"cpusleep", "1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t nametagtrans_cons_t[] = {
|
||||
{0, "Never"}, {1, "Far only"}, {2, "Dynamic"}, {3, "Always"}, {4, "HUD Trans."}, {0, NULL}};
|
||||
/*static CV_PossibleValue_t nametagscaling_cons_t[] = {
|
||||
{0, "MIN"}, {320, "MAX"}, {0, NULL}};*/
|
||||
static CV_PossibleValue_t nametagdistance_cons_t[] = {
|
||||
{0, "MIN"}, {640, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t nametagmaxplayer_cons_t[] = {
|
||||
{1, "MIN"}, {MAXPLAYERS, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t nametagsize_cons_t[] = {
|
||||
{0, "Off"}, {1, "Small"}, {2, "Minimal"}, {0, NULL}};
|
||||
static CV_PossibleValue_t nametagrestat_cons_t[] = {
|
||||
{0, "Off"}, {1, "Restat"}, {2, "Always"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_nametag = {"kartnametag", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagtrans = {"kartnametagtransparency", "Dynamic", CV_SAVE, nametagtrans_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagfacerank = {"kartnametagfacerank", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagrestat = {"kartnametagrestat", "Restat", CV_SAVE, nametagrestat_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagdist = {"kartnametagdist", "320", CV_SAVE, nametagdistance_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagmaxplayers = {"kartnametagmaxplayers", "3", CV_SAVE, nametagmaxplayer_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagmaxlenght = {"kartnametagmaxlenght", "12", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
//consvar_t cv_nametagscaling = {"nametagscaling", "160", CV_SAVE, nametagscaling_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showownnametag = {"kartnametagshowown", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_smallnametags = {"kartnametagsmall", "Off", CV_SAVE, nametagsize_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametaghop = {"kartnametaghop", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_nametagscore = {"kartnametagscore", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shownametagfinish = {"kartshownametagfinished", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_shownametagspectator = {"kartshownametagspectator", "No", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t driftgaugeoffset_cons_t[] = {
|
||||
{-FRACUNIT*128, "MIN"}, {FRACUNIT*128, "MAX"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t driftgaugestyle_cons_t[] = {
|
||||
{1, "Default"}, {2, "Small"}, {3, "Big Numbers"}, {4, "Numbers Only"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_driftgauge = {"kartdriftgauge", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftgaugeofs = {"kartdriftgaugeoffset", "-20", CV_FLOAT|CV_SAVE, driftgaugeoffset_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftgaugetrans = {"kartdriftgaugetransparency", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftgaugestyle = {"kartdriftgaugestyle", "1", CV_SAVE, driftgaugestyle_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static CV_PossibleValue_t skinselectspin_cons_t[] = {
|
||||
{0, "Off"}, {1, "Slow"}, {2, "2"}, {3, "3"}, {4, "4"}, {5, "5"}, {6, "6"}, {7, "7"}, {8, "8"}, {9, "9"}, {10, "Fast"}, {SKINSELECTSPIN_PAIN, "Pain"}, {0, NULL}};
|
||||
consvar_t cv_skinselectspin = {"skinselectspin", "5", CV_SAVE, skinselectspin_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -567,7 +516,9 @@ static CV_PossibleValue_t ps_descriptor_cons_t[] = {
|
||||
{1, "Average"}, {2, "SD"}, {3, "Minimum"}, {4, "Maximum"}, {0, NULL}};
|
||||
consvar_t cv_ps_descriptor = {"ps_descriptor", "Average", 0, ps_descriptor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_director = {"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
// only there to better keep track of it globally
|
||||
consvar_t cv_director = {"director", "Off", CV_HIDEN, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_kartdebugdirector = {"debugdirector", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showdirectorhud = {"showdirectorhud", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -703,6 +654,8 @@ void D_RegisterServerCommands(void)
|
||||
COM_AddCommand("addskins", Command_Addskins);
|
||||
COM_AddCommand("localskin", Command_GLocalSkin);
|
||||
COM_AddCommand("listwad", Command_ListWADS_f);
|
||||
COM_AddCommand("listmapthings", Command_ListDoomednums_f);
|
||||
COM_AddCommand("listunusedsprites", Command_ListUnusedSprites_f);
|
||||
|
||||
COM_AddCommand("runsoc", Command_RunSOC);
|
||||
COM_AddCommand("pause", Command_Pause);
|
||||
@@ -900,10 +853,13 @@ void D_RegisterClientCommands(void)
|
||||
COM_AddCommand("screenshot", M_ScreenShot);
|
||||
COM_AddCommand("startmovie", Command_StartMovie_f);
|
||||
COM_AddCommand("stopmovie", Command_StopMovie_f);
|
||||
COM_AddCommand("minigen", M_MinimapGenerate);
|
||||
|
||||
CV_RegisterVar(&cv_screenshot_option);
|
||||
CV_RegisterVar(&cv_screenshot_folder);
|
||||
CV_RegisterVar(&cv_moviemode);
|
||||
CV_RegisterVar(&cv_movie_option);
|
||||
CV_RegisterVar(&cv_movie_folder);
|
||||
// PNG variables
|
||||
CV_RegisterVar(&cv_zlib_level);
|
||||
CV_RegisterVar(&cv_zlib_memory);
|
||||
@@ -952,6 +908,8 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_rollingdemos);
|
||||
CV_RegisterVar(&cv_netstat);
|
||||
CV_RegisterVar(&cv_netticbuffer);
|
||||
CV_RegisterVar(&cv_mindelay);
|
||||
CV_RegisterVar(&cv_lagless);
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
CV_RegisterVar(&cv_fishcake);
|
||||
@@ -1006,71 +964,29 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_showlocalskinmenus);
|
||||
|
||||
//CV_RegisterVar(&cv_crosshair);
|
||||
//CV_RegisterVar(&cv_crosshair2);
|
||||
//CV_RegisterVar(&cv_crosshair3);
|
||||
//CV_RegisterVar(&cv_crosshair4);
|
||||
//CV_RegisterVar(&cv_alwaysfreelook);
|
||||
//CV_RegisterVar(&cv_alwaysfreelook2);
|
||||
//CV_RegisterVar(&cv_chasefreelook);
|
||||
//CV_RegisterVar(&cv_chasefreelook2);
|
||||
CV_RegisterVar(&cv_replaysearchrate);
|
||||
CV_RegisterVar(&cv_showfocuslost);
|
||||
CV_RegisterVar(&cv_pauseifunfocused);
|
||||
|
||||
// g_input.c
|
||||
CV_RegisterVar(&cv_turnaxis);
|
||||
CV_RegisterVar(&cv_turnaxis2);
|
||||
CV_RegisterVar(&cv_turnaxis3);
|
||||
CV_RegisterVar(&cv_turnaxis4);
|
||||
CV_RegisterVar(&cv_moveaxis);
|
||||
CV_RegisterVar(&cv_moveaxis2);
|
||||
CV_RegisterVar(&cv_moveaxis3);
|
||||
CV_RegisterVar(&cv_moveaxis4);
|
||||
CV_RegisterVar(&cv_brakeaxis);
|
||||
CV_RegisterVar(&cv_brakeaxis2);
|
||||
CV_RegisterVar(&cv_brakeaxis3);
|
||||
CV_RegisterVar(&cv_brakeaxis4);
|
||||
CV_RegisterVar(&cv_aimaxis);
|
||||
CV_RegisterVar(&cv_aimaxis2);
|
||||
CV_RegisterVar(&cv_aimaxis3);
|
||||
CV_RegisterVar(&cv_aimaxis4);
|
||||
CV_RegisterVar(&cv_lookaxis);
|
||||
CV_RegisterVar(&cv_lookaxis2);
|
||||
CV_RegisterVar(&cv_lookaxis3);
|
||||
CV_RegisterVar(&cv_lookaxis4);
|
||||
CV_RegisterVar(&cv_fireaxis);
|
||||
CV_RegisterVar(&cv_fireaxis2);
|
||||
CV_RegisterVar(&cv_fireaxis3);
|
||||
CV_RegisterVar(&cv_fireaxis4);
|
||||
CV_RegisterVar(&cv_driftaxis);
|
||||
CV_RegisterVar(&cv_driftaxis2);
|
||||
CV_RegisterVar(&cv_driftaxis3);
|
||||
CV_RegisterVar(&cv_driftaxis4);
|
||||
CV_RegisterVar(&cv_lookbackaxis);
|
||||
CV_RegisterVar(&cv_lookbackaxis2);
|
||||
CV_RegisterVar(&cv_lookbackaxis3);
|
||||
CV_RegisterVar(&cv_lookbackaxis4);
|
||||
CV_RegisterVar(&cv_custom1axis);
|
||||
CV_RegisterVar(&cv_custom1axis2);
|
||||
CV_RegisterVar(&cv_custom1axis3);
|
||||
CV_RegisterVar(&cv_custom1axis4);
|
||||
CV_RegisterVar(&cv_custom2axis);
|
||||
CV_RegisterVar(&cv_custom2axis2);
|
||||
CV_RegisterVar(&cv_custom2axis3);
|
||||
CV_RegisterVar(&cv_custom2axis4);
|
||||
CV_RegisterVar(&cv_custom3axis);
|
||||
CV_RegisterVar(&cv_custom3axis2);
|
||||
CV_RegisterVar(&cv_custom3axis3);
|
||||
CV_RegisterVar(&cv_custom3axis4);
|
||||
CV_RegisterVar(&cv_xdeadzone);
|
||||
CV_RegisterVar(&cv_ydeadzone);
|
||||
CV_RegisterVar(&cv_xdeadzone2);
|
||||
CV_RegisterVar(&cv_ydeadzone2);
|
||||
CV_RegisterVar(&cv_xdeadzone3);
|
||||
CV_RegisterVar(&cv_ydeadzone3);
|
||||
CV_RegisterVar(&cv_xdeadzone4);
|
||||
CV_RegisterVar(&cv_ydeadzone4);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_turnaxis[i]);
|
||||
CV_RegisterVar(&cv_moveaxis[i]);
|
||||
CV_RegisterVar(&cv_camturnaxis[i]);
|
||||
CV_RegisterVar(&cv_camstrafeaxis[i]);
|
||||
CV_RegisterVar(&cv_brakeaxis[i]);
|
||||
CV_RegisterVar(&cv_aimaxis[i]);
|
||||
CV_RegisterVar(&cv_lookaxis[i]);
|
||||
CV_RegisterVar(&cv_fireaxis[i]);
|
||||
CV_RegisterVar(&cv_driftaxis[i]);
|
||||
CV_RegisterVar(&cv_lookbackaxis[i]);
|
||||
CV_RegisterVar(&cv_custom1axis[i]);
|
||||
CV_RegisterVar(&cv_custom2axis[i]);
|
||||
CV_RegisterVar(&cv_custom3axis[i]);
|
||||
CV_RegisterVar(&cv_xdeadzone[i]);
|
||||
CV_RegisterVar(&cv_ydeadzone[i]);
|
||||
}
|
||||
|
||||
// filesrch.c
|
||||
CV_RegisterVar(&cv_addons_option);
|
||||
@@ -1080,12 +996,6 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_addons_search_type);
|
||||
CV_RegisterVar(&cv_addons_search_case);
|
||||
|
||||
// WARNING: the order is important when initialising mouse2
|
||||
// we need the mouse2port
|
||||
CV_RegisterVar(&cv_mouse2port);
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
CV_RegisterVar(&cv_mouse2opt);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_controlperkey);
|
||||
CV_RegisterVar(&cv_turnsmooth);
|
||||
|
||||
@@ -1097,38 +1007,24 @@ void D_RegisterClientCommands(void)
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_usemouse);
|
||||
CV_RegisterVar(&cv_usemouse2);
|
||||
CV_RegisterVar(&cv_invertmouse);
|
||||
CV_RegisterVar(&cv_invertmouse2);
|
||||
CV_RegisterVar(&cv_mousesens);
|
||||
CV_RegisterVar(&cv_mousesens2);
|
||||
CV_RegisterVar(&cv_mouseysens);
|
||||
CV_RegisterVar(&cv_mouseysens2);
|
||||
//CV_RegisterVar(&cv_mousemove);
|
||||
//CV_RegisterVar(&cv_mousemove2);
|
||||
|
||||
CV_RegisterVar(&cv_usejoystick);
|
||||
CV_RegisterVar(&cv_usejoystick2);
|
||||
CV_RegisterVar(&cv_usejoystick3);
|
||||
CV_RegisterVar(&cv_usejoystick4);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_usejoystick[i]);
|
||||
}
|
||||
#ifdef LJOYSTICK
|
||||
CV_RegisterVar(&cv_joyport);
|
||||
CV_RegisterVar(&cv_joyport2);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_joyscale);
|
||||
CV_RegisterVar(&cv_joyscale2);
|
||||
CV_RegisterVar(&cv_joyscale3);
|
||||
CV_RegisterVar(&cv_joyscale4);
|
||||
|
||||
// Analog Control
|
||||
/*CV_RegisterVar(&cv_analog);
|
||||
CV_RegisterVar(&cv_analog2);
|
||||
CV_RegisterVar(&cv_analog3);
|
||||
CV_RegisterVar(&cv_analog4);
|
||||
CV_RegisterVar(&cv_useranalog);
|
||||
CV_RegisterVar(&cv_useranalog2);
|
||||
CV_RegisterVar(&cv_useranalog3);
|
||||
CV_RegisterVar(&cv_useranalog4);*/
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_joyscale[i]);
|
||||
}
|
||||
|
||||
// s_sound.c
|
||||
CV_RegisterVar(&cv_soundvolume);
|
||||
@@ -1157,26 +1053,6 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
||||
CV_RegisterVar(&cv_soundtest);
|
||||
|
||||
CV_RegisterVar(&cv_nametag);
|
||||
CV_RegisterVar(&cv_nametagtrans);
|
||||
CV_RegisterVar(&cv_nametagfacerank);
|
||||
CV_RegisterVar(&cv_nametagmaxplayers);
|
||||
CV_RegisterVar(&cv_nametagmaxlenght);
|
||||
//CV_RegisterVar(&cv_nametagscaling);
|
||||
CV_RegisterVar(&cv_nametagdist);
|
||||
CV_RegisterVar(&cv_showownnametag);
|
||||
CV_RegisterVar(&cv_smallnametags);
|
||||
CV_RegisterVar(&cv_nametagrestat);
|
||||
CV_RegisterVar(&cv_nametaghop);
|
||||
CV_RegisterVar(&cv_nametagscore);
|
||||
CV_RegisterVar(&cv_shownametagfinish);
|
||||
CV_RegisterVar(&cv_shownametagspectator);
|
||||
|
||||
CV_RegisterVar(&cv_driftgauge);
|
||||
CV_RegisterVar(&cv_driftgaugeofs);
|
||||
CV_RegisterVar(&cv_driftgaugetrans);
|
||||
CV_RegisterVar(&cv_driftgaugestyle);
|
||||
|
||||
CV_RegisterVar(&cv_perfstats);
|
||||
CV_RegisterVar(&cv_ps_thinkframe_page);
|
||||
@@ -1192,6 +1068,8 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_laglesscam);
|
||||
|
||||
CV_RegisterVar(&cv_verticallook);
|
||||
|
||||
// ingame object placing
|
||||
COM_AddCommand("objectplace", Command_ObjectPlace_f);
|
||||
COM_AddCommand("writethings", Command_Writethings_f);
|
||||
@@ -1675,25 +1553,9 @@ static void SendNameAndColor(void)
|
||||
}
|
||||
else if ((foundskin = R_SkinAvailable(cv_skin.string)) != -1)
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin.value != players[consoleplayer].skin);
|
||||
|
||||
SetPlayerSkin(consoleplayer, cv_skin.string);
|
||||
CV_StealthSet(&cv_skin, skins[cv_skin.value].name);
|
||||
|
||||
// SRB2Kart
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor, skins[cv_skin.value].prefcolor);
|
||||
|
||||
players[consoleplayer].skincolor = (cv_playercolor.value&0x3F) % MAXSKINCOLORS;
|
||||
|
||||
if (players[consoleplayer].mo)
|
||||
players[consoleplayer].mo->color = (UINT8)players[consoleplayer].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1737,7 +1599,7 @@ static void SendNameAndColor(void)
|
||||
WRITESTRINGN(p, cv_playername.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin.value);
|
||||
SendNetXCmd(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(0, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
// splitscreen
|
||||
@@ -1807,24 +1669,8 @@ static void SendNameAndColor2(void)
|
||||
|
||||
if ((foundskin = R_SkinAvailable(cv_skin2.string)) != -1)
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin2.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin2.value != players[secondplaya].skin);
|
||||
|
||||
SetPlayerSkin(secondplaya, cv_skin2.string);
|
||||
|
||||
// SRB2Kart
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor2, skins[players[secondplaya].skin].prefcolor);
|
||||
|
||||
players[secondplaya].skincolor = (cv_playercolor2.value&0x3F) % MAXSKINCOLORS;
|
||||
|
||||
if (players[secondplaya].mo)
|
||||
players[secondplaya].mo->color = players[secondplaya].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1867,7 +1713,7 @@ static void SendNameAndColor2(void)
|
||||
WRITESTRINGN(p, cv_playername2.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor2.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin2.value);
|
||||
SendNetXCmd2(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(1, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void SendNameAndColor3(void)
|
||||
@@ -1988,7 +1834,7 @@ static void SendNameAndColor3(void)
|
||||
WRITESTRINGN(p, cv_playername3.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor3.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin3.value);
|
||||
SendNetXCmd3(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(2, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void SendNameAndColor4(void)
|
||||
@@ -2057,24 +1903,8 @@ static void SendNameAndColor4(void)
|
||||
|
||||
if ((foundskin = R_SkinAvailable(cv_skin4.string)) != -1)
|
||||
{
|
||||
//boolean notsame;
|
||||
|
||||
cv_skin4.value = foundskin;
|
||||
|
||||
//notsame = (cv_skin4.value != players[fourthplaya].skin);
|
||||
|
||||
SetPlayerSkin(fourthplaya, cv_skin4.string);
|
||||
|
||||
// SRB2Kart
|
||||
/*if (notsame)
|
||||
{
|
||||
CV_StealthSetValue(&cv_playercolor4, skins[players[fourthplaya].skin].prefcolor);
|
||||
|
||||
players[fourthplaya].skincolor = (cv_playercolor4.value&0x3F) % MAXSKINCOLORS;
|
||||
|
||||
if (players[fourthplaya].mo)
|
||||
players[fourthplaya].mo->color = players[fourthplaya].skincolor;
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2117,7 +1947,7 @@ static void SendNameAndColor4(void)
|
||||
WRITESTRINGN(p, cv_playername4.zstring, MAXPLAYERNAME);
|
||||
WRITEUINT8(p, (UINT8)cv_playercolor4.value);
|
||||
WRITEUINT8(p, (UINT8)cv_skin4.value);
|
||||
SendNetXCmd4(XD_NAMEANDCOLOR, buf, p - buf);
|
||||
SendNetXCmdForPlayer(3, XD_NAMEANDCOLOR, buf, p - buf);
|
||||
}
|
||||
|
||||
static void Got_NameAndColor(UINT8 **cp, INT32 playernum)
|
||||
@@ -2222,11 +2052,9 @@ void SendWeaponPref(void)
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam.value)
|
||||
if (cv_flipcam[0].value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog.value)
|
||||
buf[0] |= 2;
|
||||
SendNetXCmd(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(0, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
void SendWeaponPref2(void)
|
||||
@@ -2234,11 +2062,9 @@ void SendWeaponPref2(void)
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam2.value)
|
||||
if (cv_flipcam[1].value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog2.value)
|
||||
buf[0] |= 2;
|
||||
SendNetXCmd2(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(1, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
void SendWeaponPref3(void)
|
||||
@@ -2246,11 +2072,9 @@ void SendWeaponPref3(void)
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam3.value)
|
||||
if (cv_flipcam[2].value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog3.value)
|
||||
buf[0] |= 2;
|
||||
SendNetXCmd3(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(2, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
void SendWeaponPref4(void)
|
||||
@@ -2258,11 +2082,9 @@ void SendWeaponPref4(void)
|
||||
UINT8 buf[1];
|
||||
|
||||
buf[0] = 0;
|
||||
if (cv_flipcam4.value)
|
||||
if (cv_flipcam[3].value)
|
||||
buf[0] |= 1;
|
||||
if (cv_analog4.value)
|
||||
buf[0] |= 2;
|
||||
SendNetXCmd4(XD_WEAPONPREF, buf, 1);
|
||||
SendNetXCmdForPlayer(3, XD_WEAPONPREF, buf, 1);
|
||||
}
|
||||
|
||||
static void Got_WeaponPref(UINT8 **cp,INT32 playernum)
|
||||
@@ -2394,7 +2216,7 @@ static void Command_View_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (demo.freecam)
|
||||
if (camera[viewnum-1].freecam)
|
||||
return;
|
||||
|
||||
displayplayerp = &displayplayers[viewnum-1];
|
||||
@@ -2521,6 +2343,15 @@ static void Command_Playdemo_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!demo.playback && gamestate == GS_LEVEL) // special case: allow starting another demo while watching a demo
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't play a demo while in a game.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
// turn off any open menus
|
||||
M_ClearMenus(true);
|
||||
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
@@ -2560,6 +2391,15 @@ static void Command_Timedemo_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!demo.playback && gamestate == GS_LEVEL) // special case: allow starting another demo while watching a demo
|
||||
{
|
||||
CONS_Printf(M_GetText("You can't time a demo while in a game.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
// turn off any open menus
|
||||
M_ClearMenus(true);
|
||||
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
@@ -2594,8 +2434,6 @@ static void Command_StopMovie_f(void)
|
||||
|
||||
INT32 mapchangepending = 0;
|
||||
|
||||
tic_t driftsparkGrowTimer[MAXPLAYERS];
|
||||
|
||||
/** Runs a map change.
|
||||
* The supplied data are assumed to be good. If provided by a user, they will
|
||||
* have already been checked in Command_Map_f().
|
||||
@@ -2629,9 +2467,6 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean r
|
||||
CONS_Debug(DBG_GAMELOGIC, "Map change: mapnum=%d gametype=%d encoremode=%d resetplayers=%d delay=%d skipprecutscene=%d\n",
|
||||
mapnum, newgametype, pencoremode, resetplayers, delay, skipprecutscene);
|
||||
|
||||
// just gonna hack in a timer reset here...
|
||||
memset(driftsparkGrowTimer, 0, sizeof(driftsparkGrowTimer));
|
||||
|
||||
if (netgame || multiplayer)
|
||||
FLS = false;
|
||||
|
||||
@@ -2841,6 +2676,8 @@ static void Command_Map_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
M_ClearMenus(true);
|
||||
|
||||
last_map_cmd = I_GetTime();
|
||||
|
||||
size_t first_option;
|
||||
@@ -3023,11 +2860,17 @@ static void Command_Map_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
// spend atleast 35 seconds in one map
|
||||
if (cv_demochangemap.value && demo.recording && demo.savemode != DSM_NOTSAVING && (timeinmap > 1463) && ((cv_demochangemap.value == 2 && newmapnum == gamemap) || newmapnum != gamemap))
|
||||
G_SaveDemo();
|
||||
if (cv_demochangemap.value && demo.recording)
|
||||
{
|
||||
// spend atleast 40 seconds in one map
|
||||
if (demo.savemode != DSM_NOTSAVING && (timeinmap > (TICRATE * 40)) && ((cv_demochangemap.value == 2 && newmapnum == gamemap) || newmapnum != gamemap))
|
||||
G_SaveDemo();
|
||||
else
|
||||
G_ResetDemoRecording();
|
||||
}
|
||||
|
||||
fromlevelselect = false;
|
||||
|
||||
D_MapChange(newmapnum, newgametype, newencoremode, newresetplayers, 0, false, false);
|
||||
|
||||
Z_Free(realmapname);
|
||||
@@ -3114,7 +2957,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
SetPlayerSkinByNum(0, cv_chooseskin.value-1);
|
||||
|
||||
//mapnumber = M_MapNumber(mapname[3], mapname[4]);
|
||||
//LUAh_MapChange(mapnumber);
|
||||
//LUA_HookInt(mapnumber, HOOK(MapChange));
|
||||
|
||||
demo.savemode = (cv_recordmultiplayerdemos.value == 2) ? DSM_WILLAUTOSAVE : DSM_NOTSAVING;
|
||||
demo.savebutton = 0;
|
||||
@@ -3311,7 +3154,7 @@ static void Got_Respawn(UINT8 **cp, INT32 playernum)
|
||||
return;
|
||||
|
||||
if (players[respawnplayer].mo)
|
||||
P_DamageMobj(players[respawnplayer].mo, NULL, NULL, 10000);
|
||||
P_DamageMobj(players[respawnplayer].mo, NULL, NULL, DMG_INSTAKILL);
|
||||
demo_extradata[playernum] |= DXD_RESPAWN;
|
||||
}
|
||||
|
||||
@@ -3474,7 +3317,7 @@ static void Command_Teamchange_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(0, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_Teamchange2_f(void)
|
||||
@@ -3565,7 +3408,7 @@ static void Command_Teamchange2_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd2(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(1, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_Teamchange3_f(void)
|
||||
@@ -3656,7 +3499,7 @@ static void Command_Teamchange3_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd3(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(2, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_Teamchange4_f(void)
|
||||
@@ -3747,7 +3590,7 @@ static void Command_Teamchange4_f(void)
|
||||
}
|
||||
|
||||
usvalue = SHORT(NetPacket.value.l|NetPacket.value.b);
|
||||
SendNetXCmd4(XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
SendNetXCmdForPlayer(3, XD_TEAMCHANGE, &usvalue, sizeof(usvalue));
|
||||
}
|
||||
|
||||
static void Command_ServerTeamChange_f(void)
|
||||
@@ -4013,19 +3856,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
if (!players[playernum].spectator)
|
||||
{
|
||||
if (players[playernum].mo)
|
||||
{
|
||||
//if (!players[playernum].spectator)
|
||||
P_DamageMobj(players[playernum].mo, NULL, NULL, 10000);
|
||||
/*else
|
||||
{
|
||||
if (players[playernum].mo)
|
||||
{
|
||||
P_RemoveMobj(players[playernum].mo);
|
||||
players[playernum].mo = NULL;
|
||||
}
|
||||
players[playernum].playerstate = PST_REBORN;
|
||||
}*/
|
||||
}
|
||||
P_DamageMobj(players[playernum].mo, NULL, NULL, DMG_INSTAKILL);
|
||||
else
|
||||
players[playernum].playerstate = PST_REBORN;
|
||||
}
|
||||
@@ -4159,10 +3990,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum)
|
||||
players[playernum].mo->health = 1;
|
||||
}
|
||||
|
||||
// In tag, check to see if you still have a game.
|
||||
/*if (G_TagGametype())
|
||||
P_CheckSurvivors();
|
||||
else*/ if (G_BattleGametype())
|
||||
if (G_BattleGametype())
|
||||
K_CheckBumpers(); // SRB2Kart
|
||||
else if (G_RaceGametype())
|
||||
P_CheckRacers(); // also SRB2Kart
|
||||
@@ -4886,10 +4714,6 @@ static void Got_RequestAddfilecmd(UINT8 **cp, INT32 playernum)
|
||||
boolean kick = false;
|
||||
boolean toomany = false;
|
||||
INT32 i,j;
|
||||
serverinfo_pak *dummycheck = NULL;
|
||||
|
||||
// Shut the compiler up.
|
||||
(void)dummycheck;
|
||||
|
||||
READSTRINGN(*cp, filename, 240);
|
||||
READMEM(*cp, md5sum, 16);
|
||||
@@ -5017,6 +4841,151 @@ static void Command_ListWADS_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define MAXDOOMEDNUM 4095
|
||||
|
||||
static void Command_ListDoomednums_f(void)
|
||||
{
|
||||
INT16 i, j, k = 0, l = 0;
|
||||
INT32 argc = COM_Argc();
|
||||
INT16 table[MAXDOOMEDNUM];
|
||||
|
||||
switch (argc)
|
||||
{
|
||||
case 1:
|
||||
l = MAXDOOMEDNUM;
|
||||
break;
|
||||
case 3:
|
||||
l = atoi(COM_Argv(2));
|
||||
if (l < 1 || l > MAXDOOMEDNUM)
|
||||
{
|
||||
CONS_Printf("arg 2: doomednum \x82""%d \x85out of range (1-4095)\n", k);
|
||||
return;
|
||||
}
|
||||
//FALLTHRU
|
||||
case 2:
|
||||
k = atoi(COM_Argv(1));
|
||||
if (k < 1 || k > MAXDOOMEDNUM)
|
||||
{
|
||||
CONS_Printf("arg 1: doomednum \x82""%d \x85out of range (1-4095)\n", k);
|
||||
return;
|
||||
}
|
||||
if (!l)
|
||||
l = k;
|
||||
else if (l < k) // silently and helpfully swap.
|
||||
{
|
||||
j = k;
|
||||
k = l;
|
||||
l = j;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
CONS_Printf("listmapthings: \x86too many arguments!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// see P_SpawnNonMobjMapThing
|
||||
memset(table, 0, sizeof(table));
|
||||
for (i = 1; i <= MAXPLAYERS; i++)
|
||||
table[i-1] = MT_PLAYER; // playerstarts
|
||||
table[33-1] = table[34-1] = table[35-1] = MT_PLAYER; // battle/team starts
|
||||
table[750-1] = table[777-1] = table[778-1] = MT_UNKNOWN; // slopes
|
||||
for (i = 600; i <= 609; i++)
|
||||
table[i-1] = MT_RING; // placement patterns
|
||||
table[1705-1] = table[1713-1] = MT_HOOP; // types of hoop
|
||||
|
||||
CONS_Printf("\x82""Checking for double defines...\n");
|
||||
for (i = 1; i < MT_FIRSTFREESLOT+NUMMOBJFREESLOTS; i++)
|
||||
{
|
||||
j = mobjinfo[i].doomednum;
|
||||
if (j < (k ? k : 1) || j > (l ? l : MAXDOOMEDNUM))
|
||||
continue;
|
||||
if (table[j-1])
|
||||
{
|
||||
CONS_Printf(" doomednum \x82""%d""\x80 is \x85""double-defined\x80 by ", j);
|
||||
if (i < MT_FIRSTFREESLOT)
|
||||
{
|
||||
CONS_Printf("\x87""hardcode %s <-- MAJOR ERROR\n", MOBJTYPE_LIST[i]);
|
||||
continue;
|
||||
}
|
||||
CONS_Printf("\x81""freeslot MT_""%s\n", FREE_MOBJS[i-MT_FIRSTFREESLOT]);
|
||||
continue;
|
||||
}
|
||||
table[j-1] = i;
|
||||
}
|
||||
CONS_Printf("\x82Printing doomednum usage...\n");
|
||||
if (!k)
|
||||
{
|
||||
i = 35; // skip MT_PLAYER spam
|
||||
CONS_Printf(" doomednums \x82""1-35""\x80 are used by ""\x87""hardcode MT_PLAYER\n");
|
||||
}
|
||||
else
|
||||
i = k-1;
|
||||
|
||||
for (; i < l; i++)
|
||||
{
|
||||
if (!table[i])
|
||||
{
|
||||
if (k)
|
||||
{
|
||||
CONS_Printf(" doomednum \x82""%d""\x80 is \x83""free!", i+1);
|
||||
if (i < 99) // above the humble crawla? how dare you
|
||||
CONS_Printf(" (Don't freeslot this low...)");
|
||||
CONS_Printf("\n");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
CONS_Printf(" doomednum \x82""%d""\x80 is used by ", i+1);
|
||||
if (table[i] < MT_FIRSTFREESLOT)
|
||||
{
|
||||
CONS_Printf("\x87""hardcode %s\n", MOBJTYPE_LIST[table[i]]);
|
||||
continue;
|
||||
}
|
||||
CONS_Printf("\x81""freeslot MT_""%s\n", FREE_MOBJS[table[i]-MT_FIRSTFREESLOT]);
|
||||
}
|
||||
}
|
||||
|
||||
#undef MAXDOOMEDNUM
|
||||
|
||||
void Command_ListUnusedSprites_f(void)
|
||||
{
|
||||
size_t i, j;
|
||||
|
||||
CONS_Printf("\x82Printing sprite non-usage...\n");
|
||||
|
||||
for (i = 0; i < NUMSPRITES; i++)
|
||||
{
|
||||
if (sprites[i].numframes)
|
||||
{
|
||||
// We're only showing unused sprites...
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i < SPR_FIRSTFREESLOT)
|
||||
{
|
||||
CONS_Printf(" \x87""hardcode SPR_""%.4s\n", sprnames[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (used_spr[(i-SPR_FIRSTFREESLOT)/8] == 0xFF)
|
||||
{
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
CONS_Printf(" \x81""freeslot SPR_""%.4s\n", sprnames[i+j]);
|
||||
}
|
||||
|
||||
i += j;
|
||||
}
|
||||
|
||||
if (used_spr[(i-SPR_FIRSTFREESLOT)/8] & (1<<(i%8)))
|
||||
{
|
||||
CONS_Printf(" \x81""freeslot SPR_""%.4s\n", sprnames[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// MISC. COMMANDS
|
||||
// =========================================================================
|
||||
@@ -5306,9 +5275,6 @@ void D_GameTypeChanged(INT32 lastgametype)
|
||||
else if (!multiplayer && !netgame)
|
||||
{
|
||||
gametype = GT_RACE; // SRB2kart
|
||||
// These shouldn't matter anymore
|
||||
//CV_Set(&cv_itemrespawntime, cv_itemrespawntime.defaultvalue);
|
||||
//CV_SetValue(&cv_itemrespawn, 0);
|
||||
}
|
||||
|
||||
// reset timelimit and pointlimit in race/coop, prevent stupid cheats
|
||||
@@ -5330,19 +5296,6 @@ void D_GameTypeChanged(INT32 lastgametype)
|
||||
}
|
||||
}
|
||||
|
||||
// When swapping to a gametype that supports spectators,
|
||||
// make everyone a spectator initially.
|
||||
/*if (G_GametypeHasSpectators())
|
||||
{
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i])
|
||||
{
|
||||
players[i].ctfteam = 0;
|
||||
players[i].spectator = true;
|
||||
}
|
||||
}*/
|
||||
|
||||
// don't retain teams in other modes or between changes from ctf to team match.
|
||||
// also, stop any and all forms of team scrambling that might otherwise take place.
|
||||
if (G_GametypeHasTeams())
|
||||
@@ -5793,10 +5746,6 @@ void Command_Retry_f(void)
|
||||
CONS_Printf(M_GetText("You must be in a level to use this.\n"));
|
||||
else if (netgame || multiplayer)
|
||||
CONS_Printf(M_GetText("This only works in single player.\n"));
|
||||
/*else if (!&players[consoleplayer] || players[consoleplayer].lives <= 1)
|
||||
CONS_Printf(M_GetText("You can't retry without any lives remaining!\n"));
|
||||
else if (G_IsSpecialStage(gamemap))
|
||||
CONS_Printf(M_GetText("You can't retry special stages!\n"));*/
|
||||
else
|
||||
{
|
||||
M_ClearMenus(true);
|
||||
@@ -5866,10 +5815,9 @@ static void Command_Togglemodified_f(void)
|
||||
modifiedgame = !modifiedgame;
|
||||
}
|
||||
|
||||
extern UINT8 *save_p;
|
||||
static void Command_Archivetest_f(void)
|
||||
{
|
||||
UINT8 *buf;
|
||||
savebuffer_t save;
|
||||
UINT32 i, wrote;
|
||||
thinker_t *th;
|
||||
if (gamestate != GS_LEVEL)
|
||||
@@ -5885,28 +5833,28 @@ static void Command_Archivetest_f(void)
|
||||
((mobj_t *)th)->mobjnum = i++;
|
||||
|
||||
// allocate buffer
|
||||
buf = save_p = ZZ_Alloc(1024);
|
||||
save.buffer = save.p = ZZ_Alloc(1024);
|
||||
|
||||
// test archive
|
||||
CONS_Printf("LUA_Archive...\n");
|
||||
LUA_Archive();
|
||||
WRITEUINT8(save_p, 0x7F);
|
||||
wrote = (UINT32)(save_p-buf);
|
||||
LUA_Archive(&save, true);
|
||||
WRITEUINT8(save.p, 0x7F);
|
||||
wrote = (UINT32)(save.p - save.buffer);
|
||||
|
||||
// clear Lua state, so we can really see what happens!
|
||||
CONS_Printf("Clearing state!\n");
|
||||
LUA_ClearExtVars();
|
||||
|
||||
// test unarchive
|
||||
save_p = buf;
|
||||
save.p = save.buffer;
|
||||
CONS_Printf("LUA_UnArchive...\n");
|
||||
LUA_UnArchive();
|
||||
i = READUINT8(save_p);
|
||||
if (i != 0x7F || wrote != (UINT32)(save_p-buf))
|
||||
CONS_Printf("Savegame corrupted. (write %u, read %u)\n", wrote, (UINT32)(save_p-buf));
|
||||
LUA_UnArchive(&save, true);
|
||||
i = READUINT8(save.p);
|
||||
if (i != 0x7F || wrote != (UINT32)(save.p - save.buffer))
|
||||
CONS_Printf("Savegame corrupted. (write %u, read %u)\n", wrote, (UINT32)(save.p - save.buffer));
|
||||
|
||||
// free buffer
|
||||
Z_Free(buf);
|
||||
Z_Free(save.buffer);
|
||||
CONS_Printf("Done. No crash.\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
+4
-19
@@ -43,25 +43,12 @@ extern consvar_t cv_seenames, cv_allowseenames;
|
||||
extern consvar_t cv_usemouse;
|
||||
//WTF
|
||||
extern consvar_t cv_mouseturn;
|
||||
extern consvar_t cv_usejoystick;
|
||||
extern consvar_t cv_usejoystick2;
|
||||
extern consvar_t cv_usejoystick3;
|
||||
extern consvar_t cv_usejoystick4;
|
||||
extern consvar_t cv_usejoystick[4]; //MAXSPLITSCREENPLAYERS
|
||||
#ifdef LJOYSTICK
|
||||
extern consvar_t cv_joyport;
|
||||
extern consvar_t cv_joyport2;
|
||||
#endif
|
||||
extern consvar_t cv_joyscale;
|
||||
extern consvar_t cv_joyscale2;
|
||||
extern consvar_t cv_joyscale3;
|
||||
extern consvar_t cv_joyscale4;
|
||||
|
||||
// splitscreen with second mouse
|
||||
extern consvar_t cv_mouse2port;
|
||||
extern consvar_t cv_usemouse2;
|
||||
#if defined (__unix__) || defined (__APPLE__) || defined (UNIXCOMMON)
|
||||
extern consvar_t cv_mouse2opt;
|
||||
#endif
|
||||
extern consvar_t cv_joyscale[4]; //MAXSPLITSCREENPLAYERS
|
||||
|
||||
// normally in p_mobj but the .h is not read
|
||||
extern consvar_t cv_itemrespawntime;
|
||||
@@ -185,9 +172,7 @@ extern consvar_t cv_nametagdist;
|
||||
extern consvar_t cv_showownnametag;
|
||||
extern consvar_t cv_smallnametags;
|
||||
extern consvar_t cv_nametagrestat;
|
||||
extern consvar_t cv_nametaghop;
|
||||
extern consvar_t cv_nametagscore;
|
||||
extern consvar_t cv_shownametagfinish;
|
||||
extern consvar_t cv_shownametagspectator;
|
||||
|
||||
#define SKINSELECTSPIN_PAIN 25
|
||||
@@ -213,6 +198,8 @@ extern consvar_t cv_betainterscreen;
|
||||
|
||||
extern consvar_t cv_laglesscam;
|
||||
|
||||
extern consvar_t cv_verticallook;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SKINMENUTYPE_SCROLL = 0,
|
||||
@@ -310,8 +297,6 @@ typedef union {
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
extern tic_t driftsparkGrowTimer[16];
|
||||
|
||||
// add game commands, needs cleanup
|
||||
void D_RegisterServerCommands(void);
|
||||
void D_RegisterClientCommands(void);
|
||||
|
||||
@@ -111,6 +111,7 @@ static fileused_t transferFiles[UINT8_MAX + 1];
|
||||
// Receiver structure
|
||||
INT32 fileneedednum; // Number of files needed to join the server
|
||||
fileneeded_t fileneeded[MAX_WADFILES]; // List of needed files
|
||||
static I_mutex downloadmutex;
|
||||
char downloaddir[512] = "DOWNLOAD";
|
||||
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
@@ -232,6 +233,9 @@ void D_ParseFileneeded(INT32 fileneedednum_parm, UINT8 *fileneededstr, UINT16 fi
|
||||
|
||||
void CL_PrepareDownloadSaveGame(const char *tmpsave)
|
||||
{
|
||||
#ifdef CLIENT_LOADINGSCREEN
|
||||
lastfilenum = -1;
|
||||
#endif
|
||||
fileneedednum = 1;
|
||||
fileneeded[0].status = FS_REQUESTED;
|
||||
fileneeded[0].totalsize = UINT32_MAX;
|
||||
@@ -1327,6 +1331,7 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
curl_starttime = time(NULL);
|
||||
|
||||
curl_running = true;
|
||||
|
||||
#ifdef HAVE_THREADS
|
||||
I_spawn_thread("http-download", (I_thread_fn)CURLGetFile, NULL);
|
||||
#endif
|
||||
@@ -1336,10 +1341,15 @@ void CURLPrepareFile(const char* url, int dfilenum)
|
||||
void CURLAbortFile(void)
|
||||
{
|
||||
curl_running = false;
|
||||
|
||||
// lock and unlock to wait for the download thread to exit
|
||||
I_lock_mutex(&downloadmutex);
|
||||
I_unlock_mutex(downloadmutex);
|
||||
}
|
||||
|
||||
void CURLGetFile(void)
|
||||
{
|
||||
I_lock_mutex(&downloadmutex);
|
||||
CURLMcode mc; /* return code used by curl_multi_wait() */
|
||||
CURLcode easyres; /* Return from easy interface */
|
||||
CURLMsg *m; /* for picking up messages with the transfer status */
|
||||
@@ -1432,6 +1442,7 @@ void CURLGetFile(void)
|
||||
multi_handle = NULL;
|
||||
}
|
||||
curl_running = false;
|
||||
I_unlock_mutex(downloadmutex);
|
||||
}
|
||||
|
||||
HTTP_login *
|
||||
|
||||
+6
-5
@@ -351,6 +351,7 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
LAP_CUR,
|
||||
LAP_BEST,
|
||||
LAP_LAST,
|
||||
LAP__MAX
|
||||
} laptime_e;
|
||||
@@ -403,7 +404,6 @@ typedef struct player_s
|
||||
angle_t old_frameangle, old_frameangle2;
|
||||
|
||||
// SRB2Kart CEP: Sliptide rolling
|
||||
INT32 sliptidemem;
|
||||
angle_t sliproll;
|
||||
|
||||
INT16 lturn_max[MAXPREDICTTICS]; // What's the expected turn value for full-left for a number of frames back (to account for netgame latency)?
|
||||
@@ -413,8 +413,6 @@ typedef struct player_s
|
||||
// See pflags_t, above.
|
||||
pflags_t pflags;
|
||||
|
||||
UINT16 postimgflags;
|
||||
|
||||
// playing animation.
|
||||
panim_t panim;
|
||||
|
||||
@@ -552,9 +550,12 @@ typedef struct player_s
|
||||
UINT8 hitemvictim;
|
||||
|
||||
UINT8 splitscreenindex;
|
||||
#ifdef HWRENDER
|
||||
|
||||
tic_t driftsparkGrowTimer;
|
||||
|
||||
fixed_t spinoutrot; // When a player spins out, this value increments modulus 360.
|
||||
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
#endif
|
||||
} player_t;
|
||||
|
||||
#endif
|
||||
@@ -49,6 +49,7 @@ typedef struct thinker_s
|
||||
// killough 11/98: count of how many other objects reference
|
||||
// this one using pointers. Used for garbage collection.
|
||||
INT32 references;
|
||||
boolean cachable;
|
||||
} thinker_t;
|
||||
|
||||
#endif
|
||||
+115
-29
@@ -14,7 +14,6 @@
|
||||
#include "d_main.h" // for srb2home
|
||||
#include "g_game.h"
|
||||
#include "sounds.h"
|
||||
#include "info.h"
|
||||
#include "d_think.h"
|
||||
#include "m_argv.h"
|
||||
#include "z_zone.h"
|
||||
@@ -33,12 +32,12 @@
|
||||
#include "r_sky.h"
|
||||
#include "r_draw.h" // translation colormap consts (for lua)
|
||||
#include "fastcmp.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_glib.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#include "d_clisrv.h"
|
||||
#include "v_video.h" // video flags (for lua)
|
||||
|
||||
#include "lua_glib.h"
|
||||
#include "lua_hook.h"
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
|
||||
@@ -48,13 +47,14 @@
|
||||
|
||||
// Free slot names
|
||||
// The crazy word-reading stuff uses these.
|
||||
static char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
static char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
static UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
|
||||
#define initfreeslots() {\
|
||||
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
|
||||
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
|
||||
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
|
||||
memset(FREE_STATES,0,sizeof(char *) * NUMSTATEFREESLOTS);\
|
||||
memset(FREE_MOBJS,0,sizeof(char *) * NUMMOBJFREESLOTS);\
|
||||
memset(used_spr,0,sizeof(UINT8) * ((NUMSPRITEFREESLOTS / 8) + 1));\
|
||||
}
|
||||
|
||||
// Crazy word-reading stuff
|
||||
@@ -690,6 +690,20 @@ static const struct {
|
||||
{NULL, 0}
|
||||
};
|
||||
|
||||
static mapheader_lighting_t *usemaplighting(INT32 mapnum, const char *word)
|
||||
{
|
||||
if (fastncmp(word, "ENCORE", 6))
|
||||
{
|
||||
mapheaderinfo[mapnum]->use_encore_lighting = true;
|
||||
|
||||
return &mapheaderinfo[mapnum]->lighting_encore;
|
||||
}
|
||||
else
|
||||
{
|
||||
return &mapheaderinfo[mapnum]->lighting;
|
||||
}
|
||||
}
|
||||
|
||||
static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
|
||||
{
|
||||
char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL);
|
||||
@@ -983,6 +997,35 @@ static void readlevelheader(MYFILE *f, INT32 num, INT32 wadnum)
|
||||
}*/
|
||||
else if (fastcmp(word, "MOBJSCALE"))
|
||||
mapheaderinfo[num-1]->mobj_scale = get_number(word2);
|
||||
else if (fastcmp(word, "LIGHTCONTRAST") || fastcmp(word, "ENCORELIGHTCONTRAST"))
|
||||
{
|
||||
mapheader_lighting_t *lighting = usemaplighting(num-1, word);
|
||||
lighting->light_contrast = (UINT8)i;
|
||||
lighting->use_custom_light = true;
|
||||
}
|
||||
else if (fastcmp(word, "SPRITEBACKLIGHT") || fastcmp(word, "ENCORESPRITEBACKLIGHT"))
|
||||
{
|
||||
mapheader_lighting_t *lighting = usemaplighting(num-1, word);
|
||||
lighting->sprite_backlight = (SINT8)i;
|
||||
lighting->use_custom_light = true;
|
||||
}
|
||||
else if (fastcmp(word, "LIGHTANGLE") || fastcmp(word, "ENCORELIGHTANGLE"))
|
||||
{
|
||||
mapheader_lighting_t *lighting = usemaplighting(num-1, word);
|
||||
|
||||
if (fastcmp(word2, "EVEN"))
|
||||
{
|
||||
lighting->use_light_angle = false;
|
||||
lighting->light_angle = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
lighting->use_light_angle = true;
|
||||
lighting->light_angle = FixedAngle(FloatToFixed(atof(word2)));
|
||||
}
|
||||
|
||||
lighting->use_custom_light = true;
|
||||
}
|
||||
|
||||
// Individual triggers for level flags, for ease of use (and 2.0 compatibility)
|
||||
else if (fastcmp(word, "SCRIPTISFILE"))
|
||||
@@ -1493,9 +1536,6 @@ actionpointer_t actionpointers[] =
|
||||
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
|
||||
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
|
||||
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
|
||||
{{A_RollAngle}, "A_ROLLANGLE"},
|
||||
{{A_ChangeRollAngleRelative},"A_CHANGEROLLANGLERELATIVE"},
|
||||
{{A_ChangeRollAngleAbsolute},"A_CHANGEROLLANGLEABSOLUTE"},
|
||||
{{A_PlaySound}, "A_PLAYSOUND"},
|
||||
{{A_FindTarget}, "A_FINDTARGET"},
|
||||
{{A_FindTracer}, "A_FINDTRACER"},
|
||||
@@ -3150,7 +3190,7 @@ void DEH_LoadDehackedLump(lumpnum_t lumpnum)
|
||||
// RegEx to generate this from info.h: ^\tS_([^,]+), --> \t"S_\1",
|
||||
// I am leaving the prefixes solely for clarity to programmers,
|
||||
// because sadly no one remembers this place while searching for full state names.
|
||||
static const char *const STATE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
const char *const STATE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
"S_NULL",
|
||||
"S_UNKNOWN",
|
||||
"S_INVISIBLE", // state for invisible sprite
|
||||
@@ -6364,7 +6404,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
||||
// RegEx to generate this from info.h: ^\tMT_([^,]+), --> \t"MT_\1",
|
||||
// I am leaving the prefixes solely for clarity to programmers,
|
||||
// because sadly no one remembers this place while searching for full state names.
|
||||
static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
const char *const MOBJTYPE_LIST[] = { // array length left dynamic for sanity testing later.
|
||||
"MT_NULL",
|
||||
"MT_UNKNOWN",
|
||||
|
||||
@@ -7155,7 +7195,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
|
||||
#endif
|
||||
};
|
||||
|
||||
static const char *const MOBJFLAG_LIST[] = {
|
||||
const char *const MOBJFLAG_LIST[] = {
|
||||
"SPECIAL",
|
||||
"SOLID",
|
||||
"SHOOTABLE",
|
||||
@@ -7191,7 +7231,7 @@ static const char *const MOBJFLAG_LIST[] = {
|
||||
};
|
||||
|
||||
// \tMF2_(\S+).*// (.+) --> \t"\1", // \2
|
||||
static const char *const MOBJFLAG2_LIST[] = {
|
||||
const char *const MOBJFLAG2_LIST[] = {
|
||||
"AXIS", // It's a NiGHTS axis! (For faster checking)
|
||||
"TWOD", // Moves like it's in a 2D level
|
||||
"DONTRESPAWN", // Don't respawn this object!
|
||||
@@ -7224,7 +7264,7 @@ static const char *const MOBJFLAG2_LIST[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *const MOBJEFLAG_LIST[] = {
|
||||
const char *const MOBJEFLAG_LIST[] = {
|
||||
"ONGROUND", // The mobj stands on solid floor (not on another mobj or in air)
|
||||
"JUSTHITFLOOR", // The mobj just hit the floor while falling, this is cleared on next frame
|
||||
"TOUCHWATER", // The mobj stands in a sector with water, and touches the surface
|
||||
@@ -7242,14 +7282,14 @@ static const char *const MOBJEFLAG_LIST[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char *const MAPTHINGFLAG_LIST[4] = {
|
||||
const char *const MAPTHINGFLAG_LIST[4] = {
|
||||
NULL,
|
||||
"OBJECTFLIP", // Reverse gravity flag for objects.
|
||||
"OBJECTSPECIAL", // Special flag used with certain objects.
|
||||
"AMBUSH" // Deaf monsters/do not react to sound.
|
||||
};
|
||||
|
||||
static const char *const PLAYERFLAG_LIST[] = {
|
||||
const char *const PLAYERFLAG_LIST[] = {
|
||||
// Flip camera angle with gravity flip prefrence.
|
||||
"FLIPCAM",
|
||||
|
||||
@@ -7321,7 +7361,7 @@ static const char *const PLAYERFLAG_LIST[] = {
|
||||
};
|
||||
|
||||
// Linedef flags
|
||||
static const char *const ML_LIST[16] = {
|
||||
const char *const ML_LIST[16] = {
|
||||
"IMPASSIBLE",
|
||||
"BLOCKMONSTERS",
|
||||
"TWOSIDED",
|
||||
@@ -7342,7 +7382,7 @@ static const char *const ML_LIST[16] = {
|
||||
|
||||
// This DOES differ from r_draw's Color_Names, unfortunately.
|
||||
// Also includes Super colors
|
||||
static const char *COLOR_ENUMS[] = { // Rejigged for Kart.
|
||||
const char *COLOR_ENUMS[] = { // Rejigged for Kart.
|
||||
"NONE", // SKINCOLOR_NONE
|
||||
"WHITE", // SKINCOLOR_WHITE
|
||||
"SILVER", // SKINCOLOR_SILVER
|
||||
@@ -7510,7 +7550,7 @@ static const char *COLOR_ENUMS[] = { // Rejigged for Kart.
|
||||
"CSUPER5" // SKINCOLOR_CSUPER5,
|
||||
};
|
||||
|
||||
static const char *const POWERS_LIST[] = {
|
||||
const char *const POWERS_LIST[] = {
|
||||
"INVULNERABILITY",
|
||||
"SNEAKERS",
|
||||
"FLASHING",
|
||||
@@ -7545,7 +7585,7 @@ static const char *const POWERS_LIST[] = {
|
||||
"INGOOP" // In goop
|
||||
};
|
||||
|
||||
static const char *const KARTSTUFF_LIST[] = {
|
||||
const char *const KARTSTUFF_LIST[] = {
|
||||
"POSITION",
|
||||
"OLDPOSITION",
|
||||
"POSITIONDELAY",
|
||||
@@ -7632,7 +7672,7 @@ static const char *const KARTSTUFF_LIST[] = {
|
||||
"GROWCANCEL"
|
||||
};
|
||||
|
||||
static const char *const HUDITEMS_LIST[] = {
|
||||
const char *const HUDITEMS_LIST[] = {
|
||||
"LIVESNAME",
|
||||
"LIVESPIC",
|
||||
"LIVESNUM",
|
||||
@@ -7721,7 +7761,18 @@ struct {
|
||||
{"FF_HORIZONTALFLIP",FF_HORIZONTALFLIP},
|
||||
{"FF_PAPERSPRITE",FF_PAPERSPRITE},
|
||||
{"FF_ANIMATE",FF_ANIMATE},
|
||||
// brightness
|
||||
{"FF_BRIGHTMASK",FF_BRIGHTMASK},
|
||||
{"FF_FULLBRIGHT",FF_FULLBRIGHT},
|
||||
{"FF_SEMIBRIGHT",FF_SEMIBRIGHT},
|
||||
{"FF_FULLDARK",FF_FULLDARK},
|
||||
// blending
|
||||
{"FF_BLENDMASK",FF_BLENDMASK},
|
||||
{"FF_BLENDSHIFT",FF_BRIGHTMASK},
|
||||
{"FF_ADD",FF_ADD},
|
||||
{"FF_SUBTRACT",FF_SUBTRACT},
|
||||
{"FF_REVERSESUBTRACT",FF_REVERSESUBTRACT},
|
||||
{"FF_MODULATE",FF_MODULATE},
|
||||
{"FF_TRANSMASK",FF_TRANSMASK},
|
||||
{"FF_TRANSSHIFT",FF_TRANSSHIFT},
|
||||
// new preshifted translucency (used in source)
|
||||
@@ -7757,6 +7808,15 @@ struct {
|
||||
{"tr_trans90",tr_trans90},
|
||||
{"NUMTRANSMAPS",NUMTRANSMAPS},
|
||||
|
||||
// Alpha styles (blend modes)
|
||||
{"AST_COPY",AST_COPY},
|
||||
{"AST_TRANSLUCENT",AST_TRANSLUCENT},
|
||||
{"AST_ADD",AST_ADD},
|
||||
{"AST_SUBTRACT",AST_SUBTRACT},
|
||||
{"AST_REVERSESUBTRACT",AST_REVERSESUBTRACT},
|
||||
{"AST_MODULATE",AST_MODULATE},
|
||||
{"AST_OVERLAY",AST_OVERLAY},
|
||||
|
||||
// Type of levels
|
||||
{"TOL_SP",TOL_SP},
|
||||
{"TOL_COOP",TOL_COOP},
|
||||
@@ -8121,6 +8181,14 @@ struct {
|
||||
{"V_CHARCOLORSHIFT",V_CHARCOLORSHIFT},
|
||||
{"V_ALPHASHIFT",V_ALPHASHIFT},
|
||||
|
||||
// Blending
|
||||
{"V_BLENDSHIFT",V_BLENDSHIFT},
|
||||
{"V_BLENDMASK",V_BLENDMASK},
|
||||
{"B_ADD",B_ADD},
|
||||
{"B_SUBTRACT",B_SUBTRACT},
|
||||
{"B_REVERSESUBTRACT",B_REVERSESUBTRACT},
|
||||
{"B_MODULATE",B_MODULATE},
|
||||
|
||||
//Kick Reasons
|
||||
{"KR_KICK",KR_KICK},
|
||||
{"KR_PINGLIMIT",KR_PINGLIMIT},
|
||||
@@ -8545,6 +8613,16 @@ static int lua_enumlib_mariomode_get(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lua_enumlib_replayfreecam_get(lua_State *L)
|
||||
{
|
||||
if (dedicated) // huh?
|
||||
lua_pushboolean(L, false);
|
||||
else
|
||||
lua_pushboolean(L, camera[R_GetViewNumber()].freecam);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lua_enumlib_twodlevel_get(lua_State *L)
|
||||
{
|
||||
lua_pushboolean(L, twodlevel);
|
||||
@@ -9149,8 +9227,6 @@ int LUA_EnumLib(lua_State *L)
|
||||
PUSHGETTER(globalweather, u8);
|
||||
PUSHGETTER(levelskynum, i32);
|
||||
PUSHGETTER(globallevelskynum, i32);
|
||||
PUSHGETTER(mapmusflags, u16);
|
||||
PUSHGETTER(mapmusposition, u32);
|
||||
PUSHGETTER(gravity, fxp);
|
||||
PUSHGETTER(gamespeed, u8);
|
||||
PUSHGETTER(encoremode, bool);
|
||||
@@ -9165,9 +9241,19 @@ int LUA_EnumLib(lua_State *L)
|
||||
PUSHGETTER(racecountdown, u32);
|
||||
PUSHGETTER(exitcountdown, u32);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "mapmusflags");
|
||||
lua_glib_push_u16_getter(L, &mapmusic.flags);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "mapmusposition");
|
||||
lua_glib_push_u32_getter(L, &mapmusic.position);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "mapmusname");
|
||||
lua_glib_push_str_getter(L, mapmusname);
|
||||
lua_glib_push_str_getter(L, mapmusic.name);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
@@ -9222,7 +9308,7 @@ int LUA_EnumLib(lua_State *L)
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "replayfreecam");
|
||||
lua_glib_push_bool_getter(L, &demo.freecam);
|
||||
lua_pushcfunction(L, lua_enumlib_replayfreecam_get);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
if (!mathlib)
|
||||
|
||||
@@ -14,6 +14,26 @@
|
||||
#define __DEHACKED_H__
|
||||
|
||||
#include "m_fixed.h" // for get_number
|
||||
#include "info.h"
|
||||
|
||||
// Free slot names
|
||||
// The crazy word-reading stuff uses these.
|
||||
extern char *FREE_STATES[NUMSTATEFREESLOTS];
|
||||
extern char *FREE_MOBJS[NUMMOBJFREESLOTS];
|
||||
extern UINT8 used_spr[(NUMSPRITEFREESLOTS / 8) + 1]; // Bitwise flag for sprite freeslot in use! I would use ceil() here if I could, but it only saves 1 byte of memory anyway.
|
||||
|
||||
extern const char *const STATE_LIST[];
|
||||
extern const char *const MOBJTYPE_LIST[];
|
||||
extern const char *const MOBJFLAG_LIST[];
|
||||
extern const char *const MOBJFLAG2_LIST[]; // \tMF2_(\S+).*// (.+) --> \t"\1", // \2
|
||||
extern const char *const MOBJEFLAG_LIST[];
|
||||
extern const char *const MAPTHINGFLAG_LIST[4];
|
||||
extern const char *const PLAYERFLAG_LIST[];
|
||||
extern const char *const ML_LIST[]; // Linedef flags
|
||||
extern const char *COLOR_ENUMS[];
|
||||
extern const char *const POWERS_LIST[];
|
||||
extern const char *const KARTSTUFF_LIST[];
|
||||
extern const char *const HUDITEMS_LIST[];
|
||||
|
||||
void DEH_LoadDehackedLump(lumpnum_t lumpnum);
|
||||
void DEH_LoadDehackedLumpPwad(UINT16 wad, UINT16 lump);
|
||||
|
||||
+19
-18
@@ -21,7 +21,6 @@
|
||||
#define SOUND_DUMMY 0
|
||||
#define SOUND_SDL 1
|
||||
#define SOUND_MIXER 2
|
||||
#define SOUND_FMOD 3
|
||||
|
||||
#ifndef SOUND
|
||||
#ifdef HAVE_SDL
|
||||
@@ -29,9 +28,6 @@
|
||||
// Use Mixer interface?
|
||||
#ifdef HAVE_MIXER
|
||||
#define SOUND SOUND_MIXER
|
||||
#ifdef HW3SOUND
|
||||
#undef HW3SOUND
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Use generic SDL interface.
|
||||
@@ -40,18 +36,8 @@
|
||||
#endif
|
||||
|
||||
#else // No SDL.
|
||||
|
||||
// Use FMOD?
|
||||
#ifdef HAVE_FMOD
|
||||
#define SOUND SOUND_FMOD
|
||||
#ifdef HW3SOUND
|
||||
#undef HW3SOUND
|
||||
#endif
|
||||
#else
|
||||
// No more interfaces. :(
|
||||
#define SOUND SOUND_DUMMY
|
||||
#endif
|
||||
|
||||
// No more interfaces. :(
|
||||
#define SOUND SOUND_DUMMY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -522,15 +508,30 @@ extern boolean capslock;
|
||||
// i_system.c, replace getchar() once the keyboard has been appropriated
|
||||
INT32 I_GetKey(void);
|
||||
|
||||
/* http://www.cse.yorku.ca/~oz/hash.html */
|
||||
static inline
|
||||
UINT32 quickncasehash (const char *p, size_t n)
|
||||
{
|
||||
size_t i = 0;
|
||||
UINT32 x = 5381;
|
||||
|
||||
while (i < n && p[i])
|
||||
{
|
||||
x = (x * 33) ^ tolower(p[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
#ifndef min // Double-Check with WATTCP-32's cdefs.h
|
||||
#define min(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#endif
|
||||
#ifndef max // Double-Check with WATTCP-32's cdefs.h
|
||||
#define max(x, y) (((x) > (y)) ? (x) : (y))
|
||||
#endif
|
||||
|
||||
#ifndef CLAMP
|
||||
#define CLAMP(x, min_val, max_val) ((x) < (min_val) ? (min_val) : ((x) > (max_val) ? (max_val) : (x)))
|
||||
#define CLAMP(x, y, z) ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
|
||||
#endif
|
||||
|
||||
#ifndef M_PIl
|
||||
|
||||
+36
-6
@@ -30,16 +30,26 @@
|
||||
// =============================
|
||||
|
||||
// Selected by user.
|
||||
extern INT16 gamemap;
|
||||
extern char mapmusname[7];
|
||||
extern UINT16 mapmusflags;
|
||||
extern UINT32 mapmusposition;
|
||||
extern UINT32 mapmusresume;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[7]; // Music name, up to 6-character name
|
||||
void *data; // Music lump
|
||||
UINT16 flags; // Track and reset bit
|
||||
boolean looping; // Is this music looping?
|
||||
UINT32 position; // Position to jump to
|
||||
UINT32 resume; // Saved Position when music was stopped
|
||||
UINT32 fadeinms; // Fade in time in ms (used for queue)
|
||||
} music_t;
|
||||
|
||||
extern music_t mapmusic;
|
||||
|
||||
#define MUSIC_TRACKMASK 0x0FFF // ----************
|
||||
#define MUSIC_RELOADRESET 0x8000 // *---------------
|
||||
#define MUSIC_FORCERESET 0x4000 // -*--------------
|
||||
// Use other bits if necessary.
|
||||
|
||||
extern INT16 gamemap;
|
||||
extern INT16 maptol;
|
||||
extern UINT8 globalweather;
|
||||
extern INT32 curWeather;
|
||||
@@ -212,6 +222,15 @@ typedef struct
|
||||
char value[256]; // 255 usable characters. If this seriously isn't enough then wtf.
|
||||
} customoption_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
boolean use_custom_light;
|
||||
UINT8 light_contrast; ///< Range of wall lighting. 0 is no lighting.
|
||||
SINT8 sprite_backlight; ///< Subtract from wall lighting for sprites only.
|
||||
boolean use_light_angle; ///< When false, wall lighting is evenly distributed. When true, wall lighting is directional.
|
||||
angle_t light_angle; ///< Angle of directional wall lighting.
|
||||
} mapheader_lighting_t;
|
||||
|
||||
/** Map header information.
|
||||
*/
|
||||
typedef struct
|
||||
@@ -259,6 +278,10 @@ typedef struct
|
||||
//boolean automap; ///< Displays a level's white map outline in modified games
|
||||
fixed_t mobj_scale; ///< Replacement for TOL_ERZ3
|
||||
|
||||
mapheader_lighting_t lighting; ///< Wall and sprite lighting
|
||||
mapheader_lighting_t lighting_encore; ///< Alternative lighting for Encore mode
|
||||
boolean use_encore_lighting; ///< Whether to use separate Encore lighting
|
||||
|
||||
// Music stuff.
|
||||
UINT32 musinterfadeout; ///< Fade out level music on intermission screen in milliseconds
|
||||
char musintername[7]; ///< Intermission screen music.
|
||||
@@ -454,6 +477,14 @@ extern tic_t racecountdown, exitcountdown;
|
||||
extern fixed_t gravity;
|
||||
extern fixed_t mapobjectscale;
|
||||
|
||||
extern struct maplighting
|
||||
{
|
||||
UINT8 contrast;
|
||||
SINT8 backlight;
|
||||
boolean directional;
|
||||
angle_t angle;
|
||||
} maplighting;
|
||||
|
||||
//for CTF balancing
|
||||
extern INT16 autobalance;
|
||||
extern INT16 teamscramble;
|
||||
@@ -482,7 +513,6 @@ extern boolean startedInFreePlay;
|
||||
|
||||
extern boolean legitimateexit;
|
||||
extern boolean comebackshowninfo;
|
||||
extern tic_t curlap, bestlap;
|
||||
|
||||
extern INT16 votelevels[4][2];
|
||||
extern SINT8 votes[MAXPLAYERS];
|
||||
|
||||
+27
-9
@@ -342,15 +342,6 @@ union FColorRGBA
|
||||
} ATTRPACK;
|
||||
typedef union FColorRGBA RGBA_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
POSTIMG_WATER = 1, // Underwater screen effect.
|
||||
POSTIMG_MOTION = 1<<1, // Unused motion blur effect.
|
||||
POSTIMG_FLIP = 1<<2, // Flipcam screen effect.
|
||||
POSTIMG_HEAT = 1<<3, // Heatwave screen effect.
|
||||
POSTIMG_MIRROR = 1<<4, // encore screen effect.
|
||||
} postimgflag_t;
|
||||
|
||||
typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num)
|
||||
#define LUMPERROR UINT32_MAX
|
||||
|
||||
@@ -365,6 +356,33 @@ typedef UINT32 tic_t;
|
||||
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
|
||||
#endif
|
||||
|
||||
#define TOSTR(x) #x
|
||||
|
||||
typedef UINT8 bitarray_t;
|
||||
|
||||
#define BIT_ARRAY_SIZE(n) (((n) + 7) >> 3)
|
||||
|
||||
static inline int
|
||||
in_bit_array (const bitarray_t * const array, const int value)
|
||||
{
|
||||
return (array[value >> 3] & (1<<(value & 7)));
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_bit_array (bitarray_t * const array, const int value)
|
||||
{
|
||||
array[value >> 3] |= (1<<(value & 7));
|
||||
}
|
||||
|
||||
static inline void
|
||||
unset_bit_array (bitarray_t * const array, const int value)
|
||||
{
|
||||
array[value >> 3] &= ~(1<<(value & 7));
|
||||
}
|
||||
|
||||
#define intsign(n) \
|
||||
((n) < 0 ? -1 : (n) > 0 ? 1 : 0)
|
||||
|
||||
typedef UINT64 precise_t;
|
||||
|
||||
#endif //__DOOMTYPE__
|
||||
@@ -92,8 +92,6 @@ void I_OutputMsg(const char *error, ...)
|
||||
|
||||
void I_StartupMouse(void){}
|
||||
|
||||
void I_StartupMouse2(void){}
|
||||
|
||||
void I_StartupKeyboard(void){}
|
||||
|
||||
INT32 I_GetKey(void)
|
||||
@@ -146,8 +144,6 @@ void I_GetJoystickEvents(void){}
|
||||
|
||||
void I_GetJoystick2Events(void){}
|
||||
|
||||
void I_GetMouseEvents(void){}
|
||||
|
||||
char *I_GetEnv(const char *name)
|
||||
{
|
||||
(void)name;
|
||||
|
||||
+1
-1
@@ -273,7 +273,7 @@ static void F_DoWipe(fademask_t *fademask)
|
||||
else
|
||||
{
|
||||
// pointer to transtable that this mask would use
|
||||
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
|
||||
transtbl = R_GetTranslucencyTable((9 - *mask) + 1);
|
||||
|
||||
// DRAWING LOOP
|
||||
while (draw_linestogo--)
|
||||
|
||||
+7
-6
@@ -327,7 +327,8 @@ char menupath[1024];
|
||||
size_t menupathindex[menudepth];
|
||||
size_t menudepthleft = menudepth;
|
||||
|
||||
char menusearch[MAXSTRINGLENGTH+1];
|
||||
char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
textinput_t menusearch;
|
||||
|
||||
char **dirmenu, **coredirmenu; // core only local for this file
|
||||
size_t sizedirmenu, sizecoredirmenu; // ditto
|
||||
@@ -497,7 +498,7 @@ static boolean filemenucmp(char *haystack, char *needle)
|
||||
strupr(localhaystack);
|
||||
if (cv_addons_search_type.value)
|
||||
return (strstr(localhaystack, needle) != 0);
|
||||
return (!strncmp(localhaystack, needle, menusearch[0]));
|
||||
return (!strncmp(localhaystack, needle, menusearch.length));
|
||||
}
|
||||
|
||||
void closefilemenu(boolean validsize)
|
||||
@@ -563,7 +564,7 @@ void searchfilemenu(char *tempname)
|
||||
|
||||
first = (((UINT8)(coredirmenu[0][DIR_TYPE]) == EXT_UP) ? 1 : 0); // skip UP...
|
||||
|
||||
if (!menusearch[0])
|
||||
if (!menusearch.length)
|
||||
{
|
||||
if (dirmenu)
|
||||
Z_Free(dirmenu);
|
||||
@@ -590,7 +591,7 @@ void searchfilemenu(char *tempname)
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(localmenusearch, menusearch+1);
|
||||
strcpy(localmenusearch, menusearch.buffer);
|
||||
if (!cv_addons_search_case.value)
|
||||
strupr(localmenusearch);
|
||||
|
||||
@@ -652,7 +653,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
||||
tempname = Z_StrDup(dirmenu[dir_on[menudepthleft]]+DIR_STRING); // don't need to I_Error if can't make - not important, just QoL
|
||||
}
|
||||
else
|
||||
menusearch[0] = menusearch[1] = 0; // clear search
|
||||
M_TextInputInit(&menusearch, menusearchbuf, MAXSTRINGLENGTH+1);
|
||||
|
||||
if (!(dirhandle = opendir(menupath))) // get directory
|
||||
{
|
||||
@@ -796,7 +797,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
|
||||
}
|
||||
else if (ext == EXT_TXT)
|
||||
{
|
||||
if (!strcmp(dent->d_name, "log.txt") || !strcmp(dent->d_name, "errorlog.txt"))
|
||||
if (!strncmp(dent->d_name, "log-", 4) || !strcmp(dent->d_name, "errorlog.txt"))
|
||||
ext |= EXT_LOADED;
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -7,6 +7,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "d_netfil.h"
|
||||
#include "m_menu.h" // MAXSTRINGLENGTH
|
||||
#include "m_textinput.h"
|
||||
|
||||
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
|
||||
|
||||
@@ -34,7 +35,8 @@ extern char menupath[1024];
|
||||
extern size_t menupathindex[menudepth];
|
||||
extern size_t menudepthleft;
|
||||
|
||||
extern char menusearch[MAXSTRINGLENGTH+1];
|
||||
extern char menusearchbuf[MAXSTRINGLENGTH+1];
|
||||
extern textinput_t menusearch;
|
||||
|
||||
extern char **dirmenu;
|
||||
extern size_t sizedirmenu;
|
||||
|
||||
+832
-1171
File diff suppressed because it is too large.
Load diff
+65
-34
@@ -17,6 +17,7 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_event.h"
|
||||
#include "p_saveg.h"
|
||||
#include "m_textinput.h"
|
||||
|
||||
extern char gamedatafilename[64];
|
||||
@@ -33,7 +34,7 @@ extern INT32 player_name_changes[MAXPLAYERS];
|
||||
extern player_t players[MAXPLAYERS];
|
||||
extern boolean playeringame[MAXPLAYERS];
|
||||
|
||||
extern UINT8 *demo_p;
|
||||
extern savebuffer_t demobuf;
|
||||
|
||||
// ======================================
|
||||
// DEMO playback/recording related stuff.
|
||||
@@ -65,9 +66,6 @@ struct demovars_s {
|
||||
DSM_WILLSAVE,
|
||||
DSM_SAVED
|
||||
} savemode;
|
||||
|
||||
boolean freecam;
|
||||
|
||||
};
|
||||
|
||||
extern struct demovars_s demo;
|
||||
@@ -117,15 +115,24 @@ extern consvar_t cv_songcredits;
|
||||
extern consvar_t cv_showfreeplay;
|
||||
extern consvar_t cv_growmusic, cv_supermusic;
|
||||
extern consvar_t cv_pauseifunfocused;
|
||||
//extern consvar_t cv_crosshair, cv_crosshair2, cv_crosshair3, cv_crosshair4;
|
||||
extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mousemove*/;
|
||||
extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
|
||||
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
|
||||
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
|
||||
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_lookbackaxis,cv_custom1axis,cv_custom2axis,cv_custom3axis,cv_xdeadzone,cv_ydeadzone;
|
||||
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_lookbackaxis2,cv_custom1axis2,cv_custom2axis2,cv_custom3axis2,cv_xdeadzone2,cv_ydeadzone2;
|
||||
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_lookbackaxis3,cv_custom1axis3,cv_custom2axis3,cv_custom3axis3,cv_xdeadzone3,cv_ydeadzone3;
|
||||
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_lookbackaxis4,cv_custom1axis4,cv_custom2axis4,cv_custom3axis4,cv_xdeadzone4,cv_ydeadzone4;
|
||||
extern consvar_t cv_invertmouse;
|
||||
|
||||
extern consvar_t cv_turnaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_moveaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_camturnaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_camstrafeaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_brakeaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_aimaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_lookaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_lookbackaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_fireaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_driftaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom1axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom2axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_custom3axis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_xdeadzone[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_ydeadzone[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
// Hud offsets
|
||||
@@ -139,24 +146,27 @@ extern consvar_t cv_##name##_yoffset;
|
||||
DECL_HUD_OFFSET_X(name)\
|
||||
DECL_HUD_OFFSET_Y(name)
|
||||
|
||||
DECL_HUD_OFFSET(item); // Item box
|
||||
DECL_HUD_OFFSET(time); // Time
|
||||
DECL_HUD_OFFSET(laps); // Number of laps
|
||||
DECL_HUD_OFFSET(dnft); // Countdown (did not finish timer)
|
||||
DECL_HUD_OFFSET(speed); // Speedometer
|
||||
DECL_HUD_OFFSET(posi); // Position in race
|
||||
DECL_HUD_OFFSET(face); // Mini rankings
|
||||
DECL_HUD_OFFSET(stcd); // Starting countdown
|
||||
DECL_HUD_OFFSET(item); // Item box
|
||||
DECL_HUD_OFFSET(time); // Time
|
||||
DECL_HUD_OFFSET(laps); // Number of laps
|
||||
DECL_HUD_OFFSET(dnft); // Countdown (did not finish timer)
|
||||
DECL_HUD_OFFSET(speed); // Speedometer
|
||||
DECL_HUD_OFFSET(posi); // Position in race
|
||||
DECL_HUD_OFFSET(wheel); // RA Wheel
|
||||
DECL_HUD_OFFSET(face); // Mini rankings
|
||||
DECL_HUD_OFFSET(stcd); // Starting countdown
|
||||
DECL_HUD_OFFSET_Y(chek); // Check gfx
|
||||
DECL_HUD_OFFSET(mini); // Minimap
|
||||
DECL_HUD_OFFSET(want); // Wanted
|
||||
DECL_HUD_OFFSET(stat); // Stats
|
||||
DECL_HUD_OFFSET(mini); // Minimap
|
||||
DECL_HUD_OFFSET(want); // Wanted
|
||||
DECL_HUD_OFFSET(stat); // Stats
|
||||
|
||||
#undef DECL_HUD_OFFSET
|
||||
#undef DECL_HUD_OFFSET_X
|
||||
#undef DECL_HUD_OFFSET_Y
|
||||
|
||||
extern consvar_t cv_showinput;
|
||||
extern consvar_t cv_posanim;
|
||||
extern consvar_t cv_smallposnum;
|
||||
extern consvar_t cv_newspeedometer;
|
||||
|
||||
extern consvar_t cv_saltyhop;
|
||||
@@ -166,11 +176,11 @@ extern consvar_t cv_saltysquish;
|
||||
extern consvar_t cv_driftsparkpulse;
|
||||
extern consvar_t cv_gravstretch;
|
||||
extern consvar_t cv_sloperoll;
|
||||
extern consvar_t cv_spriteroll;
|
||||
extern consvar_t cv_sliptideroll;
|
||||
extern consvar_t cv_slamsound;
|
||||
extern consvar_t cv_sloperolldist;
|
||||
extern consvar_t cv_sparkroll;
|
||||
extern consvar_t cv_spinoutroll;
|
||||
|
||||
extern consvar_t cv_cechotoggle;
|
||||
|
||||
@@ -183,6 +193,8 @@ typedef enum
|
||||
AXISNONE = 0,
|
||||
AXISTURN,
|
||||
AXISMOVE,
|
||||
AXISCAMTURN,
|
||||
AXISCAMSTRAFE,
|
||||
AXISBRAKE,
|
||||
AXISAIM,
|
||||
AXISLOOK,
|
||||
@@ -220,8 +232,6 @@ extern angle_t localangle[MAXSPLITSCREENPLAYERS];
|
||||
extern INT32 localaiming[MAXSPLITSCREENPLAYERS]; // should be an angle_t but signed
|
||||
extern boolean camspin[MAXSPLITSCREENPLAYERS]; // SRB2Kart
|
||||
|
||||
extern tic_t directortoggletimer;
|
||||
|
||||
//
|
||||
// GAME
|
||||
//
|
||||
@@ -266,7 +276,6 @@ void G_SpawnPlayer(INT32 playernum, boolean starpost);
|
||||
// A normal game starts at map 1, but a warp test can start elsewhere
|
||||
void G_DeferedInitNew(boolean pencoremode, const char *mapname, INT32 pickedchar,
|
||||
UINT8 ssplayers, boolean FLS);
|
||||
void G_DoLoadLevel(boolean resetplayer);
|
||||
|
||||
void G_LoadDemoInfo(menudemo_t *pdemo);
|
||||
void G_LoadDemoTitle(menudemo_t *pdemo); // For use in replay search feature
|
||||
@@ -356,6 +365,7 @@ extern demoghost *ghosts;
|
||||
#define DFILE_ERROR_CANNOTLOAD 0x04 // Files are missing and cannot be loaded.
|
||||
#define DFILE_ERROR_EXTRAFILES 0x05 // Extra files outside of the replay's file list are loaded.
|
||||
|
||||
void G_ResetDemoRecording(void);
|
||||
void G_DoPlayDemo(char *defdemoname);
|
||||
void G_TimeDemo(const char *name);
|
||||
void G_AddGhost(char *defdemoname);
|
||||
@@ -423,13 +433,32 @@ void G_ClearRecords(void);
|
||||
|
||||
tic_t G_GetBestTime(INT16 map);
|
||||
|
||||
FUNCMATH INT32 G_TicsToHours(tic_t tics);
|
||||
FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full);
|
||||
FUNCMATH INT32 G_TicsToSeconds(tic_t tics);
|
||||
FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics);
|
||||
FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
|
||||
// Time utility functions
|
||||
|
||||
boolean K_DirectorIsPlayerAlone(void); // idk where else to put this lol
|
||||
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToHours(tic_t tics)
|
||||
{
|
||||
return tics/(3600*TICRATE);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full)
|
||||
{
|
||||
return full ? (tics/(60*TICRATE)) : (tics/(60*TICRATE)%60);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToSeconds(tic_t tics)
|
||||
{
|
||||
return (tics/TICRATE)%60;
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics)
|
||||
{
|
||||
return (INT32)((tics%TICRATE) * (100.00f/TICRATE));
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics)
|
||||
{
|
||||
return (INT32)((tics%TICRATE) * (1000.00f/TICRATE));
|
||||
}
|
||||
|
||||
// Don't split up TOL handling
|
||||
INT16 G_TOLFlag(INT32 pgametype);
|
||||
@@ -437,4 +466,6 @@ INT16 G_TOLFlag(INT32 pgametype);
|
||||
INT16 G_RandMap(INT16 tolflags, INT16 pprevmap, boolean ignorebuffer, UINT8 maphell, boolean callagainsoon, INT16 *extbuffer);
|
||||
void G_AddMapToBuffer(INT16 map);
|
||||
|
||||
void G_FixCamera(UINT8 view);
|
||||
|
||||
#endif
|
||||
+36
-117
@@ -33,9 +33,7 @@ static CV_PossibleValue_t turnsmooth_cons_t[] = {{2, "Slow"}, {1, "Fast"}, {0, "
|
||||
|
||||
// mouse values are used once
|
||||
consvar_t cv_mousesens = {"mousesens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mousesens2 = {"mousesens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mouseysens = {"mouseysens", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_mouseysens2 = {"mouseysens2", "20", CV_SAVE, mousesens_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_controlperkey = {"controlperkey", "One", CV_SAVE, onecontrolperkey_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_turnsmooth = {"turnsmoothing", "Slow", CV_SAVE, turnsmooth_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -125,8 +123,6 @@ static void led_off_handle4(void)
|
||||
INT32 mousex, mousey;
|
||||
INT32 mlooky; // like mousey but with a custom sensitivity for mlook
|
||||
|
||||
INT32 mouse2x, mouse2y, mlook2y;
|
||||
|
||||
// joystick values are repeated
|
||||
INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
|
||||
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
|
||||
@@ -148,7 +144,6 @@ typedef struct
|
||||
} dclick_t;
|
||||
static dclick_t mousedclicks[MOUSEBUTTONS];
|
||||
static dclick_t joydclicks[JOYBUTTONS + JOYHATS*4];
|
||||
static dclick_t mouse2dclicks[MOUSEBUTTONS];
|
||||
static dclick_t joy2dclicks[JOYBUTTONS + JOYHATS*4];
|
||||
static dclick_t joy3dclicks[JOYBUTTONS + JOYHATS*4];
|
||||
static dclick_t joy4dclicks[JOYBUTTONS + JOYHATS*4];
|
||||
@@ -233,14 +228,6 @@ void G_MapEventsToControls(event_t *ev)
|
||||
if (ev->data3 != INT32_MAX) joy4ymove[i] = ev->data3;
|
||||
break;
|
||||
|
||||
case ev_mouse2: // buttons are virtual keys
|
||||
if (menuactive || CON_Ready() || chat_on)
|
||||
break;
|
||||
mouse2x = (INT32)(ev->data2*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f));
|
||||
mouse2y = (INT32)(ev->data3*((cv_mousesens2.value*cv_mousesens2.value)/110.0f + 0.1f));
|
||||
mlook2y = (INT32)(ev->data3*((cv_mouseysens2.value*cv_mousesens2.value)/110.0f + 0.1f));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -258,12 +245,6 @@ void G_MapEventsToControls(event_t *ev)
|
||||
gamekeydown[KEY_DBLJOY1+i] = flag;
|
||||
}
|
||||
|
||||
for (i = 0; i < MOUSEBUTTONS; i++)
|
||||
{
|
||||
flag = G_CheckDoubleClick(gamekeydown[KEY_2MOUSE1+i], &mouse2dclicks[i]);
|
||||
gamekeydown[KEY_DBL2MOUSE1+i] = flag;
|
||||
}
|
||||
|
||||
for (i = 0; i < JOYBUTTONS + JOYHATS*4; i++)
|
||||
{
|
||||
flag = G_CheckDoubleClick(gamekeydown[KEY_2JOY1+i], &joy2dclicks[i]);
|
||||
@@ -401,18 +382,8 @@ static keyname_t keynames[] =
|
||||
{KEY_MOUSE1+5,"MOUSE6"},
|
||||
{KEY_MOUSE1+6,"MOUSE7"},
|
||||
{KEY_MOUSE1+7,"MOUSE8"},
|
||||
{KEY_2MOUSE1+0,"SEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
|
||||
{KEY_2MOUSE1+1,"SEC_MOUSE1"},
|
||||
{KEY_2MOUSE1+2,"SEC_MOUSE3"},
|
||||
{KEY_2MOUSE1+3,"SEC_MOUSE4"},
|
||||
{KEY_2MOUSE1+4,"SEC_MOUSE5"},
|
||||
{KEY_2MOUSE1+5,"SEC_MOUSE6"},
|
||||
{KEY_2MOUSE1+6,"SEC_MOUSE7"},
|
||||
{KEY_2MOUSE1+7,"SEC_MOUSE8"},
|
||||
{KEY_MOUSEWHEELUP, "Wheel 1 UP"},
|
||||
{KEY_MOUSEWHEELDOWN, "Wheel 1 Down"},
|
||||
{KEY_2MOUSEWHEELUP, "Wheel 2 UP"},
|
||||
{KEY_2MOUSEWHEELDOWN, "Wheel 2 Down"},
|
||||
|
||||
{KEY_JOY1+0, "JOY1"},
|
||||
{KEY_JOY1+1, "JOY2"},
|
||||
@@ -423,7 +394,7 @@ static keyname_t keynames[] =
|
||||
{KEY_JOY1+6, "JOY7"},
|
||||
{KEY_JOY1+7, "JOY8"},
|
||||
{KEY_JOY1+8, "JOY9"},
|
||||
|
||||
|
||||
#if !defined (NOMOREJOYBTN_1S)
|
||||
// we use up to 32 buttons in DirectInput
|
||||
{KEY_JOY1+9, "JOY10"},
|
||||
@@ -476,14 +447,6 @@ static keyname_t keynames[] =
|
||||
{KEY_DBLMOUSE1+5, "DBLMOUSE6"},
|
||||
{KEY_DBLMOUSE1+6, "DBLMOUSE7"},
|
||||
{KEY_DBLMOUSE1+7, "DBLMOUSE8"},
|
||||
{KEY_DBL2MOUSE1+0, "DBLSEC_MOUSE2"}, // BP: sorry my mouse handler swap button 1 and 2
|
||||
{KEY_DBL2MOUSE1+1, "DBLSEC_MOUSE1"},
|
||||
{KEY_DBL2MOUSE1+2, "DBLSEC_MOUSE3"},
|
||||
{KEY_DBL2MOUSE1+3, "DBLSEC_MOUSE4"},
|
||||
{KEY_DBL2MOUSE1+4, "DBLSEC_MOUSE5"},
|
||||
{KEY_DBL2MOUSE1+5, "DBLSEC_MOUSE6"},
|
||||
{KEY_DBL2MOUSE1+6, "DBLSEC_MOUSE7"},
|
||||
{KEY_DBL2MOUSE1+7, "DBLSEC_MOUSE8"},
|
||||
|
||||
{KEY_DBLJOY1+0, "DBLJOY1"},
|
||||
{KEY_DBLJOY1+1, "DBLJOY2"},
|
||||
@@ -868,7 +831,6 @@ static keyname_t keynames[] =
|
||||
{KEY_DBL4HAT1+13, "DBLFOR_HATDOWN4"},
|
||||
{KEY_DBL4HAT1+14, "DBLFOR_HATLEFT4"},
|
||||
{KEY_DBL4HAT1+15, "DBLFOR_HATRIGHT4"},
|
||||
|
||||
};
|
||||
|
||||
static const char *gamecontrolname[num_gamecontrols] =
|
||||
@@ -902,115 +864,81 @@ static const char *gamecontrolname[num_gamecontrols] =
|
||||
"custom2",
|
||||
"custom3",
|
||||
"director",
|
||||
"freecam",
|
||||
"camfloat",
|
||||
"camsink",
|
||||
"strafeleft",
|
||||
"straferight",
|
||||
};
|
||||
|
||||
#define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t))
|
||||
|
||||
#include "k_kart.h"
|
||||
|
||||
INT32 G_GetDeviceForPlayer(INT32 player)
|
||||
UINT16 G_GetSkinColor(INT32 playernum)
|
||||
{
|
||||
switch (player)
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
case 0:
|
||||
return cv_usejoystick.value;
|
||||
break;
|
||||
case 1:
|
||||
return cv_usejoystick2.value;
|
||||
break;
|
||||
case 2:
|
||||
return cv_usejoystick3.value;
|
||||
break;
|
||||
case 3:
|
||||
return cv_usejoystick4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
player_t *player = &players[displayplayers[playernum]];
|
||||
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
if (cv_ledpowerup[playernum].value && player->mo && (player->kartstuff[k_invincibilitytimer] || player->kartstuff[k_growshrinktimer] || player->powers[pw_invulnerability]))
|
||||
return player->mo->color;
|
||||
|
||||
// take actual player skincolour when ingame
|
||||
if (player->skincolor)
|
||||
return player->skincolor;
|
||||
}
|
||||
}
|
||||
|
||||
inline UINT16 G_GetSkinColor(INT32 player)
|
||||
{
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
if (cv_ledpowerup[player].value && gamestate == GS_LEVEL && players[displayplayers[player]].mo && (players[displayplayers[player]].kartstuff[k_invincibilitytimer] || players[displayplayers[player]].powers[pw_invulnerability] || players[displayplayers[player]].kartstuff[k_growshrinktimer]))
|
||||
return players[displayplayers[player]].mo->color;
|
||||
|
||||
// take actual player skincolour when ingame
|
||||
if (gamestate == GS_LEVEL && players[displayplayers[player]].skincolor)
|
||||
return players[displayplayers[player]].skincolor;
|
||||
|
||||
// otherwise just fallback to whatever the cvar is
|
||||
switch (player)
|
||||
switch (playernum)
|
||||
{
|
||||
case 0:
|
||||
return cv_playercolor.value;
|
||||
break;
|
||||
case 1:
|
||||
return cv_playercolor2.value;
|
||||
break;
|
||||
case 2:
|
||||
return cv_playercolor3.value;
|
||||
break;
|
||||
case 3:
|
||||
return cv_playercolor4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color)
|
||||
void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT16 color)
|
||||
{
|
||||
INT32 device;
|
||||
UINT16 skincolor;
|
||||
byteColor_t byte_color;
|
||||
|
||||
I_Assert(player >= 0 && player < MAXSPLITSCREENPLAYERS);
|
||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
return;
|
||||
|
||||
device = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device <= 0)
|
||||
if (cv_gamepadled[playernum].value == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
skincolor = color ? color : G_GetSkinColor(player);
|
||||
skincolor = color ? color : G_GetSkinColor(playernum);
|
||||
byte_color = V_GetColor(colortranslations[skincolor][8]).s;
|
||||
|
||||
I_SetGamepadIndicatorColor(device, byte_color.red, byte_color.green, byte_color.blue);
|
||||
I_SetGamepadIndicatorColor(playernum, byte_color.red, byte_color.green, byte_color.blue);
|
||||
}
|
||||
|
||||
static void G_ResetPlayerGamepadIndicatorColor(INT32 player)
|
||||
static void G_ResetPlayerGamepadIndicatorColor(INT32 playernum)
|
||||
{
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
if (cv_gamepadled[playernum].value == 0)
|
||||
{
|
||||
INT32 device = G_GetDeviceForPlayer(player);
|
||||
if (device <= 0)
|
||||
return;
|
||||
|
||||
I_SetGamepadIndicatorColor(device, 0, 0, 255);
|
||||
I_SetGamepadIndicatorColor(playernum, 0, 0, 255);
|
||||
}
|
||||
else
|
||||
G_SetPlayerGamepadIndicatorColor(player, 0);
|
||||
G_SetPlayerGamepadIndicatorColor(playernum, 0);
|
||||
}
|
||||
|
||||
static void G_ResetPlayerDeviceRumble(INT32 player)
|
||||
static void G_ResetPlayerDeviceRumble(INT32 playernum)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
I_GamepadRumble(playernum, 0, 0, 0);
|
||||
}
|
||||
|
||||
void G_ResetAllDeviceRumbles(void)
|
||||
@@ -1022,29 +950,20 @@ void G_ResetAllDeviceRumbles(void)
|
||||
|
||||
for (i = 0; i < devices; i++)
|
||||
{
|
||||
INT32 device_id = G_GetDeviceForPlayer(i);
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
I_GamepadRumble(devices, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration)
|
||||
void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration)
|
||||
{
|
||||
INT32 device_id;
|
||||
I_Assert(playernum >= 0 && playernum < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
if (cv_rumble[player].value == 0)
|
||||
if (cv_rumble[playernum].value == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
I_GamepadRumble(device_id, low_strength, high_strength, duration);
|
||||
I_GamepadRumble(playernum, low_strength, high_strength, duration);
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+11
-13
@@ -41,12 +41,10 @@ typedef enum
|
||||
KEY_DBLJOY1 = KEY_DBLMOUSE1 + MOUSEBUTTONS,
|
||||
KEY_DBLHAT1 = KEY_DBLJOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_2MOUSE1 = KEY_DBLHAT1 + JOYHATS*4,
|
||||
KEY_2JOY1 = KEY_2MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_2JOY1 = KEY_DBLHAT1 + MOUSEBUTTONS,
|
||||
KEY_2HAT1 = KEY_2JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_DBL2MOUSE1 = KEY_2HAT1 + JOYHATS*4,
|
||||
KEY_DBL2JOY1 = KEY_DBL2MOUSE1 + MOUSEBUTTONS,
|
||||
KEY_DBL2JOY1 = KEY_2HAT1 + MOUSEBUTTONS,
|
||||
KEY_DBL2HAT1 = KEY_DBL2JOY1 + JOYBUTTONS,
|
||||
|
||||
KEY_3JOY1 = KEY_DBL2HAT1 + JOYHATS*4,
|
||||
@@ -63,10 +61,8 @@ typedef enum
|
||||
|
||||
KEY_MOUSEWHEELUP = KEY_DBL4HAT1 + JOYHATS*4,
|
||||
KEY_MOUSEWHEELDOWN = KEY_MOUSEWHEELUP + 1,
|
||||
KEY_2MOUSEWHEELUP = KEY_MOUSEWHEELDOWN + 1,
|
||||
KEY_2MOUSEWHEELDOWN = KEY_2MOUSEWHEELUP + 1,
|
||||
|
||||
NUMINPUTS = KEY_2MOUSEWHEELDOWN + 1,
|
||||
NUMINPUTS = KEY_MOUSEWHEELDOWN + 1,
|
||||
} key_input_e;
|
||||
|
||||
typedef enum
|
||||
@@ -100,12 +96,16 @@ typedef enum
|
||||
gc_custom2, // Lua scriptable
|
||||
gc_custom3, // Lua scriptable
|
||||
gc_director,
|
||||
gc_freecam, // Toggle for freecam while ingame
|
||||
gc_camfloat, // alternative button for raising cam
|
||||
gc_camsink, // alternative button for sinking
|
||||
gc_strafeleft,
|
||||
gc_straferight,
|
||||
num_gamecontrols
|
||||
} gamecontrols_e;
|
||||
|
||||
// mouse values are used once
|
||||
extern consvar_t cv_mousesens, cv_mouseysens;
|
||||
extern consvar_t cv_mousesens2, cv_mouseysens2;
|
||||
extern consvar_t cv_controlperkey, cv_turnsmooth;
|
||||
extern consvar_t cv_rumble[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_gamepadled[MAXSPLITSCREENPLAYERS];
|
||||
@@ -113,7 +113,6 @@ extern consvar_t cv_ledpowerup[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern INT32 mousex, mousey;
|
||||
extern INT32 mlooky; //mousey with mlookSensitivity
|
||||
extern INT32 mouse2x, mouse2y, mlook2y;
|
||||
|
||||
extern INT32 joyxmove[JOYAXISSET], joyymove[JOYAXISSET], joy2xmove[JOYAXISSET], joy2ymove[JOYAXISSET],
|
||||
joy3xmove[JOYAXISSET], joy3ymove[JOYAXISSET], joy4xmove[JOYAXISSET], joy4ymove[JOYAXISSET];
|
||||
@@ -134,11 +133,10 @@ extern INT32 gamecontrol4[num_gamecontrols][2];
|
||||
// peace to my little coder fingers!
|
||||
// check a gamecontrol being active or not
|
||||
|
||||
UINT16 G_GetSkinColor(INT32 player);
|
||||
INT32 G_GetDeviceForPlayer(INT32 player);
|
||||
void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color);
|
||||
void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
|
||||
UINT16 G_GetSkinColor(INT32 playernum);
|
||||
void G_SetPlayerGamepadIndicatorColor(INT32 playernum, UINT16 color);
|
||||
void G_ResetAllDeviceRumbles(void);
|
||||
void G_PlayerDeviceRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
|
||||
|
||||
// remaps the input event to a game control.
|
||||
void G_MapEventsToControls(event_t *ev);
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2001 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief 3D sound import/export prototypes for low-level hardware interface
|
||||
|
||||
#ifndef __HW_3DS_DRV_H__
|
||||
#define __HW_3DS_DRV_H__
|
||||
|
||||
// Use standart hardware API
|
||||
#include "hw_dll.h"
|
||||
#include "hws_data.h"
|
||||
|
||||
#if defined (HAVE_SDL) || !defined (HWD)
|
||||
EXPORT void HWRAPI(Shutdown) (void);
|
||||
#endif
|
||||
|
||||
// Use standart Init and Shutdown functions
|
||||
|
||||
EXPORT INT32 HWRAPI (Startup) (I_Error_t FatalErrorFunction, snddev_t *snd_dev);
|
||||
EXPORT u_int HWRAPI (AddSfx) (sfx_data_t *sfx);
|
||||
EXPORT INT32 HWRAPI (AddSource) (source3D_data_t *src, u_int sfxhandle);
|
||||
EXPORT INT32 HWRAPI (StartSource) (INT32 handle);
|
||||
EXPORT void HWRAPI (StopSource) (INT32 handle);
|
||||
EXPORT INT32 HWRAPI (GetHW3DSVersion) (void);
|
||||
EXPORT void HWRAPI (BeginFrameUpdate) (void);
|
||||
EXPORT void HWRAPI (EndFrameUpdate) (void);
|
||||
EXPORT INT32 HWRAPI (IsPlaying) (INT32 handle);
|
||||
EXPORT void HWRAPI (UpdateListener) (listener_data_t *data, INT32 num);
|
||||
EXPORT void HWRAPI (UpdateSourceParms) (INT32 handle, INT32 vol, INT32 sep);
|
||||
EXPORT void HWRAPI (SetGlobalSfxVolume) (INT32 volume);
|
||||
EXPORT INT32 HWRAPI (SetCone) (INT32 handle, cone_def_t *cone_def);
|
||||
EXPORT void HWRAPI (Update3DSource) (INT32 handle, source3D_pos_t *data);
|
||||
EXPORT INT32 HWRAPI (ReloadSource) (INT32 handle, u_int sfxhandle);
|
||||
EXPORT void HWRAPI (KillSource) (INT32 handle);
|
||||
EXPORT void HWRAPI (KillSfx) (u_int sfxhandle);
|
||||
EXPORT void HWRAPI (GetHW3DSTitle) (char *buf, size_t size);
|
||||
|
||||
|
||||
#if !defined (_CREATE_DLL_)
|
||||
|
||||
struct hardware3ds_s
|
||||
{
|
||||
Startup pfnStartup;
|
||||
AddSfx pfnAddSfx;
|
||||
AddSource pfnAddSource;
|
||||
StartSource pfnStartSource;
|
||||
StopSource pfnStopSource;
|
||||
GetHW3DSVersion pfnGetHW3DSVersion;
|
||||
BeginFrameUpdate pfnBeginFrameUpdate;
|
||||
EndFrameUpdate pfnEndFrameUpdate;
|
||||
IsPlaying pfnIsPlaying;
|
||||
UpdateListener pfnUpdateListener;
|
||||
UpdateSourceParms pfnUpdateSourceParms;
|
||||
SetGlobalSfxVolume pfnSetGlobalSfxVolume;
|
||||
SetCone pfnSetCone;
|
||||
Update3DSource pfnUpdate3DSource;
|
||||
ReloadSource pfnReloadSource;
|
||||
KillSource pfnKillSource;
|
||||
KillSfx pfnKillSfx;
|
||||
Shutdown pfnShutdown;
|
||||
GetHW3DSTitle pfnGetHW3DSTitle;
|
||||
};
|
||||
|
||||
extern struct hardware3ds_s hw3ds_driver;
|
||||
|
||||
#define HW3DS hw3ds_driver
|
||||
|
||||
|
||||
#endif // _CREATE_DLL_
|
||||
|
||||
#endif // __HW_3DS_DRV_H__
|
||||
@@ -1,996 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2001 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief Hardware 3D sound general code
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HW3SOUND
|
||||
|
||||
#include "../i_sound.h"
|
||||
#include "../s_sound.h"
|
||||
#include "../w_wad.h"
|
||||
#include "../z_zone.h"
|
||||
#include "../g_game.h"
|
||||
#include "../tables.h"
|
||||
#include "../sounds.h"
|
||||
#include "../r_main.h"
|
||||
#include "../r_things.h"
|
||||
#include "../m_random.h"
|
||||
#include "../p_local.h"
|
||||
#include "hw3dsdrv.h"
|
||||
#include "hw3sound.h"
|
||||
|
||||
#define ANGLE2DEG(x) (((double)(x)) / ((double)ANGLE_45/45))
|
||||
#define NORM_PITCH 128
|
||||
#define NORM_PRIORITY 64
|
||||
#define NORM_SEP 128
|
||||
#if 1
|
||||
#define TPS(x) (x)
|
||||
#else //Alam_GBC: MPS, not MPF!
|
||||
#define TPS(x) ((float)(x)/(float)TICRATE)
|
||||
#endif
|
||||
|
||||
struct hardware3ds_s hw3ds_driver;
|
||||
|
||||
|
||||
typedef struct source_s
|
||||
{
|
||||
sfxinfo_t *sfxinfo;
|
||||
const void *origin;
|
||||
INT32 handle; // Internal source handle
|
||||
channel_type_t type; // Sound type (attack, scream, etc)
|
||||
} source_t;
|
||||
|
||||
|
||||
typedef struct ambient_sdata_s
|
||||
{
|
||||
source3D_data_t left;
|
||||
source3D_data_t right;
|
||||
} ambient_sdata_t;
|
||||
|
||||
|
||||
typedef struct ambient_source_s
|
||||
{
|
||||
source_t left;
|
||||
source_t right;
|
||||
} ambient_source_t;
|
||||
|
||||
// Static sources
|
||||
// This sources always creates
|
||||
static source_t p_attack_source; // Player attack source
|
||||
static source_t p_attack_source2; // Player2 attack source
|
||||
static source_t p_scream_source; // Player scream source
|
||||
static source_t p_scream_source2; // Player2 scream source
|
||||
|
||||
|
||||
static ambient_source_t ambient_source; // Ambinet sound sources
|
||||
|
||||
// abuse???
|
||||
//static source3D_data_t p_attack_sdata; // ?? Now just holds precalculated player attack source data
|
||||
//static source3D_data_t p_default_sdata;// ?? ---- // ---- // ---- // ---- player scream source data
|
||||
|
||||
static ambient_sdata_t ambient_sdata; // Precalculated datas of an ambient sound sources
|
||||
|
||||
// Stack of dynamic sources
|
||||
static source_t *sources = NULL; // Much like original channels
|
||||
static INT32 num_sources = 0;
|
||||
|
||||
// Current mode of 3D sound system
|
||||
// Default is original (stereo) mode
|
||||
INT32 hws_mode = HWS_DEFAULT_MODE;
|
||||
|
||||
//=============================================================================
|
||||
void HW3S_SetSourcesNum(void)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
// Allocating the internal channels for mixing
|
||||
// (the maximum number of sounds rendered
|
||||
// simultaneously) within zone memory.
|
||||
if (sources)
|
||||
HW3S_StopSounds();
|
||||
Z_Free(sources);
|
||||
|
||||
if (cv_numChannels.value <= STATIC_SOURCES_NUM)
|
||||
I_Error("HW3S_SetSourcesNum: Number of sound sources cannot be less than %d\n", STATIC_SOURCES_NUM + 1);
|
||||
|
||||
num_sources = cv_numChannels.value - STATIC_SOURCES_NUM;
|
||||
|
||||
sources = (source_t *) Z_Malloc(num_sources * sizeof (*sources), PU_STATIC, 0);
|
||||
|
||||
// Free all channels for use
|
||||
for (i = 0; i < num_sources; i++)
|
||||
{
|
||||
sources[i].sfxinfo = NULL;
|
||||
sources[i].type = CT_NORMAL;
|
||||
sources[i].handle = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
static void HW3S_KillSource(INT32 snum)
|
||||
{
|
||||
source_t * s = &sources[snum];
|
||||
|
||||
if (s->sfxinfo)
|
||||
{
|
||||
HW3DS.pfnStopSource(s->handle);
|
||||
HW3DS.pfnKillSource(s->handle);
|
||||
s->handle = -1;
|
||||
s->sfxinfo->usefulness--;
|
||||
s->origin = NULL;
|
||||
s->sfxinfo = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*
|
||||
static void HW3S_StopSource(INT32 snum)
|
||||
{
|
||||
source_t * s = &sources[snum];
|
||||
|
||||
if (s->sfxinfo)
|
||||
{
|
||||
// stop the sound playing
|
||||
HW3DS.pfnStopSource(s->handle);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//=============================================================================
|
||||
void HW3S_StopSound(void *origin)
|
||||
{
|
||||
INT32 snum;
|
||||
|
||||
for (snum = 0; snum < num_sources; snum++)
|
||||
{
|
||||
if (sources[snum].sfxinfo && sources[snum].origin == origin)
|
||||
{
|
||||
HW3S_KillSource(snum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HW3S_StopSoundByID(void *origin, sfxenum_t sfx_id)
|
||||
{
|
||||
INT32 snum;
|
||||
|
||||
for (snum = 0; snum < num_sources; snum++)
|
||||
{
|
||||
if (sources[snum].sfxinfo == &S_sfx[sfx_id] && sources[snum].origin == origin)
|
||||
{
|
||||
HW3S_KillSource(snum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HW3S_StopSoundByNum(sfxenum_t sfxnum)
|
||||
{
|
||||
INT32 snum;
|
||||
|
||||
for (snum = 0; snum < num_sources; snum++)
|
||||
{
|
||||
if (sources[snum].sfxinfo == &S_sfx[sfxnum])
|
||||
{
|
||||
HW3S_KillSource(snum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
void HW3S_StopSounds(void)
|
||||
{
|
||||
INT32 snum;
|
||||
|
||||
// kill all playing sounds at start of level
|
||||
// (trust me - a good idea)
|
||||
for (snum = 0; snum < num_sources; snum++)
|
||||
if (sources[snum].sfxinfo)
|
||||
HW3S_KillSource(snum);
|
||||
|
||||
// Also stop all static sources
|
||||
HW3DS.pfnStopSource(p_attack_source.handle);
|
||||
HW3DS.pfnStopSource(p_attack_source2.handle);
|
||||
HW3DS.pfnStopSource(p_scream_source.handle);
|
||||
HW3DS.pfnStopSource(p_scream_source2.handle);
|
||||
HW3DS.pfnStopSource(ambient_source.left.handle);
|
||||
HW3DS.pfnStopSource(ambient_source.right.handle);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
static INT32 HW3S_GetSource(const void *origin, sfxinfo_t *sfxinfo, boolean splitsound)
|
||||
{
|
||||
//
|
||||
// If none available, return -1. Otherwise source #.
|
||||
// source number to use
|
||||
|
||||
INT32 snum;
|
||||
source_t * src;
|
||||
INT32 sep = NORM_SEP, pitch = NORM_PITCH, volume = 255;
|
||||
|
||||
(void)splitsound;
|
||||
|
||||
// Find an open source
|
||||
for (snum = 0, src = sources; snum < num_sources; src++, snum++)
|
||||
{
|
||||
if (!src->sfxinfo)
|
||||
break;
|
||||
|
||||
#if 0
|
||||
if (origin && src->origin == origin)
|
||||
{
|
||||
HW3S_KillSource(snum);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Check to see if it is audible
|
||||
if (origin && origin != listenmobj)
|
||||
{
|
||||
INT32 rc;
|
||||
rc = S_AdjustSoundParams(listenmobj, origin, &volume, &sep, &pitch, sfxinfo);
|
||||
if (!rc)
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
(void)origin;
|
||||
(void)pitch;
|
||||
(void)volume;
|
||||
(void)sep;
|
||||
#endif
|
||||
|
||||
// None available
|
||||
if (snum == num_sources)
|
||||
{
|
||||
// Look for lower priority
|
||||
for (snum = 0, src = sources; snum < num_sources; src++, snum++)
|
||||
if (src->sfxinfo->priority <= sfxinfo->priority)
|
||||
break;
|
||||
|
||||
if (snum == num_sources)
|
||||
{
|
||||
// No lower priority. Sorry, Charlie.
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, kick out lower priority
|
||||
HW3S_KillSource(snum);
|
||||
}
|
||||
}
|
||||
return snum;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
static void HW3S_FillSourceParameters
|
||||
(const mobj_t *origin,
|
||||
source3D_data_t *data,
|
||||
channel_type_t c_type)
|
||||
{
|
||||
fixed_t x = 0, y = 0, z = 0;
|
||||
|
||||
data->max_distance = MAX_DISTANCE;
|
||||
data->min_distance = MIN_DISTANCE;
|
||||
|
||||
if (origin && origin != players[displayplayers[0]].mo)
|
||||
{
|
||||
data->head_relative = false;
|
||||
|
||||
data->pos.momx = TPS(FIXED_TO_FLOAT(origin->momx));
|
||||
data->pos.momy = TPS(FIXED_TO_FLOAT(origin->momy));
|
||||
data->pos.momz = TPS(FIXED_TO_FLOAT(origin->momz));
|
||||
|
||||
x = origin->x;
|
||||
y = origin->y;
|
||||
z = origin->z;
|
||||
|
||||
if (c_type == CT_ATTACK)
|
||||
{
|
||||
const angle_t an = origin->angle >> ANGLETOFINESHIFT;
|
||||
x += FixedMul(16*FRACUNIT, FINECOSINE(an));
|
||||
y += FixedMul(16*FRACUNIT, FINESINE(an));
|
||||
z += origin->height >> 1;
|
||||
}
|
||||
|
||||
else if (c_type == CT_SCREAM)
|
||||
z += origin->height - (5 * FRACUNIT);
|
||||
}
|
||||
else
|
||||
{
|
||||
data->head_relative = true;
|
||||
|
||||
data->pos.momx = 0.0f;
|
||||
data->pos.momy = 0.0f;
|
||||
data->pos.momz = 0.0f;
|
||||
}
|
||||
data->pos.x = FIXED_TO_FLOAT(x);
|
||||
data->pos.y = FIXED_TO_FLOAT(y);
|
||||
data->pos.z = FIXED_TO_FLOAT(z);
|
||||
}
|
||||
|
||||
#define HEADER_SIZE 8
|
||||
//==============================================================
|
||||
/*
|
||||
static void make_outphase_sfx(void *dest, void *src, INT32 size)
|
||||
{
|
||||
SINT8 *s = (SINT8 *)src + HEADER_SIZE, *d = (SINT8 *)dest + HEADER_SIZE;
|
||||
|
||||
M_Memcpy(dest, src, HEADER_SIZE);
|
||||
size -= HEADER_SIZE;
|
||||
|
||||
while (size--)
|
||||
*d++ = -(*s++);
|
||||
}
|
||||
*/
|
||||
|
||||
//INT32 HW3S_Start3DSound(const void *origin, source3D_data_t *source_parm, cone_def_t *cone_parm, channel_type_t channel, INT32 sfx_id, INT32 vol, INT32 pitch);
|
||||
//=============================================================================
|
||||
INT32 HW3S_I_StartSound(const void *origin_p, source3D_data_t *source_parm, channel_type_t c_type, sfxenum_t sfx_id, INT32 volume, INT32 pitch, INT32 sep)
|
||||
{
|
||||
sfxinfo_t *sfx;
|
||||
const mobj_t *origin = (const mobj_t *)origin_p;
|
||||
source3D_data_t source3d_data;
|
||||
INT32 s_num = 0;
|
||||
source_t *source = NULL;
|
||||
mobj_t *listenmobj = players[displayplayers[0]].mo; // TODO: Kart 4P does not support sounds properly here
|
||||
mobj_t *listenmobj2 = NULL;
|
||||
|
||||
if (splitscreen) listenmobj2 = players[displayplayers[1]].mo;
|
||||
|
||||
if (sound_disabled)
|
||||
return -1;
|
||||
|
||||
sfx = &S_sfx[sfx_id];
|
||||
|
||||
if (sfx->skinsound!=-1 && origin && origin->skin)
|
||||
{
|
||||
// it redirect player sound to the sound in the skin table
|
||||
sfx_id = ((skin_t *)origin->skin)->soundsid[sfx->skinsound];
|
||||
sfx = &S_sfx[sfx_id];
|
||||
}
|
||||
|
||||
if (!sfx->data)
|
||||
sfx->data = HW3S_GetSfx(sfx);
|
||||
|
||||
// judgecutor 08-16-2002
|
||||
// Sound pitching for both Doom and Heretic
|
||||
#if 0
|
||||
if (cv_rndsoundpitch.value)
|
||||
{
|
||||
/*if (gamemode != heretic)
|
||||
{
|
||||
if (sfx_id >= sfx_sawup && sfx_id <= sfx_sawhit)
|
||||
pitch += 8 - (M_RandomByte()&15);
|
||||
else if (sfx_id != sfx_itemup && sfx_id != sfx_tink)
|
||||
pitch += 16 - (M_RandomByte()&31);
|
||||
}
|
||||
else*/
|
||||
pitch = 128 + (M_RandomByte() & 7) - (M_RandomByte() & 7);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (pitch < 0)
|
||||
pitch = NORMAL_PITCH;
|
||||
|
||||
if (pitch > 255)
|
||||
pitch = 255;
|
||||
|
||||
if (sep < 0)
|
||||
sep = 128;
|
||||
|
||||
if (splitscreen && listenmobj2) // Copy the sound for the split player
|
||||
{
|
||||
if (c_type != CT_NORMAL && origin && (origin == listenmobj2))
|
||||
{
|
||||
if (c_type == CT_ATTACK)
|
||||
{
|
||||
if (origin == listenmobj2)
|
||||
source = &p_attack_source;
|
||||
else
|
||||
source = &p_attack_source2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (origin == listenmobj2)
|
||||
source = &p_scream_source;
|
||||
else
|
||||
source = &p_scream_source2;
|
||||
}
|
||||
|
||||
if (source->sfxinfo != sfx)
|
||||
{
|
||||
HW3DS.pfnStopSource(source->handle);
|
||||
source->handle = HW3DS.pfnReloadSource(source->handle, sfx->volume);
|
||||
//I_OutputMsg("PlayerSound data reloaded\n");
|
||||
}
|
||||
}
|
||||
else if (c_type == CT_AMBIENT)
|
||||
{
|
||||
// sfx_data_t outphased_sfx;
|
||||
|
||||
if (ambient_source.left.sfxinfo != sfx)
|
||||
{
|
||||
HW3DS.pfnStopSource(ambient_source.left.handle);
|
||||
HW3DS.pfnStopSource(ambient_source.right.handle);
|
||||
|
||||
// judgecutor:
|
||||
// Outphased sfx's temporarily not used!!!
|
||||
/*
|
||||
outphased_sfx.data = Z_Malloc(sfx_data.length, PU_STATIC, 0);
|
||||
make_outphase_sfx(outphased_sfx.data, sfx_data.data, sfx_data.length);
|
||||
outphased_sfx.length = sfx_data.length;
|
||||
outphased_sfx.id = sfx_data.id;
|
||||
*/
|
||||
ambient_source.left.handle = HW3DS.pfnReloadSource(ambient_source.left.handle, (u_int)sfx->length);
|
||||
//ambient_source.right.handle = HW3DS.pfnReloadSource(ambient_source.right.handle, &outphased_sfx);
|
||||
ambient_source.right.handle = HW3DS.pfnReloadSource(ambient_source.right.handle, (u_int)sfx->length);
|
||||
ambient_source.left.sfxinfo = ambient_source.right.sfxinfo = sfx;
|
||||
//Z_Free(outphased_sfx.data);
|
||||
}
|
||||
|
||||
HW3DS.pfnUpdateSourceParms(ambient_source.left.handle, volume, -1);
|
||||
HW3DS.pfnUpdateSourceParms(ambient_source.right.handle, volume, -1);
|
||||
|
||||
if (sfx->usefulness++ < 0)
|
||||
sfx->usefulness = -1;
|
||||
|
||||
// Ambient sound is special case
|
||||
HW3DS.pfnStartSource(ambient_source.left.handle);
|
||||
HW3DS.pfnStartSource(ambient_source.right.handle);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_num = HW3S_GetSource(origin, sfx, true);
|
||||
|
||||
if (s_num < 0)
|
||||
{
|
||||
//I_OutputMsg("No free source, aborting\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
source = &sources[s_num];
|
||||
|
||||
if (origin && c_type == CT_NORMAL)
|
||||
{
|
||||
if (!source_parm)
|
||||
{
|
||||
source_parm = &source3d_data;
|
||||
source3d_data.permanent = 0;
|
||||
HW3S_FillSourceParameters(origin, source_parm, c_type);
|
||||
}
|
||||
|
||||
source->handle = HW3DS.pfnAddSource(source_parm, (u_int)sfx->length);
|
||||
}
|
||||
else
|
||||
source->handle = HW3DS.pfnAddSource(NULL, (u_int)sfx->length);
|
||||
}
|
||||
|
||||
// increase the usefulness
|
||||
if (sfx->usefulness++ < 0)
|
||||
sfx->usefulness = -1;
|
||||
|
||||
source->sfxinfo = sfx;
|
||||
source->origin = origin;
|
||||
HW3DS.pfnStartSource(source->handle);
|
||||
}
|
||||
|
||||
if (c_type != CT_NORMAL && origin && (origin == listenmobj))
|
||||
{
|
||||
if (c_type == CT_ATTACK)
|
||||
{
|
||||
if (origin == listenmobj)
|
||||
source = &p_attack_source;
|
||||
else
|
||||
source = &p_attack_source2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (origin == listenmobj)
|
||||
source = &p_scream_source;
|
||||
else
|
||||
source = &p_scream_source2;
|
||||
}
|
||||
|
||||
if (source->sfxinfo != sfx)
|
||||
{
|
||||
HW3DS.pfnStopSource(source->handle);
|
||||
source->handle = HW3DS.pfnReloadSource(source->handle, sfx->volume);
|
||||
//I_OutputMsg("PlayerSound data reloaded\n");
|
||||
}
|
||||
}
|
||||
else if (c_type == CT_AMBIENT)
|
||||
{
|
||||
// sfx_data_t outphased_sfx;
|
||||
|
||||
if (ambient_source.left.sfxinfo != sfx)
|
||||
{
|
||||
HW3DS.pfnStopSource(ambient_source.left.handle);
|
||||
HW3DS.pfnStopSource(ambient_source.right.handle);
|
||||
|
||||
// judgecutor:
|
||||
// Outphased sfx's temporarily not used!!!
|
||||
/*
|
||||
outphased_sfx.data = Z_Malloc(sfx_data.length, PU_STATIC, 0);
|
||||
make_outphase_sfx(outphased_sfx.data, sfx_data.data, sfx_data.length);
|
||||
outphased_sfx.length = sfx_data.length;
|
||||
outphased_sfx.id = sfx_data.id;
|
||||
*/
|
||||
ambient_source.left.handle = HW3DS.pfnReloadSource(ambient_source.left.handle, (u_int)sfx->length);
|
||||
//ambient_source.right.handle = HW3DS.pfnReloadSource(ambient_source.right.handle, &outphased_sfx);
|
||||
ambient_source.right.handle = HW3DS.pfnReloadSource(ambient_source.right.handle, (u_int)sfx->length);
|
||||
ambient_source.left.sfxinfo = ambient_source.right.sfxinfo = sfx;
|
||||
//Z_Free(outphased_sfx.data);
|
||||
}
|
||||
|
||||
HW3DS.pfnUpdateSourceParms(ambient_source.left.handle, volume, -1);
|
||||
HW3DS.pfnUpdateSourceParms(ambient_source.right.handle, volume, -1);
|
||||
|
||||
if (sfx->usefulness++ < 0)
|
||||
sfx->usefulness = -1;
|
||||
|
||||
// Ambient sound is special case
|
||||
HW3DS.pfnStartSource(ambient_source.left.handle);
|
||||
HW3DS.pfnStartSource(ambient_source.right.handle);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_num = HW3S_GetSource(origin, sfx, false);
|
||||
|
||||
if (s_num < 0)
|
||||
{
|
||||
//I_OutputMsg("No free source, aborting\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
source = &sources[s_num];
|
||||
|
||||
if (origin && c_type == CT_NORMAL)
|
||||
{
|
||||
if (!source_parm)
|
||||
{
|
||||
source_parm = &source3d_data;
|
||||
source3d_data.permanent = 0;
|
||||
HW3S_FillSourceParameters(origin, source_parm, c_type);
|
||||
}
|
||||
|
||||
source->handle = HW3DS.pfnAddSource(source_parm, (u_int)sfx->length);
|
||||
}
|
||||
else
|
||||
source->handle = HW3DS.pfnAddSource(NULL, (u_int)sfx->length);
|
||||
|
||||
}
|
||||
|
||||
// increase the usefulness
|
||||
if (sfx->usefulness++ < 0)
|
||||
sfx->usefulness = -1;
|
||||
|
||||
source->sfxinfo = sfx;
|
||||
source->origin = origin;
|
||||
HW3DS.pfnStartSource(source->handle);
|
||||
return s_num;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Start normal sound
|
||||
//=============================================================================
|
||||
void HW3S_StartSound(const void *origin, sfxenum_t sfx_id)
|
||||
{
|
||||
HW3S_I_StartSound(origin, NULL, CT_NORMAL, sfx_id, 255, NORMAL_PITCH, NORMAL_SEP);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
void S_StartAttackSound(const void *origin, sfxenum_t sfx_id)
|
||||
{
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
HW3S_I_StartSound(origin, NULL, CT_ATTACK, sfx_id, 255, NORMAL_PITCH, NORMAL_SEP);
|
||||
else
|
||||
S_StartSound(origin, sfx_id);
|
||||
}
|
||||
|
||||
void S_StartScreamSound(const void *origin, sfxenum_t sfx_id)
|
||||
{
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
HW3S_I_StartSound(origin, NULL, CT_SCREAM, sfx_id, 255, NORMAL_PITCH, NORMAL_SEP);
|
||||
else
|
||||
S_StartSound(origin, sfx_id);
|
||||
}
|
||||
|
||||
#if 0 /// NOTE: not used
|
||||
void S_StartAmbientSound(sfxenum_t sfx_id, INT32 volume)
|
||||
{
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
{
|
||||
volume += 30;
|
||||
if (volume > 255)
|
||||
volume = 255;
|
||||
|
||||
HW3S_I_StartSound(NULL, NULL, CT_AMBIENT, sfx_id, volume, NORMAL_PITCH, NORMAL_SEP);
|
||||
}
|
||||
else
|
||||
S_StartSoundAtVolume(NULL, sfx_id, volume);
|
||||
}
|
||||
#endif
|
||||
|
||||
FUNCMATH static inline float AmbientPos(angle_t an)
|
||||
{
|
||||
const fixed_t fm = FixedMul(FLOAT_TO_FIXED(MIN_DISTANCE), FINESINE(an>>ANGLETOFINESHIFT));
|
||||
return FIXED_TO_FLOAT(fm);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
INT32 HW3S_Init(I_Error_t FatalErrorFunction, snddev_t *snd_dev)
|
||||
{
|
||||
INT32 succ;
|
||||
source3D_data_t source_data;
|
||||
|
||||
if (HW3DS.pfnStartup(FatalErrorFunction, snd_dev))
|
||||
{
|
||||
// Attack source
|
||||
source_data.head_relative = 1;
|
||||
source_data.pos.x = 0.0f;
|
||||
source_data.pos.y = 16.0f;
|
||||
source_data.pos.z = -FIXED_TO_FLOAT(mobjinfo[MT_PLAYER].height >> 1);
|
||||
source_data.pos.momx = 0.0f;
|
||||
source_data.pos.momy = 0.0f;
|
||||
source_data.pos.momz = 0.0f;
|
||||
source_data.min_distance = MIN_DISTANCE;
|
||||
source_data.max_distance = MAX_DISTANCE;
|
||||
source_data.permanent = 1;
|
||||
|
||||
p_attack_source.sfxinfo = NULL;
|
||||
|
||||
M_Memcpy(&p_attack_source2, &p_attack_source, sizeof (source_t));
|
||||
|
||||
p_attack_source.handle = HW3DS.pfnAddSource(&source_data, sfx_None);
|
||||
p_attack_source2.handle = HW3DS.pfnAddSource(&source_data, sfx_None);
|
||||
|
||||
// Scream source
|
||||
source_data.pos.y = 0;
|
||||
source_data.pos.z = 0;
|
||||
|
||||
p_scream_source.sfxinfo = NULL;
|
||||
|
||||
M_Memcpy(&p_scream_source2, &p_scream_source, sizeof (source_t));
|
||||
|
||||
p_scream_source.handle = HW3DS.pfnAddSource(&source_data, sfx_None);
|
||||
p_scream_source2.handle = HW3DS.pfnAddSource(&source_data, sfx_None);
|
||||
|
||||
//FIXED_TO_FLOAT(mobjinfo[MT_PLAYER].height - (5 * FRACUNIT));
|
||||
|
||||
// Ambient sources (left and right) at 210 and 330 degree
|
||||
// relative to listener
|
||||
memset(&ambient_sdata, 0, sizeof (ambient_sdata));
|
||||
|
||||
ambient_sdata.left.head_relative = 1;
|
||||
ambient_sdata.left.pos.x = ambient_sdata.left.pos.y = AmbientPos(ANG210);
|
||||
ambient_sdata.left.max_distance = MAX_DISTANCE;
|
||||
ambient_sdata.left.min_distance = MIN_DISTANCE;
|
||||
|
||||
ambient_sdata.left.permanent = 1;
|
||||
|
||||
M_Memcpy(&ambient_sdata.right, &ambient_sdata.left, sizeof (source3D_data_t));
|
||||
|
||||
ambient_sdata.right.pos.x = -ambient_sdata.left.pos.x;
|
||||
ambient_source.left.handle = HW3DS.pfnAddSource(&ambient_sdata.left, sfx_None);
|
||||
ambient_source.right.handle = HW3DS.pfnAddSource(&ambient_sdata.right, sfx_None);
|
||||
|
||||
succ = p_attack_source.handle > -1 && p_scream_source.handle > -1 &&
|
||||
p_attack_source2.handle > -1 && p_scream_source2.handle > -1 &&
|
||||
ambient_source.left.handle > -1 && ambient_source.right.handle > -1;
|
||||
|
||||
//I_OutputMsg("Player handles: attack %d, default %d\n", p_attack_source.handle, p_scream_source.handle);
|
||||
return succ;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
INT32 HW3S_GetVersion(void)
|
||||
{
|
||||
return HW3DS.pfnGetHW3DSVersion();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
void HW3S_BeginFrameUpdate(void)
|
||||
{
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
HW3DS.pfnBeginFrameUpdate();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
void HW3S_EndFrameUpdate(void)
|
||||
{
|
||||
if (hws_mode != HWS_DEFAULT_MODE)
|
||||
HW3DS.pfnEndFrameUpdate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
INT32 HW3S_SoundIsPlaying(INT32 handle)
|
||||
{
|
||||
return HW3DS.pfnIsPlaying(handle);
|
||||
}
|
||||
|
||||
INT32 HW3S_OriginPlaying(void *origin)
|
||||
{
|
||||
INT32 snum;
|
||||
|
||||
if (!origin)
|
||||
return 0;
|
||||
for (snum = 0; snum < num_sources; snum++)
|
||||
if (sources[snum].origin == origin)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT32 HW3S_IdPlaying(sfxenum_t id)
|
||||
{
|
||||
INT32 snum;
|
||||
for (snum = 0; snum < num_sources; snum++)
|
||||
if ((size_t)(sources[snum].sfxinfo - S_sfx) == (size_t)id)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT32 HW3S_SoundPlaying(void *origin, sfxenum_t id)
|
||||
{
|
||||
INT32 snum;
|
||||
|
||||
if (!origin)
|
||||
return 0;
|
||||
|
||||
for (snum = 0; snum < num_sources; snum++)
|
||||
{
|
||||
if (sources[snum].origin == origin
|
||||
&& (size_t)(sources[snum].sfxinfo - S_sfx) == (size_t)id)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
static void HW3S_UpdateListener(mobj_t *listener)
|
||||
{
|
||||
listener_data_t data;
|
||||
|
||||
if (!listener || !listener->player)
|
||||
return;
|
||||
|
||||
if (camera.chase)
|
||||
{
|
||||
data.x = FIXED_TO_FLOAT(camera.x);
|
||||
data.y = FIXED_TO_FLOAT(camera.y);
|
||||
data.z = FIXED_TO_FLOAT(camera.z + camera.height - (5 * FRACUNIT));
|
||||
|
||||
data.f_angle = ANGLE2DEG(camera.angle);
|
||||
data.h_angle = ANGLE2DEG(camera.aiming);
|
||||
|
||||
data.momx = TPS(FIXED_TO_FLOAT(camera.momx));
|
||||
data.momy = TPS(FIXED_TO_FLOAT(camera.momy));
|
||||
data.momz = TPS(FIXED_TO_FLOAT(camera.momz));
|
||||
}
|
||||
else
|
||||
{
|
||||
data.x = FIXED_TO_FLOAT(listener->x);
|
||||
data.y = FIXED_TO_FLOAT(listener->y);
|
||||
data.z = FIXED_TO_FLOAT(listener->z + listener->height - (5 * FRACUNIT));
|
||||
|
||||
data.f_angle = ANGLE2DEG(listener->angle);
|
||||
data.h_angle = ANGLE2DEG(listener->player->aiming);
|
||||
|
||||
data.momx = TPS(FIXED_TO_FLOAT(listener->momx));
|
||||
data.momy = TPS(FIXED_TO_FLOAT(listener->momy));
|
||||
data.momz = TPS(FIXED_TO_FLOAT(listener->momz));
|
||||
}
|
||||
HW3DS.pfnUpdateListener(&data, 1);
|
||||
}
|
||||
|
||||
static void HW3S_UpdateListener2(mobj_t *listener)
|
||||
{
|
||||
listener_data_t data;
|
||||
|
||||
if (!listener || !listener->player)
|
||||
{
|
||||
HW3DS.pfnUpdateListener(NULL, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
if (camera2.chase)
|
||||
{
|
||||
data.x = FIXED_TO_FLOAT(camera2.x);
|
||||
data.y = FIXED_TO_FLOAT(camera2.y);
|
||||
data.z = FIXED_TO_FLOAT(camera2.z + camera2.height - (5 * FRACUNIT));
|
||||
|
||||
data.f_angle = ANGLE2DEG(camera2.angle);
|
||||
data.h_angle = ANGLE2DEG(camera2.aiming);
|
||||
|
||||
data.momx = TPS(FIXED_TO_FLOAT(camera2.momx));
|
||||
data.momy = TPS(FIXED_TO_FLOAT(camera2.momy));
|
||||
data.momz = TPS(FIXED_TO_FLOAT(camera2.momz));
|
||||
}
|
||||
else
|
||||
{
|
||||
data.x = FIXED_TO_FLOAT(listener->x);
|
||||
data.y = FIXED_TO_FLOAT(listener->y);
|
||||
data.z = FIXED_TO_FLOAT(listener->z + listener->height - (5 * FRACUNIT));
|
||||
|
||||
data.f_angle = ANGLE2DEG(listener->angle);
|
||||
data.h_angle = ANGLE2DEG(listener->player->aiming);
|
||||
|
||||
data.momx = TPS(FIXED_TO_FLOAT(listener->momx));
|
||||
data.momy = TPS(FIXED_TO_FLOAT(listener->momy));
|
||||
data.momz = TPS(FIXED_TO_FLOAT(listener->momz));
|
||||
}
|
||||
|
||||
HW3DS.pfnUpdateListener(&data, 2);
|
||||
}
|
||||
|
||||
void HW3S_SetSfxVolume(INT32 volume)
|
||||
{
|
||||
HW3DS.pfnSetGlobalSfxVolume(volume);
|
||||
}
|
||||
|
||||
|
||||
static void HW3S_Update3DSource(source_t *src)
|
||||
{
|
||||
source3D_data_t data;
|
||||
data.permanent = 0;
|
||||
HW3S_FillSourceParameters(src->origin, &data, src->type);
|
||||
HW3DS.pfnUpdate3DSource(src->handle, &data.pos);
|
||||
|
||||
}
|
||||
|
||||
void HW3S_UpdateSources(void)
|
||||
{
|
||||
mobj_t *listener = players[displayplayers[0]].mo;
|
||||
mobj_t *listener2 = NULL;
|
||||
source_t *src;
|
||||
INT32 audible, snum, volume, sep, pitch;
|
||||
|
||||
if (splitscreen) listener2 = players[displayplayers[1]].mo;
|
||||
|
||||
HW3S_UpdateListener2(listener2);
|
||||
HW3S_UpdateListener(listener);
|
||||
|
||||
for (snum = 0, src = sources; snum < num_sources; src++, snum++)
|
||||
{
|
||||
if (src->sfxinfo)
|
||||
{
|
||||
#if 0
|
||||
if (HW3DS.pfnIsPlaying(src->handle))
|
||||
{
|
||||
if (src->origin)
|
||||
{
|
||||
// initialize parameters
|
||||
volume = 255; // 8 bits internal volume precision
|
||||
pitch = NORM_PITCH;
|
||||
sep = NORM_SEP;
|
||||
|
||||
// check non-local sounds for distance clipping
|
||||
// or modify their params
|
||||
if (src->origin && listener != src->origin && !(listener2 && src->origin == listener2))
|
||||
{
|
||||
INT32 audible2;
|
||||
INT32 volume2 = volume, sep2 = sep, pitch2 = pitch;
|
||||
audible = S_AdjustSoundParams(listener, src->origin, &volume, &sep, &pitch,
|
||||
src->sfxinfo);
|
||||
|
||||
if (listener2)
|
||||
{
|
||||
audible2 = S_AdjustSoundParams(listener2,
|
||||
src->origin, &volume2, &sep2, &pitch2, src->sfxinfo);
|
||||
if (audible2 && (!audible || (audible && volume2 > volume)))
|
||||
{
|
||||
audible = true;
|
||||
volume = volume2;
|
||||
sep = sep2;
|
||||
pitch = pitch2;
|
||||
}
|
||||
}
|
||||
|
||||
if (audible)
|
||||
HW3S_Update3DSource(src); // Update positional sources
|
||||
else
|
||||
HW3S_KillSource(snum); //Kill it!
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Source allocated but stopped. Kill.
|
||||
HW3S_KillSource(snum);
|
||||
}
|
||||
#else
|
||||
if (src->origin && listener != src->origin && !(listener2 && src->origin == listener2))
|
||||
HW3S_Update3DSource(src); // Update positional sources
|
||||
(void)pitch;
|
||||
(void)sep;
|
||||
(void)volume;
|
||||
(void)audible;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HW3S_Shutdown(void)
|
||||
{
|
||||
HW3DS.pfnShutdown();
|
||||
}
|
||||
|
||||
void *HW3S_GetSfx(sfxinfo_t *sfx)
|
||||
{
|
||||
sfx_data_t sfx_data;
|
||||
|
||||
if (sfx->lumpnum == LUMPERROR)
|
||||
sfx->lumpnum = S_GetSfxLumpNum (sfx);
|
||||
|
||||
sfx_data.length = W_LumpLength(sfx->lumpnum);
|
||||
sfx_data.data = Z_Malloc(sfx_data.length, PU_SOUND, &sfx->data);
|
||||
W_ReadLump(sfx->lumpnum, sfx_data.data);
|
||||
sfx_data.priority = sfx->priority;
|
||||
|
||||
sfx->length = HW3DS.pfnAddSfx(&sfx_data);
|
||||
|
||||
Z_ChangeTag(sfx->data, PU_CACHE);
|
||||
|
||||
return sfx_data.data;
|
||||
}
|
||||
|
||||
void HW3S_FreeSfx(sfxinfo_t *sfx)
|
||||
{
|
||||
INT32 snum;
|
||||
|
||||
for (snum = 0; snum < num_sources; snum++)
|
||||
{
|
||||
if (sources[snum].sfxinfo == sfx)
|
||||
{
|
||||
HW3S_KillSource(snum);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sfx->length > 0)
|
||||
HW3DS.pfnKillSfx((u_int)sfx->length);
|
||||
sfx->length = 0;
|
||||
|
||||
sfx->lumpnum = LUMPERROR;
|
||||
|
||||
Z_Free(sfx->data);
|
||||
sfx->data = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,106 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2001 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief High-level functions of hardware 3D sound
|
||||
|
||||
#ifndef __HW3_SOUND_H__
|
||||
#define __HW3_SOUND_H__
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hws_data.h"
|
||||
//#include "../s_sound.h"
|
||||
//#include "../p_mobj.h"
|
||||
|
||||
// Default sound mode (original stereo mode)
|
||||
enum
|
||||
{
|
||||
HWS_DEFAULT_MODE = 0,
|
||||
HWS_DS3D,
|
||||
HWS_OTHER,
|
||||
HWS_FMOD3D,
|
||||
HWS_OPENAL,
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
CT_NORMAL = 0,
|
||||
CT_ATTACK,
|
||||
CT_SCREAM,
|
||||
CT_AMBIENT,
|
||||
} channel_type_t;
|
||||
|
||||
extern INT32 hws_mode; // Current sound mode
|
||||
|
||||
#if defined (HW3DS) || defined (DOXYGEN)
|
||||
INT32 HW3S_Init(I_Error_t FatalErrorFunction, snddev_t *snd_dev);
|
||||
#endif
|
||||
void HW3S_Shutdown(void);
|
||||
INT32 HW3S_GetVersion(void);
|
||||
|
||||
// Common case - start 3D or 2D source
|
||||
void HW3S_StartSound(const void *origin, sfxenum_t sfx_id);
|
||||
|
||||
// Special cases of 3D sources
|
||||
void S_StartAmbientSound(sfxenum_t sfx_id, INT32 volume);
|
||||
void S_StartAttackSound(const void *origin, sfxenum_t sfx_id);
|
||||
void S_StartScreamSound(const void *origin, sfxenum_t sfx_id);
|
||||
|
||||
// Starts 3D sound with specified parameters
|
||||
// origin - for object movement tracking. NULL are possible value (no movement tracking)
|
||||
// source_parm - 3D source parameters (position etc.)
|
||||
// cone_parm - 3D source cone parameters. NULL are possible value (default cone will be used)
|
||||
// channel -
|
||||
// sfx_id - sfx id
|
||||
// vol - sound volume
|
||||
// pitch - sound pitching value
|
||||
// Returns: - sound id
|
||||
INT32 HW3S_I_StartSound(const void *origin, source3D_data_t *source_parm, channel_type_t channel, sfxenum_t sfx_id, INT32 vol, INT32 pitch, INT32 sep);
|
||||
void HW3S_StopSoundByID(void *origin, sfxenum_t sfx_id);
|
||||
void HW3S_StopSoundByNum(sfxenum_t sfxnum);
|
||||
void HW3S_StopSound(void *origin);
|
||||
void HW3S_StopSounds(void);
|
||||
|
||||
void HW3S_BeginFrameUpdate(void);
|
||||
void HW3S_EndFrameUpdate(void);
|
||||
|
||||
void HW3S_UpdateSources(void);
|
||||
|
||||
void HW3S_SetSfxVolume(INT32 volume);
|
||||
|
||||
// Utility functions
|
||||
INT32 HW3S_SoundIsPlaying(INT32 handle);
|
||||
void HW3S_SetSourcesNum(void);
|
||||
|
||||
INT32 HW3S_OriginPlaying(void *origin);
|
||||
INT32 HW3S_IdPlaying(sfxenum_t id);
|
||||
INT32 HW3S_SoundPlaying(void *origin, sfxenum_t id);
|
||||
|
||||
void *HW3S_GetSfx(sfxinfo_t *sfx);
|
||||
void HW3S_FreeSfx(sfxinfo_t *sfx);
|
||||
|
||||
#else // HW3SOUND
|
||||
|
||||
//#define S_StartAmbientSound(i,v) S_StartSoundAtVolume(NULL, i, v)
|
||||
#define S_StartAttackSound S_StartSound
|
||||
#define S_StartScreamSound S_StartSound
|
||||
|
||||
#endif // HW3SOUND
|
||||
|
||||
INT32 S_AdjustSoundParams(const mobj_t *listener, const mobj_t *source,
|
||||
INT32 *vol, INT32 *sep, INT32 *pitch, sfxinfo_t *sfxinfo);
|
||||
|
||||
#endif // __HW3_SOUND_H__
|
||||
+33
-40
@@ -15,8 +15,9 @@
|
||||
#include "hw_main.h"
|
||||
#include "../i_system.h"
|
||||
|
||||
#include "../qs22j.h"
|
||||
#include "../doomdef.h"
|
||||
|
||||
#include "../qs22j.h"
|
||||
|
||||
// The texture for the next polygon given to HWR_ProcessPolygon.
|
||||
// Set with HWR_SetCurrentTexture.
|
||||
@@ -64,7 +65,7 @@ void HWR_StartBatching(void)
|
||||
currently_batching = true;
|
||||
}
|
||||
|
||||
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
|
||||
// This replaces the direct calls to GL_SetTexture in cases where batching is available.
|
||||
// The texture selection is saved for the next HWR_ProcessPolygon call.
|
||||
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
|
||||
void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
@@ -75,7 +76,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(texture);
|
||||
GL_SetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,8 +130,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
GL_SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,27 +141,19 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2;
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
UINT32 downloaded1 = 0;
|
||||
UINT32 downloaded2 = 0;
|
||||
|
||||
int shader1 = poly1->shader;
|
||||
int shader2 = poly2->shader;
|
||||
// make skywalls and horizon lines first in order
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
shader1 = -1;
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
shader2 = -1;
|
||||
diff = shader1 - shader2;
|
||||
if (diff != 0) return diff;
|
||||
int shader1 = (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) ? -1 : poly1->shader;
|
||||
int shader2 = (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) ? -1 : poly2->shader;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (shader1 == -1 && shader2 == -1)
|
||||
return poly1 - poly2;
|
||||
|
||||
if (poly1->texture)
|
||||
downloaded1 = poly1->texture->downloaded; // there should be a opengl texture name here, usable for comparisons
|
||||
if (poly2->texture)
|
||||
downloaded2 = poly2->texture->downloaded;
|
||||
diff = shader1 - shader2;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
UINT32 downloaded1 = poly1->texture ? poly1->texture->downloaded : 0; // there should be a opengl texture name here, usable for comparisons
|
||||
UINT32 downloaded2 = poly2->texture ? poly2->texture->downloaded : 0;
|
||||
diff64 = downloaded1 - downloaded2;
|
||||
if (diff64 != 0) return diff64;
|
||||
|
||||
@@ -179,6 +172,10 @@ static int comparePolygons(const void *p1, const void *p2)
|
||||
diff = poly1->surf.LightInfo.fade_start - poly2->surf.LightInfo.fade_start;
|
||||
if (diff != 0) return diff;
|
||||
diff = poly1->surf.LightInfo.fade_end - poly2->surf.LightInfo.fade_end;
|
||||
if (diff != 0) return diff;
|
||||
|
||||
diff = poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional;
|
||||
|
||||
return diff;
|
||||
}
|
||||
|
||||
@@ -189,21 +186,15 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
int diff;
|
||||
INT64 diff64;
|
||||
|
||||
GLMipmap_t *texture1 = poly1->texture;
|
||||
GLMipmap_t *texture2 = poly2->texture;
|
||||
UINT32 downloaded1 = 0;
|
||||
UINT32 downloaded2 = 0;
|
||||
if (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial)
|
||||
texture1 = NULL;
|
||||
if (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial)
|
||||
texture2 = NULL;
|
||||
if (texture1)
|
||||
downloaded1 = texture1->downloaded; // there should be a opengl texture name here, usable for comparisons
|
||||
if (texture2)
|
||||
downloaded2 = texture2->downloaded;
|
||||
GLMipmap_t *texture1 = (poly1->polyFlags & PF_NoTexture || poly1->horizonSpecial) ? NULL : poly1->texture;
|
||||
GLMipmap_t *texture2 = (poly2->polyFlags & PF_NoTexture || poly2->horizonSpecial) ? NULL : poly2->texture;
|
||||
|
||||
// skywalls and horizon lines must retain their order for horizon lines to work
|
||||
if (!texture1 && !texture2)
|
||||
return poly1 - poly2;
|
||||
|
||||
UINT32 downloaded1 = texture1 ? texture1->downloaded : 0; // there should be a opengl texture name here, usable for comparisons
|
||||
UINT32 downloaded2 = texture2 ? texture2->downloaded : 0;
|
||||
diff64 = downloaded1 - downloaded2;
|
||||
if (diff64 != 0) return diff64;
|
||||
|
||||
@@ -227,7 +218,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
int currentShader;
|
||||
int nextShader = 0;
|
||||
GLMipmap_t *currentTexture;
|
||||
GLMipmap_t *currentTexture = NULL;
|
||||
GLMipmap_t *nextTexture = NULL;
|
||||
FBITFIELD currentPolyFlags = 0;
|
||||
FBITFIELD nextPolyFlags = 0;
|
||||
@@ -242,6 +233,7 @@ void HWR_RenderBatches(void)
|
||||
nextSurfaceInfo.LightInfo.fade_end = 0;
|
||||
nextSurfaceInfo.LightInfo.fade_start = 0;
|
||||
nextSurfaceInfo.LightInfo.light_level = 0;
|
||||
nextSurfaceInfo.LightInfo.directional = false;
|
||||
|
||||
currently_batching = false;// no longer collecting batches
|
||||
if (!polygonArraySize)
|
||||
@@ -291,13 +283,13 @@ void HWR_RenderBatches(void)
|
||||
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
HWD.pfnSetShader(currentShader);
|
||||
GL_SetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = NULL;
|
||||
else
|
||||
HWD.pfnSetTexture(currentTexture);
|
||||
GL_SetTexture(currentTexture);
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
{
|
||||
@@ -393,7 +385,8 @@ void HWR_RenderBatches(void)
|
||||
currentSurfaceInfo.FadeColor.rgba != nextSurfaceInfo.FadeColor.rgba ||
|
||||
currentSurfaceInfo.LightInfo.light_level != nextSurfaceInfo.LightInfo.light_level ||
|
||||
currentSurfaceInfo.LightInfo.fade_start != nextSurfaceInfo.LightInfo.fade_start ||
|
||||
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end)
|
||||
currentSurfaceInfo.LightInfo.fade_end != nextSurfaceInfo.LightInfo.fade_end ||
|
||||
currentSurfaceInfo.LightInfo.directional != nextSurfaceInfo.LightInfo.directional)
|
||||
{
|
||||
changeState = true;
|
||||
changeSurfaceInfo = true;
|
||||
@@ -412,7 +405,7 @@ void HWR_RenderBatches(void)
|
||||
if (changeState || stopFlag)
|
||||
{
|
||||
// execute draw call
|
||||
HWD.pfnDrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
GL_DrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
// update stats
|
||||
ps_hw_numcalls.value.i++;
|
||||
ps_hw_numverts.value.i += finalIndexWritePos;
|
||||
@@ -430,7 +423,7 @@ void HWR_RenderBatches(void)
|
||||
{
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
GL_SetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
@@ -438,8 +431,8 @@ void HWR_RenderBatches(void)
|
||||
}
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
// texture should be already ready for use from calls to GL_SetTexture during batch collection
|
||||
GL_SetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
#include "hw_defs.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
|
||||
extern boolean currently_batching;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
+119
-102
@@ -14,9 +14,10 @@
|
||||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
#include "hw_batching.h"
|
||||
|
||||
#include "../doomstat.h" //gamemode
|
||||
@@ -54,10 +55,10 @@ static INT32 format2bpp(GLTextureFormat_t format)
|
||||
// It is now split from it for my sanity! (and the sanity of others)
|
||||
// -- Monster Iestyn (13/02/19)
|
||||
static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipmap_t *mipmap,
|
||||
INT32 pblockheight, INT32 blockmodulo,
|
||||
fixed_t yfracstep, fixed_t scale_y,
|
||||
texpatch_t *originPatch, INT32 patchheight,
|
||||
INT32 bpp, RGBA_t *palette)
|
||||
INT32 pblockheight, INT32 blockmodulo,
|
||||
fixed_t yfracstep, fixed_t scale_y,
|
||||
texpatch_t *originPatch, INT32 patchheight,
|
||||
INT32 bpp, RGBA_t *palette)
|
||||
{
|
||||
fixed_t yfrac, position, count;
|
||||
UINT8 *dest;
|
||||
@@ -73,6 +74,9 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
|
||||
(void)patchheight; // This parameter is unused
|
||||
|
||||
if (!mipmap)
|
||||
return;
|
||||
|
||||
if (originPatch) // originPatch can be NULL here, unlike in the software version
|
||||
originy = originPatch->originy;
|
||||
|
||||
@@ -108,14 +112,14 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
count--;
|
||||
|
||||
texel = source[yfrac>>FRACBITS];
|
||||
alpha = 0xff;
|
||||
alpha = 0xFF;
|
||||
|
||||
//Hurdler: not perfect, but better than holes
|
||||
if (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX && (mipmap->flags & TF_CHROMAKEYED))
|
||||
// Make pixel transparent if chroma keyed
|
||||
if ((mipmap && mipmap->flags & TF_CHROMAKEYED) && (texel == HWR_PATCHES_CHROMAKEY_COLORINDEX))
|
||||
alpha = 0x00;
|
||||
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
if (mipmap->colormap)
|
||||
if (mipmap && mipmap->colormap)
|
||||
texel = mipmap->colormap[texel];
|
||||
|
||||
// hope compiler will get this switch out of the loops (dreams...)
|
||||
@@ -123,7 +127,8 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
// Alam: SRB2 uses Mingw, HUGS
|
||||
switch (bpp)
|
||||
{
|
||||
case 2 : texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
case 2 : // uhhhhhhhh..........
|
||||
texelu16 = (UINT16)((alpha<<8) | texel);
|
||||
memcpy(dest, &texelu16, sizeof(UINT16));
|
||||
break;
|
||||
case 3 : colortemp = palette[texel];
|
||||
@@ -141,6 +146,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
|
||||
dest += blockmodulo;
|
||||
yfrac += yfracstep;
|
||||
}
|
||||
|
||||
patchcol = (const column_t *)((const UINT8 *)patchcol + patchcol->length + 4);
|
||||
}
|
||||
}
|
||||
@@ -182,6 +188,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawPatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
@@ -260,6 +267,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
if (bpp < 1 || bpp > 4)
|
||||
I_Error("HWR_DrawTexturePatchInCache: no drawer defined for this bpp (%d)\n",bpp);
|
||||
|
||||
// NOTE: should this actually be pblockwidth*bpp?
|
||||
blockmodulo = pblockwidth*bpp;
|
||||
|
||||
// Draw each column to the block cache
|
||||
@@ -311,7 +319,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
patch_t *realpatch;
|
||||
INT32 blockwidth, blockheight, blocksize;
|
||||
|
||||
INT32 i;
|
||||
INT32 i, idx;
|
||||
boolean skyspecial = false; //poor hack for Legacy large skies..
|
||||
|
||||
RGBA_t *palette;
|
||||
@@ -333,8 +341,8 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
else
|
||||
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
|
||||
gltex->mipmap.width = (UINT16)texture->width;
|
||||
gltex->mipmap.height = (UINT16)texture->height;
|
||||
gltex->mipmap.width = (UINT16)(texture->width);
|
||||
gltex->mipmap.height = (UINT16)(texture->height);
|
||||
|
||||
if (skyspecial)
|
||||
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
|
||||
@@ -359,14 +367,15 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
RGBA_t col;
|
||||
|
||||
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
|
||||
for (j = 0; j < blockheight; j++)
|
||||
|
||||
for (idx = 0, j = 0; j < blockheight; j++)
|
||||
{
|
||||
for (i = 0; i < blockwidth; i++)
|
||||
for (i = 0; i < blockwidth; i++, idx++)
|
||||
{
|
||||
block[4*(j*blockwidth+i)+0] = col.s.red;
|
||||
block[4*(j*blockwidth+i)+1] = col.s.green;
|
||||
block[4*(j*blockwidth+i)+2] = col.s.blue;
|
||||
block[4*(j*blockwidth+i)+3] = 0xff;
|
||||
block[4*idx+0] = col.s.red;
|
||||
block[4*idx+1] = col.s.green;
|
||||
block[4*idx+2] = col.s.blue;
|
||||
block[4*idx+3] = 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,15 +384,15 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
HWR_DrawTexturePatchInCache(&gltex->mipmap,
|
||||
blockwidth, blockheight,
|
||||
texture, patch,
|
||||
realpatch);
|
||||
Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED);
|
||||
if (realpatch != NULL)
|
||||
{
|
||||
HWR_DrawTexturePatchInCache(&gltex->mipmap, blockwidth, blockheight, texture, patch, realpatch);
|
||||
Z_ChangeTag(realpatch, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
}
|
||||
|
||||
//Hurdler: not efficient at all but I don't remember exactly how HWR_DrawPatchInCache works :(
|
||||
if (format2bpp(gltex->mipmap.format)==4)
|
||||
if (format2bpp(gltex->mipmap.format) == 4)
|
||||
{
|
||||
for (i = 3; i < blocksize*4; i += 4) // blocksize*4 because blocksize doesn't include the bpp
|
||||
{
|
||||
@@ -402,6 +411,16 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe
|
||||
// patch may be NULL if glMipmap has been initialised already and makebitmap is false
|
||||
void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap)
|
||||
{
|
||||
if (glMipmap == NULL)
|
||||
return;
|
||||
|
||||
if (patch == NULL || glPatch == NULL)
|
||||
{
|
||||
Z_Free(glMipmap->data);
|
||||
glMipmap->data = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
// don't do it twice (like a cache)
|
||||
if (glMipmap->width == 0)
|
||||
{
|
||||
@@ -413,14 +432,13 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo
|
||||
glPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
glPatch->topoffset = SHORT(patch->topoffset);
|
||||
|
||||
//glMipmap->width = (UINT16)SHORT(patch->width);
|
||||
//glMipmap->height = (UINT16)SHORT(patch->height);
|
||||
glMipmap->width = glMipmap->height = 1;
|
||||
while (glMipmap->width < glPatch->width) glMipmap->width <<= 1;
|
||||
while (glMipmap->height < glPatch->height) glMipmap->height <<= 1;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
glMipmap->flags = 0;
|
||||
|
||||
// setup the texture info
|
||||
glMipmap->format = patchformat;
|
||||
|
||||
@@ -435,13 +453,12 @@ void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, bo
|
||||
if (makebitmap)
|
||||
{
|
||||
MakeBlock(glMipmap);
|
||||
|
||||
HWR_DrawPatchInCache(glMipmap,
|
||||
glMipmap->width, glMipmap->height,
|
||||
glPatch->width, glPatch->height,
|
||||
patch);
|
||||
}
|
||||
|
||||
//glPatch->max_s = glPatch->max_t = 1.0f;
|
||||
}
|
||||
|
||||
// =================================================
|
||||
@@ -494,7 +511,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
if (next->data)
|
||||
Z_Free(next->data);
|
||||
next->data = NULL;
|
||||
HWD.pfnDeleteTexture(next);
|
||||
GL_DeleteTexture(next);
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
@@ -505,7 +522,7 @@ void HWR_FreeMipmapCache(void)
|
||||
{
|
||||
INT32 i;
|
||||
// free references to the textures
|
||||
HWD.pfnClearMipMapCache();
|
||||
GL_ClearMipMapCache();
|
||||
|
||||
// free all hardware-converted graphics cached in the heap
|
||||
// our gool is only the textures since user of the texture is the texture cache
|
||||
@@ -572,7 +589,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gltex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&gltex->mipmap);
|
||||
GL_SetTexture(&gltex->mipmap);
|
||||
HWR_SetCurrentTexture(&gltex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -623,8 +640,7 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
|
||||
glMipmap->height = (UINT16)pflatsize;
|
||||
|
||||
// the flat raw data needn't be converted with palettized textures
|
||||
W_ReadLump(flatlumpnum, Z_Malloc(W_LumpLength(flatlumpnum),
|
||||
PU_HWRCACHE, &glMipmap->data));
|
||||
W_ReadLump(flatlumpnum, Z_Malloc(size, PU_HWRCACHE, &glMipmap->data));
|
||||
|
||||
#ifdef GLENCORE
|
||||
flat = glMipmap->data;
|
||||
@@ -641,117 +657,117 @@ static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
|
||||
// Download a Doom 'flat' to the hardware cache and make it ready for use
|
||||
void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||
{
|
||||
GLMipmap_t *glmip;
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
if (flatlumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
glmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
|
||||
glmip->colormap = colormaps;
|
||||
glMipmap->colormap = colormaps;
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (!noencoremap && encoremap)
|
||||
glmip->colormap += COLORMAP_REMAPOFFSET;
|
||||
glMipmap->colormap += COLORMAP_REMAPOFFSET;
|
||||
#endif
|
||||
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
HWR_CacheFlat(glmip, flatlumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFlat(glMipmap, flatlumpnum);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glmip->downloaded)
|
||||
HWD.pfnSetTexture(glmip);
|
||||
HWR_SetCurrentTexture(glmip);
|
||||
if (!glMipmap->downloaded)
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
//
|
||||
// HWR_LoadMappedPatch(): replace the skin color of the sprite in cache
|
||||
// : load it first in doom cache if not already
|
||||
//
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *glmip, GLPatch_t *gpatch)
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
|
||||
{
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
{
|
||||
patch_t *patch = gpatch->rawpatch;
|
||||
patch_t *patch = glPatch->rawpatch;
|
||||
if (!patch)
|
||||
patch = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(patch, gpatch, glmip, true);
|
||||
patch = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(patch, glPatch, glMipmap, true);
|
||||
|
||||
// You can't free rawpatch for some reason?
|
||||
// (Obviously I can't, sprite rotation needs that...)
|
||||
|
||||
if (!gpatch->rawpatch)
|
||||
if (!glPatch->rawpatch)
|
||||
Z_Free(patch);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glmip->downloaded)
|
||||
HWD.pfnSetTexture(glmip);
|
||||
HWR_SetCurrentTexture(glmip);
|
||||
if (!glMipmap->downloaded)
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// HWR_GetPatch : Download a patch to the hardware cache and make it ready for use
|
||||
// HWR_GetPatch : Downloads a patch to the hardware cache and make it ready for use
|
||||
// -----------------+
|
||||
void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
void HWR_GetPatch(GLPatch_t *glPatch)
|
||||
{
|
||||
// is it in hardware cache
|
||||
if (!gpatch->mipmap->downloaded && !gpatch->mipmap->data)
|
||||
if (!glPatch->mipmap->downloaded && !glPatch->mipmap->data)
|
||||
{
|
||||
// load the software patch, PU_STATIC or the Z_Malloc for hardware patch will
|
||||
// flush the software patch before the conversion! oh yeah I suffered
|
||||
patch_t *ptr = gpatch->rawpatch;
|
||||
patch_t *ptr = glPatch->rawpatch;
|
||||
if (!ptr)
|
||||
ptr = W_CacheLumpNumPwad(gpatch->wadnum, gpatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, gpatch, gpatch->mipmap, true);
|
||||
ptr = W_CacheLumpNumPwad(glPatch->wadnum, glPatch->lumpnum, PU_STATIC);
|
||||
HWR_MakePatch(ptr, glPatch, glPatch->mipmap, true);
|
||||
|
||||
// this is inefficient.. but the hardware patch in heap is purgeable so it should
|
||||
// not fragment memory, and besides the REAL cache here is the hardware memory
|
||||
if (!gpatch->rawpatch)
|
||||
if (!glPatch->rawpatch)
|
||||
Z_Free(ptr);
|
||||
}
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gpatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
HWR_SetCurrentTexture(gpatch->mipmap);
|
||||
if (!glPatch->mipmap->downloaded)
|
||||
GL_SetTexture(glPatch->mipmap);
|
||||
HWR_SetCurrentTexture(glPatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -------------------+
|
||||
// HWR_GetMappedPatch : Same as HWR_GetPatch for sprite color
|
||||
// -------------------+
|
||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
void HWR_GetMappedPatch(GLPatch_t *glPatch, const UINT8 *colormap)
|
||||
{
|
||||
GLMipmap_t *glmip, *newmip;
|
||||
GLMipmap_t *glMipmap, *newMipmap;
|
||||
|
||||
// Blatant hack for encore colormapping aside...
|
||||
if (colormap == colormaps || colormap == NULL || colormap == (const UINT8*)(COLORMAP_REMAPOFFSET))
|
||||
{
|
||||
// Load the default (green) color in doom cache (temporary?) AND hardware cache
|
||||
HWR_GetPatch(gpatch);
|
||||
HWR_GetPatch(glPatch);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
|
||||
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
glmip = glmip->nextcolormap;
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (glmip->colormap != colormap)
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
HWR_LoadMappedPatch(glmip, gpatch);
|
||||
HWR_LoadMappedPatch(glMipmap, glPatch);
|
||||
return;
|
||||
}
|
||||
// not found, create it!
|
||||
@@ -761,38 +777,38 @@ void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap)
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
glmip->nextcolormap = newmip;
|
||||
glMipmap->nextcolormap = newMipmap;
|
||||
|
||||
newmip->colormap = colormap;
|
||||
HWR_LoadMappedPatch(newmip, gpatch);
|
||||
newMipmap->colormap = colormap;
|
||||
HWR_LoadMappedPatch(newMipmap, glPatch);
|
||||
}
|
||||
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch)
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *glPatch)
|
||||
{
|
||||
if (!gpatch)
|
||||
if (!glPatch)
|
||||
return;
|
||||
|
||||
Z_ChangeTag(gpatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glPatch->mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatchPwad(UINT16 wadnum, UINT16 lumpnum)
|
||||
{
|
||||
aatree_t *hwrcache = wadfiles[wadnum]->hwrcache;
|
||||
GLPatch_t *glpatch;
|
||||
GLPatch_t *glPatch;
|
||||
|
||||
if (!(glpatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
if (!(glPatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
{
|
||||
glpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
glpatch->wadnum = wadnum;
|
||||
glpatch->lumpnum = lumpnum;
|
||||
glpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, glpatch);
|
||||
glPatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
glPatch->wadnum = wadnum;
|
||||
glPatch->lumpnum = lumpnum;
|
||||
glPatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, glPatch);
|
||||
}
|
||||
|
||||
return glpatch;
|
||||
return glPatch;
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
|
||||
@@ -819,6 +835,7 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
|
||||
stepy = ((INT32)SHORT(fmheight)<<FRACBITS)/pblockheight;
|
||||
stepx = ((INT32)SHORT(fmwidth)<<FRACBITS)/pblockwidth;
|
||||
posy = 0;
|
||||
|
||||
for (j = 0; j < pblockheight; j++)
|
||||
{
|
||||
posx = 0;
|
||||
@@ -887,17 +904,17 @@ static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
|
||||
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
{
|
||||
GLMipmap_t *glmip;
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
glmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
HWR_CacheFadeMask(glmip, fademasklumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(glmip);
|
||||
GL_SetTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// =================================================
|
||||
@@ -927,11 +944,11 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
crushed_palette[i].s.blue = (UINT8)(fblue / 31.0f * 255.0f);
|
||||
crushed_palette[i].s.alpha = 255;
|
||||
}
|
||||
HWD.pfnSetScreenPalette(crushed_palette);
|
||||
GL_SetScreenPalette(crushed_palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetScreenPalette(palette);
|
||||
GL_SetScreenPalette(palette);
|
||||
}
|
||||
|
||||
// this part is responsible for keeping track of the palette OUTSIDE of a level.
|
||||
@@ -941,7 +958,7 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
else
|
||||
{
|
||||
// set the palette for the textures
|
||||
HWD.pfnSetTexturePalette(palette);
|
||||
GL_SetPalette(palette);
|
||||
// reset mapPalette so next call to HWR_SetMapPalette will update everything correctly
|
||||
memset(mapPalette, 0, sizeof(mapPalette));
|
||||
// hardware driver will flush there own cache if cache is non paletized
|
||||
@@ -974,7 +991,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
|
||||
}
|
||||
}
|
||||
#undef STEP_SIZE
|
||||
HWD.pfnSetPaletteLookup(lut);
|
||||
GL_SetPaletteLookup(lut);
|
||||
Z_Free(lut);
|
||||
}
|
||||
|
||||
@@ -1022,7 +1039,7 @@ void HWR_SetMapPalette(void)
|
||||
// in palette rendering mode, this means that all rgba textures now have wrong colors
|
||||
// and the lookup table is outdated
|
||||
HWR_SetPaletteLookup(mapPalette);
|
||||
HWD.pfnSetTexturePalette(mapPalette);
|
||||
GL_SetPalette(mapPalette);
|
||||
|
||||
if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
|
||||
{
|
||||
@@ -1045,7 +1062,7 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
|
||||
for (i = 0; i < 256 * 32; i++)
|
||||
hw_lighttable[i] = palette[lighttable[i]];
|
||||
|
||||
id = HWD.pfnCreateLightTable(hw_lighttable);
|
||||
id = GL_CreateLightTable(hw_lighttable);
|
||||
Z_Free(hw_lighttable);
|
||||
return id;
|
||||
}
|
||||
@@ -1081,7 +1098,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
|
||||
void HWR_ClearLightTables(void)
|
||||
{
|
||||
if (vid.glstate == VID_GL_LIBRARY_LOADED)
|
||||
HWD.pfnClearLightTables();
|
||||
GL_ClearLightTables();
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
@@ -333,11 +333,11 @@ angle_t gld_FrustumAngle(angle_t tiltangle)
|
||||
|
||||
// ok, this is a gross hack that barely works...
|
||||
// but at least it doesn't overestimate too much...
|
||||
clipfov = atan(1 / projMatrix[0]) * 360 / M_PI;
|
||||
clipfov = atan(1 / projMatrix[0]) * 360.0f / M_PIl;
|
||||
floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f;
|
||||
if (floatangle >= 180.0)
|
||||
return 0xffffffff;
|
||||
a1 = (angle_t)(ANG1 * (int)floatangle);
|
||||
a1 = (angle_t)xs_CRoundToInt(ANG1 * floatangle);
|
||||
return a1;
|
||||
}
|
||||
|
||||
@@ -458,4 +458,4 @@ boolean gld_SphereInFrustum(float x, float y, float z, float radius)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -33,16 +33,18 @@ typedef enum GLTextureFormat_e
|
||||
GL_TEXFMT_ALPHA_INTENSITY_88 = 0x22,
|
||||
} GLTextureFormat_t;
|
||||
|
||||
// data holds the address of the graphics data cached in heap memory
|
||||
// NULL if the texture is not in Doom heap cache.
|
||||
// Texture information (misleadingly named "mipmap" all over the code.)
|
||||
// The *data pointer holds the address of the graphics data cached in heap memory.
|
||||
// NULL if the texture is not in SRB2's heap cache.
|
||||
struct GLMipmap_s
|
||||
{
|
||||
// for UpdateTexture
|
||||
GLTextureFormat_t format;
|
||||
void *data;
|
||||
|
||||
UINT32 flags;
|
||||
UINT16 width, height;
|
||||
UINT32 downloaded; // tex_downloaded
|
||||
UINT32 downloaded; // The GPU has this texture.
|
||||
|
||||
struct GLMipmap_s *nextcolormap;
|
||||
const UINT8 *colormap;
|
||||
@@ -50,12 +52,12 @@ struct GLMipmap_s
|
||||
typedef struct GLMipmap_s GLMipmap_t;
|
||||
|
||||
//
|
||||
// Doom texture info, as cached for hardware rendering
|
||||
// Level textures, as cached for hardware rendering.
|
||||
//
|
||||
struct GLMapTexture_s
|
||||
{
|
||||
GLMipmap_t mipmap;
|
||||
float scaleX; //used for scaling textures on walls
|
||||
float scaleX; //used for scaling textures on walls
|
||||
float scaleY;
|
||||
};
|
||||
typedef struct GLMapTexture_s GLMapTexture_t;
|
||||
|
||||
+60
-34
@@ -121,38 +121,24 @@ typedef struct
|
||||
poly_t *planepoly; // the generated convex polygon
|
||||
} extrasubsector_t;
|
||||
|
||||
// Kart features
|
||||
#define USE_FTRANSFORM_ANGLEZ
|
||||
#define USE_FTRANSFORM_MIRROR
|
||||
|
||||
// Vanilla features
|
||||
//#define USE_MODEL_NEXTFRAME
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FLOAT x,y,z; // position
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
||||
FLOAT anglex2,anglez2; // secondaries
|
||||
#else
|
||||
FLOAT anglex,angley; // aimingangle / viewangle
|
||||
FLOAT anglex2; // secondaries
|
||||
#endif
|
||||
FLOAT scalex,scaley,scalez;
|
||||
FLOAT spritexscale,spriteyscale;
|
||||
FLOAT fovxangle, fovyangle;
|
||||
FLOAT anglex, angley, anglez; // aimingangle / viewangle
|
||||
FLOAT anglex2, anglez2; // secondaries
|
||||
FLOAT scalex, scaley, scalez;
|
||||
FLOAT fovangle;
|
||||
UINT8 splitscreen;
|
||||
boolean flip; // screenflip
|
||||
boolean roll;
|
||||
boolean rollmodel;
|
||||
SINT8 rollflip;
|
||||
FLOAT rollangle;
|
||||
UINT8 rotaxis;
|
||||
FLOAT centerx, centery;
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
FLOAT rollx, rollz;
|
||||
boolean mirror; // SRB2Kart: Encore Mode
|
||||
boolean mirrorflip; // Encore Mode with Flipcam
|
||||
#endif
|
||||
boolean shearing; // 14042019
|
||||
float viewaiming; // 17052019
|
||||
} FTransform;
|
||||
@@ -164,6 +150,41 @@ typedef struct
|
||||
FLOAT s,t;
|
||||
} FOutVector;
|
||||
|
||||
typedef struct vbo_vertex_s
|
||||
{
|
||||
float x, y, z;
|
||||
float u, v;
|
||||
unsigned char r, g, b, a;
|
||||
} gl_skyvertex_t;
|
||||
|
||||
typedef enum gl_skyloopmode_e
|
||||
{
|
||||
HWD_SKYLOOP_FAN,
|
||||
HWD_SKYLOOP_STRIP
|
||||
} gl_skyloopmode_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gl_skyloopmode_t mode;
|
||||
int vertexcount;
|
||||
int vertexindex;
|
||||
boolean use_texture;
|
||||
} gl_skyloopdef_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int vbo;
|
||||
int rows, columns;
|
||||
int loopcount;
|
||||
|
||||
int detail, vertex_count;
|
||||
int texture, width, height;
|
||||
boolean rebuild; // VBO needs to be rebuilt
|
||||
|
||||
gl_skyloopdef_t *loops;
|
||||
gl_skyvertex_t *data;
|
||||
} gl_sky_t;
|
||||
|
||||
// Shader targets used to render specific types of geometry.
|
||||
// A shader target is resolved to an actual shader with HWR_GetShaderFromTarget.
|
||||
// The shader returned may be a base shader or a custom shader.
|
||||
@@ -171,7 +192,6 @@ enum
|
||||
{
|
||||
SHADER_NONE = -1,
|
||||
SHADER_FLOOR = 0,
|
||||
SHADER_SHADOW,
|
||||
SHADER_WALL,
|
||||
SHADER_SPRITE,
|
||||
SHADER_MODEL,
|
||||
@@ -202,7 +222,6 @@ enum hwdshaderstage
|
||||
|
||||
typedef enum hwdshaderstage hwdshaderstage_t;
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// RENDER MODES
|
||||
// ==========================================================================
|
||||
@@ -213,22 +232,22 @@ enum EPolyFlags
|
||||
{
|
||||
// the first 5 are mutually exclusive
|
||||
|
||||
PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pels are discarded (holes in texture)
|
||||
PF_Masked = 0x00000001, // Poly is alpha scaled and 0 alpha pixels are discarded (holes in texture)
|
||||
PF_Translucent = 0x00000002, // Poly is transparent, alpha = level of transparency
|
||||
PF_Additive = 0x00000004, // Poly is added to the frame buffer
|
||||
PF_Environment = 0x00000008, // Poly should be drawn environment mapped.
|
||||
// Hurdler: used for text drawing
|
||||
PF_Substractive = 0x00000010, // for splat
|
||||
PF_NoAlphaTest = 0x00000020, // hiden param
|
||||
PF_Fog = 0x00000040, // Fog blocks
|
||||
PF_Blending = (PF_Environment|PF_Additive|PF_Translucent|PF_Masked|PF_Substractive|PF_Fog)&~PF_NoAlphaTest,
|
||||
PF_Environment = 0x00000004, // Poly should be drawn environment mapped. (Hurdler: used for text drawing)
|
||||
PF_Additive = 0x00000008, // Source blending factor is additive.
|
||||
PF_Subtractive = 0x00000010, // Subtractive color blending
|
||||
PF_ReverseSubtract = 0x00000020, // Reverse subtract, used in wall splats (decals)
|
||||
PF_Multiplicative = 0x00000040, // Multiplicative color blending
|
||||
PF_Fog = 0x20000000, // Fog blocks
|
||||
PF_NoAlphaTest = 0x40000000, // Disables alpha testing
|
||||
PF_Blending = (PF_Masked|PF_Translucent|PF_Environment|PF_Additive|PF_Subtractive|PF_ReverseSubtract|PF_Multiplicative|PF_Fog) & ~PF_NoAlphaTest,
|
||||
|
||||
// other flag bits
|
||||
|
||||
PF_Occlude = 0x00000100, // Update the depth buffer
|
||||
PF_NoDepthTest = 0x00000200, // Disable the depth test mode
|
||||
PF_Invisible = 0x00000400, // Disable write to color buffer
|
||||
PF_Decal = 0x00000800, // Enable polygon offset
|
||||
PF_Occlude = 0x00000100, // Updates the depth buffer
|
||||
PF_NoDepthTest = 0x00000200, // Disables the depth test mode
|
||||
PF_Invisible = 0x00000400, // Disables write to color buffer
|
||||
PF_Decal = 0x00000800, // Enables polygon offset
|
||||
PF_Modulated = 0x00001000, // Modulation (multiply output with constant RGBA)
|
||||
// When set, pass the color constant into the FSurfaceInfo -> FlatColor
|
||||
PF_NoTexture = 0x00002000, // Disable texture
|
||||
@@ -270,6 +289,7 @@ struct FLightInfo
|
||||
FUINT light_level;
|
||||
FUINT fade_start;
|
||||
FUINT fade_end;
|
||||
boolean directional;
|
||||
};
|
||||
typedef struct FLightInfo FLightInfo;
|
||||
|
||||
@@ -308,6 +328,11 @@ typedef enum hwdsetspecialstate hwdspecialstate_t;
|
||||
enum hwdshaderinfo
|
||||
{
|
||||
HWD_SHADERINFO_LEVELTIME = 1,
|
||||
HWD_SHADERINFO_LIGHT_X,
|
||||
HWD_SHADERINFO_LIGHT_Y,
|
||||
HWD_SHADERINFO_LIGHT_Z,
|
||||
HWD_SHADERINFO_LIGHT_CONTRAST,
|
||||
HWD_SHADERINFO_LIGHT_BACKLIGHT,
|
||||
};
|
||||
|
||||
typedef enum hwdshaderinfo hwdshaderinfo_t;
|
||||
@@ -341,6 +366,7 @@ enum hwdscreentexture
|
||||
HWD_SCREENTEXTURE_WIPE_END, // destination image for the wipe/fade effect
|
||||
HWD_SCREENTEXTURE_GENERIC1, // underwater/heat effect, intermission background
|
||||
HWD_SCREENTEXTURE_GENERIC2, // palette-based colormap fade, final screen texture
|
||||
HWD_SCREENTEXTURE_VHS,
|
||||
NUMSCREENTEXTURES, // (generic3 is unused if palette rendering is disabled)
|
||||
};
|
||||
typedef enum hwdscreentexture hwdscreentexture_t;
|
||||
|
||||
+133
-105
@@ -18,9 +18,10 @@
|
||||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
|
||||
#include "../m_misc.h" //FIL_WriteFile()
|
||||
#include "../r_draw.h" //viewborderlump
|
||||
@@ -61,6 +62,9 @@ static UINT8 softwaretranstogl[11] = { 0, 25, 51, 76,102,127,153,178,204,229
|
||||
static UINT8 softwaretranstogl_hi[11] = { 0, 51,102,153,204,255,255,255,255,255,255};
|
||||
static UINT8 softwaretranstogl_lo[11] = { 0, 12, 24, 36, 48, 60, 71, 83, 95,111,127};
|
||||
|
||||
static const float FLOATBASEVIDWIDTH = (float)BASEVIDWIDTH;
|
||||
static const float FLOATBASEVIDHEIGHT = (float)BASEVIDHEIGHT;
|
||||
|
||||
//
|
||||
// -----------------+
|
||||
// HWR_DrawPatch : Draw a 'tile' graphic
|
||||
@@ -122,16 +126,17 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||
flags |= PF_ForceWrapY;
|
||||
|
||||
// clip it since it is used for bunny scroll in doom I
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FBITFIELD flags;
|
||||
float cx = FIXED_TO_FLOAT(x);
|
||||
float cy = FIXED_TO_FLOAT(y);
|
||||
UINT8 alphalevel = ((option & V_ALPHAMASK) >> V_ALPHASHIFT);
|
||||
UINT8 blendmode = ((bflags & V_BLENDMASK) >> V_BLENDSHIFT);
|
||||
|
||||
// 3--2
|
||||
// | /|
|
||||
@@ -142,6 +147,9 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
if (alphalevel >= 10 && alphalevel < 13)
|
||||
return;
|
||||
|
||||
const float fvw = (float)vid.width;
|
||||
const float fvh = (float)vid.height;
|
||||
|
||||
// make patch ready in hardware cache
|
||||
if (!colormap)
|
||||
HWR_GetPatch(gpatch);
|
||||
@@ -225,21 +233,21 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
Z_Free(realpatch);
|
||||
}
|
||||
// centre screen
|
||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
if (fabsf(fvw - FLOATBASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
{
|
||||
if (option & V_SNAPTORIGHT)
|
||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
||||
else if (!(option & V_SNAPTOLEFT))
|
||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
|
||||
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2;
|
||||
}
|
||||
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||
{
|
||||
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
|
||||
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
|
||||
cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy));
|
||||
else if (option & V_SNAPTOBOTTOM)
|
||||
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
||||
else if (!(option & V_SNAPTOTOP))
|
||||
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/2;
|
||||
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,12 +264,12 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
}
|
||||
|
||||
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
|
||||
cx = -1 + (cx / (vid.width/2));
|
||||
cy = 1 - (cy / (vid.height/2));
|
||||
cx = -1.0f + (cx / (vid.width / 2.0f));
|
||||
cy = 1.0f - (cy / (vid.height / 2.0f));
|
||||
|
||||
// fwidth and fheight are similar
|
||||
fwidth /= vid.width / 2;
|
||||
fheight /= vid.height / 2;
|
||||
fwidth /= fvw / 2.0f;
|
||||
fheight /= fvh / 2.0f;
|
||||
|
||||
// set the polygon vertices to the right positions
|
||||
v[0].x = v[3].x = cx;
|
||||
@@ -286,7 +294,11 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
v[0].t = v[1].t = 0.0f;
|
||||
v[2].t = v[3].t = gpatch->max_t;
|
||||
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
// whoops
|
||||
if (blendmode)
|
||||
flags = HWR_GetBlendModeFlag(blendmode+1)|PF_NoDepthTest;
|
||||
else
|
||||
flags = PF_Translucent|PF_NoDepthTest;
|
||||
|
||||
if (option & V_WRAPX)
|
||||
flags |= PF_ForceWrapX;
|
||||
@@ -294,19 +306,22 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
flags |= PF_ForceWrapY;
|
||||
|
||||
// clip it since it is used for bunny scroll in doom I
|
||||
|
||||
if (alphalevel)
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||
|
||||
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans];
|
||||
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans];
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
|
||||
@@ -326,6 +341,9 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
if (alphalevel >= 10 && alphalevel < 13)
|
||||
return;
|
||||
|
||||
const float fvw = (float)vid.width;
|
||||
const float fvh = (float)vid.height;
|
||||
|
||||
// make patch ready in hardware cache
|
||||
HWR_GetPatch(gpatch);
|
||||
|
||||
@@ -376,21 +394,21 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
Z_Free(realpatch);
|
||||
}
|
||||
// centre screen
|
||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
if (fabsf(fvw - FLOATBASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
{
|
||||
if (option & V_SNAPTORIGHT)
|
||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
cx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
||||
else if (!(option & V_SNAPTOLEFT))
|
||||
cx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx))/2;
|
||||
cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2;
|
||||
}
|
||||
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||
{
|
||||
if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP))
|
||||
cy += ((float)vid.height/2 - ((float)BASEVIDHEIGHT/2 * dupy));
|
||||
cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy));
|
||||
else if (option & V_SNAPTOBOTTOM)
|
||||
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
||||
else if (!(option & V_SNAPTOTOP))
|
||||
cy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy))/2;
|
||||
cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -422,12 +440,12 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
}
|
||||
|
||||
// positions of the cx, cy, are between 0 and vid.width/vid.height now, we need them to be between -1 and 1
|
||||
cx = -1 + (cx / (vid.width/2));
|
||||
cy = 1 - (cy / (vid.height/2));
|
||||
cx = -1.0f + (cx / (vid.width / 2.0f));
|
||||
cy = 1.0f - (cy / (vid.height / 2.0f));
|
||||
|
||||
// fwidth and fheight are similar
|
||||
fwidth /= vid.width / 2;
|
||||
fheight /= vid.height / 2;
|
||||
fwidth /= fvw / 2.0f;
|
||||
fheight /= fvh / 2.0f;
|
||||
|
||||
// set the polygon vertices to the right positions
|
||||
v[0].x = v[3].x = cx;
|
||||
@@ -455,15 +473,17 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
{
|
||||
FSurfaceInfo Surf;
|
||||
Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff;
|
||||
|
||||
if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value];
|
||||
else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value];
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -539,7 +559,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||
// BTW, I see we put 0 for PFs, and If I'm right, that
|
||||
// means we take the previous PFs as default
|
||||
// how can we be sure they are ok?
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
GL_DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
}
|
||||
|
||||
|
||||
@@ -552,33 +572,33 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||
// 0--1
|
||||
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
{
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
FOutVector v[4];
|
||||
FSurfaceInfo Surf;
|
||||
FBITFIELD poly_flags = PF_NoTexture|PF_Modulated|PF_NoDepthTest;
|
||||
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = -1.0f;
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
v[0].x = v[3].x = -1.0f;
|
||||
v[2].x = v[1].x = 1.0f;
|
||||
v[0].y = v[1].y = -1.0f;
|
||||
v[2].y = v[3].y = 1.0f;
|
||||
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
|
||||
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
v[0].s = v[3].s = 0.0f;
|
||||
v[2].s = v[1].s = 1.0f;
|
||||
v[0].t = v[1].t = 1.0f;
|
||||
v[2].t = v[3].t = 0.0f;
|
||||
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (color & 0xFF00) // Do COLORMAP fade.
|
||||
{
|
||||
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
|
||||
{
|
||||
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
|
||||
|
||||
Surf.LightTableId = HWR_GetLightTableID(NULL);
|
||||
Surf.LightInfo.light_level = strength;
|
||||
HWD.pfnMakeScreenTexture(scr_tex);
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_MakeScreenTexture(scr_tex);
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
GL_UnSetShader();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -588,9 +608,9 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
Surf.PolyColor.s.alpha = (strength*8);
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
}
|
||||
else // Do TRANSMAP** fade.
|
||||
{
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
|
||||
|
||||
@@ -600,9 +620,9 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
|
||||
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
|
||||
GL_DrawPolygon(&Surf, v, 4, poly_flags);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
@@ -629,7 +649,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
|
||||
@@ -785,7 +805,7 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
||||
v2.x = ((float)fl->b.x-(vid.width/2.0f))*(2.0f/vid.width);
|
||||
v2.y = ((float)fl->b.y-(vid.height/2.0f))*(2.0f/vid.height);
|
||||
|
||||
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
|
||||
GL_Draw2DLine(&v1, &v2, color_rgba);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -810,6 +830,9 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
fy = (float)y;
|
||||
fw = fh = (float)wh;
|
||||
|
||||
const float fvw = (float)vid.width;
|
||||
const float fvh = (float)vid.height;
|
||||
|
||||
if (!(color & V_NOSCALESTART))
|
||||
{
|
||||
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
|
||||
@@ -819,20 +842,20 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
fw *= dupx;
|
||||
fh *= dupy;
|
||||
|
||||
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
|
||||
if (fabsf(fvw - (FLOATBASEVIDWIDTH * dupx)) > 1.0E-36f)
|
||||
{
|
||||
if (color & V_SNAPTORIGHT)
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
||||
else if (!(color & V_SNAPTOLEFT))
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
||||
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
|
||||
}
|
||||
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
||||
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
||||
{
|
||||
// same thing here
|
||||
if (color & V_SNAPTOBOTTOM)
|
||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
||||
else if (!(color & V_SNAPTOTOP))
|
||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
|
||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -853,16 +876,16 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
return;
|
||||
if (fx + fw > vid.width)
|
||||
{
|
||||
fwait = fw - ((float)vid.width - fx);
|
||||
fw = (float)vid.width - fx;
|
||||
fwait = fw - (fvw- fx);
|
||||
fw = fvw - fx;
|
||||
}
|
||||
if (fy + fh > vid.height)
|
||||
fh = (float)vid.height - fy;
|
||||
fh = fvh - fy;
|
||||
|
||||
fx = -1 + fx / (vid.width / 2);
|
||||
fy = 1 - fy / (vid.height / 2);
|
||||
fw = fw / (vid.width / 2);
|
||||
fh = fh / (vid.height / 2);
|
||||
fx = -1.0f + fx / (vid.width / 2.0f);
|
||||
fy = 1.0f - fy / (vid.height / 2.0f);
|
||||
fw = fw / (fvw / 2.0f);
|
||||
fh = fh / (fvh / 2.0f);
|
||||
|
||||
v[0].x = v[3].x = fx;
|
||||
v[2].x = v[1].x = fx + fw;
|
||||
@@ -879,7 +902,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
|
||||
Surf.PolyColor = palette[color&0xFF];
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
GL_DrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
@@ -906,6 +929,9 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
fw = (float)w;
|
||||
fh = (float)h;
|
||||
|
||||
const float fvw = (float)vid.width;
|
||||
const float fvh = (float)vid.height;
|
||||
|
||||
if (!(options & V_NOSCALESTART))
|
||||
{
|
||||
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
|
||||
@@ -918,7 +944,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, false, &clearColour);
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -927,25 +953,25 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
fw *= dupx;
|
||||
fh *= dupy;
|
||||
|
||||
if (fabsf((float)vid.width - ((float)BASEVIDWIDTH * dupx)) > 1.0E-36f)
|
||||
if (fabsf(fvw - (FLOATBASEVIDWIDTH * dupx)) > 1.0E-36f)
|
||||
{
|
||||
if (options & V_SNAPTORIGHT)
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
||||
else if (!(options & V_SNAPTOLEFT))
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
||||
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
|
||||
}
|
||||
if (fabsf((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
||||
if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f)
|
||||
{
|
||||
// same thing here
|
||||
if (options & V_SNAPTOBOTTOM)
|
||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
||||
else if (!(options & V_SNAPTOTOP))
|
||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
|
||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
|
||||
}
|
||||
if (options & V_SPLITSCREEN)
|
||||
fy += ((float)BASEVIDHEIGHT * dupy)/2;
|
||||
fy += (FLOATBASEVIDHEIGHT * dupy)/2;
|
||||
if (options & V_HORZSCREEN)
|
||||
fx += ((float)BASEVIDWIDTH * dupx)/2;
|
||||
fx += (FLOATBASEVIDWIDTH * dupx)/2;
|
||||
|
||||
}
|
||||
|
||||
@@ -965,14 +991,14 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
if (fw <= 0 || fh <= 0)
|
||||
return;
|
||||
if (fx + fw > vid.width)
|
||||
fw = (float)vid.width - fx;
|
||||
fw = fvw - fx;
|
||||
if (fy + fh > vid.height)
|
||||
fh = (float)vid.height - fy;
|
||||
fh = fvh - fy;
|
||||
|
||||
fx = -1 + fx / (vid.width / 2);
|
||||
fy = 1 - fy / (vid.height / 2);
|
||||
fw = fw / (vid.width / 2);
|
||||
fh = fh / (vid.height / 2);
|
||||
fx = -1.0f + fx / (vid.width / 2.0f);
|
||||
fy = 1.0f - fy / (vid.height / 2.0f);
|
||||
fw = fw / (fvw / 2.0f);
|
||||
fh = fh / (fvh / 2.0f);
|
||||
|
||||
v[0].x = v[3].x = fx;
|
||||
v[2].x = v[1].x = fx + fw;
|
||||
@@ -989,7 +1015,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -1017,6 +1043,9 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
fw = (float)w;
|
||||
fh = (float)h;
|
||||
|
||||
const float fvw = (float)vid.width;
|
||||
const float fvh = (float)vid.height;
|
||||
|
||||
if (!(color & V_NOSCALESTART))
|
||||
{
|
||||
float dupx = (float)vid.dupx, dupy = (float)vid.dupy;
|
||||
@@ -1029,7 +1058,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, false, &clearColour);
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1038,26 +1067,25 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
fw *= dupx;
|
||||
fh *= dupy;
|
||||
|
||||
if (fabsf((float)vid.width - (float)BASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
if (fabsf(fvw - FLOATBASEVIDWIDTH * dupx) > 1.0E-36f)
|
||||
{
|
||||
if (color & V_SNAPTORIGHT)
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx));
|
||||
fx += (fvw - (FLOATBASEVIDWIDTH * dupx));
|
||||
else if (!(color & V_SNAPTOLEFT))
|
||||
fx += ((float)vid.width - ((float)BASEVIDWIDTH * dupx)) / 2;
|
||||
fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2;
|
||||
}
|
||||
if (fabsf((float)vid.height - (float)BASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||
if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f)
|
||||
{
|
||||
// same thing here
|
||||
if (color & V_SNAPTOBOTTOM)
|
||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy));
|
||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy));
|
||||
else if (!(color & V_SNAPTOTOP))
|
||||
fy += ((float)vid.height - ((float)BASEVIDHEIGHT * dupy)) / 2;
|
||||
fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2;
|
||||
}
|
||||
if (color & V_SPLITSCREEN)
|
||||
fy += ((float)BASEVIDHEIGHT * dupy)/2;
|
||||
fy += (FLOATBASEVIDHEIGHT * dupy)/2;
|
||||
if (color & V_HORZSCREEN)
|
||||
fx += ((float)BASEVIDWIDTH * dupx)/2;
|
||||
|
||||
fx += (FLOATBASEVIDWIDTH * dupx)/2;
|
||||
}
|
||||
|
||||
if (fx >= vid.width || fy >= vid.height)
|
||||
@@ -1076,14 +1104,14 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
if (fw <= 0 || fh <= 0)
|
||||
return;
|
||||
if (fx + fw > vid.width)
|
||||
fw = (float)vid.width - fx;
|
||||
fw = fvw - fx;
|
||||
if (fy + fh > vid.height)
|
||||
fh = (float)vid.height - fy;
|
||||
fh = fvh - fy;
|
||||
|
||||
fx = -1 + fx / (vid.width / 2);
|
||||
fy = 1 - fy / (vid.height / 2);
|
||||
fw = fw / (vid.width / 2);
|
||||
fh = fh / (vid.height / 2);
|
||||
fx = -1.0f + fx / (vid.width / 2.0f);
|
||||
fy = 1.0f - fy / (vid.height / 2.0f);
|
||||
fw = fw / (fvw / 2.0f);
|
||||
fh = fh / (fvh / 2.0f);
|
||||
|
||||
v[0].x = v[3].x = fx;
|
||||
v[2].x = v[1].x = fx + fw;
|
||||
@@ -1107,7 +1135,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
@@ -1126,7 +1154,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
#define _FILE_OFFSET_BITS 0
|
||||
#endif
|
||||
|
||||
#include "png.h"
|
||||
#include "png.h"
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
#define USE_PNG // PNG is only used if write is supported (see ../m_misc.c)
|
||||
#endif
|
||||
@@ -1191,7 +1219,7 @@ UINT8 *HWR_GetScreenshot(void)
|
||||
return NULL;
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1235,7 @@ boolean HWR_Screenshot(const char *pathname)
|
||||
}
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
|
||||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief imports/exports for the GPU hardware low-level interface API
|
||||
|
||||
#ifndef __HWR_DRV_H__
|
||||
#define __HWR_DRV_H__
|
||||
|
||||
// this must be here 19991024 by Kin
|
||||
#include "../screen.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#include "hw_dll.h"
|
||||
#include "../doomdef.h"
|
||||
|
||||
// ==========================================================================
|
||||
// STANDARD DLL EXPORTS
|
||||
// ==========================================================================
|
||||
|
||||
EXPORT boolean HWRAPI(Init) (void);
|
||||
EXPORT void HWRAPI(SetupGLInfo) (void);
|
||||
EXPORT void HWRAPI(SetTexturePalette) (RGBA_t *ppal);
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data);
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||
|
||||
//Hurdler: added for backward compatibility
|
||||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||
|
||||
//Hurdler: added for new development
|
||||
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||
|
||||
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
|
||||
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
|
||||
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
|
||||
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
|
||||
#define SCREENVERTS 10
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
// jimita
|
||||
EXPORT boolean HWRAPI(InitShaders) (void);
|
||||
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage);
|
||||
EXPORT boolean HWRAPI(CompileShader) (int slot);
|
||||
EXPORT void HWRAPI(SetShader) (int slot);
|
||||
EXPORT void HWRAPI(UnSetShader) (void);
|
||||
|
||||
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut);
|
||||
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable);
|
||||
EXPORT void HWRAPI(ClearLightTables)(void);
|
||||
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette);
|
||||
|
||||
// ==========================================================================
|
||||
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
|
||||
// ==========================================================================
|
||||
|
||||
#if !defined (_CREATE_DLL_)
|
||||
|
||||
struct hwdriver_s
|
||||
{
|
||||
Init pfnInit;
|
||||
SetupGLInfo pfnSetupGLInfo;
|
||||
SetTexturePalette pfnSetTexturePalette;
|
||||
FinishUpdate pfnFinishUpdate;
|
||||
Draw2DLine pfnDraw2DLine;
|
||||
DrawPolygon pfnDrawPolygon;
|
||||
DrawIndexedTriangles pfnDrawIndexedTriangles;
|
||||
SetBlend pfnSetBlend;
|
||||
ClearBuffer pfnClearBuffer;
|
||||
SetTexture pfnSetTexture;
|
||||
UpdateTexture pfnUpdateTexture;
|
||||
DeleteTexture pfnDeleteTexture;
|
||||
ReadScreenTexture pfnReadScreenTexture;
|
||||
GClipRect pfnGClipRect;
|
||||
ClearMipMapCache pfnClearMipMapCache;
|
||||
SetSpecialState pfnSetSpecialState;
|
||||
DrawModel pfnDrawModel;
|
||||
CreateModelVBOs pfnCreateModelVBOs;
|
||||
SetTransform pfnSetTransform;
|
||||
GetTextureUsed pfnGetTextureUsed;
|
||||
PostImgRedraw pfnPostImgRedraw;
|
||||
FlushScreenTextures pfnFlushScreenTextures;
|
||||
DoScreenWipe pfnDoScreenWipe;
|
||||
DrawScreenTexture pfnDrawScreenTexture;
|
||||
MakeScreenTexture pfnMakeScreenTexture;
|
||||
RenderVhsEffect pfnRenderVhsEffect;
|
||||
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
|
||||
|
||||
RenderSkyDome pfnRenderSkyDome;
|
||||
|
||||
InitShaders pfnInitShaders;
|
||||
LoadShader pfnLoadShader;
|
||||
CompileShader pfnCompileShader;
|
||||
SetShader pfnSetShader;
|
||||
UnSetShader pfnUnSetShader;
|
||||
|
||||
SetShaderInfo pfnSetShaderInfo;
|
||||
|
||||
SetPaletteLookup pfnSetPaletteLookup;
|
||||
CreateLightTable pfnCreateLightTable;
|
||||
ClearLightTables pfnClearLightTables;
|
||||
SetScreenPalette pfnSetScreenPalette;
|
||||
};
|
||||
|
||||
extern struct hwdriver_s hwdriver;
|
||||
|
||||
#define HWD hwdriver
|
||||
|
||||
#endif //not defined _CREATE_DLL_
|
||||
|
||||
#endif //__HWR_DRV_H__
|
||||
@@ -0,0 +1,79 @@
|
||||
// SONIC ROBO BLAST 2 Kart
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_gl.h
|
||||
/// \brief OpenGL low-level interface API
|
||||
|
||||
#ifndef __HWR_GL_H__
|
||||
#define __HWR_GL_H__
|
||||
|
||||
#include "../screen.h"
|
||||
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#define SCREENVERTS 10
|
||||
|
||||
boolean GL_Init(void);
|
||||
void GL_FinishUpdate(INT32 waitvbl);
|
||||
void SetupGLInfo(void);
|
||||
|
||||
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
|
||||
void GL_SetTransform(FTransform *stransform);
|
||||
void GL_SetBlend(FBITFIELD PolyFlags);
|
||||
void GL_SetPalette(RGBA_t *palette);
|
||||
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
|
||||
|
||||
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
void GL_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
|
||||
void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
#define GL_DrawModel(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface) GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface)
|
||||
|
||||
void GL_RenderSkyDome(gl_sky_t *sky);
|
||||
|
||||
void GL_SetTexture(GLMipmap_t *pTexInfo);
|
||||
void GL_DeleteTexture(GLMipmap_t *pTexInfo);
|
||||
|
||||
void GL_Flush(void);
|
||||
#define GL_ClearMipMapCache GL_Flush
|
||||
|
||||
INT32 GL_GetTextureUsed(void);
|
||||
|
||||
void GL_CreateModelVBOs(model_t *model);
|
||||
|
||||
void GL_ReadScreenTexture(int tex, UINT16 *dst_data);
|
||||
void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
|
||||
void GL_MakeScreenTexture(int tex);
|
||||
void GL_FlushScreenTextures(void);
|
||||
|
||||
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
void GL_DoScreenWipe(int wipeStart, int wipeEnd);
|
||||
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
boolean GL_InitShaders(void);
|
||||
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage);
|
||||
boolean GL_CompileShader(int slot);
|
||||
void GL_SetShader(int slot);
|
||||
void GL_UnSetShader(void);
|
||||
|
||||
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
void GL_SetPaletteLookup(UINT8 *lut);
|
||||
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable);
|
||||
void GL_ClearLightTables(void);
|
||||
void GL_SetScreenPalette(RGBA_t *palette);
|
||||
|
||||
#endif // __HWR_GL_H__
|
||||
@@ -43,6 +43,8 @@ typedef struct gl_vissprite_s
|
||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||
} gl_vissprite_t;
|
||||
|
||||
void HWR_ObjectLightLevelPost(gl_vissprite_t *spr, const sector_t *sector, INT32 *lightlevel, boolean model);
|
||||
|
||||
// --------
|
||||
// hw_bsp.c
|
||||
// --------
|
||||
|
||||
+882
-519
File diff suppressed because it is too large.
Load diff
+67
-23
@@ -20,6 +20,7 @@
|
||||
#ifndef __HWR_MAIN_H__
|
||||
#define __HWR_MAIN_H__
|
||||
|
||||
#include "hw_gl.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
@@ -29,6 +30,7 @@
|
||||
#include "../d_player.h"
|
||||
#include "../r_defs.h"
|
||||
#include "../m_perfstats.h"
|
||||
#include "../v_video.h"
|
||||
|
||||
#define GLENCORE
|
||||
|
||||
@@ -56,11 +58,11 @@ extern sector_t *gl_backsector;
|
||||
|
||||
enum
|
||||
{
|
||||
HWR_STENCIL_NORMAL,
|
||||
HWR_STENCIL_BEGIN,
|
||||
HWR_STENCIL_REVERSE,
|
||||
HWR_STENCIL_DEPTH,
|
||||
HWR_STENCIL_SKY
|
||||
HWR_STENCIL_NORMAL,
|
||||
HWR_STENCIL_BEGIN,
|
||||
HWR_STENCIL_REVERSE,
|
||||
HWR_STENCIL_DEPTH,
|
||||
HWR_STENCIL_SKY
|
||||
};
|
||||
|
||||
// Performance stats
|
||||
@@ -84,7 +86,7 @@ extern boolean gl_shadersavailable;
|
||||
|
||||
// hw_draw.c
|
||||
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap);
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap, INT32 bflags);
|
||||
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h);
|
||||
void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color);
|
||||
void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 options); // Lat: separate flags from color since color needs to be an uint to work right.
|
||||
@@ -102,36 +104,65 @@ boolean HWR_Screenshot(const char *lbmname);
|
||||
void HWR_SetViewSize(void);
|
||||
void HWR_AddCommands(void);
|
||||
|
||||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
||||
void HWR_RenderPlayerView(void);
|
||||
void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
|
||||
|
||||
void HWR_SetTransform(float fpov, player_t *player);
|
||||
void HWR_ClearSkyDome(void);
|
||||
void HWR_BuildSkyDome(void);
|
||||
|
||||
void HWR_SetTransform(float fpov);
|
||||
void HWR_ClearClipper(void);
|
||||
void HWR_SetStencilState(int state, int level);
|
||||
|
||||
boolean HWR_UseShader(void);
|
||||
boolean HWR_ShouldUsePaletteRendering(void);
|
||||
boolean HWR_PalRenderFlashpal(void);
|
||||
|
||||
// My original intention was to split hw_main.c
|
||||
// into files like hw_bsp.c, hw_sprites.c...
|
||||
|
||||
// hw_main.c: Lighting and fog
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap);
|
||||
void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *colormap, const boolean directional);
|
||||
|
||||
UINT8 HWR_GetTranstableAlpha(INT32 transtablenum);
|
||||
FBITFIELD HWR_GetBlendModeFlag(INT32 ast);
|
||||
FBITFIELD HWR_SurfaceBlend(INT32 style, INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
|
||||
// Get amount of memory used by gpu textures in bytes
|
||||
INT32 HWR_GetTextureUsed(void);
|
||||
// Get amount of memory used by gpu textures in bytes;
|
||||
FUNCINLINE static ATTRINLINE INT32 HWR_GetTextureUsed(void)
|
||||
{
|
||||
return GL_GetTextureUsed();
|
||||
}
|
||||
|
||||
// hw_main.c: Post-rendering
|
||||
void HWR_StartScreenWipe(void);
|
||||
void HWR_EndScreenWipe(void);
|
||||
void HWR_DrawIntermissionBG(void);
|
||||
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum);
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void HWR_MakeScreenFinalTexture(void);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height);
|
||||
|
||||
FUNCINLINE static ATTRINLINE void HWR_StartScreenWipe(void)
|
||||
{
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void HWR_EndScreenWipe(void)
|
||||
{
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void HWR_DrawIntermissionBG(void)
|
||||
{
|
||||
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void HWR_MakeScreenFinalTexture(void)
|
||||
{
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
|
||||
}
|
||||
|
||||
// hw_main.c: Segs
|
||||
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
|
||||
@@ -178,10 +209,23 @@ extern consvar_t cv_glrenderdistance;
|
||||
extern consvar_t cv_glhorizonlines;
|
||||
extern consvar_t cv_glportals;
|
||||
|
||||
extern consvar_t cv_glfovchange;
|
||||
|
||||
extern consvar_t cv_glpaletterendering;
|
||||
extern consvar_t cv_glpalettedepth;
|
||||
extern consvar_t cv_glflashpal;
|
||||
|
||||
FUNCINLINE static ATTRINLINE boolean HWR_UseShader(void)
|
||||
{
|
||||
return (cv_glshaders.value && gl_shadersavailable);
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE boolean HWR_ShouldUsePaletteRendering(void)
|
||||
{
|
||||
return (cv_glpaletterendering.value && (pLocalPalette != NULL) && HWR_UseShader());
|
||||
}
|
||||
|
||||
FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void)
|
||||
{
|
||||
return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value);
|
||||
}
|
||||
|
||||
#endif
|
||||
+99
-134
@@ -25,12 +25,14 @@
|
||||
#include "../doomstat.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_drv.h"
|
||||
|
||||
#include "hw_gl.h"
|
||||
#include "hw_md2.h"
|
||||
#include "../d_main.h"
|
||||
#include "../r_bsp.h"
|
||||
#include "../r_fps.h"
|
||||
#include "../r_main.h"
|
||||
#include "../p_setup.h"
|
||||
#include "../m_misc.h"
|
||||
#include "../w_wad.h"
|
||||
#include "../z_zone.h"
|
||||
@@ -43,8 +45,8 @@
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "../v_video.h"
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
@@ -417,7 +419,7 @@ static void md2_loadTexture(md2_t *model)
|
||||
}
|
||||
}
|
||||
}
|
||||
HWD.pfnSetTexture(glpatch->mipmap);
|
||||
GL_SetTexture(glpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
}
|
||||
|
||||
@@ -467,7 +469,7 @@ static void md2_loadBlendTexture(md2_t *model)
|
||||
glpatch->mipmap->width = (UINT16)w;
|
||||
glpatch->mipmap->height = (UINT16)h;
|
||||
}
|
||||
HWD.pfnSetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
GL_SetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
|
||||
Z_Free(filename);
|
||||
@@ -680,7 +682,7 @@ spritemd2found:
|
||||
#define SETBRIGHTNESS(brightness,r,g,b) \
|
||||
brightness = (UINT8)(((1063*(UINT32)(r))/5000) + ((3576*(UINT32)(g))/5000) + ((361*(UINT32)(b))/5000))
|
||||
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glmip, INT32 skinnum, skincolors_t color)
|
||||
static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, GLMipmap_t *glMipmap, INT32 skinnum, skincolors_t color)
|
||||
{
|
||||
UINT16 w = gpatch->width, h = gpatch->height;
|
||||
UINT32 size = w*h;
|
||||
@@ -696,24 +698,24 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
||||
memset(translation, 0, sizeof(translation));
|
||||
memset(cutoff, 0, sizeof(cutoff));
|
||||
|
||||
if (glmip->width == 0)
|
||||
if (glMipmap->width == 0)
|
||||
{
|
||||
glmip->width = gpatch->width;
|
||||
glmip->height = gpatch->height;
|
||||
glMipmap->width = gpatch->width;
|
||||
glMipmap->height = gpatch->height;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
glmip->flags = 0;
|
||||
glMipmap->flags = 0;
|
||||
// setup the texture info
|
||||
glmip->format = GL_TEXFMT_RGBA;
|
||||
glMipmap->format = GL_TEXFMT_RGBA;
|
||||
}
|
||||
|
||||
if (glmip->data)
|
||||
if (glMipmap->data)
|
||||
{
|
||||
Z_Free(glmip->data);
|
||||
glmip->data = NULL;
|
||||
Z_Free(glMipmap->data);
|
||||
glMipmap->data = NULL;
|
||||
}
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &glmip->data);
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &glMipmap->data);
|
||||
memset(cur, 0x00, size*4);
|
||||
|
||||
image = gpatch->mipmap->data;
|
||||
@@ -794,10 +796,9 @@ static void HWR_CreateBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (translen > 0)
|
||||
colorbrightnesses[translen] = colorbrightnesses[translen-1];
|
||||
}
|
||||
|
||||
while (size--)
|
||||
{
|
||||
@@ -1044,28 +1045,29 @@ skippixel:
|
||||
static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT32 skinnum, const UINT8 *colormap, skincolors_t color)
|
||||
{
|
||||
// mostly copied from HWR_GetMappedPatch, hence the similarities and comment
|
||||
GLMipmap_t *glmip, *newmip;
|
||||
GLMipmap_t *glMipmap, *newMipmap;
|
||||
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GL_SetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the mimmap
|
||||
// search for the Mipmap
|
||||
// skip the first (no colormap translated)
|
||||
for (glmip = gpatch->mipmap; glmip->nextcolormap; )
|
||||
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
glmip = glmip->nextcolormap;
|
||||
if (glmip->colormap == colormap)
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
if (glMipmap->downloaded && glMipmap->data)
|
||||
{
|
||||
if (glmip->downloaded && glmip->data)
|
||||
{
|
||||
HWD.pfnSetTexture(glmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
GL_SetTexture(glMipmap); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1076,19 +1078,18 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
// (it have a liste of mipmap)
|
||||
// this malloc is cleared in HWR_FreeTextureCache
|
||||
// (...) unfortunately z_malloc fragment alot the memory :(so malloc is better
|
||||
newmip = calloc(1, sizeof (*newmip));
|
||||
if (newmip == NULL)
|
||||
newMipmap = calloc(1, sizeof (*newMipmap));
|
||||
if (newMipmap == NULL)
|
||||
I_Error("%s: Out of memory", "HWR_GetMappedPatch");
|
||||
glmip->nextcolormap = newmip;
|
||||
newmip->colormap = colormap;
|
||||
glMipmap->nextcolormap = newMipmap;
|
||||
newMipmap->colormap = colormap;
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newMipmap, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
Z_ChangeTag(newmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
GL_SetTexture(newMipmap);
|
||||
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// HWR_DrawMD2 : Draw MD2
|
||||
// :
|
||||
@@ -1119,7 +1120,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
{
|
||||
sector_t *sector = spr->mobj->subsector->sector;
|
||||
extracolormap_t *colormap = sector->extra_colormap;
|
||||
UINT8 lightlevel = 255;
|
||||
INT32 lightlevel = 255;
|
||||
|
||||
if (sector->numlights)
|
||||
{
|
||||
@@ -1142,7 +1143,9 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
colormap = sector->extra_colormap;
|
||||
}
|
||||
|
||||
HWR_Lighting(&Surf, lightlevel, colormap);
|
||||
HWR_ObjectLightLevelPost(spr, sector, &lightlevel, true);
|
||||
|
||||
HWR_Lighting(&Surf, lightlevel, colormap, P_SectorUsesDirectionalLighting(sector) && !(spr->mobj->frame & FF_FULLBRIGHT));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1160,8 +1163,6 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
spritedef_t *sprdef;
|
||||
spriteframe_t *sprframe;
|
||||
spriteinfo_t *sprinfo;
|
||||
INT32 rollfactor = 0;
|
||||
angle_t ang;
|
||||
interpmobjstate_t interp;
|
||||
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_maxinterpdist.value))
|
||||
@@ -1178,13 +1179,31 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
// Apparently people don't like jump frames like that, so back it goes
|
||||
//if (tics > durs)
|
||||
//durs = tics;
|
||||
|
||||
INT32 blendmode;
|
||||
if (spr->mobj->frame & FF_BLENDMASK)
|
||||
blendmode = ((spr->mobj->frame & FF_BLENDMASK) >> FF_BLENDSHIFT) + 1;
|
||||
else
|
||||
blendmode = spr->mobj->blendmode;
|
||||
|
||||
blendmode = min(AST_MODULATE, blendmode);
|
||||
|
||||
if (spr->mobj->flags2 & MF2_SHADOW)
|
||||
{
|
||||
Surf.PolyColor.s.alpha = 0x40;
|
||||
Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode);
|
||||
}
|
||||
else if (spr->mobj->frame & FF_TRANSMASK)
|
||||
{
|
||||
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
Surf.PolyFlags = HWR_SurfaceBlend(blendmode, (spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
|
||||
}
|
||||
else
|
||||
Surf.PolyColor.s.alpha = 0xFF;
|
||||
{
|
||||
// this hack is dumb, but the blendmodes refuse to work otherwise
|
||||
Surf.PolyColor.s.alpha = (blendmode == AST_TRANSLUCENT) ? 0xFF : 0xFE;
|
||||
Surf.PolyFlags = HWR_GetBlendModeFlag(blendmode);
|
||||
}
|
||||
|
||||
// dont forget to enabled the depth test because we can't do this like
|
||||
// before: polygons models are not sorted
|
||||
@@ -1234,7 +1253,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
if (md2->model)
|
||||
{
|
||||
md2_printModelInfo(md2->model);
|
||||
HWD.pfnCreateModelVBOs(md2->model);
|
||||
GL_CreateModelVBOs(md2->model);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1289,7 +1308,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
else
|
||||
{
|
||||
// This is safe, since we know the texture has been downloaded
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GL_SetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1340,7 +1359,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
p.x = FIXED_TO_FLOAT(interp.x);
|
||||
p.y = FIXED_TO_FLOAT(interp.y)+md2->offset;
|
||||
|
||||
if (spr->mobj->eflags & MFE_VERTICALFLIP)
|
||||
if (flip)
|
||||
p.z = FIXED_TO_FLOAT(interp.z + spr->mobj->height);
|
||||
else
|
||||
p.z = FIXED_TO_FLOAT(interp.z);
|
||||
@@ -1363,112 +1382,58 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
const fixed_t anglef = AngleFixed((R_PointToAngle(interp.x, interp.y))-ANGLE_180);
|
||||
p.angley = FIXED_TO_FLOAT(anglef);
|
||||
}
|
||||
|
||||
p.rollangle = 0.0f;
|
||||
p.rollflip = 1;
|
||||
p.rotaxis = 0;
|
||||
|
||||
p.spritexscale = FIXED_TO_FLOAT(spr->mobj->spritexscale);
|
||||
p.spriteyscale = FIXED_TO_FLOAT(spr->mobj->spriteyscale);
|
||||
|
||||
angle_t sliptideroll = 0;
|
||||
|
||||
if (spr->mobj->player)
|
||||
sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value) ? spr->mobj->player->sliproll : 0);
|
||||
const angle_t sliptideroll = ((cv_sliptideroll.value && spr->mobj->player) ? spr->mobj->player->sliproll : 0);
|
||||
const SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
if ((spr->mobj->rollangle)||(sliptideroll && cv_sliptideroll.value))
|
||||
if (spr->mobj->rollangle || sliptideroll)
|
||||
{
|
||||
angle_t rollang = 0;
|
||||
rollfactor = ((spr->mobj->rollmodel == true) ? 1 : 0);
|
||||
angle_t rollang = sliptideroll
|
||||
? (spr->mobj->rollangle) + (sliptideroll * spr->mobj->player->kartstuff[k_aizdriftstrat])
|
||||
: (spr->mobj->rollangle);
|
||||
|
||||
rollang = (spr->mobj->player && sliptideroll && cv_sliptideroll.value)
|
||||
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->sliptidemem)
|
||||
: (spr->mobj->rollangle * rollfactor);
|
||||
|
||||
fixed_t anglef = AngleFixed(rollang);
|
||||
p.rollangle = FIXED_TO_FLOAT(anglef);
|
||||
p.rollmodel = (spr->mobj->rollmodel);
|
||||
p.roll = true;
|
||||
|
||||
// rotation pivot
|
||||
p.centerx = FIXED_TO_FLOAT(spr->mobj->radius/2)*(p.spritexscale);
|
||||
p.centery = FIXED_TO_FLOAT(spr->mobj->height/2)*(p.spriteyscale);
|
||||
p.rollangle = 0.0f;
|
||||
|
||||
// rotation axis
|
||||
if (sprinfo->available)
|
||||
p.rotaxis = (UINT8)(sprinfo->pivot[(spr->mobj->frame & FF_FRAMEMASK)].rotaxis);
|
||||
if (anglef)
|
||||
{
|
||||
fixed_t camAngleDiff = AngleFixed(viewangle) - FLOAT_TO_FIXED(p.angley); // dumb reconversion back, I know
|
||||
|
||||
// for NiGHTS specifically but should work everywhere else
|
||||
ang = R_PointToAngle (spr->mobj->x, spr->mobj->y) - (spr->mobj->player ? spr->mobj->player->frameangle : spr->mobj->angle);
|
||||
if ((sprframe->rotate & SRF_RIGHT) && (ang < ANGLE_180)) // See from right
|
||||
p.rollflip = 1;
|
||||
else if ((sprframe->rotate & SRF_LEFT) && (ang >= ANGLE_180)) // See from left
|
||||
p.rollflip = -1;
|
||||
p.rollangle = FIXED_TO_FLOAT(anglef);
|
||||
p.roll = true;
|
||||
|
||||
// rotation pivot
|
||||
if (sprinfo->available)
|
||||
{
|
||||
p.centerx = FIXED_TO_FLOAT(sprinfo->pivot[frame].x);
|
||||
p.centery = FIXED_TO_FLOAT(sprinfo->pivot[frame].y);
|
||||
}
|
||||
else
|
||||
{
|
||||
p.centerx = FIXED_TO_FLOAT(spr->mobj->radius/2);
|
||||
p.centery = FIXED_TO_FLOAT(spr->mobj->height/2);
|
||||
}
|
||||
|
||||
// rotation axes relative to camera
|
||||
p.rollx = FIXED_TO_FLOAT(FINECOSINE(FixedAngle(camAngleDiff) >> ANGLETOFINESHIFT));
|
||||
p.rollz = FIXED_TO_FLOAT(FINESINE(FixedAngle(camAngleDiff) >> ANGLETOFINESHIFT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
p.anglex = 0.0f;
|
||||
p.anglex2 = 0.0f;
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
// Slope rotation from Kart
|
||||
p.anglez = 0.0f;
|
||||
p.anglez2 = 0.0f;
|
||||
|
||||
// use secondary angles for the slope rotation
|
||||
if (spr->mobj->standingslope)
|
||||
{
|
||||
fixed_t tempz = spr->mobj->standingslope->normal.z;
|
||||
fixed_t tempy = spr->mobj->standingslope->normal.y;
|
||||
fixed_t tempx = spr->mobj->standingslope->normal.x;
|
||||
fixed_t tempangle = AngleFixed(R_PointToAngle2(0, 0, FixedSqrt(FixedMul(tempy, tempy) + FixedMul(tempz, tempz)), tempx));
|
||||
p.anglez2 = FIXED_TO_FLOAT(tempangle);
|
||||
tempangle = -AngleFixed(R_PointToAngle2(0, 0, tempz, tempy));
|
||||
p.anglex2 = FIXED_TO_FLOAT(tempangle);
|
||||
}
|
||||
else if ((spr->mobj->sloperoll || spr->mobj->slopepitch) && (!P_IsObjectOnGround(spr->mobj)) && (!paused))
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
angle_t camang = R_PointToAngle(interp.x, interp.y);
|
||||
angle_t mobjang;
|
||||
|
||||
if (spr->mobj->flags & (MF_NOTHINK|MF_SCENERY))
|
||||
mobjang = spr->mobj->angle;
|
||||
else
|
||||
mobjang = interp.angle;
|
||||
|
||||
angle_t fmoang;
|
||||
fmoang = camang - mobjang;
|
||||
|
||||
// slopepitch
|
||||
p.anglex += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINESINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.slopepitch)) );
|
||||
p.anglez -= flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINECOSINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.slopepitch)) );
|
||||
|
||||
// sloperoll
|
||||
p.anglex += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINECOSINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.sloperoll)) );
|
||||
p.anglez += flipfactor*FIXED_TO_FLOAT( AngleFixed(FixedMul(FINESINE((camang-fmoang) >> ANGLETOFINESHIFT), interp.sloperoll)) );
|
||||
p.roll = true;
|
||||
}
|
||||
// slope pitch and roll
|
||||
p.anglex += flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.sloperoll));
|
||||
p.anglez -= flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.slopepitch));
|
||||
|
||||
// pitch and roll
|
||||
if (interp.roll || interp.pitch)
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
p.anglex += flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.roll));
|
||||
p.anglez -= flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.pitch));
|
||||
p.roll = true;
|
||||
}
|
||||
#endif
|
||||
p.anglex += flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.roll));
|
||||
p.anglez -= flipfactor*FIXED_TO_FLOAT(AngleFixed(interp.pitch));
|
||||
|
||||
p.flip = atransform.flip;
|
||||
#ifdef USE_FTRANSFORM_MIRROR
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnSetShader(SHADER_MODEL); // model shader
|
||||
GL_SetShader(SHADER_MODEL); // model shader
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
float this_scale = FIXED_TO_FLOAT(interp.scale);
|
||||
|
||||
float xs = this_scale * FIXED_TO_FLOAT(interp.spritexscale);
|
||||
@@ -1482,7 +1447,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
p.y += ox * gl_viewcos;
|
||||
p.z += oy;
|
||||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
GL_DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "../z_zone.h"
|
||||
|
||||
#include "hw_clip.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_main.h"
|
||||
#include "hw_portal.h"
|
||||
@@ -140,23 +140,27 @@ void HWR_PortalFrame(gl_portal_t* portal)
|
||||
static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
{
|
||||
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
|
||||
|
||||
// set our portal state and prepare to render the seg
|
||||
HWR_SetPortalState(state);
|
||||
|
||||
gl_curline = portal->seg;
|
||||
gl_frontsector = portal->seg->frontsector;
|
||||
gl_backsector = portal->seg->backsector;
|
||||
|
||||
HWR_ProcessSeg();
|
||||
gl_drawing_stencil = false;
|
||||
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
GL_SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
|
||||
// Renders a single portal from the current viewpoint.
|
||||
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level)
|
||||
{
|
||||
// draw portal seg to stencil buffer with increment
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_SetTransform(fpov);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
|
||||
@@ -171,12 +175,12 @@ void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float
|
||||
HWR_PortalFrame(rootportal);
|
||||
else // current frame is not a portal frame but the main view!
|
||||
{
|
||||
R_SetupFrame(player, false);
|
||||
R_SetupFrame(viewssnum, false);
|
||||
portalclipline = NULL;
|
||||
}
|
||||
|
||||
// remove portal seg from stencil buffer
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_SetTransform(fpov);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
|
||||
|
||||
+18
-21
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
#include "hw_shaders.h"
|
||||
#include "../z_zone.h"
|
||||
|
||||
@@ -29,9 +29,6 @@ static struct {
|
||||
// Floor shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_FLOOR_FRAGMENT_SHADER},
|
||||
|
||||
// Shadow shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_SHADOW_FRAGMENT_SHADER},
|
||||
|
||||
// Wall shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
|
||||
|
||||
@@ -39,7 +36,7 @@ static struct {
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
|
||||
|
||||
// Model shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
|
||||
{GLSL_MODEL_LIGHTING_VERTEX_SHADER, GLSL_WALL_FRAGMENT_SHADER},
|
||||
|
||||
// Water shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_WATER_FRAGMENT_SHADER},
|
||||
@@ -90,7 +87,7 @@ boolean HWR_InitShaders(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!HWD.pfnInitShaders())
|
||||
if (!GL_InitShaders())
|
||||
return false;
|
||||
|
||||
for (i = 0; i < NUMSHADERTARGETS; i++)
|
||||
@@ -369,16 +366,16 @@ static void HWR_CompileShader(int index)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(vertex_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
}
|
||||
if (fragment_source)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(fragment_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
}
|
||||
|
||||
gl_shaders[index].compiled = HWD.pfnCompileShader(index);
|
||||
gl_shaders[index].compiled = GL_CompileShader(index);
|
||||
}
|
||||
|
||||
// compile or recompile shaders
|
||||
@@ -403,17 +400,18 @@ void HWR_CompileShaders(void)
|
||||
|
||||
int HWR_GetShaderFromTarget(int shader_target)
|
||||
{
|
||||
int custom_shader = gl_shadertargets[shader_target].custom_shader;
|
||||
// use custom shader if following are true
|
||||
// - custom shader exists
|
||||
// - custom shader has been compiled successfully
|
||||
// - custom shaders are enabled
|
||||
// - custom shaders are allowed by the server
|
||||
if (custom_shader != -1 && gl_shaders[custom_shader].compiled &&
|
||||
cv_glshaders.value == 1)
|
||||
return custom_shader;
|
||||
else
|
||||
return gl_shadertargets[shader_target].base_shader;
|
||||
if (cv_glshaders.value == 1)
|
||||
{
|
||||
int custom_shader = gl_shadertargets[shader_target].custom_shader;
|
||||
// use custom shader if following are true
|
||||
// - custom shader exists
|
||||
// - custom shader has been compiled successfully
|
||||
// - custom shaders are enabled
|
||||
if (custom_shader != -1 && gl_shaders[custom_shader].compiled)
|
||||
return custom_shader;
|
||||
}
|
||||
|
||||
return gl_shadertargets[shader_target].base_shader;
|
||||
}
|
||||
|
||||
static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
|
||||
@@ -432,7 +430,6 @@ static inline UINT16 HWR_FindShaderDefs(UINT16 wadnum)
|
||||
customshaderxlat_t shaderxlat[] =
|
||||
{
|
||||
{"Flat", SHADER_FLOOR},
|
||||
{"Shadow", SHADER_SHADOW},
|
||||
{"WallTexture", SHADER_WALL},
|
||||
{"Sprite", SHADER_SPRITE},
|
||||
{"Model", SHADER_MODEL},
|
||||
|
||||
@@ -31,6 +31,31 @@
|
||||
"gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n" \
|
||||
"}\0"
|
||||
|
||||
// reinterpretation of sprite lighting for models
|
||||
// it's a combination of how it works for normal sprites & papersprites
|
||||
#define GLSL_MODEL_LIGHTING_VERTEX_SHADER \
|
||||
"uniform float lighting;\n" \
|
||||
"uniform vec3 light_dir;\n" \
|
||||
"uniform float light_contrast;\n" \
|
||||
"uniform float light_backlight;\n" \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
"gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;\n" \
|
||||
"float light = lighting;\n" \
|
||||
"if (length(light_dir) > 0.000001) {\n" \
|
||||
"mat4 m4 = gl_ProjectionMatrix * gl_ModelViewMatrix;\n" \
|
||||
"mat3 m3 = mat3( m4[0].xyz, m4[1].xyz, m4[2].xyz );\n" \
|
||||
"float extralight = -dot(normalize(gl_Normal * m3), normalize(light_dir));\n" \
|
||||
"extralight *= light_contrast - light_backlight;\n" \
|
||||
"extralight *= lighting / 255.0;\n" \
|
||||
"light += extralight * 2.5;\n" \
|
||||
"}\n" \
|
||||
"light = clamp(light / 255.0, 0.0, 1.0);\n" \
|
||||
"gl_FrontColor = vec4(light, light, light, 1.0);\n" \
|
||||
"gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;\n" \
|
||||
"gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;\n" \
|
||||
"}\0"
|
||||
|
||||
// ==================
|
||||
// Fragment shaders
|
||||
// ==================
|
||||
@@ -99,6 +124,7 @@
|
||||
GLSL_DOOM_COLORMAP_NODITHER \
|
||||
"#endif\n" \
|
||||
"}\n"
|
||||
|
||||
// lighting cap adjustment:
|
||||
// first num (155.0), increase to make it start to go dark sooner
|
||||
// second num (0.26), increase to make it go dark faster
|
||||
@@ -194,26 +220,29 @@
|
||||
|
||||
// hand tuned adjustments for light level calculation
|
||||
#define GLSL_FLOOR_FUDGES \
|
||||
"#version 120\n" \
|
||||
"#define STARTMAP_FUDGE 1.06\n" \
|
||||
"#define SCALE_FUDGE 1.15\n"
|
||||
|
||||
#define GLSL_WALL_FUDGES \
|
||||
"#version 120\n" \
|
||||
"#define STARTMAP_FUDGE 1.05\n" \
|
||||
"#define SCALE_FUDGE 2.2\n"
|
||||
|
||||
#define GLSL_FLOOR_FRAGMENT_SHADER \
|
||||
"#version 120\n" \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER
|
||||
|
||||
// this is very backwards
|
||||
// but we wanna have the game look like vanilla does
|
||||
// oh well
|
||||
#define GLSL_WALL_FRAGMENT_SHADER \
|
||||
"#version 120\n" \
|
||||
"#ifdef SRB2_PALETTE_RENDERING\n" \
|
||||
GLSL_WALL_FUDGES \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER
|
||||
|
||||
#define GLSL_SHADOW_FRAGMENT_SHADER \
|
||||
"#else\n" \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
|
||||
"#endif\n" \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER
|
||||
|
||||
//
|
||||
// Water surface shader
|
||||
@@ -230,6 +259,7 @@
|
||||
"vec4 texel = texture2D(tex, vec2(gl_TexCoord[0].s - sdistort, gl_TexCoord[0].t - cdistort));\n"
|
||||
|
||||
#define GLSL_WATER_FRAGMENT_SHADER \
|
||||
"#version 120\n" \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
"const float freq = 0.025;\n" \
|
||||
"const float amp = 0.025;\n" \
|
||||
@@ -278,6 +308,7 @@
|
||||
// The floor fudges are used, but should the wall fudges be used instead? or something inbetween?
|
||||
// or separate values for floors and walls? (need to change more than this shader for that)
|
||||
#define GLSL_FOG_FRAGMENT_SHADER \
|
||||
"#version 120\n" \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
"uniform vec4 tint_color;\n" \
|
||||
"uniform vec4 fade_color;\n" \
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2005 by SRB2 Jr. Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief 3D sound definitions
|
||||
|
||||
#ifndef __HWS_DATA_H__
|
||||
#define __HWS_DATA_H__
|
||||
|
||||
#define NORMAL_SEP 128
|
||||
|
||||
// abuse?
|
||||
#define STATIC_SOURCES_NUM 6 // Total number of static sources
|
||||
|
||||
#define MIN_DISTANCE 160.0f
|
||||
#define MAX_DISTANCE 1200.0f
|
||||
|
||||
typedef struct source_pos_s
|
||||
{
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
} source_pos_t;
|
||||
|
||||
typedef struct source3D_pos_s
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
//float angle;
|
||||
float momx;
|
||||
float momy;
|
||||
float momz;
|
||||
|
||||
} source3D_pos_t;
|
||||
|
||||
|
||||
enum {NORMAL_PITCH = 128};
|
||||
|
||||
/*typedef struct source2D_data_s
|
||||
{
|
||||
INT32 volume;
|
||||
INT32 sep;
|
||||
|
||||
} source2D_data_t;*/
|
||||
|
||||
|
||||
// General 3D sound source description
|
||||
typedef struct source3D_data_s
|
||||
{
|
||||
float min_distance; //
|
||||
float max_distance; //
|
||||
INT32 head_relative; //
|
||||
INT32 permanent; //
|
||||
source3D_pos_t pos; // source position in 3D
|
||||
|
||||
} source3D_data_t;
|
||||
|
||||
|
||||
// Sound data
|
||||
typedef struct sfx_data_s
|
||||
{
|
||||
size_t length;
|
||||
void *data;
|
||||
INT32 priority;
|
||||
INT32 sep; // Only when source is 2D sound
|
||||
} sfx_data_t;
|
||||
|
||||
|
||||
// Sound cone (for 3D sources)
|
||||
typedef struct cone_def_s
|
||||
{
|
||||
float inner;
|
||||
float outer;
|
||||
INT32 outer_gain;
|
||||
/*float f_angle;
|
||||
float h_angle;*/
|
||||
} cone_def_t;
|
||||
|
||||
|
||||
typedef struct listener_data_s
|
||||
{
|
||||
// Listener position
|
||||
double x;
|
||||
double y;
|
||||
double z;
|
||||
|
||||
// Listener front and head orientation (degrees)
|
||||
double f_angle;
|
||||
double h_angle;
|
||||
|
||||
// Listener momentums
|
||||
double momx;
|
||||
double momy;
|
||||
double momz;
|
||||
} listener_data_t;
|
||||
|
||||
typedef struct snddev_s
|
||||
{
|
||||
INT32 sample_rate;
|
||||
INT32 bps;
|
||||
size_t numsfxs;
|
||||
|
||||
// Windows specific data
|
||||
#ifdef _WIN32
|
||||
UINT32 cooplevel;
|
||||
HWND hWnd;
|
||||
#endif
|
||||
} snddev_t;
|
||||
|
||||
#endif //__HWS_DATA_H__
|
||||
@@ -358,8 +358,8 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
||||
else
|
||||
textureformatGL = GL_RGB5_A1;
|
||||
|
||||
SetModelView(lvid->width, lvid->height);
|
||||
SetStates();
|
||||
GL_SetModelView(lvid->width, lvid->height);
|
||||
GL_SetStates();
|
||||
// we need to clear the depth buffer. Very important!!!
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@@ -526,7 +526,7 @@ EXPORT void HWRAPI(Shutdown) (void)
|
||||
// -----------------+
|
||||
// FinishUpdate : Swap front and back buffers
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
void GL_FinishUpdate (INT32 waitvbl)
|
||||
{
|
||||
#ifdef USE_WGL_SWAP
|
||||
static INT32 oldwaitvbl = 0;
|
||||
@@ -547,23 +547,4 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
|
||||
SwapBuffers(hDC);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetPalette : Set the color lookup table for paletted textures
|
||||
// : in OpenGL, we store values for conversion of paletted graphics when
|
||||
// : they are downloaded to the 3D card.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = pal[i].s.red;
|
||||
myPaletteData[i].s.green = pal[i].s.green;
|
||||
myPaletteData[i].s.blue = pal[i].s.blue;
|
||||
myPaletteData[i].s.alpha = pal[i].s.alpha;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+495
-605
File diff suppressed because it is too large.
Load diff
@@ -43,8 +43,9 @@
|
||||
#endif
|
||||
|
||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
|
||||
#include "../../doomdef.h"
|
||||
#include "../hw_drv.h"
|
||||
#include "../hw_gl.h"
|
||||
#include "../../z_zone.h"
|
||||
|
||||
// ==========================================================================
|
||||
@@ -65,14 +66,15 @@ extern FILE *gllogstream;
|
||||
// PROTOS
|
||||
// ==========================================================================
|
||||
|
||||
boolean LoadGL(void);
|
||||
FUNCPRINTF void GL_DBG_Printf(const char *format, ...);
|
||||
|
||||
void *GetGLFunc(const char *proc);
|
||||
boolean SetupGLfunc(void);
|
||||
void SetupGLFunc4(void);
|
||||
void Flush(void);
|
||||
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
||||
void SetModelView(GLint w, GLint h);
|
||||
void SetStates(void);
|
||||
void GL_Flush(void);
|
||||
INT32 GL_isExtAvailable(const char *extension, const GLubyte *start);
|
||||
void GL_SetModelView(GLint w, GLint h);
|
||||
void GL_SetStates(void);
|
||||
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
@@ -101,11 +103,11 @@ extern PFNglGetString pglGetString;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void GLFramebuffer_DeleteAttachments(void);
|
||||
void GL_Framebuffer_DeleteAttachments(void);
|
||||
|
||||
void GLFramebuffer_Unbind(void);
|
||||
void GLFramebuffer_Enable(void);
|
||||
void GLFramebuffer_Disable(void);
|
||||
void GL_Framebuffer_Unbind(void);
|
||||
void GL_Framebuffer_Enable(void);
|
||||
void GL_Framebuffer_Disable(void);
|
||||
|
||||
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
|
||||
@@ -119,6 +121,8 @@ extern boolean supportFBO;
|
||||
extern const GLubyte *gl_version;
|
||||
extern const GLubyte *gl_renderer;
|
||||
extern const GLubyte *gl_extensions;
|
||||
extern const GLubyte *gl_vendor;
|
||||
extern GLuint gl_num_extensions;
|
||||
|
||||
extern int majorGL, minorGL;
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,59 +0,0 @@
|
||||
[Project]
|
||||
FileName=s_ds3d.dev
|
||||
Name=s_ds3d
|
||||
Ver=1
|
||||
IsCpp=1
|
||||
Type=3
|
||||
Compiler=-D_M_IX86=500_@@_-Wall_@@_-D_WINDOWS_@@_-Os_@@_-fno-strict-aliasing_@@_-fomit-frame-pointer_@@_
|
||||
CppCompiler=
|
||||
Includes=
|
||||
Linker=--def ../s_mingw.def_@@_-luuid_@@_-ldsound_@@_
|
||||
Libs=
|
||||
UnitCount=1
|
||||
Folders=
|
||||
ObjFiles=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Icon=
|
||||
ExeOutput=C:\srb2demo2
|
||||
ObjectOutput=..\..\..\objs\Mingw\s_ds3d
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=s_ds3d.dll
|
||||
HostApplication=
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=00000000000000000111d0
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
|
||||
[Unit1]
|
||||
FileName=s_ds3d.c
|
||||
Folder=
|
||||
Compile=1
|
||||
CompileCpp=0
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=0.1
|
||||
FileDescription=Developed using the Dev-C++ IDE
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=s_ds3d.exe
|
||||
ProductName=s_ds3d
|
||||
ProductVersion=0.1
|
||||
AutoIncBuildNr=0
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="s_ds3d" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=s_ds3d - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "s_ds3d.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "s_ds3d.mak" CFG="s_ds3d - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "s_ds3d - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "s_ds3d - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "s_ds3d - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\..\bin\VC\Release\s_ds3d"
|
||||
# PROP Intermediate_Dir "..\..\..\objs\VC\Release\s_ds3d"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_DS3D_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /G5 /MT /W3 /GX /Zi /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x419 /d "NDEBUG"
|
||||
# ADD RSC /l 0x40c /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 dsound.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\s_ds3d.pdb" /machine:I386 /out:"..\..\..\bin\VC\Release\s_ds3d.dll"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "s_ds3d - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\..\..\bin\VC\Debug\s_ds3d"
|
||||
# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\s_ds3d"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_DS3D_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32
|
||||
# ADD BASE RSC /l 0x419 /d "_DEBUG"
|
||||
# ADD RSC /l 0x40c /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 dsound.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\s_ds3d.pdb" /debug /machine:I386 /out:"..\..\..\bin\VC\Debug\s_ds3d.dll" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /pdb:none /incremental:no /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "s_ds3d - Win32 Release"
|
||||
# Name "s_ds3d - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\s_ds3d.c
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,59 +0,0 @@
|
||||
[Project]
|
||||
FileName=s_fmod.dev
|
||||
Name=s_fmod
|
||||
Ver=1
|
||||
IsCpp=1
|
||||
Type=3
|
||||
Compiler=-D_M_IX86=500_@@_-Wall_@@_-D_WINDOWS_@@_-Os_@@_-fomit-frame-pointer_@@_
|
||||
CppCompiler=
|
||||
Includes=..\..\win32\FMOD
|
||||
Linker=--def ../s_mingw.def_@@_-lfmod_@@_
|
||||
Libs=..\..\win32\FMOD
|
||||
UnitCount=1
|
||||
Folders=
|
||||
ObjFiles=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Icon=
|
||||
ExeOutput=C:\srb2demo2
|
||||
ObjectOutput=..\..\..\objs\Mingw\s_fmod
|
||||
OverrideOutput=1
|
||||
OverrideOutputName=s_fmod.dll
|
||||
HostApplication=
|
||||
CommandLine=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=00000000000000000111d0
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
|
||||
[Unit1]
|
||||
FileName=s_fmod.c
|
||||
Folder=
|
||||
Compile=1
|
||||
CompileCpp=0
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=1
|
||||
Minor=0
|
||||
Release=8
|
||||
Build=42
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=Alam Arias
|
||||
FileVersion=1.42
|
||||
FileDescription=SRB2 Sound API DLL for FMOD
|
||||
InternalName=Super FMOD!
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=s_fmod.dll
|
||||
ProductName=s_fmod
|
||||
ProductVersion=0.1
|
||||
AutoIncBuildNr=0
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="s_fmod" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=s_fmod - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "s_fmod.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "s_fmod.mak" CFG="s_fmod - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "s_fmod - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "s_fmod - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "s_fmod - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\..\bin\VC\Release\s_fmod"
|
||||
# PROP Intermediate_Dir "..\..\..\objs\VC\Release\s_fmod"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_FMOD_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 fmodvc.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\s_fmod.pdb" /machine:I386 /out:"..\..\..\bin\VC\Release\s_fmod.dll"
|
||||
|
||||
!ELSEIF "$(CFG)" == "s_fmod - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\..\..\bin\VC\Debug\s_fmod"
|
||||
# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\s_fmod"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_FMOD_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /FR /FD /GZ /c
|
||||
# SUBTRACT CPP /YX
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 fmodvc.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\s_fmod.pdb" /debug /machine:I386 /out:"..\..\..\bin\VC\Debug\s_fmod.dll" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "s_fmod - Win32 Release"
|
||||
# Name "s_fmod - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\s_fmod.c
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,998 +0,0 @@
|
||||
// Emacs style mode select -*- C++ -*-
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (C) 2001 by DooM Legacy Team.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief General driver for 3D sound system
|
||||
///
|
||||
/// Implementend via OpenAL API
|
||||
|
||||
#ifdef _WINDOWS
|
||||
//#define WIN32_LEAN_AND_MEAN
|
||||
#define RPC_NO_WINDOWS_H
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
FILE* logstream = NULL;
|
||||
#else
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#ifndef HAVE_SDL // let not make a logstream here is we are inline the HW3D in the SDL binary
|
||||
FILE* logstream = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <al.h> //Main AL
|
||||
#include <alc.h> //Helpers
|
||||
#else
|
||||
#include <AL/al.h> //Main AL
|
||||
#include <AL/alc.h> //Helpers
|
||||
#endif
|
||||
|
||||
#define _CREATE_DLL_
|
||||
#include "../../doomdef.h"
|
||||
#include "../hw3dsdrv.h"
|
||||
|
||||
//#undef DEBUG_TO_FILE
|
||||
//#if defined ( HAVE_SDL ) && !defined ( LOGMESSAGES )
|
||||
#define DEBUG_TO_FILE
|
||||
//#endif
|
||||
|
||||
// Internal sound stack
|
||||
typedef struct stack_snd_s
|
||||
{
|
||||
ALuint ALsource;// 3D data of 3D source
|
||||
|
||||
ALint sfx_id;// Currently unused
|
||||
|
||||
ALint LRU;// Currently unused
|
||||
|
||||
ALboolean permanent;// Flag of static source
|
||||
} stack_snd_t;
|
||||
|
||||
#ifndef AL_INVALID
|
||||
#define AL_INVALID (-1)
|
||||
#endif
|
||||
|
||||
static I_Error_t I_ErrorOpenAl = NULL;
|
||||
static stack_snd_t *ALstack = NULL; // Sound stack
|
||||
static ALsizei allocated_sounds = 0; // Size of stack
|
||||
static ALsizei allocate_delta = 16;
|
||||
static ALCdevice *ALCDevice = NULL;
|
||||
static ALCcontext *ALContext = NULL;
|
||||
static ALenum ALo_Lasterror = AL_NO_ERROR;
|
||||
static ALenum ALCo_Lasterror = ALC_NO_ERROR;
|
||||
|
||||
static ALenum ALo_GetError(ALvoid)
|
||||
{
|
||||
ALo_Lasterror = alGetError();
|
||||
return ALo_Lasterror;
|
||||
}
|
||||
|
||||
static ALenum ALCo_GetError(ALvoid)
|
||||
{
|
||||
ALCo_Lasterror = alcGetError(ALCDevice);
|
||||
return ALCo_Lasterror;
|
||||
}
|
||||
|
||||
static ALfloat ALvol(ALint vol, ALsizei step)
|
||||
{
|
||||
return ((ALfloat)vol)/(ALfloat)step;
|
||||
}
|
||||
|
||||
/*
|
||||
static ALfloat Alpitch(ALint pitch)
|
||||
{
|
||||
#if 1
|
||||
pitch = NORMAL_PITCH;
|
||||
#endif
|
||||
return pitch < NORMAL_PITCH ?
|
||||
(float)(pitch + NORMAL_PITCH) / (NORMAL_PITCH * 2)
|
||||
:(float)pitch / (float)NORMAL_PITCH;
|
||||
}
|
||||
*/
|
||||
|
||||
static const ALchar *GetALErrorString(ALenum err)
|
||||
{
|
||||
switch (err)
|
||||
{
|
||||
case AL_NO_ERROR:
|
||||
return "There no error";
|
||||
break;
|
||||
|
||||
case AL_INVALID_NAME:
|
||||
return "Invalid name";
|
||||
break;
|
||||
|
||||
case AL_INVALID_ENUM:
|
||||
return "Invalid enum";
|
||||
break;
|
||||
|
||||
case AL_INVALID_VALUE:
|
||||
return "Invalid value";
|
||||
break;
|
||||
|
||||
case AL_INVALID_OPERATION:
|
||||
return "Invalid operation";
|
||||
break;
|
||||
|
||||
case AL_OUT_OF_MEMORY:
|
||||
return "Out Of Memory";
|
||||
break;
|
||||
|
||||
default:
|
||||
return alGetString(err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const ALchar *GetALCErrorString(ALenum err)
|
||||
{
|
||||
switch (err)
|
||||
{
|
||||
case ALC_NO_ERROR:
|
||||
return "There no error";
|
||||
break;
|
||||
|
||||
case ALC_INVALID_DEVICE:
|
||||
return "Invalid Device";
|
||||
break;
|
||||
|
||||
case ALC_INVALID_CONTEXT:
|
||||
return "Invalid Context";
|
||||
break;
|
||||
|
||||
case ALC_INVALID_ENUM:
|
||||
return "Invalid enum";
|
||||
break;
|
||||
|
||||
case ALC_INVALID_VALUE:
|
||||
return "Invalid value";
|
||||
break;
|
||||
|
||||
case ALC_OUT_OF_MEMORY:
|
||||
return "Out Of Memory";
|
||||
break;
|
||||
|
||||
default:
|
||||
return alcGetString(ALCDevice, err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* DBG_Printf
|
||||
* Output error messages to debug log if DEBUG_TO_FILE is defined,
|
||||
* else do nothing
|
||||
*
|
||||
**************************************************************
|
||||
*/
|
||||
// -----------------+
|
||||
// DBG_Printf : Output error messages to debug log if DEBUG_TO_FILE is defined,
|
||||
// : else do nothing
|
||||
// Returns :
|
||||
// -----------------+
|
||||
FUNCPRINTF void DBG_Printf(const char *lpFmt, ... )
|
||||
{
|
||||
#ifdef DEBUG_TO_FILE
|
||||
char str[4096] = "";
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, lpFmt);
|
||||
vsnprintf(str, 4096, lpFmt, arglist);
|
||||
va_end(arglist);
|
||||
if (logstream)
|
||||
fwrite(str, strlen(str), 1 , logstream);
|
||||
#else
|
||||
lpFmt = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Grow internal sound stack by allocate_delta amount
|
||||
*
|
||||
***************************************************************
|
||||
*/
|
||||
static ALboolean reallocate_stack(void)
|
||||
{
|
||||
stack_snd_t *new_stack;
|
||||
if (ALstack)
|
||||
new_stack = realloc(ALstack, sizeof (stack_snd_t) * (allocated_sounds + allocate_delta));
|
||||
else
|
||||
new_stack = malloc(sizeof (stack_snd_t) * (allocate_delta));
|
||||
if (new_stack)
|
||||
{
|
||||
ALsizei clean_stack;
|
||||
ALstack = new_stack;
|
||||
memset(&ALstack[allocated_sounds], 0, allocate_delta * sizeof (stack_snd_t));
|
||||
for (clean_stack = allocated_sounds; clean_stack < allocated_sounds; clean_stack++)
|
||||
ALstack[clean_stack].ALsource = (ALuint)AL_INVALID;
|
||||
allocated_sounds += allocate_delta;
|
||||
return AL_TRUE;
|
||||
}
|
||||
return AL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Destroys source in stack
|
||||
*
|
||||
***************************************************************
|
||||
*/
|
||||
static ALvoid kill_sound(stack_snd_t *snd)
|
||||
{
|
||||
if (alIsSource(snd->ALsource))
|
||||
alDeleteSources(1,&snd->ALsource);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alDeleteSources, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
memset(snd,0, sizeof (stack_snd_t));
|
||||
snd->ALsource = (ALuint)AL_INVALID;
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
*
|
||||
* Returns free (unused) source stack slot
|
||||
* If none available sound stack will be increased
|
||||
*
|
||||
***************************************************************
|
||||
*/
|
||||
static ALsizei find_handle(void)
|
||||
{
|
||||
ALsizei free_sfx = 0;
|
||||
stack_snd_t *snd;
|
||||
|
||||
for (snd = ALstack; free_sfx < allocated_sounds; snd++, free_sfx++)
|
||||
{
|
||||
if (snd->permanent)
|
||||
continue;
|
||||
if (snd->ALsource==(ALuint)AL_INVALID)
|
||||
break;
|
||||
if (!alIsSource(snd->ALsource))
|
||||
break;
|
||||
ALo_GetError();
|
||||
if (snd->sfx_id == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
// No suitable resource found so increase sound stack
|
||||
//DBG_Printf("sfx chan %d\n", free_sfx);
|
||||
if (free_sfx == allocated_sounds)
|
||||
{
|
||||
DBG_Printf("No free or same sfx found so increase stack (currently %d srcs)\n", allocated_sounds);
|
||||
free_sfx = reallocate_stack() ? free_sfx : (ALsizei)AL_INVALID;
|
||||
}
|
||||
return free_sfx;
|
||||
}
|
||||
|
||||
static ALvoid ALSetPan(ALuint sid, INT32 sep)
|
||||
{
|
||||
ALfloat facing[3] ={0.0f, 0.0f, 0.0f}; //Alam: bad?
|
||||
const ALfloat fsep = (ALfloat)sep;
|
||||
const ALfloat nsep = (ALfloat)NORMAL_SEP;
|
||||
if (sep)
|
||||
{
|
||||
facing[0] = (ALfloat)(fsep/nsep);
|
||||
facing[2] = 1.0f;
|
||||
}
|
||||
alSourcefv(sid, AL_POSITION, facing);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alSourcefv, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Initialise driver and listener
|
||||
*
|
||||
*****************************************************************************/
|
||||
EXPORT INT32 HWRAPI( Startup ) (I_Error_t FatalErrorFunction, snddev_t *snd_dev)
|
||||
{
|
||||
ALenum model = AL_INVERSE_DISTANCE_CLAMPED;
|
||||
ALCboolean inited = ALC_FALSE;
|
||||
ALCint AlSetup[8] = {ALC_FREQUENCY,22050,ALC_REFRESH,35,ALC_SYNC,AL_FALSE,ALC_INVALID,ALC_INVALID};
|
||||
#if (defined (_WIN32) || defined (_WIN64)) && 0
|
||||
const ALCubyte *ALCdriver = alcGetString(NULL,ALC_DEFAULT_DEVICE_SPECIFIER);
|
||||
const ALCubyte *DSdriver = "DirectSound";
|
||||
|
||||
if (!strcmp((const ALCbyte *)ALCdriver,"DirectSound3D")) //Alam: OpenAL's DS3D is buggy
|
||||
ALCDevice = alcOpenDevice(DSdriver); //Open DirectSound
|
||||
else //Alam: The OpenAl device
|
||||
ALCDevice = alcOpenDevice(ALCdriver); //Open Default
|
||||
#else
|
||||
ALCDevice = alcOpenDevice(alcGetString(NULL,ALC_DEFAULT_DEVICE_SPECIFIER));
|
||||
#endif
|
||||
if (ALCo_GetError() != ALC_NO_ERROR || !ALCDevice)
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when opening device!\n", GetALCErrorString(ALCo_Lasterror));
|
||||
return inited;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_Printf("Driver Name : %s\n", alcGetString(ALCDevice,ALC_DEVICE_SPECIFIER));
|
||||
DBG_Printf("Extensions : %s\n", alcGetString(ALCDevice,ALC_EXTENSIONS));
|
||||
DBG_Printf("S_OpenAl: OpenAl Device %s opened\n",alcGetString(ALCDevice, ALC_DEVICE_SPECIFIER));
|
||||
}
|
||||
|
||||
I_ErrorOpenAl = FatalErrorFunction;
|
||||
|
||||
AlSetup[1] = snd_dev->sample_rate; //ALC_FREQUENCY
|
||||
AlSetup[1] = 44100;
|
||||
AlSetup[3] = 35; //ALC_REFRESH
|
||||
|
||||
//Alam: The Environment?
|
||||
ALContext = alcCreateContext(ALCDevice,AlSetup);
|
||||
if (ALCo_GetError() != ALC_NO_ERROR || !ALContext)
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when making the environment!\n",GetALCErrorString(ALCo_Lasterror));
|
||||
return inited;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_Printf("S_OpenAl: OpenAl environment made\n");
|
||||
}
|
||||
|
||||
alcMakeContextCurrent(ALContext);
|
||||
if (ALCo_GetError() != ALC_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when setting the environment!\n",GetALCErrorString(ALCo_Lasterror));
|
||||
return inited;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_Printf("S_OpenAl: OpenAl environment setted up\n");
|
||||
}
|
||||
|
||||
DBG_Printf("Vendor : %s\n", alGetString(AL_VENDOR));
|
||||
DBG_Printf("Renderer : %s\n", alGetString(AL_RENDERER));
|
||||
DBG_Printf("Version : %s\n", alGetString(AL_VERSION));
|
||||
DBG_Printf("Extensions : %s\n", alGetString(AL_EXTENSIONS));
|
||||
|
||||
alDopplerFactor(0.0f);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when setting Doppler Factor!\n",GetALErrorString(ALo_Lasterror));
|
||||
return inited;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Doppler Factor of %f setted\n", alGetDouble(AL_DOPPLER_FACTOR));
|
||||
}
|
||||
|
||||
alSpeedOfSound(600.0f);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when setting Speed of Sound!\n",GetALErrorString(ALo_Lasterror));
|
||||
return inited;
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Speed of Sound set to %f\n", alGetDouble(AL_SPEED_OF_SOUND));
|
||||
}
|
||||
|
||||
alDistanceModel(model);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when setting Distance Model!\n",GetALErrorString(ALo_Lasterror));
|
||||
return inited;
|
||||
}
|
||||
else
|
||||
{
|
||||
//DBG_Printf("S_OpenAl: %s mode setted\n",alGetString(model));
|
||||
}
|
||||
|
||||
inited = reallocate_stack();
|
||||
|
||||
return inited;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Shutdown 3D Sound
|
||||
*
|
||||
******************************************************************************/
|
||||
EXPORT void HWRAPI( Shutdown ) ( void )
|
||||
{
|
||||
ALsizei i;
|
||||
|
||||
DBG_Printf ("S_OpenAL Shutdown()\n");
|
||||
|
||||
for (i = 0; i < allocated_sounds; i++)
|
||||
{
|
||||
StopSource(i);
|
||||
kill_sound(ALstack + i);
|
||||
}
|
||||
|
||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
||||
alcMakeContextCurrent(NULL);
|
||||
//TODO:check?
|
||||
#endif
|
||||
|
||||
if (ALContext)
|
||||
{
|
||||
alcDestroyContext(ALContext);
|
||||
ALContext = NULL;
|
||||
}
|
||||
|
||||
if (ALstack)
|
||||
{
|
||||
free(ALstack);
|
||||
ALstack = NULL;
|
||||
}
|
||||
|
||||
//TODO:check?
|
||||
if (ALCDevice)
|
||||
{
|
||||
alcCloseDevice(ALCDevice);
|
||||
ALCDevice = NULL;
|
||||
}
|
||||
//TODO:check?
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4200)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ALushort header; // 3?
|
||||
ALushort samplerate; // 11025+
|
||||
ALushort samples; // number of samples
|
||||
ALushort dummy; // 0
|
||||
ALubyte data[0]; // data;
|
||||
} ATTRPACK dssfx_t;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack()
|
||||
#pragma warning(default : 4200)
|
||||
#endif
|
||||
|
||||
static ALsizei getfreq(ALvoid *sfxdata, size_t len)
|
||||
{
|
||||
dssfx_t *dsfx = sfxdata;
|
||||
const ALsizei freq = SHORT(dsfx->samplerate);
|
||||
|
||||
if (len <= 8)
|
||||
return 0;
|
||||
else
|
||||
return freq;
|
||||
}
|
||||
|
||||
static ALsizei makechan(ALuint sfxhandle, ALboolean perm)
|
||||
{
|
||||
ALsizei chan = find_handle();
|
||||
|
||||
if (chan == (ALsizei)AL_INVALID) return chan;
|
||||
|
||||
alGenSources(1, &ALstack[chan].ALsource);
|
||||
if (ALo_GetError() != AL_NO_ERROR || !alIsSource(ALstack[chan].ALsource))
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when make an ALSource!\n",GetALErrorString(ALo_Lasterror));
|
||||
ALstack[chan].ALsource = (ALuint)AL_INVALID;
|
||||
return (ALsizei)AL_INVALID;
|
||||
}
|
||||
|
||||
ALstack[chan].permanent = perm;
|
||||
|
||||
alSourceQueueBuffers(ALstack[chan].ALsource, 1, &sfxhandle);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when queue up an alSource!\n",GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
return chan;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Creates ?D source
|
||||
*
|
||||
******************************************************************************/
|
||||
EXPORT INT32 HWRAPI ( AddSource ) (source3D_data_t *src, u_int sfxhandle)
|
||||
{
|
||||
ALsizei chan = makechan(sfxhandle, (ALboolean)(src?src->permanent:AL_FALSE));
|
||||
ALuint sid = (ALuint)AL_INVALID;
|
||||
if (chan == (ALsizei)AL_INVALID)
|
||||
return AL_INVALID;
|
||||
else
|
||||
sid = ALstack[chan].ALsource;
|
||||
|
||||
if (src) //3D
|
||||
{
|
||||
#if 0
|
||||
alSourcef(sid, AL_REFERENCE_DISTANCE, src->min_distance);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_REFERENCE_DISTANCE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
alSourcef(sid, AL_MAX_DISTANCE, src->max_distance);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_MAX_DISTANCE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (src->head_relative)
|
||||
alSourcei(sid, AL_SOURCE_RELATIVE, AL_TRUE);
|
||||
else
|
||||
alSourcei(sid, AL_SOURCE_RELATIVE, AL_FALSE);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_SOURCE_RELATIVE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
alSource3f(sid, AL_POSITION, src->pos.x, src->pos.z, src->pos.y);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_POSITION, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
alSource3f(sid, AL_VELOCITY, src->pos.momx, src->pos.momz, src->pos.momy);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_VELOCITY, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
else //2D
|
||||
{
|
||||
alSourcei(sid, AL_SOURCE_RELATIVE, AL_TRUE);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_SOURCE_RELATIVE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
|
||||
alSourcef(sid, AL_ROLLOFF_FACTOR, 0.0f);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_ROLLOFF_FACTOR, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
alSourcef(sid, AL_REFERENCE_DISTANCE, 0.0f);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_REFERENCE_DISTANC, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
return chan;
|
||||
}
|
||||
|
||||
EXPORT INT32 HWRAPI ( StartSource ) (INT32 chan)
|
||||
{
|
||||
ALint state = AL_NONE;
|
||||
ALuint sid = (ALuint)AL_INVALID;
|
||||
|
||||
if (chan <= AL_INVALID || !alIsSource(ALstack[chan].ALsource))
|
||||
return AL_FALSE;
|
||||
else
|
||||
sid = ALstack[chan].ALsource;
|
||||
|
||||
ALo_GetError();
|
||||
|
||||
alSourcePlay(sid);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alSourcePlay, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
alGetSourcei(sid, AL_SOURCE_STATE, &state);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alGetSourcei, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
return (state == AL_PLAYING);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI ( StopSource) (INT32 chan)
|
||||
{
|
||||
ALuint sfxhandle = AL_NONE;
|
||||
ALuint sid = (ALuint)AL_INVALID;
|
||||
if (chan <= AL_INVALID || !alIsSource(ALstack[chan].ALsource))
|
||||
return;
|
||||
else
|
||||
sid = ALstack[chan].ALsource;
|
||||
|
||||
ALo_GetError();
|
||||
|
||||
#if 1
|
||||
alSourceQueueBuffers(sid, 1, &sfxhandle);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alSourceQueueBuffers, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
#else
|
||||
alSourceStop(sid);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alSourceStop, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT INT32 HWRAPI ( GetHW3DSVersion) (void)
|
||||
{
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI (BeginFrameUpdate) (void)
|
||||
{
|
||||
alcSuspendContext(ALContext);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alcSuspendContext, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI (EndFrameUpdate) (void)
|
||||
{
|
||||
alcProcessContext(ALContext);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alcProcessContext, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT INT32 HWRAPI (IsPlaying) (INT32 chan)
|
||||
{
|
||||
ALint state = AL_NONE;
|
||||
ALuint sid = (ALuint)AL_INVALID;
|
||||
|
||||
if (chan <= AL_INVALID || !alIsSource(ALstack[chan].ALsource))
|
||||
return AL_FALSE;
|
||||
else
|
||||
sid = ALstack[chan].ALsource;
|
||||
|
||||
ALo_GetError();
|
||||
|
||||
alGetSourcei(sid, AL_SOURCE_STATE, &state);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alGetSourcei, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
return (state == AL_PLAYING);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* UpdateListener
|
||||
*
|
||||
* Set up main listener properties:
|
||||
* - position
|
||||
* - orientation
|
||||
* - velocity
|
||||
*****************************************************************************/
|
||||
EXPORT void HWRAPI (UpdateListener) (listener_data_t *data, INT32 num)
|
||||
{
|
||||
if (num != 1) return;
|
||||
|
||||
if (data)
|
||||
{
|
||||
ALfloat facing[6];
|
||||
ALdouble f_angle = 0.0;
|
||||
if (data->f_angle) f_angle = (ALdouble)((data->f_angle) / 180.0l * M_PIl);
|
||||
facing[0] = (ALfloat)cos(f_angle);
|
||||
facing[1] = 0.0f;
|
||||
facing[2] = (ALfloat)sin(f_angle);
|
||||
facing[3] = 0.0f;
|
||||
facing[4] = 1.0f;
|
||||
facing[5] = 0.0f;
|
||||
|
||||
alListener3f(AL_POSITION,(ALfloat)-data->x,(ALfloat)data->z,(ALfloat)data->y);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_POSITIO, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
alListener3f(AL_VELOCITY,(ALfloat)data->momx,(ALfloat)data->momz,(ALfloat)data->momy);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_VELOCITY, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
alListenerfv(AL_ORIENTATION, facing);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_ORIENTATION, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG_Printf("Error: 1st listener data is missing\n");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Update volume for 2D source and separation (panning) of 2D source
|
||||
*
|
||||
*****************************************************************************/
|
||||
EXPORT void HWRAPI (UpdateSourceParms) (INT32 chan, INT32 vol, INT32 sep)
|
||||
{
|
||||
ALuint sid = AL_NONE;
|
||||
ALint is2d = AL_FALSE;
|
||||
if (chan > AL_INVALID && !alIsSource(ALstack[chan].ALsource))
|
||||
return;
|
||||
else
|
||||
sid = ALstack[chan].ALsource;
|
||||
|
||||
alGetSourcei(sid, AL_SOURCE_RELATIVE, &is2d);
|
||||
|
||||
if (!is2d)
|
||||
return;
|
||||
|
||||
if (vol != -1)
|
||||
{
|
||||
alSourcef(sid,AL_GAIN,ALvol(vol,256));
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alSourcef, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
|
||||
if (sep != -1)
|
||||
{
|
||||
ALSetPan(sid,sep-NORMAL_SEP);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: ALSetPan, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// Set the global volume for sound effects
|
||||
// --------------------------------------------------------------------------
|
||||
EXPORT void HWRAPI (SetGlobalSfxVolume) (INT32 vol)
|
||||
{
|
||||
alListenerf(AL_GAIN, ALvol(vol,32));
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_GAIN, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
|
||||
//Alam: Not Used?
|
||||
EXPORT INT32 HWRAPI (SetCone) (INT32 chan, cone_def_t *cone_def)
|
||||
{
|
||||
ALuint sid = AL_NONE;
|
||||
ALint is2d = AL_FALSE;
|
||||
if (chan > AL_INVALID && !alIsSource(ALstack[chan].ALsource))
|
||||
return AL_FALSE;
|
||||
else
|
||||
sid = ALstack[chan].ALsource;
|
||||
|
||||
alGetSourcei(sid, AL_SOURCE_RELATIVE, &is2d);
|
||||
|
||||
if(is2d || !cone_def)
|
||||
return AL_FALSE;
|
||||
|
||||
alSourcef(sid,AL_CONE_INNER_ANGLE,cone_def->inner);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_CONE_INNER_ANGLE, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
alSourcef(sid,AL_CONE_OUTER_ANGLE,cone_def->outer);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_CONE_OUTER_ANGL, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
alSourcei(sid,AL_CONE_OUTER_GAIN, cone_def->outer_gain);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_CONE_OUTER_GAIN, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
return AL_TRUE;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI (Update3DSource) (INT32 chan, source3D_pos_t *sfx)
|
||||
{
|
||||
ALuint sid = AL_NONE;
|
||||
ALint is2d = AL_FALSE;
|
||||
if (chan > AL_INVALID && !alIsSource(ALstack[chan].ALsource))
|
||||
return;
|
||||
else
|
||||
sid = ALstack[chan].ALsource;
|
||||
|
||||
alGetSourcei(sid, AL_SOURCE_RELATIVE, &is2d);
|
||||
|
||||
if (is2d)
|
||||
return;
|
||||
|
||||
alSource3f(sid, AL_POSITION, sfx->x, sfx->z, sfx->y);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_POSITION, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
alSource3f(sid, AL_VELOCITY, sfx->momx, sfx->momz, sfx->momy);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: AL_VELOCITY, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Load new sound data into source
|
||||
//-------------------------------------------------------------
|
||||
EXPORT INT32 HWRAPI (ReloadSource) (INT32 chan, u_int sfxhandle)
|
||||
{
|
||||
ALuint sid;
|
||||
|
||||
if (chan <= AL_INVALID || !alIsSource(ALstack[chan].ALsource) || !alIsBuffer(sfxhandle))
|
||||
return AL_INVALID;
|
||||
else
|
||||
sid = ALstack[chan].ALsource;
|
||||
|
||||
ALo_GetError();
|
||||
|
||||
alSourceQueueBuffers(sid, 1, &sfxhandle);
|
||||
if (ALo_GetError() == AL_INVALID_OPERATION) //Alam: not needed?
|
||||
{
|
||||
alSourceStop(sid);
|
||||
alSourcei(sid, AL_BUFFER, sfxhandle);
|
||||
ALo_GetError();
|
||||
}
|
||||
if (ALo_Lasterror != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alSourcei, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
return chan;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* Destroy source and remove it from stack if it is a 2D source.
|
||||
* Otherwise put source into cache
|
||||
*
|
||||
*****************************************************************************/
|
||||
EXPORT void HWRAPI (KillSource) (INT32 chan)
|
||||
{
|
||||
if (chan > AL_INVALID && (ALsizei)chan <= allocated_sounds)
|
||||
kill_sound(ALstack + chan);
|
||||
}
|
||||
|
||||
EXPORT u_int HWRAPI (AddSfx) (sfx_data_t *sfx)
|
||||
{
|
||||
ALuint chan = (ALuint)AL_INVALID;
|
||||
ALsizei freq = 11025;
|
||||
ALubyte *data = NULL;
|
||||
ALsizei size = 0;
|
||||
|
||||
if (!sfx)
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
data = ((ALubyte *)sfx->data)+8;
|
||||
size = (ALsizei)(sfx->length-8);
|
||||
}
|
||||
|
||||
alGenBuffers(1, &chan);
|
||||
if (ALo_GetError() != AL_NO_ERROR || !alIsBuffer(chan))
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when make an ALBuffer!\n",GetALErrorString(ALo_Lasterror));
|
||||
return (u_int)AL_INVALID;
|
||||
}
|
||||
|
||||
freq = getfreq(sfx->data, sfx->length);
|
||||
|
||||
alBufferData(chan, AL_FORMAT_MONO8, data, size, freq);
|
||||
if (ALo_GetError() != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("S_OpenAl: Error %s when setting up a alBuffer!\n",GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
|
||||
return chan;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI (KillSfx) (u_int sfxhandle)
|
||||
{
|
||||
ALuint ALsfx = sfxhandle;
|
||||
if (!alIsBuffer(ALsfx))
|
||||
return;
|
||||
alDeleteBuffers(1, &ALsfx);
|
||||
if (ALo_GetError() == AL_INVALID_OPERATION)
|
||||
{
|
||||
// Buffer leak
|
||||
}
|
||||
else if (ALo_Lasterror != AL_NO_ERROR)
|
||||
{
|
||||
DBG_Printf("%s: alDeleteBuffers, %s", __FUNCTION__, GetALErrorString(ALo_Lasterror));
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI (GetHW3DSTitle) (char *buf, size_t size)
|
||||
{
|
||||
strncpy(buf, "OpenAL", size);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WINDOWS
|
||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, // handle to DLL module
|
||||
DWORD fdwReason, // reason for calling function
|
||||
LPVOID lpvReserved) // reserved
|
||||
{
|
||||
// Perform actions based on the reason for calling.
|
||||
UNREFERENCED_PARAMETER(lpvReserved);
|
||||
switch ( fdwReason )
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
// Initialize once for each new process.
|
||||
// Return FALSE to fail DLL load.
|
||||
#ifdef DEBUG_TO_FILE
|
||||
logstream = fopen("s_openal.log", "wt");
|
||||
if (logstream == NULL)
|
||||
return FALSE;
|
||||
#endif
|
||||
DisableThreadLibraryCalls(hinstDLL);
|
||||
break;
|
||||
|
||||
case DLL_THREAD_ATTACH:
|
||||
// Do thread-specific initialization.
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
// Do thread-specific cleanup.
|
||||
break;
|
||||
|
||||
case DLL_PROCESS_DETACH:
|
||||
// Perform any necessary cleanup.
|
||||
#ifdef DEBUG_TO_FILE
|
||||
if ( logstream)
|
||||
{
|
||||
fclose(logstream);
|
||||
logstream = NULL;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return TRUE; // Successful DLL_PROCESS_ATTACH.
|
||||
}
|
||||
#elif !defined (_WINDOWS)
|
||||
|
||||
// **************************************************************************
|
||||
// FUNCTIONS
|
||||
// **************************************************************************
|
||||
|
||||
EXPORT void _init()
|
||||
{
|
||||
#ifdef DEBUG_TO_FILE
|
||||
logstream = fopen("s_openal.log", "w+");
|
||||
#endif
|
||||
}
|
||||
|
||||
EXPORT void _fini()
|
||||
{
|
||||
#ifdef DEBUG_TO_FILE
|
||||
if (logstream)
|
||||
fclose(logstream);
|
||||
logstream = NULL;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
[Project]
|
||||
FileName=s_openal.dev
|
||||
Name=s_openal
|
||||
Ver=1
|
||||
IsCpp=1
|
||||
Type=3
|
||||
Compiler=-D_M_IX86=500_@@_-Wall_@@_-fexceptions_@@_-D_WINDOWS_@@_
|
||||
CppCompiler=
|
||||
Includes=
|
||||
Linker=--def ../s_mingw.def_@@_-lopenal32_@@_
|
||||
Libs=
|
||||
UnitCount=1
|
||||
Folders=
|
||||
ObjFiles=
|
||||
PrivateResource=
|
||||
ResourceIncludes=
|
||||
MakeIncludes=
|
||||
Icon=
|
||||
ExeOutput=..\..\..\bin
|
||||
ObjectOutput=..\..\..\objs\Mingw\s_opengl
|
||||
OverrideOutput=0
|
||||
OverrideOutputName=s_openal.dll
|
||||
HostApplication=
|
||||
CommandLine=
|
||||
UseCustomMakefile=0
|
||||
CustomMakefile=
|
||||
IncludeVersionInfo=0
|
||||
SupportXPThemes=0
|
||||
CompilerSet=0
|
||||
CompilerSettings=0000000010001001001001
|
||||
|
||||
[Unit1]
|
||||
FileName=s_openal.c
|
||||
Folder=
|
||||
Compile=1
|
||||
CompileCpp=0
|
||||
Link=1
|
||||
Priority=1000
|
||||
OverrideBuildCmd=0
|
||||
BuildCmd=
|
||||
|
||||
[VersionInfo]
|
||||
Major=0
|
||||
Minor=1
|
||||
Release=1
|
||||
Build=1
|
||||
LanguageID=1033
|
||||
CharsetID=1252
|
||||
CompanyName=
|
||||
FileVersion=0.1
|
||||
FileDescription=Developed using the Dev-C++ IDE
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=s_openal.dll
|
||||
ProductName=s_openal
|
||||
ProductVersion=0.1
|
||||
AutoIncBuildNr=0
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="s_openal" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=s_openal - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "s_openal.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "s_openal.mak" CFG="s_openal - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "s_openal - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "s_openal - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "s_openal - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "..\..\..\bin\VC\Release\s_openal"
|
||||
# PROP Intermediate_Dir "..\..\..\objs\VC\Release\s_openal"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_OPENAL_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /win32
|
||||
# SUBTRACT MTL /mktyplib203
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 OpenAL32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Release\s_openal.pdb" /machine:I386 /out:"C:\srb2demo2\s_openal.dll"
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "s_openal - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "..\..\..\bin\VC\Debug\s_openal"
|
||||
# PROP Intermediate_Dir "..\..\..\objs\VC\Debug\s_openal"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "S_OPENAL_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WIN32__" /D "__MSC__" /D "_MBCS" /D "_USRDLL" /D "S_OPENAL_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 OpenAL32.lib /nologo /dll /pdb:"..\..\..\bin\VC\Debug\s_openal.pdb" /debug /machine:I386 /out:"C:\srb2demo2\s_openaldebug.dll" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "s_openal - Win32 Release"
|
||||
# Name "s_openal - Win32 Debug"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\s_openal.c
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
+18
-18
@@ -289,7 +289,7 @@ int
|
||||
HMS_register (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char post[256];
|
||||
|
||||
@@ -316,23 +316,23 @@ HMS_register (void)
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
|
||||
if (ok)
|
||||
if (okay)
|
||||
{
|
||||
hms_server_token = strdup(strtok(hms->buffer, "\n"));
|
||||
}
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
int
|
||||
HMS_unlist (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
hms = HMS_connect("servers/%s/unlist", hms_server_token);
|
||||
|
||||
@@ -342,19 +342,19 @@ HMS_unlist (void)
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POST, 1);
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
HMS_end(hms);
|
||||
|
||||
free(hms_server_token);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
int
|
||||
HMS_update (void)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char post[256];
|
||||
|
||||
@@ -376,10 +376,10 @@ HMS_update (void)
|
||||
|
||||
curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDS, post);
|
||||
|
||||
ok = HMS_do(hms);
|
||||
okay = HMS_do(hms);
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -488,7 +488,7 @@ int
|
||||
HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
{
|
||||
struct HMS_buffer *hms;
|
||||
int ok;
|
||||
int okay;
|
||||
|
||||
char *version;
|
||||
char *version_name;
|
||||
@@ -498,7 +498,7 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
if (! hms)
|
||||
return 0;
|
||||
|
||||
ok = 0;
|
||||
okay = 0;
|
||||
|
||||
if (HMS_do(hms))
|
||||
{
|
||||
@@ -510,16 +510,16 @@ HMS_compare_mod_version (char *buffer, size_t buffer_size)
|
||||
if (atoi(version) != MODVERSION)
|
||||
{
|
||||
strlcpy(buffer, version_name, buffer_size);
|
||||
ok = 1;
|
||||
okay = 1;
|
||||
}
|
||||
else
|
||||
ok = -1;
|
||||
okay = -1;
|
||||
}
|
||||
}
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return ok;
|
||||
return okay;
|
||||
}
|
||||
|
||||
const char *
|
||||
@@ -532,9 +532,9 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
if (! hms)
|
||||
return NULL;
|
||||
|
||||
boolean ok = HMS_do(hms);
|
||||
boolean okay = HMS_do(hms);
|
||||
|
||||
if (ok)
|
||||
if (okay)
|
||||
{
|
||||
char *p = strstr(hms->buffer, "\n\n");
|
||||
|
||||
@@ -552,7 +552,7 @@ HMS_fetch_rules (char *buffer, size_t buffer_size)
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
if (!ok)
|
||||
if (!okay)
|
||||
return NULL;
|
||||
|
||||
return buffer;
|
||||
|
||||
+106
-118
@@ -26,6 +26,7 @@
|
||||
#include "i_video.h"
|
||||
#include "i_system.h"
|
||||
|
||||
#include "r_fps.h"
|
||||
#include "st_stuff.h" // ST_HEIGHT
|
||||
#include "r_local.h"
|
||||
|
||||
@@ -69,7 +70,6 @@ patch_t *hu_font[HU_FONTSIZE];
|
||||
patch_t *kart_font[KART_FONTSIZE]; // SRB2kart
|
||||
patch_t *tny_font[HU_FONTSIZE];
|
||||
patch_t *tallnum[10]; // 0-9
|
||||
patch_t *nightsnum[10]; // 0-9
|
||||
|
||||
// Level title and credits fonts
|
||||
patch_t *lt_font[LT_FONTSIZE];
|
||||
@@ -100,24 +100,8 @@ patch_t *rflagico;
|
||||
patch_t *bflagico;
|
||||
patch_t *rmatcico;
|
||||
patch_t *bmatcico;
|
||||
patch_t *tagico;
|
||||
patch_t *tallminus;
|
||||
|
||||
//-------------------------------------------
|
||||
// coop hud
|
||||
//-------------------------------------------
|
||||
|
||||
patch_t *emeraldpics[7];
|
||||
patch_t *tinyemeraldpics[7];
|
||||
static patch_t *emblemicon;
|
||||
static patch_t *tokenicon;
|
||||
|
||||
//-------------------------------------------
|
||||
// misc vars
|
||||
//-------------------------------------------
|
||||
|
||||
// crosshair 0 = off, 1 = cross, 2 = angle, 3 = point, see m_menu.c
|
||||
static patch_t *crosshair[HU_CROSSHAIRS]; // 3 precached crosshair graphics
|
||||
// song credits
|
||||
static patch_t *songcreditbg;
|
||||
|
||||
@@ -381,8 +365,6 @@ void HU_LoadGraphics(void)
|
||||
{
|
||||
sprintf(buffer, "STTNUM%d", i);
|
||||
tallnum[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
sprintf(buffer, "NGTNUM%d", i);
|
||||
nightsnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
|
||||
sprintf(buffer, "PINGN%d", i);
|
||||
pingnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX);
|
||||
sprintf(buffer, "OPPRNK0%d", i);
|
||||
@@ -392,32 +374,6 @@ void HU_LoadGraphics(void)
|
||||
// minus for negative tallnums
|
||||
tallminus = (patch_t *)W_CachePatchName("STTMINUS", PU_HUDGFX);
|
||||
|
||||
// cache the crosshairs, don't bother to know which one is being used,
|
||||
// just cache all 3, they're so small anyway.
|
||||
for (i = 0; i < HU_CROSSHAIRS; i++)
|
||||
{
|
||||
sprintf(buffer, "CROSHAI%c", '1'+i);
|
||||
crosshair[i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX);
|
||||
}
|
||||
|
||||
emblemicon = W_CachePatchName("EMBLICON", PU_HUDGFX);
|
||||
tokenicon = W_CachePatchName("TOKNICON", PU_HUDGFX);
|
||||
|
||||
emeraldpics[0] = W_CachePatchName("CHAOS1", PU_HUDGFX);
|
||||
emeraldpics[1] = W_CachePatchName("CHAOS2", PU_HUDGFX);
|
||||
emeraldpics[2] = W_CachePatchName("CHAOS3", PU_HUDGFX);
|
||||
emeraldpics[3] = W_CachePatchName("CHAOS4", PU_HUDGFX);
|
||||
emeraldpics[4] = W_CachePatchName("CHAOS5", PU_HUDGFX);
|
||||
emeraldpics[5] = W_CachePatchName("CHAOS6", PU_HUDGFX);
|
||||
emeraldpics[6] = W_CachePatchName("CHAOS7", PU_HUDGFX);
|
||||
tinyemeraldpics[0] = W_CachePatchName("TEMER1", PU_HUDGFX);
|
||||
tinyemeraldpics[1] = W_CachePatchName("TEMER2", PU_HUDGFX);
|
||||
tinyemeraldpics[2] = W_CachePatchName("TEMER3", PU_HUDGFX);
|
||||
tinyemeraldpics[3] = W_CachePatchName("TEMER4", PU_HUDGFX);
|
||||
tinyemeraldpics[4] = W_CachePatchName("TEMER5", PU_HUDGFX);
|
||||
tinyemeraldpics[5] = W_CachePatchName("TEMER6", PU_HUDGFX);
|
||||
tinyemeraldpics[6] = W_CachePatchName("TEMER7", PU_HUDGFX);
|
||||
|
||||
songcreditbg = W_CachePatchName("K_SONGCR", PU_HUDGFX);
|
||||
|
||||
// cache ping gfx:
|
||||
@@ -1003,7 +959,7 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
|
||||
// run the lua hook even if we were supposed to eat the msg, netgame consistency goes first.
|
||||
|
||||
if (LUAh_PlayerMsg(playernum, target, flags, msg, spam_eatmsg))
|
||||
if (LUA_HookPlayerMsg(playernum, target, flags, msg, spam_eatmsg))
|
||||
return;
|
||||
|
||||
if (spam_eatmsg)
|
||||
@@ -1198,7 +1154,7 @@ void HU_Ticker(void)
|
||||
|| hu_redownloadinggamestate
|
||||
#endif
|
||||
)
|
||||
resynch_ticker++; //tic tic tic tic tic
|
||||
resynch_ticker++; //tic tic tic tic tic
|
||||
|
||||
HU_TickSongCredits();
|
||||
}
|
||||
@@ -2231,7 +2187,7 @@ void HU_DrawSongCredits(void)
|
||||
//
|
||||
void HU_Drawer(void)
|
||||
{
|
||||
if (cv_vhseffect.value && (paused || (demo.playback && cv_playbackspeed.value > 1)))
|
||||
if (cv_vhseffect.value && ((paused && !camera[R_GetViewNumber()].freecam) || (demo.playback && cv_playbackspeed.value > 1)))
|
||||
V_DrawVhsEffect(demo.rewinding);
|
||||
|
||||
#ifndef NONET
|
||||
@@ -2274,7 +2230,7 @@ void HU_Drawer(void)
|
||||
if (renderisnewtic)
|
||||
{
|
||||
LUA_HUD_ClearDrawList(luahuddrawlist_scores);
|
||||
LUAh_ScoresHUD(luahuddrawlist_scores);
|
||||
LUA_HUDHOOK(scores, luahuddrawlist_scores);
|
||||
}
|
||||
|
||||
LUA_HUD_DrawList(luahuddrawlist_scores);
|
||||
@@ -2289,22 +2245,6 @@ void HU_Drawer(void)
|
||||
if (gamestate != GS_LEVEL)
|
||||
return;
|
||||
|
||||
// draw the crosshair, not when viewing demos nor with chasecam
|
||||
/*if (!automapactive && !demo.playback)
|
||||
{
|
||||
if (cv_crosshair.value && !camera[0].chase && !players[displayplayers[0]].spectator)
|
||||
HU_DrawCrosshair();
|
||||
|
||||
if (cv_crosshair2.value && !camera[1].chase && !players[displayplayers[1]].spectator)
|
||||
HU_DrawCrosshair2();
|
||||
|
||||
if (cv_crosshair3.value && !camera[2].chase && !players[displayplayers[2]].spectator)
|
||||
HU_DrawCrosshair3();
|
||||
|
||||
if (cv_crosshair4.value && !camera[3].chase && !players[displayplayers[3]].spectator)
|
||||
HU_DrawCrosshair4();
|
||||
}*/
|
||||
|
||||
// draw song credits
|
||||
if (cv_songcredits.value)
|
||||
HU_DrawSongCredits();
|
||||
@@ -2416,92 +2356,138 @@ Ping_gfx_num (int lag)
|
||||
return 4;
|
||||
}
|
||||
|
||||
static int
|
||||
Ping_gfx_color (int lag)
|
||||
{
|
||||
if (lag < 2)
|
||||
return SKINCOLOR_JAWZ;
|
||||
else if (lag < 4)
|
||||
return SKINCOLOR_MINT;
|
||||
else if (lag < 7)
|
||||
return SKINCOLOR_GOLD;
|
||||
else if (lag < 10)
|
||||
return SKINCOLOR_RED;
|
||||
else
|
||||
return SKINCOLOR_WHITE; // SKINCOLOR_MAGENTA
|
||||
}
|
||||
|
||||
static const UINT8 *
|
||||
Ping_gfx_colormap (UINT32 lag, boolean gentleman)
|
||||
{
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
if (K_UseColorHud())
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, Ping_gfx_color(lag), GTC_CACHE);
|
||||
|
||||
if (servermaxping && lag > servermaxping && hu_tick < 4)
|
||||
{
|
||||
// flash ping red if too high
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
}
|
||||
else if (gentleman)
|
||||
{
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_PASTEL, GTC_CACHE);
|
||||
}
|
||||
|
||||
return colormap;
|
||||
}
|
||||
|
||||
static UINT32
|
||||
Ping_conversion (UINT32 lag)
|
||||
{
|
||||
if (cv_pingmeasurement.value)
|
||||
{
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
}
|
||||
|
||||
return lag;
|
||||
}
|
||||
|
||||
//
|
||||
// HU_drawPing
|
||||
//
|
||||
|
||||
void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags)
|
||||
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags)
|
||||
{
|
||||
UINT8 *colormap = NULL;
|
||||
INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
||||
INT32 gfxnum; // gfx to draw
|
||||
|
||||
|
||||
//SRB2/Kart v1.0 style
|
||||
UINT8 numbars = 0; // how many ping bars do we draw?
|
||||
UINT8 barcolor = 31; // color we use for the bars (green, yellow, red or black)
|
||||
SINT8 i = 0;
|
||||
SINT8 yoffset = 6;
|
||||
//INT32 dx;
|
||||
|
||||
gfxnum = Ping_gfx_num(lag);
|
||||
|
||||
if (!cv_pingstyle.value)
|
||||
UINT32 lag = playerpingtable[pnum];
|
||||
const boolean gentleman = (cv_mindelay.value && (lag < (tic_t)simulated_lag));
|
||||
|
||||
if (gentleman)
|
||||
{
|
||||
lag = simulated_lag;
|
||||
}
|
||||
|
||||
if (cv_pingstyle.value == 0) // kart
|
||||
{
|
||||
gfxnum = Ping_gfx_num(lag);
|
||||
|
||||
if (measureid == 1)
|
||||
V_DrawScaledPatch(x+11 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
|
||||
if (cv_pingicon.value)
|
||||
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
||||
|
||||
if (servermaxping && lag > servermaxping && hu_tick < 4)
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE); // flash ping red if too high
|
||||
|
||||
if (cv_pingmeasurement.value)
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, lag, colormap);
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+9, flags, Ping_conversion(lag), Ping_gfx_colormap(lag, gentleman));
|
||||
|
||||
if (measureid == 0)
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+9, flags, pingmeasure[measureid]);
|
||||
}
|
||||
else if (cv_pingstyle.value) // old style ping
|
||||
else if (cv_pingstyle.value == 1) // old style ping
|
||||
{
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
if (lag < 4)
|
||||
{
|
||||
numbars = 3;
|
||||
barcolor = 184;
|
||||
}
|
||||
else if (lag < 7)
|
||||
{
|
||||
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
|
||||
barcolor = 103;
|
||||
}
|
||||
else if (lag < 10)
|
||||
{
|
||||
numbars = 1;
|
||||
barcolor = 155; // need a better red
|
||||
}
|
||||
else // brazil
|
||||
{
|
||||
numbars = 0;
|
||||
barcolor = 31;
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingmeasurement.value)
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
|
||||
if (vid.width >= 640) // how sad, we're using a shit resolution.
|
||||
{
|
||||
if (measureid == 1)
|
||||
{
|
||||
//dx = x+1 - (V_SmallStringWidth(va("%dms", lag), V_ALLOWLOWERCASE|flags)/2);
|
||||
//V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE|flags, va("%dms", lag));
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", lag));
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, V_ALLOWLOWERCASE|flags, va("%dms", Ping_conversion(lag)));
|
||||
}
|
||||
else if (measureid == 0)
|
||||
{
|
||||
//dx = x+1 - (V_SmallStringWidth(va("d%d", lag), flags)/2);
|
||||
//V_DrawSmallString(dx, y+4, flags, va("d%d", lag));
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", lag));
|
||||
V_DrawRightAlignedSmallString(x+12, y+13, flags, va("d%d", Ping_conversion(lag)));
|
||||
}
|
||||
}
|
||||
|
||||
if (cv_pingicon.value)
|
||||
{
|
||||
for (i=0; (i<3); i++) // Draw the ping bar
|
||||
{
|
||||
switch (lag)
|
||||
{
|
||||
case 0 ... 1:
|
||||
numbars = 3;
|
||||
barcolor = 215; // Blue
|
||||
break;
|
||||
case 2 ... 3:
|
||||
numbars = 3;
|
||||
barcolor = 184; // Green
|
||||
break;
|
||||
case 4 ... 6:
|
||||
numbars = 2; // Apparently ternaries w/ multiple statements don't look good in C so I decided against it.
|
||||
barcolor = 103; // Yellow
|
||||
break;
|
||||
case 7 ... 9:
|
||||
numbars = 1;
|
||||
barcolor = 155; // Red
|
||||
break;
|
||||
default: // Brazil
|
||||
numbars = 0;
|
||||
barcolor = 31; // black
|
||||
break;
|
||||
}
|
||||
|
||||
if (gentleman)
|
||||
{
|
||||
barcolor = 194; // make it purplish
|
||||
// bars get indirectly set earlier
|
||||
}
|
||||
|
||||
for (i = 0; (i < 3); i++) // Draw the ping bar
|
||||
{
|
||||
V_DrawFill(x+2 *(i-1)+7, y+8+yoffset-4, 2, 8-yoffset, 31|flags);
|
||||
if (i < numbars)
|
||||
@@ -2595,8 +2581,10 @@ static inline void HU_DrawSpectatorTicker(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (netgame && i != serverplayer)
|
||||
HU_drawPing((templength - duptweak)+8, height-20, playerpingtable[i], V_TRANSLUCENT);
|
||||
if ((netgame && i != serverplayer) || (cv_mindelay.value && P_IsLocalPlayer(&players[i])))
|
||||
{
|
||||
HU_drawPlayerPing((templength - duptweak)+8, height-20, i, V_TRANSLUCENT);
|
||||
}
|
||||
}
|
||||
|
||||
if ((length += len) >= dupadjust+8)
|
||||
|
||||
+1
-7
@@ -42,8 +42,6 @@
|
||||
#define CRED_FONTEND 'Z' // the last font character
|
||||
#define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1)
|
||||
|
||||
#define HU_CROSSHAIRS 3 // maximum of 9 - see HU_Init();
|
||||
|
||||
extern char *shiftxform; // english translation shift table
|
||||
extern char english_shiftxform[];
|
||||
|
||||
@@ -90,18 +88,14 @@ extern patch_t *tallnum[10];
|
||||
extern patch_t *pingnum[10];
|
||||
extern patch_t *pinggfx[5];
|
||||
extern patch_t *ranknum[10];
|
||||
extern patch_t *nightsnum[10];
|
||||
extern patch_t *framecounter;
|
||||
extern patch_t *frameslash;
|
||||
extern patch_t *lt_font[LT_FONTSIZE];
|
||||
extern patch_t *cred_font[CRED_FONTSIZE];
|
||||
extern patch_t *emeraldpics[7];
|
||||
extern patch_t *tinyemeraldpics[7];
|
||||
extern patch_t *rflagico;
|
||||
extern patch_t *bflagico;
|
||||
extern patch_t *rmatcico;
|
||||
extern patch_t *bmatcico;
|
||||
extern patch_t *tagico;
|
||||
extern patch_t *tallminus;
|
||||
|
||||
// set true whenever the tab rankings are being shown for any reason
|
||||
@@ -125,7 +119,7 @@ void HU_Drawer(void);
|
||||
char HU_dequeueChatChar(void);
|
||||
void HU_Erase(void);
|
||||
void HU_clearChatChars(void);
|
||||
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, INT32 flags); // Lat': Ping drawer for scoreboard.
|
||||
void HU_drawPlayerPing(INT32 x, INT32 y, INT32 pnum, INT32 flags); // Lat': Ping drawer for scoreboard.
|
||||
//void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
|
||||
//void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
|
||||
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer, INT32 hilicol);
|
||||
|
||||
+1
-1
@@ -53,6 +53,6 @@ typedef struct JoyType_s JoyType_t;
|
||||
for palyer[sic] 1-4's joystick/gamepad
|
||||
*/
|
||||
|
||||
extern JoyType_t Joystick, Joystick2, Joystick3, Joystick4;
|
||||
extern JoyType_t Joystick[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
#endif // __I_JOY_H__
|
||||
@@ -82,18 +82,10 @@ extern holepunch_t *holepunchpacket;
|
||||
*/
|
||||
extern boolean (*I_NetGet)(void);
|
||||
|
||||
/** \brief ask to driver if there is data waiting
|
||||
*/
|
||||
extern boolean (*I_NetCanGet)(void);
|
||||
|
||||
/** \brief send packet within doomcom struct
|
||||
*/
|
||||
extern void (*I_NetSend)(void);
|
||||
|
||||
/** \brief ask to driver if all is ok to send data now
|
||||
*/
|
||||
extern boolean (*I_NetCanSend)(void);
|
||||
|
||||
/** \brief close a connection
|
||||
|
||||
\param nodenum node to be closed
|
||||
|
||||
+11
-25
@@ -202,9 +202,13 @@ void I_JoyScale4(void);
|
||||
|
||||
// Called by D_SRB2Main.
|
||||
|
||||
/** \brief to startup joystick
|
||||
*/
|
||||
void I_InitJoystick(UINT8 index);
|
||||
|
||||
/** \brief to startup the first joystick
|
||||
*/
|
||||
void I_InitJoystick(void);
|
||||
void I_InitJoystick1(void);
|
||||
|
||||
/** \brief to startup the second joystick
|
||||
*/
|
||||
@@ -222,6 +226,8 @@ void I_InitJoystick4(void);
|
||||
*/
|
||||
INT32 I_NumJoys(void);
|
||||
|
||||
extern INT32 numcontrollers;
|
||||
|
||||
/** \brief The *I_GetJoyName function
|
||||
|
||||
\param joyindex which joystick
|
||||
@@ -230,8 +236,8 @@ INT32 I_NumJoys(void);
|
||||
*/
|
||||
const char *I_GetJoyName(INT32 joyindex);
|
||||
|
||||
void I_GamepadRumble(INT32 device_id, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
|
||||
void I_SetGamepadIndicatorColor(INT32 device_id, UINT8 red, UINT8 green, UINT8 blue);
|
||||
void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, UINT32 duration);
|
||||
void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 blue);
|
||||
|
||||
#ifndef NOMUMBLE
|
||||
#include "p_mobj.h" // mobj_t
|
||||
@@ -245,10 +251,6 @@ void I_UpdateMumble(const mobj_t *mobj, const listener_t listener);
|
||||
*/
|
||||
void I_StartupMouse(void);
|
||||
|
||||
/** \brief Startup the second mouse
|
||||
*/
|
||||
void I_StartupMouse2(void);
|
||||
|
||||
/** \brief setup timer irq and user timer routine.
|
||||
*/
|
||||
void I_StartupTimer(void);
|
||||
@@ -307,25 +309,9 @@ INT32 I_mkdir(const char *dirname, INT32 unixright);
|
||||
*/
|
||||
const char *I_LocateWad(void);
|
||||
|
||||
/** \brief First Joystick's events
|
||||
/** \brief Joystick events
|
||||
*/
|
||||
void I_GetJoystickEvents(void);
|
||||
|
||||
/** \brief Second Joystick's events
|
||||
*/
|
||||
void I_GetJoystick2Events(void);
|
||||
|
||||
/** \brief Third Joystick's events
|
||||
*/
|
||||
void I_GetJoystick3Events(void);
|
||||
|
||||
/** \brief Fourth Joystick's events
|
||||
*/
|
||||
void I_GetJoystick4Events(void);
|
||||
|
||||
/** \brief Mouses events
|
||||
*/
|
||||
void I_GetMouseEvents(void);
|
||||
void I_GetJoystickEvents(UINT8 index);
|
||||
|
||||
char *I_GetEnv(const char *name);
|
||||
|
||||
|
||||
+6
-79
@@ -168,7 +168,6 @@ static UINT8 UPNP_support = TRUE;
|
||||
#endif
|
||||
|
||||
#include "i_addrinfo.h"
|
||||
#define SELECTTEST
|
||||
|
||||
#define DEFAULTPORT "5029"
|
||||
|
||||
@@ -750,59 +749,6 @@ static boolean SOCK_Get(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// check if we can send (do not go over the buffer)
|
||||
#ifndef NONET
|
||||
|
||||
static fd_set masterset;
|
||||
|
||||
#ifdef SELECTTEST
|
||||
static boolean FD_CPY(fd_set *src, fd_set *dst, SOCKET_TYPE *fd, size_t len)
|
||||
{
|
||||
size_t i;
|
||||
boolean testset = false;
|
||||
FD_ZERO(dst);
|
||||
for (i = 0; i < len;i++)
|
||||
{
|
||||
if(fd[i] != (SOCKET_TYPE)ERRSOCKET &&
|
||||
FD_ISSET(fd[i], src) && !FD_ISSET(fd[i], dst)) // no checking for dups
|
||||
{
|
||||
FD_SET(fd[i], dst);
|
||||
testset = true;
|
||||
}
|
||||
}
|
||||
return testset;
|
||||
}
|
||||
|
||||
static boolean SOCK_CanSend(void)
|
||||
{
|
||||
struct timeval timeval_for_select = {0, 0};
|
||||
fd_set tset;
|
||||
int wselect;
|
||||
|
||||
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
|
||||
return false;
|
||||
wselect = select(255, NULL, &tset, NULL, &timeval_for_select);
|
||||
if (wselect >= 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean SOCK_CanGet(void)
|
||||
{
|
||||
struct timeval timeval_for_select = {0, 0};
|
||||
fd_set tset;
|
||||
int rselect;
|
||||
|
||||
if(!FD_CPY(&masterset, &tset, mysockets, mysocketses))
|
||||
return false;
|
||||
rselect = select(255, &tset, NULL, NULL, &timeval_for_select);
|
||||
if (rselect >= 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NONET
|
||||
static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr)
|
||||
{
|
||||
@@ -877,7 +823,7 @@ static void SOCK_Send(void)
|
||||
}
|
||||
}
|
||||
#undef ALLOWEDERROR
|
||||
#endif
|
||||
#endif //NONET
|
||||
|
||||
#ifndef NONET
|
||||
static void SOCK_FreeNodenum(INT32 numnode)
|
||||
@@ -1029,7 +975,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = ERRSOCKET;
|
||||
for (s = 0; s < MAXNETNODES+1; s++)
|
||||
nodesocket[s] = ERRSOCKET;
|
||||
FD_ZERO(&masterset);
|
||||
s = 0;
|
||||
|
||||
memset(&hints, 0x00, sizeof (hints));
|
||||
@@ -1056,7 +1001,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
}
|
||||
@@ -1077,7 +1021,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
#ifdef HAVE_MINIUPNPC
|
||||
@@ -1110,7 +1053,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
}
|
||||
@@ -1131,7 +1073,6 @@ static boolean UDP_Socket(void)
|
||||
mysockets[s] = UDP_Bind(runp->ai_family, runp->ai_addr, (socklen_t)runp->ai_addrlen);
|
||||
if (mysockets[s] != (SOCKET_TYPE)ERRSOCKET)
|
||||
{
|
||||
FD_SET(mysockets[s], &masterset);
|
||||
myfamily[s] = hints.ai_family;
|
||||
s++;
|
||||
}
|
||||
@@ -1298,16 +1239,15 @@ boolean I_InitTcpDriver(void)
|
||||
static void SOCK_CloseSocket(void)
|
||||
{
|
||||
size_t i;
|
||||
for (i=0; i < MAXNETNODES+1; i++)
|
||||
|
||||
for (i = 0; i < mysocketses; i++)
|
||||
{
|
||||
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET
|
||||
&& FD_ISSET(mysockets[i], &masterset))
|
||||
{
|
||||
FD_CLR(mysockets[i], &masterset);
|
||||
if (mysockets[i] != (SOCKET_TYPE)ERRSOCKET)
|
||||
close(mysockets[i]);
|
||||
}
|
||||
mysockets[i] = ERRSOCKET;
|
||||
}
|
||||
|
||||
mysocketses = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1417,9 +1357,7 @@ static void rendezvous(int size)
|
||||
|
||||
if (tic == refreshtic)
|
||||
{
|
||||
#ifdef HOLEPUNCH
|
||||
holepunchpacket->magic = hole_punch_magic;
|
||||
#endif
|
||||
sendto(mysockets[0], doomcom->data, size, 0, &rzv.any, sizeof rzv.ip4);
|
||||
}
|
||||
|
||||
@@ -1444,7 +1382,6 @@ static void SOCK_RegisterHolePunch(void)
|
||||
rendezvous(4);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static boolean SOCK_OpenSocket(void)
|
||||
@@ -1464,13 +1401,7 @@ static boolean SOCK_OpenSocket(void)
|
||||
I_NetFreeNodenum = SOCK_FreeNodenum;
|
||||
I_NetMakeNodewPort = SOCK_NetMakeNodewPort;
|
||||
|
||||
#ifdef SELECTTEST
|
||||
// seem like not work with libsocket : (
|
||||
I_NetCanSend = SOCK_CanSend;
|
||||
I_NetCanGet = SOCK_CanGet;
|
||||
#endif
|
||||
#ifdef HOLEPUNCH
|
||||
|
||||
I_NetRequestHolePunch = SOCK_RequestHolePunch;
|
||||
I_NetRegisterHolePunch = SOCK_RegisterHolePunch;
|
||||
#endif
|
||||
@@ -1738,7 +1669,6 @@ boolean I_InitTcpNetwork(void)
|
||||
// server address only in ip
|
||||
if (serverhostname[0])
|
||||
{
|
||||
CV_Set(&cv_lastserver, serverhostname);
|
||||
COM_BufAddText("connect \"");
|
||||
COM_BufAddText(serverhostname);
|
||||
COM_BufAddText("\"\n");
|
||||
@@ -1748,9 +1678,6 @@ boolean I_InitTcpNetwork(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not quite sure if we want to save that but i'll do that for now
|
||||
CV_Set(&cv_lastserver, "any");
|
||||
|
||||
// so we're on a LAN
|
||||
COM_BufAddText("connect any\n");
|
||||
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ void I_UpdateTime(fixed_t timescale)
|
||||
ticratescaled = (double)TICRATE * FIXED_TO_FLOAT(timescale);
|
||||
|
||||
enterprecise = I_GetPreciseTime();
|
||||
elapsedseconds = (double)(enterprecise - oldenterprecise) / I_GetPrecisePrecision();
|
||||
elapsedseconds = (double)((INT64)enterprecise - oldenterprecise) / I_GetPrecisePrecision();
|
||||
tictimer += elapsedseconds;
|
||||
while (tictimer > 1.0/ticratescaled)
|
||||
{
|
||||
|
||||
+2
-3
@@ -139,10 +139,9 @@ UINT32 I_GetRefreshRate(void);
|
||||
|
||||
boolean I_UseNativeKeyboard(void);
|
||||
|
||||
boolean I_CheckNativeRes(void);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
#if defined (__unix__)
|
||||
extern boolean xwaylandcrap;
|
||||
#endif
|
||||
|
||||
void RefreshOGLSDLSurface(void);
|
||||
void I_DownSample(void);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "d_player.h"
|
||||
#include "lzf.h"
|
||||
|
||||
// Hey, moron! If you change this table, don't forget about the sprite enum in info.h and the sprite lights in hw_light.c!
|
||||
char sprnames[NUMSPRITES + 1][5] =
|
||||
{
|
||||
"NULL","UNKN","THOK","PLAY","POSS","SPOS","FISH","BUZZ","RBUZ","JETB",
|
||||
|
||||
@@ -159,9 +159,6 @@ enum actionnum
|
||||
A_SPAWNOBJECTRELATIVE,
|
||||
A_CHANGEANGLERELATIVE,
|
||||
A_CHANGEANGLEABSOLUTE,
|
||||
A_ROLLANGLE,
|
||||
A_CHANGEROLLANGLERELATIVE,
|
||||
A_CHANGEROLLANGLEABSOLUTE,
|
||||
A_PLAYSOUND,
|
||||
A_FINDTARGET,
|
||||
A_FINDTRACER,
|
||||
@@ -460,7 +457,6 @@ extern boolean actionsoverridden[NUMACTIONS];
|
||||
#define NUMSPRITEFREESLOTS NUMMOBJFREESLOTS
|
||||
#define NUMSTATEFREESLOTS (NUMMOBJFREESLOTS*8)
|
||||
|
||||
// Hey, moron! If you change this table, don't forget about sprnames in info.c and the sprite lights in hw_light.c!
|
||||
typedef enum sprite
|
||||
{
|
||||
SPR_NULL, // invisible object
|
||||
|
||||
+22
-41
@@ -12,6 +12,7 @@
|
||||
|
||||
//#include "k_kart.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
#include "v_video.h"
|
||||
#include "k_director.h"
|
||||
@@ -28,6 +29,7 @@
|
||||
|
||||
struct directorinfo
|
||||
{
|
||||
player_t* viewplayer;
|
||||
tic_t cooldown; // how long has it been since we last switched?
|
||||
tic_t freeze; // when nonzero, fixed switch pending, freeze logic!
|
||||
INT32 attacker; // who to switch to when freeze delay elapses
|
||||
@@ -38,25 +40,6 @@ struct directorinfo
|
||||
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
|
||||
} directorinfo;
|
||||
|
||||
boolean K_DirectorIsPlayerAlone(void)
|
||||
{
|
||||
UINT8 pingame = 0;
|
||||
|
||||
// Gotta check how many players are active at this moment.
|
||||
for (UINT8 i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i] || players[i].spectator)
|
||||
continue;
|
||||
|
||||
pingame++;
|
||||
|
||||
if (pingame >= 2) // we dont need to check further
|
||||
break;
|
||||
}
|
||||
|
||||
return (pingame <= 1);
|
||||
}
|
||||
|
||||
static inline boolean race_rules(void)
|
||||
{
|
||||
return gametype == GT_RACE;
|
||||
@@ -67,9 +50,16 @@ static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
|
||||
return FixedMul(n, FixedDiv(scale, mapobjectscale));
|
||||
}
|
||||
|
||||
boolean K_DirectorIsAvailable(void)
|
||||
{
|
||||
if (splitscreen || (demo.playback && demo.title) || modeattacking)
|
||||
return false;
|
||||
return ((gamestate == GS_LEVEL) && ((demo.playback && !camera[0].freecam) || (players[consoleplayer].spectator && (D_NumPlayers() > 1))));
|
||||
}
|
||||
|
||||
static boolean K_DirectorIsEnabled(void)
|
||||
{
|
||||
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (((!playeringame[consoleplayer] || players[consoleplayer].spectator)) || (demo.playback && !demo.freecam && (!demo.title || !modeattacking))) && !K_DirectorIsPlayerAlone());
|
||||
return (cv_director.value && K_DirectorIsAvailable());
|
||||
}
|
||||
|
||||
void K_InitDirector(void)
|
||||
@@ -80,6 +70,7 @@ void K_InitDirector(void)
|
||||
directorinfo.freeze = 0;
|
||||
directorinfo.attacker = 0;
|
||||
directorinfo.maxdist = 0;
|
||||
directorinfo.viewplayer = NULL;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
@@ -104,8 +95,8 @@ static fixed_t K_GetDistanceToFinish(player_t player)
|
||||
continue;
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -124,7 +115,7 @@ static fixed_t K_GetDistanceToFinish(player_t player)
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(mo->x - player.mo->x,
|
||||
mo->y - player.mo->y),
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
mo->z - player.mo->z) / FRACUNIT;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -213,11 +204,6 @@ static void K_DirectorSwitch(INT32 player, boolean force)
|
||||
return;
|
||||
}
|
||||
|
||||
if (P_IsDisplayPlayer(&players[player]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (players[player].exiting)
|
||||
{
|
||||
return;
|
||||
@@ -250,7 +236,7 @@ void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!P_IsDisplayPlayer(player))
|
||||
if (directorinfo.viewplayer != player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -319,8 +305,8 @@ void K_DrawDirectorDebugger(void)
|
||||
|
||||
void K_UpdateDirector(void)
|
||||
{
|
||||
INT32 *displayplayerp = &displayplayers[0];
|
||||
INT32 targetposition;
|
||||
directorinfo.viewplayer = &players[displayplayers[0]];
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
@@ -391,25 +377,19 @@ void K_UpdateDirector(void)
|
||||
target = directorinfo.sortedplayers[targetposition];
|
||||
|
||||
// stop here since we're already viewing this player
|
||||
if (*displayplayerp == target)
|
||||
if (displayplayers[0] == target)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// if this is a splitscreen player, try next pair
|
||||
if (P_IsDisplayPlayer(&players[target]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// if we're certain the back half of the pair is actually in this position, try to switch
|
||||
if (!players[target].kartstuff[k_positiondelay])
|
||||
{
|
||||
K_DirectorSwitch(target, false);
|
||||
}
|
||||
|
||||
// even if we're not certain, if we're certain we're watching the WRONG player, try to switch
|
||||
if (players[*displayplayerp].kartstuff[k_position] != targetposition+1 && !players[*displayplayerp].kartstuff[k_positiondelay])
|
||||
// even if we're not certain, if we're cetain we're watching the WRONG player, try to switch
|
||||
if (directorinfo.viewplayer->kartstuff[k_position] != targetposition+1 && !directorinfo.viewplayer->kartstuff[k_positiondelay])
|
||||
{
|
||||
K_DirectorSwitch(target, false);
|
||||
}
|
||||
@@ -420,15 +400,16 @@ void K_UpdateDirector(void)
|
||||
|
||||
void K_ToggleDirector(void)
|
||||
{
|
||||
if (!directortextactive)
|
||||
if (!K_DirectorIsAvailable())
|
||||
return;
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
G_AdjustView(1, 1, true);
|
||||
directorinfo.cooldown = 0; // switch immediately
|
||||
}
|
||||
|
||||
directortoggletimer = 0;
|
||||
|
||||
COM_ImmedExecute("add director 1");
|
||||
CV_SetValue(&cv_director, (cv_director.value ^ 1));
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
/// \file k_director.h
|
||||
/// \brief SRB2kart automatic spectator camera.
|
||||
|
||||
boolean K_DirectorIsAvailable(void);
|
||||
void K_InitDirector(void);
|
||||
void K_UpdateDirector(void);
|
||||
void K_DrawDirectorDebugger(void);
|
||||
|
||||
+1157
-605
File diff suppressed because it is too large.
Load diff
+12
-6
@@ -11,6 +11,7 @@
|
||||
|
||||
#define KART_FULLTURN 800
|
||||
|
||||
|
||||
extern UINT8 colortranslations[MAXTRANSLATIONS][16];
|
||||
extern const char *KartColor_Names[MAXSKINCOLORS];
|
||||
extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2];
|
||||
@@ -22,20 +23,25 @@ boolean K_UseColorHud(void);
|
||||
|
||||
void K_RegisterKartStuff(void);
|
||||
|
||||
extern consvar_t cv_colorizedhud;
|
||||
extern consvar_t cv_colorizeditembox;
|
||||
extern consvar_t cv_colorizedhudcolor;
|
||||
extern consvar_t cv_coloredspeedlines, cv_coloredsneakertrail;
|
||||
extern consvar_t cv_bananajitter;
|
||||
extern consvar_t cv_bananthrowroll;
|
||||
extern consvar_t cv_airsparks;
|
||||
extern consvar_t cv_colorizedhud, cv_colorizeditembox, cv_colorizedhudcolor;
|
||||
extern consvar_t cv_darkitembox;
|
||||
extern consvar_t cv_biglaps;
|
||||
extern consvar_t cv_highresportrait;
|
||||
extern consvar_t cv_stat_xoffset;
|
||||
extern consvar_t cv_stat_yoffset;
|
||||
extern consvar_t cv_stat_xoffset, cv_stat_yoffset;
|
||||
extern consvar_t cv_showstats;
|
||||
extern consvar_t cv_fancyroulette;
|
||||
extern consvar_t cv_showlaptimes;
|
||||
extern consvar_t cv_battlespeedo;
|
||||
extern consvar_t cv_multiitemicon;
|
||||
extern consvar_t cv_huditemamount;
|
||||
|
||||
#define NUMSPEEDOSTUFF 6
|
||||
extern CV_PossibleValue_t speedo_cons_t[NUMSPEEDOSTUFF];
|
||||
extern CV_PossibleValue_t driftgaugestyle_cons_t[NUMSPEEDOSTUFF];
|
||||
|
||||
boolean K_IsPlayerLosing(player_t *player);
|
||||
boolean K_IsPlayerWanted(player_t *player);
|
||||
@@ -55,7 +61,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||
void K_StealBumper(player_t *player, player_t *victim, boolean force);
|
||||
void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source);
|
||||
void K_SpawnMineExplosion(mobj_t *source, UINT8 color);
|
||||
void K_RollMobjBySlopes(mobj_t *mo, boolean usedistance);
|
||||
void K_RollMobjBySlopes(mobj_t *mo, pslope_t *slope);
|
||||
void K_SpawnBoostTrail(player_t *player);
|
||||
void K_SpawnSparkleTrail(mobj_t *mo);
|
||||
void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent);
|
||||
|
||||
@@ -1910,15 +1910,6 @@ msgstr ""
|
||||
msgid " Not found: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: hardware/s_ds3d/s_ds3d.c:617 p_tick.c:168 sdl/i_sound.c:1347
|
||||
#: win32/win_snd.c:1073 win32/win_snd.c:1431
|
||||
msgid "Done\n"
|
||||
msgstr ""
|
||||
|
||||
#: hardware/s_ds3d/s_ds3d.c:617 win32/win_snd.c:1073
|
||||
msgid "Failed\n"
|
||||
msgstr ""
|
||||
|
||||
#: hu_stuff.c:375
|
||||
msgid "The chat is muted. You can't say anything at the moment.\n"
|
||||
msgstr ""
|
||||
@@ -3174,21 +3165,6 @@ msgstr ""
|
||||
msgid "I_ShutdownMusic: "
|
||||
msgstr ""
|
||||
|
||||
#: sdl/i_sound.c:1494
|
||||
msgid " disabled loading FMOD\n"
|
||||
msgstr ""
|
||||
|
||||
#: sdl/i_sound.c:1513
|
||||
msgid " failed to load FMOD\n"
|
||||
msgstr ""
|
||||
|
||||
#: sdl/i_sound.c:1522 win32/win_snd.c:1237
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Wrong FMOD DLL version.\n"
|
||||
"You should be using FMOD %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: sdl/i_sound.c:1611
|
||||
msgid "I_InitMusic:"
|
||||
msgstr ""
|
||||
@@ -3803,12 +3779,6 @@ msgstr ""
|
||||
msgid "%d mixer devices available\n"
|
||||
msgstr ""
|
||||
|
||||
#: win32/win_snd.c:1227
|
||||
msgid ""
|
||||
" failed to load FMOD\n"
|
||||
" no DigiMusic support\n"
|
||||
msgstr ""
|
||||
|
||||
#: win32/win_snd.c:1289
|
||||
msgid "No MIDI devices available, music is disabled\n"
|
||||
msgstr ""
|
||||
|
||||
@@ -1994,15 +1994,6 @@ msgstr ""
|
||||
msgid " Not found: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: hardware/s_ds3d/s_ds3d.c:617 p_tick.c:168 sdl/i_sound.c:1347
|
||||
#: win32/win_snd.c:1071 win32/win_snd.c:1429
|
||||
msgid "Done\n"
|
||||
msgstr ""
|
||||
|
||||
#: hardware/s_ds3d/s_ds3d.c:617 win32/win_snd.c:1071
|
||||
msgid "Failed\n"
|
||||
msgstr ""
|
||||
|
||||
#: hu_stuff.c:405
|
||||
msgid "The chat is muted. You can't say anything at the moment.\n"
|
||||
msgstr ""
|
||||
@@ -3377,21 +3368,6 @@ msgstr ""
|
||||
msgid "I_ShutdownMusic: "
|
||||
msgstr ""
|
||||
|
||||
#: sdl/i_sound.c:1494
|
||||
msgid " disabled loading FMOD\n"
|
||||
msgstr ""
|
||||
|
||||
#: sdl/i_sound.c:1513
|
||||
msgid " failed to load FMOD\n"
|
||||
msgstr ""
|
||||
|
||||
#: sdl/i_sound.c:1522 win32/win_snd.c:1235
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Wrong FMOD DLL version.\n"
|
||||
"You should be using FMOD %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: sdl/i_sound.c:1611
|
||||
msgid "I_InitMusic:"
|
||||
msgstr ""
|
||||
@@ -3999,12 +3975,6 @@ msgstr ""
|
||||
msgid "%d mixer devices available\n"
|
||||
msgstr ""
|
||||
|
||||
#: win32/win_snd.c:1225
|
||||
msgid ""
|
||||
" failed to load FMOD\n"
|
||||
" no DigiMusic support\n"
|
||||
msgstr ""
|
||||
|
||||
#: win32/win_snd.c:1287
|
||||
msgid "No MIDI devices available, music is disabled\n"
|
||||
msgstr ""
|
||||
|
||||
+15
-3
@@ -1109,6 +1109,18 @@ static int lib_pCheckSight(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// DONT USE THIS FOR ANYTHING GAMEPLAY, THIS WILL DESYNCH!
|
||||
static int lib_pCheckSightFast(lua_State *L)
|
||||
{
|
||||
mobj_t *t1 = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
mobj_t *t2 = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
|
||||
//HUDSAFE?
|
||||
if (!t1 || !t2)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
lua_pushboolean(L, P_CheckSightFast(t1, t2));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lib_pCheckHoopPosition(lua_State *L)
|
||||
{
|
||||
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
@@ -1817,7 +1829,7 @@ static int lib_sStartSoundAtVolume(lua_State *L)
|
||||
return LUA_ErrInvalid(L, "player_t");
|
||||
}
|
||||
if (!player || P_IsLocalPlayer(player))
|
||||
S_StartSoundAtVolume(origin, sound_id, volume);
|
||||
S_StartSoundAtVolume(origin, sound_id, volume);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1919,7 +1931,7 @@ static int lib_sChangeMusic(lua_State *L)
|
||||
music_flags = (UINT16)((music_num & 0x7FFF0000) >> 16);
|
||||
else
|
||||
#endif
|
||||
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||
music_flags = (UINT16)luaL_optinteger(L, 4, 0);
|
||||
|
||||
position = (UINT32)luaL_optinteger(L, 5, 0);
|
||||
prefadems = (UINT32)luaL_optinteger(L, 6, 0);
|
||||
@@ -3154,7 +3166,6 @@ static luaL_Reg lib[] = {
|
||||
{"P_LookForEnemies",lib_pLookForEnemies},
|
||||
{"P_NukeEnemies",lib_pNukeEnemies},
|
||||
{"P_HomingAttack",lib_pHomingAttack},
|
||||
//{"P_SuperReady",lib_pSuperReady},
|
||||
{"P_Telekinesis",lib_pTelekinesis},
|
||||
|
||||
// p_map
|
||||
@@ -3167,6 +3178,7 @@ static luaL_Reg lib[] = {
|
||||
{"P_SlideMove",lib_pSlideMove},
|
||||
{"P_BounceMove",lib_pBounceMove},
|
||||
{"P_CheckSight", lib_pCheckSight},
|
||||
{"P_CheckSightFast", lib_pCheckSightFast},
|
||||
{"P_CheckHoopPosition",lib_pCheckHoopPosition},
|
||||
{"P_RadiusAttack",lib_pRadiusAttack},
|
||||
{"P_FloorzAtPos",lib_pFloorzAtPos},
|
||||
|
||||
@@ -169,7 +169,7 @@ void COM_Lua_f(void)
|
||||
for (i = 0; i < argc; i++)
|
||||
WRITESTRINGN(p, COM_Argv(i), 255);
|
||||
if (flags & 2)
|
||||
SendNetXCmd2(XD_LUACMD, buf, p-buf);
|
||||
SendNetXCmdForPlayer(1, XD_LUACMD, buf, p-buf);
|
||||
else
|
||||
SendNetXCmd(XD_LUACMD, buf, p-buf);
|
||||
free(buf);
|
||||
|
||||
+116
-92
@@ -12,105 +12,129 @@
|
||||
|
||||
#include "r_defs.h"
|
||||
#include "d_player.h"
|
||||
#include "s_sound.h"
|
||||
#include "lua_hudlib_drawlist.h"
|
||||
|
||||
enum hook {
|
||||
hook_NetVars=0,
|
||||
hook_MapChange,
|
||||
hook_MapLoad,
|
||||
hook_PlayerJoin,
|
||||
hook_PreThinkFrame,
|
||||
hook_ThinkFrame,
|
||||
hook_PostThinkFrame,
|
||||
hook_MobjSpawn,
|
||||
hook_MobjCollide,
|
||||
hook_MobjMoveCollide,
|
||||
hook_TouchSpecial,
|
||||
hook_MobjFuse,
|
||||
hook_MobjThinker,
|
||||
hook_BossThinker,
|
||||
hook_ShouldDamage,
|
||||
hook_MobjDamage,
|
||||
hook_MobjDeath,
|
||||
hook_BossDeath,
|
||||
hook_MobjRemoved,
|
||||
hook_JumpSpecial,
|
||||
hook_AbilitySpecial,
|
||||
hook_SpinSpecial,
|
||||
hook_JumpSpinSpecial,
|
||||
hook_BotTiccmd,
|
||||
hook_BotAI,
|
||||
hook_LinedefExecute,
|
||||
hook_PlayerMsg,
|
||||
hook_HurtMsg,
|
||||
hook_PlayerSpawn,
|
||||
hook_PlayerQuit,
|
||||
hook_PlayerThink,
|
||||
hook_MusicChange,
|
||||
hook_ShouldSpin, //SRB2KART
|
||||
hook_ShouldExplode, //SRB2KART
|
||||
hook_ShouldSquish, //SRB2KART
|
||||
hook_PlayerSpin, //SRB2KART
|
||||
hook_PlayerExplode, //SRB2KART
|
||||
hook_PlayerSquish, //SRB2KART
|
||||
hook_PlayerCmd, //SRB2KART
|
||||
hook_IntermissionThinker, //SRB2KART
|
||||
hook_VoteThinker, //SRB2KART
|
||||
hook_ServerJoin, // SRB2KART - Saturn 32p
|
||||
/*
|
||||
* Do you know what an 'X Macro' is? Such a macro is called over each element of
|
||||
* a list and expands the input. I use it for the hook lists because both an enum
|
||||
* and array of hook names need to be kept in order. The X Macro handles this
|
||||
* automatically.
|
||||
*/
|
||||
|
||||
hook_MAX // last hook
|
||||
};
|
||||
extern const char *const hookNames[];
|
||||
#define MOBJ_HOOK_LIST(X) \
|
||||
X (MobjSpawn),/* P_SpawnMobj */\
|
||||
X (MobjCollide),/* PIT_CheckThing */\
|
||||
X (MobjMoveCollide),/* tritto */\
|
||||
X (TouchSpecial),/* P_TouchSpecialThing */\
|
||||
X (MobjFuse),/* when mobj->fuse runs out */\
|
||||
X (MobjThinker),/* P_MobjThinker, P_SceneryThinker */\
|
||||
X (BossThinker),/* P_GenericBossThinker */\
|
||||
X (ShouldDamage),/* P_DamageMobj (Should mobj take damage?) */\
|
||||
X (MobjDamage),/* P_DamageMobj (Mobj actually takes damage!) */\
|
||||
X (MobjDeath),/* P_KillMobj */\
|
||||
X (BossDeath),/* A_BossDeath */\
|
||||
X (MobjRemoved),/* P_RemoveMobj */\
|
||||
X (HurtMsg),/* imhurttin */\
|
||||
|
||||
#define HOOK_LIST(X) \
|
||||
X (NetVars),/* add to archive table (netsave) */\
|
||||
X (MapChange),/* (before map load) */\
|
||||
X (MapLoad),\
|
||||
X (PlayerJoin),/* Got_AddPlayer */\
|
||||
X (PreThinkFrame)/* frame (before mobj and player thinkers) */,\
|
||||
X (ThinkFrame),/* frame (after mobj and player thinkers) */\
|
||||
X (PostThinkFrame),/* frame (at end of tick, ie after overlays, precipitation, specials) */\
|
||||
X (JumpSpecial),/* P_DoJumpStuff (Any-jumping) */\
|
||||
X (AbilitySpecial),/* P_DoJumpStuff (Double-jumping) */\
|
||||
X (SpinSpecial),/* P_DoSpinAbility (Spin button effect) */\
|
||||
X (JumpSpinSpecial),/* P_DoJumpStuff (Spin button effect (mid-air)) */\
|
||||
X (BotTiccmd),/* B_BuildTiccmd */\
|
||||
X (PlayerMsg),/* chat messages */\
|
||||
X (PlayerSpawn),/* G_SpawnPlayer */\
|
||||
X (PlayerQuit),\
|
||||
X (PlayerThink),/* P_PlayerThink */\
|
||||
X (MusicChange),\
|
||||
X (ShouldSpin),/*SRB2KART*/\
|
||||
X (ShouldExplode),/*SRB2KART*/\
|
||||
X (ShouldSquish),/*SRB2KART*/\
|
||||
X (PlayerSpin),/*SRB2KART*/\
|
||||
X (PlayerExplode),/*SRB2KART*/\
|
||||
X (PlayerSquish),/*SRB2KART*/\
|
||||
X (PlayerCmd),/* building the player's ticcmd struct (Ported from SRB2Kart) */\
|
||||
X (IntermissionThinker),/* Y_Ticker */\
|
||||
X (VoteThinker),/*SRB2KART*/\
|
||||
X (ServerJoin),/* SRB2KART - Saturn 32p*/\
|
||||
|
||||
#define STRING_HOOK_LIST(X) \
|
||||
X (BotAI),/* B_BuildTailsTiccmd by skin name */\
|
||||
X (LinedefExecute),\
|
||||
|
||||
#define HUD_HOOK_LIST(X) \
|
||||
X (game),\
|
||||
X (scores),/* emblems/multiplayer list */\
|
||||
X (intermission),\
|
||||
X (vote),\
|
||||
|
||||
/*
|
||||
* I chose to access the hook enums through a macro as well. This could provide
|
||||
* a hint to lookup the macro's definition instead of the enum's definition.
|
||||
* (Since each enumeration is not defined in the source code, but by the list
|
||||
* macros above, it is not greppable.) The name passed to the macro can also be
|
||||
* grepped and found in the lists above.
|
||||
*/
|
||||
|
||||
#define MOBJ_HOOK(name) mobjhook_ ## name
|
||||
#define HOOK(name) hook_ ## name
|
||||
#define HUD_HOOK(name) hudhook_ ## name
|
||||
#define STRING_HOOK(name) stringhook_ ## name
|
||||
|
||||
#define ENUM(X) enum { X ## _LIST (X) X(MAX) }
|
||||
|
||||
ENUM (MOBJ_HOOK);
|
||||
ENUM (HOOK);
|
||||
ENUM (HUD_HOOK);
|
||||
ENUM (STRING_HOOK);
|
||||
|
||||
#undef ENUM
|
||||
|
||||
/* dead simple, LUA_HOOK(GameQuit) */
|
||||
#define LUA_HOOK(type) LUA_HookVoid(HOOK(type))
|
||||
#define LUA_HUDHOOK(type,drawlist) LUA_HookHUD(HUD_HOOK(type),(drawlist))
|
||||
|
||||
extern boolean hook_cmd_running; // This is used by PlayerCmd and lua_playerlib to prevent anything from being wirtten to player while we run PlayerCmd.
|
||||
extern int hook_defrosting;
|
||||
|
||||
void LUAh_MapChange(INT16 mapnumber); // Hook for map change (before load)
|
||||
void LUAh_MapLoad(void); // Hook for map load
|
||||
void LUAh_PlayerJoin(int playernum); // Hook for Got_AddPlayer
|
||||
void LUAh_PreThinkFrame(void); // Hook for frame (before mobj and player thinkers)
|
||||
void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
|
||||
void LUAh_PostThinkFrame(void); // Hook for frame (at end of tick, ie after overlays, precipitation, specials)
|
||||
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
|
||||
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
|
||||
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
|
||||
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
|
||||
#define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type
|
||||
#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type
|
||||
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
|
||||
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
|
||||
boolean LUAh_MobjThinker(mobj_t *mo); // Hook for P_MobjThinker or P_SceneryThinker by mobj type
|
||||
#define LUAh_BossThinker(mo) LUAh_MobjHook(mo, hook_BossThinker) // Hook for P_GenericBossThinker by mobj type
|
||||
UINT8 LUAh_ShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Should mobj take damage?)
|
||||
boolean LUAh_MobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage); // Hook for P_DamageMobj by mobj type (Mobj actually takes damage!)
|
||||
boolean LUAh_MobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source); // Hook for P_KillMobj by mobj type
|
||||
#define LUAh_BossDeath(mo) LUAh_MobjHook(mo, hook_BossDeath) // Hook for A_BossDeath by mobj type
|
||||
#define LUAh_MobjRemoved(mo) LUAh_MobjHook(mo, hook_MobjRemoved) // Hook for P_RemoveMobj by mobj type
|
||||
#define LUAh_JumpSpecial(player) LUAh_PlayerHook(player, hook_JumpSpecial) // Hook for P_DoJumpStuff (Any-jumping)
|
||||
#define LUAh_AbilitySpecial(player) LUAh_PlayerHook(player, hook_AbilitySpecial) // Hook for P_DoJumpStuff (Double-jumping)
|
||||
#define LUAh_SpinSpecial(player) LUAh_PlayerHook(player, hook_SpinSpecial) // Hook for P_DoSpinDash (Spin button effect)
|
||||
#define LUAh_JumpSpinSpecial(player) LUAh_PlayerHook(player, hook_JumpSpinSpecial) // Hook for P_DoJumpStuff (Spin button effect (mid-air))
|
||||
boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
|
||||
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
|
||||
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
|
||||
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg, int mute); // Hook for chat messages
|
||||
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
|
||||
#define LUAh_PlayerSpawn(player) LUAh_PlayerHook(player, hook_PlayerSpawn) // Hook for G_SpawnPlayer
|
||||
void LUAh_PlayerQuit(player_t *plr, int reason); // Hook for player quitting
|
||||
boolean LUAh_MusicChange(const char *oldname, char *newname, UINT16 *mflags, boolean *looping,
|
||||
UINT32 *position, UINT32 *prefadems, UINT32 *fadeinms); // Hook for music changes
|
||||
void LUA_HookVoid(int hook);
|
||||
void LUA_HookHUD(int hook, huddrawlist_h drawlist);
|
||||
|
||||
UINT8 LUAh_ShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
|
||||
UINT8 LUAh_ShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
|
||||
UINT8 LUAh_ShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
|
||||
int LUA_HookMobj(mobj_t *, int hook);
|
||||
int LUA_Hook2Mobj(mobj_t *, mobj_t *, int hook);
|
||||
void LUA_HookInt(INT32 integer, int hook);
|
||||
//void LUA_HookBool(boolean value, int hook);
|
||||
int LUA_HookPlayer(player_t *, int hook);
|
||||
int LUA_HookTiccmd(player_t *, ticcmd_t *, int hook);
|
||||
|
||||
boolean LUAh_PlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUAh_PlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUAh_PlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
void LUA_HookPreThinkFrame(void);
|
||||
void LUA_HookThinkFrame(void);
|
||||
void LUA_HookPostThinkFrame(void);
|
||||
int LUA_HookTouchSpecial(mobj_t *special, mobj_t *toucher);
|
||||
int LUA_HookShouldDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
|
||||
int LUA_HookMobjDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage);
|
||||
int LUA_HookMobjDeath(mobj_t *target, mobj_t *inflictor, mobj_t *source);
|
||||
int LUA_HookBotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd);
|
||||
void LUA_HookLinedefExecute(line_t *, mobj_t *, sector_t *);
|
||||
int LUA_HookPlayerMsg(int source, int target, int flags, char *msg, int mute);
|
||||
int LUA_HookHurtMsg(player_t *, mobj_t *inflictor, mobj_t *source);
|
||||
int LUA_HookPlayerCanDamage(player_t *, mobj_t *);
|
||||
void LUA_HookPlayerQuit(player_t *, int);
|
||||
int LUA_HookPlayerCmd(player_t *, ticcmd_t *);
|
||||
int LUA_HookMusicChange(const char *oldname, struct MusicChange *);
|
||||
|
||||
void LUAh_ServerJoin(void); // SRB2KART - Saturn 32p: called by client when joining a server, allows lua to load any sort of config file
|
||||
int LUA_HookShouldSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be spun out?
|
||||
int LUA_HookShouldExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be exploded?
|
||||
int LUA_HookShouldSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Should player be squished?
|
||||
|
||||
boolean LUAh_PlayerCmd(player_t *player, ticcmd_t *cmd); // Allows to write to player cmd before the game does anything with them.
|
||||
|
||||
void LUAh_IntermissionThinker(void); // Hook for Y_Ticker
|
||||
void LUAh_VoteThinker(void); // Hook for Y_VoteTicker
|
||||
#define LUAh_PlayerThink(player) LUAh_PlayerHook(player, hook_PlayerThink) // Hook for P_PlayerThink
|
||||
boolean LUA_HookPlayerSpin(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SpinPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUA_HookPlayerExplode(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_ExplodePlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
boolean LUA_HookPlayerSquish(player_t *player, mobj_t *inflictor, mobj_t *source); // SRB2KART: Hook for K_SquishPlayer. Allows Lua to execute code and/or overwrite its behavior.
|
||||
+1007
-1826
File diff suppressed because it is too large.
Load diff
+1
-4
@@ -50,9 +50,6 @@ extern boolean hud_interplatch; // string mode was toggled
|
||||
|
||||
boolean LUA_HudEnabled(enum hud option);
|
||||
|
||||
void LUAh_GameHUD(huddrawlist_h list);
|
||||
void LUAh_ScoresHUD(huddrawlist_h list);
|
||||
void LUAh_IntermissionHUD(huddrawlist_h list);
|
||||
void LUAh_VoteHUD(huddrawlist_h list);
|
||||
void LUA_SetHudHook(int hook, huddrawlist_h list);
|
||||
|
||||
#endif // __LUA_HUD_H__
|
||||
+55
-207
@@ -28,6 +28,7 @@
|
||||
#include "lua_script.h"
|
||||
#include "lua_libs.h"
|
||||
#include "lua_hud.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#define HUDONLY if (!hud_running) return luaL_error(L, "HUD rendering code should not be called outside of rendering hooks!");
|
||||
|
||||
@@ -40,8 +41,6 @@ boolean hud_interpstring = false;
|
||||
boolean hud_interplatch = false;
|
||||
static UINT8 hud_enabled[(hud_MAX/8)+1];
|
||||
|
||||
static UINT8 hudAvailable; // hud hooks field
|
||||
|
||||
static UINT8 camnum = 1;
|
||||
|
||||
// must match enum hud in lua_hud.h
|
||||
@@ -93,19 +92,6 @@ static const char *const patch_opt[] = {
|
||||
"topoffset",
|
||||
NULL};
|
||||
|
||||
enum hudhook {
|
||||
hudhook_game = 0,
|
||||
hudhook_scores = 1,
|
||||
hudhook_intermission = 2,
|
||||
hudhook_vote = 3,
|
||||
};
|
||||
static const char *const hudhook_opt[] = {
|
||||
"game",
|
||||
"scores",
|
||||
"intermission",
|
||||
"vote",
|
||||
NULL};
|
||||
|
||||
static int patch_fields_ref = LUA_NOREF;
|
||||
|
||||
// alignment types for v.drawString
|
||||
@@ -411,6 +397,18 @@ static int libd_cachePatch(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
static int libd_cachePatchRotated(lua_State *L)
|
||||
{
|
||||
HUDONLY
|
||||
angle_t rollangle = luaL_checkangle(L, 2);
|
||||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
LUA_PushUserdata(L, W_CachePatchNameRotated(luaL_checkstring(L, 1), rot, PU_STATIC), META_PATCH);
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
// this is structured like getSprite2Patch in vanilla 2.2
|
||||
// v.getSpritePatch(skin, sprite, [frame, [angle, [rollangle]]])
|
||||
static int libd_getSpritePatch(lua_State *L)
|
||||
@@ -476,12 +474,16 @@ static int libd_getSpritePatch(lua_State *L)
|
||||
if (skn < 0) // standard sprite
|
||||
{
|
||||
sprdef = &sprites[i];
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &spriteinfo[i];
|
||||
#endif
|
||||
}
|
||||
else // player skin
|
||||
{
|
||||
sprdef = &skins[skn].spritedef;
|
||||
#ifdef ROTSPRITE
|
||||
sprinfo = &skins[skn].sprinfo;
|
||||
#endif
|
||||
}
|
||||
|
||||
// set frame number
|
||||
@@ -502,13 +504,15 @@ static int libd_getSpritePatch(lua_State *L)
|
||||
if (angle >= 8) // out of range?
|
||||
angle = (angle & 7); // modulus angle by 8
|
||||
|
||||
#ifdef ROTSPRITE
|
||||
// rotsprite?????
|
||||
if (lua_isnumber(L, 4) && (cv_spriteroll.value))
|
||||
if (lua_isnumber(L, 4))
|
||||
{
|
||||
angle_t rollangle = luaL_checkangle(L, 4);
|
||||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
|
||||
if (rot) {
|
||||
if (rot)
|
||||
{
|
||||
patch_t *rotsprite = Patch_GetRotatedSprite(sprframe, frame, angle, sprframe->flip & (1<<angle), false, sprinfo, rot);
|
||||
LUA_PushUserdata(L, rotsprite, META_PATCH);
|
||||
lua_pushboolean(L, false);
|
||||
@@ -516,6 +520,7 @@ static int libd_getSpritePatch(lua_State *L)
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// push both the patch and its "flip" value
|
||||
LUA_PushUserdata(L, W_CachePatchNum(sprframe->lumppat[angle], PU_STATIC), META_PATCH);
|
||||
@@ -525,7 +530,7 @@ static int libd_getSpritePatch(lua_State *L)
|
||||
|
||||
static int libd_draw(lua_State *L)
|
||||
{
|
||||
INT32 x, y, flags;
|
||||
INT32 x, y, flags, blend;
|
||||
patch_t *patch;
|
||||
UINT8 *colormap = NULL;
|
||||
huddrawlist_h list;
|
||||
@@ -537,6 +542,7 @@ static int libd_draw(lua_State *L)
|
||||
flags = luaL_optinteger(L, 4, 0);
|
||||
if (!lua_isnoneornil(L, 5))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
|
||||
blend = luaL_optinteger(L, 6, 0);
|
||||
|
||||
flags &= ~V_PARAMMASK; // Don't let crashes happen.
|
||||
|
||||
@@ -545,16 +551,16 @@ static int libd_draw(lua_State *L)
|
||||
lua_pop(L, 1);
|
||||
|
||||
if (LUA_HUD_IsDrawListValid(list))
|
||||
LUA_HUD_AddDraw(list, x, y, patch, flags, colormap);
|
||||
LUA_HUD_AddDraw(list, x, y, patch, flags, colormap, blend);
|
||||
else
|
||||
V_DrawFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, flags, patch, colormap);
|
||||
V_DrawBlendingFixedPatch(x<<FRACBITS, y<<FRACBITS, FRACUNIT, flags, patch, colormap, blend);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int libd_drawScaled(lua_State *L)
|
||||
{
|
||||
fixed_t x, y, scale;
|
||||
INT32 flags;
|
||||
INT32 flags, blend;
|
||||
patch_t *patch;
|
||||
UINT8 *colormap = NULL;
|
||||
huddrawlist_h list;
|
||||
@@ -569,6 +575,7 @@ static int libd_drawScaled(lua_State *L)
|
||||
flags = luaL_optinteger(L, 5, 0);
|
||||
if (!lua_isnoneornil(L, 6))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 6, META_COLORMAP));
|
||||
blend = luaL_optinteger(L, 7, 0);
|
||||
|
||||
flags &= ~V_PARAMMASK; // Don't let crashes happen.
|
||||
|
||||
@@ -577,9 +584,9 @@ static int libd_drawScaled(lua_State *L)
|
||||
lua_pop(L, 1);
|
||||
|
||||
if (LUA_HUD_IsDrawListValid(list))
|
||||
LUA_HUD_AddDrawScaled(list, x, y, scale, patch, flags, colormap);
|
||||
LUA_HUD_AddDrawScaled(list, x, y, scale, patch, flags, colormap, blend);
|
||||
else
|
||||
V_DrawFixedPatch(x, y, scale, flags, patch, colormap);
|
||||
V_DrawBlendingFixedPatch(x, y, scale, flags, patch, colormap, blend);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -663,7 +670,7 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
if (gamestate != GS_LEVEL)
|
||||
return 0;
|
||||
|
||||
if (stplyr != &players[displayplayers[0]])
|
||||
if (stplyrnum != 0)
|
||||
return 0;
|
||||
|
||||
AutomapPic = minimapinfo.minimap_pic;
|
||||
@@ -723,7 +730,7 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
|
||||
if (LUA_HUD_IsDrawListValid(list))
|
||||
{
|
||||
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
|
||||
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -736,7 +743,7 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
static int libd_drawStretched(lua_State *L)
|
||||
{
|
||||
fixed_t x, y, hscale, vscale;
|
||||
INT32 flags;
|
||||
INT32 flags, blend;
|
||||
patch_t *patch;
|
||||
UINT8 *colormap = NULL;
|
||||
huddrawlist_h list;
|
||||
@@ -754,6 +761,7 @@ static int libd_drawStretched(lua_State *L)
|
||||
flags = luaL_optinteger(L, 6, 0);
|
||||
if (!lua_isnoneornil(L, 7))
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 7, META_COLORMAP));
|
||||
blend = luaL_optinteger(L, 8, 0);
|
||||
|
||||
flags &= ~V_PARAMMASK; // Don't let crashes happen.
|
||||
|
||||
@@ -762,9 +770,9 @@ static int libd_drawStretched(lua_State *L)
|
||||
lua_pop(L, 1);
|
||||
|
||||
if (LUA_HUD_IsDrawListValid(list))
|
||||
LUA_HUD_AddDrawStretched(list, x, y, hscale, vscale, patch, flags, colormap);
|
||||
LUA_HUD_AddDrawStretched(list, x, y, hscale, vscale, patch, flags, colormap, blend);
|
||||
else
|
||||
V_DrawStretchyFixedPatch(x, y, hscale, vscale, flags, patch, colormap);
|
||||
V_DrawStretchyFixedPatch(x, y, hscale, vscale, flags, patch, colormap, blend);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1186,6 +1194,10 @@ static int libd_interpLatch(lua_State *L)
|
||||
static luaL_Reg lib_draw[] = {
|
||||
{"patchExists", libd_patchExists},
|
||||
{"cachePatch", libd_cachePatch},
|
||||
#ifdef ROTSPRITE
|
||||
// Is this ifdef nonsense? Yes.
|
||||
{"cachePatchRotated", libd_cachePatchRotated},
|
||||
#endif
|
||||
{"draw", libd_draw},
|
||||
{"drawScaled", libd_drawScaled},
|
||||
{"drawStretched", libd_drawStretched},
|
||||
@@ -1215,6 +1227,8 @@ static luaL_Reg lib_draw[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static int lib_draw_ref;
|
||||
|
||||
//
|
||||
// lib_hud
|
||||
//
|
||||
@@ -1248,25 +1262,7 @@ static int lib_hudenabled(lua_State *L)
|
||||
}
|
||||
|
||||
// add a HUD element for rendering
|
||||
static int lib_hudadd(lua_State *L)
|
||||
{
|
||||
enum hudhook field;
|
||||
|
||||
luaL_checktype(L, 1, LUA_TFUNCTION);
|
||||
field = luaL_checkoption(L, 2, "game", hudhook_opt);
|
||||
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_rawgeti(L, -1, field+2); // HUD[2+]
|
||||
I_Assert(lua_istable(L, -1));
|
||||
lua_remove(L, -2);
|
||||
|
||||
lua_pushvalue(L, 1);
|
||||
lua_rawseti(L, -2, (int)(lua_objlen(L, -2) + 1));
|
||||
|
||||
hudAvailable |= 1<<field;
|
||||
return 0;
|
||||
}
|
||||
extern int lib_hudadd(lua_State *L);
|
||||
|
||||
static int lib_hudsetvotebackground(lua_State *L)
|
||||
{
|
||||
@@ -1351,23 +1347,9 @@ int LUA_HudLib(lua_State *L)
|
||||
{
|
||||
memset(hud_enabled, 0xff, (hud_MAX/8)+1);
|
||||
|
||||
lua_newtable(L); // HUD registry table
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, lib_draw);
|
||||
lua_rawseti(L, -2, 1); // HUD[1] = lib_draw
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 2); // HUD[2] = game rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 3); // HUD[3] = scores rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 4); // HUD[4] = intermission rendering functions array
|
||||
|
||||
lua_newtable(L);
|
||||
lua_rawseti(L, -2, 5); // HUD[5] = vote rendering functions array
|
||||
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||
lua_newtable(L);
|
||||
luaL_register(L, NULL, lib_draw);
|
||||
lib_draw_ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
|
||||
luaL_newmetatable(L, META_HUDINFO);
|
||||
lua_pushcfunction(L, hudinfo_get);
|
||||
@@ -1423,153 +1405,19 @@ boolean LUA_HudEnabled(enum hud option)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Hook for HUD rendering
|
||||
void LUAh_GameHUD(huddrawlist_h list)
|
||||
void LUA_SetHudHook(int hook, huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_game)))
|
||||
return;
|
||||
|
||||
lua_getref(gL, lib_draw_ref);
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_game+2); // HUD[2] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
LUA_PushUserdata(gL, stplyr, META_PLAYER);
|
||||
LUA_PushUserdata(gL, &camera[stplyrnum], META_CAMERA);
|
||||
camnum = stplyrnum + 1;
|
||||
|
||||
hud_interpcounter = 0;
|
||||
lua_pushnil(gL);
|
||||
while (lua_next(gL, -5) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -5); // graphics library (HUD[1])
|
||||
lua_pushvalue(gL, -5); // stplyr
|
||||
lua_pushvalue(gL, -5); // camera
|
||||
LUA_Call(gL, 3, 0, 1);
|
||||
// there used to be a switch statement here, its gone now.
|
||||
if (hook == HUD_HOOK(game))
|
||||
{
|
||||
LUA_PushUserdata(gL, stplyr, META_PLAYER);
|
||||
LUA_PushUserdata(gL, &camera[stplyrnum], META_CAMERA);
|
||||
camnum = stplyrnum + 1; // for compatibility
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_ScoresHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_scores)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_scores+2); // HUD[3] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
hud_interpcounter = 0;
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_IntermissionHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_intermission)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_intermission+2); // HUD[4] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
hud_interpcounter = 0;
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
|
||||
void LUAh_VoteHUD(huddrawlist_h list)
|
||||
{
|
||||
if (!gL || !(hudAvailable & (1<<hudhook_vote)))
|
||||
return;
|
||||
|
||||
lua_pushlightuserdata(gL, list);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
|
||||
hud_running = true;
|
||||
lua_settop(gL, 0);
|
||||
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_rawgeti(gL, -1, hudhook_vote+2); // HUD[5] = rendering funcs
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
|
||||
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||
I_Assert(lua_istable(gL, -1));
|
||||
lua_remove(gL, -3); // pop HUD
|
||||
lua_pushnil(gL);
|
||||
hud_interpcounter = 0;
|
||||
while (lua_next(gL, -3) != 0) {
|
||||
hud_interpolate = hud_interpstring = hud_interplatch = false;
|
||||
hud_interpcounter++;
|
||||
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||
LUA_Call(gL, 1, 0, 1);
|
||||
}
|
||||
lua_settop(gL, 0);
|
||||
hud_running = false;
|
||||
|
||||
lua_pushlightuserdata(gL, NULL);
|
||||
lua_setfield(gL, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
}
|
||||
@@ -69,6 +69,7 @@ typedef struct drawitem_s {
|
||||
size_t stroffset; // offset into strbuf to get str
|
||||
};
|
||||
const UINT8 *colormap;
|
||||
INT32 blend;
|
||||
} drawitem_t;
|
||||
|
||||
// The internal structure of a drawlist.
|
||||
@@ -345,7 +346,8 @@ void LUA_HUD_AddDraw(
|
||||
INT32 y,
|
||||
patch_t *patch,
|
||||
INT32 flags,
|
||||
UINT8 *colormap
|
||||
UINT8 *colormap,
|
||||
INT32 blend
|
||||
)
|
||||
{
|
||||
size_t i = AllocateDrawItem(list);
|
||||
@@ -357,6 +359,7 @@ void LUA_HUD_AddDraw(
|
||||
item->patch = patch;
|
||||
item->flags = flags;
|
||||
item->colormap = colormap;
|
||||
item->blend = blend;
|
||||
}
|
||||
|
||||
void LUA_HUD_AddDrawScaled(
|
||||
@@ -366,7 +369,8 @@ void LUA_HUD_AddDrawScaled(
|
||||
fixed_t scale,
|
||||
patch_t *patch,
|
||||
INT32 flags,
|
||||
UINT8 *colormap
|
||||
UINT8 *colormap,
|
||||
INT32 blend
|
||||
)
|
||||
{
|
||||
size_t i = AllocateDrawItem(list);
|
||||
@@ -379,6 +383,7 @@ void LUA_HUD_AddDrawScaled(
|
||||
item->patch = patch;
|
||||
item->flags = flags;
|
||||
item->colormap = colormap;
|
||||
item->blend = blend;
|
||||
}
|
||||
|
||||
void LUA_HUD_AddDrawStretched(
|
||||
@@ -389,7 +394,8 @@ void LUA_HUD_AddDrawStretched(
|
||||
fixed_t vscale,
|
||||
patch_t *patch,
|
||||
INT32 flags,
|
||||
UINT8 *colormap
|
||||
UINT8 *colormap,
|
||||
INT32 blend
|
||||
)
|
||||
{
|
||||
size_t i = AllocateDrawItem(list);
|
||||
@@ -403,6 +409,7 @@ void LUA_HUD_AddDrawStretched(
|
||||
item->patch = patch;
|
||||
item->flags = flags;
|
||||
item->colormap = colormap;
|
||||
item->blend = blend;
|
||||
}
|
||||
|
||||
void LUA_HUD_AddDrawNum(
|
||||
@@ -634,17 +641,17 @@ void LUA_HUD_DrawList(huddrawlist_h list)
|
||||
case DI_Draw:
|
||||
if (!item->patch || item->patch == NULL)
|
||||
return;
|
||||
V_DrawFixedPatch(LERPS(x), LERPS(y), FRACUNIT, item->flags, item->patch, item->colormap);
|
||||
V_DrawBlendingFixedPatch(LERPS(x), LERPS(y), FRACUNIT, item->flags, item->patch, item->colormap, item->blend);
|
||||
break;
|
||||
case DI_DrawScaled:
|
||||
if (!item->patch || item->patch == NULL)
|
||||
return;
|
||||
V_DrawFixedPatch(LERPS(x), LERPS(y), LERP(scale), item->flags, item->patch, item->colormap);
|
||||
V_DrawBlendingFixedPatch(LERPS(x), LERPS(y), LERP(scale), item->flags, item->patch, item->colormap, item->blend);
|
||||
break;
|
||||
case DI_DrawStretched:
|
||||
if (!item->patch || item->patch == NULL)
|
||||
return;
|
||||
V_DrawStretchyFixedPatch(LERPS(x), LERPS(y), LERP(hscale), LERP(vscale), item->flags, item->patch, item->colormap);
|
||||
V_DrawStretchyFixedPatch(LERPS(x), LERPS(y), LERP(hscale), LERP(vscale), item->flags, item->patch, item->colormap, item->blend);
|
||||
break;
|
||||
case DI_DrawNum:
|
||||
V_DrawTallNum(LERPS(x), LERPS(y), item->flags, item->num);
|
||||
|
||||
@@ -40,7 +40,8 @@ void LUA_HUD_AddDraw(
|
||||
INT32 y,
|
||||
patch_t *patch,
|
||||
INT32 flags,
|
||||
UINT8 *colormap
|
||||
UINT8 *colormap,
|
||||
INT32 blend
|
||||
);
|
||||
void LUA_HUD_AddDrawStretched(
|
||||
huddrawlist_h list,
|
||||
@@ -50,7 +51,8 @@ void LUA_HUD_AddDrawStretched(
|
||||
fixed_t vscale,
|
||||
patch_t *patch,
|
||||
INT32 flags,
|
||||
UINT8 *colormap
|
||||
UINT8 *colormap,
|
||||
INT32 blend
|
||||
);
|
||||
void LUA_HUD_AddDrawScaled(
|
||||
huddrawlist_h list,
|
||||
@@ -59,7 +61,8 @@ void LUA_HUD_AddDrawScaled(
|
||||
fixed_t scale,
|
||||
patch_t *patch,
|
||||
INT32 flags,
|
||||
UINT8 *colormap
|
||||
UINT8 *colormap,
|
||||
INT32 blend
|
||||
);
|
||||
void LUA_HUD_AddDrawNum(
|
||||
huddrawlist_h list,
|
||||
|
||||
@@ -94,6 +94,7 @@ enum line_e {
|
||||
line_sidenum,
|
||||
line_frontside,
|
||||
line_backside,
|
||||
line_alpha,
|
||||
line_slopetype,
|
||||
line_frontsector,
|
||||
line_backsector,
|
||||
@@ -115,6 +116,7 @@ static const char *const line_opt[] = {
|
||||
"sidenum",
|
||||
"frontside",
|
||||
"backside",
|
||||
"alpha",
|
||||
"slopetype",
|
||||
"frontsector",
|
||||
"backsector",
|
||||
@@ -186,6 +188,7 @@ enum ffloor_e {
|
||||
ffloor_next,
|
||||
ffloor_prev,
|
||||
ffloor_alpha,
|
||||
ffloor_blend,
|
||||
};
|
||||
|
||||
static const char *const ffloor_opt[] = {
|
||||
@@ -204,6 +207,7 @@ static const char *const ffloor_opt[] = {
|
||||
"next",
|
||||
"prev",
|
||||
"alpha",
|
||||
"blend",
|
||||
NULL};
|
||||
|
||||
static int ffloor_fields_ref = LUA_NOREF;
|
||||
@@ -652,6 +656,9 @@ static int line_get(lua_State *L)
|
||||
return 0;
|
||||
LUA_PushUserdata(L, &sides[line->sidenum[1]], META_SIDE);
|
||||
return 1;
|
||||
case line_alpha:
|
||||
lua_pushfixed(L, line->alpha);
|
||||
return 1;
|
||||
case line_slopetype:
|
||||
switch(line->slopetype)
|
||||
{
|
||||
@@ -1168,6 +1175,9 @@ static int ffloor_get(lua_State *L)
|
||||
case ffloor_alpha:
|
||||
lua_pushinteger(L, ffloor->alpha);
|
||||
return 1;
|
||||
case ffloor_blend:
|
||||
lua_pushinteger(L, ffloor->blend);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1246,6 +1256,9 @@ static int ffloor_set(lua_State *L)
|
||||
case ffloor_alpha:
|
||||
ffloor->alpha = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
case ffloor_blend:
|
||||
ffloor->blend = (INT32)luaL_checkinteger(L, 3);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+38
-3
@@ -40,6 +40,7 @@ int mobj_sprev_unimplemented(lua_State *L);
|
||||
int mobj_angle_setter(lua_State *L);
|
||||
int mobj_sloperoll_noop(lua_State *L);
|
||||
int mobj_spritescale_setter(lua_State *L);
|
||||
int mobj_spriteoffset_setter(lua_State *L);
|
||||
int mobj_touching_sectorlist_unimplemented(lua_State *L);
|
||||
int mobj_radius_setter(lua_State *L);
|
||||
int mobj_height_setter(lua_State *L);
|
||||
@@ -52,6 +53,7 @@ int mobj_skin_setter(lua_State *L);
|
||||
int mobj_localskin_getter(lua_State *L);
|
||||
int mobj_localskin_setter(lua_State *L);
|
||||
int mobj_color_setter(lua_State *L);
|
||||
int mobj_blendmode_setter(lua_State *L);
|
||||
int mobj_bnext_noset(lua_State *L);
|
||||
int mobj_bprev_unimplemented(lua_State *L);
|
||||
int mobj_hnext_setter(lua_State *L);
|
||||
@@ -94,9 +96,10 @@ static const udata_field_t mobj_fields[] = {
|
||||
FIELD(mobj_t, anim_duration, udatalib_getter_uint16, udatalib_setter_uint16),
|
||||
FIELD(mobj_t, spritexscale, udatalib_getter_fixed, mobj_spritescale_setter),
|
||||
FIELD(mobj_t, spriteyscale, udatalib_getter_fixed, mobj_spritescale_setter),
|
||||
FIELD(mobj_t, spritexoffset, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(mobj_t, spriteyoffset, udatalib_getter_fixed, udatalib_setter_fixed),
|
||||
FIELD(mobj_t, spritexoffset, udatalib_getter_fixed, mobj_spriteoffset_setter),
|
||||
FIELD(mobj_t, spriteyoffset, udatalib_getter_fixed, mobj_spriteoffset_setter),
|
||||
FIELD(mobj_t, touching_sectorlist, mobj_touching_sectorlist_unimplemented, mobj_touching_sectorlist_unimplemented),
|
||||
FIELD(mobj_t, lightlevel, udatalib_getter_int16, udatalib_setter_int16),
|
||||
FIELD(mobj_t, subsector, udatalib_getter_subsector, mobj_nosetpos_subsector),
|
||||
FIELD(mobj_t, floorz, udatalib_getter_fixed, mobj_nosetpos_floorz),
|
||||
FIELD(mobj_t, ceilingz, udatalib_getter_fixed, mobj_nosetpos_ceilingz),
|
||||
@@ -114,6 +117,7 @@ static const udata_field_t mobj_fields[] = {
|
||||
FIELD(mobj_t, skin, mobj_skin_getter, mobj_skin_setter),
|
||||
FIELD(mobj_t, localskin, mobj_localskin_getter, mobj_localskin_setter),
|
||||
FIELD(mobj_t, color, udatalib_getter_uint8, mobj_color_setter),
|
||||
FIELD(mobj_t, blendmode, udatalib_getter_int32, mobj_blendmode_setter),
|
||||
FIELD(mobj_t, bnext, udatalib_getter_mobj, mobj_bnext_noset),
|
||||
FIELD(mobj_t, bprev, mobj_bprev_unimplemented, mobj_bprev_unimplemented),
|
||||
FIELD(mobj_t, hnext, udatalib_getter_mobj, mobj_hnext_setter),
|
||||
@@ -146,7 +150,6 @@ static const udata_field_t mobj_fields[] = {
|
||||
FIELD(mobj_t, standingslope, udatalib_getter_slope, mobj_standingslope_noset),
|
||||
FIELD(mobj_t, colorized, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, mirrored, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
FIELD(mobj_t, rollmodel, udatalib_getter_boolean, udatalib_setter_boolean),
|
||||
{ NULL, 0, NULL, NULL },
|
||||
};
|
||||
#undef FIELD
|
||||
@@ -277,6 +280,26 @@ int mobj_spritescale_setter(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mobj_spriteoffset_setter(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = GETMO();
|
||||
|
||||
fixed_t *spriteoffset;
|
||||
UDATALIB_GETFIELD(fixed_t, spriteoffset);
|
||||
|
||||
if (!mo->player)
|
||||
*spriteoffset = luaL_checkfixed(L, 2);
|
||||
else
|
||||
{
|
||||
// Mmm yea
|
||||
if (spriteoffset == &mo->spritexoffset)
|
||||
mo->realxoffset = luaL_checkfixed(L, 2);
|
||||
else
|
||||
mo->realyoffset = luaL_checkfixed(L, 2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mobj_radius_setter(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = GETMO();
|
||||
@@ -476,6 +499,18 @@ int mobj_color_setter(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mobj_blendmode_setter(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = GETMO();
|
||||
|
||||
INT32 blendmode = (INT32)luaL_checkinteger(L, 2);
|
||||
if (blendmode < 0 || blendmode > AST_OVERLAY)
|
||||
return luaL_error(L, "mobj.blendmode %d out of range (0 - %d).", blendmode, AST_OVERLAY);
|
||||
mo->blendmode = blendmode;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mobj_hnext_setter(lua_State *L)
|
||||
{
|
||||
mobj_t *mo = GETMO();
|
||||
|
||||
+2
-3
@@ -157,9 +157,8 @@ static const udata_field_t player_fields[] = {
|
||||
FIELD(player_t, grieftime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, griefstrikes, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, splitscreenindex, udatalib_getter_uint8, player_splitscreenindex_noset),
|
||||
#ifdef HWRENDER
|
||||
FIELD(player_t, fovadd, udatalib_getter_fixed, udatalib_setter_fixed), // Mmm yeah thats definitely synch safe
|
||||
#endif
|
||||
|
||||
// Same as player.name
|
||||
{ "sliproll", 0, player_sliproll_getter, player_sliproll_noset },
|
||||
{ "viewrollangle", 0, player_viewrollangle_getter, player_viewrollangle_noset },
|
||||
@@ -882,4 +881,4 @@ int LUA_PlayerLib(lua_State *L)
|
||||
lua_setglobal(L, "displayplayers");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+181
-644
File diff suppressed because it is too large.
Load diff
+5
-6
@@ -13,6 +13,7 @@
|
||||
#include "m_fixed.h"
|
||||
#include "doomtype.h"
|
||||
#include "d_player.h"
|
||||
#include "p_saveg.h"
|
||||
|
||||
#include "blua/lua.h"
|
||||
#include "blua/lualib.h"
|
||||
@@ -55,17 +56,15 @@ void LUA_InvalidateLevel(void);
|
||||
void LUA_InvalidateMapthings(void);
|
||||
void LUA_InvalidatePlayer(player_t *player);
|
||||
void LUA_Step(void);
|
||||
void LUA_Archive(void);
|
||||
void LUA_UnArchive(void);
|
||||
|
||||
void LUA_ArchiveDemo(void);
|
||||
void LUA_UnArchiveDemo(void);
|
||||
void LUA_Archive(savebuffer_t *save, boolean network);
|
||||
void LUA_UnArchive(savebuffer_t *save, boolean network);
|
||||
|
||||
void Got_Luacmd(UINT8 **cp, INT32 playernum); // lua_consolelib.c
|
||||
void LUA_CVarChanged(const char *name); // lua_consolelib.c
|
||||
int Lua_optoption(lua_State *L, int narg, int def, int list_ref);
|
||||
int Lua_CreateFieldTable(lua_State *L, const char *const lst[]);
|
||||
void LUAh_NetArchiveHook(lua_CFunction archFunc);
|
||||
void LUA_HookNetArchive(lua_CFunction archFunc, savebuffer_t *save);
|
||||
//void LUA_HookNetArchive(lua_CFunction archFunc);
|
||||
|
||||
// Console wrapper
|
||||
void COM_Lua_f(void);
|
||||
|
||||
+9
-2
@@ -32,6 +32,7 @@ consvar_t cv_gif_downscale = {"gif_downscale", "On", CV_SAVE, CV_OnOff, NULL, 0
|
||||
#ifdef HAVE_ANIGIF
|
||||
static boolean gif_optimize = false; // So nobody can do something dumb
|
||||
static boolean gif_downscale = false; // like changing cvars mid output
|
||||
static RGBA_t *gif_palette = NULL;
|
||||
|
||||
static FILE *gif_out = NULL;
|
||||
static INT32 gif_frames = 0;
|
||||
@@ -461,13 +462,15 @@ static size_t gifframe_size = 8192;
|
||||
// converts an RGB frame to a frame with a palette.
|
||||
//
|
||||
#ifdef HWRENDER
|
||||
static colorlookup_t gif_colorlookup;
|
||||
|
||||
static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr)
|
||||
{
|
||||
UINT8 r, g, b;
|
||||
size_t src, dest;
|
||||
int x, y;
|
||||
|
||||
InitColorLUT();
|
||||
InitColorLUT(&gif_colorlookup, gif_palette, true);
|
||||
|
||||
for (x = 0; x < vid.width; x += scrbuf_downscaleamt)
|
||||
{
|
||||
@@ -479,7 +482,7 @@ static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr)
|
||||
r = (UINT8)linear[src];
|
||||
g = (UINT8)linear[src + 1];
|
||||
b = (UINT8)linear[src + 2];
|
||||
scr[dest] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS];
|
||||
scr[dest] = GetColorLUTDirect(&gif_colorlookup, r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -636,6 +639,10 @@ INT32 GIF_open(const char *filename)
|
||||
|
||||
gif_optimize = (!!cv_gif_optimize.value);
|
||||
gif_downscale = (!!cv_gif_downscale.value);
|
||||
|
||||
// no master palettes in SRB2Kart land
|
||||
gif_palette = pLocalPalette;
|
||||
|
||||
GIF_headwrite();
|
||||
gif_frames = 0;
|
||||
return 1;
|
||||
|
||||
+1
-1
@@ -1091,7 +1091,7 @@ void OP_ObjectplaceMovement(player_t *player)
|
||||
{
|
||||
ticcmd_t *cmd = &player->cmd;
|
||||
|
||||
if (!player->climbing && (netgame || !cv_analog.value || (player->pflags & PF_SPINNING)))
|
||||
if (!player->climbing && (netgame || (player->pflags & PF_SPINNING)))
|
||||
player->mo->angle = (cmd->angleturn<<16 /* not FRACBITS */);
|
||||
|
||||
ticruned++;
|
||||
|
||||
@@ -247,6 +247,35 @@ FUNCMATH FUNCINLINE static ATTRINLINE fixed_t FixedRound(fixed_t x)
|
||||
return INT32_MAX;
|
||||
}
|
||||
|
||||
/** \brief The xs_CRoundToInt function
|
||||
|
||||
\param val double number
|
||||
|
||||
\return Round toward nearest, but ties round toward even
|
||||
*/
|
||||
#if defined(SRB2_BIG_ENDIAN)
|
||||
#define _xs_iexp_ 0
|
||||
#define _xs_iman_ 1
|
||||
#else
|
||||
#define _xs_iexp_ 1 //intel is little endian
|
||||
#define _xs_iman_ 0
|
||||
#endif //BigEndian_
|
||||
|
||||
typedef double real64;
|
||||
|
||||
typedef union _xs_doubleints
|
||||
{
|
||||
real64 val;
|
||||
unsigned ival[2];
|
||||
} _xs_doubleints;
|
||||
|
||||
FUNCMATH FUNCINLINE static ATTRINLINE int xs_CRoundToInt(real64 val)
|
||||
{
|
||||
_xs_doubleints uval;
|
||||
uval.val = val + 6755399441055744.0;
|
||||
return uval.ival[_xs_iman_];
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
fixed_t x;
|
||||
|
||||
Loaded 100 of 179 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user