Compare commits
601
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fdc829686 | ||
|
|
f2b9077f5a | ||
|
|
cd4bdde67c | ||
|
|
de94ad24a5 | ||
|
|
6d01ec4c55 | ||
|
|
f72c64d7d1 | ||
|
|
92a3e974b0 | ||
|
|
7d6cce5881 | ||
|
|
bb3f9b5882 | ||
|
|
27d6447a83 | ||
|
|
20044fa6a7 | ||
|
|
26480882c8 | ||
|
|
b23020435f | ||
|
|
267e2be69b | ||
|
|
b9428360c0 | ||
|
|
2112be8ef7 | ||
|
|
44288a5865 | ||
|
|
66f89fb4ad | ||
|
|
eceb671ea8 | ||
|
|
a15615a229 | ||
|
|
8e10bcc739 | ||
|
|
22e65cd5e7 | ||
|
|
72383520cb | ||
|
|
38ef55b869 | ||
|
|
649373ff51 | ||
|
|
ca09a5dd46 | ||
|
|
11546cd906 | ||
|
|
4110130ca7 | ||
|
|
6b9900ad4e | ||
|
|
97e6222176 | ||
|
|
3d39f50388 | ||
|
|
eef56a7c82 | ||
|
|
8853666645 | ||
|
|
a379764076 | ||
|
|
edd1cc6059 | ||
|
|
f355b2269c | ||
|
|
03280db377 | ||
|
|
86aeff5547 | ||
|
|
b5b2062efa | ||
|
|
b51731d675 | ||
|
|
229e8d9592 | ||
|
|
da9c19bba4 | ||
|
|
3156851554 | ||
|
|
a19cb5f2bc | ||
|
|
2639f94dff | ||
|
|
2c769f8043 | ||
|
|
332f7db32f | ||
|
|
3381f6af3a | ||
|
|
45d33b951c | ||
|
|
1922b32799 | ||
|
|
6bb72c363f | ||
|
|
378382f3ad | ||
|
|
7e09493cf2 | ||
|
|
126fce9119 | ||
|
|
0b5879ffb3 | ||
|
|
0bd2c6220d | ||
|
|
a434ce2080 | ||
|
|
c8193380e7 | ||
|
|
e38580c9c2 | ||
|
|
c46ff7daff | ||
|
|
4418653edb | ||
|
|
1d9bcaa786 | ||
|
|
27bfd0078c | ||
|
|
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 | ||
|
|
52cd614613 | ||
|
|
db04046cb3 | ||
|
|
5ec48f72e0 | ||
|
|
7a1c6bd9e4 | ||
|
|
75af036fcf | ||
|
|
accc9890df | ||
|
|
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 | ||
|
|
74088c1d26 | ||
|
|
b03e74c366 | ||
|
|
cd9ee7d139 | ||
|
|
3080f2953d | ||
|
|
f7c7dae3a5 | ||
|
|
3f16f42adf | ||
|
|
7b2e763d07 | ||
|
|
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 | ||
|
|
38abb4c9e4 | ||
|
|
fc469d6433 | ||
|
|
52f1d727c0 | ||
|
|
80a29dc5a1 | ||
|
|
f4703be2ca | ||
|
|
7c78cf067c | ||
|
|
54cbfbe699 | ||
|
|
05f454157f | ||
|
|
c451f0f1a6 | ||
|
|
35b85bec36 | ||
|
|
b0c64be31d | ||
|
|
d09a28e3da | ||
|
|
550c66b25b | ||
|
|
dfec9e24f3 | ||
|
|
2350889445 | ||
|
|
990854e176 | ||
|
|
8c727b979c | ||
|
|
60de48ad65 | ||
|
|
2fd1abce5c | ||
|
|
691a61de72 | ||
|
|
3a153c3abe | ||
|
|
d22645e56a | ||
|
|
08fe3beef1 | ||
|
|
2c54c92e14 | ||
|
|
c127cd9016 | ||
|
|
9cb790ac23 | ||
|
|
c2c7381bc1 | ||
|
|
1e4eeb2bcf | ||
|
|
b1f99f8d2f | ||
|
|
f752da7d03 | ||
|
|
7ddcf6d0d4 | ||
|
|
b21776183e | ||
|
|
9c0dcac5c6 | ||
|
|
1b75d8b8e2 | ||
|
|
145e305494 | ||
|
|
8f4d185ea6 | ||
|
|
4b5ff6be5d | ||
|
|
d27ef85b9e | ||
|
|
1ac210c2fc | ||
|
|
878b7f4b43 | ||
|
|
7cbac66935 | ||
|
|
7e09223e6e | ||
|
|
b4e1be5bee | ||
|
|
d3e5e236ac | ||
|
|
238ce98c44 | ||
|
|
2824e5d850 | ||
|
|
cd154d5748 | ||
|
|
c0a8153a10 | ||
|
|
3433fc7651 | ||
|
|
22d1ee8f60 | ||
|
|
5155958ade | ||
|
|
5fdd486bab | ||
|
|
4672037bcd | ||
|
|
2281b82b5a | ||
|
|
3fe096c7d4 | ||
|
|
dd3ca0e161 | ||
|
|
d8da78f900 | ||
|
|
9325e7be8f | ||
|
|
f3f94bf80e | ||
|
|
506dc2455a | ||
|
|
94d6ee15b5 | ||
|
|
2d918d32a1 | ||
|
|
dd516b573b | ||
|
|
de9698efc8 | ||
|
|
14b026f04b | ||
|
|
9dd45440c0 | ||
|
|
c59e8387ca | ||
|
|
772ad9f04f | ||
|
|
6053c2c619 | ||
|
|
a515b133c5 | ||
|
|
240dae9a1a | ||
|
|
b8a703233a | ||
|
|
bf44c95d00 | ||
|
|
c3dd1755dc | ||
|
|
b6e766ee44 | ||
|
|
5437040b78 | ||
|
|
c786569981 | ||
|
|
7064b14539 | ||
|
|
f275ae98f5 | ||
|
|
ef07d89e29 | ||
|
|
b9bbd45e15 | ||
|
|
2bda27b80d | ||
|
|
6ebf90cc50 | ||
|
|
ea00bebb04 | ||
|
|
b862d835a5 | ||
|
|
d6602747ae | ||
|
|
9f79429d03 | ||
|
|
5ff0c09868 | ||
|
|
ad1c3e63a4 | ||
|
|
24dd6ba675 | ||
|
|
85f036a45b | ||
|
|
6f8342b9a8 | ||
|
|
c5c6f6b820 | ||
|
|
3d472c34a1 | ||
|
|
63ca366bd8 | ||
|
|
e9e888ab7f | ||
|
|
5ea55b3e3a | ||
|
|
8b1797927a | ||
|
|
05a98964fb | ||
|
|
8cbf798de8 | ||
|
|
9314a24cb2 | ||
|
|
19b1683e61 | ||
|
|
d029107e75 | ||
|
|
bc97e0b703 | ||
|
|
f47c663f79 | ||
|
|
6f9d41eadb | ||
|
|
1b512edc56 | ||
|
|
884a6da2bd | ||
|
|
7a3d958fc1 | ||
|
|
7223581539 | ||
|
|
664bd2de3f | ||
|
|
63568e3861 | ||
|
|
f149d058a1 | ||
|
|
970251ced3 | ||
|
|
dba7a7dc3c | ||
|
|
393c0be407 | ||
|
|
5e9ea2429b | ||
|
|
81a14995da | ||
|
|
4267ac9a8d | ||
|
|
bcf72cc0e8 | ||
|
|
54d9a98090 | ||
|
|
86ea7dde40 | ||
|
|
81d415c5ba | ||
|
|
de1b801bda | ||
|
|
2c665fef6f | ||
|
|
c6fbf405bf | ||
|
|
7076c35521 | ||
|
|
86ed1b709e | ||
|
|
0be25bd362 | ||
|
|
d30c96e8cb | ||
|
|
0af52ba3ae | ||
|
|
fbe97556de | ||
|
|
7a6f43bece | ||
|
|
afca521fe5 | ||
|
|
d3e2875c94 | ||
|
|
1daac9a124 | ||
|
|
38f3e48aed | ||
|
|
4cf4d49f48 | ||
|
|
a19c4dc5e5 | ||
|
|
d37505ff06 | ||
|
|
7f6ce1f299 | ||
|
|
262a84aac6 | ||
|
|
3f12ebb2bd | ||
|
|
b58fcf331c | ||
|
|
fe51278295 | ||
|
|
c3fb84981e | ||
|
|
919aad4f30 | ||
|
|
818e6046b7 | ||
|
|
f01d2a0ba6 | ||
|
|
8df0a2d059 | ||
|
|
d7ed91af1d | ||
|
|
081dcc021b | ||
|
|
70ebd0d475 | ||
|
|
02bbb38606 | ||
|
|
d00014ea59 | ||
|
|
210d6ac8ac | ||
|
|
55248e7fcf | ||
|
|
cb94235ac1 | ||
|
|
d0c50c49a7 | ||
|
|
7f1217b2ab | ||
|
|
3b01393a71 | ||
|
|
23b36b5074 | ||
|
|
2e7f0721b9 | ||
|
|
4927e55c7e | ||
|
|
c51d33fa6e | ||
|
|
8630d8cd47 | ||
|
|
659243baa1 | ||
|
|
b6a84c1646 | ||
|
|
c33afa4a3b | ||
|
|
1428c3c2bf | ||
|
|
aa0cbfda74 | ||
|
|
9d13ff3c9f | ||
|
|
e47c13b7ac | ||
|
|
3f5b96bd45 | ||
|
|
63c1372c34 | ||
|
|
8b915f9ac1 | ||
|
|
f3a18a0655 | ||
|
|
e8351d44b6 | ||
|
|
297af069cb | ||
|
|
baa5d6630d | ||
|
|
0c30730ef6 | ||
|
|
ef763487a5 | ||
|
|
03f5ac87fa | ||
|
|
c82148fafc | ||
|
|
d1346dee53 | ||
|
|
6722b43244 | ||
|
|
b2cac97106 | ||
|
|
cfdbf1f4ad | ||
|
|
48a00ba911 | ||
|
|
4b1102357a | ||
|
|
e3b0204b2c | ||
|
|
a2799ddcca | ||
|
|
76198f61de | ||
|
|
c3ce75055a | ||
|
|
90d64c4e15 | ||
|
|
595648a2b3 | ||
|
|
8e799ddd74 | ||
|
|
a754e9c08a | ||
|
|
112c9398e7 | ||
|
|
ccd691548e | ||
|
|
afd7b85005 | ||
|
|
f9e1cdb940 | ||
|
|
63fe657c7d | ||
|
|
ff2006ad74 | ||
|
|
55c9c7297f | ||
|
|
4b083ee72e | ||
|
|
6574ec2fb9 | ||
|
|
f54bb349b5 | ||
|
|
6f1252e27d | ||
|
|
7d65b5369f | ||
|
|
4877c81728 | ||
|
|
5cb207edfa | ||
|
|
fc39a0dedf | ||
|
|
0b3e7240a8 | ||
|
|
f32c346534 | ||
|
|
3165004d0e | ||
|
|
ec3b1cf130 | ||
|
|
a0437713bf | ||
|
|
96f7ff550c | ||
|
|
837216d78e | ||
|
|
dfb6006f9c | ||
|
|
fb0765a5f3 | ||
|
|
2e8769496f | ||
|
|
bdb39fcd8d | ||
|
|
31516c7987 | ||
|
|
b985ce06a2 | ||
|
|
12d6546062 | ||
|
|
fb71da3627 | ||
|
|
a90ffff320 | ||
|
|
9abf2bca75 | ||
|
|
3db6770dfd | ||
|
|
3a951576ee | ||
|
|
6b0d67ac36 | ||
|
|
d06b8ac398 | ||
|
|
67435ebf9e | ||
|
|
2ee29630fb | ||
|
|
7fa21e9aea | ||
|
|
b4b206f575 | ||
|
|
f363663b3e | ||
|
|
42d957e21b | ||
|
|
07f9756bc8 | ||
|
|
e958e43b49 | ||
|
|
0d150e4b08 | ||
|
|
0deff73a46 | ||
|
|
b24caf397a | ||
|
|
f051e33a0c | ||
|
|
ff2b28ac73 | ||
|
|
e2367d26d1 | ||
|
|
e1a65add5d | ||
|
|
913426bfdb | ||
|
|
d7b0726e42 | ||
|
|
cadb67e6c9 | ||
|
|
564838a439 | ||
|
|
4554bcc565 | ||
|
|
fd48335688 | ||
|
|
222f56d1b2 | ||
|
|
b71870f57b | ||
|
|
01c9632025 | ||
|
|
1533e13d68 | ||
|
|
89965ad718 | ||
|
|
eb74f3525a | ||
|
|
536f88dee0 | ||
|
|
2622ba286e | ||
|
|
a1d490cb49 | ||
|
|
b357c09171 | ||
|
|
48e71afec1 | ||
|
|
1c6fce9339 | ||
|
|
96551d3b75 | ||
|
|
7a832df4d3 | ||
|
|
c3b6121968 | ||
|
|
b3b2b65c5f | ||
|
|
7a3ccec38d | ||
|
|
d8da0a11a2 | ||
|
|
d5c3332635 | ||
|
|
0137f2254d | ||
|
|
63f649724e | ||
|
|
da769ce524 | ||
|
|
2e99636bb0 | ||
|
|
ff7f68f5b4 | ||
|
|
14eec0c902 | ||
|
|
b064c534d8 | ||
|
|
e7c0f322ee | ||
|
|
725754c427 | ||
|
|
9a6c0a0280 | ||
|
|
26d8c05ce7 | ||
|
|
91a9f20af7 | ||
|
|
90745d91aa | ||
|
|
0dbae34998 | ||
|
|
eec93b8013 | ||
|
|
cfe3f01b32 | ||
|
|
df10262ebb | ||
|
|
a87ac3e35e | ||
|
|
b71d9d2e68 | ||
|
|
43452e1af4 | ||
|
|
a4706e0785 | ||
|
|
c921ab463c | ||
|
|
892816dadf | ||
|
|
cc44a5785d | ||
|
|
172d2bf545 | ||
|
|
e7e1fd711e | ||
|
|
7493b3d2ab | ||
|
|
ba5459eeb6 | ||
|
|
31370741f2 | ||
|
|
0bd9c696df | ||
|
|
c14af4a136 | ||
|
|
8dfa841a7b | ||
|
|
a6de843c75 | ||
|
|
0bb1efcd50 | ||
|
|
26e8c2ca2b | ||
|
|
12ffca7374 | ||
|
|
e187f73044 | ||
|
|
6ecf65d83a | ||
|
|
231c173545 | ||
|
|
f12b7fd772 | ||
|
|
14ea041c72 | ||
|
|
6fb804292c | ||
|
|
f77f7361a9 | ||
|
|
d6d19d5dab | ||
|
|
8074bfacb6 | ||
|
|
f5f7b99479 | ||
|
|
f0a8c27829 | ||
|
|
30024f2341 | ||
|
|
ff0dcafeea | ||
|
|
8580451bce | ||
|
|
d867868854 | ||
|
|
b1644d4817 | ||
|
|
a9a3a04379 | ||
|
|
3aa55ee9c3 | ||
|
|
8cfc8a5492 | ||
|
|
3f1c8db362 | ||
|
|
0d999d7a70 | ||
|
|
8bc081d937 | ||
|
|
42eb8d1af5 | ||
|
|
1a810bc923 | ||
|
|
065572ef64 | ||
|
|
e88702e10c | ||
|
|
ee2d934525 | ||
|
|
2a3a33226e | ||
|
|
539315710c | ||
|
|
191a6ca76f | ||
|
|
7ac9f0cbef | ||
|
|
5f7bf4164d | ||
|
|
43690c9b2c | ||
|
|
02c14bfa5c |
No files matched your search
@@ -28,6 +28,7 @@ LOCAL_SRC_FILES := am_map.c \
|
||||
m_cheat.c \
|
||||
m_fixed.c \
|
||||
m_menu.c \
|
||||
m_textinput.c \
|
||||
m_misc.c \
|
||||
m_queue.c \
|
||||
m_random.c \
|
||||
|
||||
+557
-551
File diff suppressed because it is too large.
Load diff
+15
-12
@@ -213,9 +213,9 @@ DOSATURNSYNCH=1
|
||||
ifndef NOSATURNJOIN
|
||||
DOSATURNJOIN=1
|
||||
endif
|
||||
#ifndef NOSATURNPAK
|
||||
#DOSATURNPAK=1
|
||||
#endif
|
||||
ifndef NOSATURNPAK
|
||||
DOSATURNPAK=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -229,6 +229,7 @@ endif
|
||||
|
||||
ifdef LINUX
|
||||
UNIXCOMMON=1
|
||||
NOOBJDUMP=1
|
||||
ifndef NOGME
|
||||
HAVE_LIBGME=1
|
||||
endif
|
||||
@@ -293,11 +294,11 @@ ifdef NOHW
|
||||
else
|
||||
OPTS+=-DHWRENDER
|
||||
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o \
|
||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o \
|
||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_portal.o\
|
||||
$(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
|
||||
@@ -404,9 +405,9 @@ OPTS+=-DDOSATURNSYNCH
|
||||
ifndef NOSATURNJOIN
|
||||
OPTS+=-DDOSATURNJOIN
|
||||
endif
|
||||
#ifndef NOSATURNPAK
|
||||
#OPTS+=-DDOSATURNPAK
|
||||
#endif
|
||||
ifndef NOSATURNPAK
|
||||
OPTS+=-DDOSATURNPAK
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -529,6 +530,7 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/m_fixed.o \
|
||||
$(OBJDIR)/m_menu.o \
|
||||
$(OBJDIR)/m_misc.o \
|
||||
$(OBJDIR)/m_textinput.o \
|
||||
$(OBJDIR)/m_perfstats.o \
|
||||
$(OBJDIR)/m_random.o \
|
||||
$(OBJDIR)/m_queue.o \
|
||||
@@ -562,6 +564,7 @@ OBJS:=$(i_main_o) \
|
||||
$(OBJDIR)/r_splats.o \
|
||||
$(OBJDIR)/r_patch.o \
|
||||
$(OBJDIR)/r_things.o \
|
||||
$(OBJDIR)/r_portal.o \
|
||||
$(OBJDIR)/screen.o \
|
||||
$(OBJDIR)/v_video.o \
|
||||
$(OBJDIR)/s_sound.o \
|
||||
@@ -735,18 +738,18 @@ 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_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 \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.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_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 \
|
||||
am_map.h d_event.h d_player.h p_pspr.h m_fixed.h tables.h info.h d_think.h \
|
||||
p_mobj.h doomdata.h d_ticcmd.h r_defs.h hardware/hw_dll.h
|
||||
|
||||
+379
-128
@@ -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)
|
||||
@@ -260,25 +254,15 @@ static inline void AM_restoreScaleAndLoc(void)
|
||||
*/
|
||||
static void AM_findMinMaxBoundaries(void)
|
||||
{
|
||||
size_t i;
|
||||
fixed_t a;
|
||||
fixed_t b;
|
||||
fixed_t a, b;
|
||||
|
||||
min_x = min_y = +INT32_MAX;
|
||||
max_x = max_y = -INT32_MAX;
|
||||
min_x = minimapinfo.min_x << MAPBITS;
|
||||
max_x = minimapinfo.max_x << MAPBITS;
|
||||
min_y = minimapinfo.min_y << MAPBITS;
|
||||
max_y = minimapinfo.max_y << MAPBITS;
|
||||
|
||||
for (i = 0; i < numvertexes; i++)
|
||||
{
|
||||
if (vertexes[i].x < min_x)
|
||||
min_x = vertexes[i].x;
|
||||
else if (vertexes[i].x > max_x)
|
||||
max_x = vertexes[i].x;
|
||||
|
||||
if (vertexes[i].y < min_y)
|
||||
min_y = vertexes[i].y;
|
||||
else if (vertexes[i].y > max_y)
|
||||
max_y = vertexes[i].y;
|
||||
}
|
||||
max_w = minimapinfo.map_w << MAPBITS;
|
||||
max_h = minimapinfo.map_h << MAPBITS;
|
||||
|
||||
max_w = (max_x >>= FRACTOMAPBITS) - (min_x >>= FRACTOMAPBITS);
|
||||
max_h = (max_y >>= FRACTOMAPBITS) - (min_y >>= FRACTOMAPBITS);
|
||||
@@ -350,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)
|
||||
@@ -387,7 +372,7 @@ void AM_Stop(void)
|
||||
*
|
||||
* \sa AM_Stop
|
||||
*/
|
||||
static inline void AM_Start(void)
|
||||
void AM_Start(void)
|
||||
{
|
||||
static INT32 lastlevel = -1;
|
||||
|
||||
@@ -396,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();
|
||||
@@ -423,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.
|
||||
@@ -455,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();
|
||||
@@ -497,6 +521,7 @@ boolean AM_Responder(event_t *ev)
|
||||
}
|
||||
else
|
||||
AM_restoreScaleAndLoc();
|
||||
AM_setWindowPanning();
|
||||
break;
|
||||
case AM_FOLLOWKEY:
|
||||
followplayer = !followplayer;
|
||||
@@ -516,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:
|
||||
@@ -724,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
|
||||
//
|
||||
@@ -745,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;
|
||||
@@ -763,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)
|
||||
@@ -780,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)
|
||||
@@ -792,8 +843,6 @@ static void AM_drawFline_soft(const fline_t *fl, INT32 color)
|
||||
d += ax;
|
||||
}
|
||||
}
|
||||
|
||||
#undef PUTDOT
|
||||
}
|
||||
|
||||
//
|
||||
@@ -815,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;
|
||||
@@ -834,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;
|
||||
@@ -849,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
|
||||
|
||||
@@ -866,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.
|
||||
@@ -1006,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;
|
||||
}
|
||||
|
||||
@@ -1023,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1043,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.
|
||||
@@ -1059,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
|
||||
+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__
|
||||
+1
-1
@@ -628,7 +628,7 @@ static void COM_ExecuteString(char *ptext)
|
||||
|
||||
// check cvars
|
||||
// Hurdler: added at Ebola's request ;)
|
||||
// (don't flood the console in software mode with bad gr_xxx command)
|
||||
// (don't flood the console in software mode with bad gl_xxx command)
|
||||
if (!CV_Command() && con_destlines)
|
||||
CONS_Printf(M_GetText("Unknown command '%s'\n"), COM_Argv(0));
|
||||
}
|
||||
|
||||
+49
-349
@@ -32,6 +32,7 @@
|
||||
#include "i_threads.h"
|
||||
#include "d_main.h"
|
||||
#include "m_menu.h"
|
||||
#include "m_textinput.h"
|
||||
#include "filesrch.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
@@ -97,9 +98,7 @@ static char inputlines[32][CON_MAXPROMPTCHARS]; // hold last 32 prompt lines
|
||||
|
||||
static INT32 inputline; // current input line number
|
||||
static INT32 inputhist; // line number of history input line to restore
|
||||
static size_t input_cur; // position of cursor in line
|
||||
static size_t input_sel; // position of selection marker (I.E.: anything between this and input_cur is "selected")
|
||||
static size_t input_len; // length of current line, used to bound cursor and such
|
||||
static textinput_t input;
|
||||
// notice: input does NOT include the "$" at the start of the line. - 11/3/16
|
||||
|
||||
// protos.
|
||||
@@ -458,7 +457,8 @@ static void CON_InputInit(void)
|
||||
// prepare the first prompt line
|
||||
memset(inputlines, 0, sizeof (inputlines));
|
||||
inputline = 0;
|
||||
input_cur = input_sel = input_len = 0;
|
||||
|
||||
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
@@ -802,178 +802,6 @@ void CON_Ticker(void)
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
//
|
||||
// ----
|
||||
//
|
||||
// Shortcuts for adding and deleting characters, strings, and sections
|
||||
// Necessary due to moving cursor
|
||||
//
|
||||
|
||||
static void CON_InputClear(void)
|
||||
{
|
||||
Lock_state();
|
||||
|
||||
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
|
||||
input_cur = input_sel = input_len = 0;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputSetString(const char *c)
|
||||
{
|
||||
Lock_state();
|
||||
|
||||
memset(inputlines[inputline], 0, CON_MAXPROMPTCHARS);
|
||||
strcpy(inputlines[inputline], c);
|
||||
input_cur = input_sel = input_len = strlen(c);
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputAddString(const char *c)
|
||||
{
|
||||
size_t csize = strlen(c);
|
||||
|
||||
Lock_state();
|
||||
|
||||
if (input_len + csize > CON_MAXPROMPTCHARS-1)
|
||||
{
|
||||
Unlock_state();
|
||||
return;
|
||||
}
|
||||
if (input_cur != input_len)
|
||||
memmove(&inputlines[inputline][input_cur+csize], &inputlines[inputline][input_cur], input_len-input_cur);
|
||||
memcpy(&inputlines[inputline][input_cur], c, csize);
|
||||
input_len += csize;
|
||||
input_sel = (input_cur += csize);
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputDel(size_t start, size_t end)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
Lock_state();
|
||||
|
||||
len = (end - start);
|
||||
|
||||
if (end != input_len)
|
||||
memmove(&inputlines[inputline][start], &inputlines[inputline][end], input_len-end);
|
||||
memset(&inputlines[inputline][input_len - len], 0, len);
|
||||
|
||||
input_len -= len;
|
||||
|
||||
if (input_sel >= end)
|
||||
input_sel -= len;
|
||||
else if (input_sel > start)
|
||||
input_sel = start;
|
||||
|
||||
if (input_cur >= end)
|
||||
input_cur -= len;
|
||||
else if (input_cur > start)
|
||||
input_cur = start;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputDelSelection(void)
|
||||
{
|
||||
size_t start, end;
|
||||
|
||||
Lock_state();
|
||||
|
||||
if (input_cur > input_sel)
|
||||
{
|
||||
start = input_sel;
|
||||
end = input_cur;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = input_cur;
|
||||
end = input_sel;
|
||||
}
|
||||
|
||||
CON_InputDel(start, end);
|
||||
|
||||
input_sel = input_cur = start;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_ToWordEnd(boolean move_sel)
|
||||
{
|
||||
Lock_state();
|
||||
|
||||
// Skip spaces
|
||||
while (input_cur < input_len && isspace(inputlines[inputline][input_cur]))
|
||||
++input_cur;
|
||||
|
||||
// Skip word
|
||||
while (input_cur < input_len && !isspace(inputlines[inputline][input_cur]))
|
||||
++input_cur;
|
||||
|
||||
if (move_sel) input_sel = input_cur;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_ToWordBegin(boolean move_sel)
|
||||
{
|
||||
Lock_state();
|
||||
|
||||
// Hack, always move back 1 character if possible so if we press ctrl-left at a word beginning
|
||||
// we move to previous word
|
||||
if (input_cur) --input_cur;
|
||||
|
||||
// Skip spaces
|
||||
while (input_cur && isspace(inputlines[inputline][input_cur]))
|
||||
--input_cur;
|
||||
|
||||
// Skip word
|
||||
while (input_cur && !isspace(inputlines[inputline][input_cur]))
|
||||
--input_cur;
|
||||
|
||||
// Unless we reached beginning of line, we're pointing at a space before word, so move cursor
|
||||
// forward to fix that
|
||||
if (input_cur) ++input_cur;
|
||||
|
||||
if (move_sel) input_sel = input_cur;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputAddChar(char c)
|
||||
{
|
||||
if (input_len >= CON_MAXPROMPTCHARS-1)
|
||||
return;
|
||||
|
||||
Lock_state();
|
||||
|
||||
if (input_cur != input_len)
|
||||
memmove(&inputlines[inputline][input_cur+1], &inputlines[inputline][input_cur], input_len-input_cur);
|
||||
inputlines[inputline][input_cur++] = c;
|
||||
inputlines[inputline][++input_len] = 0;
|
||||
input_sel = input_cur;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
static void CON_InputDelChar(void)
|
||||
{
|
||||
if (!input_cur)
|
||||
return;
|
||||
|
||||
Lock_state();
|
||||
|
||||
if (input_cur != input_len)
|
||||
memmove(&inputlines[inputline][input_cur-1], &inputlines[inputline][input_cur], input_len-input_cur);
|
||||
inputlines[inputline][--input_len] = 0;
|
||||
input_sel = --input_cur;
|
||||
|
||||
Unlock_state();
|
||||
}
|
||||
|
||||
//
|
||||
// ----
|
||||
//
|
||||
@@ -1054,6 +882,10 @@ boolean CON_Responder(event_t *ev)
|
||||
}
|
||||
}
|
||||
|
||||
Lock_state();
|
||||
M_TextInputHandle(&input, key);
|
||||
Unlock_state();
|
||||
|
||||
// Always eat ctrl/shift/alt if console open, so the menu doesn't get ideas
|
||||
if (key == KEY_LSHIFT || key == KEY_RSHIFT
|
||||
|| key == KEY_LCTRL || key == KEY_RCTRL
|
||||
@@ -1066,12 +898,11 @@ boolean CON_Responder(event_t *ev)
|
||||
// show all cvars/commands that match what we have inputted
|
||||
if (key == KEY_TAB)
|
||||
{
|
||||
|
||||
if (!completion[0])
|
||||
{
|
||||
if (!input_len || input_len >= 40 || strchr(inputlines[inputline], ' '))
|
||||
if (!input.length || input.length >= 40 || strchr(input.buffer, ' '))
|
||||
return true;
|
||||
strcpy(completion, inputlines[inputline]);
|
||||
strcpy(completion, input.buffer);
|
||||
comskips = varskips = 0;
|
||||
}
|
||||
|
||||
@@ -1092,74 +923,9 @@ boolean CON_Responder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == 'x' || key == 'X')
|
||||
{
|
||||
if (input_sel > input_cur)
|
||||
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
|
||||
else
|
||||
I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel);
|
||||
CON_InputDelSelection();
|
||||
// Those are already handled in M_TextInputHandle, but they do extra logic... Maybe textinput_t should have some sort of callbacks?
|
||||
if (key == 'x' || key == 'X' || key == 'v' || key == 'V')
|
||||
completion[0] = 0;
|
||||
return true;
|
||||
}
|
||||
else if (key == 'c' || key == 'C')
|
||||
{
|
||||
if (input_sel > input_cur)
|
||||
I_ClipboardCopy(&inputlines[inputline][input_cur], input_sel-input_cur);
|
||||
else
|
||||
I_ClipboardCopy(&inputlines[inputline][input_sel], input_cur-input_sel);
|
||||
return true;
|
||||
}
|
||||
else if (key == 'v' || key == 'V')
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
if (input_sel != input_cur)
|
||||
CON_InputDelSelection();
|
||||
if (paste != NULL)
|
||||
CON_InputAddString(paste);
|
||||
completion[0] = 0;
|
||||
return true;
|
||||
}
|
||||
else if (key == 'w' || key == 'W')
|
||||
{
|
||||
size_t word_start, word_end, i;
|
||||
word_end = i = input_cur;
|
||||
|
||||
// Unless we're pointing at the beginning of line, decrement i so we only start
|
||||
// removing symbols that come before the cursor
|
||||
if (i) --i;
|
||||
|
||||
// We might be pointing to spaces, skip them first
|
||||
while (i && isspace(inputlines[inputline][i]))
|
||||
--i;
|
||||
|
||||
// Now skip the "word"
|
||||
while (i && !isspace(inputlines[inputline][i]))
|
||||
--i;
|
||||
|
||||
// Unless we reached beginning of line, i is pointing at first space that was found
|
||||
// before word start, and we don't want to remove it
|
||||
if (i) ++i;
|
||||
|
||||
word_start = i;
|
||||
|
||||
if (word_start != word_end)
|
||||
CON_InputDel(word_start, word_end);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
CON_ToWordEnd(!shiftdown);
|
||||
else if (key == KEY_LEFTARROW)
|
||||
CON_ToWordBegin(!shiftdown);
|
||||
|
||||
// Select all
|
||||
if (key == 'a' || key == 'A')
|
||||
{
|
||||
input_sel = 0;
|
||||
input_cur = input_len;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ...why shouldn't it eat the key? if it doesn't, it just means you
|
||||
// can control Sonic from the console, which is silly
|
||||
@@ -1174,9 +940,9 @@ boolean CON_Responder(event_t *ev)
|
||||
// remember typing for several completions (a-la-4dos)
|
||||
if (!completion[0])
|
||||
{
|
||||
if (!input_len || input_len >= 40 || strchr(inputlines[inputline], ' '))
|
||||
if (!input.length || input.length >= 40 || strchr(input.buffer, ' '))
|
||||
return true;
|
||||
strcpy(completion, inputlines[inputline]);
|
||||
strcpy(completion, input.buffer);
|
||||
comskips = varskips = 0;
|
||||
}
|
||||
else
|
||||
@@ -1207,7 +973,11 @@ boolean CON_Responder(event_t *ev)
|
||||
cmd = CV_CompleteVar(completion, varskips);
|
||||
|
||||
if (cmd)
|
||||
CON_InputSetString(va("%s ", cmd));
|
||||
{
|
||||
Lock_state();
|
||||
M_TextInputSetString(&input, va("%s ", cmd));
|
||||
Unlock_state();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (comskips > 0)
|
||||
@@ -1233,37 +1003,6 @@ boolean CON_Responder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == KEY_LEFTARROW)
|
||||
{
|
||||
if (input_cur != 0)
|
||||
--input_cur;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
{
|
||||
if (input_cur < input_len)
|
||||
++input_cur;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_HOME)
|
||||
{
|
||||
input_cur = 0;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_END)
|
||||
{
|
||||
input_cur = input_len;
|
||||
if (!shiftdown)
|
||||
input_sel = input_cur;
|
||||
return true;
|
||||
}
|
||||
|
||||
// At this point we're messing with input
|
||||
// Clear completion
|
||||
completion[0] = 0;
|
||||
@@ -1271,45 +1010,29 @@ boolean CON_Responder(event_t *ev)
|
||||
// command enter
|
||||
if (key == KEY_ENTER)
|
||||
{
|
||||
if (!input_len)
|
||||
if (!input.length)
|
||||
return true;
|
||||
|
||||
// push the command
|
||||
COM_BufAddText(inputlines[inputline]);
|
||||
COM_BufAddText(input.buffer);
|
||||
COM_BufAddText("\n");
|
||||
|
||||
CONS_Printf("\x86""%c""\x80""%s\n", CON_PROMPTCHAR, inputlines[inputline]);
|
||||
|
||||
Lock_state();
|
||||
|
||||
// Only add command to history if it differs from previous one
|
||||
if (strcmp(inputlines[inputline], inputlines[(inputline-1) & 31]))
|
||||
if (strcmp(input.buffer, inputlines[(inputline-1) & 31]))
|
||||
{
|
||||
inputline = (inputline+1) & 31;
|
||||
M_TextInputInit(&input, inputlines[inputline], CON_MAXPROMPTCHARS);
|
||||
}
|
||||
|
||||
inputhist = inputline;
|
||||
CON_InputClear();
|
||||
M_TextInputClear(&input);
|
||||
|
||||
return true;
|
||||
}
|
||||
Unlock_state();
|
||||
|
||||
// backspace and delete command prompt
|
||||
if (input_sel != input_cur)
|
||||
{
|
||||
if (key == KEY_BACKSPACE || key == KEY_DEL)
|
||||
{
|
||||
CON_InputDelSelection();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (key == KEY_BACKSPACE)
|
||||
{
|
||||
CON_InputDelChar();
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_DEL)
|
||||
{
|
||||
if (input_cur == input_len)
|
||||
return true;
|
||||
++input_cur;
|
||||
CON_InputDelChar();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1326,7 +1049,9 @@ boolean CON_Responder(event_t *ev)
|
||||
if (inputhist == inputline)
|
||||
inputhist = (inputline + 1) & 31;
|
||||
|
||||
CON_InputSetString(inputlines[inputhist]);
|
||||
Lock_state();
|
||||
M_TextInputSetString(&input, inputlines[inputhist]);
|
||||
Unlock_state();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1340,41 +1065,16 @@ boolean CON_Responder(event_t *ev)
|
||||
while (inputhist != inputline && !inputlines[inputhist][0]);
|
||||
|
||||
// back to currentline
|
||||
Lock_state();
|
||||
if (inputhist == inputline)
|
||||
CON_InputClear();
|
||||
M_TextInputClear(&input);
|
||||
else
|
||||
CON_InputSetString(inputlines[inputhist]);
|
||||
M_TextInputSetString(&input, inputlines[inputhist]);
|
||||
Unlock_state();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// allow people to use keypad in console (good for typing IP addresses) - Calum
|
||||
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
|
||||
{
|
||||
char keypad_translation[] = {'7','8','9','-',
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'};
|
||||
|
||||
key = keypad_translation[key - KEY_KEYPAD7];
|
||||
}
|
||||
else if (key == KEY_KPADSLASH)
|
||||
key = '/';
|
||||
|
||||
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
|
||||
key = CON_ShiftChar(key);
|
||||
|
||||
// enter a char into the command prompt
|
||||
if (key < 32 || key > 127)
|
||||
return true;
|
||||
|
||||
// add key to cmd line here
|
||||
if (key >= 'A' && key <= 'Z' && !(shiftdown ^ capslock)) //this is only really necessary for dedicated servers
|
||||
key = key + 'a' - 'A';
|
||||
|
||||
if (input_sel != input_cur)
|
||||
CON_InputDelSelection();
|
||||
CON_InputAddChar(key);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1536,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
|
||||
@@ -1656,16 +1356,16 @@ static void CON_DrawInput(void)
|
||||
|
||||
clen = con_width-13;
|
||||
|
||||
if (input_len <= clen)
|
||||
if (input.length <= clen)
|
||||
{
|
||||
c = 0;
|
||||
clen = input_len;
|
||||
clen = input.length;
|
||||
}
|
||||
else // input line scrolls left if it gets too long
|
||||
{
|
||||
clen -= 2; // There will always be some extra truncation -- but where is what we'll find out
|
||||
|
||||
if (input_cur <= clen/2)
|
||||
if (input.cursor <= clen/2)
|
||||
{
|
||||
// Close enough to right edge to show all
|
||||
c = 0;
|
||||
@@ -1676,15 +1376,15 @@ static void CON_DrawInput(void)
|
||||
{
|
||||
// Cursor in the middle (or right side) of input
|
||||
// Move over for the ellipsis
|
||||
c = input_cur - (clen/2) + 2;
|
||||
c = input.cursor - (clen/2) + 2;
|
||||
x += charwidth*2;
|
||||
lellip = 1;
|
||||
|
||||
if (c + clen >= input_len)
|
||||
if (c + clen >= input.length)
|
||||
{
|
||||
// Cursor in the right side of input
|
||||
// We were too far over, so move back
|
||||
c = input_len - clen;
|
||||
c = input.length - clen;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1698,7 +1398,7 @@ static void CON_DrawInput(void)
|
||||
if (lellip)
|
||||
{
|
||||
x -= charwidth*3;
|
||||
if (input_sel < c)
|
||||
if (input.select < c)
|
||||
V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 107 | V_NOSCALESTART);
|
||||
for (i = 0; i < 3; ++i, x += charwidth)
|
||||
V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value);
|
||||
@@ -1708,7 +1408,7 @@ static void CON_DrawInput(void)
|
||||
|
||||
for (cend = c + clen; c < cend; ++c, x += charwidth)
|
||||
{
|
||||
if ((input_sel > c && input_cur <= c) || (input_sel <= c && input_cur > c))
|
||||
if ((input.select > c && input.cursor <= c) || (input.select <= c && input.cursor > c))
|
||||
{
|
||||
V_DrawFill(x, y, charwidth, (10 * con_scalefactor), 107 | V_NOSCALESTART);
|
||||
V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_YELLOWMAP | V_NOSCALESTART, !cv_allcaps.value);
|
||||
@@ -1716,14 +1416,14 @@ static void CON_DrawInput(void)
|
||||
else
|
||||
V_DrawCharacter(x, y, p[c] | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
|
||||
if (c == input_cur && con_tick >= 4)
|
||||
if (c == input.cursor && con_tick >= 4)
|
||||
V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
}
|
||||
if (cend == input_cur && con_tick >= 4)
|
||||
if (cend == input.cursor && con_tick >= 4)
|
||||
V_DrawCharacter(x, y + (con_scalefactor*2), '_' | cv_constextsize.value | V_NOSCALESTART, !cv_allcaps.value);
|
||||
if (rellip)
|
||||
{
|
||||
if (input_sel > cend)
|
||||
if (input.select > cend)
|
||||
V_DrawFill(x, y, charwidth*3, (10 * con_scalefactor), 107 | V_NOSCALESTART);
|
||||
for (i = 0; i < 3; ++i, x += charwidth)
|
||||
V_DrawCharacter(x, y, '.' | cv_constextsize.value | V_GRAYMAP | V_NOSCALESTART, !cv_allcaps.value);
|
||||
|
||||
+409
-435
File diff suppressed because it is too large.
Load diff
+6
-6
@@ -600,10 +600,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,16 +645,18 @@ extern char motd[254], server_context[8];
|
||||
extern UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
INT32 D_NumPlayers(void);
|
||||
|
||||
void D_ResetTiccmds(void);
|
||||
ticcmd_t *D_LocalTiccmd(UINT8 ss);
|
||||
|
||||
tic_t GetLag(INT32 node);
|
||||
UINT8 GetFreeXCmdSize(void);
|
||||
//UINT8 GetFreeXCmdSize(UINT8 playerid);
|
||||
|
||||
extern UINT8 hu_resynching;
|
||||
#ifdef SATURNSYNCH
|
||||
extern UINT8 hu_redownloadinggamestate;
|
||||
#endif
|
||||
extern UINT8 hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
|
||||
extern boolean hu_stopped; // kart, true when the game is stopped for players due to a disconnecting or connecting player
|
||||
|
||||
typedef struct rewind_s {
|
||||
UINT8 savebuffer[(768*1024)];
|
||||
|
||||
+91
-108
@@ -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>
|
||||
@@ -99,7 +100,6 @@ UINT8 window_notinfocus = false;
|
||||
// DEMO LOOP
|
||||
//
|
||||
//static INT32 demosequence;
|
||||
static const char *pagename = "MAP1PIC";
|
||||
static char *startupwadfiles[MAX_WADFILES];
|
||||
static char *startuppwads[MAX_WADFILES];
|
||||
|
||||
@@ -116,7 +116,6 @@ boolean devparm = false; // started game with -devparm
|
||||
boolean singletics = false; // timedemo
|
||||
boolean lastdraw = false;
|
||||
|
||||
postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
|
||||
INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
// These variables are only true if
|
||||
@@ -183,7 +182,7 @@ static inline void D_DeviceLEDTick(void)
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (G_GetDeviceForPlayer(i) == 0)
|
||||
if (cv_usejoystick[i].value == 0)
|
||||
continue;
|
||||
|
||||
color[i] = G_GetSkinColor(i);
|
||||
@@ -451,6 +450,8 @@ static boolean D_Display(void)
|
||||
{
|
||||
if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD)
|
||||
{
|
||||
viewssnum = i;
|
||||
|
||||
if (i == 0) // Initialize for P1
|
||||
{
|
||||
viewwindowy = 0;
|
||||
@@ -460,8 +461,6 @@ static boolean D_Display(void)
|
||||
objectsdrawn = 0;
|
||||
}
|
||||
|
||||
viewssnum = i;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
HWR_RenderPlayerView(i, &players[displayplayers[i]]);
|
||||
@@ -513,15 +512,12 @@ static boolean D_Display(void)
|
||||
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (!splitscreen)
|
||||
R_ApplyViewMorph();
|
||||
if (!splitscreen)
|
||||
R_ApplyViewMorph();
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (!postimgtype[i])
|
||||
continue;
|
||||
|
||||
V_DoPostProcessor(i, postimgtype[i], postimgparam[i]);
|
||||
V_DoPostProcessor(i, &players[displayplayers[i]], postimgparam[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,6 +538,8 @@ static boolean D_Display(void)
|
||||
PS_START_TIMING(ps_uitime);
|
||||
ST_Drawer();
|
||||
HU_Drawer();
|
||||
|
||||
NetUpdate(); // TEST: run this EVERY frame
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -568,7 +566,7 @@ static boolean D_Display(void)
|
||||
V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, V_SNAPTOTOP, patch);
|
||||
}
|
||||
|
||||
if (demo.rewinding)
|
||||
if (rendermode == render_soft && demo.rewinding)
|
||||
V_DrawFadeScreen(TC_RAINBOW, (leveltime & 0x20) ? SKINCOLOR_PASTEL : SKINCOLOR_MOONSLAM);
|
||||
|
||||
// vid size change is now finished if it was on...
|
||||
@@ -654,7 +652,7 @@ static boolean D_Display(void)
|
||||
// =========================================================================
|
||||
|
||||
tic_t rendergametic;
|
||||
static int menuInputDelayTimer = 0;
|
||||
static SINT8 menuInputDelayTimer = 0;
|
||||
|
||||
void D_SRB2Loop(void)
|
||||
{
|
||||
@@ -745,10 +743,10 @@ void D_SRB2Loop(void)
|
||||
|
||||
renderisnewtic = (realtics > 0 || singletics);
|
||||
|
||||
refreshdirmenu = 0; // not sure where to put this, here as good as any?
|
||||
|
||||
if (renderisnewtic)
|
||||
{
|
||||
refreshdirmenu = 0; // not sure where to put this, here as good as any?
|
||||
|
||||
// don't skip more than 10 frames at a time
|
||||
// (fadein / fadeout cause massive frame skip!)
|
||||
if (realtics > 8)
|
||||
@@ -780,13 +778,45 @@ 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))
|
||||
{
|
||||
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)
|
||||
}
|
||||
}
|
||||
else
|
||||
menuInputDelayTimer = 0;
|
||||
#undef DPADSCROLLINPUT
|
||||
|
||||
D_DeviceLEDTick();
|
||||
}
|
||||
|
||||
if (interp)
|
||||
{
|
||||
renderdeltatics = FLOAT_TO_FIXED(deltatics);
|
||||
|
||||
if (!(paused || P_AutoPause()) && deltatics < 1.0 && !hu_stopped)
|
||||
if (!(paused || P_AutoPause()) && !hu_stopped)
|
||||
{
|
||||
rendertimefrac = g_time.timefrac;
|
||||
}
|
||||
@@ -794,11 +824,21 @@ void D_SRB2Loop(void)
|
||||
{
|
||||
rendertimefrac = FRACUNIT;
|
||||
}
|
||||
|
||||
if (!hu_stopped)
|
||||
{
|
||||
rendertimefrac_unpaused = g_time.timefrac;
|
||||
}
|
||||
else
|
||||
{
|
||||
rendertimefrac_unpaused = FRACUNIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
renderdeltatics = realtics * FRACUNIT;
|
||||
rendertimefrac = FRACUNIT;
|
||||
rendertimefrac_unpaused = FRACUNIT;
|
||||
}
|
||||
|
||||
if ((interp || doDisplay) && !frameskip)
|
||||
@@ -822,53 +862,12 @@ void D_SRB2Loop(void)
|
||||
LUA_Step();
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
if (! dedicated)
|
||||
if (!dedicated)
|
||||
{
|
||||
Discord_RunCallbacks();
|
||||
}
|
||||
#endif
|
||||
|
||||
// this is absolutely awful and i hate it lmao
|
||||
if (menuactive && (DPADUPSCROLL || DPADDOWNSCROLL || DPADLEFTSCROLL || DPADRIGHTSCROLL))
|
||||
{
|
||||
event_t myev;
|
||||
myev.type = ev_keydown;
|
||||
|
||||
if (renderisnewtic)
|
||||
{
|
||||
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)
|
||||
{
|
||||
myev.data1 = KEY_UPARROW;
|
||||
M_Responder(&myev);
|
||||
}
|
||||
else if (DPADDOWNSCROLL)
|
||||
{
|
||||
myev.data1 = KEY_DOWNARROW;
|
||||
M_Responder(&myev);
|
||||
}
|
||||
else if (DPADLEFTSCROLL)
|
||||
{
|
||||
myev.data1 = KEY_LEFTARROW;
|
||||
M_Responder(&myev);
|
||||
}
|
||||
else if (DPADRIGHTSCROLL)
|
||||
{
|
||||
myev.data1 = KEY_RIGHTARROW;
|
||||
M_Responder(&myev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
menuInputDelayTimer = 0;
|
||||
|
||||
if (!dedicated && renderisnewtic) // idk does this need dedi check??
|
||||
D_DeviceLEDTick();
|
||||
|
||||
// Fully completed frame made.
|
||||
finishprecise = I_GetPreciseTime();
|
||||
|
||||
@@ -968,10 +967,14 @@ void D_StartTitle(void)
|
||||
|
||||
gameaction = ga_nothing;
|
||||
memset(displayplayers, 0, sizeof(displayplayers));
|
||||
memset(g_localplayers, 0, sizeof g_localplayers);
|
||||
consoleplayer = 0;
|
||||
//demosequence = -1;
|
||||
gametype = GT_RACE; // SRB2kart
|
||||
paused = false;
|
||||
|
||||
S_ResetKeepAndSpecialMus(); // just in case
|
||||
|
||||
F_StartTitleScreen();
|
||||
|
||||
// Reset the palette -- SRB2Kart: actually never mind let's do this in the middle of every fade
|
||||
@@ -1078,8 +1081,7 @@ static void D_FindAddonsToAutoload(void)
|
||||
const char *autoloadpath;
|
||||
boolean postload;
|
||||
|
||||
INT32 i, len;
|
||||
boolean hasprefix = false;
|
||||
INT32 i;
|
||||
char wadsToAutoload[256] = "";
|
||||
|
||||
// does it exist tho
|
||||
@@ -1101,7 +1103,8 @@ static void D_FindAddonsToAutoload(void)
|
||||
|| (wadsToAutoload[0] == '#'))
|
||||
continue;
|
||||
// this marks it so that it loads after loading server addons
|
||||
else if (fastncmp(wadsToAutoload, "postload ", 9)) {
|
||||
else if (fastncmp(wadsToAutoload, "postload ", 9))
|
||||
{
|
||||
strremove(wadsToAutoload, "postload ");
|
||||
postload = true;
|
||||
}
|
||||
@@ -1113,34 +1116,10 @@ static void D_FindAddonsToAutoload(void)
|
||||
wadsToAutoload[i] = '\0';
|
||||
}
|
||||
|
||||
len = strlen(wadsToAutoload);
|
||||
hasprefix = false;
|
||||
|
||||
for (i = 0; i < len; ++i)
|
||||
if (!postload && W_CheckPostLoadList(wadsToAutoload))
|
||||
{
|
||||
if (wadsToAutoload[i] == '_')
|
||||
{
|
||||
hasprefix = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Lets just hope no one adds bonuschars in autoload
|
||||
if (hasprefix)
|
||||
{
|
||||
// We searching for c in prefix, which stands for "character" and doesn't work well with
|
||||
// autoload atm, only fine for postload
|
||||
for (i = 0; i < len; ++i)
|
||||
{
|
||||
if (wadsToAutoload[i] == '_') break; // Prefix end
|
||||
|
||||
if (wadsToAutoload[i] == 'c' || wadsToAutoload[i] == 'C')
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "forcing postload for %s as local skin\n", wadsToAutoload);
|
||||
postload = true;
|
||||
break; // Found it
|
||||
}
|
||||
}
|
||||
CONS_Printf("forcing postload for file %s\n", wadsToAutoload);
|
||||
postload = true;
|
||||
}
|
||||
|
||||
// LOAD IT
|
||||
@@ -1158,30 +1137,30 @@ static void D_FindAddonsToAutoload(void)
|
||||
fclose(autoloadconfigfile);
|
||||
}
|
||||
|
||||
void D_AddAutoloadFiles(void)
|
||||
static void D_AddAutoloadFiles(void)
|
||||
{
|
||||
if (wasautoloaded && postautoloaded)
|
||||
if (wasautoloaded)
|
||||
return;
|
||||
|
||||
if (!wasautoloaded && !modeattacking)
|
||||
{
|
||||
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfiles);
|
||||
CONS_Printf("D_AutoloadFile(): Loading autoloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfiles) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfiles);
|
||||
|
||||
wasautoloaded = true;
|
||||
}
|
||||
wasautoloaded = true;
|
||||
}
|
||||
|
||||
if ((!postautoloaded) && netgame)
|
||||
{
|
||||
CONS_Printf("D_AutoloadFile(): Loading postloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
|
||||
CONS_Printf("D_AutoloadFile(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfilespost);
|
||||
void D_AddPostloadFiles(void)
|
||||
{
|
||||
if (postautoloaded || !netgame)
|
||||
return;
|
||||
|
||||
postautoloaded = true;
|
||||
}
|
||||
CONS_Printf("D_AddPostloadFiles(): Loading postloaded addons...\n");
|
||||
if (W_AddAutoloadedLocalFiles(autoloadwadfilespost) == 0)
|
||||
CONS_Printf("D_AddPostloadFiles(): Are you sure you put in valid files or what?\n");
|
||||
D_CleanFile(autoloadwadfilespost);
|
||||
|
||||
postautoloaded = true;
|
||||
}
|
||||
|
||||
void D_CleanFile(char **filearray)
|
||||
@@ -1677,6 +1656,10 @@ void D_SRB2Main(void)
|
||||
#undef PUSHSPEEDO
|
||||
memcpy(speedo_cons_t, speedo_cons_temp, sizeof(speedo_cons_t));
|
||||
|
||||
// Do it before P_InitMapData because PNG patch
|
||||
// conversion sometimes needs the palette
|
||||
V_ReloadPalette();
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
@@ -1867,11 +1850,12 @@ void D_SRB2Main(void)
|
||||
}
|
||||
|
||||
S_InitMusicDefs();
|
||||
S_InitMTDefs();
|
||||
|
||||
CONS_Printf("ST_Init(): Init status bar.\n");
|
||||
ST_Init();
|
||||
|
||||
D_AddAutoloadFiles();
|
||||
|
||||
// Set up splitscreen players before joining!
|
||||
if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm()))
|
||||
{
|
||||
@@ -2073,7 +2057,6 @@ void D_SRB2Main(void)
|
||||
|
||||
if (dedicated && server)
|
||||
{
|
||||
pagename = "TITLESKY";
|
||||
levelstarttic = gametic;
|
||||
G_SetGamestate(GS_LEVEL);
|
||||
if (!P_SetupLevel(false, false))
|
||||
|
||||
+3
-3
@@ -45,12 +45,12 @@ extern boolean statdp; // stat display for extended player setup
|
||||
extern boolean nametaggfx; // Nametag stuffs
|
||||
extern boolean driftgaugegfx;
|
||||
|
||||
void D_AddAutoloadFiles(void);
|
||||
|
||||
// autoload stuff
|
||||
extern boolean autoloading;
|
||||
extern boolean autoloaded;
|
||||
extern boolean postautoloaded;
|
||||
extern boolean wasautoloaded;
|
||||
|
||||
void D_AddPostloadFiles(void);
|
||||
|
||||
extern char *autoloadwadfilespost[MAX_WADFILES];
|
||||
extern char *autoloadwadfiles[MAX_WADFILES];
|
||||
|
||||
+5
-17
@@ -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;
|
||||
@@ -1087,15 +1085,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 +1282,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;
|
||||
@@ -1446,13 +1435,13 @@ void Command_Ping_f(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (f_width < 10) f_width = 1;
|
||||
if (f_width < 10) f_width = 1;
|
||||
else if (f_width < 100) f_width = 2;
|
||||
else f_width = 3;
|
||||
else f_width = 3;
|
||||
|
||||
if (ms_width < 10) ms_width = 1;
|
||||
if (ms_width < 10) ms_width = 1;
|
||||
else if (ms_width < 100) ms_width = 2;
|
||||
else ms_width = 3;
|
||||
else ms_width = 3;
|
||||
|
||||
qsort(pingv, pingc, sizeof (struct pingcell), &pingcellcmp);
|
||||
|
||||
@@ -1491,7 +1480,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;
|
||||
|
||||
+339
-251
@@ -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);
|
||||
@@ -303,14 +306,12 @@ consvar_t cv_mouseturn = {"mouseturn", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL,
|
||||
consvar_t cv_laglesscam = {"laglesscamera", "Off", 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,13 +319,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
|
||||
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
|
||||
#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};
|
||||
@@ -493,6 +498,8 @@ consvar_t cv_showlapemblem = {"showlapemblem", "On", CV_SAVE, CV_OnOff, NULL, 0,
|
||||
|
||||
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};
|
||||
|
||||
// Intermission time Tails 04-19-2002
|
||||
static CV_PossibleValue_t inttime_cons_t[] = {{0, "MIN"}, {3600, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_inttime = {"inttime", "20", CV_NETVAR, inttime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -537,9 +544,9 @@ consvar_t cv_nametagscore = {"kartnametagscore", "Off", CV_SAVE, CV_OnOff, 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}};
|
||||
|
||||
@@ -565,9 +572,17 @@ 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};
|
||||
//consvar_t cv_director = {"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_director[MAXSPLITSCREENPLAYERS] = {
|
||||
{"director", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"director2", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"director3", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"director4", "Off", CV_SAVE, 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", 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};
|
||||
|
||||
consvar_t cv_showtrackaddon = {"showtrackaddon", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
@@ -701,6 +716,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);
|
||||
@@ -898,6 +915,7 @@ 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);
|
||||
@@ -976,7 +994,6 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_audbuffersize);
|
||||
|
||||
// m_menu.c
|
||||
//CV_RegisterVar(&cv_compactscoreboard);
|
||||
CV_RegisterVar(&cv_chatheight);
|
||||
CV_RegisterVar(&cv_chatwidth);
|
||||
CV_RegisterVar(&cv_chattime);
|
||||
@@ -994,8 +1011,13 @@ void D_RegisterClientCommands(void)
|
||||
|
||||
CV_RegisterVar(&cv_showtrackaddon);
|
||||
CV_RegisterVar(&cv_showviewpointtext);
|
||||
CV_RegisterVar(&cv_showdownloadprompt);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_director[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_director);
|
||||
CV_RegisterVar(&cv_kartdebugdirector);
|
||||
CV_RegisterVar(&cv_showdirectorhud);
|
||||
|
||||
@@ -1017,58 +1039,22 @@ void D_RegisterClientCommands(void)
|
||||
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_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);
|
||||
@@ -1087,20 +1073,12 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_controlperkey);
|
||||
CV_RegisterVar(&cv_turnsmooth);
|
||||
|
||||
CV_RegisterVar(&cv_rumble[0]);
|
||||
CV_RegisterVar(&cv_rumble[1]);
|
||||
CV_RegisterVar(&cv_rumble[2]);
|
||||
CV_RegisterVar(&cv_rumble[3]);
|
||||
|
||||
CV_RegisterVar(&cv_gamepadled[0]);
|
||||
CV_RegisterVar(&cv_gamepadled[1]);
|
||||
CV_RegisterVar(&cv_gamepadled[2]);
|
||||
CV_RegisterVar(&cv_gamepadled[3]);
|
||||
|
||||
CV_RegisterVar(&cv_ledpowerup[0]);
|
||||
CV_RegisterVar(&cv_ledpowerup[1]);
|
||||
CV_RegisterVar(&cv_ledpowerup[2]);
|
||||
CV_RegisterVar(&cv_ledpowerup[3]);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
CV_RegisterVar(&cv_rumble[i]);
|
||||
CV_RegisterVar(&cv_gamepadled[i]);
|
||||
CV_RegisterVar(&cv_ledpowerup[i]);
|
||||
}
|
||||
|
||||
CV_RegisterVar(&cv_usemouse);
|
||||
CV_RegisterVar(&cv_usemouse2);
|
||||
@@ -1113,28 +1091,19 @@ void D_RegisterClientCommands(void)
|
||||
//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);
|
||||
@@ -1163,7 +1132,7 @@ 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);
|
||||
@@ -1178,7 +1147,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_nametagscore);
|
||||
CV_RegisterVar(&cv_shownametagfinish);
|
||||
CV_RegisterVar(&cv_shownametagspectator);
|
||||
|
||||
|
||||
CV_RegisterVar(&cv_driftgauge);
|
||||
CV_RegisterVar(&cv_driftgaugeofs);
|
||||
CV_RegisterVar(&cv_driftgaugetrans);
|
||||
@@ -1204,26 +1173,16 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_speed);
|
||||
CV_RegisterVar(&cv_opflags);
|
||||
CV_RegisterVar(&cv_mapthingnum);
|
||||
//CV_RegisterVar(&cv_grid);
|
||||
//CV_RegisterVar(&cv_snapto);
|
||||
|
||||
// add cheat commands
|
||||
COM_AddCommand("noclip", Command_CheatNoClip_f);
|
||||
COM_AddCommand("god", Command_CheatGod_f);
|
||||
COM_AddCommand("notarget", Command_CheatNoTarget_f);
|
||||
/*COM_AddCommand("getallemeralds", Command_Getallemeralds_f);
|
||||
COM_AddCommand("resetemeralds", Command_Resetemeralds_f);
|
||||
COM_AddCommand("setrings", Command_Setrings_f);
|
||||
COM_AddCommand("setlives", Command_Setlives_f);
|
||||
COM_AddCommand("setcontinues", Command_Setcontinues_f);*/
|
||||
COM_AddCommand("devmode", Command_Devmode_f);
|
||||
COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f);
|
||||
COM_AddCommand("scale", Command_Scale_f);
|
||||
COM_AddCommand("gravflip", Command_Gravflip_f);
|
||||
COM_AddCommand("hurtme", Command_Hurtme_f);
|
||||
/*COM_AddCommand("jumptoaxis", Command_JumpToAxis_f);
|
||||
COM_AddCommand("charability", Command_Charability_f);
|
||||
COM_AddCommand("charspeed", Command_Charspeed_f);*/
|
||||
COM_AddCommand("teleport", Command_Teleport_f);
|
||||
COM_AddCommand("rteleport", Command_RTeleport_f);
|
||||
COM_AddCommand("skynum", Command_Skynum_f);
|
||||
@@ -1255,19 +1214,69 @@ void D_RegisterClientCommands(void)
|
||||
*/
|
||||
static void Skin_FindRealNameSkin(consvar_t *cvar)
|
||||
{
|
||||
// Not the best way to implements this but it will do.
|
||||
INT32 matches[MAXSKINS] = {0}; // Skin numbers of matching skins
|
||||
INT32 matches_pos[MAXSKINS] = {0}; // Index of matching substring
|
||||
INT32 nummatches = 0;
|
||||
|
||||
int i;
|
||||
INT32 i;
|
||||
const char *value = cvar->string;
|
||||
|
||||
for (i = 0; i < numskins; i++)
|
||||
{
|
||||
if (strncmp(value, skins[i].realname, sizeof skins[i].realname) == 0)
|
||||
{
|
||||
// Change the cvar to be the value of the name.
|
||||
CV_StealthSet(cvar, skins[i].name);
|
||||
// Perfect match with some skin name, no need to find matching realname
|
||||
if (strncasecmp(value, skins[i].name, sizeof skins[i].name) == 0)
|
||||
return;
|
||||
|
||||
const char *match = strcasestr(skins[i].realname, value);
|
||||
if (match != NULL)
|
||||
{
|
||||
matches[nummatches] = i;
|
||||
matches_pos[nummatches] = match - skins[i].realname;
|
||||
++nummatches;
|
||||
}
|
||||
}
|
||||
|
||||
if (nummatches == 1)
|
||||
{
|
||||
// Change the cvar to be the value of the name.
|
||||
CV_StealthSet(cvar, skins[matches[0]].name);
|
||||
}
|
||||
else if (nummatches > 1)
|
||||
{
|
||||
size_t query_length = strlen(value);
|
||||
|
||||
char start[SKINNAMESIZE+1] = {0}; // Start of name, printed with normal color
|
||||
char match[SKINNAMESIZE+1] = {0}; // Matching part of name, highlighted in red
|
||||
const char *end = NULL; // End of the name, printed with normal color. Can be just a pointer into realname part
|
||||
|
||||
CONS_Printf("\x86Multiple matches found:\n");
|
||||
|
||||
for (i = 0; i < nummatches; ++i)
|
||||
{
|
||||
const char *realname = skins[matches[i]].realname;
|
||||
|
||||
if (matches_pos[i] == 0)
|
||||
start[0] = 0;
|
||||
else
|
||||
{
|
||||
memcpy(start, realname, matches_pos[i]);
|
||||
start[matches_pos[i]] = 0;
|
||||
}
|
||||
|
||||
memcpy(match, realname+matches_pos[i], query_length);
|
||||
match[matches_pos[i] + query_length] = 0;
|
||||
|
||||
end = realname + matches_pos[i] + query_length;
|
||||
|
||||
CONS_Printf("%s\x85%s\x80%s (%s)\n", start, match, end, skins[matches[i]].name);
|
||||
}
|
||||
|
||||
CONS_Printf("\x86Try be more specific\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Printf("\x86Skin not found\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1641,25 +1650,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
|
||||
{
|
||||
@@ -1703,7 +1696,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
|
||||
@@ -1773,24 +1766,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
|
||||
{
|
||||
@@ -1833,7 +1810,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)
|
||||
@@ -1954,7 +1931,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)
|
||||
@@ -2023,24 +2000,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
|
||||
{
|
||||
@@ -2083,7 +2044,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)
|
||||
@@ -2188,11 +2149,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)
|
||||
@@ -2200,11 +2159,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)
|
||||
@@ -2212,11 +2169,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)
|
||||
@@ -2224,11 +2179,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)
|
||||
@@ -2360,7 +2313,7 @@ static void Command_View_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (demo.freecam)
|
||||
if (camera[viewnum-1].freecam)
|
||||
return;
|
||||
|
||||
displayplayerp = &displayplayers[viewnum-1];
|
||||
@@ -2487,6 +2440,12 @@ 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 time a demo while in a game.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
@@ -2526,6 +2485,12 @@ 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;
|
||||
}
|
||||
|
||||
// disconnect from server here?
|
||||
if (demo.playback)
|
||||
G_StopDemo();
|
||||
@@ -2949,6 +2914,14 @@ static void Command_Map_f(void)
|
||||
// G_TOLFlag handles both multiplayer gametype and ignores it for !multiplayer
|
||||
else
|
||||
{
|
||||
if (!mapheaderinfo[newmapnum-1] || mapheaderinfo[newmapnum-1] == NULL)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Invalid mapheaderinfo for Course %s (%s)\n"), realmapname, G_BuildMapName(newmapnum));
|
||||
Z_Free(realmapname);
|
||||
Z_Free(mapname);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(mapheaderinfo[newmapnum-1]->typeoflevel & G_TOLFlag(newgametype)))
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, M_GetText("Course %s (%s) doesn't support %s mode!\n(Use -force to override)\n"), realmapname, G_BuildMapName(newmapnum),
|
||||
@@ -2981,9 +2954,14 @@ 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);
|
||||
@@ -3072,7 +3050,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;
|
||||
@@ -3175,6 +3153,8 @@ static void Got_Pause(UINT8 **cp, INT32 playernum)
|
||||
else
|
||||
S_ResumeAudio();
|
||||
}
|
||||
|
||||
G_ResetAllDeviceRumbles();
|
||||
}
|
||||
|
||||
static void Command_ReplayMarker(void)
|
||||
@@ -3192,7 +3172,10 @@ static void Command_ReplayMarker(void)
|
||||
demo.savemode = DSM_WILLAUTOSAVE;
|
||||
if (adjustedleveltime < 0)
|
||||
adjustedleveltime = 0;
|
||||
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", G_BuildMapTitle(gamemap), G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
char *title = G_BuildMapTitle(gamemap);
|
||||
snprintf(demo.titlename, 64, "%s [%i:%02d/%.5s]", title, G_TicsToMinutes(adjustedleveltime, false), G_TicsToSeconds(adjustedleveltime), modeattacking ? "Record Attack" : connectedservername);
|
||||
if (title)
|
||||
Z_Free(title);
|
||||
CONS_Printf("Replay will be saved!\n");
|
||||
}
|
||||
}
|
||||
@@ -3427,7 +3410,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)
|
||||
@@ -3518,7 +3501,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)
|
||||
@@ -3609,7 +3592,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)
|
||||
@@ -3700,7 +3683,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)
|
||||
@@ -3966,19 +3949,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, 10000);
|
||||
else
|
||||
players[playernum].playerstate = PST_REBORN;
|
||||
}
|
||||
@@ -4112,10 +4083,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
|
||||
@@ -4839,10 +4807,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);
|
||||
@@ -4970,6 +4934,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
|
||||
// =========================================================================
|
||||
@@ -5259,9 +5368,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
|
||||
@@ -5283,19 +5389,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())
|
||||
@@ -5746,10 +5839,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);
|
||||
@@ -5819,10 +5908,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)
|
||||
@@ -5838,28 +5926,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
|
||||
|
||||
+5
-9
@@ -43,18 +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;
|
||||
extern consvar_t cv_joyscale[4]; //MAXSPLITSCREENPLAYERS
|
||||
|
||||
// splitscreen with second mouse
|
||||
extern consvar_t cv_mouse2port;
|
||||
@@ -166,6 +160,7 @@ extern consvar_t cv_minihead;
|
||||
extern consvar_t cv_showlapemblem;
|
||||
|
||||
extern consvar_t cv_showviewpointtext;
|
||||
extern consvar_t cv_showdownloadprompt;
|
||||
extern consvar_t cv_luaimmersion;
|
||||
extern consvar_t cv_fakelocalskin;
|
||||
extern consvar_t cv_showlocalskinmenus;
|
||||
@@ -202,7 +197,8 @@ extern consvar_t cv_ps_thinkframe_page;
|
||||
extern consvar_t cv_ps_samplesize;
|
||||
extern consvar_t cv_ps_descriptor;
|
||||
|
||||
extern consvar_t cv_director, cv_kartdebugdirector, cv_showdirectorhud;
|
||||
extern consvar_t cv_director[4]; // screw you includes
|
||||
extern consvar_t cv_kartdebugdirector, cv_showdirectorhud;
|
||||
|
||||
extern consvar_t cv_showtrackaddon;
|
||||
|
||||
|
||||
+34
-6
@@ -65,10 +65,10 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid);
|
||||
#ifdef HAVE_CURL
|
||||
size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
#if defined(CURL_AT_LEAST_VERSION) && CURL_AT_LEAST_VERSION(7, 35, 0)
|
||||
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
|
||||
static int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow);
|
||||
#define XFERINFOFUNCTION
|
||||
#else
|
||||
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
static int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1203,25 +1203,53 @@ size_t curlwrite_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
}
|
||||
|
||||
#ifdef XFERINFOFUNCTION
|
||||
int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
static int curlprogress_callbackx(void *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow)
|
||||
{
|
||||
time_t curtime;
|
||||
|
||||
(void)clientp;
|
||||
(void)ultotal;
|
||||
(void)ulnow; // Function prototype requires these but we won't use, so just discard
|
||||
|
||||
curtime = time(NULL);
|
||||
|
||||
curl_dlnow = dlnow;
|
||||
curl_dltotal = dltotal;
|
||||
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
|
||||
|
||||
if (curtime > curl_starttime)
|
||||
{
|
||||
getbytes = curl_dlnow / (curtime - curl_starttime); // To-do: Make this more accurate???
|
||||
}
|
||||
else
|
||||
{
|
||||
getbytes = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
static int curlprogress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow)
|
||||
{
|
||||
time_t curtime;
|
||||
|
||||
(void)clientp;
|
||||
(void)ultotal;
|
||||
(void)ulnow; // Function prototype requires these but we won't use, so just discard
|
||||
|
||||
curtime = time(NULL);
|
||||
|
||||
curl_dlnow = dlnow;
|
||||
curl_dltotal = dltotal;
|
||||
getbytes = curl_dlnow / (time(NULL) - curl_starttime); // To-do: Make this more accurate???
|
||||
|
||||
if (curtime > curl_starttime)
|
||||
{
|
||||
getbytes = curl_dlnow / (curtime - curl_starttime); // To-do: Make this more accurate???
|
||||
}
|
||||
else
|
||||
{
|
||||
getbytes = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
+2
-1
@@ -403,7 +403,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,6 +412,8 @@ typedef struct player_s
|
||||
// See pflags_t, above.
|
||||
pflags_t pflags;
|
||||
|
||||
UINT16 postimgflags;
|
||||
|
||||
// playing animation.
|
||||
panim_t panim;
|
||||
|
||||
|
||||
@@ -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
|
||||
+42
-26
@@ -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
|
||||
@@ -1493,9 +1493,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 +3147,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 +6361,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 +7152,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 +7188,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 +7221,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 +7239,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 +7318,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 +7339,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 +7507,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 +7542,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 +7629,7 @@ static const char *const KARTSTUFF_LIST[] = {
|
||||
"GROWCANCEL"
|
||||
};
|
||||
|
||||
static const char *const HUDITEMS_LIST[] = {
|
||||
const char *const HUDITEMS_LIST[] = {
|
||||
"LIVESNAME",
|
||||
"LIVESPIC",
|
||||
"LIVESNUM",
|
||||
@@ -8545,6 +8542,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,7 +9156,6 @@ int LUA_EnumLib(lua_State *L)
|
||||
PUSHGETTER(globalweather, u8);
|
||||
PUSHGETTER(levelskynum, i32);
|
||||
PUSHGETTER(globallevelskynum, i32);
|
||||
PUSHGETTER((*mapmusname), str);
|
||||
PUSHGETTER(mapmusflags, u16);
|
||||
PUSHGETTER(mapmusposition, u32);
|
||||
PUSHGETTER(gravity, fxp);
|
||||
@@ -9166,6 +9172,11 @@ int LUA_EnumLib(lua_State *L)
|
||||
PUSHGETTER(racecountdown, u32);
|
||||
PUSHGETTER(exitcountdown, u32);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "mapmusname");
|
||||
lua_glib_push_str_getter(L, mapmusname);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "mariomode");
|
||||
lua_pushcfunction(L, lua_enumlib_mariomode_get);
|
||||
@@ -9216,6 +9227,11 @@ int LUA_EnumLib(lua_State *L)
|
||||
lua_glib_push_bool_getter(L, &demo.playback);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
lua_pushliteral(L, "replayfreecam");
|
||||
lua_pushcfunction(L, lua_enumlib_replayfreecam_get);
|
||||
lua_call(L, 2, 0);
|
||||
|
||||
if (!mathlib)
|
||||
{
|
||||
lua_pushcfunction(L, lua_glib_new_getter);
|
||||
|
||||
@@ -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);
|
||||
|
||||
+27
-11
@@ -127,13 +127,8 @@ extern char logfilename[1024];
|
||||
#else
|
||||
#define VERSION 1 // Game version
|
||||
#define SUBVERSION 6 // more precise version number
|
||||
#ifndef USE_FBO_OGL
|
||||
#define VERSIONSTRING "Saturn v7"
|
||||
#define VERSIONSTRINGW L"Saturn v7"
|
||||
#else
|
||||
#define VERSIONSTRING "Saturn v7 - FBO "
|
||||
#define VERSIONSTRINGW L"Saturn v7 - FBO"
|
||||
#endif
|
||||
#define VERSIONSTRING "Saturn v7.2"
|
||||
#define VERSIONSTRINGW L"Saturn v7.2"
|
||||
// Hey! If you change this, add 1 to the MODVERSION below! Otherwise we can't force updates!
|
||||
// And change CMakeLists.txt (not src/, but in root), for CMake users!
|
||||
// AND appveyor.yml, for the build bots!
|
||||
@@ -474,7 +469,12 @@ void M_StartupLocale(void);
|
||||
// M_GetText function that just returns the string.
|
||||
#define M_GetText(x) (x)
|
||||
#endif
|
||||
void *M_Memcpy(void* dest, const void* src, size_t n);
|
||||
|
||||
FUNCINLINE static ATTRINLINE void *M_Memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
char *va(const char *format, ...) FUNCPRINTF;
|
||||
char *M_GetToken(const char *inputString);
|
||||
char *sizeu1(size_t num);
|
||||
@@ -522,6 +522,22 @@ 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
|
||||
@@ -585,9 +601,9 @@ extern const char *compdate, *comptime, *comprevision, *compbranch;
|
||||
|
||||
/// Server detection for if a connecting client is on Saturn.
|
||||
/// For stuff like extra synching, etc.
|
||||
//#ifdef DOSATURNPAK
|
||||
//#define SATURNPAK
|
||||
//#endif
|
||||
#ifdef DOSATURNPAK
|
||||
#define SATURNPAK
|
||||
#endif
|
||||
//-- <( ̄︶ ̄)> __
|
||||
#endif
|
||||
|
||||
|
||||
+2
-2
@@ -112,7 +112,6 @@ extern UINT8 window_notinfocus; // are we in focus? (backend independant -- hand
|
||||
extern boolean nodrawers;
|
||||
extern boolean noblit;
|
||||
extern boolean lastdraw;
|
||||
extern postimg_t postimgtype[MAXSPLITSCREENPLAYERS];
|
||||
extern INT32 postimgparam[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern INT32 viewwindowx, viewwindowy;
|
||||
@@ -123,6 +122,7 @@ extern boolean gamedataloaded;
|
||||
// Player taking events, and displaying.
|
||||
extern INT32 consoleplayer;
|
||||
extern INT32 displayplayers[MAXSPLITSCREENPLAYERS];
|
||||
extern INT32 g_localplayers[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
// Maps of special importance
|
||||
extern INT16 spstage_start;
|
||||
@@ -192,7 +192,7 @@ extern struct quake
|
||||
// camera offsets and duration
|
||||
fixed_t x,y,z;
|
||||
angle_t roll;
|
||||
UINT16 time;
|
||||
tic_t time;
|
||||
|
||||
// location, radius, and intensity...
|
||||
mappoint_t *epicenter;
|
||||
|
||||
+30
-8
@@ -344,14 +344,12 @@ typedef union FColorRGBA RGBA_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
postimg_none,
|
||||
postimg_water,
|
||||
postimg_motion,
|
||||
postimg_flip,
|
||||
postimg_heat,
|
||||
postimg_mirror,
|
||||
postimg_mirrorflip
|
||||
} postimg_t;
|
||||
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
|
||||
@@ -367,6 +365,30 @@ 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));
|
||||
}
|
||||
|
||||
typedef UINT64 precise_t;
|
||||
|
||||
#endif //__DOOMTYPE__
|
||||
+5
-5
@@ -170,8 +170,8 @@ static void F_SkyScroll(INT32 scrollspeed)
|
||||
w = (vid.width / vid.dupx)<<FRACBITS;
|
||||
|
||||
// The scroll offset MUST be clamped before shifting by FRACBITS, or else it'll overflow in about 3 minutes
|
||||
animtimer = ((((finalecount * scrollspeed) % (SHORT(pat->width)*16))<<FRACBITS) + (R_GetHudUncap() * scrollspeed))/16;
|
||||
anim2 = (SHORT(pat2->width)<<FRACBITS) - ((((finalecount * scrollspeed) % (SHORT(pat2->width)*16))<<FRACBITS) + (R_GetHudUncap() * scrollspeed))/16;
|
||||
animtimer = ((((finalecount * scrollspeed) % (SHORT(pat->width)*16))<<FRACBITS) + (R_GetMenuUncap() * scrollspeed))/16;
|
||||
anim2 = (SHORT(pat2->width)<<FRACBITS) - ((((finalecount * scrollspeed) % (SHORT(pat2->width)*16))<<FRACBITS) + (R_GetMenuUncap() * scrollspeed))/16;
|
||||
|
||||
// SRB2Kart: F_DrawPatchCol is over-engineered; recoded to be less shitty and error-prone
|
||||
if (rendermode != render_none)
|
||||
@@ -996,7 +996,7 @@ void F_TitleScreenDrawer(void)
|
||||
if (finalecount >= 20)
|
||||
V_DrawSmallScaledPatch(84, 87, 0, ttkart);
|
||||
else if (finalecount >= 10)
|
||||
V_DrawSciencePatch((84<<FRACBITS) - 18*(((20 - finalecount)<<FRACBITS) - R_GetHudUncap()), 87<<FRACBITS, 0, ttkart, FRACUNIT/2);
|
||||
V_DrawSciencePatch((84<<FRACBITS) - 18*(((20 - finalecount)<<FRACBITS) - R_GetMenuUncap()), 87<<FRACBITS, 0, ttkart, FRACUNIT/2);
|
||||
}
|
||||
else if (finalecount < 52)
|
||||
{
|
||||
@@ -1012,8 +1012,8 @@ void F_TitleScreenDrawer(void)
|
||||
|
||||
F_SkyScroll(titlescrollspeed);
|
||||
|
||||
V_DrawSciencePatch(0, -40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetHudUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTOLEFT, ttcheckers, FRACUNIT);
|
||||
V_DrawSciencePatch(280<<FRACBITS, -(40<<FRACBITS) + 40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetHudUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTORIGHT, ttcheckers, FRACUNIT);
|
||||
V_DrawSciencePatch(0, -40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetMenuUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTOLEFT, ttcheckers, FRACUNIT);
|
||||
V_DrawSciencePatch(280<<FRACBITS, -(40<<FRACBITS) + 40*FixedDiv(((finalecount % 70)<<FRACBITS) + R_GetMenuUncap(), 70<<FRACBITS), V_SNAPTOTOP|V_SNAPTORIGHT, ttcheckers, FRACUNIT);
|
||||
|
||||
if (transval)
|
||||
V_DrawFadeScreen(120, 10 - transval);
|
||||
|
||||
+6
-5
@@ -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
|
||||
{
|
||||
|
||||
+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;
|
||||
|
||||
+714
-1114
File diff suppressed because it is too large.
Load diff
+22
-19
@@ -17,6 +17,8 @@
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "d_event.h"
|
||||
#include "p_saveg.h"
|
||||
#include "m_textinput.h"
|
||||
|
||||
extern char gamedatafilename[64];
|
||||
extern char timeattackfolder[64];
|
||||
@@ -32,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.
|
||||
@@ -44,6 +46,7 @@ extern consvar_t cv_recordmultiplayerdemos, cv_netdemosyncquality, cv_maxdemosiz
|
||||
// Publicly-accessible demo vars
|
||||
struct demovars_s {
|
||||
char titlename[65];
|
||||
textinput_t titlenameinput;
|
||||
boolean recording, playback, timing;
|
||||
UINT16 version; // Current file format of the demo being played
|
||||
boolean title; // Title Screen demo can be cancelled by any key
|
||||
@@ -118,12 +121,21 @@ 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_turnaxis[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_moveaxis[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
|
||||
@@ -164,7 +176,6 @@ 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;
|
||||
@@ -264,7 +275,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
|
||||
@@ -354,6 +364,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);
|
||||
@@ -417,19 +428,9 @@ void G_SetGamestate(gamestate_t newstate);
|
||||
|
||||
// Gamedata record shit
|
||||
void G_AllocMainRecordData(INT16 i);
|
||||
//void G_AllocNightsRecordData(INT16 i);
|
||||
void G_ClearRecords(void);
|
||||
|
||||
//UINT32 G_GetBestScore(INT16 map);
|
||||
tic_t G_GetBestTime(INT16 map);
|
||||
//tic_t G_GetBestLap(INT16 map);
|
||||
//UINT16 G_GetBestRings(INT16 map);
|
||||
//UINT32 G_GetBestNightsScore(INT16 map, UINT8 mare);
|
||||
//tic_t G_GetBestNightsTime(INT16 map, UINT8 mare);
|
||||
//UINT8 G_GetBestNightsGrade(INT16 map, UINT8 mare);
|
||||
|
||||
//void G_AddTempNightsRecords(UINT32 pscore, tic_t ptime, UINT8 mare);
|
||||
//void G_SetNightsRecords(void);
|
||||
|
||||
FUNCMATH INT32 G_TicsToHours(tic_t tics);
|
||||
FUNCMATH INT32 G_TicsToMinutes(tic_t tics, boolean full);
|
||||
@@ -437,6 +438,8 @@ FUNCMATH INT32 G_TicsToSeconds(tic_t tics);
|
||||
FUNCMATH INT32 G_TicsToCentiseconds(tic_t tics);
|
||||
FUNCMATH INT32 G_TicsToMilliseconds(tic_t tics);
|
||||
|
||||
boolean K_DirectorIsPlayerAlone(void); // idk where else to put this lol
|
||||
|
||||
// Don't split up TOL handling
|
||||
INT16 G_TOLFlag(INT32 pgametype);
|
||||
|
||||
|
||||
+28
-26
@@ -902,34 +902,15 @@ static const char *gamecontrolname[num_gamecontrols] =
|
||||
"custom2",
|
||||
"custom3",
|
||||
"director",
|
||||
"freecam",
|
||||
"camfloat",
|
||||
"camsink",
|
||||
};
|
||||
|
||||
#define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t))
|
||||
|
||||
#include "k_kart.h"
|
||||
|
||||
INT32 G_GetDeviceForPlayer(INT32 player)
|
||||
{
|
||||
switch (player)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
inline UINT16 G_GetSkinColor(INT32 player)
|
||||
{
|
||||
// make rgb rainbow vomit when invul or flash blue when grow
|
||||
@@ -972,7 +953,7 @@ void G_SetPlayerGamepadIndicatorColor(INT32 player, UINT16 color)
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
return;
|
||||
|
||||
device = G_GetDeviceForPlayer(player);
|
||||
device = cv_usejoystick[player].value;
|
||||
|
||||
if (device <= 0)
|
||||
{
|
||||
@@ -989,7 +970,7 @@ static void G_ResetPlayerGamepadIndicatorColor(INT32 player)
|
||||
{
|
||||
if (cv_gamepadled[player].value == 0)
|
||||
{
|
||||
INT32 device = G_GetDeviceForPlayer(player);
|
||||
INT32 device = cv_usejoystick[player].value;
|
||||
if (device <= 0)
|
||||
return;
|
||||
|
||||
@@ -1003,7 +984,7 @@ static void G_ResetPlayerDeviceRumble(INT32 player)
|
||||
{
|
||||
INT32 device_id;
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
device_id = cv_usejoystick[player].value;
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
@@ -1013,6 +994,21 @@ static void G_ResetPlayerDeviceRumble(INT32 player)
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
}
|
||||
|
||||
void G_ResetAllDeviceRumbles(void)
|
||||
{
|
||||
int i;
|
||||
int devices;
|
||||
|
||||
devices = I_NumJoys();
|
||||
|
||||
for (i = 0; i < devices; i++)
|
||||
{
|
||||
INT32 device_id = cv_usejoystick[i].value;
|
||||
|
||||
I_GamepadRumble(device_id, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strength, UINT32 duration)
|
||||
{
|
||||
INT32 device_id;
|
||||
@@ -1022,7 +1018,7 @@ void G_PlayerDeviceRumble(INT32 player, UINT16 low_strength, UINT16 high_strengt
|
||||
return;
|
||||
}
|
||||
|
||||
device_id = G_GetDeviceForPlayer(player);
|
||||
device_id = cv_usejoystick[player].value;
|
||||
|
||||
if (device_id < 1)
|
||||
{
|
||||
@@ -1146,6 +1142,12 @@ void G_Controldefault(UINT8 player)
|
||||
//gamecontrol[gc_screenshot ][1] = KEY_HAT1+1; // D-Pad Down // absolutely fucking NOT
|
||||
gamecontrol[gc_talkkey ][1] = KEY_HAT1+1; // D-Pad Down
|
||||
gamecontrol[gc_scores ][1] = KEY_HAT1+0; // D-Pad Up
|
||||
|
||||
gamecontrol[gc_camfloat ][0] = 'a';
|
||||
gamecontrol[gc_camsink ][0] = 'd';
|
||||
|
||||
gamecontrol[gc_camfloat ][1] = KEY_JOY1+0; // A
|
||||
gamecontrol[gc_camsink ][1] = KEY_JOY1+1; // B
|
||||
}
|
||||
|
||||
if (player == 0 || player == 2)
|
||||
|
||||
@@ -100,6 +100,9 @@ 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
|
||||
num_gamecontrols
|
||||
} gamecontrols_e;
|
||||
|
||||
@@ -138,6 +141,7 @@ 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);
|
||||
void G_ResetAllDeviceRumbles(void);
|
||||
|
||||
// remaps the input event to a game control.
|
||||
void G_MapEventsToControls(event_t *ev);
|
||||
|
||||
+35
-32
@@ -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.
|
||||
@@ -46,12 +47,12 @@ int unsortedVertexArrayAllocSize = 65536;
|
||||
// Call HWR_RenderBatches to render all the collected geometry.
|
||||
void HWR_StartBatching(void)
|
||||
{
|
||||
if (currently_batching)
|
||||
if (currently_batching)
|
||||
{
|
||||
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
|
||||
I_Error("Repeat call to HWR_StartBatching without HWR_RenderBatches");
|
||||
}
|
||||
|
||||
// init arrays if that has not been done yet
|
||||
// init arrays if that has not been done yet
|
||||
if (!finalVertexArray)
|
||||
{
|
||||
finalVertexArray = malloc(finalVertexArrayAllocSize * sizeof(FOutVector));
|
||||
@@ -61,22 +62,22 @@ void HWR_StartBatching(void)
|
||||
unsortedVertexArray = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector));
|
||||
}
|
||||
|
||||
currently_batching = true;
|
||||
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)
|
||||
{
|
||||
if (currently_batching)
|
||||
{
|
||||
current_texture = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(texture);
|
||||
}
|
||||
if (currently_batching)
|
||||
{
|
||||
current_texture = texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_SetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
// If batching is enabled, this function collects the polygon data and the chosen texture
|
||||
@@ -84,7 +85,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
// render the polygon immediately.
|
||||
void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, int shader_target, boolean horizonSpecial)
|
||||
{
|
||||
if (currently_batching)
|
||||
if (currently_batching)
|
||||
{
|
||||
if (!pSurf)
|
||||
I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,14 +221,14 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2)
|
||||
// the rendering backend to draw them.
|
||||
void HWR_RenderBatches(void)
|
||||
{
|
||||
int finalVertexWritePos = 0;// position in finalVertexArray
|
||||
int finalVertexWritePos = 0;// position in finalVertexArray
|
||||
int finalIndexWritePos = 0;// position in finalVertexIndexArray
|
||||
|
||||
int polygonReadPos = 0;// position in polygonArraySorted
|
||||
|
||||
int currentShader;
|
||||
int nextShader = 0;
|
||||
GLMipmap_t *currentTexture;
|
||||
GLMipmap_t *currentTexture = NULL;
|
||||
GLMipmap_t *nextTexture = NULL;
|
||||
FBITFIELD currentPolyFlags = 0;
|
||||
FBITFIELD nextPolyFlags = 0;
|
||||
@@ -236,7 +237,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
int i;
|
||||
|
||||
if (!currently_batching)
|
||||
if (!currently_batching)
|
||||
I_Error("HWR_RenderBatches called without starting batching");
|
||||
|
||||
nextSurfaceInfo.LightInfo.fade_end = 0;
|
||||
@@ -256,6 +257,7 @@ void HWR_RenderBatches(void)
|
||||
ps_hw_numcalls.value.i = ps_hw_numverts.value.i = 0;
|
||||
ps_hw_numshaders.value.i = ps_hw_numtextures.value.i
|
||||
= ps_hw_numpolyflags.value.i = ps_hw_numcolors.value.i = 1;
|
||||
|
||||
// init polygonArraySorted
|
||||
for (i = 0; i < polygonArraySize; i++)
|
||||
{
|
||||
@@ -264,11 +266,12 @@ void HWR_RenderBatches(void)
|
||||
|
||||
// sort polygons
|
||||
PS_START_TIMING(ps_hw_batchsorttime);
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygons);
|
||||
else
|
||||
qs22j(polygonArraySorted, polygonArraySize, sizeof(PolygonArrayEntry *), comparePolygonsNoShaders);
|
||||
PS_STOP_TIMING(ps_hw_batchsorttime);
|
||||
|
||||
// sort order
|
||||
// 1. shader
|
||||
// 2. texture
|
||||
@@ -287,15 +290,15 @@ void HWR_RenderBatches(void)
|
||||
|
||||
// set state for first batch
|
||||
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
HWD.pfnSetShader(currentShader);
|
||||
GL_SetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = NULL;
|
||||
else
|
||||
HWD.pfnSetTexture(currentTexture);
|
||||
else
|
||||
GL_SetTexture(currentTexture);
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
{
|
||||
@@ -369,7 +372,7 @@ void HWR_RenderBatches(void)
|
||||
nextSurfaceInfo = nextEntry->surf;
|
||||
if (nextPolyFlags & PF_NoTexture)
|
||||
nextTexture = 0;
|
||||
if (currentShader != nextShader && cv_grshaders.value && gr_shadersavailable)
|
||||
if (currentShader != nextShader && cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
changeState = true;
|
||||
changeShader = true;
|
||||
@@ -384,7 +387,7 @@ void HWR_RenderBatches(void)
|
||||
changeState = true;
|
||||
changePolyFlags = true;
|
||||
}
|
||||
if (cv_grshaders.value && gr_shadersavailable)
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba ||
|
||||
currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba ||
|
||||
@@ -410,7 +413,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;
|
||||
@@ -428,7 +431,7 @@ void HWR_RenderBatches(void)
|
||||
{
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
GL_SetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
@@ -436,8 +439,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;
|
||||
|
||||
@@ -457,6 +460,7 @@ void HWR_RenderBatches(void)
|
||||
|
||||
ps_hw_numcolors.value.i++;
|
||||
}
|
||||
// and that should be it?
|
||||
}
|
||||
}
|
||||
// reset the arrays (set sizes to 0)
|
||||
@@ -466,5 +470,4 @@ void HWR_RenderBatches(void)
|
||||
PS_STOP_TIMING(ps_hw_batchdrawtime);
|
||||
}
|
||||
|
||||
|
||||
#endif // HWRENDER
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef struct
|
||||
|
||||
// when loading the map, this is set to true if portals are found.
|
||||
// if no portals are found, the portal scanning phase can be skipped while rendering, saving a bit of time.
|
||||
boolean gr_maphasportals = false;
|
||||
boolean gl_maphasportals = false;
|
||||
|
||||
// ==========================================================================
|
||||
// FLOOR & CEILING CONVEX POLYS GENERATION
|
||||
@@ -371,14 +371,14 @@ static poly_t *CutOutSubsecPoly(seg_t *lseg, INT32 count, poly_t *poly)
|
||||
line_t *line = lseg->linedef;
|
||||
|
||||
// portal check
|
||||
if (!gr_maphasportals && line->special == 40 && lseg->side == 0)
|
||||
if (!gl_maphasportals && line->special == 40 && lseg->side == 0)
|
||||
{
|
||||
// Find the other side!
|
||||
INT32 line2 = P_FindSpecialLineFromTag(40, line->tag, -1);
|
||||
if (line == &lines[line2])
|
||||
line2 = P_FindSpecialLineFromTag(40, line->tag, line2);
|
||||
if (line2 >= 0) // found it!
|
||||
gr_maphasportals = 1;
|
||||
gl_maphasportals = 1;
|
||||
}
|
||||
|
||||
p1.x = FIXED_TO_FLOAT(lseg->side ? line->v2->x : line->v1->x);
|
||||
@@ -768,7 +768,7 @@ static INT32 SolveTProblem(void)
|
||||
INT32 i;
|
||||
size_t l;
|
||||
|
||||
if (cv_grsolvetjoin.value == 0)
|
||||
if (cv_glsolvetjoin.value == 0)
|
||||
return 0;
|
||||
|
||||
CONS_Debug(DBG_RENDER, "Solving T-joins. This may take a while. Please wait...\n");
|
||||
@@ -905,7 +905,7 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
||||
#endif
|
||||
|
||||
// reset the portal flag
|
||||
gr_maphasportals = 0;
|
||||
gl_maphasportals = 0;
|
||||
|
||||
// find min/max boundaries of map
|
||||
//CONS_Debug(DBG_RENDER, "Looking for boundaries of map...\n");
|
||||
@@ -923,9 +923,9 @@ void HWR_CreatePlanePolygons(INT32 bspnum)
|
||||
I_Error("couldn't malloc extrasubsectors totsubsectors %s\n", sizeu1(totsubsectors));
|
||||
|
||||
// allocate table for back to front drawing of subsectors
|
||||
/*gr_drawsubsectors = (INT16 *)malloc(sizeof (*gr_drawsubsectors) * totsubsectors);
|
||||
if (!gr_drawsubsectors)
|
||||
I_Error("couldn't malloc gr_drawsubsectors\n");*/
|
||||
/*gl_drawsubsectors = (INT16 *)malloc(sizeof (*gl_drawsubsectors) * totsubsectors);
|
||||
if (!gl_drawsubsectors)
|
||||
I_Error("couldn't malloc gl_drawsubsectors\n");*/
|
||||
|
||||
// number of the first new subsector that might be added
|
||||
addsubsector = numsubsectors;
|
||||
|
||||
+189
-184
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -166,7 +172,7 @@ static void HWR_DrawPatchInCache(GLMipmap_t *mipmap,
|
||||
|
||||
if (pwidth <= 0 || pheight <= 0)
|
||||
return;
|
||||
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
ncols = pwidth;
|
||||
@@ -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
|
||||
@@ -216,7 +223,7 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
|
||||
if (texture->width <= 0 || texture->height <= 0)
|
||||
return;
|
||||
|
||||
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
x1 = patch->originx;
|
||||
@@ -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
|
||||
@@ -275,15 +283,15 @@ static void HWR_DrawTexturePatchInCache(GLMipmap_t *mipmap,
|
||||
}
|
||||
}
|
||||
|
||||
static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||
static UINT8 *MakeBlock(GLMipmap_t *glMipmap)
|
||||
{
|
||||
UINT8 *block;
|
||||
INT32 bpp, i;
|
||||
UINT16 bu16 = ((0x00 <<8) | HWR_PATCHES_CHROMAKEY_COLORINDEX);
|
||||
INT32 blocksize = (grMipmap->width * grMipmap->height);
|
||||
INT32 blocksize = (glMipmap->width * glMipmap->height);
|
||||
|
||||
bpp = format2bpp(grMipmap->format);
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(grMipmap->data));
|
||||
bpp = format2bpp(glMipmap->format);
|
||||
block = Z_Malloc(blocksize*bpp, PU_HWRCACHE, &(glMipmap->data));
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
@@ -303,7 +311,7 @@ static UINT8 *MakeBlock(GLMipmap_t *grMipmap)
|
||||
// Create a composite texture from patches, adapt the texture size to a power of 2
|
||||
// height and width for the hardware texture cache.
|
||||
//
|
||||
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noencore)
|
||||
static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noencore)
|
||||
{
|
||||
UINT8 *block;
|
||||
texture_t *texture;
|
||||
@@ -313,7 +321,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
|
||||
|
||||
INT32 i;
|
||||
boolean skyspecial = false; //poor hack for Legacy large skies..
|
||||
|
||||
|
||||
RGBA_t *palette;
|
||||
palette = HWR_GetTexturePalette();
|
||||
|
||||
@@ -328,30 +336,30 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
|
||||
)
|
||||
{
|
||||
skyspecial = true;
|
||||
grtex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
|
||||
gltex->mipmap.flags = TF_WRAPXY; // don't use the chromakey for sky
|
||||
}
|
||||
else
|
||||
grtex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
gltex->mipmap.flags = TF_CHROMAKEYED | TF_WRAPXY;
|
||||
|
||||
grtex->mipmap.width = (UINT16)texture->width;
|
||||
grtex->mipmap.height = (UINT16)texture->height;
|
||||
gltex->mipmap.width = (UINT16)(texture->width);
|
||||
gltex->mipmap.height = (UINT16)(texture->height);
|
||||
|
||||
if (skyspecial)
|
||||
grtex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
|
||||
gltex->mipmap.format = GL_TEXFMT_RGBA; // that skyspecial code below assumes this format ...
|
||||
else
|
||||
grtex->mipmap.format = textureformat;
|
||||
gltex->mipmap.format = textureformat;
|
||||
|
||||
grtex->mipmap.colormap = colormaps;
|
||||
gltex->mipmap.colormap = colormaps;
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (encoremap && !noencore)
|
||||
grtex->mipmap.colormap += COLORMAP_REMAPOFFSET;
|
||||
gltex->mipmap.colormap += COLORMAP_REMAPOFFSET;
|
||||
#endif
|
||||
|
||||
|
||||
blockwidth = texture->width;
|
||||
blockheight = texture->height;
|
||||
blocksize = (blockwidth * blockheight);
|
||||
block = MakeBlock(&grtex->mipmap);
|
||||
block = MakeBlock(&gltex->mipmap);
|
||||
|
||||
if (skyspecial) //Hurdler: not efficient, but better than holes in the sky (and it's done only at level loading)
|
||||
{
|
||||
@@ -359,14 +367,17 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
|
||||
RGBA_t col;
|
||||
|
||||
col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX];
|
||||
|
||||
for (j = 0; j < blockheight; j++)
|
||||
{
|
||||
for (i = 0; i < blockwidth; i++)
|
||||
{
|
||||
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;
|
||||
int idx = (j*blockwidth+i);
|
||||
|
||||
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,86 +386,81 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *grtex, boolean noe
|
||||
for (i = 0, patch = texture->patches; i < texture->patchcount; i++, patch++)
|
||||
{
|
||||
realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE);
|
||||
HWR_DrawTexturePatchInCache(&grtex->mipmap,
|
||||
blockwidth, blockheight,
|
||||
texture, patch,
|
||||
realpatch);
|
||||
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(grtex->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
|
||||
{
|
||||
if (block[i] != 0)
|
||||
continue;
|
||||
|
||||
grtex->mipmap.flags |= TF_TRANSPARENT;
|
||||
gltex->mipmap.flags |= TF_TRANSPARENT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
grtex->scaleX = 1.0f/(texture->width*FRACUNIT);
|
||||
grtex->scaleY = 1.0f/(texture->height*FRACUNIT);
|
||||
gltex->scaleX = 1.0f/(texture->width*FRACUNIT);
|
||||
gltex->scaleY = 1.0f/(texture->height*FRACUNIT);
|
||||
}
|
||||
|
||||
// patch may be NULL if grMipmap has been initialised already and makebitmap is false
|
||||
void HWR_MakePatch (patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap)
|
||||
// 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)
|
||||
{
|
||||
// don't do it twice (like a cache)
|
||||
if (grMipmap->width == 0)
|
||||
if (glMipmap->width == 0)
|
||||
{
|
||||
// save the original patch header so that the GLPatch can be casted
|
||||
// into a standard patch_t struct and the existing code can get the
|
||||
// orginal patch dimensions and offsets.
|
||||
grPatch->width = SHORT(patch->width);
|
||||
grPatch->height = SHORT(patch->height);
|
||||
grPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
grPatch->topoffset = SHORT(patch->topoffset);
|
||||
glPatch->width = SHORT(patch->width);
|
||||
glPatch->height = SHORT(patch->height);
|
||||
glPatch->leftoffset = SHORT(patch->leftoffset);
|
||||
glPatch->topoffset = SHORT(patch->topoffset);
|
||||
|
||||
//grMipmap->width = (UINT16)SHORT(patch->width);
|
||||
//grMipmap->height = (UINT16)SHORT(patch->height);
|
||||
grMipmap->width = grMipmap->height = 1;
|
||||
while (grMipmap->width < grPatch->width) grMipmap->width <<= 1;
|
||||
while (grMipmap->height < grPatch->height) grMipmap->height <<= 1;
|
||||
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
|
||||
grMipmap->flags = 0;
|
||||
glMipmap->flags = 0;
|
||||
|
||||
// setup the texture info
|
||||
grMipmap->format = patchformat;
|
||||
|
||||
//grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
grPatch->max_s = (float)grPatch->width / (float)grMipmap->width;
|
||||
grPatch->max_t = (float)grPatch->height / (float)grMipmap->height;
|
||||
glMipmap->format = patchformat;
|
||||
|
||||
//glPatch->max_s = glPatch->max_t = 1.0f;
|
||||
glPatch->max_s = (float)glPatch->width / (float)glMipmap->width;
|
||||
glPatch->max_t = (float)glPatch->height / (float)glMipmap->height;
|
||||
}
|
||||
|
||||
Z_Free(grMipmap->data);
|
||||
grMipmap->data = NULL;
|
||||
Z_Free(glMipmap->data);
|
||||
glMipmap->data = NULL;
|
||||
|
||||
if (makebitmap)
|
||||
{
|
||||
MakeBlock(grMipmap);
|
||||
HWR_DrawPatchInCache(grMipmap,
|
||||
grMipmap->width, grMipmap->height,
|
||||
grPatch->width, grPatch->height,
|
||||
MakeBlock(glMipmap);
|
||||
|
||||
HWR_DrawPatchInCache(glMipmap,
|
||||
glMipmap->width, glMipmap->height,
|
||||
glPatch->width, glPatch->height,
|
||||
patch);
|
||||
}
|
||||
|
||||
//grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
}
|
||||
|
||||
// =================================================
|
||||
// CACHING HANDLING
|
||||
// =================================================
|
||||
|
||||
static size_t gr_numtextures;
|
||||
static GLMapTexture_t *gr_textures; // For all textures
|
||||
static size_t gl_numtextures;
|
||||
static GLMapTexture_t *gl_textures; // For all textures
|
||||
|
||||
void HWR_InitTextureCache(void)
|
||||
{
|
||||
gr_numtextures = 0;
|
||||
gr_textures = NULL;
|
||||
gl_numtextures = 0;
|
||||
gl_textures = NULL;
|
||||
}
|
||||
|
||||
// Callback function for HWR_FreeTextureCache.
|
||||
@@ -494,7 +500,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 +511,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
|
||||
@@ -526,10 +532,10 @@ void HWR_FreeTextureCache(void)
|
||||
|
||||
// now the heap don't have any 'user' pointing to our
|
||||
// texturecache info, we can free it
|
||||
if (gr_textures)
|
||||
free(gr_textures);
|
||||
gr_textures = NULL;
|
||||
gr_numtextures = 0;
|
||||
if (gl_textures)
|
||||
free(gl_textures);
|
||||
gl_textures = NULL;
|
||||
gl_numtextures = 0;
|
||||
}
|
||||
|
||||
void HWR_LoadTextures(size_t pnumtextures)
|
||||
@@ -537,13 +543,13 @@ void HWR_LoadTextures(size_t pnumtextures)
|
||||
// we must free it since numtextures changed
|
||||
HWR_FreeTextureCache();
|
||||
|
||||
gr_numtextures = pnumtextures;
|
||||
gl_numtextures = pnumtextures;
|
||||
#ifdef GLENCORE
|
||||
gr_textures = calloc(pnumtextures, sizeof (*gr_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
|
||||
gl_textures = calloc(pnumtextures, sizeof (*gl_textures)*2); // *2 - 1 for encore-remapped texture and another for noencore texture (unused when not in encore)
|
||||
#else
|
||||
gr_textures = calloc(pnumtextures, sizeof (*gr_textures));
|
||||
gl_textures = calloc(pnumtextures, sizeof (*gl_textures));
|
||||
#endif
|
||||
if (gr_textures == NULL)
|
||||
if (gl_textures == NULL)
|
||||
I_Error("HWR_LoadTextures: ran out of memory for OpenGL textures. Sad!");
|
||||
}
|
||||
|
||||
@@ -552,9 +558,9 @@ void HWR_LoadTextures(size_t pnumtextures)
|
||||
// --------------------------------------------------------------------------
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
{
|
||||
GLMapTexture_t *grtex;
|
||||
GLMapTexture_t *gltex;
|
||||
|
||||
if (tex < 0 || tex >= (signed)gr_numtextures)
|
||||
if (tex < 0 || tex >= (signed)gl_numtextures)
|
||||
{
|
||||
#ifdef PARANOIA
|
||||
I_Error("HWR_GetTexture: Invalid texture ID %d", tex);
|
||||
@@ -563,25 +569,25 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
#endif
|
||||
}
|
||||
#ifdef GLENCORE
|
||||
grtex = &gr_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
|
||||
gltex = &gl_textures[tex*2 + (encoremap && !noencore ? 0 : 1)];
|
||||
#else
|
||||
grtex = &gr_textures[tex];
|
||||
gltex = &gl_textures[tex];
|
||||
#endif
|
||||
if (!grtex->mipmap.data && !grtex->mipmap.downloaded)
|
||||
HWR_GenerateTexture(tex, grtex, noencore);
|
||||
if (!gltex->mipmap.data && !gltex->mipmap.downloaded)
|
||||
HWR_GenerateTexture(tex, gltex, noencore);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
if (!gltex->mipmap.downloaded)
|
||||
GL_SetTexture(&gltex->mipmap);
|
||||
HWR_SetCurrentTexture(&gltex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grtex->mipmap.data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(gltex->mipmap.data, PU_HWRCACHE_UNLOCKED);
|
||||
|
||||
return grtex;
|
||||
return gltex;
|
||||
}
|
||||
|
||||
static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
static void HWR_CacheFlat(GLMipmap_t *glMipmap, lumpnum_t flatlumpnum)
|
||||
{
|
||||
#ifdef GLENCORE
|
||||
UINT8 *flat;
|
||||
@@ -590,8 +596,8 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
size_t size, pflatsize;
|
||||
|
||||
// setup the texture info
|
||||
grMipmap->format = GL_TEXFMT_P_8;
|
||||
grMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
glMipmap->format = GL_TEXFMT_P_8;
|
||||
glMipmap->flags = TF_WRAPXY|TF_CHROMAKEYED;
|
||||
|
||||
size = W_LumpLength(flatlumpnum);
|
||||
|
||||
@@ -619,21 +625,21 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum)
|
||||
pflatsize = 64;
|
||||
break;
|
||||
}
|
||||
grMipmap->width = (UINT16)pflatsize;
|
||||
grMipmap->height = (UINT16)pflatsize;
|
||||
glMipmap->width = (UINT16)pflatsize;
|
||||
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, &grMipmap->data));
|
||||
PU_HWRCACHE, &glMipmap->data));
|
||||
|
||||
#ifdef GLENCORE
|
||||
flat = grMipmap->data;
|
||||
flat = glMipmap->data;
|
||||
for (steppy = 0; steppy < size; steppy++)
|
||||
{
|
||||
if (flat[steppy] == HWR_PATCHES_CHROMAKEY_COLORINDEX)
|
||||
continue;
|
||||
|
||||
flat[steppy] = grMipmap->colormap[flat[steppy]];
|
||||
flat[steppy] = glMipmap->colormap[flat[steppy]];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -641,117 +647,117 @@ static void HWR_CacheFlat(GLMipmap_t *grMipmap, 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 *grmip;
|
||||
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
if (flatlumpnum == LUMPERROR)
|
||||
return;
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(flatlumpnum)->mipmap;
|
||||
|
||||
grmip->colormap = colormaps;
|
||||
glMipmap->colormap = colormaps;
|
||||
|
||||
#ifdef GLENCORE
|
||||
if (!noencoremap && encoremap)
|
||||
grmip->colormap += COLORMAP_REMAPOFFSET;
|
||||
glMipmap->colormap += COLORMAP_REMAPOFFSET;
|
||||
#endif
|
||||
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFlat(grmip, flatlumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFlat(glMipmap, flatlumpnum);
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
if (!glMipmap->downloaded)
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->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 *grmip, GLPatch_t *gpatch)
|
||||
static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
|
||||
{
|
||||
if (!grmip->downloaded && !grmip->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, grmip, 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 (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
if (!glMipmap->downloaded)
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->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 *grmip, *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 (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
for (glMipmap = glPatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (grmip->colormap != colormap)
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
HWR_LoadMappedPatch(grmip, gpatch);
|
||||
HWR_LoadMappedPatch(glMipmap, glPatch);
|
||||
return;
|
||||
}
|
||||
// not found, create it!
|
||||
@@ -761,38 +767,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");
|
||||
grmip->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 *grpatch;
|
||||
GLPatch_t *glPatch;
|
||||
|
||||
if (!(grpatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
if (!(glPatch = M_AATreeGet(hwrcache, lumpnum)))
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof(GLPatch_t), PU_HWRPATCHINFO, NULL);
|
||||
grpatch->wadnum = wadnum;
|
||||
grpatch->lumpnum = lumpnum;
|
||||
grpatch->mipmap = Z_Calloc(sizeof(GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
M_AATreeSet(hwrcache, lumpnum, grpatch);
|
||||
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 grpatch;
|
||||
return glPatch;
|
||||
}
|
||||
|
||||
GLPatch_t *HWR_GetCachedGLPatch(lumpnum_t lumpnum)
|
||||
@@ -840,14 +846,14 @@ static void HWR_DrawFadeMaskInCache(GLMipmap_t *mipmap, INT32 pblockwidth, INT32
|
||||
Z_Free(flat);
|
||||
}
|
||||
|
||||
static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
||||
static void HWR_CacheFadeMask(GLMipmap_t *glMipmap, lumpnum_t fademasklumpnum)
|
||||
{
|
||||
size_t size;
|
||||
UINT16 fmheight = 0, fmwidth = 0;
|
||||
|
||||
// setup the texture info
|
||||
grMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
|
||||
grMipmap->flags = 0;
|
||||
glMipmap->format = GL_TEXFMT_ALPHA_8; // put the correct alpha levels straight in so I don't need to convert it later
|
||||
glMipmap->flags = 0;
|
||||
|
||||
size = W_LumpLength(fademasklumpnum);
|
||||
|
||||
@@ -876,28 +882,28 @@ static void HWR_CacheFadeMask(GLMipmap_t *grMipmap, lumpnum_t fademasklumpnum)
|
||||
}
|
||||
|
||||
// Thankfully, this will still work for this scenario
|
||||
grMipmap->width = fmwidth;
|
||||
grMipmap->height = fmheight;
|
||||
glMipmap->width = fmwidth;
|
||||
glMipmap->height = fmheight;
|
||||
|
||||
MakeBlock(grMipmap);
|
||||
MakeBlock(glMipmap);
|
||||
|
||||
HWR_DrawFadeMaskInCache(grMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
|
||||
HWR_DrawFadeMaskInCache(glMipmap, fmwidth, fmheight, fademasklumpnum, fmwidth, fmheight);
|
||||
// I DO need to convert this because it isn't power of 2 and we need the alpha
|
||||
}
|
||||
|
||||
void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
{
|
||||
GLMipmap_t *grmip;
|
||||
GLMipmap_t *glMipmap;
|
||||
|
||||
grmip = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
glMipmap = HWR_GetCachedGLPatch(fademasklumpnum)->mipmap;
|
||||
|
||||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFadeMask(grmip, fademasklumpnum);
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(grmip);
|
||||
GL_SetTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
// =================================================
|
||||
@@ -909,15 +915,15 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
// set the palette for palette postprocessing
|
||||
if (cv_grpalettedepth.value == 16)
|
||||
if (cv_glpalettedepth.value == 16)
|
||||
{
|
||||
// crush to 16-bit rgb565, like software currently does in the standard configuration
|
||||
// Note: Software's screenshots have the 24-bit palette, but the screen gets
|
||||
// the 16-bit version! For making comparison screenshots either use an external screenshot
|
||||
// tool or set the palette depth to 24 bits.
|
||||
RGBA_t crushed_palette[256];
|
||||
int i;
|
||||
for (i = 0; i < 256; i++)
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
float fred = (float)(palette[i].s.red >> 3);
|
||||
float fgreen = (float)(palette[i].s.green >> 2);
|
||||
@@ -927,21 +933,21 @@ 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.
|
||||
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
|
||||
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
|
||||
HWR_SetMapPalette();
|
||||
}
|
||||
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 +980,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
|
||||
}
|
||||
}
|
||||
#undef STEP_SIZE
|
||||
HWD.pfnSetPaletteLookup(lut);
|
||||
GL_SetPaletteLookup(lut);
|
||||
Z_Free(lut);
|
||||
}
|
||||
|
||||
@@ -987,11 +993,9 @@ void HWR_SetMapPalette(void)
|
||||
RGBA_t *palette;
|
||||
int i;
|
||||
|
||||
if ((!(gamestate == GS_LEVEL)) || (gamestate == GS_TITLESCREEN))
|
||||
if (gamestate != GS_LEVEL || gamestate == GS_TITLESCREEN)
|
||||
{
|
||||
// outside of a level, pMasterPalette should have PLAYPAL ready for us
|
||||
//palette = pMasterPalette; // we dont have this in kart so just use pLocalPalette as before
|
||||
|
||||
// outside of a level, pLocalPalette should have PLAYPAL ready for us
|
||||
palette = pLocalPalette;
|
||||
}
|
||||
else
|
||||
@@ -1001,8 +1005,10 @@ void HWR_SetMapPalette(void)
|
||||
lumpnum_t lumpnum = W_GetNumForName(GetPalette());
|
||||
size_t palsize = W_LumpLength(lumpnum);
|
||||
UINT8 *RGB_data;
|
||||
|
||||
if (palsize < 768) // 256 * 3
|
||||
I_Error("HWR_SetMapPalette: A programmer assumed palette lumps are at least 768 bytes long, but apparently this was a wrong assumption!\n");
|
||||
|
||||
RGB_data = W_CacheLumpNum(lumpnum, PU_CACHE);
|
||||
// we got the RGB palette now, but we need it in RGBA format.
|
||||
for (i = 0; i < 256; i++)
|
||||
@@ -1022,7 +1028,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,12 +1051,11 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
// get hwr lighttable id for colormap, create it if it doesn't already exist
|
||||
UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
|
||||
{
|
||||
@@ -1082,7 +1087,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 / 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;
|
||||
|
||||
+42
-13
@@ -121,8 +121,6 @@ typedef struct
|
||||
poly_t *planepoly; // the generated convex polygon
|
||||
} extrasubsector_t;
|
||||
|
||||
//here lies gr_vissprite
|
||||
|
||||
// Kart features
|
||||
#define USE_FTRANSFORM_ANGLEZ
|
||||
#define USE_FTRANSFORM_MIRROR
|
||||
@@ -134,14 +132,14 @@ typedef struct
|
||||
{
|
||||
FLOAT x,y,z; // position
|
||||
#ifdef USE_FTRANSFORM_ANGLEZ
|
||||
FLOAT anglex,angley,anglez; // aimingangle / viewangle
|
||||
FLOAT anglex2,anglez2; // secondaries
|
||||
FLOAT anglex, angley, anglez; // aimingangle / viewangle
|
||||
FLOAT anglex2, anglez2; // secondaries
|
||||
#else
|
||||
FLOAT anglex,angley; // aimingangle / viewangle
|
||||
FLOAT anglex, angley; // aimingangle / viewangle
|
||||
FLOAT anglex2; // secondaries
|
||||
#endif
|
||||
FLOAT scalex,scaley,scalez;
|
||||
FLOAT spritexscale,spriteyscale;
|
||||
FLOAT scalex, scaley, scalez;
|
||||
FLOAT spritexscale, spriteyscale;
|
||||
FLOAT fovxangle, fovyangle;
|
||||
UINT8 splitscreen;
|
||||
boolean flip; // screenflip
|
||||
@@ -156,7 +154,7 @@ typedef struct
|
||||
boolean mirrorflip; // Encore Mode with Flipcam
|
||||
#endif
|
||||
boolean shearing; // 14042019
|
||||
angle_t viewaiming; // 17052019
|
||||
float viewaiming; // 17052019
|
||||
} FTransform;
|
||||
|
||||
// Transformed vector, as passed to HWR API
|
||||
@@ -166,6 +164,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.
|
||||
@@ -173,7 +206,6 @@ enum
|
||||
{
|
||||
SHADER_NONE = -1,
|
||||
SHADER_FLOOR = 0,
|
||||
SHADER_SHADOW,
|
||||
SHADER_WALL,
|
||||
SHADER_SPRITE,
|
||||
SHADER_MODEL,
|
||||
@@ -204,7 +236,6 @@ enum hwdshaderstage
|
||||
|
||||
typedef enum hwdshaderstage hwdshaderstage_t;
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// RENDER MODES
|
||||
// ==========================================================================
|
||||
@@ -289,9 +320,6 @@ typedef struct FSurfaceInfo FSurfaceInfo;
|
||||
|
||||
enum hwdsetspecialstate
|
||||
{
|
||||
#ifdef USE_FBO_OGL
|
||||
HWD_SET_FRAMEBUFFER,
|
||||
#endif
|
||||
HWD_SET_SHADERS,
|
||||
|
||||
HWD_SET_TEXTUREFILTERMODE,
|
||||
@@ -346,6 +374,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;
|
||||
|
||||
+50
-49
@@ -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
|
||||
@@ -122,7 +123,7 @@ 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)
|
||||
@@ -303,10 +304,10 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
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)
|
||||
@@ -460,10 +461,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
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 +540,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 +553,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 (HWR_ShouldUsePaletteRendering() && cv_grscreentextures.value)
|
||||
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,21 +589,21 @@ 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;
|
||||
|
||||
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
else
|
||||
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
|
||||
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
|
||||
GL_DrawPolygon(&Surf, v, 4, poly_flags);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
@@ -629,7 +630,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -652,17 +653,17 @@ void HWR_DrawViewBorder(INT32 clearlines)
|
||||
INT32 basewindowx, basewindowy;
|
||||
GLPatch_t *patch;
|
||||
|
||||
// if (gr_viewwidth == vid.width)
|
||||
// if (gl_viewwidth == vid.width)
|
||||
// return;
|
||||
|
||||
if (!clearlines)
|
||||
clearlines = BASEVIDHEIGHT; // refresh all
|
||||
|
||||
// calc view size based on original game resolution
|
||||
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
|
||||
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_viewheight), vid.fdupy));
|
||||
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowy), vid.fdupy));
|
||||
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gr_baseviewwindowx), vid.fdupx));
|
||||
baseviewwidth = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewwidth), vid.fdupx)); //(cv_viewsize.value * BASEVIDWIDTH/10)&~7;
|
||||
baseviewheight = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_viewheight), vid.fdupy));
|
||||
top = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowy), vid.fdupy));
|
||||
side = FixedInt(FixedDiv(FLOAT_TO_FIXED(gl_baseviewwindowx), vid.fdupx));
|
||||
|
||||
// top
|
||||
HWR_DrawFlatFill(0, 0,
|
||||
@@ -776,16 +777,16 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
||||
F2DCoord v1, v2;
|
||||
RGBA_t color_rgba;
|
||||
RGBA_t *palette = HWR_GetTexturePalette();
|
||||
|
||||
|
||||
color_rgba = palette[color&0xFF];
|
||||
|
||||
|
||||
v1.x = ((float)fl->a.x-(vid.width/2.0f))*(2.0f/vid.width);
|
||||
v1.y = ((float)fl->a.y-(vid.height/2.0f))*(2.0f/vid.height);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -879,7 +880,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);
|
||||
}
|
||||
|
||||
@@ -918,7 +919,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;
|
||||
}
|
||||
|
||||
@@ -989,7 +990,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);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -1029,7 +1030,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;
|
||||
}
|
||||
|
||||
@@ -1107,7 +1108,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
|
||||
@@ -1191,7 +1192,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 +1208,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__
|
||||
+3
-12
@@ -23,7 +23,7 @@
|
||||
|
||||
// needed for sprite rendering
|
||||
// equivalent of the software renderer's vissprites
|
||||
typedef struct gr_vissprite_s
|
||||
typedef struct gl_vissprite_s
|
||||
{
|
||||
float x1, x2;
|
||||
float z1, z2;
|
||||
@@ -32,7 +32,6 @@ typedef struct gr_vissprite_s
|
||||
float scale;
|
||||
float spritexscale, spriteyscale;
|
||||
float spritexoffset, spriteyoffset;
|
||||
UINT32 renderflags;
|
||||
GLPatch_t *gpatch;
|
||||
boolean flip;
|
||||
UINT8 translucency; //alpha level 0-255
|
||||
@@ -42,7 +41,7 @@ typedef struct gr_vissprite_s
|
||||
//Hurdler: 25/04/2000: now support colormap in hardware mode
|
||||
UINT8 *colormap;
|
||||
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
|
||||
} gr_vissprite_t;
|
||||
} gl_vissprite_t;
|
||||
|
||||
// --------
|
||||
// hw_bsp.c
|
||||
@@ -64,7 +63,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap);
|
||||
GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore);
|
||||
void HWR_GetPatch(GLPatch_t *gpatch);
|
||||
void HWR_GetMappedPatch(GLPatch_t *gpatch, const UINT8 *colormap);
|
||||
void HWR_MakePatch(patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipmap, boolean makebitmap);
|
||||
void HWR_MakePatch(patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap);
|
||||
void HWR_UnlockCachedPatch(GLPatch_t *gpatch);
|
||||
void HWR_SetPalette(RGBA_t *palette);
|
||||
|
||||
@@ -82,14 +81,6 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum);
|
||||
extern INT32 patchformat;
|
||||
extern INT32 textureformat;
|
||||
|
||||
// --------
|
||||
// hw_main.c // originally hw_drawnodes.c from HWPortal branch
|
||||
// --------
|
||||
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight,
|
||||
INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
|
||||
|
||||
// --------
|
||||
// hw_shaders.c
|
||||
// --------
|
||||
|
||||
+1454
-1591
File diff suppressed because it is too large.
Load diff
+67
-61
@@ -23,6 +23,7 @@
|
||||
#include "hw_glob.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_portal.h"
|
||||
|
||||
#include "../am_map.h"
|
||||
#include "../d_player.h"
|
||||
@@ -35,15 +36,32 @@
|
||||
void HWR_Startup(void);
|
||||
void HWR_Shutdown(void);
|
||||
|
||||
extern float gr_viewwidth, gr_viewheight, gr_baseviewwindowx, gr_baseviewwindowy;
|
||||
extern float gl_viewwidth, gl_viewheight, gl_baseviewwindowx, gl_baseviewwindowy;
|
||||
|
||||
extern float gr_basewindowcenterx, gr_basewindowcentery;
|
||||
extern float gl_basewindowcenterx, gl_basewindowcentery;
|
||||
|
||||
extern unsigned msaa;
|
||||
extern boolean a2c;
|
||||
|
||||
extern FTransform atransform;
|
||||
extern float gr_viewsin, gr_viewcos;
|
||||
extern float gl_viewsin, gl_viewcos;
|
||||
|
||||
extern boolean gl_drawing_stencil;
|
||||
|
||||
extern seg_t *gl_curline;
|
||||
extern side_t *gl_sidedef;
|
||||
extern line_t *gl_linedef;
|
||||
extern sector_t *gl_frontsector;
|
||||
extern sector_t *gl_backsector;
|
||||
|
||||
enum
|
||||
{
|
||||
HWR_STENCIL_NORMAL,
|
||||
HWR_STENCIL_BEGIN,
|
||||
HWR_STENCIL_REVERSE,
|
||||
HWR_STENCIL_DEPTH,
|
||||
HWR_STENCIL_SKY
|
||||
};
|
||||
|
||||
// Performance stats
|
||||
extern ps_metric_t ps_hw_nodesorttime;
|
||||
@@ -62,7 +80,7 @@ extern ps_metric_t ps_hw_numcolors;
|
||||
extern ps_metric_t ps_hw_batchsorttime;
|
||||
extern ps_metric_t ps_hw_batchdrawtime;
|
||||
|
||||
extern boolean gr_shadersavailable;
|
||||
extern boolean gl_shadersavailable;
|
||||
|
||||
// hw_draw.c
|
||||
void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option);
|
||||
@@ -81,24 +99,28 @@ UINT8 *HWR_GetScreenshot(void);
|
||||
boolean HWR_Screenshot(const char *lbmname);
|
||||
|
||||
// hw_main.c
|
||||
void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox);
|
||||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
||||
void HWR_SetViewSize(void);
|
||||
void HWR_AddCommands(void);
|
||||
|
||||
void HWR_RenderPlayerView(INT32 viewnumber, player_t *player);
|
||||
void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *player, int stencil_level, boolean allow_portals);
|
||||
|
||||
void HWR_ClearSkyDome(void);
|
||||
void HWR_BuildSkyDome(void);
|
||||
|
||||
void HWR_SetTransform(float fpov, player_t *player);
|
||||
void HWR_ClearClipper(void);
|
||||
void HWR_SetStencilState(int state, int level);
|
||||
|
||||
boolean HWR_UseShader(void);
|
||||
boolean HWR_ShouldUsePaletteRendering(void);
|
||||
boolean HWR_PalRenderFlashpal(void);
|
||||
void HWR_TogglePaletteRendering(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);
|
||||
UINT8 HWR_FogBlockAlpha(INT32 light, extracolormap_t *colormap); // Let's see if this can work
|
||||
|
||||
FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
|
||||
@@ -106,79 +128,63 @@ FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf);
|
||||
INT32 HWR_GetTextureUsed(void);
|
||||
|
||||
// hw_main.c: Post-rendering
|
||||
void HWR_DoPostProcessor(player_t *player);
|
||||
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);
|
||||
|
||||
// hw_main.c: Planes
|
||||
void HWR_RenderPlane(subsector_t *subsector, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, FBITFIELD PolyFlags, INT32 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
|
||||
void HWR_AddTransparentFloor(lumpnum_t lumpnum, extrasubsector_t *xsub, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, boolean fogplane, extracolormap_t *planecolormap);
|
||||
|
||||
void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, FBITFIELD blendmode, UINT8 lightlevel, lumpnum_t lumpnum, sector_t *FOFsector, UINT8 alpha, extracolormap_t *planecolormap);
|
||||
void HWR_AddTransparentPolyobjectFloor(lumpnum_t lumpnum, polyobj_t *polysector, boolean isceiling, fixed_t fixedheight, INT32 lightlevel, INT32 alpha, sector_t *FOFSector, FBITFIELD blend, extracolormap_t *planecolormap);
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
// hw_main.c: Segs
|
||||
void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom
|
||||
void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 texnum, boolean noencore, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap);
|
||||
// moved HWR_SplitWall to hw_main.c
|
||||
void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf);
|
||||
void HWR_DrawSkyBackground(float fpov);
|
||||
|
||||
// hw_main.c: Sprites
|
||||
void HWR_AddSprites(sector_t *sec);
|
||||
void HWR_ProjectSprite(mobj_t *thing);
|
||||
//void HWR_ProjectPrecipitationSprite(precipmobj_t *thing);
|
||||
void HWR_DrawSprites(void);
|
||||
|
||||
// hw_bsp.c
|
||||
void HWR_CreatePlanePolygons(INT32 bspnum);
|
||||
extern boolean gr_maphasportals;
|
||||
extern boolean gl_maphasportals;
|
||||
|
||||
// hw_cache.c
|
||||
void HWR_LoadTextures(size_t pnumtextures);
|
||||
RGBA_t *HWR_GetTexturePalette(void);
|
||||
|
||||
void HWR_SetShaderState(void);
|
||||
|
||||
// Console variables
|
||||
extern consvar_t cv_grshaders;
|
||||
extern CV_PossibleValue_t glanisotropicmode_cons_t[];
|
||||
|
||||
extern consvar_t cv_glscreentextures;
|
||||
#ifdef USE_FBO_OGL
|
||||
extern consvar_t cv_grframebuffer;
|
||||
extern consvar_t cv_glframebuffer;
|
||||
#endif
|
||||
extern consvar_t cv_splitwallfix;
|
||||
extern consvar_t cv_grshearing;
|
||||
extern consvar_t cv_grfov;
|
||||
extern consvar_t cv_grmdls;
|
||||
extern consvar_t cv_grfog;
|
||||
extern consvar_t cv_grfogdensity;
|
||||
extern consvar_t cv_grfiltermode;
|
||||
extern consvar_t cv_granisotropicmode;
|
||||
extern consvar_t cv_grcorrecttricks;
|
||||
extern consvar_t cv_grfovchange;
|
||||
extern consvar_t cv_grsolvetjoin;
|
||||
extern consvar_t cv_grspritebillboarding;
|
||||
extern consvar_t cv_grfakecontrast;
|
||||
extern consvar_t cv_grslopecontrast;
|
||||
extern consvar_t cv_grhorizonlines;
|
||||
extern consvar_t cv_grfallbackplayermodel;
|
||||
extern consvar_t cv_grbatching;
|
||||
extern consvar_t cv_grrenderdistance;
|
||||
extern consvar_t cv_grpaletterendering;
|
||||
extern consvar_t cv_grpalettedepth;
|
||||
extern consvar_t cv_grflashpal;
|
||||
extern consvar_t cv_lightdither;
|
||||
extern consvar_t cv_grscreentextures;
|
||||
extern consvar_t cv_grportals;
|
||||
extern consvar_t cv_nostencil;
|
||||
extern consvar_t cv_secbright;
|
||||
|
||||
extern CV_PossibleValue_t granisotropicmode_cons_t[];
|
||||
extern consvar_t cv_glmdls;
|
||||
extern consvar_t cv_glfallbackplayermodel;
|
||||
|
||||
extern consvar_t cv_glspritebillboarding;
|
||||
extern consvar_t cv_glshearing;
|
||||
|
||||
extern consvar_t cv_glfakecontrast;
|
||||
extern consvar_t cv_glslopecontrast;
|
||||
|
||||
extern consvar_t cv_glshaders;
|
||||
|
||||
extern consvar_t cv_gllightdither;
|
||||
extern consvar_t cv_glsecbright;
|
||||
|
||||
extern consvar_t cv_glfiltermode;
|
||||
extern consvar_t cv_glanisotropicmode;
|
||||
|
||||
extern consvar_t cv_glsolvetjoin;
|
||||
|
||||
extern consvar_t cv_glbatching;
|
||||
|
||||
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;
|
||||
|
||||
#endif
|
||||
+108
-110
@@ -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
|
||||
@@ -147,7 +149,7 @@ static void PNG_warn(png_structp PNG, png_const_charp pngtext)
|
||||
CONS_Debug(DBG_RENDER, "libpng warning at %p: %s", PNG, pngtext);
|
||||
}
|
||||
|
||||
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *grpatch)
|
||||
static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_t *glpatch)
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop png_info_ptr;
|
||||
@@ -201,7 +203,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
||||
//CONS_Debug(DBG_RENDER, "libpng load error on %s\n", filename);
|
||||
png_destroy_read_struct(&png_ptr, &png_info_ptr, NULL);
|
||||
fclose(png_FILE);
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
Z_Free(glpatch->mipmap->data);
|
||||
return 0;
|
||||
}
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
@@ -242,7 +244,7 @@ static GLTextureFormat_t PNG_Load(const char *filename, int *w, int *h, GLPatch_
|
||||
|
||||
{
|
||||
png_uint_32 i, pitch = png_get_rowbytes(png_ptr, png_info_ptr);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &grpatch->mipmap->data);
|
||||
png_bytep PNG_image = Z_Malloc(pitch*height, PU_HWRCACHE, &glpatch->mipmap->data);
|
||||
png_bytepp row_pointers = png_malloc(png_ptr, height * sizeof (png_bytep));
|
||||
for (i = 0; i < height; i++)
|
||||
row_pointers[i] = PNG_image + i*pitch;
|
||||
@@ -282,7 +284,7 @@ typedef struct
|
||||
} PcxHeader;
|
||||
|
||||
static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
||||
GLPatch_t *grpatch)
|
||||
GLPatch_t *glpatch)
|
||||
{
|
||||
PcxHeader header;
|
||||
#define PALSIZE 768
|
||||
@@ -322,7 +324,7 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
||||
|
||||
pw = *w = header.xmax - header.xmin + 1;
|
||||
ph = *h = header.ymax - header.ymin + 1;
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &grpatch->mipmap->data);
|
||||
image = Z_Malloc(pw*ph*4, PU_HWRCACHE, &glpatch->mipmap->data);
|
||||
|
||||
if (fread(palette, sizeof (UINT8), PALSIZE, file) != PALSIZE)
|
||||
{
|
||||
@@ -364,43 +366,43 @@ static GLTextureFormat_t PCX_Load(const char *filename, int *w, int *h,
|
||||
// -----------------+
|
||||
static void md2_loadTexture(md2_t *model)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
GLPatch_t *glpatch;
|
||||
const char *filename = model->filename;
|
||||
|
||||
if (model->grpatch)
|
||||
if (model->glpatch)
|
||||
{
|
||||
grpatch = model->grpatch;
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
glpatch = model->glpatch;
|
||||
Z_Free(glpatch->mipmap->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||
&(model->grpatch));
|
||||
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
|
||||
&(model->glpatch));
|
||||
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
}
|
||||
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
|
||||
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
|
||||
if (glpatch->mipmap->format == 0)
|
||||
#endif
|
||||
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
|
||||
if (glpatch->mipmap->format == 0)
|
||||
{
|
||||
grpatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
glpatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
glpatch->mipmap->downloaded = 0;
|
||||
glpatch->mipmap->flags = 0;
|
||||
|
||||
grpatch->width = (INT16)w;
|
||||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
glpatch->width = (INT16)w;
|
||||
glpatch->height = (INT16)h;
|
||||
glpatch->mipmap->width = (UINT16)w;
|
||||
glpatch->mipmap->height = (UINT16)h;
|
||||
|
||||
// for palette rendering, color cube is applied in post-processing instead of here
|
||||
if (!HWR_ShouldUsePaletteRendering())
|
||||
@@ -408,7 +410,7 @@ static void md2_loadTexture(md2_t *model)
|
||||
UINT32 size;
|
||||
RGBA_t *image;
|
||||
// Lactozilla: Apply colour cube
|
||||
image = grpatch->mipmap->data;
|
||||
image = glpatch->mipmap->data;
|
||||
size = w*h;
|
||||
while (size--)
|
||||
{
|
||||
@@ -417,8 +419,8 @@ static void md2_loadTexture(md2_t *model)
|
||||
}
|
||||
}
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
GL_SetTexture(glpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -426,49 +428,49 @@ static void md2_loadTexture(md2_t *model)
|
||||
// -----------------+
|
||||
static void md2_loadBlendTexture(md2_t *model)
|
||||
{
|
||||
GLPatch_t *grpatch;
|
||||
GLPatch_t *glpatch;
|
||||
char *filename = Z_Malloc(strlen(model->filename)+7, PU_STATIC, NULL);
|
||||
strcpy(filename, model->filename);
|
||||
|
||||
FIL_ForceExtension(filename, "_blend.png");
|
||||
|
||||
if (model->blendgrpatch)
|
||||
if (model->blendglpatch)
|
||||
{
|
||||
grpatch = model->blendgrpatch;
|
||||
Z_Free(grpatch->mipmap->data);
|
||||
glpatch = model->blendglpatch;
|
||||
Z_Free(glpatch->mipmap->data);
|
||||
}
|
||||
else
|
||||
{
|
||||
grpatch = Z_Calloc(sizeof *grpatch, PU_HWRPATCHINFO,
|
||||
&(model->blendgrpatch));
|
||||
grpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
glpatch = Z_Calloc(sizeof *glpatch, PU_HWRPATCHINFO,
|
||||
&(model->blendglpatch));
|
||||
glpatch->mipmap = Z_Calloc(sizeof (GLMipmap_t), PU_HWRPATCHINFO, NULL);
|
||||
}
|
||||
|
||||
if (!grpatch->mipmap->downloaded && !grpatch->mipmap->data)
|
||||
if (!glpatch->mipmap->downloaded && !glpatch->mipmap->data)
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
#ifdef HAVE_PNG
|
||||
grpatch->mipmap->format = PNG_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
glpatch->mipmap->format = PNG_Load(filename, &w, &h, glpatch);
|
||||
if (glpatch->mipmap->format == 0)
|
||||
#endif
|
||||
grpatch->mipmap->format = PCX_Load(filename, &w, &h, grpatch);
|
||||
if (grpatch->mipmap->format == 0)
|
||||
glpatch->mipmap->format = PCX_Load(filename, &w, &h, glpatch);
|
||||
if (glpatch->mipmap->format == 0)
|
||||
{
|
||||
grpatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
glpatch->notfound = true;// mark it so its not searched for again repeatedly
|
||||
Z_Free(filename);
|
||||
return;
|
||||
}
|
||||
|
||||
grpatch->mipmap->downloaded = 0;
|
||||
grpatch->mipmap->flags = 0;
|
||||
glpatch->mipmap->downloaded = 0;
|
||||
glpatch->mipmap->flags = 0;
|
||||
|
||||
grpatch->width = (INT16)w;
|
||||
grpatch->height = (INT16)h;
|
||||
grpatch->mipmap->width = (UINT16)w;
|
||||
grpatch->mipmap->height = (UINT16)h;
|
||||
glpatch->width = (INT16)w;
|
||||
glpatch->height = (INT16)h;
|
||||
glpatch->mipmap->width = (UINT16)w;
|
||||
glpatch->mipmap->height = (UINT16)h;
|
||||
}
|
||||
HWD.pfnSetTexture(grpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(grpatch);
|
||||
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);
|
||||
}
|
||||
@@ -489,7 +491,7 @@ void HWR_InitMD2(void)
|
||||
{
|
||||
md2_playermodels[s].scale = -1.0f;
|
||||
md2_playermodels[s].model = NULL;
|
||||
md2_playermodels[s].grpatch = NULL;
|
||||
md2_playermodels[s].glpatch = NULL;
|
||||
md2_playermodels[s].skin = -1;
|
||||
md2_playermodels[s].notfound = true;
|
||||
md2_playermodels[s].error = false;
|
||||
@@ -498,7 +500,7 @@ void HWR_InitMD2(void)
|
||||
{
|
||||
md2_localplayermodels[s].scale = -1.0f;
|
||||
md2_localplayermodels[s].model = NULL;
|
||||
md2_localplayermodels[s].grpatch = NULL;
|
||||
md2_localplayermodels[s].glpatch = NULL;
|
||||
md2_localplayermodels[s].skin = -1;
|
||||
md2_localplayermodels[s].notfound = true;
|
||||
md2_localplayermodels[s].error = false;
|
||||
@@ -507,7 +509,7 @@ void HWR_InitMD2(void)
|
||||
{
|
||||
md2_models[i].scale = -1.0f;
|
||||
md2_models[i].model = NULL;
|
||||
md2_models[i].grpatch = NULL;
|
||||
md2_models[i].glpatch = NULL;
|
||||
md2_models[i].skin = -1;
|
||||
md2_models[i].notfound = true;
|
||||
md2_models[i].error = false;
|
||||
@@ -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 *grmip, 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 (grmip->width == 0)
|
||||
if (glMipmap->width == 0)
|
||||
{
|
||||
grmip->width = gpatch->width;
|
||||
grmip->height = gpatch->height;
|
||||
glMipmap->width = gpatch->width;
|
||||
glMipmap->height = gpatch->height;
|
||||
|
||||
// no wrap around, no chroma key
|
||||
grmip->flags = 0;
|
||||
glMipmap->flags = 0;
|
||||
// setup the texture info
|
||||
grmip->format = GL_TEXFMT_RGBA;
|
||||
glMipmap->format = GL_TEXFMT_RGBA;
|
||||
}
|
||||
|
||||
if (grmip->data)
|
||||
if (glMipmap->data)
|
||||
{
|
||||
Z_Free(grmip->data);
|
||||
grmip->data = NULL;
|
||||
Z_Free(glMipmap->data);
|
||||
glMipmap->data = NULL;
|
||||
}
|
||||
|
||||
cur = Z_Malloc(size*4, PU_HWRCACHE, &grmip->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 *grmip, *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 (grmip = gpatch->mipmap; grmip->nextcolormap; )
|
||||
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
grmip = grmip->nextcolormap;
|
||||
if (grmip->colormap == colormap)
|
||||
glMipmap = glMipmap->nextcolormap;
|
||||
|
||||
if (glMipmap->colormap != colormap)
|
||||
continue;
|
||||
|
||||
if (glMipmap->downloaded && glMipmap->data)
|
||||
{
|
||||
if (grmip->downloaded && grmip->data)
|
||||
{
|
||||
HWD.pfnSetTexture(grmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(grmip->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,26 +1078,25 @@ 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");
|
||||
grmip->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
|
||||
// :
|
||||
// Returns :
|
||||
// -----------------+
|
||||
|
||||
void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
{
|
||||
md2_t *md2;
|
||||
|
||||
@@ -1105,7 +1106,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
FTransform p;
|
||||
FSurfaceInfo Surf;
|
||||
|
||||
if (!cv_grmdls.value)
|
||||
if (!cv_glmdls.value)
|
||||
return;
|
||||
|
||||
if (spr->precip)
|
||||
@@ -1164,7 +1165,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
angle_t ang;
|
||||
interpmobjstate_t interp;
|
||||
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_grmaxinterpdist.value))
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_maxinterpdist.value || R_QuickCamDist(spr->mobj->x, spr->mobj->y) < cv_maxinterpdist.value))
|
||||
{
|
||||
R_InterpolateMobjState(spr->mobj, rendertimefrac, &interp);
|
||||
}
|
||||
@@ -1234,7 +1235,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
if (md2->model)
|
||||
{
|
||||
md2_printModelInfo(md2->model);
|
||||
HWD.pfnCreateModelVBOs(md2->model);
|
||||
GL_CreateModelVBOs(md2->model);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1244,22 +1245,22 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
}
|
||||
}
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
gpatch = md2->grpatch;
|
||||
gpatch = md2->glpatch;
|
||||
if (!gpatch || ((!gpatch->mipmap->format || !gpatch->mipmap->downloaded) && !gpatch->notfound))
|
||||
md2_loadTexture(md2);
|
||||
gpatch = md2->grpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
gpatch = md2->glpatch; // Load it again, because it isn't being loaded into gpatch after md2_loadtexture...
|
||||
|
||||
if ((gpatch && gpatch->mipmap->format) // don't load the blend texture if the base texture isn't available
|
||||
&& (!md2->blendgrpatch
|
||||
|| ((!((GLPatch_t *)md2->blendgrpatch)->mipmap->format || !((GLPatch_t *)md2->blendgrpatch)->mipmap->downloaded)
|
||||
&& !((GLPatch_t *)md2->blendgrpatch)->notfound)))
|
||||
&& (!md2->blendglpatch
|
||||
|| ((!((GLPatch_t *)md2->blendglpatch)->mipmap->format || !((GLPatch_t *)md2->blendglpatch)->mipmap->downloaded)
|
||||
&& !((GLPatch_t *)md2->blendglpatch)->notfound)))
|
||||
md2_loadBlendTexture(md2);
|
||||
|
||||
if (gpatch && gpatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
{
|
||||
if ((skincolors_t)spr->mobj->color != SKINCOLOR_NONE &&
|
||||
md2->blendgrpatch && ((GLPatch_t *)md2->blendgrpatch)->mipmap->format
|
||||
&& gpatch->width == ((GLPatch_t *)md2->blendgrpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendgrpatch)->height)
|
||||
md2->blendglpatch && ((GLPatch_t *)md2->blendglpatch)->mipmap->format
|
||||
&& gpatch->width == ((GLPatch_t *)md2->blendglpatch)->width && gpatch->height == ((GLPatch_t *)md2->blendglpatch)->height)
|
||||
{
|
||||
INT32 tcskinnum = TC_DEFAULT;
|
||||
if ((spr->mobj->flags & MF_BOSS) && (spr->mobj->flags2 & MF2_FRET) && (leveltime & 1)) // Bosses "flash"
|
||||
@@ -1284,12 +1285,12 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
}
|
||||
else tcskinnum = TC_DEFAULT;
|
||||
}
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendgrpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
HWR_GetBlendedTexture(gpatch, (GLPatch_t *)md2->blendglpatch, tcskinnum, spr->colormap, (skincolors_t)spr->mobj->color);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is safe, since we know the texture has been downloaded
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GL_SetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1313,7 +1314,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
// Interpolate the model interpolation. (lol)
|
||||
tics -= FixedToFloat(rendertimefrac);
|
||||
|
||||
if (cv_grmdls.value == 1 && tics <= durs)
|
||||
if (cv_glmdls.value == 1 && tics <= durs)
|
||||
{
|
||||
// frames are handled differently for states with FF_ANIMATE, so get the next frame differently for the interpolation
|
||||
if (spr->mobj->frame & FF_ANIMATE)
|
||||
@@ -1370,19 +1371,16 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
|
||||
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);
|
||||
angle_t sliptideroll = ((cv_sloperoll.value && cv_sliptideroll.value && spr->mobj->player) ? spr->mobj->player->sliproll : 0);
|
||||
|
||||
if ((spr->mobj->rollangle)||(sliptideroll && cv_sliptideroll.value))
|
||||
if (spr->mobj->rollangle || sliptideroll)
|
||||
{
|
||||
angle_t rollang = 0;
|
||||
rollfactor = ((spr->mobj->rollmodel == true) ? 1 : 0);
|
||||
|
||||
rollang = (spr->mobj->player && sliptideroll && cv_sliptideroll.value)
|
||||
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->sliptidemem)
|
||||
rollang = sliptideroll
|
||||
? (spr->mobj->rollangle * rollfactor) + (sliptideroll * spr->mobj->player->kartstuff[k_aizdriftstrat])
|
||||
: (spr->mobj->rollangle * rollfactor);
|
||||
|
||||
fixed_t anglef = AngleFixed(rollang);
|
||||
@@ -1465,7 +1463,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnSetShader(SHADER_MODEL); // model shader
|
||||
GL_SetShader(SHADER_MODEL); // model shader
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
@@ -1478,11 +1476,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
|
||||
float oy = ys * flipfactor*FIXED_TO_FLOAT(interp.spriteyoffset);
|
||||
|
||||
// offset perpendicular to the camera angle
|
||||
p.x -= ox * gr_viewsin;
|
||||
p.y += ox * gr_viewcos;
|
||||
p.x -= ox * gl_viewsin;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef struct
|
||||
float scale;
|
||||
float offset;
|
||||
model_t *model;
|
||||
void *grpatch;
|
||||
void *blendgrpatch;
|
||||
void *glpatch;
|
||||
void *blendglpatch;
|
||||
boolean notfound;
|
||||
INT32 skin;
|
||||
boolean error;
|
||||
@@ -40,7 +40,7 @@ extern md2_t md2_playermodels[MAXSKINS];
|
||||
extern md2_t md2_localplayermodels[MAXLOCALSKINS];
|
||||
|
||||
void HWR_InitMD2(void);
|
||||
void HWR_DrawMD2(gr_vissprite_t *spr);
|
||||
void HWR_DrawMD2(gl_vissprite_t *spr);
|
||||
void HWR_AddPlayerMD2(INT32 skin, boolean local);
|
||||
void HWR_AddSpriteMD2(size_t spritenum);
|
||||
|
||||
|
||||
@@ -0,0 +1,231 @@
|
||||
// SONIC ROBO BLAST 2 KART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2024 by Kart Krew.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
// Copyright (C) 2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1996 by id Software, Inc.
|
||||
//
|
||||
// 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_portal.c
|
||||
/// \brief OpenGL renderer portals.
|
||||
|
||||
// ==========================================================================
|
||||
// Visual portals (attr. Hannu Hanhi)
|
||||
// ==========================================================================
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "../r_portal.h"
|
||||
|
||||
#include "../z_zone.h"
|
||||
|
||||
#include "hw_clip.h"
|
||||
#include "hw_gl.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_main.h"
|
||||
#include "hw_portal.h"
|
||||
|
||||
SINT8 gl_portal_state = GLPORTAL_OFF;
|
||||
|
||||
gl_portallist_t *currentportallist;
|
||||
|
||||
// clip the area outside the portal destination window
|
||||
void HWR_PortalClipping(gl_portal_t *portal)
|
||||
{
|
||||
gld_clipper_SafeAddClipRange(portal->angle1, portal->angle2);
|
||||
}
|
||||
|
||||
static gl_portal_t* HWR_Portal_Add (seg_t *seg)
|
||||
{
|
||||
gl_portal_t *portal = Z_Malloc(sizeof(gl_portal_t), PU_STATIC, NULL);
|
||||
|
||||
// Linked list.
|
||||
if (!currentportallist->base)
|
||||
{
|
||||
currentportallist->base = portal;
|
||||
currentportallist->cap = portal;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentportallist->cap->next = portal;
|
||||
currentportallist->cap = portal;
|
||||
}
|
||||
portal->next = NULL;
|
||||
|
||||
portal->seg = seg;
|
||||
|
||||
return portal;
|
||||
}
|
||||
|
||||
void HWR_FreePortalList(gl_portallist_t freelist)
|
||||
{
|
||||
portalcullsector = NULL;
|
||||
|
||||
// free memory from portal list allocated by calls to Add2Lines
|
||||
gl_portal_t *gl_portal_temp = freelist.base;
|
||||
while (gl_portal_temp)
|
||||
{
|
||||
gl_portal_t *nextportal = gl_portal_temp->next;
|
||||
Z_Free(gl_portal_temp);
|
||||
gl_portal_temp = nextportal;
|
||||
}
|
||||
}
|
||||
|
||||
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg)
|
||||
{
|
||||
gl_portal_t *portal = HWR_Portal_Add(seg);
|
||||
|
||||
// Offset the portal view by the linedef centers
|
||||
line_t* start = &lines[line1];
|
||||
line_t* dest = &lines[line2];
|
||||
|
||||
angle_t dangle = R_PointToAngle2(0, 0, dest->dx, dest->dy) - R_PointToAngle2(start->dx, start->dy, 0, 0);
|
||||
|
||||
fixed_t disttopoint;
|
||||
angle_t angtopoint;
|
||||
|
||||
vertex_t dest_c, start_c;
|
||||
|
||||
// looking glass center
|
||||
start_c.x = start->v1->x/2 + start->v2->x/2;
|
||||
start_c.y = start->v1->y/2 + start->v2->y/2;
|
||||
|
||||
// other side center
|
||||
dest_c.x = dest->v1->x/2 + dest->v2->x/2;
|
||||
dest_c.y = dest->v1->y/2 + dest->v2->y/2;
|
||||
|
||||
disttopoint = R_PointToDist2(start_c.x, start_c.y, viewx, viewy);
|
||||
angtopoint = R_PointToAngle2(start_c.x, start_c.y, viewx, viewy);
|
||||
angtopoint += dangle;
|
||||
|
||||
portal->viewx = dest_c.x + FixedMul(FINECOSINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
|
||||
portal->viewy = dest_c.y + FixedMul(FINESINE(angtopoint>>ANGLETOFINESHIFT), disttopoint);
|
||||
portal->viewz = viewz + dest->frontsector->floorheight - start->frontsector->floorheight;
|
||||
portal->viewangle = viewangle + dangle;
|
||||
|
||||
portal->angle1 = R_PointToAngle64(seg->v1->x, seg->v1->y) + dangle;
|
||||
portal->angle2 = R_PointToAngle64(seg->v2->x, seg->v2->y) + dangle;
|
||||
|
||||
portal->clipline = line2;
|
||||
}
|
||||
|
||||
void HWR_PortalFrame(gl_portal_t* portal)
|
||||
{
|
||||
viewx = portal->viewx;
|
||||
viewy = portal->viewy;
|
||||
viewz = portal->viewz;
|
||||
|
||||
viewangle = portal->viewangle;
|
||||
//viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT);
|
||||
//viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT);
|
||||
|
||||
if (portal->clipline != -1)
|
||||
{
|
||||
portalclipline = &lines[portal->clipline];
|
||||
portalcullsector = portalclipline->frontsector;
|
||||
viewsector = portalclipline->frontsector;
|
||||
}
|
||||
else
|
||||
{
|
||||
portalclipline = NULL;
|
||||
portalcullsector = NULL;
|
||||
viewsector = R_PointInSubsectorFast(viewx, viewy)->sector;
|
||||
}
|
||||
}
|
||||
|
||||
// Renders a portal segment.
|
||||
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
|
||||
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_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_BEGIN, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
|
||||
|
||||
// go to portal frame lmao
|
||||
HWR_PortalFrame(portal);
|
||||
// call HWR_RenderViewpoint
|
||||
HWR_RenderViewpoint(portal, fpov, player, stencil_level + 1, true);
|
||||
// return to current frame
|
||||
if (rootportal)
|
||||
HWR_PortalFrame(rootportal);
|
||||
else // current frame is not a portal frame but the main view!
|
||||
{
|
||||
R_SetupFrame(viewssnum, false);
|
||||
portalclipline = NULL;
|
||||
}
|
||||
|
||||
// remove portal seg from stencil buffer
|
||||
HWR_SetTransform(fpov, player);
|
||||
HWR_ClearClipper();
|
||||
|
||||
HWR_SetStencilState(HWR_STENCIL_REVERSE, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GLPORTAL_STENCIL);
|
||||
|
||||
// draw portal seg to depth buffer
|
||||
HWR_ClearClipper();
|
||||
HWR_SetStencilState(HWR_STENCIL_DEPTH, stencil_level);
|
||||
HWR_RenderPortalSeg(portal, GLPORTAL_DEPTH);
|
||||
}
|
||||
|
||||
// returns true if the point is on the correct (viewable) side of the
|
||||
// portal destination line
|
||||
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y)
|
||||
{
|
||||
// we are checking if the point is on the viewable side of the portal exit.
|
||||
// being exactly on the portal exit line is not enough to pass the test.
|
||||
// P_PointOnLineSide could behave differently from this expectation on this case,
|
||||
// so first check if the point is precisely on the line, and then if not, check the side.
|
||||
|
||||
vertex_t closest_point;
|
||||
P_ClosestPointOnLine(x, y, portalclipline, &closest_point);
|
||||
if (closest_point.x != x || closest_point.y != y)
|
||||
{
|
||||
if (P_PointOnLineSide(x, y, portalclipline) != 1)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord)
|
||||
{
|
||||
if (!portalclipline)
|
||||
return true;
|
||||
|
||||
if (HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXTOP]) ||
|
||||
HWR_PortalCheckPointSide(bspcoord[BOXLEFT], bspcoord[BOXBOTTOM]) ||
|
||||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXTOP]) ||
|
||||
HWR_PortalCheckPointSide(bspcoord[BOXRIGHT], bspcoord[BOXBOTTOM]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// we did not find any reason to pass the check, so return failure
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2018 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_portal.h
|
||||
/// \brief OpenGL renderer portal struct, functions, linked list extern.
|
||||
|
||||
#ifndef __HW_PORTAL__
|
||||
#define __HW_PORTAL__
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "../doomstat.h"
|
||||
#include "../r_data.h"
|
||||
#include "../r_bsp.h"
|
||||
|
||||
/** Portal structure.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
GLPORTAL_OFF,
|
||||
GLPORTAL_SEARCH,
|
||||
GLPORTAL_STENCIL,
|
||||
GLPORTAL_DEPTH,
|
||||
GLPORTAL_INSIDE,
|
||||
};
|
||||
|
||||
typedef struct gl_portal_s
|
||||
{
|
||||
struct gl_portal_s *next;
|
||||
|
||||
// Viewport.
|
||||
fixed_t viewx;
|
||||
fixed_t viewy;
|
||||
fixed_t viewz;
|
||||
angle_t viewangle;
|
||||
|
||||
seg_t *seg; // seg that is used for drawing to the stencil buffer
|
||||
INT32 clipline; // Optional clipline for line-based portals
|
||||
|
||||
// angles for the left and right edges of the portal
|
||||
// relative to the viewpoint
|
||||
angle_t angle1;
|
||||
angle_t angle2;
|
||||
} gl_portal_t;
|
||||
|
||||
typedef struct gl_portallist_s
|
||||
{
|
||||
gl_portal_t *base;
|
||||
gl_portal_t *cap;
|
||||
} gl_portallist_t;
|
||||
|
||||
extern SINT8 gl_portal_state;
|
||||
|
||||
// new thing
|
||||
extern gl_portallist_t *currentportallist;
|
||||
|
||||
static inline void HWR_SetPortalState (SINT8 state)
|
||||
{
|
||||
gl_portal_state = state;
|
||||
}
|
||||
|
||||
// Adds an entry to the clipper for portal rendering
|
||||
void HWR_PortalClipping(gl_portal_t *portal);
|
||||
|
||||
void HWR_Portal_Add2Lines(const INT32 line1, const INT32 line2, seg_t *seg);
|
||||
void HWR_PortalFrame(gl_portal_t* portal);
|
||||
void HWR_RenderPortal(gl_portal_t* portal, gl_portal_t* rootportal, const float fpov, player_t *player, int stencil_level);
|
||||
void HWR_FreePortalList(gl_portallist_t portallist);
|
||||
|
||||
boolean HWR_PortalCheckPointSide(fixed_t x, fixed_t y);
|
||||
boolean HWR_PortalCheckBBox(const fixed_t *bspcoord);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+14
-18
@@ -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"
|
||||
|
||||
@@ -25,13 +25,10 @@ static struct {
|
||||
const char *vertex;
|
||||
const char *fragment;
|
||||
} const gl_shadersources[] = {
|
||||
|
||||
|
||||
// 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},
|
||||
|
||||
@@ -52,7 +49,7 @@ static struct {
|
||||
|
||||
// Palette postprocess shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_PALETTE_POSTPROCESS_FRAGMENT_SHADER},
|
||||
|
||||
|
||||
// UI colormap fade shader
|
||||
{GLSL_DEFAULT_VERTEX_SHADER, GLSL_UI_COLORMAP_FADE_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++)
|
||||
@@ -279,11 +276,11 @@ static char *HWR_PreprocessShader(char *original)
|
||||
|
||||
// Calculate length of modified shader.
|
||||
new_len = original_len;
|
||||
|
||||
if (cv_grpaletterendering.value)
|
||||
|
||||
if (cv_glpaletterendering.value)
|
||||
ADD_TO_LEN(PALETTE_RENDERING_DEFINE)
|
||||
|
||||
if (cv_lightdither.value)
|
||||
if (cv_gllightdither.value)
|
||||
ADD_TO_LEN(LIGHT_DITHERING_DEFINE)
|
||||
|
||||
#undef ADD_TO_LEN
|
||||
@@ -324,10 +321,10 @@ static char *HWR_PreprocessShader(char *original)
|
||||
}
|
||||
|
||||
// Write the defines.
|
||||
if (cv_grpaletterendering.value)
|
||||
if (cv_glpaletterendering.value)
|
||||
WRITE_DEFINE(PALETTE_RENDERING_DEFINE)
|
||||
|
||||
if (cv_lightdither.value)
|
||||
if (cv_gllightdither.value)
|
||||
WRITE_DEFINE(LIGHT_DITHERING_DEFINE)
|
||||
|
||||
#undef WRITE_DEFINE
|
||||
@@ -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
|
||||
@@ -410,7 +407,7 @@ int HWR_GetShaderFromTarget(int shader_target)
|
||||
// - custom shaders are enabled
|
||||
// - custom shaders are allowed by the server
|
||||
if (custom_shader != -1 && gl_shaders[custom_shader].compiled &&
|
||||
cv_grshaders.value == 1)
|
||||
cv_glshaders.value == 1)
|
||||
return custom_shader;
|
||||
else
|
||||
return gl_shadertargets[shader_target].base_shader;
|
||||
@@ -432,7 +429,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},
|
||||
@@ -565,7 +561,7 @@ void HWR_LoadCustomShadersFromFile(UINT16 wadnum, boolean PK3)
|
||||
int i;
|
||||
boolean modified_shaders[NUMSHADERTARGETS] = {0};
|
||||
|
||||
if (!gr_shadersavailable)
|
||||
if (!gl_shadersavailable)
|
||||
return;
|
||||
|
||||
lump = HWR_FindShaderDefs(wadnum);
|
||||
|
||||
@@ -99,6 +99,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
|
||||
@@ -171,7 +172,7 @@
|
||||
"gl_FragColor = final_color;\n" \
|
||||
"}\n" \
|
||||
"#endif\0"
|
||||
|
||||
|
||||
#define GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL \
|
||||
"uniform sampler2D tex;\n" \
|
||||
"uniform vec4 poly_color;\n" \
|
||||
@@ -210,10 +211,6 @@
|
||||
#define GLSL_WALL_FRAGMENT_SHADER \
|
||||
GLSL_WALL_FUDGES \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER
|
||||
|
||||
#define GLSL_SHADOW_FRAGMENT_SHADER \
|
||||
GLSL_FLOOR_FUDGES \
|
||||
GLSL_SOFTWARE_FRAGMENT_SHADER_NOPAL
|
||||
|
||||
//
|
||||
// Water surface shader
|
||||
|
||||
@@ -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
|
||||
+449
-639
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
|
||||
@@ -98,18 +100,14 @@ typedef void (APIENTRY * PFNglGetIntegerv) (GLenum pname, GLint *params);
|
||||
extern PFNglGetIntegerv pglGetIntegerv;
|
||||
typedef const GLubyte* (APIENTRY * PFNglGetString) (GLenum name);
|
||||
extern PFNglGetString pglGetString;
|
||||
#if 0
|
||||
typedef void (APIENTRY * PFNglEnableClientState) (GLenum cap); // redefined in r_opengl.c
|
||||
static PFNglEnableClientState pglEnableClientState;
|
||||
#endif
|
||||
#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;
|
||||
@@ -123,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;
|
||||
|
||||
|
||||
+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;
|
||||
|
||||
+150
-277
@@ -49,6 +49,8 @@
|
||||
#include "s_sound.h" // song credits
|
||||
#include "k_kart.h"
|
||||
|
||||
#include "m_textinput.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h"
|
||||
#endif
|
||||
@@ -86,8 +88,8 @@ patch_t *frameslash; // framerate stuff. Used in screen.c
|
||||
|
||||
static player_t *plr;
|
||||
boolean chat_on; // entering a chat message?
|
||||
static char w_chat[HU_MAXMSGLEN + 1];
|
||||
static size_t c_input = 0; // let's try to make the chat input less shitty.
|
||||
static char w_chat_buf[HU_MAXMSGLEN + 1];
|
||||
static textinput_t w_chat;
|
||||
static boolean headsupactive = false;
|
||||
boolean hu_showscores; // draw rankings
|
||||
static char hu_tick;
|
||||
@@ -1001,7 +1003,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)
|
||||
@@ -1143,71 +1145,6 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum)
|
||||
#endif
|
||||
}
|
||||
|
||||
// Handles key input and string input
|
||||
//
|
||||
static inline boolean HU_keyInChatString(char *s, char ch)
|
||||
{
|
||||
size_t l;
|
||||
|
||||
if ((ch >= HU_FONTSTART && ch <= HU_FONTEND && hu_font[ch-HU_FONTSTART])
|
||||
|| ch == ' ') // Allow spaces, of course
|
||||
{
|
||||
l = strlen(s);
|
||||
if (l < HU_MAXMSGLEN - 1)
|
||||
{
|
||||
if (c_input >= strlen(s)) // don't do anything complicated
|
||||
{
|
||||
s[l++] = ch;
|
||||
s[l]=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// move everything past c_input for new characters:
|
||||
size_t m = HU_MAXMSGLEN-1;
|
||||
while (m>=c_input)
|
||||
{
|
||||
if (s[m])
|
||||
s[m+1] = (s[m]);
|
||||
if (m == 0) // prevent overflow
|
||||
break;
|
||||
m--;
|
||||
}
|
||||
s[c_input] = ch; // and replace this.
|
||||
}
|
||||
c_input++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (ch == KEY_BACKSPACE)
|
||||
{
|
||||
size_t i = c_input;
|
||||
|
||||
if (c_input <= 0)
|
||||
return false;
|
||||
|
||||
if (!s[i-1])
|
||||
return false;
|
||||
|
||||
if (i >= strlen(s)-1)
|
||||
{
|
||||
s[strlen(s)-1] = 0;
|
||||
c_input--;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (; (i < HU_MAXMSGLEN); i++)
|
||||
{
|
||||
s[i-1] = s[i];
|
||||
}
|
||||
c_input--;
|
||||
}
|
||||
else if (ch != KEY_ENTER)
|
||||
return false; // did not eat key
|
||||
|
||||
return true; // ate the key
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
@@ -1280,9 +1217,9 @@ static boolean HU_clearChatSpaces(void)
|
||||
char c; // current character we're iterating.
|
||||
boolean nothingbutspaces = true;
|
||||
|
||||
for (; i < strlen(w_chat); i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
for (; i < strlen(w_chat_buf); i++) // iterate through message and eradicate all spaces that don't belong.
|
||||
{
|
||||
c = w_chat[i];
|
||||
c = w_chat_buf[i];
|
||||
if (!c)
|
||||
break; // if there's nothing, it's safe to assume our message has ended, so let's not waste any more time here.
|
||||
|
||||
@@ -1294,128 +1231,110 @@ static boolean HU_clearChatSpaces(void)
|
||||
return nothingbutspaces;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
static void HU_queueChatChar(INT32 c)
|
||||
static void HU_SendChatMessage(void)
|
||||
{
|
||||
// send automaticly the message (no more chat char)
|
||||
if (c == KEY_ENTER)
|
||||
char buf[2 + HU_MAXMSGLEN + 1];
|
||||
char *msg = &buf[2];
|
||||
size_t ci = 2;
|
||||
INT32 target = 0;
|
||||
char c;
|
||||
|
||||
if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
|
||||
return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
|
||||
|
||||
do {
|
||||
c = w_chat_buf[-2+ci++];
|
||||
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
|
||||
buf[ci-1]=c;
|
||||
} while (c);
|
||||
|
||||
M_TextInputClear(&w_chat);
|
||||
|
||||
// last minute mute check
|
||||
if (CHAT_MUTE)
|
||||
{
|
||||
char buf[2 + HU_MAXMSGLEN + 1];
|
||||
char *msg = &buf[2];
|
||||
size_t i;
|
||||
size_t ci = 2;
|
||||
INT32 target = 0;
|
||||
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (HU_clearChatSpaces()) // Avoids being able to send empty messages, or something.
|
||||
return; // If this returns true, that means our message was NOTHING but spaces, so don't send it period.
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
{
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
const char *newmsg;
|
||||
|
||||
do {
|
||||
c = w_chat[-2+ci++];
|
||||
if (!c || (c >= ' ' && !(c & 0x80))) // copy printable characters and terminating '\0' only.
|
||||
buf[ci-1]=c;
|
||||
} while (c);
|
||||
i = 0;
|
||||
for (;(i<HU_MAXMSGLEN);i++)
|
||||
w_chat[i] = 0; // reset this.
|
||||
// what we're gonna do now is check if the node exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
|
||||
c_input = 0;
|
||||
|
||||
for (;(i<HU_MAXMSGLEN);i++)
|
||||
w_chat[i] = 0; // reset this.
|
||||
|
||||
c_input = 0;
|
||||
|
||||
// last minute mute check
|
||||
if (CHAT_MUTE)
|
||||
// teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko.
|
||||
if (teamtalk)
|
||||
{
|
||||
HU_AddChatText(va("%s>ERROR: The chat is muted. You can't say anything.", "\x85"), false);
|
||||
HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85"), false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strlen(msg) > 4 && strnicmp(msg, "/pm", 3) == 0) // used /pm
|
||||
memcpy(nodenum, msg+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
{
|
||||
INT32 spc = 1; // used if nodenum[1] is a space.
|
||||
char *nodenum = (char*) malloc(3);
|
||||
const char *newmsg;
|
||||
|
||||
// what we're gonna do now is check if the node exists
|
||||
// with that logic, characters 4 and 5 are our numbers:
|
||||
|
||||
// teamtalk can't send PMs, just don't send it, else everyone would be able to see it, and no one wants to see your sex RP sicko.
|
||||
if (teamtalk)
|
||||
{
|
||||
HU_AddChatText(va("%sCannot send sayto in Say-Team.", "\x85"), false);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(nodenum, msg+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
|
||||
// check for undesirable characters in our "number"
|
||||
if (((nodenum[0] < '0') || (nodenum[0] > '9')) || ((nodenum[1] < '0') || (nodenum[1] > '9')))
|
||||
{
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
spc = 0;
|
||||
// let it slide
|
||||
else
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// I'm very bad at C, I swear I am, additional checks eww!
|
||||
if (spc != 0)
|
||||
{
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
if (target < MAXPLAYERS && playeringame[target]) // player exists
|
||||
target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
|
||||
// check if nodenum[1] is a space
|
||||
if (nodenum[1] == ' ')
|
||||
spc = 0;
|
||||
// let it slide
|
||||
else
|
||||
{
|
||||
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
|
||||
// we need to get rid of the /pm<node>
|
||||
newmsg = msg+5+spc;
|
||||
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
|
||||
}
|
||||
if (ci > 3) // don't send target+flags+empty message.
|
||||
// I'm very bad at C, I swear I am, additional checks eww!
|
||||
if (spc != 0)
|
||||
{
|
||||
if (teamtalk)
|
||||
buf[0] = -1; // target
|
||||
else
|
||||
buf[0] = target;
|
||||
|
||||
buf[1] = 0; // flags
|
||||
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
||||
if (msg[5] != ' ')
|
||||
{
|
||||
HU_AddChatText("\x82NOTICE: \x80Invalid command format. Correct format is \'/pm<node> \'.", false);
|
||||
free(nodenum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
target = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
//CONS_Printf("%d\n", target);
|
||||
|
||||
// check for target player, if it doesn't exist then we can't send the message!
|
||||
if (target < MAXPLAYERS && playeringame[target]) // player exists
|
||||
target++; // even though playernums are from 0 to 31, target is 1 to 32, so up that by 1 to have it work!
|
||||
else
|
||||
{
|
||||
HU_AddChatText(va("\x82NOTICE: \x80Player %d does not exist.", target), false); // same
|
||||
return;
|
||||
}
|
||||
|
||||
// we need to get rid of the /pm<node>
|
||||
newmsg = msg+5+spc;
|
||||
strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
|
||||
}
|
||||
if (ci > 3) // don't send target+flags+empty message.
|
||||
{
|
||||
if (teamtalk)
|
||||
buf[0] = -1; // target
|
||||
else
|
||||
buf[0] = target;
|
||||
|
||||
buf[1] = 0; // flags
|
||||
SendNetXCmd(XD_SAY, buf, 2 + strlen(&buf[2]) + 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void HU_clearChatChars(void)
|
||||
{
|
||||
size_t i = 0;
|
||||
for (;i<HU_MAXMSGLEN;i++)
|
||||
w_chat[i] = 0; // reset this.
|
||||
M_TextInputClear(&w_chat);
|
||||
chat_on = false;
|
||||
c_input = 0;
|
||||
}
|
||||
|
||||
#ifndef NONET
|
||||
@@ -1463,7 +1382,8 @@ boolean HU_Responder(event_t *ev)
|
||||
&& netgame && !OLD_MUTE) // check for old chat mute, still let the players open the chat incase they want to scroll otherwise.
|
||||
{
|
||||
chat_on = true;
|
||||
w_chat[0] = 0;
|
||||
w_chat_buf[0] = 0;
|
||||
M_TextInputInit(&w_chat, w_chat_buf, sizeof w_chat_buf);
|
||||
teamtalk = false;
|
||||
chat_scrollmedown = true;
|
||||
typelines = 1;
|
||||
@@ -1473,7 +1393,8 @@ boolean HU_Responder(event_t *ev)
|
||||
&& netgame && !OLD_MUTE)
|
||||
{
|
||||
chat_on = true;
|
||||
w_chat[0] = 0;
|
||||
w_chat_buf[0] = 0;
|
||||
M_TextInputInit(&w_chat, w_chat_buf, sizeof w_chat_buf);
|
||||
teamtalk = G_GametypeHasTeams(); // Don't teamtalk if we don't have teams.
|
||||
chat_scrollmedown = true;
|
||||
typelines = 1;
|
||||
@@ -1498,62 +1419,13 @@ boolean HU_Responder(event_t *ev)
|
||||
&& ev->data1 != gamecontrol[gc_talkkey][1]))
|
||||
return false;
|
||||
|
||||
c = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(c) : CON_ShiftChar(c);
|
||||
M_TextInputHandle(&w_chat, c);
|
||||
|
||||
// pasting. pasting is cool. chat is a bit limited, though :(
|
||||
if (((c == 'v' || c == 'V') && ctrldown) && !CHAT_MUTE)
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
size_t chatlen;
|
||||
size_t pastelen;
|
||||
|
||||
// create a dummy string real quickly
|
||||
|
||||
if (paste == NULL)
|
||||
return true;
|
||||
|
||||
chatlen = strlen(w_chat);
|
||||
pastelen = strlen(paste);
|
||||
if (chatlen+pastelen > HU_MAXMSGLEN)
|
||||
return true; // we can't paste this!!
|
||||
|
||||
if (c_input >= strlen(w_chat)) // add it at the end of the string.
|
||||
{
|
||||
memcpy(&w_chat[chatlen], paste, pastelen); // copy all of that.
|
||||
c_input += pastelen;
|
||||
/*size_t i = 0;
|
||||
for (;i<pastelen;i++)
|
||||
{
|
||||
HU_queueChatChar(paste[i]); // queue it so that it's actually sent. (this chat write thing is REALLY messy.)
|
||||
}*/
|
||||
return true;
|
||||
}
|
||||
else // otherwise, we need to shift everything and make space, etc etc
|
||||
{
|
||||
size_t i = HU_MAXMSGLEN-1;
|
||||
while (i >= c_input)
|
||||
{
|
||||
if (w_chat[i])
|
||||
w_chat[i+pastelen] = w_chat[i];
|
||||
if (i == 0) // prevent overflow
|
||||
break;
|
||||
i--;
|
||||
}
|
||||
memcpy(&w_chat[c_input], paste, pastelen); // copy all of that.
|
||||
c_input += pastelen;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!CHAT_MUTE && HU_keyInChatString(w_chat,c))
|
||||
{
|
||||
HU_queueChatChar(c);
|
||||
}
|
||||
if (c == KEY_ENTER)
|
||||
{
|
||||
chat_on = false;
|
||||
c_input = 0; // reset input cursor
|
||||
chat_scrollmedown = true; // you hit enter, so you might wanna autoscroll to see what you just sent. :)
|
||||
HU_SendChatMessage();
|
||||
}
|
||||
else if (c == KEY_ESCAPE
|
||||
|| ((c == gamecontrol[gc_talkkey][0] || c == gamecontrol[gc_talkkey][1]
|
||||
@@ -1561,7 +1433,6 @@ boolean HU_Responder(event_t *ev)
|
||||
&& c >= KEY_MOUSE1)) // If it's not a keyboard key, then the chat button is used as a toggle.
|
||||
{
|
||||
chat_on = false;
|
||||
c_input = 0; // reset input cursor
|
||||
}
|
||||
else if ((c == KEY_UPARROW || c == KEY_MOUSEWHEELUP) && chat_scroll > 0 && !OLDCHAT) // CHAT SCROLLING YAYS!
|
||||
{
|
||||
@@ -1575,10 +1446,6 @@ boolean HU_Responder(event_t *ev)
|
||||
justscrolleddown = true;
|
||||
chat_scrolltime = 4;
|
||||
}
|
||||
else if (c == KEY_LEFTARROW && c_input != 0 && !OLDCHAT) // i said go back
|
||||
c_input--;
|
||||
else if (c == KEY_RIGHTARROW && c_input < strlen(w_chat) && !OLDCHAT) // don't need to check for admin or w/e here since the chat won't ever contain anything if it's muted.
|
||||
c_input++;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@@ -1932,8 +1799,9 @@ static void HU_DrawChat(void)
|
||||
INT32 charwidth = 4, charheight = 6;
|
||||
INT32 boxw = cv_chatwidth.value;
|
||||
INT32 t = 0, c = 0, y = chaty - (typelines*charheight);
|
||||
UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday!
|
||||
UINT32 i = 0, saylen = strlen(w_chat_buf); // You learn new things everyday!
|
||||
INT32 cflag = 0;
|
||||
size_t select_start = 0, select_end = 0;
|
||||
const char *ntalk = "Say: ", *ttalk = "Team: ";
|
||||
const char *talk = ntalk;
|
||||
const char *mute = "Chat has been muted.";
|
||||
@@ -1995,13 +1863,19 @@ static void HU_DrawChat(void)
|
||||
i = 0;
|
||||
typelines = 1;
|
||||
|
||||
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
|
||||
V_DrawChatCharacter(chatx + 2 + c, y+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
||||
if ((w_chat.cursor == 0 || w_chat.length == 0) && hu_tick < 4)
|
||||
V_DrawChatCharacter(chatx+2+c+charwidth*w_chat.cursor, y+1, '_'|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL);
|
||||
|
||||
while (w_chat[i])
|
||||
if (w_chat.select != w_chat.cursor)
|
||||
{
|
||||
select_start = min(w_chat.select, w_chat.cursor);
|
||||
select_end = max(w_chat.select, w_chat.cursor);
|
||||
}
|
||||
|
||||
while (w_chat_buf[i])
|
||||
{
|
||||
boolean skippedline = false;
|
||||
if (c_input == (i+1))
|
||||
if (w_chat.cursor == (i+1))
|
||||
{
|
||||
INT32 cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down.
|
||||
INT32 cursory = (cursorx != chatx+1) ? (y) : (y+charheight);
|
||||
@@ -2016,10 +1890,14 @@ static void HU_DrawChat(void)
|
||||
}
|
||||
|
||||
//Hurdler: isn't it better like that?
|
||||
if (w_chat[i] < HU_FONTSTART)
|
||||
++i;
|
||||
else
|
||||
V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL);
|
||||
if (w_chat_buf[i] >= HU_FONTSTART)
|
||||
V_DrawChatCharacter(chatx + c + 2, y, w_chat_buf[i] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL);
|
||||
|
||||
// Draw selection
|
||||
if (i >= select_start && i < select_end)
|
||||
V_DrawFill(chatx + c + 2, y-1, charwidth, charheight, 103|V_TRANSLUCENT|V_SNAPTOBOTTOM|V_SNAPTOLEFT|t);
|
||||
|
||||
++i;
|
||||
|
||||
c += charwidth;
|
||||
if (c > boxw-(charwidth*2) && !skippedline)
|
||||
@@ -2031,7 +1909,7 @@ static void HU_DrawChat(void)
|
||||
}
|
||||
|
||||
// handle /pm list. It's messy, horrible and I don't care.
|
||||
if (strnicmp(w_chat, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
|
||||
if (strnicmp(w_chat_buf, "/pm", 3) == 0 && vid.width >= 400 && !teamtalk) // 320x200 unsupported kthxbai
|
||||
{
|
||||
INT32 count = 0;
|
||||
INT32 p_dispy = chaty - charheight -1;
|
||||
@@ -2051,38 +1929,38 @@ static void HU_DrawChat(void)
|
||||
{
|
||||
|
||||
// filter: (code needs optimization pls help I'm bad with C)
|
||||
if (w_chat[3])
|
||||
if (w_chat_buf[3])
|
||||
{
|
||||
char *nodenum;
|
||||
UINT32 n;
|
||||
// right, that's half important: (w_chat[4] may be a space since /pm0 msg is perfectly acceptable!)
|
||||
if ( ( ((w_chat[3] != 0) && ((w_chat[3] < '0') || (w_chat[3] > '9'))) || ((w_chat[4] != 0) && (((w_chat[4] < '0') || (w_chat[4] > '9'))))) && (w_chat[4] != ' '))
|
||||
// right, that's half important: (w_chat_buf[4] may be a space since /pm0 msg is perfectly acceptable!)
|
||||
if ( ( ((w_chat_buf[3] != 0) && ((w_chat_buf[3] < '0') || (w_chat_buf[3] > '9'))) || ((w_chat_buf[4] != 0) && (((w_chat_buf[4] < '0') || (w_chat_buf[4] > '9'))))) && (w_chat_buf[4] != ' '))
|
||||
break;
|
||||
|
||||
|
||||
nodenum = (char*) malloc(3);
|
||||
memcpy(nodenum, w_chat+3, 2);
|
||||
memcpy(nodenum, w_chat_buf+3, 2);
|
||||
nodenum[2] = '\0';
|
||||
n = atoi((const char*) nodenum); // turn that into a number
|
||||
free(nodenum);
|
||||
// special cases:
|
||||
|
||||
if ((n == 0) && !(w_chat[4] == '0'))
|
||||
if ((n == 0) && !(w_chat_buf[4] == '0'))
|
||||
{
|
||||
if (!(i<10))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 1) && !(w_chat[3] == '0'))
|
||||
else if ((n == 1) && !(w_chat_buf[3] == '0'))
|
||||
{
|
||||
if (!((i == 1) || ((i >= 10) && (i <= 19))))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 2) && !(w_chat[3] == '0'))
|
||||
else if ((n == 2) && !(w_chat_buf[3] == '0'))
|
||||
{
|
||||
if (!((i == 2) || ((i >= 20) && (i <= 29))))
|
||||
continue;
|
||||
}
|
||||
else if ((n == 3) && !(w_chat[3] == '0'))
|
||||
else if ((n == 3) && !(w_chat_buf[3] == '0'))
|
||||
{
|
||||
if (!((i == 3) || ((i >= 30) && (i <= 31))))
|
||||
continue;
|
||||
@@ -2121,6 +1999,7 @@ static void HU_DrawChat_Old(void)
|
||||
size_t i = 0;
|
||||
const char *ntalk = "Say: ", *ttalk = "Say-Team: ";
|
||||
const char *talk = ntalk;
|
||||
size_t select_start = 0, select_end = 0;
|
||||
INT32 charwidth = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->width) * con_scalefactor;
|
||||
INT32 charheight = 8 * con_scalefactor; //SHORT(hu_font['A'-HU_FONTSTART]->height) * con_scalefactor;
|
||||
if (teamtalk)
|
||||
@@ -2149,14 +2028,19 @@ static void HU_DrawChat_Old(void)
|
||||
c += charwidth;
|
||||
}
|
||||
|
||||
if ((strlen(w_chat) == 0 || c_input == 0) && hu_tick < 4)
|
||||
V_DrawCharacter(HU_INPUTX+c, y+2*con_scalefactor, '_' |cv_constextsize.value | V_NOSCALESTART|t, !cv_allcaps.value);
|
||||
if ((w_chat.cursor == 0 || w_chat.length == 0) && hu_tick < 4)
|
||||
V_DrawCharacter(HU_INPUTX+c+charwidth*w_chat.cursor, y+2*con_scalefactor, '_'|cv_constextsize.value|V_NOSCALESTART|t, !cv_allcaps.value);
|
||||
|
||||
if (w_chat.select != w_chat.cursor)
|
||||
{
|
||||
select_start = min(w_chat.select, w_chat.cursor);
|
||||
select_end = max(w_chat.select, w_chat.cursor);
|
||||
}
|
||||
|
||||
i = 0;
|
||||
while (w_chat[i])
|
||||
while (w_chat_buf[i])
|
||||
{
|
||||
|
||||
if (c_input == (i+1) && hu_tick < 4)
|
||||
if (w_chat.cursor == (i+1) && hu_tick < 4)
|
||||
{
|
||||
INT32 cursorx = (HU_INPUTX+c+charwidth < vid.width) ? (HU_INPUTX + c + charwidth) : (HU_INPUTX); // we may have to go down.
|
||||
INT32 cursory = (cursorx != HU_INPUTX) ? (y) : (y+charheight);
|
||||
@@ -2164,17 +2048,18 @@ static void HU_DrawChat_Old(void)
|
||||
}
|
||||
|
||||
//Hurdler: isn't it better like that?
|
||||
if (w_chat[i] < HU_FONTSTART)
|
||||
{
|
||||
++i;
|
||||
//charwidth = 4 * con_scalefactor;
|
||||
}
|
||||
else
|
||||
if (w_chat_buf[i] >= HU_FONTSTART)
|
||||
{
|
||||
//charwidth = SHORT(hu_font[w_chat[i]-HU_FONTSTART]->width) * con_scalefactor;
|
||||
V_DrawCharacter(HU_INPUTX + c, y, w_chat[i++] | cv_constextsize.value | V_NOSCALESTART | t, !cv_allcaps.value);
|
||||
V_DrawCharacter(HU_INPUTX + c, y, w_chat_buf[i] | cv_constextsize.value | V_NOSCALESTART | t, !cv_allcaps.value);
|
||||
}
|
||||
|
||||
// Draw selection
|
||||
if (i >= select_start && i < select_end)
|
||||
V_DrawFill(HU_INPUTX + c, y, charwidth, charheight, 103|V_TRANSLUCENT|cv_constextsize.value|V_NOSCALESTART|t);
|
||||
|
||||
++i;
|
||||
|
||||
c += charwidth;
|
||||
if (c >= vid.width)
|
||||
{
|
||||
@@ -2389,7 +2274,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);
|
||||
@@ -2732,7 +2617,8 @@ static void HU_DrawRankings(void)
|
||||
boolean completed[MAXPLAYERS];
|
||||
UINT32 whiteplayer = MAXPLAYERS;
|
||||
|
||||
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
|
||||
if (!automapactive)
|
||||
V_DrawFadeScreen(0xFF00, 16); // A little more readable, and prevents cheating the fades under other circumstances.
|
||||
|
||||
if (cons_menuhighlight.value)
|
||||
hilicol = cons_menuhighlight.value;
|
||||
@@ -2748,10 +2634,14 @@ static void HU_DrawRankings(void)
|
||||
//V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, gametype_cons_t[gametype].strvalue);
|
||||
|
||||
// draw the current map in the lower right if theres none just say its unknown
|
||||
if (!G_BuildMapTitle(gamemap))
|
||||
char *maptitle = G_BuildMapTitle(gamemap);
|
||||
if (!maptitle)
|
||||
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, "UNKNOWN");
|
||||
else
|
||||
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, G_BuildMapTitle(gamemap));
|
||||
{
|
||||
V_DrawString(4, 188, hilicol|V_SNAPTOBOTTOM|V_SNAPTOLEFT, maptitle);
|
||||
Z_Free(maptitle);
|
||||
}
|
||||
|
||||
if (G_GametypeHasTeams())
|
||||
{
|
||||
@@ -2801,18 +2691,6 @@ static void HU_DrawRankings(void)
|
||||
V_DrawCenteredString(256, 16, hilicol, va("%d", cv_pointlimit.value));
|
||||
}
|
||||
}
|
||||
/*else if (gametype == GT_COOP)
|
||||
{
|
||||
INT32 totalscore = 0;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playeringame[i])
|
||||
totalscore += players[i].score;
|
||||
}
|
||||
|
||||
V_DrawCenteredString(256, 8, 0, "TOTAL SCORE");
|
||||
V_DrawCenteredString(256, 16, 0, va("%u", totalscore));
|
||||
}*/
|
||||
else
|
||||
{
|
||||
if (circuitmap)
|
||||
@@ -2885,12 +2763,7 @@ static void HU_DrawRankings(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*if (G_GametypeHasTeams())
|
||||
HU_DrawTeamTabRankings(tab, whiteplayer); //separate function for Spazzo's silly request -- gotta fix this up later
|
||||
else if (scorelines > 10)*/
|
||||
HU_DrawTabRankings(((scorelines > 8) ? 32 : 40), 33, tab, scorelines, whiteplayer, hilicol);
|
||||
/*else
|
||||
HU_DrawDualTabRankings(32, 32, tab, scorelines, whiteplayer);*/
|
||||
|
||||
// draw spectators in a ticker across the bottom
|
||||
if (netgame && G_GametypeHasSpectators())
|
||||
|
||||
+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
|
||||
|
||||
+7
-15
@@ -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
|
||||
*/
|
||||
@@ -307,21 +311,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);
|
||||
void I_GetJoystickEvents(UINT8 index);
|
||||
|
||||
/** \brief Mouses events
|
||||
*/
|
||||
|
||||
+28
-78
@@ -100,6 +100,14 @@
|
||||
#undef ETIMEDOUT
|
||||
#endif
|
||||
#define ETIMEDOUT WSAETIMEDOUT
|
||||
#ifdef EHOSTUNREACH
|
||||
#undef EHOSTUNREACH
|
||||
#endif
|
||||
#define EHOSTUNREACH WSAEHOSTUNREACH
|
||||
#ifdef ENETUNREACH
|
||||
#undef ENETUNREACH
|
||||
#endif
|
||||
#define ENETUNREACH WSAENETUNREACH
|
||||
#ifndef IOC_VENDOR
|
||||
#define IOC_VENDOR 0x18000000
|
||||
#endif
|
||||
@@ -160,7 +168,6 @@ static UINT8 UPNP_support = TRUE;
|
||||
#endif
|
||||
|
||||
#include "i_addrinfo.h"
|
||||
#define SELECTTEST
|
||||
|
||||
#define DEFAULTPORT "5029"
|
||||
|
||||
@@ -742,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)
|
||||
{
|
||||
@@ -816,6 +770,8 @@ static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr
|
||||
return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d);
|
||||
}
|
||||
|
||||
#define ALLOWEDERROR(x) ((x) == ECONNREFUSED || (x) == EWOULDBLOCK || (x) == EHOSTUNREACH || (x) == ENETUNREACH)
|
||||
|
||||
static void SOCK_Send(void)
|
||||
{
|
||||
ssize_t c = ERRSOCKET;
|
||||
@@ -831,7 +787,11 @@ static void SOCK_Send(void)
|
||||
for (j = 0; j < broadcastaddresses; j++)
|
||||
{
|
||||
if (myfamily[i] == broadcastaddress[j].any.sa_family)
|
||||
SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
|
||||
{
|
||||
c = SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]);
|
||||
if (c == ERRSOCKET && !ALLOWEDERROR(errno))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -841,7 +801,11 @@ static void SOCK_Send(void)
|
||||
for (i = 0; i < mysocketses; i++)
|
||||
{
|
||||
if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family)
|
||||
SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
|
||||
{
|
||||
c = SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]);
|
||||
if (c == ERRSOCKET && !ALLOWEDERROR(errno))
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -853,12 +817,13 @@ static void SOCK_Send(void)
|
||||
if (c == ERRSOCKET)
|
||||
{
|
||||
int e = errno; // save error code so it can't be modified later
|
||||
if (e != ECONNREFUSED && e != EWOULDBLOCK)
|
||||
if (!ALLOWEDERROR(e))
|
||||
I_Error("SOCK_Send, error sending to node %d (%s) #%u: %s", doomcom->remotenode,
|
||||
SOCK_GetNodeAddress(doomcom->remotenode), e, strerror(e));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#undef ALLOWEDERROR
|
||||
#endif //NONET
|
||||
|
||||
#ifndef NONET
|
||||
static void SOCK_FreeNodenum(INT32 numnode)
|
||||
@@ -1010,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));
|
||||
@@ -1037,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++;
|
||||
}
|
||||
@@ -1058,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
|
||||
@@ -1091,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++;
|
||||
}
|
||||
@@ -1112,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++;
|
||||
}
|
||||
@@ -1279,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
|
||||
|
||||
@@ -1398,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);
|
||||
}
|
||||
|
||||
@@ -1425,7 +1382,6 @@ static void SOCK_RegisterHolePunch(void)
|
||||
rendezvous(4);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static boolean SOCK_OpenSocket(void)
|
||||
@@ -1445,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
|
||||
|
||||
+3
-3
@@ -139,13 +139,13 @@ 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);
|
||||
boolean UseScreenFBO(void);
|
||||
extern boolean downsample;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+122
-79
@@ -12,21 +12,27 @@
|
||||
|
||||
//#include "k_kart.h"
|
||||
#include "doomdef.h"
|
||||
#include "doomstat.h"
|
||||
#include "g_game.h"
|
||||
#include "v_video.h"
|
||||
#include "k_director.h"
|
||||
#include "d_netcmd.h"
|
||||
#include "p_local.h"
|
||||
#include "st_stuff.h"
|
||||
|
||||
#include "r_fps.h"
|
||||
|
||||
#define SWITCHTIME TICRATE * 5 // cooldown between unforced switches
|
||||
#define BOREDOMTIME 3 * TICRATE / 2 // how long until players considered far apart?
|
||||
#define TRANSFERTIME TICRATE // how long to delay reaction shots?
|
||||
#define BREAKAWAYDIST 2000 // how *far* until players considered far apart?
|
||||
#define WALKBACKDIST 600 // how close should a trailing player be before we switch?
|
||||
#define WALKBACKDIST 400 // how close should a trailing player be before we switch?
|
||||
#define PINCHDIST 20000 // how close should the leader be to be considered "end of race"?
|
||||
|
||||
struct directorinfo
|
||||
{
|
||||
UINT8 viewnum;
|
||||
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
|
||||
@@ -37,6 +43,27 @@ struct directorinfo
|
||||
INT32 boredom[MAXPLAYERS]; // how long has a given position had no credible attackers?
|
||||
} directorinfo;
|
||||
|
||||
struct directorinfo directorinfosplit[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
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;
|
||||
@@ -47,25 +74,38 @@ static fixed_t ScaleFromMap(fixed_t n, fixed_t scale)
|
||||
return FixedMul(n, FixedDiv(scale, mapobjectscale));
|
||||
}
|
||||
|
||||
static boolean K_DirectorIsEnabled(void)
|
||||
boolean K_DirectorIsAvailable(UINT8 viewnum)
|
||||
{
|
||||
return cv_director.value && !splitscreen && (gamestate == GS_LEVEL && (!playeringame[consoleplayer] || players[consoleplayer].spectator || (demo.playback && (!demo.title || !modeattacking))));
|
||||
if ((demo.playback && demo.title) || modeattacking)
|
||||
return false;
|
||||
return ((gamestate == GS_LEVEL) && (viewnum <= splitscreen) && (demo.playback || (players[g_localplayers[viewnum]].spectator && !K_DirectorIsPlayerAlone())));
|
||||
}
|
||||
|
||||
static boolean K_DirectorIsEnabled(const UINT8 viewnum)
|
||||
{
|
||||
return (cv_director[viewnum].value && K_DirectorIsAvailable(viewnum));
|
||||
}
|
||||
|
||||
void K_InitDirector(void)
|
||||
{
|
||||
INT32 playernum;
|
||||
|
||||
directorinfo.cooldown = SWITCHTIME;
|
||||
directorinfo.freeze = 0;
|
||||
directorinfo.attacker = 0;
|
||||
directorinfo.maxdist = 0;
|
||||
directorinfo.viewnum = 0;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
for (UINT8 i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
directorinfo.sortedplayers[playernum] = -1;
|
||||
directorinfo.gap[playernum] = INT32_MAX;
|
||||
directorinfo.boredom[playernum] = 0;
|
||||
directorinfosplit[i].cooldown = SWITCHTIME;
|
||||
directorinfosplit[i].freeze = 0;
|
||||
directorinfosplit[i].attacker = 0;
|
||||
directorinfosplit[i].maxdist = 0;
|
||||
directorinfosplit[i].viewplayer = NULL;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
directorinfosplit[i].sortedplayers[playernum] = -1;
|
||||
directorinfosplit[i].gap[playernum] = INT32_MAX;
|
||||
directorinfosplit[i].boredom[playernum] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +124,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;
|
||||
}
|
||||
@@ -104,7 +144,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;
|
||||
}
|
||||
@@ -128,13 +168,13 @@ static fixed_t K_GetFinishGap(INT32 leader, INT32 follower)
|
||||
}
|
||||
}
|
||||
|
||||
static void K_UpdateDirectorPositions(void)
|
||||
static void K_UpdateDirectorPositions(const UINT8 viewnum)
|
||||
{
|
||||
INT32 playernum;
|
||||
INT32 position;
|
||||
player_t* target;
|
||||
|
||||
memset(directorinfo.sortedplayers, -1, sizeof(directorinfo.sortedplayers));
|
||||
memset(directorinfosplit[viewnum].sortedplayers, -1, sizeof(directorinfo.sortedplayers));
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; playernum++)
|
||||
{
|
||||
@@ -142,43 +182,43 @@ static void K_UpdateDirectorPositions(void)
|
||||
|
||||
if (playeringame[playernum] && !target->spectator && target->kartstuff[k_position] > 0)
|
||||
{
|
||||
directorinfo.sortedplayers[target->kartstuff[k_position] - 1] = playernum;
|
||||
directorinfosplit[viewnum].sortedplayers[target->kartstuff[k_position] - 1] = playernum;
|
||||
}
|
||||
}
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
directorinfo.gap[position] = INT32_MAX;
|
||||
directorinfosplit[viewnum].gap[position] = INT32_MAX;
|
||||
|
||||
if (directorinfo.sortedplayers[position] == -1 || directorinfo.sortedplayers[position + 1] == -1)
|
||||
if (directorinfosplit[viewnum].sortedplayers[position] == -1 || directorinfosplit[viewnum].sortedplayers[position + 1] == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
directorinfo.gap[position] = ScaleFromMap(K_GetFinishGap(directorinfo.sortedplayers[position], directorinfo.sortedplayers[position + 1]), FRACUNIT);
|
||||
directorinfosplit[viewnum].gap[position] = ScaleFromMap(K_GetFinishGap(directorinfosplit[viewnum].sortedplayers[position], directorinfosplit[viewnum].sortedplayers[position + 1]), FRACUNIT);
|
||||
|
||||
if (directorinfo.gap[position] >= BREAKAWAYDIST)
|
||||
if (directorinfosplit[viewnum].gap[position] >= BREAKAWAYDIST)
|
||||
{
|
||||
directorinfo.boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfo.boredom[position] + 1));
|
||||
directorinfosplit[viewnum].boredom[position] = (INT32)(min(BOREDOMTIME * 2, directorinfosplit[viewnum].boredom[position] + 1));
|
||||
}
|
||||
else if (directorinfo.boredom[position] > 0)
|
||||
else if (directorinfosplit[viewnum].boredom[position] > 0)
|
||||
{
|
||||
directorinfo.boredom[position]--;
|
||||
directorinfosplit[viewnum].boredom[position]--;
|
||||
}
|
||||
}
|
||||
|
||||
if (directorinfo.sortedplayers[0] == -1)
|
||||
if (directorinfosplit[viewnum].sortedplayers[0] == -1)
|
||||
{
|
||||
directorinfo.maxdist = -1;
|
||||
directorinfosplit[viewnum].maxdist = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfo.maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfo.sortedplayers[0]]), FRACUNIT);
|
||||
directorinfosplit[viewnum].maxdist = ScaleFromMap(K_GetDistanceToFinish(players[directorinfosplit[viewnum].sortedplayers[0]]), FRACUNIT);
|
||||
}
|
||||
|
||||
static boolean K_CanSwitchDirector(void)
|
||||
static boolean K_CanSwitchDirector(const UINT8 viewnum)
|
||||
{
|
||||
if (directorinfo.cooldown > 0)
|
||||
if (directorinfosplit[viewnum].cooldown > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -186,14 +226,9 @@ static boolean K_CanSwitchDirector(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void K_DirectorSwitch(INT32 player, boolean force)
|
||||
static void K_DirectorSwitch(INT32 player, boolean force, const UINT8 viewnum)
|
||||
{
|
||||
if (!K_DirectorIsEnabled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (P_IsDisplayPlayer(&players[player]))
|
||||
if (!K_DirectorIsEnabled(viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -203,45 +238,45 @@ static void K_DirectorSwitch(INT32 player, boolean force)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!force && !K_CanSwitchDirector())
|
||||
if (!force && !K_CanSwitchDirector(viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
G_ResetView(1, player, true);
|
||||
directorinfo.cooldown = SWITCHTIME;
|
||||
G_ResetView(viewnum+1, player, true);
|
||||
directorinfosplit[viewnum].cooldown = SWITCHTIME;
|
||||
}
|
||||
|
||||
static void K_DirectorForceSwitch(INT32 player, INT32 time)
|
||||
static void K_DirectorForceSwitch(INT32 player, INT32 time, const UINT8 viewnum)
|
||||
{
|
||||
if (players[player].exiting)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
directorinfo.attacker = player;
|
||||
directorinfo.freeze = time;
|
||||
directorinfosplit[viewnum].attacker = player;
|
||||
directorinfosplit[viewnum].freeze = time;
|
||||
}
|
||||
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
if (!K_DirectorIsEnabled())
|
||||
if (!K_DirectorIsEnabled(directorinfo.viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!P_IsDisplayPlayer(player))
|
||||
if (directorinfosplit[directorinfo.viewnum].viewplayer != player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (inflictor && inflictor->player)
|
||||
{
|
||||
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME);
|
||||
K_DirectorForceSwitch(inflictor->player - players, TRANSFERTIME, directorinfo.viewnum);
|
||||
}
|
||||
else if (source && source->player)
|
||||
{
|
||||
K_DirectorForceSwitch(source->player - players, TRANSFERTIME);
|
||||
K_DirectorForceSwitch(source->player - players, TRANSFERTIME, directorinfo.viewnum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,14 +296,14 @@ void K_DrawDirectorDebugger(void)
|
||||
V_DrawThinString(40, 0, V_70TRANS, va("CONF?"));
|
||||
V_DrawThinString(80, 0, V_70TRANS, va("GAP"));
|
||||
V_DrawThinString(120, 0, V_70TRANS, va("BORED"));
|
||||
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfo.cooldown));
|
||||
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfo.maxdist));
|
||||
V_DrawThinString(150, 0, V_70TRANS, va("COOLDOWN: %d", directorinfosplit[0].cooldown));
|
||||
V_DrawThinString(230, 0, V_70TRANS, va("MAXDIST: %d", directorinfosplit[0].maxdist));
|
||||
|
||||
for (position = 0; position < MAXPLAYERS - 1; position++)
|
||||
{
|
||||
ytxt = 10 * (position + 1);
|
||||
leader = directorinfo.sortedplayers[position];
|
||||
follower = directorinfo.sortedplayers[position + 1];
|
||||
leader = directorinfosplit[0].sortedplayers[position];
|
||||
follower = directorinfosplit[0].sortedplayers[position + 1];
|
||||
|
||||
if (leader == -1 || follower == -1)
|
||||
break;
|
||||
@@ -281,15 +316,15 @@ void K_DrawDirectorDebugger(void)
|
||||
V_DrawThinString(40, ytxt, V_70TRANS, va("NG"));
|
||||
}
|
||||
|
||||
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfo.gap[position]));
|
||||
V_DrawThinString(80, ytxt, V_70TRANS, va("%d", directorinfosplit[0].gap[position]));
|
||||
|
||||
if (directorinfo.boredom[position] >= BOREDOMTIME)
|
||||
if (directorinfosplit[0].boredom[position] >= BOREDOMTIME)
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("BORED"));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfo.boredom[position]));
|
||||
V_DrawThinString(120, ytxt, V_70TRANS, va("%d", directorinfosplit[0].boredom[position]));
|
||||
}
|
||||
|
||||
V_DrawThinString(150, ytxt, V_70TRANS, va("%s", player_names[leader]));
|
||||
@@ -297,37 +332,38 @@ void K_DrawDirectorDebugger(void)
|
||||
}
|
||||
}
|
||||
|
||||
void K_UpdateDirector(void)
|
||||
void K_UpdateDirector(const UINT8 viewnum)
|
||||
{
|
||||
INT32 *displayplayerp = &displayplayers[0];
|
||||
INT32 targetposition;
|
||||
directorinfo.viewnum = viewnum;
|
||||
directorinfosplit[directorinfo.viewnum].viewplayer = &players[displayplayers[directorinfo.viewnum]];
|
||||
|
||||
if (!K_DirectorIsEnabled())
|
||||
if (!K_DirectorIsEnabled(directorinfo.viewnum))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
K_UpdateDirectorPositions();
|
||||
K_UpdateDirectorPositions(directorinfo.viewnum);
|
||||
|
||||
if (directorinfo.cooldown > 0) {
|
||||
directorinfo.cooldown--;
|
||||
if (directorinfosplit[directorinfo.viewnum].cooldown > 0) {
|
||||
directorinfosplit[directorinfo.viewnum].cooldown--;
|
||||
}
|
||||
|
||||
// handle pending forced switches
|
||||
if (directorinfo.freeze > 0)
|
||||
if (directorinfosplit[directorinfo.viewnum].freeze > 0)
|
||||
{
|
||||
if (!(--directorinfo.freeze))
|
||||
K_DirectorSwitch(directorinfo.attacker, true);
|
||||
if (!(--directorinfosplit[directorinfo.viewnum].freeze))
|
||||
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].attacker, true, directorinfo.viewnum);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// if there's only one player left in the list, just switch to that player
|
||||
if (directorinfo.sortedplayers[0] != -1 && (directorinfo.sortedplayers[1] == -1 ||
|
||||
if (directorinfosplit[directorinfo.viewnum].sortedplayers[0] != -1 && (directorinfosplit[directorinfo.viewnum].sortedplayers[1] == -1 ||
|
||||
// TODO: Battle; I just threw this together quick. Focus on leader.
|
||||
!race_rules()))
|
||||
{
|
||||
K_DirectorSwitch(directorinfo.sortedplayers[0], false);
|
||||
K_DirectorSwitch(directorinfosplit[directorinfo.viewnum].sortedplayers[0], false, directorinfo.viewnum);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -339,39 +375,39 @@ void K_UpdateDirector(void)
|
||||
INT32 target;
|
||||
|
||||
// you are out of players, try again
|
||||
if (directorinfo.sortedplayers[targetposition] == -1)
|
||||
if (directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition] == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// pair too far apart? try the next one
|
||||
if (directorinfo.boredom[targetposition - 1] >= BOREDOMTIME)
|
||||
if (directorinfosplit[directorinfo.viewnum].boredom[targetposition - 1] >= BOREDOMTIME)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// pair finished? try the next one
|
||||
if (players[directorinfo.sortedplayers[targetposition]].exiting)
|
||||
if (players[directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition]].exiting)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't risk switching away from forward pairs at race end, might miss something!
|
||||
if (directorinfo.maxdist > PINCHDIST)
|
||||
if (directorinfosplit[directorinfo.viewnum].maxdist > PINCHDIST)
|
||||
{
|
||||
// if the "next" player is close enough, they should be able to see everyone fine!
|
||||
// walk back through the standings to find a vantage that gets everyone in frame.
|
||||
// (also creates a pretty cool effect w/ overtakes at speed)
|
||||
while (targetposition < MAXPLAYERS && directorinfo.gap[targetposition] < WALKBACKDIST)
|
||||
while (targetposition < MAXPLAYERS && directorinfosplit[directorinfo.viewnum].gap[targetposition] < WALKBACKDIST)
|
||||
{
|
||||
targetposition++;
|
||||
}
|
||||
}
|
||||
|
||||
target = directorinfo.sortedplayers[targetposition];
|
||||
target = directorinfosplit[directorinfo.viewnum].sortedplayers[targetposition];
|
||||
|
||||
// stop here since we're already viewing this player
|
||||
if (*displayplayerp == target)
|
||||
if (displayplayers[directorinfo.viewnum] == target)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -379,25 +415,32 @@ void K_UpdateDirector(void)
|
||||
// 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);
|
||||
K_DirectorSwitch(target, false, directorinfo.viewnum);
|
||||
}
|
||||
|
||||
// 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 (directorinfosplit[directorinfo.viewnum].viewplayer->kartstuff[k_position] != targetposition+1 && !directorinfosplit[directorinfo.viewnum].viewplayer->kartstuff[k_positiondelay])
|
||||
{
|
||||
K_DirectorSwitch(target, false);
|
||||
K_DirectorSwitch(target, false, directorinfo.viewnum);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void K_ToggleDirector(void)
|
||||
void K_ToggleDirector(const UINT8 viewnum)
|
||||
{
|
||||
if (!K_DirectorIsEnabled())
|
||||
if (!K_DirectorIsAvailable(viewnum))
|
||||
return;
|
||||
|
||||
G_AdjustView(viewnum+1, 1, true);
|
||||
|
||||
if (!K_DirectorIsEnabled(viewnum))
|
||||
{
|
||||
directorinfo.cooldown = 0; // switch immediately
|
||||
directorinfosplit[viewnum].cooldown = 0; // switch immediately
|
||||
}
|
||||
|
||||
COM_ImmedExecute("add director 1");
|
||||
directortoggletimer = 0;
|
||||
|
||||
CV_SetValue(&cv_director[viewnum], (cv_director[viewnum].value ^ 1));
|
||||
}
|
||||
+3
-2
@@ -10,8 +10,9 @@
|
||||
/// \file k_director.h
|
||||
/// \brief SRB2kart automatic spectator camera.
|
||||
|
||||
boolean K_DirectorIsAvailable(UINT8 viewnum);
|
||||
void K_InitDirector(void);
|
||||
void K_UpdateDirector(void);
|
||||
void K_UpdateDirector(UINT8 viewnum);
|
||||
void K_DrawDirectorDebugger(void);
|
||||
void K_DirectorFollowAttack(player_t *player, mobj_t *inflictor, mobj_t *source);
|
||||
void K_ToggleDirector(void);
|
||||
void K_ToggleDirector(UINT8 viewnum);
|
||||
+338
-428
File diff suppressed because it is too large.
Load diff
+18
-8
@@ -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));
|
||||
@@ -1553,8 +1565,9 @@ static int lib_pSetSkyboxMobj(lua_State *L)
|
||||
// Shhh, neither does P_StartQuake.
|
||||
static int lib_pStartQuake(lua_State *L)
|
||||
{
|
||||
tic_t q_time = (tic_t)luaL_checkinteger(L, 2);
|
||||
fixed_t q_intensity = luaL_checkinteger(L, 1);
|
||||
UINT16 q_time = (UINT16)luaL_checkinteger(L, 2);
|
||||
fixed_t q_radius = luaL_optinteger(L, 4, 512<<FRACBITS);
|
||||
static mappoint_t q_epicenter = {0,0,0};
|
||||
|
||||
NOHUD
|
||||
@@ -1606,11 +1619,8 @@ static int lib_pStartQuake(lua_State *L)
|
||||
}
|
||||
else
|
||||
quake.epicenter = NULL;
|
||||
quake.radius = luaL_optinteger(L, 4, 512*FRACUNIT);
|
||||
|
||||
// These things are actually used in 2.1.
|
||||
quake.intensity = q_intensity;
|
||||
quake.time = q_time;
|
||||
P_StartQuake(q_time, q_intensity, q_radius);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1819,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;
|
||||
}
|
||||
|
||||
@@ -1921,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);
|
||||
@@ -3156,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
|
||||
@@ -3169,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},
|
||||
|
||||
@@ -81,6 +81,9 @@ void Got_Luacmd(UINT8 **cp, INT32 playernum)
|
||||
lua_pushstring(gL, buf);
|
||||
}
|
||||
LUA_Call(gL, (int)argc, 0, 1); // argc is 1-based, so this will cover the player we passed too.
|
||||
|
||||
lua_pop(gL, 1); // Pop LUA_GetErrorMessage (lua_pcall doesn't pop it)
|
||||
|
||||
return;
|
||||
|
||||
deny:
|
||||
@@ -143,7 +146,7 @@ void COM_Lua_f(void)
|
||||
if (netgame && !( flags & COM_LOCAL ))/* don't send local commands */
|
||||
{ // Send the command through the network
|
||||
UINT8 argc;
|
||||
lua_pop(gL, 1); // pop command info table
|
||||
lua_pop(gL, 2); // pop command info table and LUA_GetErrorMessage
|
||||
|
||||
if (flags & COM_ADMIN && !server && !IsPlayerAdmin(playernum)) // flag 1: only server/admin can use this command.
|
||||
{
|
||||
@@ -166,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);
|
||||
@@ -182,6 +185,8 @@ void COM_Lua_f(void)
|
||||
for (i = 1; i < COM_Argc(); i++)
|
||||
lua_pushstring(gL, COM_Argv(i));
|
||||
LUA_Call(gL, (int)COM_Argc(), 0, 1); // COM_Argc is 1-based, so this will cover the player we passed too.
|
||||
|
||||
lua_pop(gL, 1); // Pop LUA_GetErrorMessage (lua_pcall doesn't pop it)
|
||||
}
|
||||
|
||||
// Wrapper for COM_AddCommand
|
||||
|
||||
+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
-1827
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__
|
||||
+64
-282
@@ -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
|
||||
@@ -503,7 +489,7 @@ static int libd_getSpritePatch(lua_State *L)
|
||||
angle = (angle & 7); // modulus angle by 8
|
||||
|
||||
// rotsprite?????
|
||||
if (lua_isnumber(L, 4) && (cv_spriteroll.value))
|
||||
if (lua_isnumber(L, 4) && cv_sloperoll.value)
|
||||
{
|
||||
angle_t rollangle = luaL_checkangle(L, 4);
|
||||
INT32 rot = R_GetRollAngle(rollangle);
|
||||
@@ -591,26 +577,16 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
UINT8 *colormap = NULL; // do we want to colormap this patch?
|
||||
boolean centered; // the patch is centered and doesn't need readjusting on x/y coordinates.
|
||||
huddrawlist_h list;
|
||||
|
||||
// variables used to replicate k_kart's mmap drawer:
|
||||
INT32 lumpnum;
|
||||
patch_t *AutomapPic;
|
||||
INT32 mx, my;
|
||||
INT32 splitflags, minimaptrans;
|
||||
patch_t *AutomapPic = NULL;
|
||||
|
||||
// base position of the minimap which also takes splits into account:
|
||||
INT32 MM_X, MM_Y;
|
||||
|
||||
// variables used for actually drawing the icon:
|
||||
INT32 splitflags, minimaptrans;
|
||||
fixed_t amnumxpos, amnumypos;
|
||||
INT32 amxpos, amypos;
|
||||
|
||||
node_t *bsp = &nodes[numnodes-1];
|
||||
fixed_t maxx, minx, maxy, miny;
|
||||
|
||||
fixed_t mapwidth, mapheight;
|
||||
fixed_t xoffset, yoffset;
|
||||
fixed_t xscale, yscale, zoom;
|
||||
fixed_t amxpos, amypos;
|
||||
INT32 mm_x, mm_y;
|
||||
fixed_t patchw, patchh;
|
||||
|
||||
HUDONLY // only run this function in hud hooks
|
||||
@@ -622,8 +598,6 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
|
||||
centered = lua_optboolean(L, 6);
|
||||
|
||||
// replicate exactly what source does for its minimap drawer; AKA hardcoded garbo.
|
||||
|
||||
// first, check what position the mmap is supposed to be in (pasted from k_kart.c):
|
||||
MM_X = BASEVIDWIDTH - 50 + cv_mini_xoffset.value; // 270
|
||||
MM_Y = (BASEVIDHEIGHT/2)-16 + cv_mini_yoffset.value; // 84
|
||||
@@ -658,7 +632,6 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
else
|
||||
return 0;
|
||||
|
||||
|
||||
minimaptrans = ((10-minimaptrans)<<FF_TRANSSHIFT);
|
||||
splitflags |= minimaptrans;
|
||||
|
||||
@@ -676,100 +649,73 @@ static int libd_drawOnMinimap(lua_State *L)
|
||||
if (gamestate != GS_LEVEL)
|
||||
return 0;
|
||||
|
||||
if (stplyr != &players[displayplayers[0]])
|
||||
if (stplyrnum != 0)
|
||||
return 0;
|
||||
|
||||
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
|
||||
AutomapPic = minimapinfo.minimap_pic;
|
||||
|
||||
if (lumpnum != -1)
|
||||
AutomapPic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX);
|
||||
else
|
||||
if (!AutomapPic)
|
||||
{
|
||||
return 0; // no pic, just get outta here
|
||||
}
|
||||
|
||||
mx = MM_X - (AutomapPic->width/2);
|
||||
my = MM_Y - (AutomapPic->height/2);
|
||||
// Handle offsets and stuff.
|
||||
mm_x = MM_X - (SHORT(AutomapPic->width)/2);
|
||||
mm_y = MM_Y - (SHORT(AutomapPic->height)/2);
|
||||
|
||||
// let offsets transfer to the heads, too!
|
||||
if (encoremode)
|
||||
mx += SHORT(AutomapPic->leftoffset);
|
||||
{
|
||||
mm_x += SHORT(AutomapPic->leftoffset);
|
||||
}
|
||||
else
|
||||
mx -= SHORT(AutomapPic->leftoffset);
|
||||
my -= SHORT(AutomapPic->topoffset);
|
||||
{
|
||||
mm_x -= SHORT(AutomapPic->leftoffset);
|
||||
}
|
||||
|
||||
// now that we have replicated this behavior, we can draw an icon from our supplied x, y coordinates by replicating k_kart.c's totally understandable uncommented code!!!
|
||||
|
||||
// get map boundaries using nodes
|
||||
maxx = maxy = INT32_MAX;
|
||||
minx = miny = INT32_MIN;
|
||||
minx = bsp->bbox[0][BOXLEFT];
|
||||
maxx = bsp->bbox[0][BOXRIGHT];
|
||||
miny = bsp->bbox[0][BOXBOTTOM];
|
||||
maxy = bsp->bbox[0][BOXTOP];
|
||||
|
||||
if (bsp->bbox[1][BOXLEFT] < minx)
|
||||
minx = bsp->bbox[1][BOXLEFT];
|
||||
if (bsp->bbox[1][BOXRIGHT] > maxx)
|
||||
maxx = bsp->bbox[1][BOXRIGHT];
|
||||
if (bsp->bbox[1][BOXBOTTOM] < miny)
|
||||
miny = bsp->bbox[1][BOXBOTTOM];
|
||||
if (bsp->bbox[1][BOXTOP] > maxy)
|
||||
maxy = bsp->bbox[1][BOXTOP];
|
||||
|
||||
// You might be wondering why these are being bitshift here
|
||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
||||
minx >>= FRACBITS;
|
||||
maxx >>= FRACBITS;
|
||||
miny >>= FRACBITS;
|
||||
maxy >>= FRACBITS;
|
||||
|
||||
// these are our final map boundaries:
|
||||
mapwidth = maxx - minx;
|
||||
mapheight = maxy - miny;
|
||||
|
||||
// These should always be small enough to be bitshift back right now
|
||||
xoffset = (minx + mapwidth/2)<<FRACBITS;
|
||||
yoffset = (miny + mapheight/2)<<FRACBITS;
|
||||
|
||||
xscale = FixedDiv(AutomapPic->width, mapwidth);
|
||||
yscale = FixedDiv(AutomapPic->height, mapheight);
|
||||
zoom = FixedMul(min(xscale, yscale), FRACUNIT-FRACUNIT/20);
|
||||
|
||||
amnumxpos = (FixedMul(x, zoom) - FixedMul(xoffset, zoom));
|
||||
amnumypos = -(FixedMul(y, zoom) - FixedMul(yoffset, zoom));
|
||||
|
||||
if (encoremode)
|
||||
amnumxpos = -amnumxpos;
|
||||
mm_y -= SHORT(AutomapPic->topoffset);
|
||||
|
||||
// scale patch coords
|
||||
patchw = patch->width*scale /2;
|
||||
patchh = patch->height*scale /2;
|
||||
patchw = (SHORT(patch->width) * scale / 2);
|
||||
patchh = (SHORT(patch->height) * scale / 2);
|
||||
|
||||
if (centered)
|
||||
{
|
||||
patchw = patchh = 0; // patch is supposedly already centered, don't butt in.
|
||||
}
|
||||
|
||||
amxpos = amnumxpos + ((mx + AutomapPic->width/2)<<FRACBITS) - patchw;
|
||||
amypos = amnumypos + ((my + AutomapPic->height/2)<<FRACBITS) - patchh;
|
||||
amnumxpos = (FixedMul(x, minimapinfo.zoom) - minimapinfo.offs_x);
|
||||
amnumypos = -(FixedMul(y, minimapinfo.zoom) - minimapinfo.offs_y);
|
||||
|
||||
if (encoremode)
|
||||
{
|
||||
amnumxpos = -amnumxpos;
|
||||
}
|
||||
|
||||
amxpos = amnumxpos + ((mm_x + SHORT(AutomapPic->width) / 2)<<FRACBITS) - patchw;
|
||||
amypos = amnumypos + ((mm_y + SHORT(AutomapPic->height) / 2)<<FRACBITS) - patchh;
|
||||
|
||||
// and NOW we can FINALLY DRAW OUR GOD DAMN PATCH :V
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
|
||||
list = (huddrawlist_h) lua_touserdata(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
if (LUA_HUD_IsDrawListValid(list)){
|
||||
if (cv_minihead.value)
|
||||
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale/2, patch, splitflags, colormap);
|
||||
else
|
||||
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
|
||||
}else{
|
||||
if (cv_minihead.value)
|
||||
V_DrawFixedPatch(amxpos, amypos, scale/2, splitflags, patch, colormap);
|
||||
else
|
||||
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
|
||||
if (cv_minihead.value)
|
||||
{
|
||||
amxpos += patchw / 2;
|
||||
amypos += patchh / 2;
|
||||
scale /= 2;
|
||||
}
|
||||
|
||||
if (LUA_HUD_IsDrawListValid(list))
|
||||
{
|
||||
LUA_HUD_AddDrawScaled(list, amxpos, amypos, scale, patch, splitflags, colormap);
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawFixedPatch(amxpos, amypos, scale, splitflags, patch, colormap);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1255,6 +1201,8 @@ static luaL_Reg lib_draw[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static int lib_draw_ref;
|
||||
|
||||
//
|
||||
// lib_hud
|
||||
//
|
||||
@@ -1288,25 +1236,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)
|
||||
{
|
||||
@@ -1391,23 +1321,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);
|
||||
@@ -1463,153 +1379,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");
|
||||
}
|
||||
@@ -632,12 +632,18 @@ void LUA_HUD_DrawList(huddrawlist_h list)
|
||||
switch (item->type)
|
||||
{
|
||||
case DI_Draw:
|
||||
if (!item->patch || item->patch == NULL)
|
||||
return;
|
||||
V_DrawFixedPatch(LERPS(x), LERPS(y), FRACUNIT, item->flags, item->patch, item->colormap);
|
||||
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);
|
||||
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);
|
||||
break;
|
||||
case DI_DrawNum:
|
||||
|
||||
+3
-1
@@ -111,6 +111,8 @@ static void A_Lua(mobj_t *actor)
|
||||
lua_pushinteger(gL, var2);
|
||||
LUA_Call(gL, 3, 0, 1);
|
||||
|
||||
lua_pop(gL, 1); // pop error handler
|
||||
|
||||
if (found)
|
||||
{
|
||||
--superstack;
|
||||
@@ -940,7 +942,7 @@ static int lib_setSfxInfo(lua_State *L)
|
||||
|
||||
if (lua_isnumber(L, 2))
|
||||
{
|
||||
int j = lua_tointeger(L, 2) - 1;
|
||||
int j = lua_tointeger(L, 2);
|
||||
|
||||
// Read and Write enums were combined, need to do this switch now
|
||||
switch (j)
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ static int lib_iterateSectorThinglist(lua_State *L)
|
||||
if (!lua_isnil(L, 1))
|
||||
{
|
||||
thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
|
||||
if (P_MobjWasRemoved(thing))
|
||||
if (!thing)
|
||||
return luaL_error(L, "current entry in thinglist was removed; avoid calling P_RemoveMobj on entries!");
|
||||
thing = thing->snext;
|
||||
}
|
||||
|
||||
+209
-557
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);
|
||||
|
||||
+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;
|
||||
|
||||
+670
-698
File diff suppressed because it is too large.
Load diff
@@ -64,6 +64,10 @@ void M_DrawTextBox(INT32 x, INT32 y, INT32 width, INT32 boxlines);
|
||||
// Same but with extra flags applied
|
||||
void M_DrawTextBoxFlags(INT32 x, INT32 y, INT32 width, INT32 boxlines, INT32 flags);
|
||||
|
||||
// Draw text input
|
||||
typedef struct textinput_s textinput_t;
|
||||
void M_DrawTextInput(INT32 x, INT32 y, textinput_t *input, INT32 flags);
|
||||
|
||||
// Used in d_netcmd to restart time attack
|
||||
void M_ModeAttackRetry(INT32 choice);
|
||||
|
||||
@@ -295,6 +299,10 @@ void Bird_menu_Onchange(void);
|
||||
// Saturn Hud menu updating
|
||||
void SaturnHud_menu_Onchange(void);
|
||||
|
||||
#ifdef HWRENDER
|
||||
void M_UpdateOGLMenu(void);
|
||||
#endif
|
||||
|
||||
void M_ReplayHut(INT32 choice);
|
||||
void M_SetPlaybackMenuPointer(void);
|
||||
|
||||
|
||||
+80
-5
@@ -27,6 +27,8 @@
|
||||
// Extended map support.
|
||||
#include <ctype.h>
|
||||
|
||||
#include "am_map.h"
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "g_game.h"
|
||||
#include "m_misc.h"
|
||||
@@ -1573,6 +1575,84 @@ boolean M_ScreenshotResponder(event_t *ev)
|
||||
return true;
|
||||
}
|
||||
|
||||
void M_MinimapGenerate(void)
|
||||
{
|
||||
#ifdef USE_PNG
|
||||
char *filepath;
|
||||
boolean ret = false;
|
||||
minigen_t *minigen = NULL;
|
||||
size_t option_scale;
|
||||
INT32 mul = 1;
|
||||
|
||||
if (gamestate != GS_LEVEL)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "You must be in a level to generate a preliminary minimap!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (automapactive)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "The automap is active! Please deactivate it and try again.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
option_scale = COM_CheckPartialParm("-m");
|
||||
|
||||
if (option_scale)
|
||||
{
|
||||
if (COM_Argc() < option_scale + 2)/* no argument after? */
|
||||
{
|
||||
CONS_Alert(CONS_ERROR,
|
||||
"No multiplier follows parameter '%s'.\n",
|
||||
COM_Argv(option_scale));
|
||||
return;
|
||||
}
|
||||
|
||||
mul = atoi(COM_Argv(option_scale + 1));
|
||||
|
||||
if (mul < 1 || mul > 10)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR,
|
||||
"Multiplier %d must be within range 1-10.\n",
|
||||
mul);
|
||||
return;
|
||||
}
|
||||
|
||||
filepath = va("%s" PATHSEP "%s-MINIMAP-%d.png", srb2home, G_BuildMapName(gamemap), mul);
|
||||
}
|
||||
else
|
||||
{
|
||||
filepath = va("%s" PATHSEP "%s-MINIMAP.png", srb2home, G_BuildMapName(gamemap));
|
||||
}
|
||||
|
||||
minigen = AM_MinimapGenerate(mul);
|
||||
|
||||
if (minigen == NULL || minigen->buf == NULL)
|
||||
goto failure;
|
||||
|
||||
M_CreateScreenShotPalette();
|
||||
ret = M_SavePNG(filepath, minigen->buf, minigen->w, minigen->h, screenshot_palette);
|
||||
|
||||
failure:
|
||||
if (minigen->buf != NULL)
|
||||
free(minigen->buf);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
CONS_Printf(M_GetText("%s saved.\nRemember that this is not a complete minimap,\nand must be edited before putting in-game.\n"), filepath);
|
||||
if (mul != 1)
|
||||
{
|
||||
CONS_Printf("You should divide its size by %d!\n", mul);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create %s\n"), filepath);
|
||||
}
|
||||
#endif //#ifdef USE_PNG
|
||||
}
|
||||
|
||||
|
||||
// ==========================================================================
|
||||
// TRANSLATION FUNCTIONS
|
||||
// ==========================================================================
|
||||
@@ -1987,11 +2067,6 @@ char *sizeu5(size_t num)
|
||||
return sizeu5_buf;
|
||||
}
|
||||
|
||||
FUNCINLINE ATTRINLINE void *M_Memcpy(void *dest, const void *src, size_t n)
|
||||
{
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
/** Return the appropriate message for a file error or end of file.
|
||||
*/
|
||||
const char *M_FileError(FILE *fp)
|
||||
|
||||
@@ -69,6 +69,8 @@ void M_ScreenShot(void);
|
||||
void M_DoScreenShot(void);
|
||||
boolean M_ScreenshotResponder(event_t *ev);
|
||||
|
||||
void M_MinimapGenerate(void);
|
||||
|
||||
void Command_SaveConfig_f(void);
|
||||
void Command_LoadConfig_f(void);
|
||||
void Command_ChangeConfig_f(void);
|
||||
|
||||
+13
-5
@@ -10,6 +10,7 @@
|
||||
/// \brief Performance measurement tools.
|
||||
|
||||
#include "m_perfstats.h"
|
||||
#include "p_mobj.h"
|
||||
#include "v_video.h"
|
||||
#include "i_video.h"
|
||||
#include "d_netcmd.h"
|
||||
@@ -58,6 +59,7 @@ static ps_metric_t ps_regularcount = {0};
|
||||
static ps_metric_t ps_scenerycount = {0};
|
||||
static ps_metric_t ps_nothinkcount = {0};
|
||||
static ps_metric_t ps_otherthcount = {0};
|
||||
static ps_metric_t ps_precipcount = {0};
|
||||
static ps_metric_t ps_removecount = {0};
|
||||
|
||||
ps_metric_t ps_checkposition_calls = {0};
|
||||
@@ -171,6 +173,7 @@ perfstatrow_t thinkercount_rows[] = {
|
||||
{" regular", " Regular: ", &ps_regularcount, PS_LEVEL},
|
||||
{" scenery", " Scenery: ", &ps_scenerycount, PS_LEVEL},
|
||||
{" nothink", " Nothink: ", &ps_nothinkcount, PS_HIDE_ZERO|PS_LEVEL},
|
||||
{" precip ", " Precipitation: ", &ps_precipcount, PS_LEVEL},
|
||||
{" other ", " Other: ", &ps_otherthcount, PS_LEVEL},
|
||||
{" remove ", " Pending removal:", &ps_removecount, PS_LEVEL},
|
||||
{0}
|
||||
@@ -298,7 +301,7 @@ static boolean PS_IsRowValid(perfstatrow_t *row)
|
||||
|| (row->flags & PS_SW && rendermode != render_soft)
|
||||
|| (row->flags & PS_HW && rendermode != render_opengl)
|
||||
#ifdef HWRENDER
|
||||
|| (row->flags & PS_BATCHING && !cv_grbatching.value)
|
||||
|| (row->flags & PS_BATCHING && !cv_glbatching.value)
|
||||
#endif
|
||||
);
|
||||
}
|
||||
@@ -515,7 +518,7 @@ static void PS_UpdateFrameStats(void)
|
||||
ps_hw_spritesorttime.value.p +
|
||||
ps_hw_spritedrawtime.value.p;
|
||||
|
||||
if (cv_grbatching.value)
|
||||
if (cv_glbatching.value)
|
||||
{
|
||||
ps_otherrendertime.value.p -=
|
||||
ps_hw_batchsorttime.value.p +
|
||||
@@ -544,7 +547,7 @@ static void PS_UpdateFrameStats(void)
|
||||
PS_UpdateRowHistories(interpolation_rows, true);*/
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && cv_grbatching.value)
|
||||
if (rendermode == render_opengl && cv_glbatching.value)
|
||||
{
|
||||
PS_UpdateRowHistories(batchcount_rows, true);
|
||||
PS_UpdateRowHistories(batchcalls_rows, true);
|
||||
@@ -569,11 +572,14 @@ static void PS_CountThinkers(void)
|
||||
ps_regularcount.value.i = 0;
|
||||
ps_scenerycount.value.i = 0;
|
||||
ps_nothinkcount.value.i = 0;
|
||||
ps_precipcount.value.i = 0;
|
||||
ps_otherthcount.value.i = 0;
|
||||
ps_removecount.value.i = 0;
|
||||
for (thinker = thinkercap.next; thinker != &thinkercap; thinker = thinker->next)
|
||||
{
|
||||
ps_thinkercount.value.i++;
|
||||
if (thinker->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
ps_thinkercount.value.i++;
|
||||
|
||||
if (thinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
|
||||
ps_removecount.value.i++;
|
||||
else if (thinker->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
@@ -587,6 +593,8 @@ static void PS_CountThinkers(void)
|
||||
else
|
||||
ps_regularcount.value.i++;
|
||||
}
|
||||
else if (thinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
|
||||
ps_precipcount.value.i++;
|
||||
else
|
||||
ps_otherthcount.value.i++;
|
||||
}
|
||||
@@ -752,7 +760,7 @@ static void PS_DrawRenderStats(void)
|
||||
/*cy = */PS_DrawPerfRows(x, 10, V_BLUEMAP, commoncounter_rows);// + half_row;
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && cv_grbatching.value)
|
||||
if (rendermode == render_opengl && cv_glbatching.value)
|
||||
{
|
||||
x = hires ? 200 : 155;
|
||||
y = PS_DrawPerfRows(x, 10, V_PURPLEMAP, batchcount_rows);
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
#include "m_textinput.h"
|
||||
#include "i_system.h"
|
||||
#include "keys.h"
|
||||
#include "console.h"
|
||||
|
||||
static void M_TextInputDel(textinput_t *input, size_t start, size_t end)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = (end - start);
|
||||
|
||||
if (end != input->length)
|
||||
memmove(&input->buffer[start], &input->buffer[end], input->length-end);
|
||||
memset(&input->buffer[input->length - len], 0, len);
|
||||
|
||||
input->length -= len;
|
||||
|
||||
if (input->select >= end)
|
||||
input->select -= len;
|
||||
else if (input->select > start)
|
||||
input->select = start;
|
||||
|
||||
if (input->cursor >= end)
|
||||
input->cursor -= len;
|
||||
else if (input->cursor > start)
|
||||
input->cursor = start;
|
||||
}
|
||||
|
||||
static void M_TextInputDelSelection(textinput_t *input)
|
||||
{
|
||||
size_t start, end;
|
||||
|
||||
if (input->cursor > input->select)
|
||||
{
|
||||
start = input->select;
|
||||
end = input->cursor;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = input->cursor;
|
||||
end = input->select;
|
||||
}
|
||||
|
||||
M_TextInputDel(input, start, end);
|
||||
|
||||
input->select = input->cursor = start;
|
||||
}
|
||||
|
||||
static void M_TextInputAddString(textinput_t *input, const char *c)
|
||||
{
|
||||
size_t csize = strlen(c);
|
||||
|
||||
if (input->length + csize > input->buffer_size-1)
|
||||
return;
|
||||
|
||||
if (input->cursor != input->length)
|
||||
memmove(&input->buffer[input->cursor+csize], &input->buffer[input->cursor], input->length-input->cursor);
|
||||
memcpy(&input->buffer[input->cursor], c, csize);
|
||||
input->length += csize;
|
||||
input->select = (input->cursor += csize);
|
||||
input->buffer[input->length] = 0;
|
||||
}
|
||||
|
||||
static void M_TextInputAddChar(textinput_t *input, char c)
|
||||
{
|
||||
if (input->length >= input->buffer_size-1)
|
||||
return;
|
||||
|
||||
if (input->cursor != input->length)
|
||||
memmove(&input->buffer[input->cursor+1], &input->buffer[input->cursor], input->length-input->cursor);
|
||||
input->buffer[input->cursor++] = c;
|
||||
input->buffer[++input->length] = 0;
|
||||
input->select = input->cursor;
|
||||
}
|
||||
|
||||
static void M_TextInputDelChar(textinput_t *input)
|
||||
{
|
||||
if (!input->cursor)
|
||||
return;
|
||||
|
||||
if (input->cursor != input->length)
|
||||
memmove(&input->buffer[input->cursor-1], &input->buffer[input->cursor], input->length-input->cursor);
|
||||
input->buffer[--input->length] = 0;
|
||||
input->select = --input->cursor;
|
||||
}
|
||||
|
||||
static void M_TextInputToWordEnd(textinput_t *input, boolean move_sel)
|
||||
{
|
||||
// Skip spaces
|
||||
while (input->cursor < input->length && isspace(input->buffer[input->cursor]))
|
||||
++input->cursor;
|
||||
|
||||
// Skip word
|
||||
while (input->cursor < input->length && !isspace(input->buffer[input->cursor]))
|
||||
++input->cursor;
|
||||
|
||||
if (move_sel) input->select = input->cursor;
|
||||
}
|
||||
|
||||
static void M_TextInputToWordBegin(textinput_t *input, boolean move_sel)
|
||||
{
|
||||
// Hack, always move back 1 character if possible so if we press ctrl-left at a word beginning
|
||||
// we move to previous word
|
||||
if (input->cursor) --input->cursor;
|
||||
|
||||
// Skip spaces
|
||||
while (input->cursor && isspace(input->buffer[input->cursor]))
|
||||
--input->cursor;
|
||||
|
||||
// Skip word
|
||||
while (input->cursor && !isspace(input->buffer[input->cursor]))
|
||||
--input->cursor;
|
||||
|
||||
// Unless we reached beginning of line, we're pointing at a space before word, so move cursor
|
||||
// forward to fix that
|
||||
if (input->cursor) ++input->cursor;
|
||||
|
||||
if (move_sel) input->select = input->cursor;
|
||||
}
|
||||
|
||||
static void M_TextInputPaste(textinput_t *input)
|
||||
{
|
||||
const char *paste = I_ClipboardPaste();
|
||||
if (input->select != input->cursor)
|
||||
M_TextInputDelSelection(input);
|
||||
if (paste != NULL)
|
||||
M_TextInputAddString(input, paste);
|
||||
}
|
||||
|
||||
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size)
|
||||
{
|
||||
input->buffer = buffer;
|
||||
input->buffer_size = buffer_size;
|
||||
|
||||
M_TextInputClear(input);
|
||||
}
|
||||
|
||||
void M_TextInputClear(textinput_t *input)
|
||||
{
|
||||
input->cursor = 0;
|
||||
input->select = 0;
|
||||
input->length = 0;
|
||||
|
||||
input->buffer[0] = 0;
|
||||
}
|
||||
|
||||
void M_TextInputSetString(textinput_t *input, const char *c)
|
||||
{
|
||||
memset(input->buffer, 0, input->buffer_size);
|
||||
strcpy(input->buffer, c);
|
||||
input->cursor = input->select = input->length = strlen(c);
|
||||
}
|
||||
|
||||
boolean M_TextInputHandle(textinput_t *input, INT32 key)
|
||||
{
|
||||
if (key == KEY_LSHIFT || key == KEY_RSHIFT
|
||||
|| key == KEY_LCTRL || key == KEY_RCTRL
|
||||
|| key == KEY_LALT || key == KEY_RALT)
|
||||
return false;
|
||||
|
||||
if (shiftdown && key == KEY_INS)
|
||||
{
|
||||
M_TextInputPaste(input);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((cv_keyboardlayout.value != 3 && ctrldown) || (cv_keyboardlayout.value == 3 && ctrldown && !altdown))
|
||||
{
|
||||
if (key == 'x' || key == 'X')
|
||||
{
|
||||
if (input->select > input->cursor)
|
||||
I_ClipboardCopy(&input->buffer[input->cursor], input->select-input->cursor);
|
||||
else
|
||||
I_ClipboardCopy(&input->buffer[input->select], input->cursor-input->select);
|
||||
M_TextInputDelSelection(input);
|
||||
return true;
|
||||
}
|
||||
else if (key == 'c' || key == 'C')
|
||||
{
|
||||
if (input->select > input->cursor)
|
||||
I_ClipboardCopy(&input->buffer[input->cursor], input->select-input->cursor);
|
||||
else
|
||||
I_ClipboardCopy(&input->buffer[input->select], input->cursor-input->select);
|
||||
return true;
|
||||
}
|
||||
else if (key == 'v' || key == 'V')
|
||||
{
|
||||
M_TextInputPaste(input);
|
||||
return true;
|
||||
}
|
||||
else if (key == 'w' || key == 'W')
|
||||
{
|
||||
size_t word_start, word_end, i;
|
||||
word_end = i = input->cursor;
|
||||
|
||||
// Unless we're pointing at the beginning of line, decrement i so we only start
|
||||
// removing symbols that come before the cursor
|
||||
if (i) --i;
|
||||
|
||||
// We might be pointing to spaces, skip them first
|
||||
while (i && isspace(input->buffer[i]))
|
||||
--i;
|
||||
|
||||
// Now skip the "word"
|
||||
while (i && !isspace(input->buffer[i]))
|
||||
--i;
|
||||
|
||||
// Unless we reached beginning of line, i is pointing at first space that was found
|
||||
// before word start, and we don't want to remove it
|
||||
if (i) ++i;
|
||||
|
||||
word_start = i;
|
||||
|
||||
if (word_start != word_end)
|
||||
M_TextInputDel(input, word_start, word_end);
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
M_TextInputToWordEnd(input, !shiftdown);
|
||||
else if (key == KEY_LEFTARROW)
|
||||
M_TextInputToWordBegin(input, !shiftdown);
|
||||
|
||||
// Select all
|
||||
if (key == 'a' || key == 'A')
|
||||
{
|
||||
input->select = 0;
|
||||
input->cursor = input->length;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ...why shouldn't it eat the key? if it doesn't, it just means you
|
||||
// can control Sonic from the console, which is silly
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == KEY_LEFTARROW)
|
||||
{
|
||||
if (input->cursor != 0)
|
||||
--input->cursor;
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_RIGHTARROW)
|
||||
{
|
||||
if (input->cursor < input->length)
|
||||
++input->cursor;
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_HOME)
|
||||
{
|
||||
input->cursor = 0;
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_END)
|
||||
{
|
||||
input->cursor = input->length;
|
||||
if (!shiftdown)
|
||||
input->select = input->cursor;
|
||||
return true;
|
||||
}
|
||||
|
||||
// backspace and delete command prompt
|
||||
if (input->select != input->cursor)
|
||||
{
|
||||
if (key == KEY_BACKSPACE || key == KEY_DEL)
|
||||
{
|
||||
M_TextInputDelSelection(input);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (key == KEY_BACKSPACE)
|
||||
{
|
||||
M_TextInputDelChar(input);
|
||||
return true;
|
||||
}
|
||||
else if (key == KEY_DEL)
|
||||
{
|
||||
if (input->cursor == input->length)
|
||||
return true;
|
||||
++input->cursor;
|
||||
M_TextInputDelChar(input);
|
||||
return true;
|
||||
}
|
||||
|
||||
// allow people to use keypad in console (good for typing IP addresses) - Calum
|
||||
if (key >= KEY_KEYPAD7 && key <= KEY_KPADDEL)
|
||||
{
|
||||
char keypad_translation[] = {'7','8','9','-',
|
||||
'4','5','6','+',
|
||||
'1','2','3',
|
||||
'0','.'};
|
||||
|
||||
key = keypad_translation[key - KEY_KEYPAD7];
|
||||
}
|
||||
else if (key == KEY_KPADSLASH)
|
||||
key = '/';
|
||||
|
||||
// same capslock code as hu_stuff.c's HU_responder. Check there for details.
|
||||
key = cv_keyboardlayout.value == 3 ? CON_ShitAndAltGrChar(key) : CON_ShiftChar(key);
|
||||
|
||||
// enter a char into the command prompt
|
||||
if (key < 32 || key > 127)
|
||||
return false;
|
||||
|
||||
if (input->select != input->cursor)
|
||||
M_TextInputDelSelection(input);
|
||||
M_TextInputAddChar(input, key);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef __M_TEXTINPUT__
|
||||
#define __M_TEXTINPUT__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
typedef struct textinput_s {
|
||||
size_t cursor;
|
||||
size_t select;
|
||||
size_t length;
|
||||
|
||||
char *buffer;
|
||||
size_t buffer_size;
|
||||
} textinput_t;
|
||||
|
||||
void M_TextInputInit(textinput_t *input, char *buffer, size_t buffer_size);
|
||||
|
||||
void M_TextInputClear(textinput_t *input);
|
||||
|
||||
void M_TextInputSetString(textinput_t *input, const char *c);
|
||||
|
||||
boolean M_TextInputHandle(textinput_t *input, INT32 key);
|
||||
|
||||
#endif
|
||||
+1
-78
@@ -165,9 +165,6 @@ void A_SpawnObjectAbsolute(mobj_t *actor);
|
||||
void A_SpawnObjectRelative(mobj_t *actor);
|
||||
void A_ChangeAngleRelative(mobj_t *actor);
|
||||
void A_ChangeAngleAbsolute(mobj_t *actor);
|
||||
void A_RollAngle(mobj_t *actor);
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor);
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor);
|
||||
void A_PlaySound(mobj_t *actor);
|
||||
void A_FindTarget(mobj_t *actor);
|
||||
void A_FindTracer(mobj_t *actor);
|
||||
@@ -2658,7 +2655,7 @@ void A_BossDeath(mobj_t *mo)
|
||||
}
|
||||
|
||||
bossjustdie:
|
||||
if (LUAh_BossDeath(mo))
|
||||
if (LUA_HookMobj(mo, MOBJ_HOOK(BossDeath)))
|
||||
return;
|
||||
else if (P_MobjWasRemoved(mo))
|
||||
return;
|
||||
@@ -7183,80 +7180,6 @@ void A_ChangeAngleAbsolute(mobj_t *actor)
|
||||
actor->angle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_RollAngle
|
||||
//
|
||||
// Description: Changes the roll angle.
|
||||
//
|
||||
// var1 = angle
|
||||
// var2 = relative? (default)
|
||||
//
|
||||
void A_RollAngle(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const angle_t angle = FixedAngle(locvar1*FRACUNIT);
|
||||
|
||||
if (LUA_CallAction(A_ROLLANGLE, actor))
|
||||
return;
|
||||
|
||||
// relative (default)
|
||||
if (!locvar2)
|
||||
actor->rollangle += angle;
|
||||
// absolute
|
||||
else
|
||||
actor->rollangle = angle;
|
||||
}
|
||||
|
||||
// Function: A_ChangeRollAngleRelative
|
||||
//
|
||||
// Description: Changes the roll angle to a random relative value between the min and max. Set min and max to the same value to eliminate randomness
|
||||
//
|
||||
// var1 = min
|
||||
// var2 = max
|
||||
//
|
||||
void A_ChangeRollAngleRelative(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
|
||||
if (LUA_CallAction(A_CHANGEROLLANGLERELATIVE, actor))
|
||||
return;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleRelative: var1 is greater than var2");
|
||||
#endif
|
||||
|
||||
actor->rollangle += FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_ChangeRollAngleAbsolute
|
||||
//
|
||||
// Description: Changes the roll angle to a random absolute value between the min and max. Set min and max to the same value to eliminate randomness
|
||||
//
|
||||
// var1 = min
|
||||
// var2 = max
|
||||
//
|
||||
void A_ChangeRollAngleAbsolute(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const fixed_t amin = locvar1*FRACUNIT;
|
||||
const fixed_t amax = locvar2*FRACUNIT;
|
||||
|
||||
if (LUA_CallAction(A_CHANGEROLLANGLEABSOLUTE, actor))
|
||||
return;
|
||||
|
||||
#ifdef PARANOIA
|
||||
if (amin > amax)
|
||||
I_Error("A_ChangeRollAngleAbsolute: var1 is greater than var2");
|
||||
#endif
|
||||
|
||||
actor->rollangle = FixedAngle(P_RandomRange(amin, amax));
|
||||
}
|
||||
|
||||
// Function: A_PlaySound
|
||||
//
|
||||
// Description: Plays a sound
|
||||
|
||||
+36
-111
@@ -2119,10 +2119,11 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
sec = §ors[secnum];
|
||||
|
||||
FOFsector = false;
|
||||
INT32 special = GETSECSPECIAL(sec->special, 2);
|
||||
|
||||
if (GETSECSPECIAL(sec->special, 2) == 3 || GETSECSPECIAL(sec->special, 2) == 5)
|
||||
if (special == 3 || special == 5)
|
||||
floortouch = true;
|
||||
else if (GETSECSPECIAL(sec->special, 2) >= 1 && GETSECSPECIAL(sec->special, 2) <= 8)
|
||||
else if (special >= 1 && special <= 8)
|
||||
floortouch = false;
|
||||
else
|
||||
continue;
|
||||
@@ -2254,7 +2255,7 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
continue;
|
||||
|
||||
if (!(players[i].mo->subsector->sector == sec
|
||||
|| P_PlayerTouchingSectorSpecial(&players[i], 2, (GETSECSPECIAL(sec->special, 2))) == sec))
|
||||
|| P_PlayerTouchingSectorSpecial(&players[i], 2, special) == sec))
|
||||
continue;
|
||||
|
||||
if (floortouch == true && P_IsObjectOnRealGround(players[i].mo, sec))
|
||||
@@ -2298,7 +2299,9 @@ void T_EachTimeThinker(levelspecthink_t *eachtime)
|
||||
|
||||
while ((affectPlayer = P_HavePlayersEnteredArea(playersArea, oldPlayersArea, inAndOut)) != -1)
|
||||
{
|
||||
if (GETSECSPECIAL(sec->special, 2) == 2 || GETSECSPECIAL(sec->special, 2) == 3)
|
||||
INT32 special = GETSECSPECIAL(sec->special, 2);
|
||||
|
||||
if (special == 2 || special == 3)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
@@ -2507,123 +2510,44 @@ void T_CameraScanner(elevator_t *elevator)
|
||||
{
|
||||
// leveltime is compared to make multiple scanners in one map function correctly.
|
||||
static tic_t lastleveltime = 32000; // any number other than 0 should do here
|
||||
static boolean camerascanned, camerascanned2, camerascanned3, camerascanned4;
|
||||
static boolean camerascanned[MAXSPLITSCREENPLAYERS];
|
||||
static fixed_t t_cam_dist[MAXSPLITSCREENPLAYERS] = {-42, -42, -42, -42};
|
||||
static fixed_t t_cam_height[MAXSPLITSCREENPLAYERS] = {-42, -42, -42, -42};
|
||||
|
||||
if (leveltime != lastleveltime) // Back on the first camera scanner
|
||||
{
|
||||
camerascanned = camerascanned2 = camerascanned3 = camerascanned4 = false;
|
||||
memset(camerascanned, false, sizeof (camerascanned));
|
||||
lastleveltime = leveltime;
|
||||
}
|
||||
|
||||
if (players[displayplayers[0]].mo)
|
||||
for (UINT8 i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (players[displayplayers[0]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam_dist == -42)
|
||||
t_cam_dist = cv_cam_dist.value;
|
||||
if (t_cam_height == -42)
|
||||
t_cam_height = cv_cam_height.value;
|
||||
if (t_cam_rotate == -42)
|
||||
t_cam_rotate = cv_cam_rotate.value;
|
||||
CV_SetValue(&cv_cam_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam_rotate, elevator->distance);
|
||||
camerascanned = true;
|
||||
}
|
||||
else if (!camerascanned)
|
||||
{
|
||||
if (t_cam_height != -42 && cv_cam_height.value != t_cam_height)
|
||||
CV_Set(&cv_cam_height, va("%f", (double)FIXED_TO_FLOAT(t_cam_height)));
|
||||
if (t_cam_dist != -42 && cv_cam_dist.value != t_cam_dist)
|
||||
CV_Set(&cv_cam_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam_dist)));
|
||||
if (t_cam_rotate != -42 && cv_cam_rotate.value != t_cam_rotate)
|
||||
CV_Set(&cv_cam_rotate, va("%f", (double)t_cam_rotate));
|
||||
if (!players[displayplayers[i]].mo || P_MobjWasRemoved(players[displayplayers[i]].mo))
|
||||
continue;
|
||||
|
||||
t_cam_dist = t_cam_height = t_cam_rotate = -42;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitscreen && players[displayplayers[1]].mo)
|
||||
{
|
||||
if (players[displayplayers[1]].mo->subsector->sector == elevator->actionsector)
|
||||
if (players[displayplayers[i]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam2_rotate == -42)
|
||||
t_cam2_dist = cv_cam2_dist.value;
|
||||
if (t_cam2_rotate == -42)
|
||||
t_cam2_height = cv_cam2_height.value;
|
||||
if (t_cam2_rotate == -42)
|
||||
t_cam2_rotate = cv_cam2_rotate.value;
|
||||
CV_SetValue(&cv_cam2_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam2_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam2_rotate, elevator->distance);
|
||||
camerascanned2 = true;
|
||||
if (t_cam_dist[i] == -42)
|
||||
t_cam_dist[i] = cv_cam_dist[i].value;
|
||||
if (t_cam_height[i] == -42)
|
||||
t_cam_height[i] = cv_cam_height[i].value;
|
||||
if (t_cam_rotate[i] == -42)
|
||||
t_cam_rotate[i] = cv_cam_rotate[i].value;
|
||||
CV_SetValue(&cv_cam_height[i], FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam_dist[i], FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam_rotate[i], elevator->distance);
|
||||
camerascanned[i] = true;
|
||||
}
|
||||
else if (!camerascanned2)
|
||||
else if (!camerascanned[i])
|
||||
{
|
||||
if (t_cam2_height != -42 && cv_cam2_height.value != t_cam2_height)
|
||||
CV_Set(&cv_cam2_height, va("%f", (double)FIXED_TO_FLOAT(t_cam2_height)));
|
||||
if (t_cam2_dist != -42 && cv_cam2_dist.value != t_cam2_dist)
|
||||
CV_Set(&cv_cam2_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam2_dist)));
|
||||
if (t_cam2_rotate != -42 && cv_cam2_rotate.value != t_cam2_rotate)
|
||||
CV_Set(&cv_cam2_rotate, va("%f", (double)t_cam2_rotate));
|
||||
if (t_cam_height[i] != -42 && cv_cam_height[i].value != t_cam_height[i])
|
||||
CV_Set(&cv_cam_height[i], va("%f", (double)FIXED_TO_FLOAT(t_cam_height[i])));
|
||||
if (t_cam_dist[i] != -42 && cv_cam_dist[i].value != t_cam_dist[i])
|
||||
CV_Set(&cv_cam_dist[i], va("%f", (double)FIXED_TO_FLOAT(t_cam_dist[i])));
|
||||
if (t_cam_rotate[i] != -42 && cv_cam_rotate[i].value != t_cam_rotate[i])
|
||||
CV_Set(&cv_cam_rotate[i], va("%f", (double)t_cam_rotate[i]));
|
||||
|
||||
t_cam2_dist = t_cam2_height = t_cam2_rotate = -42;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitscreen > 1 && players[displayplayers[2]].mo)
|
||||
{
|
||||
if (players[displayplayers[2]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam3_rotate == -42)
|
||||
t_cam3_dist = cv_cam3_dist.value;
|
||||
if (t_cam3_rotate == -42)
|
||||
t_cam3_height = cv_cam3_height.value;
|
||||
if (t_cam3_rotate == -42)
|
||||
t_cam3_rotate = cv_cam3_rotate.value;
|
||||
CV_SetValue(&cv_cam3_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam3_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam3_rotate, elevator->distance);
|
||||
camerascanned3 = true;
|
||||
}
|
||||
else if (!camerascanned3)
|
||||
{
|
||||
if (t_cam3_height != -42 && cv_cam3_height.value != t_cam3_height)
|
||||
CV_Set(&cv_cam3_height, va("%f", (double)FIXED_TO_FLOAT(t_cam3_height)));
|
||||
if (t_cam3_dist != -42 && cv_cam3_dist.value != t_cam3_dist)
|
||||
CV_Set(&cv_cam3_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam3_dist)));
|
||||
if (t_cam3_rotate != -42 && cv_cam3_rotate.value != t_cam3_rotate)
|
||||
CV_Set(&cv_cam3_rotate, va("%f", (double)t_cam3_rotate));
|
||||
|
||||
t_cam3_dist = t_cam3_height = t_cam3_rotate = -42;
|
||||
}
|
||||
}
|
||||
|
||||
if (splitscreen > 2 && players[displayplayers[3]].mo)
|
||||
{
|
||||
if (players[displayplayers[3]].mo->subsector->sector == elevator->actionsector)
|
||||
{
|
||||
if (t_cam4_rotate == -42)
|
||||
t_cam4_dist = cv_cam4_dist.value;
|
||||
if (t_cam4_rotate == -42)
|
||||
t_cam4_height = cv_cam4_height.value;
|
||||
if (t_cam4_rotate == -42)
|
||||
t_cam4_rotate = cv_cam4_rotate.value;
|
||||
CV_SetValue(&cv_cam4_height, FixedInt(elevator->sector->floorheight));
|
||||
CV_SetValue(&cv_cam4_dist, FixedInt(elevator->sector->ceilingheight));
|
||||
CV_SetValue(&cv_cam4_rotate, elevator->distance);
|
||||
camerascanned4 = true;
|
||||
}
|
||||
else if (!camerascanned4)
|
||||
{
|
||||
if (t_cam4_height != -42 && cv_cam4_height.value != t_cam4_height)
|
||||
CV_Set(&cv_cam4_height, va("%f", (double)FIXED_TO_FLOAT(t_cam4_height)));
|
||||
if (t_cam4_dist != -42 && cv_cam4_dist.value != t_cam4_dist)
|
||||
CV_Set(&cv_cam4_dist, va("%f", (double)FIXED_TO_FLOAT(t_cam4_dist)));
|
||||
if (t_cam4_rotate != -42 && cv_cam4_rotate.value != t_cam4_rotate)
|
||||
CV_Set(&cv_cam4_rotate, va("%f", (double)t_cam4_rotate));
|
||||
|
||||
t_cam4_dist = t_cam4_height = t_cam4_rotate = -42;
|
||||
t_cam_dist[i] = t_cam_height[i] = t_cam_rotate[i] = -42;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2996,11 +2920,12 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
||||
fixed_t a, b, c;
|
||||
mobjtype_t type = MT_ROCKCRUMBLE1;
|
||||
const fixed_t spacing = 48*mapobjectscale;
|
||||
INT32 special = GETSECSPECIAL(rover->master->frontsector->special, 3);
|
||||
|
||||
// If the control sector has a special
|
||||
// of Section3:7-15, use the custom debris.
|
||||
if (GETSECSPECIAL(rover->master->frontsector->special, 3) >= 8)
|
||||
type = MT_ROCKCRUMBLE1+(GETSECSPECIAL(rover->master->frontsector->special, 3)-7);
|
||||
if (special >= 8)
|
||||
type = MT_ROCKCRUMBLE1+(special-7);
|
||||
|
||||
// soundorg z height never gets set normally, so MEH.
|
||||
sec->soundorg.z = sec->floorheight;
|
||||
|
||||
+13
-18
@@ -284,7 +284,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
if (special->flags & MF_BOSS && special->flags2 & MF2_FRET)
|
||||
return;
|
||||
|
||||
if (LUAh_TouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
if (LUA_HookTouchSpecial(special, toucher) || P_MobjWasRemoved(special))
|
||||
return;
|
||||
|
||||
if (special->flags & MF_BOSS)
|
||||
@@ -976,11 +976,10 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
break;
|
||||
case MT_HOOPCOLLIDE:
|
||||
// This produces a kind of 'domino effect' with the hoop's pieces.
|
||||
if (!midgamejoin)
|
||||
for (; special->hprev != NULL; special = special->hprev); // Move to the first sprite in the hoop
|
||||
for (; !P_MobjWasRemoved(special->hprev); special = special->hprev); // Move to the first sprite in the hoop
|
||||
|
||||
i = 0;
|
||||
for (; special->type == MT_HOOP; special = special->hnext)
|
||||
for (; !P_MobjWasRemoved(special->hnext) && special->type == MT_HOOP; special = special->hnext)
|
||||
{
|
||||
special->fuse = 11;
|
||||
special->movedir = i;
|
||||
@@ -1641,7 +1640,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
target->flags2 &= ~(MF2_SKULLFLY|MF2_NIGHTSPULL);
|
||||
target->health = 0; // This makes it easy to check if something's dead elsewhere.
|
||||
|
||||
if (LUAh_MobjDeath(target, inflictor, source) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDeath(target, inflictor, source) || P_MobjWasRemoved(target))
|
||||
return;
|
||||
|
||||
// SRB2kart
|
||||
@@ -2397,11 +2396,9 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
// Everything above here can't be forced.
|
||||
if (!metalrecording)
|
||||
{
|
||||
UINT8 shouldForce = LUAh_ShouldDamage(target, inflictor, source, damage);
|
||||
UINT8 shouldForce = LUA_HookShouldDamage(target, inflictor, source, damage);
|
||||
if (P_MobjWasRemoved(target))
|
||||
return (shouldForce == 1); // mobj was removed
|
||||
if (P_MobjWasRemoved(source))
|
||||
source = NULL;
|
||||
if (shouldForce == 1)
|
||||
force = true;
|
||||
else if (shouldForce == 2)
|
||||
@@ -2440,7 +2437,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (!force && target->fuse) // Invincible
|
||||
return false;
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
|
||||
if (target->health > 1)
|
||||
@@ -2466,7 +2463,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
if (!force && target->flags2 & MF2_FRET) // Currently flashing from being hit
|
||||
return false;
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
|
||||
if (target->health > 1)
|
||||
@@ -2474,7 +2471,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
}
|
||||
else if (target->flags & MF_ENEMY)
|
||||
{
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage) || P_MobjWasRemoved(target))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2503,14 +2500,14 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
return false; // Don't run eachother over in special stages and team games and such
|
||||
}
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage))
|
||||
return true;
|
||||
|
||||
P_NiGHTSDamage(target, source); // -5s :(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (LUAh_MobjDamage(target, inflictor, source, damage))
|
||||
if (LUA_HookMobjDamage(target, inflictor, source, damage))
|
||||
return true;
|
||||
|
||||
if (!force && inflictor && (inflictor->flags & MF_FIRE))
|
||||
@@ -2564,8 +2561,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
P_PlayerRingBurst(player, 5);
|
||||
if (P_IsLocalPlayer(player))
|
||||
{
|
||||
quake.intensity = 32*FRACUNIT;
|
||||
quake.time = 5;
|
||||
P_StartQuake(5, 32<<FRACBITS, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2639,6 +2635,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
P_ResetPlayer(target->player);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (target->type)
|
||||
{
|
||||
case MT_EGGMOBILE2: // egg slimer
|
||||
@@ -2652,9 +2649,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
||||
P_SetMobjState(target, target->info->painstate);
|
||||
break;
|
||||
}
|
||||
|
||||
if (P_MobjWasRemoved(target))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!P_MobjWasRemoved(target))
|
||||
{
|
||||
|
||||
+57
-36
@@ -66,6 +66,7 @@
|
||||
|
||||
// both the head and tail of the thinker list
|
||||
extern thinker_t thinkercap;
|
||||
extern mobj_t *mobjcache;
|
||||
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
@@ -78,8 +79,19 @@ void P_UnlinkThinker(thinker_t *thinker);
|
||||
typedef struct camera_s
|
||||
{
|
||||
boolean chase;
|
||||
boolean freecam;
|
||||
|
||||
angle_t localangle;
|
||||
INT32 localaiming;
|
||||
|
||||
angle_t aiming;
|
||||
|
||||
// Freecam: A button was held since entering from menu, so don't move camera
|
||||
UINT8 button_a_held;
|
||||
|
||||
// Freecam: aiming needs to be reset after switching from chasecam
|
||||
boolean reset_aiming;
|
||||
|
||||
// Things used by FS cameras.
|
||||
fixed_t viewheight;
|
||||
angle_t startangle;
|
||||
@@ -111,32 +123,15 @@ typedef struct camera_s
|
||||
fixed_t pan;
|
||||
} camera_t;
|
||||
|
||||
// demo freecam or something before i commit die
|
||||
struct demofreecam_s {
|
||||
|
||||
camera_t *cam; // this is useful when the game is paused, notably
|
||||
mobj_t *soundmobj; // mobj to play sound from, used in s_sound
|
||||
|
||||
angle_t localangle; // keeps track of the cam angle for cmds
|
||||
angle_t localaiming; // ditto with aiming
|
||||
boolean turnheld; // holding turn button for gradual turn speed
|
||||
boolean keyboardlook; // keyboard look
|
||||
};
|
||||
|
||||
extern struct demofreecam_s democam;
|
||||
|
||||
extern camera_t camera[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_dist, cv_cam_still, cv_cam_height;
|
||||
extern consvar_t cv_cam_speed, cv_cam_rotate, cv_cam_rotspeed;
|
||||
extern consvar_t cv_cam_dist[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_still[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_height[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_speed[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||
extern consvar_t cv_cam_rotspeed[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
extern consvar_t cv_cam2_dist, cv_cam2_still, cv_cam2_height;
|
||||
extern consvar_t cv_cam2_speed, cv_cam2_rotate, cv_cam2_rotspeed;
|
||||
|
||||
extern consvar_t cv_cam3_dist, cv_cam3_still, cv_cam3_height;
|
||||
extern consvar_t cv_cam3_speed, cv_cam3_rotate, cv_cam3_rotspeed;
|
||||
|
||||
extern consvar_t cv_cam4_dist, cv_cam4_still, cv_cam4_height;
|
||||
extern consvar_t cv_cam4_speed, cv_cam4_rotate, cv_cam4_rotspeed;
|
||||
extern consvar_t cv_freecam_speed;
|
||||
|
||||
extern consvar_t cv_tilting;
|
||||
extern consvar_t cv_quaketilt;
|
||||
@@ -146,10 +141,7 @@ extern consvar_t cv_actionmovie;
|
||||
|
||||
extern consvar_t cv_lookbackmom;
|
||||
|
||||
extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate;
|
||||
extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate;
|
||||
extern fixed_t t_cam3_dist, t_cam3_height, t_cam3_rotate;
|
||||
extern fixed_t t_cam4_dist, t_cam4_height, t_cam4_rotate;
|
||||
extern fixed_t t_cam_rotate[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
fixed_t P_GetPlayerHeight(player_t *player);
|
||||
fixed_t P_GetPlayerSpinHeight(player_t *player);
|
||||
@@ -157,15 +149,16 @@ void P_AddPlayerScore(player_t *player, UINT32 amount);
|
||||
void P_ResetCamera(player_t *player, camera_t *thiscam);
|
||||
boolean P_TryCameraMove(fixed_t x, fixed_t y, camera_t *thiscam);
|
||||
void P_SlideCameraMove(camera_t *thiscam);
|
||||
void P_DemoCameraMovement(camera_t *cam);
|
||||
//void P_DemoCameraMovement(camera_t *cam, UINT8 num);
|
||||
boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcalled);
|
||||
void P_ResetLocalCamAiming(player_t *player);
|
||||
void P_InitCameraCmd(void);
|
||||
void P_ToggleDemoCamera(UINT8 viewnum);
|
||||
boolean P_PlayerInPain(player_t *player);
|
||||
void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor);
|
||||
void P_ResetPlayer(player_t *player);
|
||||
boolean P_IsLocalPlayer(player_t *player);
|
||||
boolean P_IsDisplayPlayer(player_t *player);
|
||||
boolean P_IsLocalPlayer(const player_t *player);
|
||||
boolean P_IsDisplayPlayer(const player_t *player);
|
||||
|
||||
boolean P_SpectatorJoinGame(player_t *player);
|
||||
|
||||
boolean P_IsObjectInGoop(mobj_t *mo);
|
||||
@@ -248,7 +241,7 @@ void P_RecalcPrecipInSector(sector_t *sector);
|
||||
void P_PrecipitationEffects(void);
|
||||
|
||||
void P_RemoveMobj(mobj_t *th);
|
||||
boolean P_MobjWasRemoved(const mobj_t *th);
|
||||
|
||||
void P_RemoveSavegameMobj(mobj_t *th);
|
||||
boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state);
|
||||
boolean P_SetMobjState(mobj_t *mobj, statenum_t state);
|
||||
@@ -260,6 +253,12 @@ boolean P_RailThinker(mobj_t *mobj);
|
||||
void P_PushableThinker(mobj_t *mobj);
|
||||
void P_SceneryThinker(mobj_t *mobj);
|
||||
|
||||
// This does not need to be added to Lua.
|
||||
// To test it in Lua, check mobj.valid
|
||||
FUNCINLINE static ATTRINLINE boolean P_MobjWasRemoved(const mobj_t *mobj)
|
||||
{
|
||||
return (!mobj || mobj->thinker.function.acp1 != (actionf_p1)P_MobjThinker);
|
||||
}
|
||||
|
||||
fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t x, fixed_t y, line_t *line, boolean lowest, boolean perfect);
|
||||
@@ -291,7 +290,14 @@ mobj_t *P_SPMAngle(mobj_t *source, mobjtype_t type, angle_t angle, UINT8 aimtype
|
||||
#define P_SpawnNameFinder(s,t) P_SPMAngle(s,t,s->angle,true,0)
|
||||
#endif
|
||||
void P_ColorTeamMissile(mobj_t *missile, player_t *source);
|
||||
SINT8 P_MobjFlip(const mobj_t *mobj);
|
||||
|
||||
// P_MobjFlip
|
||||
// Special utility to return +1 or -1 depending on mobj's gravity
|
||||
FUNCINLINE static ATTRINLINE SINT8 P_MobjFlip(const mobj_t *mobj)
|
||||
{
|
||||
return (mobj && mobj->eflags & MFE_VERTICALFLIP) ? -1 : 1;
|
||||
}
|
||||
|
||||
fixed_t P_GetMobjGravity(mobj_t *mo);
|
||||
FUNCMATH boolean P_WeaponOrPanel(mobjtype_t type);
|
||||
|
||||
@@ -361,7 +367,11 @@ boolean P_MoveOrigin(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z);
|
||||
void P_SlideMove(mobj_t *mo, boolean forceslide);
|
||||
void P_BouncePlayerMove(mobj_t *mo);
|
||||
void P_BounceMove(mobj_t *mo);
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2);
|
||||
|
||||
#define P_CheckSight(t1, t2) P_CheckSight2(t1, t2, false)
|
||||
#define P_CheckSightFast(t1, t2) P_CheckSight2(t1, t2, true)
|
||||
boolean P_CheckSight2(mobj_t *t1, mobj_t *t2, boolean fast);
|
||||
|
||||
void P_CheckHoopPosition(mobj_t *hoopthing, fixed_t x, fixed_t y, fixed_t z, fixed_t radius);
|
||||
|
||||
boolean P_CheckSector(sector_t *sector, boolean crunch);
|
||||
@@ -392,6 +402,18 @@ extern fixed_t bmaporgy; // origin of block map
|
||||
extern mobj_t **blocklinks; // for thing chains
|
||||
extern precipmobj_t **precipblocklinks; // special blockmap for precip rendering
|
||||
|
||||
extern struct minimapinfo
|
||||
{
|
||||
patch_t *minimap_pic;
|
||||
UINT8 mapthingcount;
|
||||
INT32 min_x, min_y;
|
||||
INT32 max_x, max_y;
|
||||
INT32 map_w, map_h;
|
||||
INT32 minimap_w, minimap_h;
|
||||
fixed_t offs_x, offs_y;
|
||||
fixed_t zoom;
|
||||
} minimapinfo;
|
||||
|
||||
//
|
||||
// P_INTER
|
||||
//
|
||||
@@ -422,7 +444,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck);
|
||||
void P_PlayerFlagBurst(player_t *player, boolean toss);
|
||||
void P_CheckTimeLimit(void);
|
||||
void P_CheckPointLimit(void);
|
||||
//void P_CheckSurvivors(void);
|
||||
boolean P_CheckRacers(void);
|
||||
|
||||
boolean P_CanPickupItem(player_t *player, UINT8 weapon);
|
||||
|
||||
+9
-5
@@ -449,7 +449,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
}
|
||||
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjCollide(thing, tmthing); // checks hook for thing's type
|
||||
UINT8 shouldCollide = LUA_Hook2Mobj(thing, tmthing, MOBJ_HOOK(MobjCollide)); // checks hook for thing's type
|
||||
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
|
||||
return true; // one of them was removed???
|
||||
if (shouldCollide == 1)
|
||||
@@ -458,7 +458,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
||||
return true; // force no collide
|
||||
}
|
||||
{
|
||||
UINT8 shouldCollide = LUAh_MobjMoveCollide(tmthing, thing); // checks hook for tmthing's type
|
||||
UINT8 shouldCollide = LUA_Hook2Mobj(tmthing, thing, MOBJ_HOOK(MobjMoveCollide)); // checks hook for tmthing's type
|
||||
if (P_MobjWasRemoved(tmthing) || P_MobjWasRemoved(thing))
|
||||
return true; // one of them was removed???
|
||||
if (shouldCollide == 1)
|
||||
@@ -1727,6 +1727,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y)
|
||||
tmbbox[BOXLEFT] = x - tmthing->radius;
|
||||
|
||||
newsubsec = R_PointInSubsector(x, y);
|
||||
|
||||
ceilingline = blockingline = NULL;
|
||||
|
||||
// The base floor / ceiling is from the subsector
|
||||
@@ -2391,16 +2392,19 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
{
|
||||
//All things are affected by their scale.
|
||||
fixed_t maxstep = FixedMul(MAXSTEPMOVE, mapobjectscale);
|
||||
INT32 special = 0;
|
||||
|
||||
if (thing->player)
|
||||
{
|
||||
special = GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1);
|
||||
|
||||
// If using type Section1:13, double the maxstep.
|
||||
if (P_PlayerTouchingSectorSpecial(thing->player, 1, 13)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 13)
|
||||
|| special == 13)
|
||||
maxstep <<= 1;
|
||||
// If using type Section1:12, no maxstep. For ledges you don't want the player to climb! (see: Egg Zeppelin & SMK port walls)
|
||||
else if (P_PlayerTouchingSectorSpecial(thing->player, 1, 12)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 12)
|
||||
|| special == 12)
|
||||
maxstep = 0;
|
||||
}
|
||||
|
||||
@@ -2446,7 +2450,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
|
||||
else if (maxstep > 0 && !(
|
||||
thing->player && (
|
||||
P_PlayerTouchingSectorSpecial(thing->player, 1, 14)
|
||||
|| GETSECSPECIAL(R_PointInSubsector(x, y)->sector->special, 1) == 14)
|
||||
|| special == 14)
|
||||
)) // Step down
|
||||
{
|
||||
// If the floor difference is MAXSTEPMOVE or less, and the sector isn't Section1:14, ALWAYS
|
||||
|
||||
+290
-263
File diff suppressed because it is too large.
Load diff
+10
-11
@@ -261,20 +261,21 @@ typedef enum {
|
||||
PCF_SPLASH = 1<<4, // Splashed on the ground, return to the ceiling after the animation's over
|
||||
PCF_THUNK = 1<<5, // Ran the thinker this tic.
|
||||
} precipflag_t;
|
||||
|
||||
// Map Object definition.
|
||||
typedef struct mobj_s
|
||||
{
|
||||
// List: thinker links.
|
||||
thinker_t thinker;
|
||||
|
||||
mobjtype_t type;
|
||||
const mobjinfo_t *info; // &mobjinfo[mobj->type]
|
||||
|
||||
// Info for drawing: position.
|
||||
fixed_t x, y, z;
|
||||
fixed_t old_x, old_y, old_z; // position interpolation
|
||||
fixed_t old_x2, old_y2, old_z2;
|
||||
|
||||
mobjtype_t type;
|
||||
const mobjinfo_t *info; // &mobjinfo[mobj->type]
|
||||
|
||||
// More list: links in sector (if needed)
|
||||
struct mobj_s *bnext;
|
||||
struct mobj_s **bprev; // killough 8/11/98: change to ptr-to-ptr
|
||||
@@ -287,8 +288,7 @@ typedef struct mobj_s
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT16 anim_duration; // for FF_ANIMATE states
|
||||
|
||||
UINT32 renderflags; // render flags
|
||||
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
fixed_t spritexoffset, spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
@@ -420,14 +420,14 @@ typedef struct precipmobj_s
|
||||
// List: thinker links.
|
||||
thinker_t thinker;
|
||||
|
||||
mobjtype_t type;
|
||||
const mobjinfo_t *info; // &mobjinfo[mobj->type]
|
||||
|
||||
// Info for drawing: position.
|
||||
fixed_t x, y, z;
|
||||
fixed_t old_x, old_y, old_z; // position interpolation
|
||||
fixed_t old_x2, old_y2, old_z2;
|
||||
|
||||
mobjtype_t type;
|
||||
const mobjinfo_t *info; // &mobjinfo[mobj->type]
|
||||
|
||||
// More list: links in sector (if needed)
|
||||
struct precipmobj_s *bnext;
|
||||
struct precipmobj_s **bprev; // killough 8/11/98: change to ptr-to-ptr
|
||||
@@ -440,8 +440,7 @@ typedef struct precipmobj_s
|
||||
spritenum_t sprite; // used to find patch_t and flip value
|
||||
UINT32 frame; // frame number, plus bits see p_pspr.h
|
||||
UINT16 anim_duration; // for FF_ANIMATE states
|
||||
|
||||
UINT32 renderflags; // render flags
|
||||
|
||||
fixed_t spritexscale, spriteyscale;
|
||||
fixed_t spritexoffset, spriteyoffset;
|
||||
fixed_t old_spritexscale, old_spriteyscale;
|
||||
@@ -450,7 +449,7 @@ typedef struct precipmobj_s
|
||||
fixed_t realxscale, realyscale; // funn-E streeetch
|
||||
|
||||
fixed_t stretchslam; // "squish" effect when you land
|
||||
|
||||
|
||||
//sloperollangle
|
||||
angle_t sloperoll, slopepitch;
|
||||
angle_t old_sloperoll, old_slopepitch;
|
||||
|
||||
+5
-1
@@ -28,6 +28,7 @@
|
||||
#include "r_main.h"
|
||||
#include "r_state.h"
|
||||
#include "r_defs.h"
|
||||
#include "qs22j.h"
|
||||
|
||||
|
||||
/*
|
||||
@@ -152,6 +153,9 @@ FUNCINLINE static ATTRINLINE void PolyObj_AddThinker(thinker_t *th)
|
||||
th->next = thinkercap.next;
|
||||
th->prev = &thinkercap;
|
||||
thinkercap.next = th;
|
||||
|
||||
th->references = 0;
|
||||
th->cachable = false; // not initialising this made the mobjcache die thx!
|
||||
}
|
||||
|
||||
static void FreeSideLists(void)
|
||||
@@ -580,7 +584,7 @@ static void Polyobj_findExplicit(polyobj_t *po)
|
||||
|
||||
// sort the array if necessary
|
||||
if (numSegItems >= 2)
|
||||
qsort(segitems, numSegItems, sizeof(segitem_t), Polyobj_segCompare);
|
||||
qs22j(segitems, numSegItems, sizeof(segitem_t), Polyobj_segCompare);
|
||||
|
||||
// second loop: put the sorted segs into the polyobject
|
||||
for (i = 0; i < numSegItems; ++i)
|
||||
|
||||
+1006
-1047
File diff suppressed because it is too large.
Load diff
+16
-8
@@ -21,13 +21,6 @@
|
||||
// Persistent storage/archiving.
|
||||
// These are the load / save game routines.
|
||||
|
||||
void P_SaveGame(void);
|
||||
void P_SaveNetGame(boolean resending);
|
||||
boolean P_LoadGame(INT16 mapoverride);
|
||||
boolean P_LoadNetGame(boolean resending);
|
||||
|
||||
mobj_t *P_FindNewPosition(UINT32 oldposition);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 skincolor;
|
||||
@@ -41,6 +34,21 @@ typedef struct
|
||||
} savedata_t;
|
||||
|
||||
extern savedata_t savedata;
|
||||
extern UINT8 *save_p;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UINT8 *buffer;
|
||||
UINT8 *p;
|
||||
} savebuffer_t;
|
||||
|
||||
// Persistent storage/archiving.
|
||||
// These are the load / save game routines.
|
||||
|
||||
void P_SaveGame(savebuffer_t *save);
|
||||
void P_SaveNetGame(savebuffer_t *save, boolean resending);
|
||||
boolean P_LoadGame(savebuffer_t *save, INT16 mapoverride);
|
||||
boolean P_LoadNetGame(savebuffer_t *save, boolean reloading);
|
||||
|
||||
mobj_t *P_FindNewPosition(UINT32 oldposition);
|
||||
|
||||
#endif
|
||||
+133
-67
@@ -63,7 +63,7 @@
|
||||
|
||||
#include "md5.h" // map MD5
|
||||
|
||||
// for LUAh_MapLoad
|
||||
// for MapLoad hook
|
||||
#include "lua_script.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
@@ -460,7 +460,11 @@ FUNCINLINE static ATTRINLINE void P_LoadRawVertexes(UINT8 *data)
|
||||
* \param seg Seg to compute length for.
|
||||
* \return Length in fracunits.
|
||||
*/
|
||||
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
|
||||
fixed_t P_SegLength(seg_t *seg)
|
||||
#else
|
||||
static inline fixed_t P_SegLength(seg_t *seg)
|
||||
#endif
|
||||
{
|
||||
INT64 dx = (seg->v2->x - seg->v1->x)>>1;
|
||||
INT64 dy = (seg->v2->y - seg->v1->y)>>1;
|
||||
@@ -510,7 +514,7 @@ void P_UpdateSegLightOffset(seg_t *li)
|
||||
// Loads the SEGS resource from a level.
|
||||
static void P_LoadRawSegs(UINT8 *data)
|
||||
{
|
||||
INT32 linedef, side;
|
||||
INT32 rawlinedef, rawside;
|
||||
mapseg_t *ml = (mapseg_t*)data;
|
||||
seg_t *li = segs;
|
||||
line_t *ldef;
|
||||
@@ -530,14 +534,14 @@ static void P_LoadRawSegs(UINT8 *data)
|
||||
|
||||
li->angle = (SHORT(ml->angle))<<FRACBITS;
|
||||
li->offset = (SHORT(ml->offset))<<FRACBITS;
|
||||
linedef = SHORT(ml->linedef);
|
||||
ldef = &lines[linedef];
|
||||
rawlinedef = SHORT(ml->linedef);
|
||||
ldef = &lines[rawlinedef];
|
||||
li->linedef = ldef;
|
||||
li->side = side = SHORT(ml->side);
|
||||
li->sidedef = &sides[ldef->sidenum[side]];
|
||||
li->frontsector = sides[ldef->sidenum[side]].sector;
|
||||
li->side = rawside = SHORT(ml->side);
|
||||
li->sidedef = &sides[ldef->sidenum[rawside]];
|
||||
li->frontsector = sides[ldef->sidenum[rawside]].sector;
|
||||
if (ldef->flags & ML_TWOSIDED)
|
||||
li->backsector = sides[ldef->sidenum[side^1]].sector;
|
||||
li->backsector = sides[ldef->sidenum[rawside^1]].sector;
|
||||
else
|
||||
li->backsector = 0;
|
||||
|
||||
@@ -997,14 +1001,14 @@ void P_WriteThings(lumpnum_t lumpnum)
|
||||
size_t i, length;
|
||||
mapthing_t *mt;
|
||||
UINT8 *data;
|
||||
UINT8 *savebuffer, *savebuf_p;
|
||||
savebuffer_t save;
|
||||
INT16 temp;
|
||||
|
||||
data = W_CacheLumpNum(lumpnum, PU_LEVEL);
|
||||
|
||||
savebuf_p = savebuffer = (UINT8 *)malloc(nummapthings * sizeof (mapthing_t));
|
||||
save.p = save.buffer = (UINT8 *)malloc(nummapthings * sizeof (mapthing_t));
|
||||
|
||||
if (!savebuf_p)
|
||||
if (!save.p)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("No more free memory for thing writing!\n"));
|
||||
return;
|
||||
@@ -1013,23 +1017,23 @@ void P_WriteThings(lumpnum_t lumpnum)
|
||||
mt = mapthings;
|
||||
for (i = 0; i < nummapthings; i++, mt++)
|
||||
{
|
||||
WRITEINT16(savebuf_p, mt->x);
|
||||
WRITEINT16(savebuf_p, mt->y);
|
||||
WRITEINT16(save.p, mt->x);
|
||||
WRITEINT16(save.p, mt->y);
|
||||
|
||||
WRITEINT16(savebuf_p, mt->angle);
|
||||
WRITEINT16(save.p, mt->angle);
|
||||
|
||||
temp = (INT16)(mt->type + ((INT16)mt->extrainfo << 12));
|
||||
WRITEINT16(savebuf_p, temp);
|
||||
WRITEUINT16(savebuf_p, mt->options);
|
||||
WRITEINT16(save.p, temp);
|
||||
WRITEUINT16(save.p, mt->options);
|
||||
}
|
||||
|
||||
Z_Free(data);
|
||||
|
||||
length = savebuf_p - savebuffer;
|
||||
length = save.p - save.buffer;
|
||||
|
||||
FIL_WriteFile(va("newthings%d.lmp", gamemap), savebuffer, length);
|
||||
free(savebuffer);
|
||||
savebuf_p = NULL;
|
||||
FIL_WriteFile(va("newthings%d.lmp", gamemap), save.buffer, length);
|
||||
free(save.buffer);
|
||||
save.p = NULL;
|
||||
|
||||
CONS_Printf(M_GetText("newthings%d.lmp saved.\n"), gamemap);
|
||||
}
|
||||
@@ -1542,16 +1546,23 @@ static void P_CreateBlockMap(void)
|
||||
// First find limits of map
|
||||
for (i = 0; i < numvertexes; i++)
|
||||
{
|
||||
if (vertexes[i].x>>FRACBITS < minx)
|
||||
minx = vertexes[i].x>>FRACBITS;
|
||||
else if (vertexes[i].x>>FRACBITS > maxx)
|
||||
maxx = vertexes[i].x>>FRACBITS;
|
||||
if (vertexes[i].y>>FRACBITS < miny)
|
||||
miny = vertexes[i].y>>FRACBITS;
|
||||
else if (vertexes[i].y>>FRACBITS > maxy)
|
||||
maxy = vertexes[i].y>>FRACBITS;
|
||||
fixed_t t;
|
||||
|
||||
if ((t = vertexes[i].x) < minx)
|
||||
minx = t;
|
||||
else if (t > maxx)
|
||||
maxx = t;
|
||||
if ((t = vertexes[i].y) < miny)
|
||||
miny = t;
|
||||
else if (t > maxy)
|
||||
maxy = t;
|
||||
}
|
||||
|
||||
minx >>= FRACBITS;
|
||||
maxx >>= FRACBITS;
|
||||
miny >>= FRACBITS;
|
||||
maxy >>= FRACBITS;
|
||||
|
||||
// Save blockmap parameters
|
||||
bmaporgx = minx << FRACBITS;
|
||||
bmaporgy = miny << FRACBITS;
|
||||
@@ -2426,7 +2437,7 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
cam->y = players[pnum].mo->y;
|
||||
cam->z = players[pnum].mo->z;
|
||||
cam->angle = players[pnum].mo->angle;
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2451,8 +2462,10 @@ static void P_SetupCamera(UINT8 pnum, camera_t *cam)
|
||||
cam->y = thing->y;
|
||||
cam->z = thing->z;
|
||||
cam->angle = FixedAngle((fixed_t)thing->angle << FRACBITS);
|
||||
cam->subsector = R_PointInSubsector(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
cam->subsector = R_PointInSubsectorFast(cam->x, cam->y); // make sure camera has a subsector set -- Monster Iestyn (12/11/18)
|
||||
}
|
||||
|
||||
cam->chase = false; // tell camera to reset its position next tic
|
||||
}
|
||||
|
||||
static void P_InitCamera(void)
|
||||
@@ -2461,22 +2474,20 @@ static void P_InitCamera(void)
|
||||
|
||||
if (!dedicated)
|
||||
{
|
||||
if (!demo.freecam)
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
{
|
||||
if (camera[i].freecam)
|
||||
continue;
|
||||
|
||||
P_SetupCamera(displayplayers[i], &camera[i]);
|
||||
}
|
||||
|
||||
// Though, I don't think anyone would care about cam_rotate being reset back to the only value that makes sense :P
|
||||
if (!cv_cam_rotate.changed)
|
||||
CV_Set(&cv_cam_rotate, cv_cam_rotate.defaultvalue);
|
||||
|
||||
if (!cv_cam2_rotate.changed)
|
||||
CV_Set(&cv_cam2_rotate, cv_cam2_rotate.defaultvalue);
|
||||
|
||||
if (!cv_cam3_rotate.changed)
|
||||
CV_Set(&cv_cam3_rotate, cv_cam3_rotate.defaultvalue);
|
||||
|
||||
if (!cv_cam4_rotate.changed)
|
||||
CV_Set(&cv_cam4_rotate, cv_cam4_rotate.defaultvalue);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!cv_cam_rotate[i].changed)
|
||||
CV_Set(&cv_cam_rotate[i], cv_cam_rotate[i].defaultvalue);
|
||||
}
|
||||
|
||||
displayplayers[0] = consoleplayer; // Start with your OWN view, please!
|
||||
}
|
||||
@@ -2487,6 +2498,71 @@ static boolean P_CanSave(void)
|
||||
return false; // SRB2Kart: no SP, no saving.
|
||||
}
|
||||
|
||||
struct minimapinfo minimapinfo;
|
||||
static void P_InitMinimapInfo(void)
|
||||
{
|
||||
INT32 lumpnum;
|
||||
fixed_t a;
|
||||
fixed_t b;
|
||||
node_t *bsp = &nodes[numnodes-1];
|
||||
|
||||
minimapinfo.minimap_pic = NULL;
|
||||
|
||||
lumpnum = W_CheckNumForName(va("%sR", G_BuildMapName(gamemap)));
|
||||
|
||||
if (lumpnum != -1)
|
||||
minimapinfo.minimap_pic = W_CachePatchName(va("%sR", G_BuildMapName(gamemap)), PU_HUDGFX);
|
||||
|
||||
minimapinfo.mapthingcount = 0;
|
||||
// TODO iterate over mapthings to look for possible user-defined bounds
|
||||
minimapinfo.min_x = bsp->bbox[0][BOXLEFT];
|
||||
minimapinfo.max_x = bsp->bbox[0][BOXRIGHT];
|
||||
minimapinfo.min_y = bsp->bbox[0][BOXBOTTOM];
|
||||
minimapinfo.max_y = bsp->bbox[0][BOXTOP];
|
||||
|
||||
if (bsp->bbox[1][BOXLEFT] < minimapinfo.min_x)
|
||||
minimapinfo.min_x = bsp->bbox[1][BOXLEFT];
|
||||
if (bsp->bbox[1][BOXRIGHT] > minimapinfo.max_x)
|
||||
minimapinfo.max_x = bsp->bbox[1][BOXRIGHT];
|
||||
if (bsp->bbox[1][BOXBOTTOM] < minimapinfo.min_y)
|
||||
minimapinfo.min_y = bsp->bbox[1][BOXBOTTOM];
|
||||
if (bsp->bbox[1][BOXTOP] > minimapinfo.max_y)
|
||||
minimapinfo.max_y = bsp->bbox[1][BOXTOP];
|
||||
|
||||
// You might be wondering why these are being bitshift here
|
||||
// it's because mapwidth and height would otherwise overflow for maps larger than half the size possible...
|
||||
// map boundaries and sizes will ALWAYS be whole numbers thankfully
|
||||
// later calculations take into consideration that these are actually not in terms of FRACUNIT though
|
||||
minimapinfo.map_w = (minimapinfo.max_x >>= FRACBITS) - (minimapinfo.min_x >>= FRACBITS);
|
||||
minimapinfo.map_h = (minimapinfo.max_y >>= FRACBITS) - (minimapinfo.min_y >>= FRACBITS);
|
||||
|
||||
minimapinfo.minimap_w = minimapinfo.minimap_h = 100;
|
||||
|
||||
a = FixedDiv(minimapinfo.minimap_w<<FRACBITS, minimapinfo.map_w<<4);
|
||||
b = FixedDiv(minimapinfo.minimap_h<<FRACBITS, minimapinfo.map_h<<4);
|
||||
|
||||
if (a < b)
|
||||
{
|
||||
minimapinfo.minimap_h = FixedMul(a, minimapinfo.map_h)>>(FRACBITS-4);
|
||||
minimapinfo.zoom = a;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (a != b)
|
||||
{
|
||||
minimapinfo.minimap_w = FixedMul(b, minimapinfo.map_w)>>(FRACBITS-4);
|
||||
}
|
||||
minimapinfo.zoom = b;
|
||||
}
|
||||
|
||||
minimapinfo.zoom >>= (FRACBITS-4);
|
||||
minimapinfo.zoom -= (minimapinfo.zoom/20);
|
||||
|
||||
// These should always be small enough to be bitshift back right now
|
||||
minimapinfo.offs_x = FixedMul((minimapinfo.min_x + minimapinfo.map_w/2) << FRACBITS, minimapinfo.zoom);
|
||||
minimapinfo.offs_y = FixedMul((minimapinfo.min_y + minimapinfo.map_h/2) << FRACBITS, minimapinfo.zoom);
|
||||
}
|
||||
|
||||
/** Loads a level from a lump or external wad.
|
||||
*
|
||||
* \param skipprecip If true, don't spawn precipitation.
|
||||
@@ -2532,9 +2608,6 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
|
||||
P_LevelInitStuff(reloadinggamestate);
|
||||
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
postimgtype[i] = postimg_none;
|
||||
|
||||
if (mapheaderinfo[gamemap-1]->forcecharacter[0] != '\0'
|
||||
&& atoi(mapheaderinfo[gamemap-1]->forcecharacter) != 255)
|
||||
P_ForceCharacter(mapheaderinfo[gamemap-1]->forcecharacter);
|
||||
@@ -2545,18 +2618,11 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
|
||||
if (!dedicated)
|
||||
{
|
||||
if (!cv_chasecam.changed)
|
||||
CV_SetValue(&cv_chasecam, chase);
|
||||
|
||||
// same for second player
|
||||
if (!cv_chasecam2.changed)
|
||||
CV_SetValue(&cv_chasecam2, chase);
|
||||
|
||||
if (!cv_chasecam3.changed)
|
||||
CV_SetValue(&cv_chasecam3, chase);
|
||||
|
||||
if (!cv_chasecam4.changed)
|
||||
CV_SetValue(&cv_chasecam4, chase);
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
if (!cv_chasecam[i].changed)
|
||||
CV_SetValue(&cv_chasecam[i], chase);
|
||||
}
|
||||
}
|
||||
|
||||
// Initial height of PointOfView
|
||||
@@ -2628,7 +2694,7 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
// As oddly named as this is, this handles music only.
|
||||
// We should be fine starting it here.
|
||||
if (!reloadinggamestate)
|
||||
S_Start();
|
||||
S_InitMapMusic();
|
||||
|
||||
levelfadecol = (encoremode && !ranspecialwipe ? 122 : 120);
|
||||
|
||||
@@ -2687,6 +2753,8 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
R_ClearLevelSplats();
|
||||
#endif
|
||||
|
||||
mobjcache = NULL;
|
||||
|
||||
R_InitializeLevelInterpolators();
|
||||
|
||||
P_InitThinkers();
|
||||
@@ -2738,6 +2806,8 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
|
||||
P_SpawnSecretItems(loademblems);
|
||||
|
||||
P_InitMinimapInfo();
|
||||
|
||||
for (numcoopstarts = 0; numcoopstarts < MAXPLAYERS; numcoopstarts++)
|
||||
if (!playerstarts[numcoopstarts])
|
||||
break;
|
||||
@@ -2844,8 +2914,9 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
: mapheaderinfo[gamemap - 1]->numlaps);
|
||||
|
||||
// Start recording replay in multiplayer with a temp filename
|
||||
//Ensure dedis only record a replay if there is a player at the start of the map, otherwise we get invalid replays!
|
||||
if (!demo.playback && multiplayer && D_NumPlayers()) {
|
||||
// Ensure dedis only record a replay if there is a player at the start of the map, otherwise we get invalid replays!
|
||||
if (!demo.playback && multiplayer && D_NumPlayers())
|
||||
{
|
||||
static char buf[256];
|
||||
sprintf(buf, "replay"PATHSEP"online"PATHSEP"%d-%s", (int) (time(NULL)), G_BuildMapName(gamemap));
|
||||
|
||||
@@ -2948,12 +3019,12 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate)
|
||||
G_CopyTiccmd(&players[i].cmd, &netcmds[buf][i], 1);
|
||||
}
|
||||
P_PreTicker(2);
|
||||
LUAh_MapLoad();
|
||||
if (!reloadinggamestate)
|
||||
LUA_HookInt(gamemap, HOOK(MapLoad));
|
||||
}
|
||||
|
||||
if (rendermode != render_none && !reloadinggamestate)
|
||||
{
|
||||
R_ResetViewInterpolation(0);
|
||||
R_ResetViewInterpolation(0);
|
||||
R_UpdateMobjInterpolators();
|
||||
}
|
||||
@@ -3099,11 +3170,6 @@ UINT16 P_PartialAddWadFile(const char *wadfilename, boolean local)
|
||||
//
|
||||
S_LoadMusicDefs(wadnum);
|
||||
|
||||
//
|
||||
// edit music defs for stuff like musictest
|
||||
//
|
||||
S_LoadMTDefs(wadnum);
|
||||
|
||||
//
|
||||
// search for maps
|
||||
//
|
||||
|
||||
@@ -88,6 +88,11 @@ SINT8 P_PartialAddGetStage(void);
|
||||
|
||||
boolean P_RunSOC(const char *socfilename);
|
||||
void P_WriteThings(lumpnum_t lump);
|
||||
|
||||
#if defined (WALLSPLATS) || defined (FLOORSPLATS)
|
||||
fixed_t P_SegLength(seg_t *seg);
|
||||
#endif
|
||||
|
||||
void P_UpdateSegLightOffset(seg_t *li);
|
||||
size_t P_PrecacheLevelFlats(void);
|
||||
void P_AllocMapHeader(INT16 i);
|
||||
|
||||
+40
-80
@@ -38,66 +38,21 @@ static INT32 sightcounts[2];
|
||||
//
|
||||
// Returns side 0 (front), 1 (back), or 2 (on).
|
||||
//
|
||||
static INT32 P_DivlineSide(fixed_t x, fixed_t y, divline_t *node)
|
||||
// killough 4/19/98: made static, cleaned up
|
||||
static INT32 P_DivlineSide(fixed_t x, fixed_t y, const divline_t *node)
|
||||
{
|
||||
fixed_t dx, dy, left, right;
|
||||
|
||||
if (!node->dx)
|
||||
{
|
||||
if (x == node->x)
|
||||
return 2;
|
||||
|
||||
if (x <= node->x)
|
||||
return (node->dy > 0);
|
||||
|
||||
return (node->dy < 0);
|
||||
}
|
||||
|
||||
if (!node->dy)
|
||||
{
|
||||
if (y == node->y)
|
||||
return 2;
|
||||
|
||||
if (y <= node->y)
|
||||
return (node->dx < 0);
|
||||
|
||||
return (node->dx > 0);
|
||||
}
|
||||
|
||||
dx = x - node->x;
|
||||
dy = y - node->y;
|
||||
|
||||
left = (node->dy>>FRACBITS) * (dx>>FRACBITS);
|
||||
right = (dy>>FRACBITS) * (node->dx>>FRACBITS);
|
||||
|
||||
if (right < left)
|
||||
return 0; // front side
|
||||
|
||||
if (left == right)
|
||||
return 2;
|
||||
|
||||
return 1; // back side
|
||||
fixed_t left, right;
|
||||
return
|
||||
!node->dx ? x == node->x ? 2 : x <= node->x ? node->dy > 0 : node->dy < 0 :
|
||||
!node->dy ? y == node->y ? 2 : y <= node->y ? node->dx < 0 : node->dx > 0 :
|
||||
(right = ((y - node->y) >> FRACBITS) * (node->dx >> FRACBITS)) <
|
||||
(left = ((x - node->x) >> FRACBITS) * (node->dy >> FRACBITS)) ? 0 :
|
||||
right == left ? 2 : 1;
|
||||
}
|
||||
|
||||
//
|
||||
// P_InterceptVector2
|
||||
//
|
||||
// Returns the fractional intercept point along the first divline.
|
||||
// This is only called by the addthings and addlines traversers.
|
||||
//
|
||||
static fixed_t P_InterceptVector2(divline_t *v2, divline_t *v1)
|
||||
static INT32 P_DivlineCrossed(fixed_t x1, fixed_t y1, fixed_t x2, fixed_t y2, const divline_t *node)
|
||||
{
|
||||
fixed_t frac, num, den;
|
||||
|
||||
den = FixedMul(v1->dy>>8, v2->dx) - FixedMul(v1->dx>>8, v2->dy);
|
||||
|
||||
if (!den)
|
||||
return 0;
|
||||
|
||||
num = FixedMul((v1->x - v2->x)>>8, v1->dy) + FixedMul((v2->y - v1->y)>>8, v1->dx);
|
||||
frac = FixedDiv(num, den);
|
||||
|
||||
return frac;
|
||||
return (P_DivlineSide(x1, y1, node) == P_DivlineSide(x2, y2, node));
|
||||
}
|
||||
|
||||
static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
||||
@@ -135,23 +90,21 @@ static boolean P_CrossSubsecPolyObj(polyobj_t *po, register los_t *los)
|
||||
v2 = line->v2;
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(v1->x, v1->y, &los->strace) ==
|
||||
P_DivlineSide(v2->x, v2->y, &los->strace))
|
||||
if (P_DivlineCrossed(v1->x, v1->y, v2->x, v2->y, &los->strace))
|
||||
continue;
|
||||
|
||||
divl.dx = v2->x - (divl.x = v1->x);
|
||||
divl.dy = v2->y - (divl.y = v1->y);
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(los->strace.x, los->strace.y, &divl) ==
|
||||
P_DivlineSide(los->t2x, los->t2y, &divl))
|
||||
if (P_DivlineCrossed(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl))
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided
|
||||
//if (!(po->flags & POF_TESTHEIGHT))
|
||||
//return false;
|
||||
|
||||
frac = P_InterceptVector2(&los->strace, &divl);
|
||||
frac = P_InterceptVector(&los->strace, &divl);
|
||||
|
||||
// get slopes of top and bottom of this polyobject line
|
||||
topslope = FixedDiv(polysec->ceilingheight - los->sightzstart , frac);
|
||||
@@ -232,16 +185,14 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
v2 = line->v2;
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(v1->x, v1->y, &los->strace) ==
|
||||
P_DivlineSide(v2->x, v2->y, &los->strace))
|
||||
if (P_DivlineCrossed(v1->x, v1->y, v2->x, v2->y, &los->strace))
|
||||
continue;
|
||||
|
||||
divl.dx = v2->x - (divl.x = v1->x);
|
||||
divl.dy = v2->y - (divl.y = v1->y);
|
||||
|
||||
// line isn't crossed?
|
||||
if (P_DivlineSide(los->strace.x, los->strace.y, &divl) ==
|
||||
P_DivlineSide(los->t2x, los->t2y, &divl))
|
||||
if (P_DivlineCrossed(los->strace.x, los->strace.y, los->t2x, los->t2y, &divl))
|
||||
continue;
|
||||
|
||||
// stop because it is not two sided anyway
|
||||
@@ -249,7 +200,7 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
return false;
|
||||
|
||||
// calculate fractional intercept (how far along we are divided by how far we are from t2)
|
||||
frac = P_InterceptVector2(&los->strace, &divl);
|
||||
frac = P_InterceptVector(&los->strace, &divl);
|
||||
|
||||
front = seg->frontsector;
|
||||
back = seg->backsector;
|
||||
@@ -348,25 +299,34 @@ static boolean P_CrossSubsector(size_t num, register los_t *los)
|
||||
// if strace crosses the given node successfully.
|
||||
//
|
||||
// killough 4/20/98: rewritten to remove tail recursion, clean up, and optimize
|
||||
|
||||
static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los)
|
||||
static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los, boolean fast)
|
||||
{
|
||||
while (!(bspnum & NF_SUBSECTOR))
|
||||
{
|
||||
register node_t *bsp = nodes + bspnum;
|
||||
INT32 side = P_DivlineSide(los->strace.x,los->strace.y,(divline_t *)bsp)&1;
|
||||
if (side == P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp))
|
||||
bspnum = bsp->children[side]; // doesn't touch the other side
|
||||
else // the partition plane is crossed here
|
||||
|
||||
INT32 side = (fast ? R_PointOnSideFast(los->strace.x, los->strace.y, bsp) : (P_DivlineSide(los->strace.x,los->strace.y, (divline_t *)bsp) & 1));
|
||||
INT32 side2 = (fast ? R_PointOnSideFast(los->t2x, los->t2y, bsp) : P_DivlineSide(los->t2x, los->t2y, (divline_t *) bsp));
|
||||
|
||||
if (side == side2)
|
||||
{
|
||||
if (!P_CrossBSPNode(bsp->children[side], los))
|
||||
return 0; // cross the starting side
|
||||
bspnum = bsp->children[side]; // doesn't touch the other side
|
||||
}
|
||||
else
|
||||
{
|
||||
// the partition plane is crossed here
|
||||
if (!P_CrossBSPNode(bsp->children[side], los, fast))
|
||||
{
|
||||
return false; // cross the starting side
|
||||
}
|
||||
else
|
||||
bspnum = bsp->children[side^1]; // cross the ending side
|
||||
{
|
||||
bspnum = bsp->children[side^1]; // cross the ending side
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los);
|
||||
|
||||
return P_CrossSubsector((bspnum == -1 ? 0 : bspnum & ~NF_SUBSECTOR), los);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -375,7 +335,7 @@ static boolean P_CrossBSPNode(INT32 bspnum, register los_t *los)
|
||||
// Returns true if a straight line between t1 and t2 is unobstructed.
|
||||
// Uses REJECT.
|
||||
//
|
||||
boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
||||
boolean P_CheckSight2(mobj_t *t1, mobj_t *t2, boolean fast)
|
||||
{
|
||||
const sector_t *s1, *s2;
|
||||
size_t pnum;
|
||||
@@ -492,5 +452,5 @@ boolean P_CheckSight(mobj_t *t1, mobj_t *t2)
|
||||
}
|
||||
|
||||
// the head node is the last node output
|
||||
return P_CrossBSPNode((INT32)numnodes - 1, &los);
|
||||
}
|
||||
return (P_CrossBSPNode((INT32)numnodes - 1, &los, fast));
|
||||
}
|
||||
+34
-74
@@ -364,11 +364,11 @@ void P_SpawnSlope_Line(int linenum)
|
||||
// In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef
|
||||
|
||||
fslope = line->frontsector->f_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 1;
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 1;
|
||||
|
||||
// Now remember that f_slope IS a vector
|
||||
// fslope->o = origin 3D point 1 of the vector
|
||||
@@ -425,11 +425,11 @@ void P_SpawnSlope_Line(int linenum)
|
||||
dz = FixedDiv(origin.z - point.z, extent);
|
||||
|
||||
cslope = line->frontsector->c_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 2;
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 2;
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
@@ -494,11 +494,11 @@ void P_SpawnSlope_Line(int linenum)
|
||||
dz = FixedDiv(origin.z - point.z, extent);
|
||||
|
||||
fslope = line->backsector->f_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 3;
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 3;
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
@@ -531,6 +531,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
|
||||
P_CalculateSlopeNormal(fslope);
|
||||
}
|
||||
|
||||
if (backceil)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
@@ -540,11 +541,11 @@ void P_SpawnSlope_Line(int linenum)
|
||||
dz = FixedDiv(origin.z - point.z, extent);
|
||||
|
||||
cslope = line->backsector->c_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 4;
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 4;
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
@@ -604,7 +605,8 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
||||
memset(ret->vertices, 0, 3*sizeof(mapthing_t));
|
||||
|
||||
// And... look for the vertices in question.
|
||||
for (i = 0; i < nummapthings; i++, mt++) {
|
||||
for (i = 0; i < nummapthings; i++, mt++)
|
||||
{
|
||||
if (mt->type != 750) // Haha, I'm hijacking the old Chaos Spawn thingtype for something!
|
||||
continue;
|
||||
|
||||
@@ -617,7 +619,8 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
||||
}
|
||||
|
||||
// Now set heights for each vertex, because they haven't been set yet
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
mt = ret->vertices[i];
|
||||
if (!mt) // If a vertex wasn't found, it's game over. There's nothing you can do to recover (except maybe try and kill the slope instead - TODO?)
|
||||
I_Error("P_NewVertexSlope: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1);
|
||||
@@ -649,23 +652,23 @@ static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flag
|
||||
//
|
||||
void P_CopySectorSlope(line_t *line)
|
||||
{
|
||||
sector_t *fsec = line->frontsector;
|
||||
int i, special = line->special;
|
||||
sector_t *fsec = line->frontsector;
|
||||
int i, special = line->special;
|
||||
|
||||
// Check for copy linedefs
|
||||
for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *srcsec = sectors + i;
|
||||
// Check for copy linedefs
|
||||
for(i = -1; (i = P_FindSectorFromLineTag(line, i)) >= 0;)
|
||||
{
|
||||
sector_t *srcsec = sectors + i;
|
||||
|
||||
if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
|
||||
fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
|
||||
if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
|
||||
fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
|
||||
}
|
||||
if((special - 719) & 1 && !fsec->f_slope && srcsec->f_slope)
|
||||
fsec->f_slope = srcsec->f_slope; //P_CopySlope(srcsec->f_slope);
|
||||
if((special - 719) & 2 && !fsec->c_slope && srcsec->c_slope)
|
||||
fsec->c_slope = srcsec->c_slope; //P_CopySlope(srcsec->c_slope);
|
||||
}
|
||||
|
||||
fsec->hasslope = true;
|
||||
fsec->hasslope = true;
|
||||
|
||||
line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
|
||||
line->special = 0; // Linedef was use to set slopes, it finished its job, so now make it a normal linedef
|
||||
}
|
||||
|
||||
//
|
||||
@@ -790,49 +793,6 @@ void P_ResetDynamicSlopes(void)
|
||||
// Various utilities related to slopes
|
||||
//
|
||||
|
||||
//
|
||||
// P_GetZAt
|
||||
//
|
||||
// Returns the height of the sloped plane at (x, y) as a fixed_t
|
||||
//
|
||||
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y)
|
||||
{
|
||||
fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) +
|
||||
FixedMul(y - slope->o.y, slope->d.y);
|
||||
|
||||
return slope->o.z + FixedMul(dist, slope->zdelta);
|
||||
}
|
||||
|
||||
// Returns the height of the sector floor at (x, y)
|
||||
fixed_t P_GetSectorFloorZAt(const sector_t *sector, fixed_t x, fixed_t y)
|
||||
{
|
||||
return sector->f_slope ? P_GetZAt(sector->f_slope, x, y) : sector->floorheight;
|
||||
}
|
||||
|
||||
// Returns the height of the sector ceiling at (x, y)
|
||||
fixed_t P_GetSectorCeilingZAt(const sector_t *sector, fixed_t x, fixed_t y)
|
||||
{
|
||||
return sector->c_slope ? P_GetZAt(sector->c_slope, x, y) : sector->ceilingheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF top at (x, y)
|
||||
fixed_t P_GetFFloorTopZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y)
|
||||
{
|
||||
return *ffloor->t_slope ? P_GetZAt(*ffloor->t_slope, x, y) : *ffloor->topheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF bottom at (x, y)
|
||||
fixed_t P_GetFFloorBottomZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y)
|
||||
{
|
||||
return *ffloor->b_slope ? P_GetZAt(*ffloor->b_slope, x, y) : *ffloor->bottomheight;
|
||||
}
|
||||
|
||||
// Returns the height of the light list at (x, y)
|
||||
fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y)
|
||||
{
|
||||
return light->slope ? P_GetZAt(light->slope, x, y) : light->height;
|
||||
}
|
||||
|
||||
//
|
||||
// P_QuantizeMomentumToSlope
|
||||
//
|
||||
|
||||
+37
-8
@@ -13,9 +13,12 @@
|
||||
#ifndef P_SLOPES_H__
|
||||
#define P_SLOPES_H__
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
void P_CalculateSlopeNormal(pslope_t *slope);
|
||||
void P_ResetDynamicSlopes(void);
|
||||
void P_RunDynamicSlopes(void);
|
||||
|
||||
// P_SpawnSlope_Line
|
||||
// Creates one or more slopes based on the given line type and front/back
|
||||
// sectors.
|
||||
@@ -30,19 +33,45 @@ void P_CopySectorSlope(line_t *line);
|
||||
|
||||
pslope_t *P_SlopeById(UINT16 id);
|
||||
|
||||
//
|
||||
// P_GetZAt
|
||||
//
|
||||
|
||||
// Returns the height of the sloped plane at (x, y) as a fixed_t
|
||||
fixed_t P_GetZAt(pslope_t *slope, fixed_t x, fixed_t y);
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetZAt(pslope_t *z_slope, fixed_t x, fixed_t y)
|
||||
{
|
||||
return z_slope->o.z + FixedMul((FixedMul(x - z_slope->o.x, z_slope->d.x) + FixedMul(y - z_slope->o.y, z_slope->d.y)), z_slope->zdelta);
|
||||
}
|
||||
|
||||
// Returns the height of the sector at (x, y)
|
||||
fixed_t P_GetSectorFloorZAt (const sector_t *sector, fixed_t x, fixed_t y);
|
||||
fixed_t P_GetSectorCeilingZAt(const sector_t *sector, fixed_t x, fixed_t y);
|
||||
// Returns the height of the sector floor at (x, y)
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetSectorFloorZAt(const sector_t *z_sector, fixed_t x, fixed_t y)
|
||||
{
|
||||
return z_sector->f_slope ? P_GetZAt(z_sector->f_slope, x, y) : z_sector->floorheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF at (x, y)
|
||||
fixed_t P_GetFFloorTopZAt (const ffloor_t *ffloor, fixed_t x, fixed_t y);
|
||||
fixed_t P_GetFFloorBottomZAt(const ffloor_t *ffloor, fixed_t x, fixed_t y);
|
||||
// Returns the height of the sector ceiling at (x, y)
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetSectorCeilingZAt(const sector_t *z_sector, fixed_t x, fixed_t y)
|
||||
{
|
||||
return z_sector->c_slope ? P_GetZAt(z_sector->c_slope, x, y) : z_sector->ceilingheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF top at (x, y)
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetFFloorTopZAt(const ffloor_t *z_ffloor, fixed_t x, fixed_t y)
|
||||
{
|
||||
return *z_ffloor->t_slope ? P_GetZAt(*z_ffloor->t_slope, x, y) : *z_ffloor->topheight;
|
||||
}
|
||||
|
||||
// Returns the height of the FOF bottom at (x, y)
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetFFloorBottomZAt(const ffloor_t *z_ffloor, fixed_t x, fixed_t y)
|
||||
{
|
||||
return *z_ffloor->b_slope ? P_GetZAt(*z_ffloor->b_slope, x, y) : *z_ffloor->bottomheight;
|
||||
}
|
||||
|
||||
// Returns the height of the light list at (x, y)
|
||||
fixed_t P_GetLightZAt(const lightlist_t *light, fixed_t x, fixed_t y);
|
||||
FUNCINLINE static ATTRINLINE fixed_t P_GetLightZAt(const lightlist_t *z_light, fixed_t x, fixed_t y)
|
||||
{
|
||||
return z_light->slope ? P_GetZAt(z_light->slope, x, y) : z_light->height;
|
||||
}
|
||||
|
||||
// Lots of physics-based bullshit
|
||||
void P_QuantizeMomentumToSlope(vector3_t *momentum, pslope_t *slope);
|
||||
|
||||
Loaded 100 of 151 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user