mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 22:56:30 -10:00
Compare commits
1184
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d1334e5a3 | ||
|
|
bbd2b65616 | ||
|
|
55d6cb4b70 | ||
|
|
fe88ab1396 | ||
|
|
4179e85caf | ||
|
|
b73dcd739b | ||
|
|
c1a82b09d6 | ||
|
|
75e8b56828 | ||
|
|
205fc23b91 | ||
|
|
49a65b4ea8 | ||
|
|
d8351b5cb9 | ||
|
|
50306334bc | ||
|
|
7e3012fec1 | ||
|
|
28b190122d | ||
|
|
caa37d9b86 | ||
|
|
8a36ebd73e | ||
|
|
8890cec34b | ||
|
|
d2bcd90e9e | ||
|
|
017d7b1cb8 | ||
|
|
fccb7eaf69 | ||
|
|
6b94ed3308 | ||
|
|
cee0940c17 | ||
|
|
5663c4933a | ||
|
|
1292005d71 | ||
|
|
598598d26c | ||
|
|
4d6d45dd76 | ||
|
|
efe030c058 | ||
|
|
8b4b35be0a | ||
|
|
f51a10c546 | ||
|
|
c1acb96dc6 | ||
|
|
0952771b72 | ||
|
|
f116ff4f58 | ||
|
|
f6c794bd85 | ||
|
|
cc72eb1d2a | ||
|
|
68265ecfc9 | ||
|
|
adb71b42b6 | ||
|
|
bd372c46ec | ||
|
|
a62183fd64 | ||
|
|
74f451ab2e | ||
|
|
f98a3ba721 | ||
|
|
33e28ed71e | ||
|
|
2518d7d7a9 | ||
|
|
391ae75979 | ||
|
|
fa1270f62d | ||
|
|
7e583ad5d6 | ||
|
|
46386e5ee0 | ||
|
|
40442a6cc4 | ||
|
|
b783360750 | ||
|
|
5507bf9c95 | ||
|
|
dcb66b4ce6 | ||
|
|
d13386b02b | ||
|
|
9f64817f7d | ||
|
|
80a248e214 | ||
|
|
6e816fc2d3 | ||
|
|
0357abd27d | ||
|
|
98ab82451e | ||
|
|
ae0211df31 | ||
|
|
a71dd6e5c5 | ||
|
|
f3d6636fb9 | ||
|
|
499bfccdf3 | ||
|
|
10b4d8ef73 | ||
|
|
f7db8ee7d1 | ||
|
|
20de684fcd | ||
|
|
0b285d1ce5 | ||
|
|
85e806405c | ||
|
|
94d2d6da1d | ||
|
|
6d83162a72 | ||
|
|
995961bd93 | ||
|
|
f9e97e03dc | ||
|
|
87363eba75 | ||
|
|
9f2bf811be | ||
|
|
49735a9631 | ||
|
|
7d7d365d9c | ||
|
|
eff4e44151 | ||
|
|
ce5aa8edfb | ||
|
|
e28c203461 | ||
|
|
87d2843cfc | ||
|
|
09e9dbec4d | ||
|
|
35309cc15a | ||
|
|
f851a3190b | ||
|
|
a646e617ff | ||
|
|
9872bd0bc3 | ||
|
|
e01b990494 | ||
|
|
1000c46fe9 | ||
|
|
73c9b0e749 | ||
|
|
421fc46b42 | ||
|
|
66fd939231 | ||
|
|
725bfc17df | ||
|
|
2cde2c8e46 | ||
|
|
9e9b151960 | ||
|
|
5c563c5cb8 | ||
|
|
b8818d6cfc | ||
|
|
a081773563 | ||
|
|
cb3401e03a | ||
|
|
222b984cc3 | ||
|
|
0fda3d1fbd | ||
|
|
4e3fb69600 | ||
|
|
0ee8aac766 | ||
|
|
ca91178cbe | ||
|
|
c619247b02 | ||
|
|
3708fb1de7 | ||
|
|
4602e63dc1 | ||
|
|
d9cf3916f4 | ||
|
|
2c6bc53193 | ||
|
|
61ccec1abd | ||
|
|
c8bc719c4c | ||
|
|
3817a704ff | ||
|
|
1a62ef0b68 | ||
|
|
d37906f041 | ||
|
|
d77c090eaf | ||
|
|
8a5dc41e2e | ||
|
|
2dd43251ec | ||
|
|
9719b83766 | ||
|
|
9fb769900b | ||
|
|
9b12500fe1 | ||
|
|
2d0bde22e4 | ||
|
|
f0b3d37762 | ||
|
|
2f1745b9c8 | ||
|
|
db06ce05c1 | ||
|
|
9e830fd82d | ||
|
|
e4dfa534f6 | ||
|
|
9ad5b3686f | ||
|
|
2bb5300132 | ||
|
|
ed4f880369 | ||
|
|
01f6ac2148 | ||
|
|
253e12878c | ||
|
|
7b18d839ca | ||
|
|
b1f5390f90 | ||
|
|
c85ed21a50 | ||
|
|
a8daa191bf | ||
|
|
95f0ce016e | ||
|
|
6328625e63 | ||
|
|
2f84efb076 | ||
|
|
1c19a2bfa5 | ||
|
|
9a494bb545 | ||
|
|
f7cc6399c4 | ||
|
|
f996cbb2c0 | ||
|
|
d4e507ad41 | ||
|
|
25d1addbed | ||
|
|
295a57cc65 | ||
|
|
c54410f177 | ||
|
|
1ffb472245 | ||
|
|
db538a19d7 | ||
|
|
ba26e4690f | ||
|
|
478543cd73 | ||
|
|
e21deb998a | ||
|
|
7cc52df168 | ||
|
|
32304b128a | ||
|
|
fe0b2855ee | ||
|
|
5398dc8206 | ||
|
|
f0b509911a | ||
|
|
a13064936a | ||
|
|
a14b57d6f5 | ||
|
|
23d5e01508 | ||
|
|
b48172ce1b | ||
|
|
64721e4407 | ||
|
|
6a2a61287d | ||
|
|
08db59549f | ||
|
|
6a02b099da | ||
|
|
e49cd4edb8 | ||
|
|
919bd0d434 | ||
|
|
d9c643bb41 | ||
|
|
1004ffcb54 | ||
|
|
d62d659bf4 | ||
|
|
81833122b8 | ||
|
|
a3ee32e28d | ||
|
|
851732e3e1 | ||
|
|
485e7fcf7e | ||
|
|
c14a21e332 | ||
|
|
55e04969c9 | ||
|
|
b8db2eb59f | ||
|
|
47edc76b69 | ||
|
|
84b8fe77d7 | ||
|
|
28fdeb4a28 | ||
|
|
197a041da5 | ||
|
|
9b657a529b | ||
|
|
3008602982 | ||
|
|
1259c46d3c | ||
|
|
67a5183ad6 | ||
|
|
61162cfd67 | ||
|
|
6a2b0110b9 | ||
|
|
43d061d4f3 | ||
|
|
344c50572a | ||
|
|
2175a959db | ||
|
|
ccd760994b | ||
|
|
775c86a894 | ||
|
|
449f1e2fe5 | ||
|
|
dc7a2d08db | ||
|
|
88d08df966 | ||
|
|
5e8c31dadd | ||
|
|
ea7c3255fc | ||
|
|
e2bc4ff920 | ||
|
|
7500378696 | ||
|
|
3921b2b079 | ||
|
|
15c5c06c7f | ||
|
|
0270ac2c0b | ||
|
|
8842fb64db | ||
|
|
578d70b7cd | ||
|
|
ea73c417ff | ||
|
|
cbf7b33393 | ||
|
|
84e6492488 | ||
|
|
d24b80f395 | ||
|
|
ef175e9271 | ||
|
|
304a1f77a1 | ||
|
|
83012fe0e9 | ||
|
|
4df1fd48c4 | ||
|
|
81480ebcbc | ||
|
|
15628c5f8b | ||
|
|
5427e73ffa | ||
|
|
97982c52d7 | ||
|
|
892fb2ea93 | ||
|
|
4de6d09b64 | ||
|
|
52d9eccb72 | ||
|
|
abed73b3c6 | ||
|
|
5f9b7064c9 | ||
|
|
148ba14b56 | ||
|
|
3abc9fc0f8 | ||
|
|
0de8af2602 | ||
|
|
7f48891579 | ||
|
|
375bad91e6 | ||
|
|
887aa98e05 | ||
|
|
8862debae8 | ||
|
|
d1b28d6c7e | ||
|
|
b4cf700de6 | ||
|
|
cb9c2520bd | ||
|
|
e2c5b17775 | ||
|
|
4a1fa4ce38 | ||
|
|
ad6698346f | ||
|
|
5db635395d | ||
|
|
960d41a0d5 | ||
|
|
457f351954 | ||
|
|
ed3eeb59e4 | ||
|
|
7bb2d44d29 | ||
|
|
c774be5da9 | ||
|
|
b213b72e04 | ||
|
|
1f3ed28920 | ||
|
|
7df06d9b99 | ||
|
|
2b4dd24535 | ||
|
|
2807196e1e | ||
|
|
1665521590 | ||
|
|
0051f2b19f | ||
|
|
8f0d5d7024 | ||
|
|
e3883f2426 | ||
|
|
f006692c72 | ||
|
|
98870cab35 | ||
|
|
7ffbec56f3 | ||
|
|
28979a738d | ||
|
|
5977a382dd | ||
|
|
125f341f10 | ||
|
|
597668dd88 | ||
|
|
7b1cf8dd59 | ||
|
|
c71c1ab1f9 | ||
|
|
85a0250f11 | ||
|
|
dc0d63e1c0 | ||
|
|
1c229c15d0 | ||
|
|
32dd6aafd5 | ||
|
|
1500870bfa | ||
|
|
063342c36b | ||
|
|
f034cb48a1 | ||
|
|
12fc5a9a32 | ||
|
|
2db4db928e | ||
|
|
e03d62eeb7 | ||
|
|
59c1d7a01e | ||
|
|
e24d75cf94 | ||
|
|
8d1c0cd5b2 | ||
|
|
bb89ede9a2 | ||
|
|
8ffc7d031f | ||
|
|
49318711ab | ||
|
|
5e415f7bd4 | ||
|
|
abb7c260b4 | ||
|
|
622f835598 | ||
|
|
039f3a26af | ||
|
|
7cfdb91770 | ||
|
|
f0b9910163 | ||
|
|
1f730b9284 | ||
|
|
90005e98fe | ||
|
|
28fbeef528 | ||
|
|
ba24fb1aee | ||
|
|
a4f4184fe0 | ||
|
|
17b8798fbe | ||
|
|
133e98a434 | ||
|
|
583024a8fa | ||
|
|
9bea5c63e6 | ||
|
|
437733a98e | ||
|
|
366980ab4a | ||
|
|
8fa5d63cb0 | ||
|
|
82d7c503d8 | ||
|
|
7aec8d2a42 | ||
|
|
edc7a3da00 | ||
|
|
e722d89389 | ||
|
|
6f481a3472 | ||
|
|
7c5d87a506 | ||
|
|
ae398ffe8b | ||
|
|
644f1120ed | ||
|
|
edc4c33208 | ||
|
|
1c55a120b8 | ||
|
|
49f283f030 | ||
|
|
c96527a320 | ||
|
|
d363f55686 | ||
|
|
0610b5e051 | ||
|
|
e02157b394 | ||
|
|
1aafce7240 | ||
|
|
a73e6686d0 | ||
|
|
75ecd13e2c | ||
|
|
b3235d9998 | ||
|
|
71cb920cab | ||
|
|
f0f3990738 | ||
|
|
a432fd8699 | ||
|
|
f66759eac1 | ||
|
|
4c8003fb8c | ||
|
|
4a8d5d19d3 | ||
|
|
97778bd8ce | ||
|
|
560ee745ea | ||
|
|
c44cb63459 | ||
|
|
f9cad9acb4 | ||
|
|
c225d664a2 | ||
|
|
78d4b21830 | ||
|
|
349a0cda5f | ||
|
|
ff36b6aa7b | ||
|
|
fdb372e5a3 | ||
|
|
7089596664 | ||
|
|
9ff37eb37e | ||
|
|
dca9ba1202 | ||
|
|
359485654f | ||
|
|
0a858b7b05 | ||
|
|
e4131e25e4 | ||
|
|
b4cc142d08 | ||
|
|
7dbcf77914 | ||
|
|
23176b03dd | ||
|
|
ff31561484 | ||
|
|
6f55648495 | ||
|
|
122ddc2134 | ||
|
|
a110e19177 | ||
|
|
c2700b4b9e | ||
|
|
6a9f82eac5 | ||
|
|
ee91e844ef | ||
|
|
5fbc8f7e23 | ||
|
|
62cfe8b61b | ||
|
|
ef6b1a12f4 | ||
|
|
f2d38d2f13 | ||
|
|
76d763cd8e | ||
|
|
35c25efdc7 | ||
|
|
8eea5e3446 | ||
|
|
1563378777 | ||
|
|
03137abad6 | ||
|
|
48af4d28a9 | ||
|
|
bc45b7c1d8 | ||
|
|
8f8afd10ff | ||
|
|
428dde26e4 | ||
|
|
2b8b24f78a | ||
|
|
33b64ccd98 | ||
|
|
7fa4c0f215 | ||
|
|
ee3624ccdb | ||
|
|
4631e6f31a | ||
|
|
3232327c9d | ||
|
|
f3bc4e0425 | ||
|
|
790810ada9 | ||
|
|
994f25cdf0 | ||
|
|
c70c6005b3 | ||
|
|
63d1922367 | ||
|
|
0c7adec15c | ||
|
|
3230a9eca9 | ||
|
|
313d75276e | ||
|
|
045e29ae29 | ||
|
|
d0bace2c57 | ||
|
|
aa61590ad3 | ||
|
|
a1569ff1c2 | ||
|
|
39ea734595 | ||
|
|
471ed14f14 | ||
|
|
2ce65069fb | ||
|
|
1270b04c97 | ||
|
|
0b959888c7 | ||
|
|
bd620e76dd | ||
|
|
6f2fc71a7c | ||
|
|
24774cf9cc | ||
|
|
79d41f9a59 | ||
|
|
6e69f08e65 | ||
|
|
529e3c47bd | ||
|
|
e01a6293d5 | ||
|
|
e63b108e61 | ||
|
|
744a53ddf0 | ||
|
|
ff0d52b1a4 | ||
|
|
fbc24176cd | ||
|
|
a7987b89be | ||
|
|
448027d119 | ||
|
|
ec269425fd | ||
|
|
7543e00581 | ||
|
|
593ff86eeb | ||
|
|
46acd73b0b | ||
|
|
7ed4e8985d | ||
|
|
151c188018 | ||
|
|
97cb2f5933 | ||
|
|
a4d6350db0 | ||
|
|
d0d7f35c76 | ||
|
|
44f837acf8 | ||
|
|
68ded37681 | ||
|
|
f959265a74 | ||
|
|
01791870bc | ||
|
|
365c12e99f | ||
|
|
d2eaea9a85 | ||
|
|
18606cfb46 | ||
|
|
658730bb4b | ||
|
|
732d7f5561 | ||
|
|
592899a5f5 | ||
|
|
a99518e88d | ||
|
|
e3c8004429 | ||
|
|
343e2537de | ||
|
|
995ce3e17f | ||
|
|
f630e1799e | ||
|
|
ae8c507d37 | ||
|
|
605b490d17 | ||
|
|
ea491e3bed | ||
|
|
159c0affaf | ||
|
|
2d7f231f47 | ||
|
|
1417a0236a | ||
|
|
f7e389eec4 | ||
|
|
4f94da464d | ||
|
|
2e35d7571c | ||
|
|
3575982079 | ||
|
|
6f93eb7ca8 | ||
|
|
4dc7881df8 | ||
|
|
131bac2b53 | ||
|
|
e030989f59 | ||
|
|
51cc8377d2 | ||
|
|
5a75bba686 | ||
|
|
d0ad20c79d | ||
|
|
1fe7c55885 | ||
|
|
f63d3a01f1 | ||
|
|
981c2e4601 | ||
|
|
fe81f39299 | ||
|
|
3460e06701 | ||
|
|
dd41824dc5 | ||
|
|
72f1bb21ab | ||
|
|
95db195410 | ||
|
|
dc2e5a8ef9 | ||
|
|
31f7d6dd34 | ||
|
|
904a63b7e5 | ||
|
|
a8713687ae | ||
|
|
5f7ce77177 | ||
|
|
75f276cff4 | ||
|
|
a35470e783 | ||
|
|
48959c177c | ||
|
|
a0e945bf21 | ||
|
|
a0305a1fc6 | ||
|
|
78f22aea2f | ||
|
|
777a5dbab0 | ||
|
|
0a72f49270 | ||
|
|
d4799821f8 | ||
|
|
b87907a3be | ||
|
|
d950a6d8da | ||
|
|
af4ce5c886 | ||
|
|
7fd2b592b4 | ||
|
|
1e4e53bf80 | ||
|
|
1745959ed7 | ||
|
|
255570da57 | ||
|
|
b24cd07398 | ||
|
|
085db31507 | ||
|
|
092315362e | ||
|
|
6a655dc469 | ||
|
|
b217d73a44 | ||
|
|
d78b715166 | ||
|
|
d55e7cc900 | ||
|
|
443c49cbf9 | ||
|
|
0cbd23c615 | ||
|
|
55f7fdc264 | ||
|
|
7241244f70 | ||
|
|
d0ed305d43 | ||
|
|
b3e0314930 | ||
|
|
41fdb1da08 | ||
|
|
3b2eee464a | ||
|
|
b6980737f0 | ||
|
|
039e34ffaa | ||
|
|
99136873c0 | ||
|
|
7516eae124 | ||
|
|
84a3455035 | ||
|
|
9b86e6966b | ||
|
|
8388a394c1 | ||
|
|
120c01f735 | ||
|
|
189e5fe678 | ||
|
|
fc35ceeffc | ||
|
|
8698cece32 | ||
|
|
30fc4cc19f | ||
|
|
17ac979ae7 | ||
|
|
e37bdddb71 | ||
|
|
be7f62118c | ||
|
|
7079b22535 | ||
|
|
8b414664c5 | ||
|
|
0b89fec44c | ||
|
|
fb90a4caaf | ||
|
|
3e633a7021 | ||
|
|
4f7a1a73c7 | ||
|
|
4dd746e46d | ||
|
|
a89a6f6186 | ||
|
|
6c822c7993 | ||
|
|
67eb07aae2 | ||
|
|
5a34ecf947 | ||
|
|
4df7becbea | ||
|
|
586190fb8e | ||
|
|
2059ed3528 | ||
|
|
fc42a097eb | ||
|
|
ba27712ccd | ||
|
|
02fb161187 | ||
|
|
826be871bc | ||
|
|
6958a3be52 | ||
|
|
6576b9bf69 | ||
|
|
77a4348695 | ||
|
|
f1f9396d4f | ||
|
|
a550f19877 | ||
|
|
aea447768f | ||
|
|
68c7b774e6 | ||
|
|
ce89e0d560 | ||
|
|
111fa9a728 | ||
|
|
001f85c695 | ||
|
|
23ab20680a | ||
|
|
aff41f6382 | ||
|
|
cdfbe82f07 | ||
|
|
8316e86843 | ||
|
|
591a76e0bd | ||
|
|
a9ba9ccea8 | ||
|
|
9d30ba0210 | ||
|
|
5f32fc582f | ||
|
|
c519d635f1 | ||
|
|
272627527b | ||
|
|
1406ef90ec | ||
|
|
fbad2dcdc0 | ||
|
|
b24d6815bc | ||
|
|
a28a052ac6 | ||
|
|
71c2ae7fca | ||
|
|
fb1d118622 | ||
|
|
1dbfce5ea7 | ||
|
|
b4e502737c | ||
|
|
bbefc0b90e | ||
|
|
fe8a8cc8e7 | ||
|
|
dbacdf939b | ||
|
|
728ee7e21f | ||
|
|
0f94de5dd8 | ||
|
|
6351a5becf | ||
|
|
881f1c6077 | ||
|
|
2dfa5cdd45 | ||
|
|
413cdab6b7 | ||
|
|
e4827d8110 | ||
|
|
7fe64c20b0 | ||
|
|
4dfb7611ed | ||
|
|
233a8c3134 | ||
|
|
885ab83dba | ||
|
|
4df106d0e6 | ||
|
|
54707bc916 | ||
|
|
0d4ab080a9 | ||
|
|
3b3aafd920 | ||
|
|
a1509554e7 | ||
|
|
3dd13913da | ||
|
|
6581a79466 | ||
|
|
f8b4ba66bc | ||
|
|
ab323f6b2a | ||
|
|
535f8fc3d6 | ||
|
|
8cba1f3939 | ||
|
|
18ddb1f6ad | ||
|
|
dc3d359393 | ||
|
|
31b5327765 | ||
|
|
622ac05c63 | ||
|
|
6319d41ab6 | ||
|
|
19ea0c5b11 | ||
|
|
9471ebced4 | ||
|
|
fbf776164b | ||
|
|
feee088277 | ||
|
|
1630965ce8 | ||
|
|
bb556e9c7f | ||
|
|
b0ec8041de | ||
|
|
9e329634b3 | ||
|
|
7843ed8770 | ||
|
|
008582fce5 | ||
|
|
8ecfbed208 | ||
|
|
851fc877d0 | ||
|
|
3ff8fff6af | ||
|
|
74ae69a49b | ||
|
|
3df75bed77 | ||
|
|
37034092d4 | ||
|
|
8e98e16796 | ||
|
|
1c2d7163c1 | ||
|
|
0e2d83529b | ||
|
|
c1bc6871c3 | ||
|
|
12c6e04b17 | ||
|
|
d2912daaac | ||
|
|
983881e398 | ||
|
|
822b4d9c01 | ||
|
|
8074a129cd | ||
|
|
844ac565ef | ||
|
|
40eeea76d8 | ||
|
|
c7b5a70830 | ||
|
|
4972df4cdf | ||
|
|
028fd5c930 | ||
|
|
1397a84db7 | ||
|
|
9523481fe2 | ||
|
|
00a413d3b0 | ||
|
|
dd6d061488 | ||
|
|
038cb865be | ||
|
|
f46914eab9 | ||
|
|
a71305bdc3 | ||
|
|
9ef30029aa | ||
|
|
69231d79ff | ||
|
|
22a4cfc835 | ||
|
|
db1c760a3c | ||
|
|
70f831bc22 | ||
|
|
c20117ef22 | ||
|
|
0e92b61ebf | ||
|
|
f36b06ee40 | ||
|
|
5739cfb2d0 | ||
|
|
7b8ff3d087 | ||
|
|
087c0be980 | ||
|
|
1f1153bc57 | ||
|
|
c54e4875bd | ||
|
|
06dc37d064 | ||
|
|
c32522129b | ||
|
|
0f50203063 | ||
|
|
50b2cd65fa | ||
|
|
a036fc3bea | ||
|
|
b2c098ee44 | ||
|
|
1f92bafc8f | ||
|
|
50baf2c401 | ||
|
|
440b39a3ee | ||
|
|
ed45cfb078 | ||
|
|
249bfeb9fe | ||
|
|
68ec71efad | ||
|
|
a42a4ec0f0 | ||
|
|
4504bea340 | ||
|
|
d395341b1c | ||
|
|
a3f509766a | ||
|
|
69130eb9fe | ||
|
|
bac63f2faf | ||
|
|
bedf8a6157 | ||
|
|
947e8b16fb | ||
|
|
fd9f14053a | ||
|
|
4821082a53 | ||
|
|
56774f66d0 | ||
|
|
76b12d5465 | ||
|
|
fcac6d58c2 | ||
|
|
f3dcea6db1 | ||
|
|
030267adf3 | ||
|
|
119a28190f | ||
|
|
dfcf412627 | ||
|
|
386efe7325 | ||
|
|
d63f7075a9 | ||
|
|
a24fde6280 | ||
|
|
c78c8c0a43 | ||
|
|
1fdfc4bca8 | ||
|
|
bf878a6322 | ||
|
|
a77e725968 | ||
|
|
e69a6f945b | ||
|
|
c6e589c31a | ||
|
|
cc62873cb3 | ||
|
|
e27299e03b | ||
|
|
c2d671deac | ||
|
|
70d2885e0b | ||
|
|
ff7451ccc0 | ||
|
|
a09aba049c | ||
|
|
6be13dc50b | ||
|
|
6b54aa9784 | ||
|
|
b5381eb23e | ||
|
|
a600ceca96 | ||
|
|
f4296903ce | ||
|
|
abeaab1602 | ||
|
|
00211ea1f0 | ||
|
|
ca97992985 | ||
|
|
8850cbcb38 | ||
|
|
382e540086 | ||
|
|
b9d5898908 | ||
|
|
20c60b021f | ||
|
|
f81a818afa | ||
|
|
58b5bae0cb | ||
|
|
69e5efdd91 | ||
|
|
811c572cf8 | ||
|
|
0c6f8bbefd | ||
|
|
a58856e0d5 | ||
|
|
9ce18ac6e5 | ||
|
|
5bdb318371 | ||
|
|
3659d10464 | ||
|
|
bf26a96691 | ||
|
|
4625702437 | ||
|
|
438f9360e1 | ||
|
|
d54288be7f | ||
|
|
3f2266581c | ||
|
|
5085b17246 | ||
|
|
ecd3f09e74 | ||
|
|
aa8a4447ef | ||
|
|
0ea465d45f | ||
|
|
6c1468d59d | ||
|
|
345a4b396d | ||
|
|
ed21106256 | ||
|
|
5b28717fec | ||
|
|
85ff0f7030 | ||
|
|
df2d335539 | ||
|
|
144429e984 | ||
|
|
9cf34e208c | ||
|
|
f64849dc72 | ||
|
|
853b8e79f3 | ||
|
|
6a6069354d | ||
|
|
d66b99c9f4 | ||
|
|
c195c0aaf2 | ||
|
|
d7f483708a | ||
|
|
333c370d71 | ||
|
|
c5222f828c | ||
|
|
a828e0e934 | ||
|
|
9c87d92c91 | ||
|
|
833e99e6a7 | ||
|
|
af3332d595 | ||
|
|
97119e182a | ||
|
|
a504a33138 | ||
|
|
cd741318d3 | ||
|
|
d0f50e30e4 | ||
|
|
2ab0a4a032 | ||
|
|
f73d8075c6 | ||
|
|
fc8e4a077e | ||
|
|
83272bbd2f | ||
|
|
153526208d | ||
|
|
d553a0d2c5 | ||
|
|
5732d2f126 | ||
|
|
88950ad717 | ||
|
|
60d1234579 | ||
|
|
74f77cf920 | ||
|
|
7192f32409 | ||
|
|
b1d397e91b | ||
|
|
42cbf081d0 | ||
|
|
ddc47ef2f2 | ||
|
|
931f4f2df6 | ||
|
|
97c87a6bf8 | ||
|
|
85386190d2 | ||
|
|
0ffcef0fc8 | ||
|
|
96645bff74 | ||
|
|
9bd125e1de | ||
|
|
5b549c7d4a | ||
|
|
550ef67140 | ||
|
|
7be677573e | ||
|
|
65bea0960c | ||
|
|
0ddb694d5c | ||
|
|
de6cadea7d | ||
|
|
fd8c41243e | ||
|
|
40193dcfa7 | ||
|
|
75d63a8bb5 | ||
|
|
5d1ca5e7c6 | ||
|
|
a685b68033 | ||
|
|
36da5e1a16 | ||
|
|
ab78ba209c | ||
|
|
4ae7263242 | ||
|
|
b1128630e4 | ||
|
|
b906b0fcce | ||
|
|
b723200206 | ||
|
|
81d967eab5 | ||
|
|
2673720ce8 | ||
|
|
03bb0c45a4 | ||
|
|
8eef49b990 | ||
|
|
40516e52a4 | ||
|
|
7a31d39759 | ||
|
|
2407f4f0d9 | ||
|
|
fa0172afb0 | ||
|
|
2952838d64 | ||
|
|
f9db9a5810 | ||
|
|
a26e7a0a49 | ||
|
|
8400768e9a | ||
|
|
a51ff7379b | ||
|
|
be4fa8cef9 | ||
|
|
8b4df0aaff | ||
|
|
85bd57fb74 | ||
|
|
3dba61c334 | ||
|
|
84d991e191 | ||
|
|
e4fd785fbd | ||
|
|
54a3a76774 | ||
|
|
8a20ab1088 | ||
|
|
2d41918dae | ||
|
|
dae81d157b | ||
|
|
a014e5227c | ||
|
|
633bca17d9 | ||
|
|
e19e89b20f | ||
|
|
9eba78035a | ||
|
|
68a26cf7d5 | ||
|
|
e3077951ca | ||
|
|
9d79b2e8d5 | ||
|
|
ecd3cddeca | ||
|
|
38de54f03a | ||
|
|
49d25dce7c | ||
|
|
e4d74ff3cb | ||
|
|
c789bf7509 | ||
|
|
ee26a8a8f6 | ||
|
|
06540c61b3 | ||
|
|
72a5f1fa53 | ||
|
|
ba13b76ffe | ||
|
|
a70d0b3144 | ||
|
|
a853432699 | ||
|
|
afa8c96236 | ||
|
|
88c4e9880b | ||
|
|
4ffaf24ab8 | ||
|
|
c2c4c1a4ea | ||
|
|
c09b89127b | ||
|
|
291215d6a9 | ||
|
|
23e73f2b0d | ||
|
|
6f7f3296e0 | ||
|
|
6c89a3310c | ||
|
|
579972dd62 | ||
|
|
c7916f4483 | ||
|
|
3dff6606f2 | ||
|
|
69ab027ecf | ||
|
|
ee175fcfd3 | ||
|
|
bf2a2cf7cc | ||
|
|
0094f97f3c | ||
|
|
77cc78e5e7 | ||
|
|
6f1eed006f | ||
|
|
5b09ed5b78 | ||
|
|
86ad73d71b | ||
|
|
5017882299 | ||
|
|
7d6f0afc73 | ||
|
|
8989ee4abf | ||
|
|
c85f1bfa4e | ||
|
|
0fe03690f8 | ||
|
|
227298f10b | ||
|
|
388fa7ac45 | ||
|
|
926c12c560 | ||
|
|
8cafc52ff3 | ||
|
|
6483947732 | ||
|
|
8b6dab73be | ||
|
|
0d8d459deb | ||
|
|
5f9778d505 | ||
|
|
a023302cbb | ||
|
|
5937327c44 | ||
|
|
f29529494c | ||
|
|
a1d0a19ec5 | ||
|
|
55635a499e | ||
|
|
582b4ea365 | ||
|
|
718e2a71ec | ||
|
|
97c909de30 | ||
|
|
0a49604e83 | ||
|
|
7a2c197144 | ||
|
|
82a82b2bae | ||
|
|
9aa9bfaaf1 | ||
|
|
134a3668ae | ||
|
|
00b0a8d148 | ||
|
|
6111162808 | ||
|
|
63d43fbfb0 | ||
|
|
6f2275c4ab | ||
|
|
55b3af43e8 | ||
|
|
144f8f3a4b | ||
|
|
0b5a25446a | ||
|
|
1ddc459df6 | ||
|
|
cfe8a03ff3 | ||
|
|
3e4f71fe29 | ||
|
|
f236be7241 | ||
|
|
18ac53bb5d | ||
|
|
ebd866660e | ||
|
|
4a4e834199 | ||
|
|
eee1d07cf5 | ||
|
|
6539724237 | ||
|
|
21bb39d102 | ||
|
|
4a93077ddf | ||
|
|
30c6e6582b | ||
|
|
b8e4e24434 | ||
|
|
926b788fc9 | ||
|
|
c425a9c12b | ||
|
|
15e395f6a4 | ||
|
|
cf35f79402 | ||
|
|
431812cd6d | ||
|
|
d0cf0ced4a | ||
|
|
a6dbf2facd | ||
|
|
56da3a6bf6 | ||
|
|
55323b32f1 | ||
|
|
49c005525e | ||
|
|
fafb5bd1e8 | ||
|
|
075fdeaa5c | ||
|
|
065ec54a46 | ||
|
|
e7eb31a0df | ||
|
|
d340b8da04 | ||
|
|
a17eca915c | ||
|
|
149629e1e2 | ||
|
|
05948719b1 | ||
|
|
c2e4c526d0 | ||
|
|
4da2a92335 | ||
|
|
65b1250353 | ||
|
|
562cf1e47a | ||
|
|
7ae710ace6 | ||
|
|
611ce79893 | ||
|
|
5ceb4a2291 | ||
|
|
4f719b2c4d | ||
|
|
4b5f47441b | ||
|
|
6b3c4a3bbe | ||
|
|
2f8c97d99d | ||
|
|
3d527efc50 | ||
|
|
7dd62135a3 | ||
|
|
4071a37ef4 | ||
|
|
dd6eea5406 | ||
|
|
840a2b37b5 | ||
|
|
762d41f41c | ||
|
|
e0b48bec6f | ||
|
|
28b3a8cffa | ||
|
|
431335b27d | ||
|
|
237ae621a4 | ||
|
|
f959999594 | ||
|
|
997d57faae | ||
|
|
1f2a891c7a | ||
|
|
911528b6d7 | ||
|
|
9b6620e21c | ||
|
|
17fc45faba | ||
|
|
59add586e3 | ||
|
|
bb472f8669 | ||
|
|
2f807f5793 | ||
|
|
a770aeab31 | ||
|
|
afa8e9b947 | ||
|
|
6c733d9f7b | ||
|
|
4474d26e5b | ||
|
|
9ca91d3518 | ||
|
|
d4823f735a | ||
|
|
4f87d063b8 | ||
|
|
eaae1243e6 | ||
|
|
3ce44dcdfa | ||
|
|
17f4291b70 | ||
|
|
31019d38a2 | ||
|
|
bca69ce180 | ||
|
|
f56c5d230e | ||
|
|
45caba7c72 | ||
|
|
0fc13dfa87 | ||
|
|
f5b60aa156 | ||
|
|
023d5ffab0 | ||
|
|
a4760e9c70 | ||
|
|
a58587d3a5 | ||
|
|
3b35a4f9c1 | ||
|
|
6ddaabcead | ||
|
|
d706747bd1 | ||
|
|
503ea74554 | ||
|
|
128a6d840f | ||
|
|
a0b4747c57 | ||
|
|
e237b9d8ba | ||
|
|
0bd342af4a | ||
|
|
1c8018a5ab | ||
|
|
5760eaf5fc | ||
|
|
ea4341a938 | ||
|
|
a410c7f132 | ||
|
|
83f954520c | ||
|
|
29963bfe39 | ||
|
|
163b45fdab | ||
|
|
73eda1ee69 | ||
|
|
2ea42c0928 | ||
|
|
af3afff65c | ||
|
|
1651717c41 | ||
|
|
71b718a3b9 | ||
|
|
c619e7b3b7 | ||
|
|
6e5ee3312d | ||
|
|
14b29354bb | ||
|
|
9460f0c613 | ||
|
|
ff083e9600 | ||
|
|
008a450cfd | ||
|
|
1e5edb91a7 | ||
|
|
863475d8d0 | ||
|
|
5194bb5f80 | ||
|
|
2c6f07a416 | ||
|
|
664c3bf797 | ||
|
|
031b923385 | ||
|
|
db75f373b3 | ||
|
|
d2badfc49e | ||
|
|
200588c3b0 | ||
|
|
5511c94080 | ||
|
|
e4460b46f3 | ||
|
|
bd3855b315 | ||
|
|
00f6a2ee32 | ||
|
|
4594df128c | ||
|
|
a3b330bdf5 | ||
|
|
01a1403f67 | ||
|
|
a09c6beb5c | ||
|
|
d589bcd911 | ||
|
|
401dbfc523 | ||
|
|
6cc7c6fcbd | ||
|
|
7e37fee039 | ||
|
|
0e2d84c60e | ||
|
|
647a03d53c | ||
|
|
97e7b62860 | ||
|
|
da03d81df6 | ||
|
|
194717b0c8 | ||
|
|
ccf5d144b5 | ||
|
|
87552b959c | ||
|
|
1a384df3ce | ||
|
|
bf0a46d3f6 | ||
|
|
e0570a7677 | ||
|
|
738c92e036 | ||
|
|
56e60218b3 | ||
|
|
0dad90aa7f | ||
|
|
9abdc3e9ae | ||
|
|
35e62e4777 | ||
|
|
aa5d98a918 | ||
|
|
6e0f31092e | ||
|
|
1c98f5954d | ||
|
|
19b5126542 | ||
|
|
b5fa66428c | ||
|
|
6a0d138a08 | ||
|
|
14804a1396 | ||
|
|
38dbeab543 | ||
|
|
41fdb82dd1 | ||
|
|
91af9dbfc0 | ||
|
|
c3cc9f8e21 | ||
|
|
1429123da4 | ||
|
|
93973d4a49 | ||
|
|
df028f3714 | ||
|
|
6937a4d1e2 | ||
|
|
19680f4ebd | ||
|
|
8a450c6b4d | ||
|
|
dacc345814 | ||
|
|
349459c502 | ||
|
|
fc9655bde3 | ||
|
|
faac91b3be | ||
|
|
eaa75f0a3f | ||
|
|
6ca850fbe6 | ||
|
|
f035fff922 | ||
|
|
625220a856 | ||
|
|
134aeb0085 | ||
|
|
7d51c61184 | ||
|
|
ec523fdf0b | ||
|
|
849e22dfff | ||
|
|
d334ab504a | ||
|
|
09f3d78d1c | ||
|
|
363313ee59 | ||
|
|
48371badfc | ||
|
|
cd3bb82030 | ||
|
|
2f0a9985de | ||
|
|
83887ad91b | ||
|
|
7c6bde8551 | ||
|
|
d355d6be5c | ||
|
|
35441575e7 | ||
|
|
92424ee0e3 | ||
|
|
bb4974a467 | ||
|
|
d5cc98338e | ||
|
|
ea30714b53 | ||
|
|
12ce22b1a4 | ||
|
|
e2865c4576 | ||
|
|
14cbcbf2ac | ||
|
|
c71f96710f | ||
|
|
f787dd331d | ||
|
|
33b42b554e | ||
|
|
5ac6b0a787 | ||
|
|
11ae968eb6 | ||
|
|
48a882755e | ||
|
|
a179aa698b | ||
|
|
a69435baa1 | ||
|
|
2f4ff28011 | ||
|
|
6cef921092 | ||
|
|
4c53554eae | ||
|
|
ec7681b75d | ||
|
|
0d46b06833 | ||
|
|
6316b4a4e4 | ||
|
|
85d7186bf6 | ||
|
|
b5ae16e463 | ||
|
|
acbb64b9b4 | ||
|
|
63af0632df | ||
|
|
60d31003cf | ||
|
|
cb22efe237 | ||
|
|
3a7f5f7320 | ||
|
|
bf2870d53b | ||
|
|
5024413d68 | ||
|
|
e418257394 | ||
|
|
4640a5eea4 | ||
|
|
c55568852b | ||
|
|
21448785ec | ||
|
|
4acd808412 | ||
|
|
806e9eefd1 | ||
|
|
4634470897 | ||
|
|
670d6a9078 | ||
|
|
1bf056b5ca | ||
|
|
3aae4e73f2 | ||
|
|
bd64ca2cb9 | ||
|
|
1c6ef1c02c | ||
|
|
1119146fcd | ||
|
|
45d5f46063 | ||
|
|
a5407aff0a | ||
|
|
be1fba0b34 | ||
|
|
d1186a73ab | ||
|
|
cb8f3dd3e2 | ||
|
|
33144fdad4 | ||
|
|
89e6af4fb5 | ||
|
|
a1c0d95647 | ||
|
|
a4dbb0ee88 | ||
|
|
a4e1bcfd2d | ||
|
|
3ad5ea54fb | ||
|
|
2b9cdc2689 | ||
|
|
5a9eee5a12 | ||
|
|
ff8edc4adc | ||
|
|
d83dbd88c4 | ||
|
|
7af6e41fa1 | ||
|
|
b3c084db06 | ||
|
|
37cdc6a4fe | ||
|
|
e9a29ac2e6 | ||
|
|
f7ffb89690 | ||
|
|
77fcc86c14 | ||
|
|
f0dddf2854 | ||
|
|
d23c3a6e4d | ||
|
|
26726238b5 | ||
|
|
51d8809a22 | ||
|
|
92e696a6ea | ||
|
|
cae2b33d34 | ||
|
|
e1ab4e4532 | ||
|
|
21fe0590ed | ||
|
|
0d76068eb8 | ||
|
|
f6faea6f81 | ||
|
|
72c34be6f9 | ||
|
|
65da0763f7 | ||
|
|
baed9715df | ||
|
|
8d2fa0418a | ||
|
|
f7dd512ba8 | ||
|
|
9c9006f55e | ||
|
|
177698e014 | ||
|
|
70834437dd | ||
|
|
a501d4b688 | ||
|
|
cb0360016d | ||
|
|
55f179db5c | ||
|
|
e8c844b32a | ||
|
|
b8fb999660 | ||
|
|
93964edfed | ||
|
|
3a89eeffc9 | ||
|
|
72ac50ca24 | ||
|
|
6f8e5b4447 | ||
|
|
64efe3e91c | ||
|
|
eda444a92b | ||
|
|
7999173fc7 | ||
|
|
a4c2329316 | ||
|
|
e2b8ce4d5d | ||
|
|
13ee198069 | ||
|
|
84e74a8abf | ||
|
|
a1903268ad | ||
|
|
f36d1802df | ||
|
|
a8beea705e | ||
|
|
0e60209a24 | ||
|
|
5187223a76 | ||
|
|
d99263ed75 | ||
|
|
eb489320e1 | ||
|
|
1b906e0369 | ||
|
|
5019375c1f | ||
|
|
3f1f149312 | ||
|
|
698f4e0e16 | ||
|
|
c089510571 | ||
|
|
e2bb83fbdb | ||
|
|
16b030459f | ||
|
|
2fbdb960f6 | ||
|
|
e80f8b391d | ||
|
|
231f9a0246 | ||
|
|
eb26a123cf | ||
|
|
2b8c618b27 | ||
|
|
7d0c23b02b | ||
|
|
1fc27844ce | ||
|
|
d6d0be0a3c | ||
|
|
94b5611023 | ||
|
|
5142d17030 | ||
|
|
6bcd42f543 | ||
|
|
d00f29b663 | ||
|
|
633d2c58e2 | ||
|
|
55d46b3801 | ||
|
|
d329ae66ae | ||
|
|
54d0d3bd2c | ||
|
|
9a50e83dce | ||
|
|
a98bc2643a | ||
|
|
3bf411f705 | ||
|
|
2d0dc11c64 | ||
|
|
30c3556abc | ||
|
|
6a3569280a | ||
|
|
76215199f1 | ||
|
|
3d8b7de265 | ||
|
|
4bc768fc32 | ||
|
|
e34938c8dc | ||
|
|
254efe0d53 | ||
|
|
cdfd1299f0 | ||
|
|
c005dc7dad | ||
|
|
9193af0210 | ||
|
|
12eef3702d | ||
|
|
480175df7d | ||
|
|
8ae9aaebf8 | ||
|
|
e7ac8a5d12 | ||
|
|
6710e15c5c | ||
|
|
f5c586edaf | ||
|
|
16163aad45 | ||
|
|
1cb372a8e7 | ||
|
|
e22820c475 | ||
|
|
9469dee1b8 | ||
|
|
71aecd3927 | ||
|
|
a8f2fb5c24 | ||
|
|
5a4a0f9710 | ||
|
|
f5bbbff05b | ||
|
|
fc0251d305 | ||
|
|
7129774def | ||
|
|
fc71fe2c0e | ||
|
|
de55362fe1 | ||
|
|
4df953f3bd | ||
|
|
a867b1979c | ||
|
|
8acb0872ac |
No files matched your search
@@ -1,15 +0,0 @@
|
||||
# The "checkoutlist" file is used to support additional version controlled
|
||||
# administrative files in $CVSROOT/CVSROOT, such as template files.
|
||||
#
|
||||
# The first entry on a line is a filename which will be checked out from
|
||||
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
|
||||
# The remainder of the line is an error message to use if the file cannot
|
||||
# be checked out.
|
||||
#
|
||||
# File format:
|
||||
#
|
||||
# [<whitespace>]<filename><whitespace><error message><end-of-line>
|
||||
#
|
||||
# comment lines begin with '#'
|
||||
new_commit_prep Error checking out/updating CVSROOT/new_commit_prep
|
||||
new_log_accum Error checking out/updating CVSROOT/new_log_accum
|
||||
@@ -1,17 +0,0 @@
|
||||
# The "commitinfo" file is used to control pre-commit checks.
|
||||
# The filter on the right is invoked with the repository and a list
|
||||
# of files to check. A non-zero exit of the filter program will
|
||||
# cause the commit to be aborted.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being committed to, relative
|
||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||
# of the line is the name of the filter to run.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
DEFAULT $CVSROOT/CVSROOT/new_commit_prep
|
||||
CVSROOT $CVSROOT/CVSROOT/new_commit_prep
|
||||
@@ -1,14 +0,0 @@
|
||||
# Set this to "no" if pserver shouldn't check system users/passwords
|
||||
#SystemAuth=no
|
||||
|
||||
# Put CVS lock files in this directory rather than directly in the repository.
|
||||
LockDir=/var/lock/cvs
|
||||
|
||||
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
|
||||
# level of the new working directory when using the `cvs checkout'
|
||||
# command.
|
||||
#TopLevelAdmin=no
|
||||
|
||||
# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
|
||||
# history file, or a subset as needed (ie `TMAR' logs all write operations)
|
||||
#LogHistory=TOFEWGCMAR
|
||||
@@ -1,23 +0,0 @@
|
||||
# This file affects handling of files based on their names.
|
||||
#
|
||||
# The -t/-f options allow one to treat directories of files
|
||||
# as a single file, or to transform a file in other ways on
|
||||
# its way in and out of CVS.
|
||||
#
|
||||
# The -m option specifies whether CVS attempts to merge files.
|
||||
#
|
||||
# The -k option specifies keyword expansion (e.g. -kb for binary).
|
||||
#
|
||||
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
|
||||
#
|
||||
# wildcard [option value][option value]...
|
||||
#
|
||||
# where option is one of
|
||||
# -f from cvs filter value: path to filter
|
||||
# -t to cvs filter value: path to filter
|
||||
# -m update methodology value: MERGE or COPY
|
||||
# -k expansion mode value: b, o, kkv, &c
|
||||
#
|
||||
# and value is a single-quote delimited value.
|
||||
# For example:
|
||||
#*.gif -k 'b'
|
||||
@@ -1,21 +0,0 @@
|
||||
# The "editinfo" file is used to allow verification of logging
|
||||
# information. It works best when a template (as specified in the
|
||||
# rcsinfo file) is provided for the logging procedure. Given a
|
||||
# template with locations for, a bug-id number, a list of people who
|
||||
# reviewed the code before it can be checked in, and an external
|
||||
# process to catalog the differences that were code reviewed, the
|
||||
# following test can be applied to the code:
|
||||
#
|
||||
# Making sure that the entered bug-id number is correct.
|
||||
# Validating that the code that was reviewed is indeed the code being
|
||||
# checked in (using the bug-id number or a seperate review
|
||||
# number to identify this particular code set.).
|
||||
#
|
||||
# If any of the above test failed, then the commit would be aborted.
|
||||
#
|
||||
# Actions such as mailing a copy of the report to each reviewer are
|
||||
# better handled by an entry in the loginfo file.
|
||||
#
|
||||
# One thing that should be noted is the the ALL keyword is not
|
||||
# supported. There can be only one entry that matches a given
|
||||
# repository.
|
||||
@@ -1,30 +0,0 @@
|
||||
# The "loginfo" file controls where "cvs commit" log information
|
||||
# is sent. The first entry on a line is a regular expression which must match
|
||||
# the directory that the change is being made to, relative to the
|
||||
# $CVSROOT. If a match is found, then the remainder of the line is a filter
|
||||
# program that should expect log information on its standard input.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name ALL appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or DEFAULT.
|
||||
#
|
||||
# You may specify a format string as part of the
|
||||
# filter. The string is composed of a `%' followed
|
||||
# by a single format character, or followed by a set of format
|
||||
# characters surrounded by `{' and `}' as separators. The format
|
||||
# characters are:
|
||||
#
|
||||
# s = file name
|
||||
# V = old version number (pre-checkin)
|
||||
# v = new version number (post-checkin)
|
||||
#
|
||||
# For example:
|
||||
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||
# or
|
||||
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||
|
||||
DEFAULT $CVSROOT/CVSROOT/new_log_accum -m [email protected] %{sVv}
|
||||
CVSROOT $CVSROOT/CVSROOT/new_log_accum -m [email protected] %{sVv}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
# Three different line formats are valid:
|
||||
# key -a aliases...
|
||||
# key [options] directory
|
||||
# key [options] directory files...
|
||||
#
|
||||
# Where "options" are composed of:
|
||||
# -i prog Run "prog" on "cvs commit" from top-level of module.
|
||||
# -o prog Run "prog" on "cvs checkout" of module.
|
||||
# -e prog Run "prog" on "cvs export" of module.
|
||||
# -t prog Run "prog" on "cvs rtag" of module.
|
||||
# -u prog Run "prog" on "cvs update" of module.
|
||||
# -d dir Place module in directory "dir" instead of module name.
|
||||
# -l Top-level directory only -- do not recurse.
|
||||
#
|
||||
# NOTE: If you change any of the "Run" options above, you'll have to
|
||||
# release and re-checkout any working directories of these modules.
|
||||
#
|
||||
# And "directory" is a path to a directory relative to $CVSROOT.
|
||||
#
|
||||
# The "-a" option specifies an alias. An alias is interpreted as if
|
||||
# everything on the right of the "-a" had been typed on the command line.
|
||||
#
|
||||
# You can encode a module within a module by using the special '&'
|
||||
# character to interpose another module into the current module. This
|
||||
# can be useful for creating a module that consists of many directories
|
||||
# spread out over the entire source repository.
|
||||
@@ -1,104 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2000 by Kevin L. Mitchell <[email protected]>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
#
|
||||
# Script to store the last visited directory for newlogaccum.pl.
|
||||
#
|
||||
# $Id: new_commit_prep,v 1.1 2002-08-11 23:05:15 drevil Exp $
|
||||
|
||||
use strict;
|
||||
|
||||
# This routine removes everything in a directory
|
||||
sub clear_dir {
|
||||
my ($dir) = @_;
|
||||
my ($file);
|
||||
|
||||
opendir(DIR, $dir) || die "Cannot clear directory $dir: $!";
|
||||
while ($file = readdir(DIR)) {
|
||||
next
|
||||
if ($file eq "." || $file eq "..");
|
||||
|
||||
$file = "$dir/$file";
|
||||
|
||||
if (-d $file) {
|
||||
# It's a directory, recurse into it, then delete it.
|
||||
clear_dir($file);
|
||||
rmdir($file);
|
||||
} else {
|
||||
# It's a file, delete it.
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
# This routine prepares a temporary directory, hopefully in a secure
|
||||
# fashion; it uses the process group to make secondary programs be able
|
||||
# to find it.
|
||||
sub tmpdir (;$) {
|
||||
my ($clear) = @_;
|
||||
my ($pgrp, $own, $mode, $tmpdir);
|
||||
|
||||
$pgrp = getpgrp();
|
||||
|
||||
die "Don't run $0 setuid!"
|
||||
unless ($< == $>);
|
||||
|
||||
# Decide on the directory name, using various environment variables
|
||||
$tmpdir = ($ENV{TMPDIR} || $ENV{TMP} || $ENV{TEMP} || "/tmp") .
|
||||
"/.#cvs.$pgrp";
|
||||
|
||||
# Doesn't exist, but we can't create it...
|
||||
die "Can't create temporary directory $tmpdir: $!"
|
||||
unless (-e $tmpdir || mkdir($tmpdir, 0700));
|
||||
|
||||
die "Temporary directory $tmpdir is not a directory"
|
||||
unless (-d $tmpdir);
|
||||
|
||||
# Check ownership and permissions
|
||||
(undef, undef, $mode, undef, $own, undef) = stat($tmpdir);
|
||||
|
||||
die "Temporary directory $tmpdir not owned by $< (owned by $own)"
|
||||
unless ($own == $<);
|
||||
|
||||
die "Temporary directory $tmpdir group-writable"
|
||||
if ($mode & 0020);
|
||||
die "Temporary directory $tmpdir other-writable"
|
||||
if ($mode & 0002);
|
||||
|
||||
# If we're supposed to clear the directory, do so...
|
||||
clear_dir($tmpdir)
|
||||
if ($clear);
|
||||
|
||||
return $tmpdir;
|
||||
}
|
||||
|
||||
# This routine writes a single line to a file
|
||||
sub write_line ($$) {
|
||||
my ($fname, $line) = @_;
|
||||
|
||||
open(FILE, ">$fname") || die "Cannot open file $fname for writing";
|
||||
print FILE "$line\n";
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
# Create and empty the temporary directory
|
||||
my ($tmpdir) = (tmpdir(1));
|
||||
|
||||
# Store the directory name
|
||||
write_line("$tmpdir/lastdir", shift(@ARGV));
|
||||
@@ -1,757 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2000 by Kevin L. Mitchell <[email protected]>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
#
|
||||
# Script to accumulate log messages for an entire tree and send them along
|
||||
# with the diffs; deals correctly with all manner of branching (I hope)
|
||||
#
|
||||
# $Id: new_log_accum,v 1.3 2003-09-07 12:46:59 drevil Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
use vars qw($MAILER $CVS $debug $boundary);
|
||||
use Digest::MD5;
|
||||
|
||||
# Set this to the full path of a mailer that takes a list
|
||||
# of email addresses as arguments...
|
||||
$MAILER = "/usr/sbin/sendmail -oi -oeq";
|
||||
|
||||
# Set this to the path of the CVS binary responsible for this tree...
|
||||
$CVS = "/usr/bin/cvs";
|
||||
|
||||
# Don't touch this; use the -d command line option
|
||||
$debug = 0;
|
||||
|
||||
# This is initialized by build_mailheader()
|
||||
$boundary = '';
|
||||
|
||||
use POSIX qw(setsid);
|
||||
|
||||
# We have to dissociate from our parent, so that the CVS commit can
|
||||
# complete, before we try to extract the diffs
|
||||
sub daemonize {
|
||||
defined(my $pid = fork()) || die "Can't fork: $!";
|
||||
exit(0)
|
||||
if $pid;
|
||||
setsid() || die "Can't start a new session: $!";
|
||||
}
|
||||
|
||||
# Debugging output
|
||||
sub debug (@) {
|
||||
print STDERR @_
|
||||
if ($debug);
|
||||
}
|
||||
|
||||
# Constants used in the FSM below for parsing the log message
|
||||
sub STATE_NONE { 0 }
|
||||
sub STATE_MODIFIED { 1 }
|
||||
sub STATE_ADDED { 2 }
|
||||
sub STATE_REMOVED { 3 }
|
||||
sub STATE_LOG1 { 4 }
|
||||
sub STATE_LOG2 { 5 }
|
||||
|
||||
# This routine removes everything in a directory
|
||||
sub clear_dir {
|
||||
my ($dir) = @_;
|
||||
my ($file);
|
||||
|
||||
opendir(DIR, $dir) || die "Cannot clear directory $dir: $!";
|
||||
while ($file = readdir(DIR)) {
|
||||
next
|
||||
if ($file eq "." || $file eq "..");
|
||||
|
||||
$file = "$dir/$file";
|
||||
|
||||
if (-d $file) {
|
||||
# It's a directory, recurse into it, then delete it.
|
||||
clear_dir($file);
|
||||
rmdir($file);
|
||||
} else {
|
||||
# It's a file, delete it.
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
# This routine prepares a temporary directory, hopefully in a secure
|
||||
# fashion; it uses the process group to make secondary programs be able
|
||||
# to find it.
|
||||
sub tmpdir (;$) {
|
||||
my ($clear) = @_;
|
||||
my ($pgrp, $own, $mode, $tmpdir);
|
||||
|
||||
$pgrp = getpgrp();
|
||||
|
||||
die "Don't run $0 setuid!"
|
||||
unless ($< == $>);
|
||||
|
||||
# Decide on the directory name, using various environment variables
|
||||
$tmpdir = ($ENV{TMPDIR} || $ENV{TMP} || $ENV{TEMP} || "/tmp") .
|
||||
"/.#cvs.$pgrp";
|
||||
|
||||
# Doesn't exist, but we can't create it...
|
||||
die "Can't create temporary directory $tmpdir: $!"
|
||||
unless (-e $tmpdir || mkdir($tmpdir, 0700));
|
||||
|
||||
die "Temporary directory $tmpdir is not a directory"
|
||||
unless (-d $tmpdir);
|
||||
|
||||
# Check ownership and permissions
|
||||
(undef, undef, $mode, undef, $own, undef) = stat($tmpdir);
|
||||
|
||||
die "Temporary directory $tmpdir not owned by $< (owned by $own)"
|
||||
unless ($own == $<);
|
||||
|
||||
die "Temporary directory $tmpdir group-writable"
|
||||
if ($mode & 0020);
|
||||
die "Temporary directory $tmpdir other-writable"
|
||||
if ($mode & 0002);
|
||||
|
||||
# If we're supposed to clear the directory, do so...
|
||||
clear_dir($tmpdir)
|
||||
if ($clear);
|
||||
|
||||
return $tmpdir;
|
||||
}
|
||||
|
||||
# Routine to remove the temporary directory when done
|
||||
sub cleanup_dir ($) {
|
||||
# If we're debugging, we may want to look at the contents...
|
||||
return
|
||||
if ($debug);
|
||||
|
||||
clear_dir($_[0]);
|
||||
rmdir($_[0]);
|
||||
}
|
||||
|
||||
# Retrieve a single line from a specified file
|
||||
sub get_line ($) {
|
||||
my ($fname) = @_;
|
||||
|
||||
open(FILE, "<$fname") || die "Cannot open file $fname for reading";
|
||||
my $line = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
# Chomp off the \n
|
||||
chomp $line;
|
||||
|
||||
return $line;
|
||||
}
|
||||
|
||||
# Routine that only allows one value to be pushed on the array;
|
||||
# implemented by making the first element of the array a hash-reference.
|
||||
# When we add a new value, we also increment the count of an element in
|
||||
# the hash with the key being the array value...
|
||||
sub push_once (\@@) {
|
||||
my ($array, @values) = @_;
|
||||
|
||||
# If the array is empty, create our hash ref
|
||||
push @{$array}, {}
|
||||
if (@{$array} == 0);
|
||||
|
||||
foreach my $value (@values) {
|
||||
push @{$array}, $value
|
||||
if (!exists($array->[0]{$value}));
|
||||
|
||||
$array->[0]{$value}++;
|
||||
}
|
||||
|
||||
return @{$array} - 1;
|
||||
}
|
||||
|
||||
# Filter //, /./, and remove leading ./ or / from filenames
|
||||
sub fname_filter ($) {
|
||||
my ($fname) = @_;
|
||||
|
||||
$fname =~ s,//,/,g;
|
||||
$fname =~ s,/\./,/,g;
|
||||
$fname =~ s,^\.?/,,g;
|
||||
|
||||
return $fname;
|
||||
}
|
||||
|
||||
# Store file data in a temporary file
|
||||
sub names_to_file ($$@) {
|
||||
my ($fname, $dir, @names) = @_;
|
||||
|
||||
if (@names > 0) {
|
||||
open(FILE, ">>$fname") || die "Cannot open file $fname for appending";
|
||||
|
||||
# Store the directory data
|
||||
print FILE "D $dir\n";
|
||||
|
||||
foreach my $name (@names) {
|
||||
# Mark record as a file...
|
||||
print FILE "F ";
|
||||
|
||||
# Store the tag, if there is one...
|
||||
print FILE "$name->{tag}"
|
||||
if (defined($name->{tag}));
|
||||
|
||||
# Then store old revision, new revision, and file name
|
||||
print FILE ":$name->{old}:$name->{new}:$name->{file}\n";
|
||||
}
|
||||
|
||||
close(FILE);
|
||||
}
|
||||
}
|
||||
|
||||
# Retrieve file data from temporary file; updates branch tags with what it
|
||||
# reads
|
||||
sub file_to_names (\@$) {
|
||||
my ($btags, $fname) = @_;
|
||||
my ($dir) = (undef);
|
||||
my (@names) = ();
|
||||
|
||||
debug "Reading file names from $fname...\n";
|
||||
|
||||
# We may not have, say, added a file in this subdirectory...
|
||||
return ()
|
||||
if (!-e $fname);
|
||||
|
||||
open(FILE, "<$fname");
|
||||
while(<FILE>) {
|
||||
chomp;
|
||||
|
||||
# Get record type...
|
||||
my ($type, $data) = split(' ', $_, 2);
|
||||
|
||||
# ok, it's a directory, remember that...
|
||||
if ($type eq "D") {
|
||||
$dir = $data;
|
||||
|
||||
debug "Read directory $dir\n";
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
debug "Read file $data\n";
|
||||
|
||||
# Get all the information about the file
|
||||
my ($tag, $old, $new, $file) = split(':', $data);
|
||||
|
||||
# and store it all
|
||||
push(@names, { tag => $tag, old => $old, new => $new, file => $file,
|
||||
dir => $dir, name => fname_filter("$dir/$file") });
|
||||
|
||||
# Remember the tags...
|
||||
push_once(@{$btags}, $tag)
|
||||
if (defined($tag) && $tag ne "");
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
return @names;
|
||||
}
|
||||
|
||||
# Create a text-formatted list of names
|
||||
sub name_to_list (\@@) {
|
||||
my ($btags, @names) = @_;
|
||||
my (@nlist, @nline) = ();
|
||||
|
||||
debug "Tags:", join(':', @{$btags}), "\n";
|
||||
|
||||
# We group them by tag
|
||||
foreach my $tag ("", @{$btags}[1..$#{$btags}]) {
|
||||
debug "Processing tag $tag...\n";
|
||||
|
||||
@nlist = ();
|
||||
|
||||
# Get a list of files by the tag...
|
||||
foreach my $name (@names) {
|
||||
debug "Processing $name->{file}...\n";
|
||||
|
||||
next
|
||||
if ($name->{tag} ne $tag);
|
||||
|
||||
debug "Pushing $name->{name} on \@nlist...\n";
|
||||
push(@nlist, $name->{name});
|
||||
}
|
||||
|
||||
# If the tag is not the empty string, list the tag...
|
||||
push(@nline, " Tag: $tag", " ")
|
||||
if ($tag ne "");
|
||||
|
||||
# Now list each file name
|
||||
foreach my $name (@nlist) {
|
||||
# indent if we run past the end of line limit
|
||||
push(@nline, " ")
|
||||
if (@nline == 0 || ($nline[$#nline] ne " " &&
|
||||
length($nline[$#nline]) + length($name) + 1 > 70));
|
||||
|
||||
# add the file name to the list
|
||||
debug "Adding $name to \@nline...\n";
|
||||
$nline[$#nline] .= " $name";
|
||||
}
|
||||
}
|
||||
|
||||
return @nline;
|
||||
}
|
||||
|
||||
# write the log message to a temporary file
|
||||
sub write_log ($@) {
|
||||
my ($fname, @text) = @_;
|
||||
|
||||
open(FILE, ">$fname") || die "Cannot open file $fname for writing";
|
||||
print FILE join("\n", @text), "\n";
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
# Build the header of the commit message: CVSROOT, module name, any
|
||||
# branch tags, and the commit time
|
||||
sub build_header ($@) {
|
||||
my ($module, $subject, $mailto, @branch_tags) = @_;
|
||||
my (@text, @mailto);
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time());
|
||||
my ($user, $dummy);
|
||||
my ($digest);
|
||||
|
||||
($user, $dummy, $dummy, $dummy, $dummy, $dummy, $dummy) = getpwuid($<);
|
||||
|
||||
@mailto = @{$mailto};
|
||||
|
||||
# generate a unique boundary by calculating the md5sum of the
|
||||
# current time
|
||||
$digest = new Digest::MD5;
|
||||
$digest->reset();
|
||||
$digest->add(time() . rand());
|
||||
$boundary = "----=MIME." . unpack("H*", $digest->digest());
|
||||
|
||||
# Build the mail header
|
||||
push(@text, 'From: [email protected]');
|
||||
push(@text, "To: " . join(' ', @mailto));
|
||||
push(@text, "Subject: $subject");
|
||||
push(@text, "MIME-Version: 1.0");
|
||||
push(@text, "Content-Type: multipart/mixed; boundary=\"$boundary\"");
|
||||
push(@text, "");
|
||||
push(@text, "This is a multipart message as defined by RFC2049 (MIME)");
|
||||
push(@text, "");
|
||||
push(@text, "--$boundary");
|
||||
push(@text, "Content-Type: text/plain; charset=us-ascii");
|
||||
push(@text, "Content-Disposition: inline");
|
||||
push(@text, "");
|
||||
|
||||
# Build the commit message header
|
||||
push(@text, "Commiter : $user");
|
||||
push(@text, "CVSROOT : $ENV{CVSROOT}");
|
||||
push(@text, "Module : $module");
|
||||
push(@text, "Branch tags: " . join(' ', @branch_tags[1..$#branch_tags]))
|
||||
if (@branch_tags > 0);
|
||||
push(@text, sprintf("Commit time: %04d-%02d-%02d %02d:%02d:%02d UTC",
|
||||
$year + 1900, $mon + 1, $mday, $hour, $min, $sec));
|
||||
|
||||
return @text, "";
|
||||
}
|
||||
|
||||
# Send the mail message
|
||||
sub send_mail {
|
||||
my ($mailto, $text) = @_;
|
||||
my (@mailto, @text);
|
||||
# I <heart> perl
|
||||
@mailto = @{$mailto};
|
||||
@text = @{$text};
|
||||
|
||||
open(MAIL, "|$MAILER " . join(' ', @mailto));
|
||||
push(@text, "--$boundary--", "");
|
||||
print MAIL join("\n", @text), "\n";
|
||||
close(MAIL);
|
||||
}
|
||||
|
||||
# Find the tmp directory
|
||||
my ($tmpdir) = (tmpdir());
|
||||
|
||||
my (@mailto) = ();
|
||||
my (@files) = ();
|
||||
my (@path) = ();
|
||||
my ($modname, $repdir, $dir) = (undef, undef, undef);
|
||||
|
||||
# Process command line arguments
|
||||
while (@ARGV > 0) {
|
||||
my ($arg) = (shift(@ARGV));
|
||||
|
||||
if ($arg eq '-d') {
|
||||
# Turn on debugging
|
||||
$debug++;
|
||||
} elsif ($arg eq '-M') {
|
||||
# Module name explicitly set -- XXX Not tested, use at your own risk
|
||||
die "Argument for -M missing"
|
||||
unless (@ARGV > 0);
|
||||
|
||||
$modname = shift(@ARGV);
|
||||
} elsif ($arg eq '-m') {
|
||||
# An address to mail the notification to
|
||||
die "Argument for -m missing"
|
||||
unless (@ARGV > 0);
|
||||
|
||||
push(@mailto, shift(@ARGV));
|
||||
} else {
|
||||
# the list of filenames passed by CVS--you *must* use %{sVv}!
|
||||
die "Too many arguments!"
|
||||
unless (@files == 0);
|
||||
|
||||
@files = split(" ", $arg);
|
||||
}
|
||||
}
|
||||
|
||||
die "Nobody to mail to"
|
||||
unless (@mailto > 0);
|
||||
|
||||
die "No files to process"
|
||||
unless (@files > 1);
|
||||
|
||||
# The repository directory
|
||||
$repdir = shift(@files);
|
||||
|
||||
# break it appart...
|
||||
@path = split("/", $repdir);
|
||||
|
||||
# Now we know the module name, if it wasn't explicitly set
|
||||
$modname = $path[0]
|
||||
unless (defined($modname));
|
||||
|
||||
# Figure out what our directory is
|
||||
if (@path == 1) {
|
||||
$dir = ".";
|
||||
} else {
|
||||
$dir = join("/", @path[1..$#path]);
|
||||
}
|
||||
|
||||
# append a / to it...
|
||||
$dir .= "/";
|
||||
|
||||
debug "module = $modname\n";
|
||||
debug "dir = $dir\n";
|
||||
debug "path = ", join(":", @path), "\n";
|
||||
debug "files = ", join(":", @files), "\n";
|
||||
debug "tmpdir = $tmpdir\n";
|
||||
|
||||
my (%fversions);
|
||||
|
||||
# Unless its a new directory or imported sources, create file records
|
||||
unless (defined($files[1]) && defined($files[2]) &&
|
||||
(($files[1] eq "New" && $files[2] eq "directory") ||
|
||||
($files[1] eq "Imported" && $files[2] eq "sources"))) {
|
||||
|
||||
foreach my $fname (@files) {
|
||||
# You *must* use %{sVv} in the call in loginfo!
|
||||
die "Invalid filenames"
|
||||
unless ($fname =~ /^(.*),([0-9.]+|NONE),([0-9.]+|NONE)$/);
|
||||
|
||||
$fversions{$1} = {
|
||||
old => ($2 eq "NONE" ? "0" : $2),
|
||||
new => ($3 eq "NONE" ? "0" : $3),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
# process log message
|
||||
my ($state, $tag) = (STATE_NONE, undef);
|
||||
|
||||
my (@modified, @added, @removed, @log, @branch_tags) = ();
|
||||
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
|
||||
debug "State $state, line:$_\n";
|
||||
|
||||
# Ignore empty space at the beginning of the log message
|
||||
next
|
||||
if ($state == STATE_LOG1 && /^\s*$/);
|
||||
|
||||
# We're done ignoring empty space
|
||||
if ($state == STATE_LOG1) {
|
||||
$state = STATE_LOG2;
|
||||
}
|
||||
|
||||
if ($state == STATE_LOG2) {
|
||||
# Don't modify the lines at all if we're processing the log message
|
||||
push(@log, $_);
|
||||
next;
|
||||
} else {
|
||||
# Strip out leading and trailing space
|
||||
s/^\s*(.*?)\s*$/$1/;
|
||||
}
|
||||
|
||||
if (/^Modified Files/) {
|
||||
# Collect list of modified files
|
||||
debug "State switching to STATE_MODIFIED\n";
|
||||
|
||||
$state = STATE_MODIFIED;
|
||||
$tag = undef;
|
||||
|
||||
next;
|
||||
|
||||
} elsif (/^Added Files/) {
|
||||
# Collect list of added files
|
||||
debug "State switching to STATE_ADDED\n";
|
||||
|
||||
$state = STATE_ADDED;
|
||||
$tag = undef;
|
||||
|
||||
next;
|
||||
|
||||
} elsif (/^Removed Files/) {
|
||||
# Collect list of removed files
|
||||
debug "State switching to STATE_REMOVED\n";
|
||||
|
||||
$state = STATE_REMOVED;
|
||||
$tag = undef;
|
||||
|
||||
next;
|
||||
|
||||
} elsif (/^Log Message/) {
|
||||
# Collect log message
|
||||
debug "State switching to STATE_LOG1\n";
|
||||
|
||||
$state = STATE_LOG1;
|
||||
$tag = undef;
|
||||
|
||||
next;
|
||||
|
||||
} elsif (/^Revision\/Branch/) {
|
||||
# Parse old-style Revision/Branch field
|
||||
debug "Found a branch tag\n";
|
||||
|
||||
/^[^:]+:\s*(.*)/;
|
||||
|
||||
push_once(@branch_tags, $1);
|
||||
|
||||
warn "Tag == $tag"
|
||||
if (defined($tag));
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
# Ignore the stuff at the top of the commit report
|
||||
next
|
||||
if ($state == STATE_NONE);
|
||||
|
||||
if (/^Tag:\s*(.*)$/) {
|
||||
# Remember the tag
|
||||
debug "Setting tag to $1\n";
|
||||
$tag = $1;
|
||||
next;
|
||||
}
|
||||
|
||||
my (@tfiles) = ();
|
||||
|
||||
# Find the file in our command line list of files
|
||||
foreach my $file (split) {
|
||||
die "Nothing known about file $file!"
|
||||
unless (exists($fversions{$file}));
|
||||
|
||||
push @tfiles, {
|
||||
file => $file,
|
||||
tag => $tag,
|
||||
old => $fversions{$file}{old},
|
||||
new => $fversions{$file}{new},
|
||||
};
|
||||
}
|
||||
|
||||
# Store the file list in the correct array
|
||||
push(@modified, @tfiles)
|
||||
if ($state == STATE_MODIFIED);
|
||||
|
||||
push(@added, @tfiles)
|
||||
if ($state == STATE_ADDED);
|
||||
|
||||
push(@removed, @tfiles)
|
||||
if ($state == STATE_REMOVED);
|
||||
}
|
||||
|
||||
# Remove trailing blank lines from the log message
|
||||
while (@log > 0 && $log[$#log] =~ /^\s*$/) {
|
||||
pop(@log);
|
||||
}
|
||||
|
||||
# If a new directory was added, we're done...
|
||||
if (defined($files[1]) && defined($files[2]) &&
|
||||
$files[1] eq "New" && $files[2] eq "directory") {
|
||||
|
||||
my (@text) = ();
|
||||
|
||||
# If there was a sticky tag for the directory, make it a branch tag
|
||||
if ($log[$#log] =~ /^--> Using per-directory sticky tag \`(.*)\'$/) {
|
||||
push_once(@branch_tags, $1);
|
||||
pop(@log);
|
||||
}
|
||||
|
||||
# Build the message...
|
||||
push(@text, build_header($modname, "Module $modname: New directory $dir",
|
||||
\@mailto, @branch_tags));
|
||||
push(@text, "Log message:", "", @log);
|
||||
|
||||
# and send it (synchronously)
|
||||
send_mail(\@mailto, \@text);
|
||||
|
||||
# Clean up after ourselves and exit.
|
||||
cleanup_dir($tmpdir);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
# If an import was done, we're done...
|
||||
if (defined($files[1]) && defined($files[2]) &&
|
||||
$files[1] eq "Imported" && $files[2] eq "sources") {
|
||||
|
||||
my (@text) = ();
|
||||
|
||||
# Build the message...
|
||||
push(@text, build_header($modname, "Module $modname: Imported $dir",
|
||||
\@mailto, @branch_tags));
|
||||
push(@text, "Log message:", "", @log);
|
||||
|
||||
# and send it (synchronously)
|
||||
send_mail(\@mailto, \@text);
|
||||
|
||||
# Clean up after ourselves and exit.
|
||||
cleanup_dir($tmpdir);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
debug "Searching for log file index...";
|
||||
|
||||
my ($i);
|
||||
|
||||
# Look for an empty log file or one that matches our current log message
|
||||
for ($i = 0; ; $i++) {
|
||||
my (@text);
|
||||
|
||||
# found one that doesn't exist...
|
||||
last
|
||||
if (!-e "$tmpdir/logfile.$i");
|
||||
|
||||
# read in the log file
|
||||
open(FILE, "<$tmpdir/logfile.$i");
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
push(@text, $_);
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
# If the log file was empty, use it
|
||||
last
|
||||
if (@text == 0);
|
||||
|
||||
# If the log messages are identical, use that
|
||||
last
|
||||
if (join(' ', @log) eq join(' ', @text));
|
||||
}
|
||||
|
||||
debug "$tmpdir/logfile.$i\n";
|
||||
|
||||
# Store modified, added, and removed file lists, along with the log message
|
||||
names_to_file("$tmpdir/modified.$i", $dir, @modified);
|
||||
names_to_file("$tmpdir/added.$i", $dir, @added);
|
||||
names_to_file("$tmpdir/removed.$i", $dir, @removed);
|
||||
write_log("$tmpdir/logfile.$i", @log);
|
||||
|
||||
# Now check to see if we're at the end of our rope
|
||||
my ($lastdir) = (get_line("$tmpdir/lastdir"));
|
||||
|
||||
debug "Checking $ENV{CVSROOT}/$repdir against lastdir $lastdir\n";
|
||||
|
||||
# Nope, exit instead of sending a message
|
||||
exit(0)
|
||||
if ($lastdir ne "$ENV{CVSROOT}/$repdir");
|
||||
|
||||
debug "At last, we've reached the end\n";
|
||||
|
||||
# We have to daemonize and sleep so that there isn't any lock hanging
|
||||
# around when we get to the cvs rdiff below...
|
||||
daemonize();
|
||||
sleep(10);
|
||||
|
||||
# Build the mail message...
|
||||
my (@text) = ();
|
||||
@files = ();
|
||||
@branch_tags = ();
|
||||
|
||||
for ($i = 0; ; $i++) {
|
||||
# No more log files
|
||||
last
|
||||
if (!-e "$tmpdir/logfile.$i");
|
||||
|
||||
# read and insert the log message
|
||||
open(FILE, "<$tmpdir/logfile.$i");
|
||||
push(@text, "Log message:", "");
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
push(@text, $_);
|
||||
}
|
||||
push(@text, "");
|
||||
close(FILE);
|
||||
|
||||
# read modified list and list all modified files if non-empty
|
||||
@modified = file_to_names(@branch_tags, "$tmpdir/modified.$i");
|
||||
push(@text, "Modified files:", name_to_list(@branch_tags, @modified), "")
|
||||
if (@modified > 0);
|
||||
|
||||
# read added list and list all added files if non-empty
|
||||
@added = file_to_names(@branch_tags, "$tmpdir/added.$i");
|
||||
push(@text, "Added files:", name_to_list(@branch_tags, @added), "")
|
||||
if (@added > 0);
|
||||
|
||||
# read removed list and list all removed files if non-empty
|
||||
@removed = file_to_names(@branch_tags, "$tmpdir/removed.$i");
|
||||
push(@text, "Removed files:", name_to_list(@branch_tags, @removed), "")
|
||||
if (@removed > 0);
|
||||
|
||||
# remember all the files we looked at
|
||||
push(@files, @modified, @added, @removed);
|
||||
}
|
||||
|
||||
# Now that name_to_list has rebuilt our list of branch tags, we can build the
|
||||
# header and prepend it to the message
|
||||
unshift(@text, build_header($modname, "Module $modname: Change committed",
|
||||
\@mailto, @branch_tags));
|
||||
|
||||
# sort the files out for our diff
|
||||
@files = sort { $a->{name} cmp $b->{name} } @files;
|
||||
|
||||
my ($user, $filename);
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time());
|
||||
$user = getpwuid($<);
|
||||
|
||||
$filename = sprintf("%s.%04d%02d%02d.%02d%02d%02d.%s.diff", $modname,
|
||||
$year + 1900, $mon + 1, $mday, $hour, $min, $sec, $user);
|
||||
|
||||
push(@text, "--$boundary");
|
||||
push(@text, "Content-Type: text/plain; name=\"$filename\"");
|
||||
push(@text, "Content-Disposition: attachment; filename=\"$filename\"");
|
||||
push(@text, "Content-Transfer-Encoding: 8bit");
|
||||
push(@text, "");
|
||||
|
||||
foreach my $file (@files) {
|
||||
debug "Diffing file $file->{name}...\n";
|
||||
|
||||
# Run cvs rdiff, extracting a diff between the old version and the new
|
||||
open(DIFF, "$CVS -Q rdiff -u -r $file->{old} -r $file->{new} " .
|
||||
"$modname/$file->{name}|");
|
||||
while (<DIFF>) {
|
||||
chomp;
|
||||
push(@text, $_);
|
||||
}
|
||||
close(DIFF);
|
||||
}
|
||||
|
||||
# send the mail...
|
||||
send_mail(\@mailto, \@text);
|
||||
|
||||
# and clean up after ourselves
|
||||
cleanup_dir($tmpdir);
|
||||
@@ -1,12 +0,0 @@
|
||||
# The "notify" file controls where notifications from watches set by
|
||||
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
|
||||
# a regular expression which is tested against the directory that the
|
||||
# change is being made to, relative to the $CVSROOT. If it matches,
|
||||
# then the remainder of the line is a filter program that should contain
|
||||
# one occurrence of %s for the user to notify, and information on its
|
||||
# standard input.
|
||||
#
|
||||
# "ALL" or "DEFAULT" can be used in place of the regular expression.
|
||||
#
|
||||
# For example:
|
||||
#ALL mail %s -s "CVS notification"
|
||||
@@ -1,19 +0,0 @@
|
||||
drevil:f76FWdDTUBG5c:fs2source
|
||||
mysterial:f7nJUwoIhmSrg:fs2source
|
||||
wmcoolmon:f7JRB.js9Q1sE:fs2source
|
||||
inquisitor:f7BVkOvwjDlWk:fs2source
|
||||
penguin:Jh.dOjaiO2jHk:fs2source
|
||||
DTP:f7M92Z/6/uep.:fs2source
|
||||
unknownplayer:f79BgAn.IzJs6:fs2source
|
||||
phreak:f7WQyGiT/jzlM:fs2source
|
||||
randomtiger:f7Way/xL9ic7o:fs2source
|
||||
righteous1:f7fpcXiE0Ubao:fs2source
|
||||
bobboau:f7jChSbXOIdWY:fs2source
|
||||
sesquipedalian:f75AcAOV6TM6Q:fs2source
|
||||
daveb:f7f2mVbMvbe.6:fs2source
|
||||
Goober5000:f7Fc.gHzyrOL2:fs2source
|
||||
dkharrat:f7odljbD5tm5k:fs2source
|
||||
EdrickV:f7cDahmEbbAlg:fs2source
|
||||
OldMan:f7N4NyUG5Ommw:fs2source
|
||||
komet:f7fyoBN5r.m76:fs2source
|
||||
anonymous:oIKtWP1q6GDt6:fs2source
|
||||
@@ -1,13 +0,0 @@
|
||||
# The "rcsinfo" file is used to control templates with which the editor
|
||||
# is invoked on commit and import.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being made to, relative to the
|
||||
# $CVSROOT. For the first match that is found, then the remainder of the
|
||||
# line is the name of the file that contains the template.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@@ -1,20 +0,0 @@
|
||||
# The "taginfo" file is used to control pre-tag checks.
|
||||
# The filter on the right is invoked with the following arguments:
|
||||
#
|
||||
# $1 -- tagname
|
||||
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
|
||||
# $3 -- repository
|
||||
# $4-> file revision [file revision ...]
|
||||
#
|
||||
# A non-zero exit of the filter program will cause the tag to be aborted.
|
||||
#
|
||||
# The first entry on a line is a regular expression which is tested
|
||||
# against the directory that the change is being committed to, relative
|
||||
# to the $CVSROOT. For the first match that is found, then the remainder
|
||||
# of the line is the name of the filter to run.
|
||||
#
|
||||
# If the repository name does not match any of the regular expressions in this
|
||||
# file, the "DEFAULT" line is used, if it is specified.
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
@@ -1,21 +0,0 @@
|
||||
# The "verifymsg" file is used to allow verification of logging
|
||||
# information. It works best when a template (as specified in the
|
||||
# rcsinfo file) is provided for the logging procedure. Given a
|
||||
# template with locations for, a bug-id number, a list of people who
|
||||
# reviewed the code before it can be checked in, and an external
|
||||
# process to catalog the differences that were code reviewed, the
|
||||
# following test can be applied to the code:
|
||||
#
|
||||
# Making sure that the entered bug-id number is correct.
|
||||
# Validating that the code that was reviewed is indeed the code being
|
||||
# checked in (using the bug-id number or a seperate review
|
||||
# number to identify this particular code set.).
|
||||
#
|
||||
# If any of the above test failed, then the commit would be aborted.
|
||||
#
|
||||
# Actions such as mailing a copy of the report to each reviewer are
|
||||
# better handled by an entry in the loginfo file.
|
||||
#
|
||||
# One thing that should be noted is the the ALL keyword is not
|
||||
# supported. There can be only one entry that matches a given
|
||||
# repository.
|
||||
@@ -1,18 +0,0 @@
|
||||
drevil
|
||||
inquisitor
|
||||
mysterial
|
||||
DTP
|
||||
randomtiger
|
||||
wmcoolmon
|
||||
unknownplayer
|
||||
phreak
|
||||
bobboau
|
||||
righteous1
|
||||
sesquipedalian
|
||||
Goober5000
|
||||
dkharrat
|
||||
daveb
|
||||
EdrickV
|
||||
OldMan
|
||||
komet
|
||||
penguin
|
||||
@@ -0,0 +1,25 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
configure
|
||||
FS2_Open.prj
|
||||
FS2_Open.prj.bak
|
||||
FS2_Open.pws
|
||||
.tm_project.cache
|
||||
config.guess
|
||||
config.cache
|
||||
config.log
|
||||
config.status
|
||||
config.sub
|
||||
depcomp
|
||||
install-sh
|
||||
missing
|
||||
mkinstalldirs
|
||||
autom4te*
|
||||
aclocal.m4
|
||||
Freespace2.dsp
|
||||
Freespace2.dsw
|
||||
Freespace2.ncb
|
||||
Freespace2.opt
|
||||
Freespace2.plg
|
||||
Release
|
||||
Debug
|
||||
+64
-1
@@ -2,4 +2,67 @@
|
||||
#
|
||||
# This file uses GNU Automake to generate makefiles
|
||||
|
||||
SUBDIRS = code
|
||||
SUBDIRS = libjpeg code
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
FS2OpenSCPReadMe.doc \
|
||||
projects/MSVC_2005/Freespace2.sln \
|
||||
projects/MSVC_2005/Freespace2.vcproj \
|
||||
projects/MSVC_2005/code.vcproj \
|
||||
projects/MSVC_6/Freespace2.dsp \
|
||||
projects/MSVC_6/Freespace2.dsw \
|
||||
projects/MSVC_6/code.dsp \
|
||||
projects/MSVC_6/libjpeg.dsp \
|
||||
projects/MSVC_6/wxFRED2.dsp \
|
||||
projects/anjuta1/FS2_Open.prj \
|
||||
projects/anjuta1/README
|
||||
|
||||
|
||||
# D_ variants are defaults and should always be used
|
||||
AM_CXXFLAGS = -I./code @D_CFLAGS@
|
||||
AM_LDFLAGS = @D_LDFLAGS@
|
||||
|
||||
EXTRA_PROGRAMS = cfilearchiver cfileextractor cryptstring scramble
|
||||
|
||||
###############################################################################
|
||||
##
|
||||
## Begin utilitites
|
||||
##
|
||||
|
||||
# cfilearchiver -- to create VPs
|
||||
cfilearchiver_SOURCES = \
|
||||
code/cfilearchiver/cfilearchiver.cpp
|
||||
|
||||
# cfileextractor -- to extract files from VPs
|
||||
cfileextractor_SOURCES = \
|
||||
code/cfileextractor/cfileextractor.cpp
|
||||
|
||||
# cryptstring -- to encrypt strings that are used as cheat codes
|
||||
cryptstring_SOURCES = \
|
||||
code/cryptstring/cryptstring.cpp
|
||||
|
||||
# scramble -- to encrypt tables
|
||||
scramble_SOURCES = \
|
||||
code/parse/encrypt.cpp \
|
||||
code/scramble/scramble.cpp \
|
||||
code/scramble/scramble.h
|
||||
|
||||
|
||||
# catch all to build utilitites
|
||||
tools: cfilearchiver cfileextractor cryptstring scramble
|
||||
|
||||
|
||||
# cleaning
|
||||
clean-tools:
|
||||
-test -z "$(EXTRA_PROGRAMS)" || rm -f $(EXTRA_PROGRAMS)
|
||||
|
||||
##
|
||||
## End utilitites
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
|
||||
# make sure we get this stuff cleaned up
|
||||
clean-generic: clean-tools
|
||||
|
||||
@@ -1,506 +0,0 @@
|
||||
# Makefile.in generated by automake 1.7.2 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
|
||||
# Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
# Makefile.am for fs2_open (top level)
|
||||
#
|
||||
# This file uses GNU Automake to generate makefiles
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = .
|
||||
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_triplet = @host@
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DX8_INCLUDE = @DX8_INCLUDE@
|
||||
DX8_LIB = @DX8_LIB@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EXEEXT = @EXEEXT@
|
||||
FS2_GRSOFT_FALSE = @FS2_GRSOFT_FALSE@
|
||||
FS2_GRSOFT_TRUE = @FS2_GRSOFT_TRUE@
|
||||
FS2_JOYSTICK_FALSE = @FS2_JOYSTICK_FALSE@
|
||||
FS2_JOYSTICK_TRUE = @FS2_JOYSTICK_TRUE@
|
||||
FS2_NETWORKING_FALSE = @FS2_NETWORKING_FALSE@
|
||||
FS2_NETWORKING_TRUE = @FS2_NETWORKING_TRUE@
|
||||
FS2_OS_UNIX_FALSE = @FS2_OS_UNIX_FALSE@
|
||||
FS2_OS_UNIX_TRUE = @FS2_OS_UNIX_TRUE@
|
||||
FS2_OS_WIN32_FALSE = @FS2_OS_WIN32_FALSE@
|
||||
FS2_OS_WIN32_TRUE = @FS2_OS_WIN32_TRUE@
|
||||
FS2_SOUND_FALSE = @FS2_SOUND_FALSE@
|
||||
FS2_SOUND_TRUE = @FS2_SOUND_TRUE@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__quote = @am__quote@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
|
||||
SUBDIRS = code
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_SOURCES =
|
||||
|
||||
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
|
||||
ps-recursive install-info-recursive uninstall-info-recursive \
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS aclocal.m4 config.guess config.sub configure \
|
||||
configure.in depcomp install-sh missing mkinstalldirs
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
|
||||
|
||||
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
$(ACLOCAL_M4): configure.in
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
uninstall-info-am:
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@set fnord $$MAKEFLAGS; amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $$MAKEFLAGS; amf=$$2; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ETAGS = etags
|
||||
ETAGSFLAGS =
|
||||
|
||||
CTAGS = ctags
|
||||
CTAGSFLAGS =
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|
||||
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
top_distdir = .
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
|
||||
am__remove_distdir = \
|
||||
{ test ! -d $(distdir) \
|
||||
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr $(distdir); }; }
|
||||
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
mkdir $(distdir)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkinstalldirs) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
(cd $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" \
|
||||
distdir=../$(distdir)/$$subdir \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r $(distdir)
|
||||
dist-gzip: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
$(am__remove_distdir)
|
||||
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
chmod a-w $(distdir)
|
||||
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
|
||||
&& rm -f $(distdir).tar.gz \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
|
||||
$(am__remove_distdir)
|
||||
@echo "$(distdir).tar.gz is ready for distribution" | \
|
||||
sed 'h;s/./=/g;p;x;p;x'
|
||||
distuninstallcheck:
|
||||
cd $(distuninstallcheck_dir) \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
distclean-am: clean-am distclean-generic distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf autom4te.cache
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
uninstall-info: uninstall-info-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
|
||||
clean-generic clean-recursive ctags ctags-recursive dist \
|
||||
dist-all dist-gzip distcheck distclean distclean-generic \
|
||||
distclean-recursive distclean-tags distcleancheck distdir \
|
||||
distuninstallcheck dvi dvi-am dvi-recursive info info-am \
|
||||
info-recursive install install-am install-data install-data-am \
|
||||
install-data-recursive install-exec install-exec-am \
|
||||
install-exec-recursive install-info install-info-am \
|
||||
install-info-recursive install-man install-recursive \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am installdirs-recursive maintainer-clean \
|
||||
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
|
||||
mostlyclean-generic mostlyclean-recursive pdf pdf-am \
|
||||
pdf-recursive ps ps-am ps-recursive tags tags-recursive \
|
||||
uninstall uninstall-am uninstall-info-am \
|
||||
uninstall-info-recursive uninstall-recursive
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
+5
-1
@@ -1,4 +1,8 @@
|
||||
This file is required to keep autoconf/automake from complaining.
|
||||
The "projects" directory contains ready projects for:
|
||||
Microsoft Visual C++ 6
|
||||
Microsoft Visual C++ 2005
|
||||
Anjuta 1 (please see README with project before using)
|
||||
|
||||
|
||||
See the ChangeLog to see what's new.
|
||||
See the INSTALL file for instructions on how to build fs2_open.
|
||||
@@ -0,0 +1,382 @@
|
||||
# Configure paths for SDL
|
||||
# Sam Lantinga 9/21/99
|
||||
# stolen from Manish Singh
|
||||
# stolen back from Frank Belew
|
||||
# stolen from Manish Singh
|
||||
# Shamelessly stolen from Owen Taylor
|
||||
|
||||
dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
|
||||
dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_SDL],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from the sdl-config script
|
||||
dnl
|
||||
AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)],
|
||||
sdl_prefix="$withval", sdl_prefix="")
|
||||
AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)],
|
||||
sdl_exec_prefix="$withval", sdl_exec_prefix="")
|
||||
AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program],
|
||||
, enable_sdltest=yes)
|
||||
|
||||
if test x$sdl_exec_prefix != x ; then
|
||||
sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
if test x$sdl_prefix != x ; then
|
||||
sdl_args="$sdl_args --prefix=$sdl_prefix"
|
||||
if test x${SDL_CONFIG+set} != xset ; then
|
||||
SDL_CONFIG=$sdl_prefix/bin/sdl-config
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_REQUIRE([AC_CANONICAL_TARGET])
|
||||
PATH="$prefix/bin:$prefix/usr/bin:$PATH"
|
||||
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH])
|
||||
min_sdl_version=ifelse([$1], ,0.11.0,$1)
|
||||
AC_MSG_CHECKING(for SDL - version >= $min_sdl_version)
|
||||
no_sdl=""
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
no_sdl=yes
|
||||
else
|
||||
SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags`
|
||||
SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs`
|
||||
|
||||
sdl_major_version=`$SDL_CONFIG $sdl_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_sdltest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_CXXFLAGS="$CXXFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed SDL is sufficiently new. (Also sanity
|
||||
dnl checks the results of sdl-config to some extent
|
||||
dnl
|
||||
rm -f conf.sdltest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "SDL.h"
|
||||
|
||||
char*
|
||||
my_strdup (char *str)
|
||||
{
|
||||
char *new_str;
|
||||
|
||||
if (str)
|
||||
{
|
||||
new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char));
|
||||
strcpy (new_str, str);
|
||||
}
|
||||
else
|
||||
new_str = NULL;
|
||||
|
||||
return new_str;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
/* This hangs on some systems (?)
|
||||
system ("touch conf.sdltest");
|
||||
*/
|
||||
{ FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); }
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = my_strdup("$min_sdl_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_sdl_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (($sdl_major_version > major) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version > minor)) ||
|
||||
(($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version);
|
||||
printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro);
|
||||
printf("*** best to upgrade to the required version.\n");
|
||||
printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n");
|
||||
printf("*** to point to the correct copy of sdl-config, and remove the file\n");
|
||||
printf("*** config.cache before re-running configure\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_sdl" = x ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$SDL_CONFIG" = "no" ; then
|
||||
echo "*** The sdl-config script installed by SDL could not be found"
|
||||
echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in"
|
||||
echo "*** your path, or set the SDL_CONFIG environment variable to the"
|
||||
echo "*** full path to sdl-config."
|
||||
else
|
||||
if test -f conf.sdltest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run SDL test program, checking why..."
|
||||
CFLAGS="$CFLAGS $SDL_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
|
||||
LIBS="$LIBS $SDL_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include "SDL.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{ return 0; }
|
||||
#undef main
|
||||
#define main K_and_R_C_main
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding SDL or finding the wrong"
|
||||
echo "*** version of SDL. If it is not finding SDL, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means SDL was incorrectly installed"
|
||||
echo "*** or that you have moved SDL since it was installed. In the latter case, you"
|
||||
echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
SDL_CFLAGS=""
|
||||
SDL_LIBS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(SDL_CFLAGS)
|
||||
AC_SUBST(SDL_LIBS)
|
||||
rm -f conf.sdltest
|
||||
])
|
||||
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Macros for wxWindows detection. Typically used in configure.in as:
|
||||
dnl
|
||||
dnl AC_ARG_ENABLE(...)
|
||||
dnl AC_ARG_WITH(...)
|
||||
dnl ...
|
||||
dnl AM_OPTIONS_WXCONFIG
|
||||
dnl ...
|
||||
dnl ...
|
||||
dnl AM_PATH_WXCONFIG(2.3.4, wxWin=1)
|
||||
dnl if test "$wxWin" != 1; then
|
||||
dnl AC_MSG_ERROR([
|
||||
dnl wxWindows must be installed on your system
|
||||
dnl but wx-config script couldn't be found.
|
||||
dnl
|
||||
dnl Please check that wx-config is in path, the directory
|
||||
dnl where wxWindows libraries are installed (returned by
|
||||
dnl 'wx-config --libs' command) is in LD_LIBRARY_PATH or
|
||||
dnl equivalent variable and wxWindows version is 2.3.4 or above.
|
||||
dnl ])
|
||||
dnl fi
|
||||
dnl CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
|
||||
dnl CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS_ONLY"
|
||||
dnl CFLAGS="$CFLAGS $WX_CFLAGS_ONLY"
|
||||
dnl
|
||||
dnl LDFLAGS="$LDFLAGS $WX_LIBS"
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl AM_OPTIONS_WXCONFIG
|
||||
dnl
|
||||
dnl adds support for --wx-prefix, --wx-exec-prefix and --wx-config
|
||||
dnl command line options
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
AC_DEFUN([AM_OPTIONS_WXCONFIG],
|
||||
[
|
||||
AC_ARG_WITH(wx-prefix, [ --with-wx-prefix=PREFIX Prefix where wxWindows is installed (optional)],
|
||||
wx_config_prefix="$withval", wx_config_prefix="")
|
||||
AC_ARG_WITH(wx-exec-prefix,[ --with-wx-exec-prefix=PREFIX Exec prefix where wxWindows is installed (optional)],
|
||||
wx_config_exec_prefix="$withval", wx_config_exec_prefix="")
|
||||
AC_ARG_WITH(wx-config,[ --with-wx-config=CONFIG wx-config script to use (optional)],
|
||||
wx_config_name="$withval", wx_config_name="")
|
||||
])
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl AM_PATH_WXCONFIG(VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl
|
||||
dnl Test for wxWindows, and define WX_C*FLAGS, WX_LIBS and WX_LIBS_STATIC
|
||||
dnl (the latter is for static linking against wxWindows). Set WX_CONFIG_NAME
|
||||
dnl environment variable to override the default name of the wx-config script
|
||||
dnl to use. Set WX_CONFIG_PATH to specify the full path to wx-config - in this
|
||||
dnl case the macro won't even waste time on tests for its existence.
|
||||
dnl ---------------------------------------------------------------------------
|
||||
|
||||
dnl
|
||||
dnl Get the cflags and libraries from the wx-config script
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_WXCONFIG],
|
||||
[
|
||||
dnl do we have wx-config name: it can be wx-config or wxd-config or ...
|
||||
if test x${WX_CONFIG_NAME+set} != xset ; then
|
||||
WX_CONFIG_NAME=wx-config
|
||||
fi
|
||||
if test "x$wx_config_name" != x ; then
|
||||
WX_CONFIG_NAME="$wx_config_name"
|
||||
fi
|
||||
|
||||
dnl deal with optional prefixes
|
||||
if test x$wx_config_exec_prefix != x ; then
|
||||
wx_config_args="$wx_config_args --exec-prefix=$wx_config_exec_prefix"
|
||||
WX_LOOKUP_PATH="$wx_config_exec_prefix/bin"
|
||||
fi
|
||||
if test x$wx_config_prefix != x ; then
|
||||
wx_config_args="$wx_config_args --prefix=$wx_config_prefix"
|
||||
WX_LOOKUP_PATH="$WX_LOOKUP_PATH:$wx_config_prefix/bin"
|
||||
fi
|
||||
|
||||
dnl don't search the PATH if WX_CONFIG_NAME is absolute filename
|
||||
if test -x "$WX_CONFIG_NAME" ; then
|
||||
AC_MSG_CHECKING(for wx-config)
|
||||
WX_CONFIG_PATH="$WX_CONFIG_NAME"
|
||||
AC_MSG_RESULT($WX_CONFIG_PATH)
|
||||
else
|
||||
AC_PATH_PROG(WX_CONFIG_PATH, $WX_CONFIG_NAME, no, "$WX_LOOKUP_PATH:$PATH")
|
||||
fi
|
||||
|
||||
if test "$WX_CONFIG_PATH" != "no" ; then
|
||||
WX_VERSION=""
|
||||
no_wx=""
|
||||
|
||||
min_wx_version=ifelse([$1], ,2.2.1,$1)
|
||||
AC_MSG_CHECKING(for wxWindows version >= $min_wx_version)
|
||||
|
||||
WX_CONFIG_WITH_ARGS="$WX_CONFIG_PATH $wx_config_args"
|
||||
|
||||
WX_VERSION=`$WX_CONFIG_WITH_ARGS --version`
|
||||
wx_config_major_version=`echo $WX_VERSION | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
wx_config_minor_version=`echo $WX_VERSION | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
wx_config_micro_version=`echo $WX_VERSION | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
wx_requested_major_version=`echo $min_wx_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
wx_requested_minor_version=`echo $min_wx_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
wx_requested_micro_version=`echo $min_wx_version | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
|
||||
wx_ver_ok=""
|
||||
if test $wx_config_major_version -gt $wx_requested_major_version; then
|
||||
wx_ver_ok=yes
|
||||
else
|
||||
if test $wx_config_major_version -eq $wx_requested_major_version; then
|
||||
if test $wx_config_minor_version -gt $wx_requested_minor_version; then
|
||||
wx_ver_ok=yes
|
||||
else
|
||||
if test $wx_config_minor_version -eq $wx_requested_minor_version; then
|
||||
if test $wx_config_micro_version -ge $wx_requested_micro_version; then
|
||||
wx_ver_ok=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$wx_ver_ok" = x ; then
|
||||
no_wx=yes
|
||||
else
|
||||
WX_LIBS=`$WX_CONFIG_WITH_ARGS --libs`
|
||||
WX_LIBS_STATIC=`$WX_CONFIG_WITH_ARGS --static --libs`
|
||||
|
||||
dnl starting with version 2.2.6 wx-config has --cppflags argument
|
||||
wx_has_cppflags=""
|
||||
if test $wx_config_major_version -gt 2; then
|
||||
wx_has_cppflags=yes
|
||||
else
|
||||
if test $wx_config_major_version -eq 2; then
|
||||
if test $wx_config_minor_version -gt 2; then
|
||||
wx_has_cppflags=yes
|
||||
else
|
||||
if test $wx_config_minor_version -eq 2; then
|
||||
if test $wx_config_micro_version -ge 6; then
|
||||
wx_has_cppflags=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$wx_has_cppflags" = x ; then
|
||||
dnl no choice but to define all flags like CFLAGS
|
||||
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
|
||||
WX_CPPFLAGS=$WX_CFLAGS
|
||||
WX_CXXFLAGS=$WX_CFLAGS
|
||||
|
||||
WX_CFLAGS_ONLY=$WX_CFLAGS
|
||||
WX_CXXFLAGS_ONLY=$WX_CFLAGS
|
||||
else
|
||||
dnl we have CPPFLAGS included in CFLAGS included in CXXFLAGS
|
||||
WX_CPPFLAGS=`$WX_CONFIG_WITH_ARGS --cppflags`
|
||||
WX_CXXFLAGS=`$WX_CONFIG_WITH_ARGS --cxxflags`
|
||||
WX_CFLAGS=`$WX_CONFIG_WITH_ARGS --cflags`
|
||||
|
||||
WX_CFLAGS_ONLY=`echo $WX_CFLAGS | sed "s@^$WX_CPPFLAGS *@@"`
|
||||
WX_CXXFLAGS_ONLY=`echo $WX_CXXFLAGS | sed "s@^$WX_CFLAGS *@@"`
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$no_wx" = x ; then
|
||||
AC_MSG_RESULT(yes (version $WX_VERSION))
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
if test "x$WX_VERSION" = x; then
|
||||
dnl no wx-config at all
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(no (version $WX_VERSION is not new enough))
|
||||
fi
|
||||
|
||||
WX_CFLAGS=""
|
||||
WX_CPPFLAGS=""
|
||||
WX_CXXFLAGS=""
|
||||
WX_LIBS=""
|
||||
WX_LIBS_STATIC=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(WX_CPPFLAGS)
|
||||
AC_SUBST(WX_CFLAGS)
|
||||
AC_SUBST(WX_CXXFLAGS)
|
||||
AC_SUBST(WX_CFLAGS_ONLY)
|
||||
AC_SUBST(WX_CXXFLAGS_ONLY)
|
||||
AC_SUBST(WX_LIBS)
|
||||
AC_SUBST(WX_LIBS_STATIC)
|
||||
AC_SUBST(WX_VERSION)
|
||||
])
|
||||
Executable
+137
@@ -0,0 +1,137 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
PKG_NAME="fs2_open"
|
||||
|
||||
# check the version of a package
|
||||
check_version() {
|
||||
COMMAND=$1
|
||||
MAJOR=$2
|
||||
MINOR=$3
|
||||
MICRO=$4
|
||||
|
||||
($COMMAND --version) </dev/null >/dev/null 2>&1 || return 1
|
||||
|
||||
ver=`$COMMAND --version|head -n 1|sed 's/^.*) //'|sed 's/ (.*)//'`
|
||||
major=`echo $ver | cut -d. -f1 | sed s/[a-zA-Z\-].*//g`
|
||||
minor=`echo $ver | cut -d. -f2 | sed s/[a-zA-Z\-].*//g`
|
||||
micro=`echo $ver | cut -d. -f3 | sed s/[a-zA-Z\-].*//g`
|
||||
test -z "$major" && major=0
|
||||
test -z "$minor" && minor=0
|
||||
test -z "$micro" && micro=0
|
||||
|
||||
fail=0
|
||||
if [ ! "$major" -gt "$MAJOR" ]; then
|
||||
if [ "$major" -lt "$MAJOR" ]; then
|
||||
fail=1
|
||||
elif [ ! "$minor" -gt "$MINOR" ]; then
|
||||
if [ "$minor" -lt "$MINOR" ]; then
|
||||
fail=1
|
||||
elif [ "$micro" -lt "$MICRO" ]; then
|
||||
fail=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
return "$fail"
|
||||
}
|
||||
|
||||
AUTOMAKE=
|
||||
ACLOCAL=
|
||||
DIE=0
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "**Error**: You must have \`autoconf' installed to."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
for AM in automake-1.9 automake-1.8 automake-1.7 automake-1.6 automake; do
|
||||
(check_version "$AM" 1 6 1) && {
|
||||
AUTOMAKE="$AM"
|
||||
break
|
||||
}
|
||||
done
|
||||
|
||||
if [ -z "$AUTOMAKE" ]; then
|
||||
echo
|
||||
echo "**Error**: You must have \`automake' version 1.6.1 or greater"
|
||||
echo "installed to compile $PKG_NAME. Download the appropriate package"
|
||||
echo "for your distribution, or get the source tarball at"
|
||||
echo "ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
fi
|
||||
|
||||
# if no automake, don't bother testing for aclocal
|
||||
test -z "$AUTOMAKE" || {
|
||||
for ACL in aclocal-1.9 aclocal-1.8 aclocal-1.7 aclocal-1.6 aclocal; do
|
||||
(check_version "$ACL" 1 6 1) && {
|
||||
ACLOCAL="$ACL"
|
||||
break
|
||||
}
|
||||
done
|
||||
|
||||
if [ -z "$ACLOCAL" ]; then
|
||||
echo
|
||||
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
|
||||
echo "installed seems to be outdated. Get a recent package from"
|
||||
echo "ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
fi
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$*"; then
|
||||
echo "**Warning**: I am going to run \`configure' with no arguments."
|
||||
echo "If you wish to pass any to it, please specify them on the"
|
||||
echo \`$0\'" command line."
|
||||
echo
|
||||
fi
|
||||
|
||||
case $CC in
|
||||
xlc )
|
||||
am_opt=--include-deps;;
|
||||
esac
|
||||
|
||||
for coin in `find $srcdir -name configure.ac -print`
|
||||
do
|
||||
dr=`dirname $coin`
|
||||
if test -f $dr/NO-AUTO-GEN; then
|
||||
echo skipping $dr -- flagged as no auto-gen
|
||||
else
|
||||
echo processing $dr
|
||||
macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
|
||||
( cd $dr
|
||||
aclocalinclude="$ACLOCAL_FLAGS"
|
||||
for k in $macrodirs; do
|
||||
if test -d $k; then
|
||||
aclocalinclude="$aclocalinclude -I $k"
|
||||
##else
|
||||
## echo "**Warning**: No such directory \`$k'. Ignored."
|
||||
fi
|
||||
done
|
||||
echo "Running $ACLOCAL $aclocalinclude ..."
|
||||
"$ACLOCAL" $aclocalinclude
|
||||
echo "Running $AUTOMAKE --add-missing --copy --foreign $am_opt ..."
|
||||
"$AUTOMAKE" --add-missing --copy --foreign $am_opt
|
||||
echo "Running autoconf..."
|
||||
autoconf
|
||||
)
|
||||
fi
|
||||
done
|
||||
|
||||
#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
|
||||
|
||||
if test x$NOCONFIGURE = x; then
|
||||
echo Running $srcdir/configure $conf_flags "$@" ...
|
||||
$srcdir/configure $conf_flags "$@" \
|
||||
&& echo Now type \`make\' to compile $PKG_NAME.
|
||||
else
|
||||
echo Skipping configure process.
|
||||
fi
|
||||
@@ -0,0 +1,5 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
fs2_open_d
|
||||
fs2_open_r
|
||||
.deps
|
||||
+650
-283
@@ -1,305 +1,672 @@
|
||||
# code/Makefile.am for fs2_open
|
||||
#
|
||||
# $Id: Makefile.am,v 1.2 2003-03-11 19:00:05 penguin Exp $
|
||||
## code/Makefile.am for fs2_open
|
||||
##
|
||||
## $Id: Makefile.am,v 1.20 2005-07-18 03:37:35 taylor Exp $
|
||||
|
||||
noinst_PROGRAMS = fs2
|
||||
|
||||
fs2_SOURCES = \
|
||||
anim/animplay.cpp \
|
||||
anim/packunpack.cpp \
|
||||
asteroid/asteroid.cpp \
|
||||
bmpman/bmpman.cpp \
|
||||
cfile/cfile.cpp \
|
||||
cfile/cfilearchive.cpp \
|
||||
cfile/cfilelist.cpp \
|
||||
cfile/cfilesystem.cpp \
|
||||
cmdline/cmdline.cpp \
|
||||
cmeasure/cmeasure.cpp \
|
||||
controlconfig/controlsconfig.cpp \
|
||||
controlconfig/controlsconfigcommon.cpp \
|
||||
cutscene/cutscenes.cpp \
|
||||
debris/debris.cpp \
|
||||
debugconsole/console.cpp \
|
||||
decals/decals.cpp \
|
||||
demo/demo.cpp \
|
||||
exceptionhandler/exceptionhandler.cpp \
|
||||
fireball/fireballs.cpp \
|
||||
fireball/warpineffect.cpp \
|
||||
freespace2/freespace.cpp \
|
||||
freespace2/levelpaging.cpp \
|
||||
gamehelp/contexthelp.cpp \
|
||||
gamehelp/gameplayhelp.cpp \
|
||||
gamesequence/gamesequence.cpp \
|
||||
globalincs/alphacolors.cpp \
|
||||
globalincs/crypt.cpp \
|
||||
globalincs/systemvars.cpp \
|
||||
globalincs/version.cpp \
|
||||
graphics/2d.cpp \
|
||||
graphics/aaline.cpp \
|
||||
graphics/bitblt.cpp \
|
||||
graphics/circle.cpp \
|
||||
graphics/colors.cpp \
|
||||
graphics/font.cpp \
|
||||
graphics/gradient.cpp \
|
||||
graphics/gropengl.cpp \
|
||||
graphics/grzbuffer.cpp \
|
||||
graphics/line.cpp \
|
||||
graphics/pixel.cpp \
|
||||
graphics/rect.cpp \
|
||||
graphics/scaler.cpp \
|
||||
graphics/shade.cpp \
|
||||
hud/hud.cpp \
|
||||
hud/hudartillery.cpp \
|
||||
hud/hudbrackets.cpp \
|
||||
hud/hudconfig.cpp \
|
||||
hud/hudescort.cpp \
|
||||
hud/hudets.cpp \
|
||||
hud/hudlock.cpp \
|
||||
hud/hudmessage.cpp \
|
||||
hud/hudreticle.cpp \
|
||||
hud/hudshield.cpp \
|
||||
hud/hudsquadmsg.cpp \
|
||||
hud/hudtarget.cpp \
|
||||
hud/hudtargetbox.cpp \
|
||||
hud/hudwingmanstatus.cpp \
|
||||
io/key.cpp \
|
||||
io/keycontrol.cpp \
|
||||
io/mouse.cpp \
|
||||
io/timer.cpp \
|
||||
jumpnode/jumpnode.cpp \
|
||||
lighting/lighting.cpp \
|
||||
localization/fhash.cpp \
|
||||
localization/localize.cpp \
|
||||
math/fix.cpp \
|
||||
math/floating.cpp \
|
||||
math/fvi.cpp \
|
||||
math/spline.cpp \
|
||||
math/staticrand.cpp \
|
||||
math/vecmat.cpp \
|
||||
menuui/barracks.cpp \
|
||||
menuui/credits.cpp \
|
||||
menuui/fishtank.cpp \
|
||||
menuui/mainhallmenu.cpp \
|
||||
menuui/mainhalltemp.cpp \
|
||||
menuui/optionsmenu.cpp \
|
||||
menuui/playermenu.cpp \
|
||||
menuui/readyroom.cpp \
|
||||
menuui/snazzyui.cpp \
|
||||
menuui/techmenu.cpp \
|
||||
menuui/trainingmenu.cpp \
|
||||
mission/missionbriefcommon.cpp \
|
||||
mission/missioncampaign.cpp \
|
||||
mission/missiongoals.cpp \
|
||||
mission/missiongrid.cpp \
|
||||
mission/missionhotkey.cpp \
|
||||
mission/missionload.cpp \
|
||||
mission/missionlog.cpp \
|
||||
mission/missionmessage.cpp \
|
||||
mission/missionparse.cpp \
|
||||
mission/missiontraining.cpp \
|
||||
missionui/missionbrief.cpp \
|
||||
missionui/missioncmdbrief.cpp \
|
||||
missionui/missiondebrief.cpp \
|
||||
missionui/missionloopbrief.cpp \
|
||||
missionui/missionpause.cpp \
|
||||
missionui/missionrecommend.cpp \
|
||||
missionui/missionscreencommon.cpp \
|
||||
missionui/missionshipchoice.cpp \
|
||||
missionui/missionstats.cpp \
|
||||
missionui/missionweaponchoice.cpp \
|
||||
missionui/redalert.cpp \
|
||||
model/modelcollide.cpp \
|
||||
model/modelinterp.cpp \
|
||||
model/modeloctant.cpp \
|
||||
model/modelread.cpp \
|
||||
nebula/neb.cpp \
|
||||
nebula/neblightning.cpp \
|
||||
object/collidedebrisship.cpp \
|
||||
object/collidedebrisweapon.cpp \
|
||||
object/collideshipship.cpp \
|
||||
object/collideshipweapon.cpp \
|
||||
object/collideweaponweapon.cpp \
|
||||
object/objcollide.cpp \
|
||||
object/object.cpp \
|
||||
object/objectsort.cpp \
|
||||
observer/observer.cpp \
|
||||
palman/palman.cpp \
|
||||
parse/encrypt.cpp \
|
||||
parse/parselo.cpp \
|
||||
parse/sexp.cpp \
|
||||
particle/particle.cpp \
|
||||
pcxutils/pcxutils.cpp \
|
||||
physics/physics.cpp \
|
||||
playerman/managepilot.cpp \
|
||||
playerman/playercontrol.cpp \
|
||||
popup/popup.cpp \
|
||||
popup/popupdead.cpp \
|
||||
radar/radar.cpp \
|
||||
render/3dclipper.cpp \
|
||||
render/3ddraw.cpp \
|
||||
render/3dlaser.cpp \
|
||||
render/3dmath.cpp \
|
||||
render/3dsetup.cpp \
|
||||
ship/afterburner.cpp \
|
||||
ship/ai.cpp \
|
||||
ship/aibig.cpp \
|
||||
ship/aicode.cpp \
|
||||
ship/aigoals.cpp \
|
||||
ship/awacs.cpp \
|
||||
ship/shield.cpp \
|
||||
ship/ship.cpp \
|
||||
ship/shipcontrails.cpp \
|
||||
ship/shipfx.cpp \
|
||||
ship/shiphit.cpp \
|
||||
starfield/nebula.cpp \
|
||||
starfield/starfield.cpp \
|
||||
starfield/supernova.cpp \
|
||||
stats/medals.cpp \
|
||||
stats/scoring.cpp \
|
||||
stats/stats.cpp \
|
||||
tgautils/tgautils.cpp \
|
||||
ui/button.cpp \
|
||||
ui/checkbox.cpp \
|
||||
ui/gadget.cpp \
|
||||
ui/icon.cpp \
|
||||
ui/inputbox.cpp \
|
||||
ui/keytrap.cpp \
|
||||
ui/listbox.cpp \
|
||||
ui/radio.cpp \
|
||||
ui/scroll.cpp \
|
||||
ui/slider.cpp \
|
||||
ui/slider2.cpp \
|
||||
ui/uidraw.cpp \
|
||||
ui/uimouse.cpp \
|
||||
ui/window.cpp \
|
||||
weapon/beam.cpp \
|
||||
weapon/corkscrew.cpp \
|
||||
weapon/emp.cpp \
|
||||
weapon/flak.cpp \
|
||||
weapon/muzzleflash.cpp \
|
||||
weapon/shockwave.cpp \
|
||||
weapon/swarm.cpp \
|
||||
weapon/trails.cpp \
|
||||
weapon/weapons.cpp
|
||||
EXTRA_DIST = \
|
||||
freespace2/app_icon.ico \
|
||||
freespace2/freespace.rc \
|
||||
freespace2/freespaceresource.h \
|
||||
freespace2/goal_com.bmp \
|
||||
freespace2/goal_fail.bmp \
|
||||
freespace2/goal_inc.bmp \
|
||||
freespace2/goal_none.bmp \
|
||||
freespace2/goal_ord.bmp \
|
||||
wxfred2/res/FRED.ico \
|
||||
wxfred2/wxfred.xrc
|
||||
|
||||
|
||||
# D_ variants are defaults and should always be used
|
||||
# FS2_ variants are for game building and wxFRED
|
||||
AM_CXXFLAGS = @D_CFLAGS@ @FS2_CXXFLAGS@
|
||||
AM_LDFLAGS = @D_LDFLAGS@ @FS2_LDFLAGS@
|
||||
|
||||
noinst_LIBRARIES = libcode.a
|
||||
noinst_PROGRAMS = @FS2_BINARY@
|
||||
|
||||
EXTRA_PROGRAMS = fs2_open_r fs2_open_d wxFRED2_r wxFRED2_d
|
||||
|
||||
###############################################################################
|
||||
##
|
||||
## Begin CORE library
|
||||
##
|
||||
|
||||
FS2_SOURCES = \
|
||||
ai/ai.cpp \
|
||||
ai/ai.h \
|
||||
ai/aibig.cpp \
|
||||
ai/aibig.h \
|
||||
ai/aicode.cpp \
|
||||
ai/aigoals.cpp \
|
||||
ai/aigoals.h \
|
||||
ai/aiinternal.h \
|
||||
ai/ailocal.h \
|
||||
ai/aiturret.cpp \
|
||||
anim/animplay.cpp \
|
||||
anim/animplay.h \
|
||||
anim/packunpack.cpp \
|
||||
anim/packunpack.h \
|
||||
asteroid/asteroid.cpp \
|
||||
asteroid/asteroid.h \
|
||||
autopilot/autopilot.cpp \
|
||||
autopilot/autopilot.h \
|
||||
bmpman/bm_internal.h \
|
||||
bmpman/bmpman.cpp \
|
||||
bmpman/bmpman.h \
|
||||
camera/camera.cpp \
|
||||
camera/camera.h \
|
||||
cfile/cfile.cpp \
|
||||
cfile/cfile.h \
|
||||
cfile/cfilearchive.cpp \
|
||||
cfile/cfilearchive.h \
|
||||
cfile/cfilelist.cpp \
|
||||
cfile/cfilesystem.cpp \
|
||||
cfile/cfilesystem.h \
|
||||
cmdline/cmdline.cpp \
|
||||
cmdline/cmdline.h \
|
||||
cmeasure/cmeasure.cpp \
|
||||
cmeasure/cmeasure.h \
|
||||
controlconfig/controlsconfig.cpp \
|
||||
controlconfig/controlsconfig.h \
|
||||
controlconfig/controlsconfigcommon.cpp \
|
||||
cutscene/cutscenes.cpp \
|
||||
cutscene/cutscenes.h \
|
||||
cutscene/movie.cpp \
|
||||
cutscene/movie.h \
|
||||
ddsutils/ddsutils.cpp \
|
||||
ddsutils/ddsutils.h \
|
||||
debris/debris.cpp \
|
||||
debris/debris.h \
|
||||
debugconsole/console.cpp \
|
||||
debugconsole/dbugfile.h \
|
||||
debugconsole/timerbar.cpp \
|
||||
debugconsole/timerbar.h \
|
||||
decals/decals.cpp \
|
||||
decals/decals.h \
|
||||
demo/demo.cpp \
|
||||
demo/demo.h \
|
||||
exceptionhandler/exceptionhandler.cpp \
|
||||
exceptionhandler/exceptionhandler.h \
|
||||
fireball/fireballs.cpp \
|
||||
fireball/fireballs.h \
|
||||
fireball/warpineffect.cpp \
|
||||
fs2open_pxo/Client.cpp \
|
||||
fs2open_pxo/Client.h \
|
||||
fs2open_pxo/TCP_Client.cpp \
|
||||
fs2open_pxo/TCP_Socket.cpp \
|
||||
fs2open_pxo/TCP_Socket.h \
|
||||
fs2open_pxo/protocol.h \
|
||||
fs2open_pxo/udpsocket.cpp \
|
||||
fs2open_pxo/udpsocket.h \
|
||||
gamehelp/contexthelp.cpp \
|
||||
gamehelp/contexthelp.h \
|
||||
gamehelp/gameplayhelp.cpp \
|
||||
gamehelp/gameplayhelp.h \
|
||||
gamesequence/gamesequence.cpp \
|
||||
gamesequence/gamesequence.h \
|
||||
globalincs/alphacolors.cpp \
|
||||
globalincs/alphacolors.h \
|
||||
globalincs/crypt.cpp \
|
||||
globalincs/crypt.h \
|
||||
globalincs/globals.h \
|
||||
globalincs/linklist.h \
|
||||
globalincs/pstypes.h \
|
||||
globalincs/systemvars.cpp \
|
||||
globalincs/systemvars.h \
|
||||
globalincs/version.cpp \
|
||||
globalincs/version.h \
|
||||
graphics/2d.cpp \
|
||||
graphics/2d.h \
|
||||
graphics/font.cpp \
|
||||
graphics/font.h \
|
||||
graphics/grbatch.cpp \
|
||||
graphics/grbatch.h \
|
||||
graphics/grinternal.h \
|
||||
graphics/gropengl.cpp \
|
||||
graphics/gropengl.h \
|
||||
graphics/gropenglbmpman.cpp \
|
||||
graphics/gropenglbmpman.h \
|
||||
graphics/gropenglextension.cpp \
|
||||
graphics/gropenglextension.h \
|
||||
graphics/gropengllight.cpp \
|
||||
graphics/gropengllight.h \
|
||||
graphics/gropengltexture.cpp \
|
||||
graphics/gropengltexture.h \
|
||||
graphics/gropengltnl.cpp \
|
||||
graphics/gropengltnl.h \
|
||||
graphics/grstub.h \
|
||||
graphics/grzbuffer.cpp \
|
||||
graphics/grzbuffer.h \
|
||||
graphics/line.h \
|
||||
graphics/tmapper.h \
|
||||
hud/hud.cpp \
|
||||
hud/hud.h \
|
||||
hud/hudartillery.cpp \
|
||||
hud/hudartillery.h \
|
||||
hud/hudbrackets.cpp \
|
||||
hud/hudbrackets.h \
|
||||
hud/hudconfig.cpp \
|
||||
hud/hudconfig.h \
|
||||
hud/hudescort.cpp \
|
||||
hud/hudescort.h \
|
||||
hud/hudets.cpp \
|
||||
hud/hudets.h \
|
||||
hud/hudgauges.h \
|
||||
hud/hudlock.cpp \
|
||||
hud/hudlock.h \
|
||||
hud/hudmessage.cpp \
|
||||
hud/hudmessage.h \
|
||||
hud/hudnavigation.cpp \
|
||||
hud/hudnavigation.h \
|
||||
hud/hudobserver.cpp \
|
||||
hud/hudobserver.h \
|
||||
hud/hudparse.cpp \
|
||||
hud/hudparse.h \
|
||||
hud/hudresource.h \
|
||||
hud/hudreticle.cpp \
|
||||
hud/hudreticle.h \
|
||||
hud/hudshield.cpp \
|
||||
hud/hudshield.h \
|
||||
hud/hudsquadmsg.cpp \
|
||||
hud/hudsquadmsg.h \
|
||||
hud/hudtarget.cpp \
|
||||
hud/hudtarget.h \
|
||||
hud/hudtargetbox.cpp \
|
||||
hud/hudtargetbox.h \
|
||||
hud/hudwingmanstatus.cpp \
|
||||
hud/hudwingmanstatus.h \
|
||||
io/key.cpp \
|
||||
io/key.h \
|
||||
io/keycontrol.cpp \
|
||||
io/keycontrol.h \
|
||||
io/mouse.cpp \
|
||||
io/mouse.h \
|
||||
io/timer.cpp \
|
||||
io/timer.h \
|
||||
irc/irc.cpp \
|
||||
irc/irc.h \
|
||||
jpgutils/jpgutils.cpp \
|
||||
jpgutils/jpgutils.h \
|
||||
jumpnode/jumpnode.cpp \
|
||||
jumpnode/jumpnode.h \
|
||||
lab/lab.cpp \
|
||||
lab/lab.h \
|
||||
lab/wmcgui.cpp \
|
||||
lab/wmcgui.h \
|
||||
lighting/lighting.cpp \
|
||||
lighting/lighting.h \
|
||||
localization/fhash.cpp \
|
||||
localization/fhash.h \
|
||||
localization/localize.cpp \
|
||||
localization/localize.h \
|
||||
math/bitarray.h \
|
||||
math/fix.cpp \
|
||||
math/fix.h \
|
||||
math/floating.cpp \
|
||||
math/floating.h \
|
||||
math/fvi.cpp \
|
||||
math/fvi.h \
|
||||
math/spline.cpp \
|
||||
math/spline.h \
|
||||
math/staticrand.cpp \
|
||||
math/staticrand.h \
|
||||
math/vecmat.cpp \
|
||||
math/vecmat.h \
|
||||
menuui/barracks.cpp \
|
||||
menuui/barracks.h \
|
||||
menuui/credits.cpp \
|
||||
menuui/credits.h \
|
||||
menuui/fishtank.cpp \
|
||||
menuui/fishtank.h \
|
||||
menuui/mainhallmenu.cpp \
|
||||
menuui/mainhallmenu.h \
|
||||
menuui/mainhalltemp.cpp \
|
||||
menuui/mainhalltemp.h \
|
||||
menuui/optionsmenu.cpp \
|
||||
menuui/optionsmenu.h \
|
||||
menuui/optionsmenumulti.cpp \
|
||||
menuui/optionsmenumulti.h \
|
||||
menuui/playermenu.cpp \
|
||||
menuui/playermenu.h \
|
||||
menuui/readyroom.cpp \
|
||||
menuui/readyroom.h \
|
||||
menuui/snazzyui.cpp \
|
||||
menuui/snazzyui.h \
|
||||
menuui/storybook.cpp \
|
||||
menuui/storybook.h \
|
||||
menuui/techmenu.cpp \
|
||||
menuui/techmenu.h \
|
||||
menuui/trainingmenu.cpp \
|
||||
menuui/trainingmenu.h \
|
||||
mission/missionbriefcommon.cpp \
|
||||
mission/missionbriefcommon.h \
|
||||
mission/missioncampaign.cpp \
|
||||
mission/missioncampaign.h \
|
||||
mission/missiongoals.cpp \
|
||||
mission/missiongoals.h \
|
||||
mission/missiongrid.cpp \
|
||||
mission/missiongrid.h \
|
||||
mission/missionhotkey.cpp \
|
||||
mission/missionhotkey.h \
|
||||
mission/missionload.cpp \
|
||||
mission/missionload.h \
|
||||
mission/missionlog.cpp \
|
||||
mission/missionlog.h \
|
||||
mission/missionmessage.cpp \
|
||||
mission/missionmessage.h \
|
||||
mission/missionparse.cpp \
|
||||
mission/missionparse.h \
|
||||
mission/missiontraining.cpp \
|
||||
mission/missiontraining.h \
|
||||
missionui/chatbox.cpp \
|
||||
missionui/chatbox.h \
|
||||
missionui/missionbrief.cpp \
|
||||
missionui/missionbrief.h \
|
||||
missionui/missioncmdbrief.cpp \
|
||||
missionui/missioncmdbrief.h \
|
||||
missionui/missiondebrief.cpp \
|
||||
missionui/missiondebrief.h \
|
||||
missionui/missionloopbrief.cpp \
|
||||
missionui/missionloopbrief.h \
|
||||
missionui/missionpause.cpp \
|
||||
missionui/missionpause.h \
|
||||
missionui/missionrecommend.cpp \
|
||||
missionui/missionrecommend.h \
|
||||
missionui/missionscreencommon.cpp \
|
||||
missionui/missionscreencommon.h \
|
||||
missionui/missionshipchoice.cpp \
|
||||
missionui/missionshipchoice.h \
|
||||
missionui/missionstats.cpp \
|
||||
missionui/missionstats.h \
|
||||
missionui/missionweaponchoice.cpp \
|
||||
missionui/missionweaponchoice.h \
|
||||
missionui/redalert.cpp \
|
||||
missionui/redalert.h \
|
||||
model/model.h \
|
||||
model/modelcollide.cpp \
|
||||
model/modelinterp.cpp \
|
||||
model/modelsinc.h \
|
||||
model/modeloctant.cpp \
|
||||
model/modelread.cpp \
|
||||
nebula/neb.cpp \
|
||||
nebula/neb.h \
|
||||
nebula/neblightning.cpp \
|
||||
nebula/neblightning.h \
|
||||
network/fs2ox.cpp \
|
||||
network/fs2ox.h \
|
||||
network/multi.cpp \
|
||||
network/multi.h \
|
||||
network/multilag.h \
|
||||
network/multimsgs.cpp \
|
||||
network/multimsgs.h \
|
||||
network/multiteamselect.cpp \
|
||||
network/multiteamselect.h \
|
||||
network/multiui.cpp \
|
||||
network/multiui.h \
|
||||
network/multiutil.cpp \
|
||||
network/multiutil.h \
|
||||
network/multi_campaign.cpp \
|
||||
network/multi_campaign.h \
|
||||
network/multi_data.cpp \
|
||||
network/multi_data.h \
|
||||
network/multi_dogfight.cpp \
|
||||
network/multi_dogfight.h \
|
||||
network/multi_endgame.cpp \
|
||||
network/multi_endgame.h \
|
||||
network/multi_ingame.cpp \
|
||||
network/multi_ingame.h \
|
||||
network/multi_kick.cpp \
|
||||
network/multi_kick.h \
|
||||
network/multi_log.cpp \
|
||||
network/multi_log.h \
|
||||
network/multi_obj.cpp \
|
||||
network/multi_obj.h \
|
||||
network/multi_observer.cpp \
|
||||
network/multi_observer.h \
|
||||
network/multi_oo.h \
|
||||
network/multi_options.cpp \
|
||||
network/multi_options.h \
|
||||
network/multi_pause.cpp \
|
||||
network/multi_pause.h \
|
||||
network/multi_pinfo.cpp \
|
||||
network/multi_pinfo.h \
|
||||
network/multi_ping.cpp \
|
||||
network/multi_ping.h \
|
||||
network/multi_pmsg.cpp \
|
||||
network/multi_pmsg.h \
|
||||
network/multi_rate.cpp \
|
||||
network/multi_rate.h \
|
||||
network/multi_respawn.cpp \
|
||||
network/multi_respawn.h \
|
||||
network/multi_team.cpp \
|
||||
network/multi_team.h \
|
||||
network/multi_update.h \
|
||||
network/multi_voice.cpp \
|
||||
network/multi_voice.h \
|
||||
network/multi_xfer.cpp \
|
||||
network/multi_xfer.h \
|
||||
network/psnet.cpp \
|
||||
network/psnet.h \
|
||||
network/psnet2.cpp \
|
||||
network/psnet2.h \
|
||||
object/collidedebrisship.cpp \
|
||||
object/collidedebrisweapon.cpp \
|
||||
object/collideshipship.cpp \
|
||||
object/collideshipweapon.cpp \
|
||||
object/collideweaponweapon.cpp \
|
||||
object/objcollide.cpp \
|
||||
object/objcollide.h \
|
||||
object/objectdock.cpp \
|
||||
object/objectdock.h \
|
||||
object/object.cpp \
|
||||
object/object.h \
|
||||
object/objectsort.cpp \
|
||||
observer/observer.cpp \
|
||||
observer/observer.h \
|
||||
palman/palman.cpp \
|
||||
palman/palman.h \
|
||||
parse/encrypt.cpp \
|
||||
parse/encrypt.h \
|
||||
parse/parselo.cpp \
|
||||
parse/parselo.h \
|
||||
parse/sexp.cpp \
|
||||
parse/sexp.h \
|
||||
particle/particle.cpp \
|
||||
particle/particle.h \
|
||||
pcxutils/pcxutils.cpp \
|
||||
pcxutils/pcxutils.h \
|
||||
physics/physics.cpp \
|
||||
physics/physics.h \
|
||||
playerman/managepilot.cpp \
|
||||
playerman/managepilot.h \
|
||||
playerman/player.h \
|
||||
playerman/playercontrol.cpp \
|
||||
popup/popup.cpp \
|
||||
popup/popup.h \
|
||||
popup/popupdead.cpp \
|
||||
popup/popupdead.h \
|
||||
radar/radar.cpp \
|
||||
radar/radar.h \
|
||||
radar/radarorb.cpp \
|
||||
radar/radarorb.h \
|
||||
radar/radarsetup.cpp \
|
||||
radar/radarsetup.h \
|
||||
render/3d.h \
|
||||
render/3dclipper.cpp \
|
||||
render/3ddraw.cpp \
|
||||
render/3dinternal.h \
|
||||
render/3dlaser.cpp \
|
||||
render/3dmath.cpp \
|
||||
render/3dsetup.cpp \
|
||||
ship/afterburner.cpp \
|
||||
ship/afterburner.h \
|
||||
ship/awacs.cpp \
|
||||
ship/awacs.h \
|
||||
ship/shield.cpp \
|
||||
ship/ship.cpp \
|
||||
ship/ship.h \
|
||||
ship/shipcontrails.cpp \
|
||||
ship/shipcontrails.h \
|
||||
ship/shipfx.cpp \
|
||||
ship/shipfx.h \
|
||||
ship/shiphit.cpp \
|
||||
ship/shiphit.h \
|
||||
ship/subsysdamage.h \
|
||||
species_defs/species_defs.cpp \
|
||||
species_defs/species_defs.h \
|
||||
starfield/nebula.cpp \
|
||||
starfield/nebula.h \
|
||||
starfield/starfield.cpp \
|
||||
starfield/starfield.h \
|
||||
starfield/supernova.cpp \
|
||||
starfield/supernova.h \
|
||||
stats/medals.cpp \
|
||||
stats/medals.h \
|
||||
stats/scoring.cpp \
|
||||
stats/scoring.h \
|
||||
stats/stats.cpp \
|
||||
stats/stats.h \
|
||||
tgautils/tgautils.cpp \
|
||||
tgautils/tgautils.h \
|
||||
ui/button.cpp \
|
||||
ui/checkbox.cpp \
|
||||
ui/gadget.cpp \
|
||||
ui/icon.cpp \
|
||||
ui/inputbox.cpp \
|
||||
ui/keytrap.cpp \
|
||||
ui/listbox.cpp \
|
||||
ui/radio.cpp \
|
||||
ui/scroll.cpp \
|
||||
ui/slider.cpp \
|
||||
ui/slider2.cpp \
|
||||
ui/ui.h \
|
||||
ui/uidefs.h \
|
||||
ui/uidraw.cpp \
|
||||
ui/uimouse.cpp \
|
||||
ui/window.cpp \
|
||||
weapon/beam.cpp \
|
||||
weapon/beam.h \
|
||||
weapon/corkscrew.cpp \
|
||||
weapon/corkscrew.h \
|
||||
weapon/emp.cpp \
|
||||
weapon/emp.h \
|
||||
weapon/flak.cpp \
|
||||
weapon/flak.h \
|
||||
weapon/muzzleflash.cpp \
|
||||
weapon/muzzleflash.h \
|
||||
weapon/shockwave.cpp \
|
||||
weapon/shockwave.h \
|
||||
weapon/swarm.cpp \
|
||||
weapon/swarm.h \
|
||||
weapon/trails.cpp \
|
||||
weapon/trails.h \
|
||||
weapon/weapons.cpp \
|
||||
weapon/weapon.h
|
||||
|
||||
## conditional includes follow:
|
||||
|
||||
## joystic support sources
|
||||
if FS2_JOYSTICK
|
||||
fs2_SOURCES += \
|
||||
io/joy.cpp \
|
||||
io/joy_ff.cpp \
|
||||
io/swff_lib.cpp
|
||||
endif # FS2_JOYSTICK
|
||||
if FS2_OS_WIN32
|
||||
JOY_SOURCES = \
|
||||
io/joy.cpp \
|
||||
io/joy.h \
|
||||
io/joy_ff.cpp \
|
||||
io/joy_ff.h \
|
||||
io/sw_error.hpp \
|
||||
io/sw_force.h \
|
||||
io/sw_guid.hpp \
|
||||
io/swff_lib.cpp
|
||||
endif
|
||||
|
||||
if FS2_OS_UNIX
|
||||
JOY_SOURCES = \
|
||||
io/joy.h \
|
||||
io/joy-unix.cpp
|
||||
endif
|
||||
|
||||
## networking support sources
|
||||
if FS2_NETWORKING
|
||||
fs2_SOURCES += \
|
||||
hud/hudobserver.cpp \
|
||||
network/multi.cpp \
|
||||
network/multimsgs.cpp \
|
||||
network/multiteamselect.cpp \
|
||||
network/multiui.cpp \
|
||||
network/multiutil.cpp \
|
||||
network/multi_campaign.cpp \
|
||||
network/multi_data.cpp \
|
||||
network/multi_dogfight.cpp \
|
||||
network/multi_endgame.cpp \
|
||||
network/multi_ingame.cpp \
|
||||
network/multi_kick.cpp \
|
||||
network/multi_log.cpp \
|
||||
network/multi_obj.cpp \
|
||||
network/multi_observer.cpp \
|
||||
network/multi_options.cpp \
|
||||
network/multi_pause.cpp \
|
||||
network/multi_pinfo.cpp \
|
||||
network/multi_ping.cpp \
|
||||
network/multi_pmsg.cpp \
|
||||
network/multi_rate.cpp \
|
||||
network/multi_respawn.cpp \
|
||||
network/multi_team.cpp \
|
||||
network/multi_voice.cpp \
|
||||
network/multi_xfer.cpp \
|
||||
network/psnet.cpp \
|
||||
network/psnet2.cpp \
|
||||
menuui/optionsmenumulti.cpp \
|
||||
missionui/chatbox.cpp
|
||||
endif # FS2_NETWORKING
|
||||
if FS2_OS_WIN32
|
||||
FS2_SOURCES += \
|
||||
network/multilag.cpp \
|
||||
network/stand_gui.cpp \
|
||||
network/stand_gui.h
|
||||
endif
|
||||
|
||||
if FS2_OS_UNIX
|
||||
FS2_SOURCES += \
|
||||
network/stand_gui-unix.cpp \
|
||||
network/stand_gui.h
|
||||
endif
|
||||
|
||||
## sound support sources
|
||||
if FS2_SOUND
|
||||
fs2_SOURCES += \
|
||||
gamesnd/eventmusic.cpp \
|
||||
gamesnd/gamesnd.cpp \
|
||||
object/objectsnd.cpp \
|
||||
sound/acm.cpp \
|
||||
sound/audiostr.cpp \
|
||||
sound/ds.cpp \
|
||||
sound/ds3d.cpp \
|
||||
sound/dscap.cpp \
|
||||
sound/midifile.cpp \
|
||||
sound/rbaudio.cpp \
|
||||
sound/rtvoice.cpp \
|
||||
sound/sound.cpp \
|
||||
sound/winmidi.cpp \
|
||||
sound/winmidi_base.cpp \
|
||||
vcodec/codec1.cpp
|
||||
endif # FS2_SOUND
|
||||
SOUND_SOURCES = \
|
||||
gamesnd/eventmusic.cpp \
|
||||
gamesnd/eventmusic.h \
|
||||
gamesnd/gamesnd.cpp \
|
||||
gamesnd/gamesnd.h \
|
||||
object/objectsnd.cpp \
|
||||
object/objectsnd.h \
|
||||
sound/ogg/ogg.cpp \
|
||||
sound/ogg/ogg.h \
|
||||
sound/audiostr-openal.cpp \
|
||||
sound/audiostr.cpp \
|
||||
sound/audiostr.h \
|
||||
sound/acm-openal.cpp \
|
||||
sound/acm.cpp \
|
||||
sound/acm.h \
|
||||
sound/ds.cpp \
|
||||
sound/ds.h \
|
||||
sound/ds3d.cpp \
|
||||
sound/ds3d.h \
|
||||
sound/midifile.cpp \
|
||||
sound/midifile.h \
|
||||
sound/midiseq.h \
|
||||
sound/rbaudio.cpp \
|
||||
sound/rbaudio.h \
|
||||
sound/rtvoice.cpp \
|
||||
sound/rtvoice.h \
|
||||
sound/sound.cpp \
|
||||
sound/sound.h \
|
||||
sound/winmidi.cpp \
|
||||
sound/winmidi.h \
|
||||
sound/winmidi_base.cpp \
|
||||
vcodec/codec1.cpp \
|
||||
vcodec/codec1.h \
|
||||
sound/fsspeech.cpp \
|
||||
sound/fsspeech.h \
|
||||
sound/speech.cpp \
|
||||
sound/speech.h
|
||||
|
||||
## software-rendering support sources
|
||||
if FS2_GRSOFT
|
||||
fs2_SOURCES += \
|
||||
graphics/grsoft.cpp \
|
||||
graphics/tmapper.cpp
|
||||
endif # FS2_GRSOFT
|
||||
if FS2_OS_WIN32
|
||||
SOUND_SOURCES += \
|
||||
sound/dscap.cpp \
|
||||
sound/dscap.h
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
## Win32-specific sources
|
||||
if FS2_OS_WIN32
|
||||
fs2_SOURCES += \
|
||||
cutscene/movie.cpp \
|
||||
directx/dx8show.cpp \
|
||||
ddsutils/ddsutils.cpp \
|
||||
globalincs/windebug.cpp \
|
||||
glide/glide.cpp \
|
||||
graphics/grd3d.cpp \
|
||||
graphics/grd3drender.cpp \
|
||||
graphics/grd3dtexture.cpp \
|
||||
graphics/grdirectdraw.cpp \
|
||||
graphics/grglide.cpp \
|
||||
graphics/grglidetexture.cpp \
|
||||
network/stand_gui.cpp \
|
||||
osapi/osapi.cpp \
|
||||
osapi/osregistry.cpp \
|
||||
osapi/outwnd.cpp
|
||||
endif # FS2_OS_WIN32
|
||||
WIN32_SOURCES = \
|
||||
directx/dx8show.cpp \
|
||||
directx/dx8show.h \
|
||||
directx/vasync.h \
|
||||
directx/vd3dtypes.h \
|
||||
directx/vddraw.h \
|
||||
directx/vdinput.h \
|
||||
directx/vdplay.h \
|
||||
directx/vdplobby.h \
|
||||
directx/vdsetup.h \
|
||||
directx/vdsound.h \
|
||||
directx/vdvp.h \
|
||||
globalincs/windebug.cpp \
|
||||
graphics/gl/GLAUX.H \
|
||||
graphics/gl/GLU.H \
|
||||
graphics/gl/Gl.h \
|
||||
graphics/gl/Glext.h \
|
||||
graphics/gl/wglext.h \
|
||||
graphics/GrD3DParticle.cpp \
|
||||
graphics/GrD3DParticle.h \
|
||||
graphics/GrD3DStateBlock.cpp \
|
||||
graphics/grd3d.cpp \
|
||||
graphics/grd3d.h \
|
||||
graphics/grd3dbatch.cpp \
|
||||
graphics/grd3dbatch.h \
|
||||
graphics/grd3dcalls.cpp \
|
||||
graphics/grd3dbmpman.cpp \
|
||||
graphics/grd3dbmpman.h \
|
||||
graphics/grd3dinternal.h \
|
||||
graphics/grd3dlight.cpp \
|
||||
graphics/grd3dlight.h \
|
||||
graphics/grd3drender.cpp \
|
||||
graphics/grd3dsetup.cpp \
|
||||
graphics/grd3dsetup.h \
|
||||
graphics/grd3dtexture.cpp \
|
||||
osapi/monopub.h \
|
||||
osapi/osapi.cpp \
|
||||
osapi/osapi.h \
|
||||
osapi/osregistry.cpp \
|
||||
osapi/osregistry.h \
|
||||
osapi/outwnd.cpp \
|
||||
osapi/outwnd.h
|
||||
endif
|
||||
|
||||
## Unix-specific sources
|
||||
if FS2_OS_UNIX
|
||||
fs2_SOURCES += \
|
||||
io/xmouse.cpp \
|
||||
osapi/osapi_unix.cpp \
|
||||
osapi/osregistry_unix.cpp \
|
||||
osapi/outwnd_unix.cpp
|
||||
endif # FS2_OS_UNIX
|
||||
|
||||
|
||||
## compiler flags
|
||||
# INCLUDES = -I.
|
||||
AM_CXXFLAGS = -fno-exceptions @DX8_INCLUDE@
|
||||
AM_LDFLAGS = -L/c/dx8/lib @DX8_LIB@
|
||||
|
||||
LDADD =
|
||||
|
||||
if FS2_OS_WIN32
|
||||
## Win32 libraries needed
|
||||
LDADD += \
|
||||
-lgdi32 -lole32 -lwsock32 -lwinmm -lmsacm32 -lopengl32 \
|
||||
-lcomctl32 -lstrmiids -ldxguid -lddraw -ldinput
|
||||
UNIX_SOURCES = \
|
||||
osapi/osapi_unix.cpp \
|
||||
osapi/osapi.h \
|
||||
osapi/osregistry_unix.cpp \
|
||||
osapi/osregistry.h \
|
||||
osapi/outwnd_unix.cpp \
|
||||
osapi/outwnd.h \
|
||||
windows_stub/stubs.cpp \
|
||||
windows_stub/config.h
|
||||
endif
|
||||
|
||||
|
||||
if FS2_OS_UNIX
|
||||
## Unix libraries needed
|
||||
## -- TODO --
|
||||
endif
|
||||
## libcode.a
|
||||
libcode_a_SOURCES = ${FS2_SOURCES} ${JOY_SOURCES} ${SOUND_SOURCES} \
|
||||
${WIN32_SOURCES} ${UNIX_SOURCES}
|
||||
|
||||
##
|
||||
## End CODE library
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
##
|
||||
## Begin MAIN fs2 binary
|
||||
##
|
||||
|
||||
FS2OPEN_SOURCES = \
|
||||
freespace2/freespace.cpp \
|
||||
freespace2/freespace.h \
|
||||
freespace2/levelpaging.cpp \
|
||||
freespace2/levelpaging.h
|
||||
|
||||
fs2_open_d_SOURCES = \
|
||||
${FS2OPEN_SOURCES} \
|
||||
${PLATFORM_SOURCES}
|
||||
|
||||
fs2_open_r_SOURCES = \
|
||||
${FS2OPEN_SOURCES} \
|
||||
${PLATFORM_SOURCES}
|
||||
|
||||
fs2_open_d_LDADD = libcode.a ../libjpeg/libjpeg.a
|
||||
fs2_open_r_LDADD = libcode.a ../libjpeg/libjpeg.a
|
||||
|
||||
##
|
||||
## End MAIN binary
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
##
|
||||
## Begin wxFRED2 binary
|
||||
##
|
||||
|
||||
wxFRED_SOURCES = \
|
||||
wxfred2/wxfred2.cpp \
|
||||
wxfred2/wxfred2.h \
|
||||
wxfred2/fredframe.cpp \
|
||||
wxfred2/fredframe.h \
|
||||
wxfred2/wxfred_xrc.cpp \
|
||||
wxfred2/wxfred_xrc.h
|
||||
|
||||
wxFRED2_d_SOURCES = \
|
||||
${wxFRED_SOURCES} \
|
||||
${PLATFORM_SOURCES}
|
||||
|
||||
wxFRED2_r_SOURCES = \
|
||||
${wxFRED_SOURCES} \
|
||||
${PLATFORM_SOURCES}
|
||||
|
||||
wxFRED2_d_LDADD = libcode.a ../libjpeg/libjpeg.a
|
||||
wxFRED2_r_LDADD = libcode.a ../libjpeg/libjpeg.a
|
||||
|
||||
##
|
||||
## End wxFRED2 binary
|
||||
##
|
||||
###############################################################################
|
||||
File diff suppressed because it is too large.
Load diff
@@ -11,10 +11,12 @@
|
||||
// ai slots and linking them to ships.
|
||||
// See AiCode.cpp for the actual AI code.
|
||||
|
||||
#include "ship/ai.h"
|
||||
#include "ai/ai.h"
|
||||
#include "object/object.h"
|
||||
#include "ship/ship.h"
|
||||
|
||||
|
||||
|
||||
int Total_goal_ship_names = 0;
|
||||
char Goal_ship_names[MAX_GOAL_SHIP_NAMES][NAME_LENGTH];
|
||||
ai_info Ai_info[MAX_AI_INFO];
|
||||
@@ -9,11 +9,65 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/ai.h $
|
||||
* $Revision: 2.14 $
|
||||
* $Date: 2004-03-05 09:01:51 $
|
||||
* $Revision: 1.7 $
|
||||
* $Date: 2005-07-27 17:22:22 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.6 2005/07/25 03:13:24 Goober5000
|
||||
* various code cleanups, tweaks, and fixes; most notably the MISSION_FLAG_USE_NEW_AI
|
||||
* should now be added to all places where it is needed (except the turret code, which I still
|
||||
* have to to review)
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.5 2005/07/24 20:12:55 Goober5000
|
||||
* cleaned up some rotating submodel code
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.4 2005/07/22 09:19:39 wmcoolmon
|
||||
* Dynamic AI Class number commit. KNOWN BUG: When AI_CLASS_INCREMENT is hit and vm_realloc is called, memory corruption seems to
|
||||
* result. Not at all sure what causes this; if this can't be resolved soon, we can always treat _INCREMENT like _MAX
|
||||
*
|
||||
* Revision 1.3 2005/07/13 02:50:48 Goober5000
|
||||
* remove PreProcDefine #includes in FS2
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.2 2005/04/05 05:53:13 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 1.1 2005/03/25 06:45:12 wmcoolmon
|
||||
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
|
||||
*
|
||||
* Revision 2.21 2005/02/20 23:13:00 wmcoolmon
|
||||
* Trails stuff, moved ship docking func declaration so FRED could get to it.
|
||||
*
|
||||
* Revision 2.20 2005/01/28 09:01:04 Goober5000
|
||||
* finished implementing docking to a rotating submodel
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.19 2005/01/27 11:26:23 Goober5000
|
||||
* dock points on rotating submodels is *almost* working
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.18 2005/01/13 03:33:07 Goober5000
|
||||
* hmm, rolled back one of my clarifications since it caused things to get messed up
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.17 2005/01/11 21:38:48 Goober5000
|
||||
* multiple ship docking :)
|
||||
* don't tell anyone yet... check the SCP internal
|
||||
* --Goober500
|
||||
*
|
||||
* Revision 2.16 2004/08/11 05:06:33 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.15 2004/07/25 00:31:30 Kazan
|
||||
* i have absolutely nothing to say about that subject
|
||||
*
|
||||
* Revision 2.14 2004/03/05 09:01:51 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.13 2004/01/26 23:07:43 phreak
|
||||
* bumped MAX_AI_CLASSES to 30 if INF_BUILD is defined
|
||||
*
|
||||
@@ -220,36 +274,35 @@ struct object;
|
||||
|
||||
#define AI_DEFAULT_CLASS 3 // default AI class for new ships (Fred)
|
||||
|
||||
#define AIF_FORMATION_WING (1 << 0) // Fly in formation as part of wing.
|
||||
#define AIF_AWAITING_REPAIR (1 << 1) // Awaiting a repair ship.
|
||||
#define AIF_BEING_REPAIRED (1 << 2) // Currently docked with repair ship.
|
||||
#define AIF_REPAIRING (1 << 3) // Repairing a ship (or going to repair a ship)
|
||||
#define AIF_DOCKED (1 << 4) // this object docked with something else
|
||||
#define AIF_SEEK_LOCK (1 << 5) // set if should focus on gaining aspect lock, not hitting with lasers
|
||||
#define AIF_FORMATION_OBJECT (1 << 6) // Fly in formation off a specific object.
|
||||
#define AIF_TEMPORARY_IGNORE (1 << 7) // Means current ignore_objnum is only temporary, not an order from the player.
|
||||
#define AIF_USE_EXIT_PATH (1 << 8) // Used by path code, to flag path as an exit path
|
||||
#define AIF_USE_STATIC_PATH (1 << 9) // Used by path code, use fixed path, don't try to recreate
|
||||
#define AIF_TARGET_COLLISION (1 << 10) // Collided with aip->target_objnum last frame. Avoid that ship for half a second or so.
|
||||
#define AIF_UNLOAD_SECONDARIES (1 << 11) // Fire secondaries as fast as possible!
|
||||
#define AIF_ON_SUBSYS_PATH (1 << 12) // Current path leads to a subsystem
|
||||
#define AIF_AVOID_SHOCKWAVE_SHIP (1 << 13) // Avoid an existing shockwave from a ship.
|
||||
#define AIF_AVOID_SHOCKWAVE_WEAPON (1 << 14) // Avoid an expected shockwave from a weapon. shockwave_object field contains object index.
|
||||
#define AIF_AVOID_SHOCKWAVE_STARTED (1 << 15) // Already started avoiding shockwave, don't keep deciding whether to avoid.
|
||||
#define AIF_ATTACK_SLOWLY (1 << 16) // Move slowly while attacking.
|
||||
#define AIF_REPAIR_OBSTRUCTED (1 << 17) // Ship wants to be repaired, but path is obstructed.
|
||||
#define AIF_KAMIKAZE (1 << 18) // Crash into target
|
||||
#define AIF_NO_DYNAMIC (1 << 19) // Not allowed to get dynamic goals
|
||||
#define AIF_AVOIDING_SMALL_SHIP (1 << 20) // Avoiding a player ship.
|
||||
#define AIF_AVOIDING_BIG_SHIP (1 << 21) // Avoiding a large ship.
|
||||
#define AIF_BIG_SHIP_COLLIDE_RECOVER_1 (1 << 22) // Collided into a big ship. Recovering by flying away.
|
||||
#define AIF_BIG_SHIP_COLLIDE_RECOVER_2 (1 << 23) // Collided into a big ship. Fly towards big ship sphere perimeter.
|
||||
#define AIF_STEALTH_PURSUIT (1 << 24) // Ai is trying to fight stealth ship
|
||||
#define AIF_FORMATION_WING (1 << 0) // Fly in formation as part of wing.
|
||||
#define AIF_AWAITING_REPAIR (1 << 1) // Awaiting a repair ship.
|
||||
#define AIF_BEING_REPAIRED (1 << 2) // Currently docked with repair ship.
|
||||
#define AIF_REPAIRING (1 << 3) // Repairing a ship (or going to repair a ship)
|
||||
#define AIF_SEEK_LOCK (1 << 4) // set if should focus on gaining aspect lock, not hitting with lasers
|
||||
#define AIF_FORMATION_OBJECT (1 << 5) // Fly in formation off a specific object.
|
||||
#define AIF_TEMPORARY_IGNORE (1 << 6) // Means current ignore_objnum is only temporary, not an order from the player.
|
||||
#define AIF_USE_EXIT_PATH (1 << 7) // Used by path code, to flag path as an exit path
|
||||
#define AIF_USE_STATIC_PATH (1 << 8) // Used by path code, use fixed path, don't try to recreate
|
||||
#define AIF_TARGET_COLLISION (1 << 9) // Collided with aip->target_objnum last frame. Avoid that ship for half a second or so.
|
||||
#define AIF_UNLOAD_SECONDARIES (1 << 10) // Fire secondaries as fast as possible!
|
||||
#define AIF_ON_SUBSYS_PATH (1 << 11) // Current path leads to a subsystem
|
||||
#define AIF_AVOID_SHOCKWAVE_SHIP (1 << 12) // Avoid an existing shockwave from a ship.
|
||||
#define AIF_AVOID_SHOCKWAVE_WEAPON (1 << 13) // Avoid an expected shockwave from a weapon. shockwave_object field contains object index.
|
||||
#define AIF_AVOID_SHOCKWAVE_STARTED (1 << 14) // Already started avoiding shockwave, don't keep deciding whether to avoid.
|
||||
#define AIF_ATTACK_SLOWLY (1 << 15) // Move slowly while attacking.
|
||||
#define AIF_REPAIR_OBSTRUCTED (1 << 16) // Ship wants to be repaired, but path is obstructed.
|
||||
#define AIF_KAMIKAZE (1 << 17) // Crash into target
|
||||
#define AIF_NO_DYNAMIC (1 << 18) // Not allowed to get dynamic goals
|
||||
#define AIF_AVOIDING_SMALL_SHIP (1 << 19) // Avoiding a player ship.
|
||||
#define AIF_AVOIDING_BIG_SHIP (1 << 20) // Avoiding a large ship.
|
||||
#define AIF_BIG_SHIP_COLLIDE_RECOVER_1 (1 << 21) // Collided into a big ship. Recovering by flying away.
|
||||
#define AIF_BIG_SHIP_COLLIDE_RECOVER_2 (1 << 22) // Collided into a big ship. Fly towards big ship sphere perimeter.
|
||||
#define AIF_STEALTH_PURSUIT (1 << 23) // Ai is trying to fight stealth ship
|
||||
|
||||
// Goober5000
|
||||
#define AIF_UNLOAD_PRIMARIES (1 << 25) // Fire primaries as fast as possible!
|
||||
#define AIF_UNLOAD_PRIMARIES (1 << 24) // Fire primaries as fast as possible!
|
||||
|
||||
#define AIF_AVOID_SHOCKWAVE (AIF_AVOID_SHOCKWAVE_SHIP | AIF_AVOID_SHOCKWAVE_WEAPON)
|
||||
#define AIF_AVOID_SHOCKWAVE (AIF_AVOID_SHOCKWAVE_SHIP | AIF_AVOID_SHOCKWAVE_WEAPON)
|
||||
#define AIF_FORMATION (AIF_FORMATION_WING | AIF_FORMATION_OBJECT)
|
||||
|
||||
// dock_orient_and_approach() modes.
|
||||
@@ -284,13 +337,16 @@ struct object;
|
||||
#define AIG_TYPE_DYNAMIC 5 // created on the fly
|
||||
|
||||
// flags for AI_GOALS
|
||||
#define AIGF_DOCKER_NAME_VALID (1<<0) // when set, name field for docker is valid
|
||||
#define AIGF_DOCKEE_NAME_VALID (1<<1) // when set, name field for dockee is valid
|
||||
#define AIGF_DOCKER_INDEX_VALID (1<<0) // when set, index field for docker is valid
|
||||
#define AIGF_DOCKEE_INDEX_VALID (1<<1) // when set, index field for dockee is valid
|
||||
#define AIGF_GOAL_ON_HOLD (1<<2) // when set, this goal cannot currently be satisfied, although it could be in the future
|
||||
#define AIGF_SUBSYS_NAME_VALID (1<<3) // when set, the subsystem name (for a destroy subsystem goal) is valid, and stored in docker.name field!!
|
||||
#define AIGF_SUBSYS_NEEDS_FIXUP (1<<3) // when set, the subsystem index (for a destroy subsystem goal) is invalid and must be gotten from the subsys name stored in docker.name field!!
|
||||
#define AIGF_GOAL_OVERRIDE (1<<4) // paired with AIG_TYPE_DYNAMIC to mean this goal overrides any other goal
|
||||
#define AIGF_PURGE (1<<5) // purge this goal next time we process
|
||||
#define AIGF_GOALS_PURGED (1<<6) // this goal has already caused other goals to get purged
|
||||
#define AIGF_DOCK_SOUND_PLAYED (1<<7) // Goober5000 - replacement for AL's hack ;)
|
||||
|
||||
#define AIGF_DOCK_INDEXES_VALID (AIGF_DOCKER_INDEX_VALID|AIGF_DOCKEE_INDEX_VALID)
|
||||
|
||||
// Flags to ai_turn_towards_vector().
|
||||
#define AITTV_FAST (1<<0) // Turn fast, not slowed down based on skill level.
|
||||
@@ -326,6 +382,8 @@ typedef struct ai_goal {
|
||||
int num_special_objects;
|
||||
|
||||
// unions for docking stuff.
|
||||
// (AIGF_DOCKER_INDEX_VALID and AIGF_DOCKEE_INDEX_VALID tell us to use indexes; otherwise we use names)
|
||||
// these are the dockpoints used on the docker and dockee ships, not the ships themselves
|
||||
union {
|
||||
char *name;
|
||||
int index;
|
||||
@@ -338,11 +396,6 @@ typedef struct ai_goal {
|
||||
|
||||
} ai_goal;
|
||||
|
||||
#ifdef INF_BUILD
|
||||
#define MAX_AI_CLASSES 30
|
||||
#else
|
||||
#define MAX_AI_CLASSES 10
|
||||
#endif
|
||||
#define MAX_GOAL_SHIP_NAMES 100
|
||||
|
||||
#define AIM_CHASE 0
|
||||
@@ -366,8 +419,9 @@ typedef struct ai_goal {
|
||||
#define AIM_BAY_DEPART 18 // Departing to a fighter bay, following path to do so
|
||||
#define AIM_SENTRYGUN 19 // AI mode for sentry guns only (floating turrets)
|
||||
#define AIM_WARP_OUT 20 // Commence warp out sequence. Point in legal direction. Then call John's code.
|
||||
#define AIM_FLY_TO_SHIP 21 // [Kazan] Fly to a ship, doesn't matter if it's hostile or friendly -- for Autopilot usage
|
||||
|
||||
#define MAX_AI_BEHAVIORS 21 // Number of AIM_xxxx types
|
||||
#define MAX_AI_BEHAVIORS 22 // Number of AIM_xxxx types
|
||||
|
||||
#define MAX_WAYPOINTS_PER_LIST 20
|
||||
#define MAX_WAYPOINT_LISTS 32
|
||||
@@ -380,7 +434,7 @@ typedef struct waypoint_list {
|
||||
char name[NAME_LENGTH];
|
||||
int count;
|
||||
char flags[MAX_WAYPOINTS_PER_LIST];
|
||||
vector waypoints[MAX_WAYPOINTS_PER_LIST];
|
||||
vec3d waypoints[MAX_WAYPOINTS_PER_LIST];
|
||||
} waypoint_list;
|
||||
|
||||
#define AI_GOAL_NONE -1
|
||||
@@ -420,7 +474,7 @@ typedef struct ai_class {
|
||||
#define AIS_DOCK_1 22
|
||||
#define AIS_DOCK_2 23
|
||||
#define AIS_DOCK_3 24
|
||||
#define AIS_DOCK_3A 25
|
||||
//#define AIS_DOCK_3A 25
|
||||
#define AIS_DOCK_4 26 // Only for rearm/repair.
|
||||
#define AIS_DOCK_4A 27 // Only for not rearm/repair. MK, 7/15/97
|
||||
#define AIS_UNDOCK_0 30
|
||||
@@ -464,7 +518,7 @@ typedef struct ai_class {
|
||||
// This hook is used to extract information on the point such as whether it is
|
||||
// protected by turrets.
|
||||
typedef struct pnode {
|
||||
vector pos;
|
||||
vec3d pos;
|
||||
int path_num; // path number from polymodel, ie in polymodel, paths[path_num]
|
||||
int path_index; // index in original model path of point, ie in model_path, use verts[path_index]
|
||||
} pnode;
|
||||
@@ -490,14 +544,15 @@ typedef struct ai_info {
|
||||
int stealth_last_cheat_visible_stamp; // when within 100m, always update pos and velocity, with error increasing for increasing time from last legal visible
|
||||
int stealth_last_visible_stamp;
|
||||
float stealth_sweep_box_size;
|
||||
vector stealth_last_pos;
|
||||
vector stealth_velocity;
|
||||
vec3d stealth_last_pos;
|
||||
vec3d stealth_velocity;
|
||||
|
||||
float previous_dot_to_enemy; // dot(fvec, vec_to_enemy) last frame
|
||||
float target_time; // Amount of time continuously targeting this ship.
|
||||
|
||||
int enemy_wing; // When picking an enemy wing, only allow to be in enemy_wing, unless == -1, in which case don't care.
|
||||
int attacker_objnum;
|
||||
|
||||
int goal_objnum; // mode specific goal. In DOCK, ship to dock with.
|
||||
int goal_signature;
|
||||
|
||||
@@ -526,7 +581,7 @@ typedef struct ai_info {
|
||||
int path_objnum; // Object of interest. It's model contains the path.
|
||||
int path_goal_obj_hash; // Hash value of goal object when global path created.
|
||||
fix path_next_create_time; // Next time at which we'll create a global path.
|
||||
vector path_create_pos; // Object's position at time of global path creation.
|
||||
vec3d path_create_pos; // Object's position at time of global path creation.
|
||||
matrix path_create_orient; // Object's orientation at time of global path creation.
|
||||
int mp_index; // Model path index. Index in polymodel:model_paths
|
||||
fix path_next_check_time; // Last time checked to see if would collide with model.
|
||||
@@ -547,7 +602,7 @@ typedef struct ai_info {
|
||||
int active_goal; // index of active goal, -1 if none, AI_ACTIVE_GOAL_DYNAMIC if dynamic (runtime-created) goal
|
||||
int goal_check_time; // timer used for processing goals for this ai object
|
||||
|
||||
vector last_predicted_enemy_pos; // Where he thought enemy was last time.
|
||||
vec3d last_predicted_enemy_pos; // Where he thought enemy was last time.
|
||||
float time_enemy_in_range; // Amount of time enemy continuously in "sight", near crosshair.
|
||||
fix last_attack_time; // Missiontime of last time this ship attacked its enemy.
|
||||
fix last_hit_time; // Missiontime of last time this ship was hit by anyone.
|
||||
@@ -558,8 +613,8 @@ typedef struct ai_info {
|
||||
fix resume_goal_time; // Time at which to resume interrupted goal, if nothing else intervenes.
|
||||
float prev_accel; // Acceleration last frame.
|
||||
float prev_dot_to_goal; // dot of fvec to goal last frame, used to see if making progress towards goal.
|
||||
vector goal_point; // Used in AIM_SAFETY, AIM_STILL and in circling.
|
||||
vector prev_goal_point; // Previous location of goal point, used at least for evading.
|
||||
vec3d goal_point; // Used in AIM_SAFETY, AIM_STILL and in circling.
|
||||
vec3d prev_goal_point; // Previous location of goal point, used at least for evading.
|
||||
float ai_accuracy, ai_evasion, ai_courage, ai_patience;
|
||||
union {
|
||||
float lead_scale; // Amount to lead current opponent by.
|
||||
@@ -574,15 +629,15 @@ typedef struct ai_info {
|
||||
|
||||
// ship_subsys *targeted_subobject; // subsystem to attack
|
||||
// int attack_subsystem_parent; // objnum of the object containing the attack_subsystem
|
||||
int dock_index; // index of docking point to use when docking.
|
||||
int dockee_index; // index of dock point on other ship.
|
||||
int dock_path_index; // index of docking path to use when docking.
|
||||
int dock_objnum; // objnum of ship we are docked with.
|
||||
int dock_signature; // Signature of repair object.
|
||||
|
||||
// Goober5000
|
||||
int support_ship_objnum; // objnum of support ship docking with us, or (if we're a support ship) object we're docking to
|
||||
int support_ship_signature; // signature of the same
|
||||
|
||||
int danger_weapon_objnum; // Closest objnum of weapon fired at this ship.
|
||||
int danger_weapon_signature; // Signature of object danger_weapon_objnum.
|
||||
|
||||
vector guard_vec; // vector to object being guarded, only used in AIS_GUARD_STATIC submode
|
||||
vec3d guard_vec; // vector to object being guarded, only used in AIS_GUARD_STATIC submode
|
||||
int nearest_locked_object; // Nearest locked object.
|
||||
float nearest_locked_distance; // Distance to nearest locked object.
|
||||
|
||||
@@ -621,19 +676,19 @@ typedef struct ai_info {
|
||||
int ok_to_target_timestamp; // Time at which this ship can dynamically target.
|
||||
|
||||
float kamikaze_damage; // some damage value used to produce a shockwave from a kamikaze ship
|
||||
vector big_attack_point; // Global point this ship is attacking on a big ship.
|
||||
vector big_attack_surface_normal; // Surface normal at ship at big_attack_point;
|
||||
vec3d big_attack_point; // Global point this ship is attacking on a big ship.
|
||||
vec3d big_attack_surface_normal; // Surface normal at ship at big_attack_point;
|
||||
int pick_big_attack_point_timestamp; // timestamp at which to pick a new point to attack on a big ship.
|
||||
|
||||
// Note: These three avoid_XX terms are shared between the code that avoids small (only player now) and large ships
|
||||
// The bits in ai_flags determine which is occurring. AIF_AVOID_SMALL_SHIP, AIF_AVOID_BIG_SHIP
|
||||
int avoid_ship_num; // object index of small ship to avoid
|
||||
vector avoid_goal_point; // point to aim at when avoiding a ship
|
||||
vec3d avoid_goal_point; // point to aim at when avoiding a ship
|
||||
fix avoid_check_timestamp; // timestamp at which to next check for having to avoid ship
|
||||
|
||||
vector big_collision_normal; // Global normal of collision with big ship. Helps find direction to fly away from big ship. Set for each collision.
|
||||
vector big_recover_pos_1; // Global point to fly towards when recovering from collision with a big ship, stage 1.
|
||||
vector big_recover_pos_2; // Global point to fly towards when recovering from collision with a big ship, stage 2.
|
||||
vec3d big_collision_normal; // Global normal of collision with big ship. Helps find direction to fly away from big ship. Set for each collision.
|
||||
vec3d big_recover_pos_1; // Global point to fly towards when recovering from collision with a big ship, stage 1.
|
||||
vec3d big_recover_pos_2; // Global point to fly towards when recovering from collision with a big ship, stage 2.
|
||||
int big_recover_timestamp; // timestamp at which it's OK to re-enter stage 1.
|
||||
|
||||
int abort_rearm_timestamp; // time at which this rearm should be aborted in a multiplayer game.
|
||||
@@ -642,7 +697,7 @@ typedef struct ai_info {
|
||||
int artillery_objnum; // object currently being targeted for artillery lock/attack
|
||||
int artillery_sig; // artillery object signature
|
||||
float artillery_lock_time; // how long we've been locked onto this guy
|
||||
vector artillery_lock_pos; // base position of the lock point on (in model's frame of reference)
|
||||
vec3d artillery_lock_pos; // base position of the lock point on (in model's frame of reference)
|
||||
float lethality; // measure of how dangerous ship is to enemy BIG|HUGE ships (likelyhood of targeting)
|
||||
} ai_info;
|
||||
|
||||
@@ -671,8 +726,8 @@ extern ai_info *Player_ai;
|
||||
|
||||
extern int Waypoints_created; // externed since needed for save/restore
|
||||
|
||||
extern ai_class Ai_classes[];
|
||||
extern char *Ai_class_names[];
|
||||
extern ai_class *Ai_classes;
|
||||
extern char** Ai_class_names;
|
||||
|
||||
extern int Num_ai_classes;
|
||||
extern int Ai_firing_enabled;
|
||||
@@ -714,14 +769,14 @@ extern void ai_attack_object(object *attacker, object *attacked, int priority, s
|
||||
extern void ai_evade_object(object *evader, object *evaded, int priority);
|
||||
extern void ai_ignore_object(object *ignorer, object *ignored, int priority);
|
||||
extern void ai_ignore_wing(object *ignorer, int wingnum, int priority);
|
||||
extern void ai_dock_with_object(object *docker, object *dockee, int priority, int dock_type, int docker_index, int dockee_index);
|
||||
extern void ai_stay_still(object *still_objp, vector *view_pos);
|
||||
extern void ai_dock_with_object(object *docker, int docker_index, object *dockee, int dockee_index, int priority, int dock_type);
|
||||
extern void ai_stay_still(object *still_objp, vec3d *view_pos);
|
||||
extern void ai_set_default_behavior(object *obj, int classnum);
|
||||
extern void ai_do_default_behavior(object *obj);
|
||||
extern void ai_start_waypoints(object *objp, int waypoint_list_index, int wp_flags);
|
||||
extern void ai_ship_hit(object *objp_ship, object *hit_objp, vector *hitpos, int shield_quadrant, vector *hit_normal);
|
||||
extern void ai_ship_hit(object *objp_ship, object *hit_objp, vec3d *hitpos, int shield_quadrant, vec3d *hit_normal);
|
||||
extern void ai_ship_destroy(int shipnum, int method);
|
||||
extern void ai_turn_towards_vector(vector *dest, object *objp, float frametime, float turn_time, vector *slide_vec, vector *rel_pos, float bank_override, int flags, vector *rvec = NULL, int sexp_flags = 0);
|
||||
extern void ai_turn_towards_vector(vec3d *dest, object *objp, float frametime, float turn_time, vec3d *slide_vec, vec3d *rel_pos, float bank_override, int flags, vec3d *rvec = NULL, int sexp_flags = 0);
|
||||
extern void init_ai_object(int objnum);
|
||||
extern void ai_init(void); // Call this one to parse ai.tbl.
|
||||
extern void ai_level_init(void); // Call before each level to reset AI
|
||||
@@ -730,29 +785,27 @@ extern int ai_set_attack_subsystem(object *objp, int subnum);
|
||||
extern int ai_issue_rearm_request(object *requester_objp); // Object requests rearm/repair.
|
||||
extern int ai_abort_rearm_request(object *requester_objp); // Object aborts rearm/repair.
|
||||
extern void ai_do_repair_frame(object *objp, ai_info *aip, float frametime); // Repair a ship object, player or AI.
|
||||
extern float dock_orient_and_approach(object *objp, object *dobjp, int dock_mode); // Move to a position relative to a dock bay using thrusters.
|
||||
extern void ai_update_danger_weapon(int objnum, int weapon_objnum);
|
||||
|
||||
// called externally from MissionParse.cpp to position ships in wings upon arrival into the
|
||||
// mission.
|
||||
extern void get_absolute_wing_pos( vector *result_pos, object *leader_objp, int wing_index, int formation_object_flag);
|
||||
extern void get_absolute_wing_pos( vec3d *result_pos, object *leader_objp, int wing_index, int formation_object_flag);
|
||||
|
||||
|
||||
// Interface from goals code to AI. Set ship to guard. *objp guards *other_objp
|
||||
extern void ai_set_guard_object(object *objp, object *other_objp);
|
||||
extern void ai_set_evade_object(object *objp, object *other_objp);
|
||||
extern void ai_set_guard_wing(object *objp, int wingnum);
|
||||
extern void ai_warp_out(object *objp, vector *vp);
|
||||
extern void ai_warp_out(object *objp, vec3d *vp);
|
||||
extern void ai_attack_wing(object *attacker, int wingnum, int priority);
|
||||
extern void ai_deathroll_start(object *ship_obj);
|
||||
extern void ai_fly_in_formation(int wing_num); // Force wing to fly in formation.
|
||||
extern void ai_disband_formation(int wing_num); // Force wing to disband formation flying.
|
||||
extern object *ai_find_docked_object( object *objp ); // returns object that objp is docked to
|
||||
extern int set_target_objnum(ai_info *aip, int objnum);
|
||||
extern void ai_form_on_wing(object *objp, object *goal_objp);
|
||||
extern void ai_do_stay_near(object *objp, object *other_obj, float dist);
|
||||
extern ship_subsys *set_targeted_subsys(ai_info *aip, ship_subsys *new_subsys, int parent_objnum);
|
||||
extern void ai_rearm_repair( object *objp, object *goal_objp, int priority, int docker_index, int dockee_index );
|
||||
extern void ai_rearm_repair( object *objp, int docker_index, object *goal_objp, int dockee_index, int priority );
|
||||
extern void ai_add_rearm_goal( object *requester_objp, object *support_objp );
|
||||
extern void create_model_path(object *pl_objp, object *mobjp, int path_num, int subsys_path=0);
|
||||
|
||||
@@ -760,15 +813,15 @@ extern void create_model_path(object *pl_objp, object *mobjp, int path_num, int
|
||||
extern void ai_do_safety(object *objp);
|
||||
|
||||
// used to get path info for fighter bay emerging and departing
|
||||
int ai_acquire_emerge_path(object *pl_objp, int parent_objnum, vector *pos, vector *fvec);
|
||||
int ai_acquire_emerge_path(object *pl_objp, int parent_objnum, vec3d *pos, vec3d *fvec);
|
||||
int ai_acquire_depart_path(object *pl_objp, int parent_objnum);
|
||||
|
||||
// used by AiBig.cpp
|
||||
extern void ai_set_positions(object *pl_objp, object *en_objp, ai_info *aip, vector *player_pos, vector *enemy_pos);
|
||||
extern void ai_set_positions(object *pl_objp, object *en_objp, ai_info *aip, vec3d *player_pos, vec3d *enemy_pos);
|
||||
extern void accelerate_ship(ai_info *aip, float accel);
|
||||
extern void turn_away_from_point(object *objp, vector *point, float bank_override);
|
||||
extern void turn_away_from_point(object *objp, vec3d *point, float bank_override);
|
||||
extern float ai_endangered_by_weapon(ai_info *aip);
|
||||
extern void update_aspect_lock_information(ai_info *aip, vector *vec_to_enemy, float dist_to_enemy, float enemy_radius);
|
||||
extern void update_aspect_lock_information(ai_info *aip, vec3d *vec_to_enemy, float dist_to_enemy, float enemy_radius);
|
||||
extern void ai_chase_ct();
|
||||
extern void ai_find_path(object *pl_objp, int objnum, int path_num, int exit_flag, int subsys_path=0);
|
||||
extern float ai_path();
|
||||
@@ -777,22 +830,21 @@ extern int might_collide_with_ship(object *obj1, object *obj2, float dot_to_enem
|
||||
extern int ai_fire_primary_weapon(object *objp); //changed to return weather it fired-Bobboau
|
||||
extern int ai_fire_secondary_weapon(object *objp, int priority1 = -1, int priority2 = -1);
|
||||
extern float ai_get_weapon_dist(ship_weapon *swp);
|
||||
extern void turn_towards_point(object *objp, vector *point, vector *slide_vec, float bank_override);
|
||||
extern void turn_towards_point(object *objp, vec3d *point, vec3d *slide_vec, float bank_override);
|
||||
extern int ai_maybe_fire_afterburner(object *objp, ai_info *aip);
|
||||
extern void set_predicted_enemy_pos(vector *predicted_enemy_pos, object *pobjp, object *eobjp, ai_info *aip);
|
||||
extern void set_predicted_enemy_pos(vec3d *predicted_enemy_pos, object *pobjp, object *eobjp, ai_info *aip);
|
||||
|
||||
extern int is_instructor(object *objp);
|
||||
extern int find_enemy(int objnum, float range, int max_attackers, int except = 0);
|
||||
|
||||
float ai_get_weapon_speed(ship_weapon *swp);
|
||||
void set_predicted_enemy_pos_turret(vector *predicted_enemy_pos, vector *gun_pos, object *pobjp, vector *enemy_pos, vector *enemy_vel, float weapon_speed, float time_enemy_in_range);
|
||||
void ai_turret_select_default_weapon(ship_subsys *turret);
|
||||
void set_predicted_enemy_pos_turret(vec3d *predicted_enemy_pos, vec3d *gun_pos, object *pobjp, vec3d *enemy_pos, vec3d *enemy_vel, float weapon_speed, float time_enemy_in_range);
|
||||
|
||||
// function to change rearm status for ai ships (called from sexpression code)
|
||||
extern void ai_set_rearm_status( int team, int new_status );
|
||||
extern void ai_good_secondary_time( int team, int weapon_index, int num_weapons, char *shipname );
|
||||
|
||||
extern void ai_do_objects_docked_stuff( object *docker, object *dockee );
|
||||
extern void ai_do_objects_docked_stuff(object *docker, int docker_point, object *dockee, int dockee_point);
|
||||
extern void ai_do_objects_undocked_stuff( object *docker, object *dockee );
|
||||
extern void ai_do_objects_repairing_stuff( object *repaired_obj, object *repair_obj, int how );
|
||||
|
||||
@@ -806,4 +858,11 @@ int get_nearest_objnum(int objnum, int enemy_team_mask, int enemy_wing, float ra
|
||||
// moved to header file by Goober5000
|
||||
void ai_announce_ship_dying(object *dying_objp);
|
||||
|
||||
// added by kazan
|
||||
void ai_start_fly_to_ship(object *objp, int shipnum);
|
||||
void ai_fly_to_ship();
|
||||
|
||||
//Moved declaration here for player ship -WMC
|
||||
void process_subobjects(int objnum);
|
||||
|
||||
#endif
|
||||
@@ -9,13 +9,55 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/AiBig.cpp $
|
||||
* $Revision: 2.8 $
|
||||
* $Date: 2004-03-05 09:01:51 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2005-09-01 04:14:03 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* C module for AI code related to large ships
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.5 2005/07/27 18:27:49 Goober5000
|
||||
* verified that submode_start_time is updated whenever submode is changed
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.4 2005/07/25 05:23:33 Goober5000
|
||||
* whoops
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.3 2005/07/25 03:13:23 Goober5000
|
||||
* various code cleanups, tweaks, and fixes; most notably the MISSION_FLAG_USE_NEW_AI
|
||||
* should now be added to all places where it is needed (except the turret code, which I still
|
||||
* have to to review)
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.2 2005/04/05 05:53:13 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 1.1 2005/03/25 06:45:12 wmcoolmon
|
||||
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
|
||||
*
|
||||
* Revision 2.12 2005/03/10 08:00:14 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
* build unbreakage for everything that's not MSVC++ 6
|
||||
* lots of warning fixes
|
||||
* fix OpenGL rendering problem with ship insignias
|
||||
* no Warnings() in non-debug mode for Linux (like Windows)
|
||||
* some campaign savefile fixage to stop reverting everyones data
|
||||
*
|
||||
* Revision 2.11 2004/11/27 10:49:14 taylor
|
||||
* make sure the old behavior still applies to everything that's not a beam
|
||||
*
|
||||
* Revision 2.10 2004/07/26 20:47:50 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.9 2004/07/12 16:33:04 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.8 2004/03/05 09:01:51 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.7 2003/11/11 02:15:40 Goober5000
|
||||
* ubercommit - basically spelling and language fixes with some additional
|
||||
* warnings disabled
|
||||
@@ -364,7 +406,7 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include "ship/aibig.h"
|
||||
#include "ai/aibig.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "object/object.h"
|
||||
#include "ship/ship.h"
|
||||
@@ -374,6 +416,8 @@
|
||||
#include "io/timer.h"
|
||||
#include "mission/missionparse.h"
|
||||
|
||||
|
||||
|
||||
#pragma optimize("", off)
|
||||
#pragma auto_inline(off)
|
||||
|
||||
@@ -405,13 +449,13 @@
|
||||
|
||||
// forward declarations
|
||||
void ai_big_evade_ship();
|
||||
void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float dist_to_enemy, int modelnum);
|
||||
void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float dist_to_enemy, int modelnum);
|
||||
void ai_big_avoid_ship();
|
||||
int ai_big_maybe_follow_subsys_path(int do_dot_check=1);
|
||||
|
||||
extern int model_which_octant_distant_many( vector *pnt, int model_num,matrix *model_orient, vector * model_pos, polymodel **pm, int *octs);
|
||||
extern void compute_desired_rvec(vector *rvec, vector *goal_pos, vector *cur_pos);
|
||||
extern void big_ship_collide_recover_start(object *objp, object *big_objp, vector *collide_pos, vector *collision_normal);
|
||||
extern int model_which_octant_distant_many( vec3d *pnt, int model_num,matrix *model_orient, vec3d * model_pos, polymodel **pm, int *octs);
|
||||
extern void compute_desired_rvec(vec3d *rvec, vec3d *goal_pos, vec3d *cur_pos);
|
||||
extern void big_ship_collide_recover_start(object *objp, object *big_objp, vec3d *collide_pos, vec3d *collision_normal);
|
||||
|
||||
|
||||
// Called by ai_big_pick_attack_point.
|
||||
@@ -419,11 +463,11 @@ extern void big_ship_collide_recover_start(object *objp, object *big_objp, vecto
|
||||
// If truly_random flag set (haha), then generate a pretty random number. Otherwise, generate a static rand which
|
||||
// tends to not change from frame to frame.
|
||||
// Try four times and choose nearest point to increase chance of getting a good point.
|
||||
void ai_bpap(object *objp, vector *attacker_objp_pos, vector *attacker_objp_fvec, vector *attack_point, vector *local_attack_point, float fov, float weapon_travel_dist, vector *surface_normal)
|
||||
void ai_bpap(object *objp, vec3d *attacker_objp_pos, vec3d *attacker_objp_fvec, vec3d *attack_point, vec3d *local_attack_point, float fov, float weapon_travel_dist, vec3d *surface_normal)
|
||||
{
|
||||
float nearest_dist;
|
||||
vector result_point, best_point;
|
||||
vector rel_point;
|
||||
vec3d result_point, best_point;
|
||||
vec3d rel_point;
|
||||
int num_tries;
|
||||
model_octant *octp;
|
||||
polymodel *pm;
|
||||
@@ -463,7 +507,7 @@ void ai_bpap(object *objp, vector *attacker_objp_pos, vector *attacker_objp_fvec
|
||||
for (i=0; i<num_tries; i++) {
|
||||
int index;
|
||||
float dist, dot;
|
||||
vector v2p;
|
||||
vec3d v2p;
|
||||
|
||||
index = (int) (frand() * (octp->nverts));
|
||||
|
||||
@@ -496,7 +540,7 @@ done_1:
|
||||
// If no collision, cast to (0,0,0) [center of big ship]** [best_point initialized to 000]
|
||||
|
||||
// do in world coords to get attack point, then translate to local for local_attack_point
|
||||
vector attack_dir, end_point, temp;
|
||||
vec3d attack_dir, end_point, temp;
|
||||
float dist;
|
||||
dist = vm_vec_normalized_dir(&attack_dir, attack_point, attacker_objp_pos);
|
||||
|
||||
@@ -537,14 +581,14 @@ done_1:
|
||||
//
|
||||
// Note: Default value for fov is 1.0f 1.0f means don't use fov parameter.
|
||||
// If fov != 1.0f, try up to four times to find a point that's in the field of view.
|
||||
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vector *gpos, vector *gvec, vector *attack_point, float fov, float weapon_travel_dist)
|
||||
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float fov, float weapon_travel_dist)
|
||||
{
|
||||
if (!timestamp_elapsed(ssp->turret_pick_big_attack_point_timestamp)) {
|
||||
vector result_point;
|
||||
vec3d result_point;
|
||||
vm_vec_unrotate(&result_point, &ssp->turret_big_attack_point, &objp->orient);
|
||||
vm_vec_add(attack_point, &result_point, &objp->pos);
|
||||
} else {
|
||||
vector local_attack_point;
|
||||
vec3d local_attack_point;
|
||||
ssp->turret_pick_big_attack_point_timestamp = timestamp(2000 + (int) (frand()*500.0f));
|
||||
ai_bpap(objp, gpos, gvec, attack_point, &local_attack_point, fov, weapon_travel_dist, NULL);
|
||||
ssp->turret_big_attack_point = local_attack_point;
|
||||
@@ -557,19 +601,19 @@ void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vector *gpo
|
||||
// Note: Default value for fov is 1.0f 1.0f means don't use fov parameter.
|
||||
// If fov != 1.0f, try up to four times to find a point that's in the field of view.
|
||||
// Note, attacker_objp can be a ship or a weapon.
|
||||
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attack_point, float fov)
|
||||
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov)
|
||||
{
|
||||
Assert(objp->instance > -1);
|
||||
Assert(objp->type == OBJ_SHIP);
|
||||
|
||||
vector local_attack_point;
|
||||
vec3d local_attack_point;
|
||||
|
||||
switch (attacker_objp->type) {
|
||||
case OBJ_SHIP: {
|
||||
ai_info *attacker_aip;
|
||||
attacker_aip = &Ai_info[Ships[attacker_objp->instance].ai_index];
|
||||
if (!timestamp_elapsed(attacker_aip->pick_big_attack_point_timestamp)) {
|
||||
vector result_point;
|
||||
vec3d result_point;
|
||||
|
||||
vm_vec_unrotate(&result_point, &attacker_aip->big_attack_point, &objp->orient);
|
||||
vm_vec_add(attack_point, &result_point, &objp->pos);
|
||||
@@ -584,7 +628,7 @@ void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attac
|
||||
weapon *wp = &Weapons[attacker_objp->instance];
|
||||
|
||||
if (!timestamp_elapsed(wp->pick_big_attack_point_timestamp)) {
|
||||
vector result_point;
|
||||
vec3d result_point;
|
||||
|
||||
vm_vec_unrotate(&result_point, &wp->big_attack_point, &objp->orient);
|
||||
vm_vec_add(attack_point, &result_point, &objp->pos);
|
||||
@@ -598,7 +642,7 @@ void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attac
|
||||
}
|
||||
|
||||
// checks valid line to target
|
||||
vector surface_normal;
|
||||
vec3d surface_normal;
|
||||
ai_bpap(objp, &attacker_objp->pos, &attacker_objp->orient.vec.fvec, attack_point, &local_attack_point, fov, 99999.9f, &surface_normal);
|
||||
|
||||
switch (attacker_objp->type) {
|
||||
@@ -628,11 +672,11 @@ void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attac
|
||||
// Handler for SM_EVADE submode ( called from ai_big_chase() )
|
||||
void ai_big_evade_ship()
|
||||
{
|
||||
vector player_pos, enemy_pos;
|
||||
vec3d player_pos, enemy_pos;
|
||||
float dist;
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
ai_info *aip = &Ai_info[shipp->ai_index];
|
||||
vector randvec, semi_enemy_pos;
|
||||
vec3d randvec, semi_enemy_pos;
|
||||
|
||||
ai_set_positions(Pl_objp, En_objp, aip, &player_pos, &enemy_pos);
|
||||
|
||||
@@ -649,7 +693,7 @@ void ai_big_evade_ship()
|
||||
turn_away_from_point(Pl_objp, &semi_enemy_pos, 0.0f);
|
||||
|
||||
float box_dist;
|
||||
vector box_vec;
|
||||
vec3d box_vec;
|
||||
int is_inside;
|
||||
box_dist = get_world_closest_box_point_with_delta(&box_vec, En_objp, &player_pos, &is_inside, EVADE_BOX_BASE_DISTANCE);
|
||||
if (box_dist > EVADE_BOX_BASE_DISTANCE) {
|
||||
@@ -718,7 +762,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
|
||||
// only check for subsystem sight every N milliseconds
|
||||
checked_sight = 0;
|
||||
if ( timestamp_elapsed(aip->path_subsystem_next_check) ) {
|
||||
vector geye, gsubpos;
|
||||
vec3d geye, gsubpos;
|
||||
eye *ep;
|
||||
|
||||
aip->path_subsystem_next_check = timestamp(1500);
|
||||
@@ -735,7 +779,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
|
||||
|
||||
// Calc dot between subsys normal (based on using path info), and subsys_to_eye vector. This is
|
||||
// useful later when we want to decide whether we have a realistic line-of-sight to the subsystem.
|
||||
vector subsys_normal, subsys_to_eye;
|
||||
vec3d subsys_normal, subsys_to_eye;
|
||||
if ( do_dot_check ) {
|
||||
if ( !ship_return_subsys_path_normal(&Ships[target_objp->instance], aip->targeted_subsys, &gsubpos, &subsys_normal) ) {
|
||||
vm_vec_normalized_dir(&subsys_to_eye, &geye, &gsubpos);
|
||||
@@ -804,6 +848,7 @@ int ai_big_maybe_follow_subsys_path(int do_dot_check)
|
||||
aip->previous_mode = aip->mode;
|
||||
aip->mode = AIM_NONE;
|
||||
aip->submode = -1;
|
||||
aip->submode_start_time = Missiontime;
|
||||
return 1;
|
||||
}
|
||||
ai_path();
|
||||
@@ -863,7 +908,7 @@ int ai_big_maybe_start_strafe(ai_info *aip, ship_info *sip)
|
||||
}
|
||||
|
||||
// ATTACK submode handler for chase mode.
|
||||
void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float dist_to_enemy, int modelnum)
|
||||
void ai_big_chase_attack(ai_info *aip, ship_info *sip, vec3d *enemy_pos, float dist_to_enemy, int modelnum)
|
||||
{
|
||||
int start_bank;
|
||||
float dot_to_enemy, time_to_hit;
|
||||
@@ -881,7 +926,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if ((objp->type == OBJ_WEAPON) && (Weapons[objp->instance].team != Ships[Pl_objp->instance].team))
|
||||
if (Weapon_info[objp->instance].subtype == WP_LASER) {
|
||||
vector in_vec;
|
||||
vec3d in_vec;
|
||||
float dist;
|
||||
|
||||
vm_vec_sub(&in_vec, &objp->pos, &Pl_objp->pos);
|
||||
@@ -920,7 +965,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float
|
||||
return;
|
||||
}
|
||||
|
||||
vector *rel_pos, vec_to_enemy;
|
||||
vec3d *rel_pos, vec_to_enemy;
|
||||
float weapon_travel_dist;
|
||||
|
||||
start_bank = Ships[aip->shipnum].weapons.current_primary_bank;
|
||||
@@ -933,7 +978,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float
|
||||
dist_to_enemy = vm_vec_normalized_dir(&vec_to_enemy, enemy_pos, &Pl_objp->pos);
|
||||
dot_to_enemy = vm_vec_dot(&vec_to_enemy, &Pl_objp->orient.vec.fvec);
|
||||
|
||||
vector rvec_vec, *rvec = &rvec_vec;
|
||||
vec3d rvec_vec, *rvec = &rvec_vec;
|
||||
|
||||
if (dist_to_enemy > 500.0f)
|
||||
compute_desired_rvec(rvec, enemy_pos, &Pl_objp->pos);
|
||||
@@ -950,7 +995,7 @@ void ai_big_chase_attack(ai_info *aip, ship_info *sip, vector *enemy_pos, float
|
||||
accelerate_ship(aip, 1.0f);
|
||||
else {
|
||||
// AL 12-31-97: Move at least as quickly as your target is moving...
|
||||
accelerate_ship(aip, max(1.0f - dot_to_enemy, Objects[aip->target_objnum].phys_info.fspeed/sip->max_speed));
|
||||
accelerate_ship(aip, MAX(1.0f - dot_to_enemy, Objects[aip->target_objnum].phys_info.fspeed/sip->max_speed));
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -988,7 +1033,7 @@ void ai_big_chase_ct()
|
||||
extern void ai_select_secondary_weapon(object *objp, ship_weapon *swp, int priority1 = -1, int priority2 = -1);
|
||||
extern float set_secondary_fire_delay(ai_info *aip, ship *shipp, weapon_info *swip);
|
||||
extern void ai_choose_secondary_weapon(object *objp, ai_info *aip, object *en_objp);
|
||||
extern int maybe_avoid_big_ship(object *objp, object *ignore_objp, ai_info *aip, vector *goal_point, float delta_time);
|
||||
extern int maybe_avoid_big_ship(object *objp, object *ignore_objp, ai_info *aip, vec3d *goal_point, float delta_time);
|
||||
|
||||
extern void maybe_cheat_fire_synaptic(object *objp, ai_info *aip);
|
||||
|
||||
@@ -997,7 +1042,7 @@ extern void maybe_cheat_fire_synaptic(object *objp, ai_info *aip);
|
||||
// dist_to_enemy => distance (in m) to attack point on current target
|
||||
// dot_to_enemy => dot product between fvec of Pl_objp and vector from Pl_objp to attack point
|
||||
//
|
||||
void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector *firing_pos, vector *enemy_pos, vector *enemy_vel)
|
||||
void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vec3d *firing_pos, vec3d *enemy_pos, vec3d *enemy_vel)
|
||||
{
|
||||
ai_info *aip;
|
||||
ship_weapon *swp;
|
||||
@@ -1006,12 +1051,12 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector *
|
||||
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
|
||||
swp = &Ships[Pl_objp->instance].weapons;
|
||||
|
||||
if (dot_to_enemy > 0.95f - 0.5f * En_objp->radius/max(1.0f, En_objp->radius + dist_to_enemy)) {
|
||||
if (dot_to_enemy > 0.95f - 0.5f * En_objp->radius/MAX(1.0f, En_objp->radius + dist_to_enemy)) {
|
||||
aip->time_enemy_in_range += flFrametime;
|
||||
|
||||
// Chance of hitting ship is based on dot product of firing ship's forward vector with vector to ship
|
||||
// and also the size of the target relative to distance to target.
|
||||
if (dot_to_enemy > max(0.5f, 0.90f + aip->ai_accuracy/10.0f - En_objp->radius/max(1.0f,dist_to_enemy))) {
|
||||
if (dot_to_enemy > MAX(0.5f, 0.90f + aip->ai_accuracy/10.0f - En_objp->radius/MAX(1.0f,dist_to_enemy))) {
|
||||
|
||||
ship *temp_shipp;
|
||||
temp_shipp = &Ships[Pl_objp->instance];
|
||||
@@ -1021,7 +1066,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector *
|
||||
Assert(tswp->current_primary_bank < tswp->num_primary_banks);
|
||||
weapon_info *wip = &Weapon_info[tswp->primary_bank_weapons[tswp->current_primary_bank]];
|
||||
|
||||
if (dist_to_enemy < wip->max_speed * wip->lifetime){
|
||||
if (dist_to_enemy < MIN((wip->max_speed * wip->lifetime), wip->weapon_range)){
|
||||
has_fired = 1;
|
||||
if(! ai_fire_primary_weapon(Pl_objp)){
|
||||
has_fired = -1;
|
||||
@@ -1060,7 +1105,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector *
|
||||
if (swip->wi_flags2 & WIF2_LOCAL_SSM)
|
||||
firing_range=swip->lssm_lock_range;
|
||||
else
|
||||
firing_range= swip->max_speed * swip->lifetime;
|
||||
firing_range = MIN((swip->max_speed * swip->lifetime), swip->weapon_range);
|
||||
// reduce firing range of secondaries in nebula
|
||||
extern int Nebula_sec_range;
|
||||
if ((The_mission.flags & MISSION_FLAG_FULLNEB) && Nebula_sec_range) {
|
||||
@@ -1110,18 +1155,18 @@ void ai_big_switch_to_chase_mode(ai_info *aip)
|
||||
aip->submode_start_time = Missiontime;
|
||||
}
|
||||
|
||||
extern int ai_big_strafe_maybe_retreat(float dist, vector *target_pos);
|
||||
extern int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos);
|
||||
|
||||
// Make object Pl_objp chase object En_objp, which is a big ship, not a small ship.
|
||||
void ai_big_chase()
|
||||
{
|
||||
float dist_to_enemy, dot_to_enemy;
|
||||
vector player_pos, enemy_pos, vec_to_enemy;
|
||||
vec3d player_pos, enemy_pos, vec_to_enemy;
|
||||
ship_info *sip = &Ship_info[Ships[Pl_objp->instance].ship_info_index];
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
ai_info *aip = &Ai_info[shipp->ai_index];
|
||||
int enemy_ship_type;
|
||||
vector predicted_enemy_pos;
|
||||
vec3d predicted_enemy_pos;
|
||||
|
||||
Assert(aip->mode == AIM_CHASE);
|
||||
|
||||
@@ -1152,8 +1197,9 @@ void ai_big_chase()
|
||||
if (aip->ai_flags & AIF_TARGET_COLLISION) {
|
||||
if ( ai_big_strafe_maybe_retreat(dist_to_enemy, &enemy_pos) ) {
|
||||
aip->mode = AIM_STRAFE;
|
||||
aip->submode = AIS_STRAFE_AVOID;
|
||||
aip->submode_parm0 = Missiontime; // use parm0 as time strafe mode entered
|
||||
aip->submode = AIS_STRAFE_AVOID;
|
||||
aip->submode_start_time = Missiontime;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1237,6 +1283,7 @@ void ai_big_chase()
|
||||
default:
|
||||
aip->last_attack_time = Missiontime;
|
||||
aip->submode = SM_ATTACK;
|
||||
aip->submode_start_time = Missiontime;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1270,9 +1317,9 @@ void ai_big_chase()
|
||||
// mprintf(("normal dist; %.1f, time: %.1f\n", dist_normal_to_enemy, time_to_enemy));
|
||||
// }
|
||||
|
||||
// since we're not in strafe and we may get a bad normal, cap dist_normal_to_enemy as min(0.3*dist_to_enemy, self)
|
||||
// since we're not in strafe and we may get a bad normal, cap dist_normal_to_enemy as MIN(0.3*dist_to_enemy, self)
|
||||
// this will allow us to get closer on a bad normal
|
||||
dist_normal_to_enemy = max(0.3f*dist_to_enemy, dist_normal_to_enemy);
|
||||
dist_normal_to_enemy = MAX(0.3f*dist_to_enemy, dist_normal_to_enemy);
|
||||
|
||||
if (dist_to_enemy < ATTACK_COLLIDE_BASE_DIST) {
|
||||
// within 50m or 1sec
|
||||
@@ -1293,7 +1340,7 @@ void ai_big_chase()
|
||||
}
|
||||
}
|
||||
|
||||
float speed_dist = max(0.0f, (Pl_objp->phys_info.speed-50) * 2);
|
||||
float speed_dist = MAX(0.0f, (Pl_objp->phys_info.speed-50) * 2);
|
||||
if ((dist_normal_to_enemy < ATTACK_COLLIDE_AVOID_DIST + speed_dist) || (time_to_enemy < ATTACK_COLLIDE_AVOID_TIME) ) {
|
||||
// get away, simulate crsh recovery (don't use avoid)
|
||||
// accelerate_ship(aip, -1.0f);
|
||||
@@ -1352,8 +1399,8 @@ void ai_big_chase()
|
||||
|
||||
if (box_dist > 300) {
|
||||
aip->submode = SM_ATTACK;
|
||||
aip->last_attack_time = Missiontime;
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->last_attack_time = Missiontime;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1365,8 +1412,8 @@ void ai_big_chase()
|
||||
aip->submode_start_time = Missiontime;
|
||||
} else {
|
||||
aip->submode = SM_ATTACK;
|
||||
aip->last_attack_time = Missiontime;
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->last_attack_time = Missiontime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1382,8 +1429,8 @@ void ai_big_chase()
|
||||
|
||||
default:
|
||||
aip->submode = SM_ATTACK;
|
||||
aip->last_attack_time = Missiontime;
|
||||
aip->submode_start_time = Missiontime;
|
||||
aip->last_attack_time = Missiontime;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1412,9 +1459,9 @@ void ai_big_ship(object *objp)
|
||||
// dist => distance from Pl_objp front to attack point
|
||||
// dot => dot of Pl_objp fvec and vector to attack point
|
||||
// fire_pos => world pos from which firing
|
||||
void ai_big_attack_get_data(vector *enemy_pos, float *dist_to_enemy, float *dot_to_enemy)
|
||||
void ai_big_attack_get_data(vec3d *enemy_pos, float *dist_to_enemy, float *dot_to_enemy)
|
||||
{
|
||||
vector player_pos, vec_to_enemy, predicted_enemy_pos;
|
||||
vec3d player_pos, vec_to_enemy, predicted_enemy_pos;
|
||||
ship *shipp = &Ships[Pl_objp->instance];
|
||||
ai_info *aip = &Ai_info[shipp->ai_index];
|
||||
ship_info *esip = &Ship_info[Ships[En_objp->instance].ship_info_index];
|
||||
@@ -1449,7 +1496,7 @@ void ai_big_attack_get_data(vector *enemy_pos, float *dist_to_enemy, float *dot_
|
||||
if ((*dot_to_enemy < 0.25f) || (aip->target_time < 1.0f) || (aip->ai_flags & AIF_SEEK_LOCK)) {
|
||||
predicted_enemy_pos=*enemy_pos;
|
||||
} else {
|
||||
vector gun_pos, pnt;
|
||||
vec3d gun_pos, pnt;
|
||||
polymodel *po = model_get( shipp->modelnum );
|
||||
float weapon_speed;
|
||||
|
||||
@@ -1471,12 +1518,12 @@ void ai_big_attack_get_data(vector *enemy_pos, float *dist_to_enemy, float *dot_
|
||||
|
||||
// check to see if Pl_objp has gotten too close to attacking point.. if so, break off by entering
|
||||
// AIS_STRAFE_RETREAT
|
||||
int ai_big_strafe_maybe_retreat(float dist, vector *target_pos)
|
||||
int ai_big_strafe_maybe_retreat(float dist, vec3d *target_pos)
|
||||
{
|
||||
ai_info *aip;
|
||||
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
|
||||
|
||||
vector vec_to_target;
|
||||
vec3d vec_to_target;
|
||||
vm_vec_sub(&vec_to_target, target_pos, &Pl_objp->pos);
|
||||
|
||||
float dist_to_target, dist_normal_to_target, time_to_target;
|
||||
@@ -1487,11 +1534,11 @@ int ai_big_strafe_maybe_retreat(float dist, vector *target_pos)
|
||||
dist_normal_to_target = 0.2f * vm_vec_mag_quick(&vec_to_target);
|
||||
}
|
||||
|
||||
dist_normal_to_target = max(0.2f*dist_to_target, dist_normal_to_target);
|
||||
dist_normal_to_target = MAX(0.2f*dist_to_target, dist_normal_to_target);
|
||||
time_to_target = dist_normal_to_target / Pl_objp->phys_info.speed;
|
||||
|
||||
// add distance penalty for going too fast
|
||||
float speed_to_dist_penalty = max(0.0f, (Pl_objp->phys_info.speed-50));
|
||||
float speed_to_dist_penalty = MAX(0.0f, (Pl_objp->phys_info.speed-50));
|
||||
|
||||
//if ((dot_to_enemy > 1.0f - 0.1f * En_objp->radius/(dist_to_enemy + 1.0f)) && (Pl_objp->phys_info.speed > dist_to_enemy/5.0f))
|
||||
|
||||
@@ -1509,7 +1556,7 @@ int ai_big_strafe_maybe_retreat(float dist, vector *target_pos)
|
||||
|
||||
float box_dist;
|
||||
int is_inside;
|
||||
vector goal_point;
|
||||
vec3d goal_point;
|
||||
box_dist = get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST);
|
||||
|
||||
// set goal point
|
||||
@@ -1531,8 +1578,8 @@ int ai_big_strafe_maybe_retreat(float dist, vector *target_pos)
|
||||
void ai_big_strafe_attack()
|
||||
{
|
||||
ai_info *aip;
|
||||
vector target_pos;
|
||||
vector rand_vec;
|
||||
vec3d target_pos;
|
||||
vec3d rand_vec;
|
||||
float target_dist, target_dot, accel, t;
|
||||
object *target_objp;
|
||||
|
||||
@@ -1634,7 +1681,7 @@ void ai_big_strafe_attack()
|
||||
void ai_big_strafe_avoid()
|
||||
{
|
||||
ai_info *aip;
|
||||
vector target_pos;
|
||||
vec3d target_pos;
|
||||
float target_dist, target_dot;
|
||||
fix mode_time;
|
||||
|
||||
@@ -1661,7 +1708,7 @@ void ai_big_strafe_retreat1()
|
||||
{
|
||||
float dist;
|
||||
ai_info *aip;
|
||||
vector rand_vec;
|
||||
vec3d rand_vec;
|
||||
|
||||
aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
|
||||
|
||||
@@ -1907,24 +1954,26 @@ void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp)
|
||||
return;
|
||||
}
|
||||
|
||||
// Only attack turret if it sits on current target
|
||||
Assert(weapon_objp->parent >= 0 && weapon_objp->parent < MAX_OBJECTS);
|
||||
parent_objp = &Objects[weapon_objp->parent];
|
||||
|
||||
// UnknownPlayer : Decide whether or not this weapon was a beam, in which case it might be a good
|
||||
// idea to go after it even if its not on the current target. This is randomized so
|
||||
// the ai will not always go after different ships firing beams at them.
|
||||
// Approx 1/4 chance we'll go after the other ship's beam.
|
||||
|
||||
if ( Weapon_info[weapon_objp->instance].wi_flags & WIF_BEAM ) {
|
||||
// Approx 1/4 chance we'll go after the beam
|
||||
if (frand()*100 > 25.0f) {
|
||||
if ( (parent_objp->signature != weapon_objp->parent_sig) || (parent_objp->type != OBJ_SHIP) ) {
|
||||
return;
|
||||
}
|
||||
bool attack_turret_on_different_ship = (The_mission.flags & MISSION_FLAG_USE_NEW_AI)
|
||||
&& (Weapon_info[weapon_objp->instance].wi_flags & WIF_BEAM) && (frand()*100 < 25.0f);
|
||||
|
||||
// unless we're making an exception, we should only attack a turret if it sits on the current target
|
||||
if ( !attack_turret_on_different_ship )
|
||||
{
|
||||
if ( (parent_objp->signature != weapon_objp->parent_sig) || (parent_objp->type != OBJ_SHIP) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( aip->target_objnum != OBJ_INDEX(parent_objp) ) {
|
||||
return;
|
||||
}
|
||||
if ( aip->target_objnum != OBJ_INDEX(parent_objp) ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,26 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/AiBig.h $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2004-03-05 09:01:51 $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 2005-07-13 02:50:48 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Header file for AI code related to large ships
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.2 2005/04/05 05:53:13 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 1.1 2005/03/25 06:45:12 wmcoolmon
|
||||
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
|
||||
*
|
||||
* Revision 2.2 2004/08/11 05:06:34 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.1 2004/03/05 09:01:51 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:28 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -70,13 +83,12 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __AIBIG_H__
|
||||
#define __AIBIG_H__
|
||||
|
||||
struct object;
|
||||
struct ai_info;
|
||||
struct vector;
|
||||
struct vec3d;
|
||||
struct ship_subsys;
|
||||
|
||||
void ai_big_ship(object *objp);
|
||||
@@ -87,8 +99,8 @@ void ai_big_subsys_path_cleanup(ai_info *aip);
|
||||
void ai_big_strafe();
|
||||
int ai_big_maybe_enter_strafe_mode(object *objp, int weapon_objnum, int consider_target_only=0);
|
||||
void ai_big_strafe_maybe_attack_turret(object *ship_objp, object *weapon_objp);
|
||||
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vector *attack_point, float fov=1.0f);
|
||||
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vector *gpos, vector *gvec, vector *attack_point, float weapon_travel_dist, float fov=1.0f);
|
||||
void ai_big_pick_attack_point(object *objp, object *attacker_objp, vec3d *attack_point, float fov=1.0f);
|
||||
void ai_big_pick_attack_point_turret(object *objp, ship_subsys *ssp, vec3d *gpos, vec3d *gvec, vec3d *attack_point, float weapon_travel_dist, float fov=1.0f);
|
||||
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -9,13 +9,119 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/AiGoals.cpp $
|
||||
* $Revision: 2.11 $
|
||||
* $Date: 2004-03-05 09:01:52 $
|
||||
* $Revision: 1.12 $
|
||||
* $Date: 2005-08-31 08:11:58 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* File to deal with manipulating AI goals, etc.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.11 2005/08/31 08:09:51 Goober5000
|
||||
* All wings will now form on their respective leaders, not just certain starting wings.
|
||||
* If this breaks anything, the old code is commented out. You know who to yell at. ;)
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.10 2005/08/31 07:54:33 Goober5000
|
||||
* Wings will now form on their leader, not necessarily the player. This is to
|
||||
* account for cases where the player is not the leader of his wing. It has the
|
||||
* side effect of causing wings that arrive later in the mission to form on *their*
|
||||
* leader rather than the player, but this is probably the preferred behavior (at
|
||||
* least judging from Mike Kulas's comment of 5/9/98). This does create a
|
||||
* difference from retail AI, but it should be only cosmetic, since ships only form
|
||||
* on a wing until they are ordered (via comm or sexp) to do something else.
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.9 2005/08/23 09:18:08 Goober5000
|
||||
* ensure init/reset of goals works cleanly
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.8 2005/08/23 09:03:56 Goober5000
|
||||
* fix for bug 519
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.7 2005/07/27 18:27:49 Goober5000
|
||||
* verified that submode_start_time is updated whenever submode is changed
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.6 2005/07/25 03:13:24 Goober5000
|
||||
* various code cleanups, tweaks, and fixes; most notably the MISSION_FLAG_USE_NEW_AI
|
||||
* should now be added to all places where it is needed (except the turret code, which I still
|
||||
* have to to review)
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.5 2005/07/23 18:38:47 Goober5000
|
||||
* fixed a rare but ugly (though amusing) bug
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.4 2005/07/22 10:18:36 Goober5000
|
||||
* CVS header tweaks
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.3 2005/07/13 02:50:48 Goober5000
|
||||
* remove PreProcDefine #includes in FS2
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.2 2005/05/11 11:38:03 Goober5000
|
||||
* fixed a docking bug
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.1 2005/03/25 06:45:13 wmcoolmon
|
||||
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
|
||||
*
|
||||
* Revision 2.24 2005/03/02 21:24:47 taylor
|
||||
* more network/inferno goodness for Windows, takes care of a few warnings too
|
||||
*
|
||||
* Revision 2.23 2005/01/31 10:34:39 taylor
|
||||
* merge with Linux/OSX tree - p0131
|
||||
*
|
||||
* Revision 2.22 2005/01/26 05:44:10 Goober5000
|
||||
* AHA... squashed another bug
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.21 2005/01/18 00:14:36 Goober5000
|
||||
* clarified a bunch of sexp stuff and fixed a bug
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.20 2005/01/13 03:33:07 Goober5000
|
||||
* hmm, rolled back one of my clarifications since it caused things to get messed up
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.19 2005/01/13 01:10:33 Goober5000
|
||||
* forgot to remove a comment
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.18 2005/01/12 23:38:42 Goober5000
|
||||
* fixed another nasty bug
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.17 2005/01/11 21:38:48 Goober5000
|
||||
* multiple ship docking :)
|
||||
* don't tell anyone yet... check the SCP internal
|
||||
* --Goober500
|
||||
*
|
||||
* Revision 2.16 2004/12/14 14:46:12 Goober5000
|
||||
* allow different wing names than ABGDEZ
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.15 2004/07/26 20:47:51 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.14 2004/07/25 18:46:30 Kazan
|
||||
* -fred_no_warn has become -no_warn and applies to both fred and fs2
|
||||
* added new ai directive (last commit) and disabled afterburners while performing AIM_WAYPOINTS or AIM_FLY_TO_SHIP
|
||||
* fixed player ship speed bug w/ player-use-ai, now stays in formation correctly and manages speed
|
||||
* made -radar_reduce ignore itself if no parameter is given (ignoring launcher bug)
|
||||
*
|
||||
* Revision 2.13 2004/07/25 00:31:31 Kazan
|
||||
* i have absolutely nothing to say about that subject
|
||||
*
|
||||
* Revision 2.12 2004/07/12 16:33:05 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.11 2004/03/05 09:01:52 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.10 2004/02/04 09:21:36 Goober5000
|
||||
* more player ai stuff
|
||||
* --Goober5000
|
||||
@@ -95,8 +201,8 @@
|
||||
* subsystem as model_read.
|
||||
*
|
||||
* 9 6/03/99 8:58p Andsager
|
||||
* Fix bug where player's target is lost. Alpha wing had clear wing
|
||||
* goals, and this was applied to alpha1.
|
||||
* Fix bug where player's target is lost. Player wing had clear wing
|
||||
* goals, and this was applied to player.
|
||||
*
|
||||
* 8 5/27/99 12:14p Andsager
|
||||
* Some fixes for live debris when more than one subsys on ship with live
|
||||
@@ -145,7 +251,7 @@
|
||||
* 169 5/11/98 11:20a Sandeep
|
||||
*
|
||||
* 168 5/10/98 12:02a Mike
|
||||
* Only Alpha wing will form on player's wing, not any player wing.
|
||||
* Only player's wing will form on player's wing, not any wing in player's squadron.
|
||||
*
|
||||
* 167 4/23/98 1:49a Allender
|
||||
* major rearm/repair fixes for multiplayer. Fixed respawning of AI ships
|
||||
@@ -441,7 +547,7 @@
|
||||
* goal vs. ship type validity
|
||||
*
|
||||
* 91 8/12/97 9:58a Hoffoss
|
||||
* Fixed ai_update_goal_references() and query_referended_in_ai_goals().
|
||||
* Fixed ai_update_goal_references() and query_referenced_in_ai_goals().
|
||||
*
|
||||
* 90 8/12/97 8:01a Allender
|
||||
* when adding goals to wing structures, replace the oldest entry of the
|
||||
@@ -510,7 +616,8 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include "ship/aigoals.h"
|
||||
|
||||
#include "ai/aigoals.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "mission/missionlog.h"
|
||||
#include "mission/missionparse.h"
|
||||
@@ -521,6 +628,8 @@
|
||||
#include "network/multi.h"
|
||||
#include "ship/ship.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "object/objectdock.h"
|
||||
|
||||
|
||||
// all ai goals dealt with in this code are goals that are specified through
|
||||
// sexpressions in the mission file. They are either specified as part of a
|
||||
@@ -593,28 +702,37 @@ char *Ai_goal_text(int goal)
|
||||
|
||||
// function to maybe add the form on my wing goal for a player's starting wing. Called from below and when a
|
||||
// player wing arrives.
|
||||
// Goober5000 - made more generic
|
||||
void ai_maybe_add_form_goal( wing *wingp )
|
||||
{
|
||||
int j;
|
||||
char *wing_leader;
|
||||
|
||||
// Goober5000 - the wing leader is now not necessarily the player
|
||||
wing_leader = Ships[wingp->ship_index[wingp->special_ship]].ship_name;
|
||||
|
||||
// iterate through the ship_index list of this wing and check for orders. We will do
|
||||
// this for all ships in the wing instead of on a wing only basis in cases some ships
|
||||
// this for all ships in the wing instead of on a wing only basis in case some ships
|
||||
// in the wing actually have different orders than others
|
||||
for ( j = 0; j < wingp->current_count; j++ ) {
|
||||
ai_info *aip;
|
||||
|
||||
Assert( wingp->ship_index[j] != -1 ); // get Allender
|
||||
|
||||
// don't process wing leader
|
||||
if (j == wingp->special_ship)
|
||||
continue;
|
||||
|
||||
aip = &Ai_info[Ships[wingp->ship_index[j]].ai_index];
|
||||
|
||||
// don't process Player_ship
|
||||
if ( aip == Player_ai )
|
||||
continue;
|
||||
|
||||
// it is sufficient enough to check the first goal entry to see if it has a valid
|
||||
// goal
|
||||
// it is sufficient enough to check the first goal entry to see if it has a valid goal
|
||||
if ( aip->goals[0].ai_mode == AI_GOAL_NONE ) {
|
||||
// need to add a form on my wing goal here. Ships are always forming on the player's wing.
|
||||
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, Player_ship->ship_name, aip );
|
||||
// need to add a form on my wing goal here
|
||||
ai_add_ship_goal_player( AIG_TYPE_PLAYER_SHIP, AI_GOAL_FORM_ON_WING, -1, wing_leader, aip );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -629,8 +747,16 @@ void ai_post_process_mission()
|
||||
// (2) if they have an order, they are free to act on it.
|
||||
//
|
||||
// So basically, we are checking for (1)
|
||||
if ( !Fred_running ) {
|
||||
for ( i = 0; i < 1; i++ ) { // MK, 5/9/98: Used to iterate through MAX_PLAYER_WINGS, but this was too many ships forming on player.
|
||||
if ( !Fred_running )
|
||||
{
|
||||
// Goober5000 - make all wings form on their respective leaders
|
||||
for ( i = 0; i < num_wings; i++ )
|
||||
{
|
||||
ai_maybe_add_form_goal( &Wings[i] );
|
||||
}
|
||||
|
||||
/*
|
||||
for ( i = 0; i < 1; i++ ) { // MK, 5/9/98: Used to iterate through MAX_STARTING_WINGS, but this was too many ships forming on player.
|
||||
if ( Starting_wings[i] != -1 ) {
|
||||
wing *wingp;
|
||||
|
||||
@@ -640,6 +766,7 @@ void ai_post_process_mission()
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// for every valid ship object, call process_mission_orders to be sure that ships start the
|
||||
@@ -766,6 +893,7 @@ void ai_remove_ship_goal( ai_info *aip, int index )
|
||||
aip->goals[index].signature = -1;
|
||||
aip->goals[index].priority = -1;
|
||||
aip->goals[index].flags = 0; // must reset the flags since not doing so will screw up goal sorting.
|
||||
|
||||
if ( index == aip->active_goal )
|
||||
aip->active_goal = AI_GOAL_NONE;
|
||||
|
||||
@@ -786,7 +914,9 @@ void ai_clear_ship_goals( ai_info *aip )
|
||||
// next line moved here on 8/5/97 by MWA
|
||||
// Dont reset player ai (and hence target)
|
||||
// Goober5000 - account for player ai
|
||||
if ( !((Player_ship != NULL) && (&Ships[aip->shipnum] == Player_ship)) || Player_use_ai ) {
|
||||
//if ( !((Player_ship != NULL) && (&Ships[aip->shipnum] == Player_ship)) || Player_use_ai ) {
|
||||
if ( (Player_ship == NULL) || (&Ships[aip->shipnum] != Player_ship) || Player_use_ai )
|
||||
{
|
||||
ai_do_default_behavior( &Objects[Ships[aip->shipnum].objnum] );
|
||||
}
|
||||
}
|
||||
@@ -811,6 +941,7 @@ void ai_clear_wing_goals( int wingnum )
|
||||
wingp->ai_goals[i].ai_mode = AI_GOAL_NONE;
|
||||
wingp->ai_goals[i].signature = -1;
|
||||
wingp->ai_goals[i].priority = -1;
|
||||
wingp->ai_goals[i].flags = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -870,6 +1001,7 @@ void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp )
|
||||
wingp->ai_goals[i].ai_mode = AI_GOAL_NONE;
|
||||
wingp->ai_goals[i].signature = -1;
|
||||
wingp->ai_goals[i].priority = -1;
|
||||
wingp->ai_goals[i].flags = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1014,13 +1146,61 @@ void ai_goal_purge_all_invalid_goals( ai_goal *aigp )
|
||||
ai_goal_purge_invalid_goals( aigp, Wings[i].ai_goals );
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
int ai_goal_find_dockpoint(int shipnum, int dock_type)
|
||||
{
|
||||
int dock_index = -1;
|
||||
int loop_count = 0;
|
||||
|
||||
ship *shipp = &Ships[shipnum];
|
||||
object *objp = &Objects[shipp->objnum];
|
||||
|
||||
// only check 100 points for sanity's sake
|
||||
while (loop_count < 100)
|
||||
{
|
||||
dock_index = model_find_dock_index(shipp->modelnum, dock_type, dock_index+1);
|
||||
|
||||
// not found?
|
||||
if (dock_index == -1)
|
||||
{
|
||||
if (loop_count == 0)
|
||||
{
|
||||
// first time around... there are no slots fitting this description
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// every slot is full
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// we've found something... check if it's occupied
|
||||
if (dock_find_object_at_dockpoint(objp, dock_index) == NULL)
|
||||
{
|
||||
// not occupied... yay, we've found an index
|
||||
return dock_index;
|
||||
}
|
||||
|
||||
// keep track
|
||||
loop_count++;
|
||||
}
|
||||
|
||||
// insanity?
|
||||
if (loop_count >= 100)
|
||||
Warning(LOCATION, "Too many iterations while looking for a dockpoint on %s. Either there was a bug or this is an übership.\n", shipp->ship_name);
|
||||
|
||||
// if we're here, just return the first dockpoint
|
||||
return model_find_dock_index(shipp->modelnum, dock_type);
|
||||
}
|
||||
|
||||
// function to fix up dock point references for objects.
|
||||
// passed are the pointer to goal we are working with. aip if the ai_info pointer
|
||||
// of the ship with the order. aigp is a pointer to the goal (of aip) of which we are
|
||||
// fixing up the docking points
|
||||
void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
|
||||
{
|
||||
int shipnum, dockee_index, docker_index;
|
||||
int shipnum, docker_index, dockee_index;
|
||||
|
||||
Assert ( aip->shipnum != -1 );
|
||||
shipnum = ship_name_lookup( aigp->ship_name );
|
||||
@@ -1028,24 +1208,23 @@ void ai_goal_fixup_dockpoints(ai_info *aip, ai_goal *aigp)
|
||||
dockee_index = -1;
|
||||
|
||||
// look for docking points of the appriopriate type. Use cargo docks for cargo ships.
|
||||
// use
|
||||
if ( Ship_info[Ships[shipnum].ship_info_index].flags & SIF_CARGO ) {
|
||||
docker_index = model_find_dock_index(Ships[aip->shipnum].modelnum, DOCK_TYPE_CARGO );
|
||||
dockee_index = model_find_dock_index(Ships[shipnum].modelnum, DOCK_TYPE_CARGO );
|
||||
} else if ( Ship_info[Ships[aip->shipnum].ship_info_index].flags & SIF_SUPPORT ) {
|
||||
docker_index = model_find_dock_index( Ships[aip->shipnum].modelnum, DOCK_TYPE_REARM );
|
||||
dockee_index = model_find_dock_index( Ships[shipnum].modelnum, DOCK_TYPE_REARM );
|
||||
if (Ship_info[Ships[shipnum].ship_info_index].flags & SIF_CARGO) {
|
||||
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_CARGO);
|
||||
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_CARGO);
|
||||
} else if (Ship_info[Ships[aip->shipnum].ship_info_index].flags & SIF_SUPPORT) {
|
||||
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_REARM);
|
||||
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_REARM);
|
||||
}
|
||||
|
||||
// if we didn't find dockpoints above, then we should just look for generic docking points
|
||||
if ( docker_index == -1 )
|
||||
docker_index = model_find_dock_index(Ships[aip->shipnum].modelnum, DOCK_TYPE_GENERIC );
|
||||
docker_index = ai_goal_find_dockpoint(aip->shipnum, DOCK_TYPE_GENERIC);
|
||||
if ( dockee_index == -1 )
|
||||
dockee_index = model_find_dock_index(Ships[shipnum].modelnum, DOCK_TYPE_GENERIC );
|
||||
dockee_index = ai_goal_find_dockpoint(shipnum, DOCK_TYPE_GENERIC);
|
||||
|
||||
aigp->docker.index = docker_index;
|
||||
aigp->dockee.index = dockee_index;
|
||||
aigp->flags &= ~(AIGF_DOCKER_NAME_VALID | AIGF_DOCKEE_NAME_VALID);
|
||||
aigp->flags |= AIGF_DOCK_INDEXES_VALID;
|
||||
}
|
||||
|
||||
// these functions deal with adding goals sent from the player. They are slightly different
|
||||
@@ -1087,27 +1266,36 @@ void ai_add_goal_sub_player(int type, int mode, int submode, char *shipname, ai_
|
||||
aigp->priority = PLAYER_PRIORITY_SHIP;
|
||||
}
|
||||
|
||||
int ai_goal_find_empty_slot( ai_goal *goals )
|
||||
// Goober5000 - Modified this function for clarity and to avoid returning the active goal's index
|
||||
// as the empty slot. This avoids overwriting the active goal while it's being executed. So far
|
||||
// the only time I've noticed it being a problem is during a rare situation where more than five
|
||||
// friendlies want to rearm at the same time. The support ship forgets what it's doing and flies
|
||||
// off to repair somebody while still docked. I reproduced this with retail, so it's not a bug in
|
||||
// my new docking code. :)
|
||||
int ai_goal_find_empty_slot( ai_goal *goals, int active_goal )
|
||||
{
|
||||
int gindex, empty_index, oldest_index;
|
||||
int gindex, oldest_index;
|
||||
|
||||
empty_index = -1;
|
||||
oldest_index = 0;
|
||||
for ( gindex = 0; gindex < MAX_AI_GOALS; gindex++ ) {
|
||||
if ( goals[gindex].time < goals[oldest_index].time )
|
||||
oldest_index = -1;
|
||||
for ( gindex = 0; gindex < MAX_AI_GOALS; gindex++ )
|
||||
{
|
||||
// get the index for the first unused goal
|
||||
if (goals[gindex].ai_mode == AI_GOAL_NONE)
|
||||
return gindex;
|
||||
|
||||
// if this is the active goal, don't consider it for pre-emption!!
|
||||
if (gindex == active_goal)
|
||||
continue;
|
||||
|
||||
// store the index of the oldest goal
|
||||
if (oldest_index < 0)
|
||||
oldest_index = gindex;
|
||||
else if (goals[gindex].time < goals[oldest_index].time)
|
||||
oldest_index = gindex;
|
||||
|
||||
if ( (empty_index == -1) && (goals[gindex].ai_mode == AI_GOAL_NONE) ) // get the index for this goal
|
||||
empty_index = gindex;
|
||||
}
|
||||
|
||||
// if we didn't find an empty slot, find the oldest goal and use it's slot
|
||||
if ( empty_index == -1 )
|
||||
empty_index = oldest_index;
|
||||
|
||||
Assert ( empty_index < MAX_AI_GOALS );
|
||||
|
||||
return empty_index;
|
||||
// if we didn't find an empty slot, use the oldest goal's slot
|
||||
return oldest_index;
|
||||
}
|
||||
|
||||
// adds a goal from a player to the given ship's ai_info structure. 'type' tells us if goal
|
||||
@@ -1119,7 +1307,7 @@ void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, a
|
||||
int empty_index;
|
||||
ai_goal *aigp;
|
||||
|
||||
empty_index = ai_goal_find_empty_slot( aip->goals );
|
||||
empty_index = ai_goal_find_empty_slot( aip->goals, aip->active_goal );
|
||||
|
||||
// get a pointer to the goal structure
|
||||
aigp = &aip->goals[empty_index];
|
||||
@@ -1158,13 +1346,13 @@ void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, i
|
||||
// add the sexpression index into the wing's list of goal sexpressions if
|
||||
// there are more waves to come. We use the same method here as when adding a goal to
|
||||
// a ship -- find the first empty entry. If none exists, take the oldest entry and replace it.
|
||||
empty_index = ai_goal_find_empty_slot( wingp->ai_goals );
|
||||
empty_index = ai_goal_find_empty_slot( wingp->ai_goals, -1 );
|
||||
ai_add_goal_sub_player( type, mode, submode, shipname, &wingp->ai_goals[empty_index] );
|
||||
}
|
||||
|
||||
|
||||
// common routine to add a sexpression mission goal to the appropriate goal structure.
|
||||
void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
|
||||
void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp, char *actor_name )
|
||||
{
|
||||
int n, node, dummy, op;
|
||||
char *text;
|
||||
@@ -1175,11 +1363,12 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
|
||||
|
||||
aigp->signature = Ai_goal_signature++;
|
||||
|
||||
aigp->ship_name = NULL;
|
||||
aigp->time = Missiontime;
|
||||
aigp->type = type;
|
||||
aigp->flags = 0;
|
||||
|
||||
op = find_operator( text );
|
||||
op = get_operator_const( text );
|
||||
|
||||
switch (op) {
|
||||
|
||||
@@ -1207,11 +1396,10 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
|
||||
case OP_AI_DESTROY_SUBSYS:
|
||||
aigp->ai_mode = AI_GOAL_DESTROY_SUBSYSTEM;
|
||||
aigp->ship_name = ai_get_goal_ship_name( CTEXT(CDR(node)), &aigp->ship_name_index );
|
||||
// store the name of the subsystem in the docker_name field for now -- this field must
|
||||
// get fixed up when the goal is valid since we need to locate the subsystem on the ship's
|
||||
// model.
|
||||
// store the name of the subsystem in the docker.name field for now -- this field must get
|
||||
// fixed up when the goal is valid since we need to locate the subsystem on the ship's model
|
||||
aigp->docker.name = ai_get_goal_ship_name(CTEXT(CDR(CDR(node))), &dummy);
|
||||
aigp->flags |= AIGF_SUBSYS_NAME_VALID;
|
||||
aigp->flags |= AIGF_SUBSYS_NEEDS_FIXUP;
|
||||
aigp->priority = atoi( CTEXT(CDR(CDR(CDR(node)))) );
|
||||
break;
|
||||
|
||||
@@ -1244,8 +1432,14 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
|
||||
break;
|
||||
|
||||
case OP_AI_UNDOCK:
|
||||
aigp->ship_name = NULL;
|
||||
aigp->priority = atoi( CTEXT(CDR(node)) );
|
||||
|
||||
// Goober5000 - optional undock with something
|
||||
if (CDR(CDR(node)) != -1)
|
||||
aigp->ship_name = ai_get_goal_ship_name( CTEXT(CDR(CDR(node))), &aigp->ship_name_index );
|
||||
else
|
||||
aigp->ship_name = NULL;
|
||||
|
||||
aigp->ai_mode = AI_GOAL_UNDOCK;
|
||||
aigp->ai_submode = AIS_UNDOCK_0;
|
||||
break;
|
||||
@@ -1260,7 +1454,7 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
|
||||
aigp->ship_name = ai_get_goal_ship_name( CTEXT(CDR(node)), &aigp->ship_name_index );
|
||||
aigp->docker.name = ai_add_dock_name(CTEXT(CDR(CDR(node))));
|
||||
aigp->dockee.name = ai_add_dock_name(CTEXT(CDR(CDR(CDR(node)))));
|
||||
aigp->flags |= ( AIGF_DOCKER_NAME_VALID | AIGF_DOCKEE_NAME_VALID );
|
||||
aigp->flags &= ~AIGF_DOCK_INDEXES_VALID;
|
||||
aigp->priority = atoi( CTEXT(CDR(CDR(CDR(CDR(node))))) );
|
||||
|
||||
aigp->ai_mode = AI_GOAL_DOCK;
|
||||
@@ -1373,6 +1567,18 @@ void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp )
|
||||
nprintf (("AI", "bashing sexpression priority of goal %s from %d to %d.\n", text, aigp->priority, PLAYER_PRIORITY_MIN-1));
|
||||
aigp->priority = PLAYER_PRIORITY_MIN-1;
|
||||
}
|
||||
|
||||
// Goober5000 - since none of the goals act on the actor,
|
||||
// don't assign the goal if the actor's goal target is itself
|
||||
if (aigp->ship_name != NULL && !strcmp(aigp->ship_name, actor_name))
|
||||
{
|
||||
// based on ai_remove_ship_goal, these seem to be the only statements
|
||||
// necessary to cause this goal to "never have been assigned"
|
||||
aigp->ai_mode = AI_GOAL_NONE;
|
||||
aigp->signature = -1;
|
||||
aigp->priority = -1;
|
||||
aigp->flags = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// adds an ai goal for an individual ship
|
||||
@@ -1381,8 +1587,8 @@ void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip )
|
||||
{
|
||||
int gindex;
|
||||
|
||||
gindex = ai_goal_find_empty_slot( aip->goals );
|
||||
ai_add_goal_sub_sexp( sexp, type, &aip->goals[gindex] );
|
||||
gindex = ai_goal_find_empty_slot( aip->goals, aip->active_goal );
|
||||
ai_add_goal_sub_sexp( sexp, type, &aip->goals[gindex], Ships[aip->shipnum].ship_name );
|
||||
}
|
||||
|
||||
// code to add ai goals to wings.
|
||||
@@ -1391,7 +1597,7 @@ void ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
|
||||
int i;
|
||||
wing *wingp = &Wings[wingnum];
|
||||
|
||||
// add the ai goal for any ship that is currently arrived in the game (only if fred isn't running
|
||||
// add the ai goal for any ship that is currently arrived in the game (only if fred isn't running)
|
||||
if ( !Fred_running ) {
|
||||
for (i = 0; i < wingp->current_count; i++) {
|
||||
int num = wingp->ship_index[i];
|
||||
@@ -1406,8 +1612,8 @@ void ai_add_wing_goal_sexp(int sexp, int type, int wingnum)
|
||||
if ((wingp->num_waves - wingp->current_wave > 0) || Fred_running) {
|
||||
int gindex;
|
||||
|
||||
gindex = ai_goal_find_empty_slot( wingp->ai_goals );
|
||||
ai_add_goal_sub_sexp( sexp, type, &wingp->ai_goals[gindex] );
|
||||
gindex = ai_goal_find_empty_slot( wingp->ai_goals, -1 );
|
||||
ai_add_goal_sub_sexp( sexp, type, &wingp->ai_goals[gindex], wingp->name );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1425,9 +1631,18 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int doc
|
||||
int gindex;
|
||||
ai_goal *aigp;
|
||||
|
||||
// find an empty slot to put this goal in.
|
||||
gindex = ai_goal_find_empty_slot( aip->goals );
|
||||
#ifndef NDEBUG
|
||||
// Goober5000 - none of the goals act on the actor, as in ai_add_goal_sub_sexp
|
||||
if (!strcmp(name, Ships[aip->shipnum].ship_name))
|
||||
{
|
||||
// not good
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// find an empty slot to put this goal in.
|
||||
gindex = ai_goal_find_empty_slot( aip->goals, aip->active_goal );
|
||||
aigp = &(aip->goals[gindex]);
|
||||
|
||||
aigp->signature = Ai_goal_signature++;
|
||||
@@ -1437,6 +1652,8 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int doc
|
||||
aigp->flags = AIGF_GOAL_OVERRIDE;
|
||||
|
||||
switch ( goal_type ) {
|
||||
|
||||
/* Goober5000 - this seems to not be used
|
||||
case AI_GOAL_DOCK:
|
||||
aigp->ship_name = name;
|
||||
aigp->docker.index = docker_point;
|
||||
@@ -1446,19 +1663,24 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int doc
|
||||
aigp->ai_mode = AI_GOAL_DOCK;
|
||||
aigp->ai_submode = AIS_DOCK_0; // be sure to set the submode
|
||||
break;
|
||||
*/
|
||||
|
||||
case AI_GOAL_UNDOCK:
|
||||
aigp->ship_name = NULL;
|
||||
aigp->ship_name = name;
|
||||
aigp->priority = 100;
|
||||
aigp->ai_mode = AI_GOAL_UNDOCK;
|
||||
aigp->ai_submode = AIS_UNDOCK_0;
|
||||
break;
|
||||
|
||||
/* Goober5000 - this seems to not be used
|
||||
case AI_GOAL_GUARD:
|
||||
aigp->ai_mode = AI_GOAL_GUARD;
|
||||
if ( wing_name_lookup(name, 1) != -1 )
|
||||
aigp->ai_mode = AI_GOAL_GUARD_WING;
|
||||
else
|
||||
aigp->ai_mode = AI_GOAL_GUARD;
|
||||
aigp->priority = PLAYER_PRIORITY_MIN-1; // make the priority always less than what the player's is
|
||||
break;
|
||||
*/
|
||||
|
||||
case AI_GOAL_REARM_REPAIR:
|
||||
aigp->ai_mode = AI_GOAL_REARM_REPAIR;
|
||||
@@ -1471,7 +1693,7 @@ void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int doc
|
||||
|
||||
default:
|
||||
Int3(); // unsupported internal goal -- see Mike K or Mark A.
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1544,7 +1766,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
if (!(shipp->flags2 & SF2_NO_SUBSPACE_DRIVE))
|
||||
return AI_GOAL_ACHIEVABLE;
|
||||
|
||||
// if subspace drive, only valid if there's somewhere to depart to
|
||||
// if no subspace drive, only valid if there's somewhere to depart to
|
||||
|
||||
// locate a capital ship on the same team:
|
||||
if (ship_get_ship_with_dock_bay(shipp->team) >= 0)
|
||||
@@ -1614,9 +1836,9 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
// destroyed when shipnum is valid
|
||||
shipnum = ship_name_lookup( aigp->ship_name );
|
||||
|
||||
// can't determine the status of this goal if ship not valid or the subsystem
|
||||
// name *is* still valid (meaning we haven't found a valid index yet).
|
||||
if ( (shipnum == -1) || (aigp->flags & AIGF_SUBSYS_NAME_VALID) ) {
|
||||
// can't determine the status of this goal if ship not valid
|
||||
// or we haven't found a valid subsystem index yet
|
||||
if ( (shipnum == -1) || (aigp->flags & AIGF_SUBSYS_NEEDS_FIXUP) ) {
|
||||
status = 0;
|
||||
break;
|
||||
}
|
||||
@@ -1644,7 +1866,8 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
case AI_GOAL_EVADE_SHIP:
|
||||
case AI_GOAL_CHASE:
|
||||
case AI_GOAL_STAY_NEAR_SHIP:
|
||||
case AI_GOAL_REARM_REPAIR: {
|
||||
case AI_GOAL_REARM_REPAIR:
|
||||
case AI_GOAL_FLY_TO_SHIP: {
|
||||
int shipnum;
|
||||
|
||||
// MWA -- 4/22/98. Check for the ship actually being in the mission before
|
||||
@@ -1703,7 +1926,8 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
// determine the status of the shipname that this object is acting on. There are a couple of
|
||||
// special cases to deal with. Both the chase wing and undock commands will return from within
|
||||
// the if statement.
|
||||
if ( (aigp->ai_mode == AI_GOAL_CHASE_WING) || (aigp->ai_mode == AI_GOAL_GUARD_WING) ) {
|
||||
if ( (aigp->ai_mode == AI_GOAL_CHASE_WING) || (aigp->ai_mode == AI_GOAL_GUARD_WING) )
|
||||
{
|
||||
int num = wing_name_lookup( aigp->ship_name );
|
||||
wing *wingp = &Wings[num];
|
||||
|
||||
@@ -1713,16 +1937,32 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
else
|
||||
return AI_GOAL_ACHIEVABLE;
|
||||
} else if ( aigp->ai_mode == AI_GOAL_UNDOCK ) {
|
||||
}
|
||||
// Goober5000 - undocking from an unspecified object is always achievable;
|
||||
// undocking from a specified object is handled below
|
||||
else if ( (aigp->ai_mode == AI_GOAL_UNDOCK) && (aigp->ship_name == NULL) )
|
||||
{
|
||||
return AI_GOAL_ACHIEVABLE;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// goal ship is currently in mission
|
||||
if ( ship_name_lookup( aigp->ship_name ) != -1 )
|
||||
{
|
||||
status = SHIP_STATUS_ARRIVED;
|
||||
}
|
||||
// goal ship is still on the arrival list
|
||||
else if ( !mission_parse_ship_arrived(aigp->ship_name) )
|
||||
{
|
||||
status = SHIP_STATUS_NOT_ARRIVED;
|
||||
}
|
||||
// goal ship has left the area
|
||||
else if ( ship_find_exited_ship_by_name(aigp->ship_name) != -1 )
|
||||
{
|
||||
status = SHIP_STATUS_GONE;
|
||||
else {
|
||||
}
|
||||
else
|
||||
{
|
||||
Int3(); // get ALLENDER
|
||||
status = SHIP_STATUS_UNKNOWN;
|
||||
}
|
||||
@@ -1740,25 +1980,20 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
// this goal will get removed.
|
||||
if ( (aigp->ai_mode == AI_GOAL_DOCK) && (status == SHIP_STATUS_ARRIVED) ) {
|
||||
int index, modelnum, shipnum;
|
||||
char docker_name[NAME_LENGTH], dockee_name[NAME_LENGTH];
|
||||
|
||||
// debug code to save off the name of the dockpoints (if they exist).
|
||||
docker_name[0] = dockee_name[0] = '\0';
|
||||
if ( aigp->flags & AIGF_DOCKER_NAME_VALID ) {
|
||||
strcpy(docker_name, aigp->docker.name);
|
||||
if (!(aigp->flags & AIGF_DOCKER_INDEX_VALID)) {
|
||||
modelnum = Ships[objp->instance].modelnum;
|
||||
index = model_find_dock_name_index(modelnum, aigp->docker.name);
|
||||
aigp->docker.index = index;
|
||||
aigp->flags &= ~AIGF_DOCKER_NAME_VALID;
|
||||
aigp->flags |= AIGF_DOCKER_INDEX_VALID;
|
||||
}
|
||||
if ( aigp->flags & AIGF_DOCKEE_NAME_VALID ) {
|
||||
if (!(aigp->flags & AIGF_DOCKEE_INDEX_VALID)) {
|
||||
shipnum = ship_name_lookup(aigp->ship_name);
|
||||
if ( shipnum != -1 ) {
|
||||
strcpy(dockee_name, aigp->dockee.name);
|
||||
modelnum = Ships[shipnum].modelnum;
|
||||
index = model_find_dock_name_index(modelnum, aigp->dockee.name);
|
||||
aigp->dockee.index = index;
|
||||
aigp->flags &= ~AIGF_DOCKEE_NAME_VALID;
|
||||
aigp->flags |= AIGF_DOCKEE_INDEX_VALID;
|
||||
} else
|
||||
aigp->dockee.index = -1; // this will force code into if statement below making goal not achievable.
|
||||
}
|
||||
@@ -1767,56 +2002,78 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
return AI_GOAL_NOT_ACHIEVABLE;
|
||||
}
|
||||
|
||||
// we must also determine if this ship which is supposed to dock with something is currently
|
||||
// docked with something else. If so, then return the ON_HOLD until it is not docked anymore
|
||||
shipnum = ship_name_lookup(aigp->ship_name);
|
||||
Assert( shipnum != -1 );
|
||||
|
||||
// if ship is disabled, dont' know if it can dock or not
|
||||
// if ship is disabled, don't know if it can dock or not
|
||||
if ( Ships[objp->instance].flags & SF_DISABLED )
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
|
||||
// if the ship that I am supposed to dock with is docked with something else, then I need to put my
|
||||
// goal on hold
|
||||
// we must also determine if we're prevented from docking for any reason
|
||||
shipnum = ship_name_lookup(aigp->ship_name);
|
||||
Assert( shipnum != -1 );
|
||||
object *goal_objp = &Objects[Ships[shipnum].objnum];
|
||||
|
||||
// if the ship that I am supposed to dock with is docked with something else, then I need to put my goal on hold
|
||||
// [MK, 4/23/98: With Mark, we believe this fixes the problem of Comet refusing to warp out after docking with Omega.
|
||||
// This bug occurred only when mission goals were validated in the frame in which Comet docked, which happened about
|
||||
// once in 10-20 tries.]
|
||||
if ( Ai_info[Ships[shipnum].ai_index].ai_flags & AIF_DOCKED )
|
||||
if (aip->dock_objnum != Ships[shipnum].objnum)
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
|
||||
// if this ship is docked and needs to get docked with something else, then undock this
|
||||
// ship
|
||||
if ( aip->ai_flags & AIF_DOCKED ) {
|
||||
|
||||
// if we are trying to dock with a different ship, then force this ship to undock
|
||||
if ( aip->dock_objnum != Ships[shipnum].objnum ) {
|
||||
// if this goal isn't on hold yet, then issue the undock goal and return NOT_KNOWN
|
||||
// which will then place the goal on hold until the undocking is complete.
|
||||
if ( !(aigp->flags & AIGF_GOAL_ON_HOLD) )
|
||||
ai_add_goal_ship_internal( aip, AI_GOAL_UNDOCK, NULL, -1, -1, 0 );
|
||||
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
} else {
|
||||
// if this ship is already docked with the guy this order tells him to dock with,
|
||||
// then mark the goal as satisfied.
|
||||
// MWA 2/23/98 -- don't return anything. Since this item is a goal, the ai_dock code
|
||||
// should remove the goal!!!!
|
||||
//return AI_GOAL_SATISFIED;
|
||||
if ( object_is_docked(goal_objp) )
|
||||
{
|
||||
// if the dockpoint I need to dock to is occupied by someone other than me
|
||||
object *obstacle_objp = dock_find_object_at_dockpoint(goal_objp, aigp->dockee.index);
|
||||
if (obstacle_objp == NULL)
|
||||
{
|
||||
// nobody in the way... we're good
|
||||
}
|
||||
else if (obstacle_objp != objp)
|
||||
{
|
||||
// return NOT_KNOWN which will place the goal on hold until the dockpoint is clear
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
// if this ship is docked and needs to get docked with something else, then undock this ship
|
||||
if ( object_is_docked(objp) )
|
||||
{
|
||||
// if the dockpoint I need to dock with is occupied by someone other than the guy I need to dock to
|
||||
object *obstacle_objp = dock_find_object_at_dockpoint(objp, aigp->docker.index);
|
||||
if (obstacle_objp == NULL)
|
||||
{
|
||||
// nobody in the way... we're good
|
||||
}
|
||||
else if (obstacle_objp != goal_objp)
|
||||
{
|
||||
// if this goal isn't on hold yet, then issue the undock goal
|
||||
if ( !(aigp->flags & AIGF_GOAL_ON_HOLD) )
|
||||
ai_add_goal_ship_internal( aip, AI_GOAL_UNDOCK, Ships[obstacle_objp->instance].ship_name, -1, -1, 0 );
|
||||
|
||||
// return NOT_KNOWN which will place the goal on hold until the undocking is complete.
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
// Goober5000 - necessitated by the multiple ship docking
|
||||
} else if ( (aigp->ai_mode == AI_GOAL_UNDOCK) && (status == SHIP_STATUS_ARRIVED) ) {
|
||||
// Put this goal on hold if we're already undocking. Otherwise the new goal will pre-empt
|
||||
// the current goal and strange things might happen. One is that the object movement code
|
||||
// forgets the previous undocking and "re-docks" the previous goal's ship. Other problems
|
||||
// might happen too, so err on the safe side. (Yay for emergent paragraph justification!)
|
||||
if ((aip->mode == AIM_DOCK) && (aip->submode >= AIS_UNDOCK_0))
|
||||
{
|
||||
// only put it on hold if it's someone other than the guy we're undocking from right now!!
|
||||
if (aip->goal_objnum != Ships[ship_name_lookup(aigp->ship_name)].objnum)
|
||||
return AI_GOAL_NOT_KNOWN;
|
||||
}
|
||||
|
||||
} else if ( (aigp->ai_mode == AI_GOAL_DESTROY_SUBSYSTEM) && (status == SHIP_STATUS_ARRIVED) ) {
|
||||
// if the ship has arrived, and the goal is destroy subsystem, then check to see that we
|
||||
// have fixed up the subsystem name (of the subsystem to destroy) into an index into
|
||||
// the ship's subsystem list
|
||||
if ( aigp->flags & AIGF_SUBSYS_NAME_VALID ) {
|
||||
if ( aigp->flags & AIGF_SUBSYS_NEEDS_FIXUP ) {
|
||||
int shipnum;
|
||||
|
||||
shipnum = ship_name_lookup( aigp->ship_name );
|
||||
if ( shipnum != -1 ) {
|
||||
aigp->ai_submode = ship_get_subsys_index( &Ships[shipnum], aigp->docker.name );
|
||||
aigp->flags &= ~AIGF_SUBSYS_NAME_VALID;
|
||||
aigp->flags &= ~AIGF_SUBSYS_NEEDS_FIXUP;
|
||||
} else {
|
||||
Int3();
|
||||
return AI_GOAL_NOT_ACHIEVABLE; // force this goal to be invalid
|
||||
@@ -1847,6 +2104,7 @@ int ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
case AI_GOAL_IGNORE:
|
||||
case AI_GOAL_EVADE_SHIP:
|
||||
case AI_GOAL_STAY_NEAR_SHIP:
|
||||
case AI_GOAL_FLY_TO_SHIP:
|
||||
if ( status == SHIP_STATUS_ARRIVED )
|
||||
return AI_GOAL_ACHIEVABLE;
|
||||
else if ( status == SHIP_STATUS_NOT_ARRIVED )
|
||||
@@ -2022,7 +2280,7 @@ void validate_mission_goals(int objnum, ai_info *aip)
|
||||
|
||||
// if the active goal is a rearm/repair goal, the put all other valid goals (which are not repair goals)
|
||||
// on hold
|
||||
if ( (aip->goals[0].ai_mode == AI_GOAL_REARM_REPAIR) && (aip->ai_flags & AIF_DOCKED) ) {
|
||||
if ( (aip->goals[0].ai_mode == AI_GOAL_REARM_REPAIR) && object_is_docked(&Objects[objnum]) ) {
|
||||
for ( i = 1; i < MAX_AI_GOALS; i++ ) {
|
||||
if ( (aip->goals[i].ai_mode == AI_GOAL_NONE) || (aip->goals[i].ai_mode == AI_GOAL_REARM_REPAIR) )
|
||||
continue;
|
||||
@@ -2032,6 +2290,7 @@ void validate_mission_goals(int objnum, ai_info *aip)
|
||||
}
|
||||
|
||||
//XSTR:OFF
|
||||
/*
|
||||
static char *Goal_text[5] = {
|
||||
"EVENT_SHIP",
|
||||
"EVENT_WING",
|
||||
@@ -2039,6 +2298,7 @@ static char *Goal_text[5] = {
|
||||
"PLAYER_WING",
|
||||
"DYNAMIC",
|
||||
};
|
||||
*/
|
||||
//XSTR:ON
|
||||
|
||||
extern char *Mode_text[MAX_AI_BEHAVIORS];
|
||||
@@ -2116,10 +2376,13 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
|
||||
// Goober5000 - we may want to use AI for the player
|
||||
// AL 3-7-98: If this is a player ship, and the goal is not a formation goal, then do a quick out
|
||||
if ( !(Player_use_ai) && (objp->flags & OF_PLAYER_SHIP) && (current_goal->ai_mode != AI_GOAL_FORM_ON_WING) ) {
|
||||
if ( !(Player_use_ai) && (objp->flags & OF_PLAYER_SHIP) && (current_goal->ai_mode != AI_GOAL_FORM_ON_WING) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch ( current_goal->ai_mode ) {
|
||||
|
||||
case AI_GOAL_CHASE:
|
||||
@@ -2173,6 +2436,12 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
break;
|
||||
}
|
||||
|
||||
case AI_GOAL_FLY_TO_SHIP:
|
||||
shipnum = ship_name_lookup( current_goal->ship_name );
|
||||
Assert (shipnum != -1 ); // shouldn't get here if this is false!!!!
|
||||
ai_start_fly_to_ship(objp, shipnum);
|
||||
break;
|
||||
|
||||
case AI_GOAL_DOCK: {
|
||||
shipnum = ship_name_lookup( current_goal->ship_name );
|
||||
Assert (shipnum != -1 ); // shouldn't get here if this is false!!!!
|
||||
@@ -2180,10 +2449,8 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
|
||||
// be sure that we have indices for docking points here! If we ever had names, they should
|
||||
// get fixed up in goal_achievable so that the points can be checked there for validity
|
||||
Assert ( !(current_goal->flags & AIGF_DOCKER_NAME_VALID) );
|
||||
Assert ( !(current_goal->flags & AIGF_DOCKEE_NAME_VALID) );
|
||||
ai_dock_with_object( objp, other_obj, current_goal->priority, AIDO_DOCK, current_goal->docker.index, current_goal->dockee.index );
|
||||
aip->submode_start_time = Missiontime;
|
||||
Assert (current_goal->flags & AIGF_DOCK_INDEXES_VALID);
|
||||
ai_dock_with_object( objp, current_goal->docker.index, other_obj, current_goal->dockee.index, current_goal->priority, AIDO_DOCK );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2191,7 +2458,42 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
// try to find the object which which this object is docked with. Use that object as the
|
||||
// "other object" for the undocking proceedure. If "other object" isn't found, then the undock
|
||||
// goal cannot continue. Spit out a warning and remove the goal.
|
||||
other_obj = ai_find_docked_object( objp );
|
||||
|
||||
// Goober5000 - do we have a specific ship to undock from?
|
||||
if ( current_goal->ship_name != NULL )
|
||||
{
|
||||
shipnum = ship_name_lookup( current_goal->ship_name );
|
||||
|
||||
// hmm, perhaps he was destroyed
|
||||
if (shipnum == -1)
|
||||
{
|
||||
other_obj = NULL;
|
||||
}
|
||||
// he exists... let's undock from him
|
||||
else
|
||||
{
|
||||
other_obj = &Objects[Ships[shipnum].objnum];
|
||||
}
|
||||
}
|
||||
// no specific ship
|
||||
else
|
||||
{
|
||||
// are we docked?
|
||||
if (object_is_docked(objp))
|
||||
{
|
||||
// just pick the first guy we're docked to
|
||||
other_obj = dock_get_first_docked_object( objp );
|
||||
|
||||
// and add the ship name so it displays on the HUD
|
||||
current_goal->ship_name = Ships[other_obj->instance].ship_name;
|
||||
}
|
||||
// hmm, nobody exists that we can undock from
|
||||
else
|
||||
{
|
||||
other_obj = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( other_obj == NULL ) {
|
||||
//Int3();
|
||||
// assume that the guy he was docked with doesn't exist anymore. (i.e. a cargo containuer
|
||||
@@ -2200,8 +2502,18 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
ai_mission_goal_complete( aip ); // mark as complete, so we can remove it and move on!!!
|
||||
break;
|
||||
}
|
||||
ai_dock_with_object( objp, other_obj, current_goal->priority, AIDO_UNDOCK, 0, 0 );
|
||||
aip->submode_start_time = Missiontime;
|
||||
|
||||
// Goober5000 - Sometimes a ship will be assigned a new goal before it can finish undocking. Later,
|
||||
// when the ship returns to this goal, it will try to resume undocking from a ship it's not attached
|
||||
// to. If this happens, remove the goal as above.
|
||||
if (!dock_check_find_direct_docked_object(objp, other_obj))
|
||||
{
|
||||
ai_mission_goal_complete( aip );
|
||||
break;
|
||||
}
|
||||
|
||||
// passing 0, 0 is okay because the undock code will figure out where to undock from
|
||||
ai_dock_with_object( objp, 0, other_obj, 0, current_goal->priority, AIDO_UNDOCK );
|
||||
break;
|
||||
|
||||
|
||||
@@ -2274,6 +2586,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
ai_clear_ship_goals( aip );
|
||||
aip->mode = AIM_PLAY_DEAD;
|
||||
aip->submode = -1;
|
||||
aip->submode_start_time = Missiontime;
|
||||
break;
|
||||
|
||||
case AI_GOAL_FORM_ON_WING:
|
||||
@@ -2307,7 +2620,7 @@ void ai_process_mission_orders( int objnum, ai_info *aip )
|
||||
case AI_GOAL_REARM_REPAIR:
|
||||
shipnum = ship_name_lookup( current_goal->ship_name );
|
||||
other_obj = &Objects[Ships[shipnum].objnum];
|
||||
ai_rearm_repair( objp, other_obj, current_goal->priority, current_goal->docker.index, current_goal->dockee.index );
|
||||
ai_rearm_repair( objp, current_goal->docker.index, other_obj, current_goal->dockee.index, current_goal->priority );
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -9,13 +9,26 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Ship/AiGoals.h $
|
||||
* $Revision: 2.4 $
|
||||
* $Date: 2004-03-05 09:01:52 $
|
||||
* $Revision: 1.2 $
|
||||
* $Date: 2005-07-13 02:50:48 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* <insert description of file here>
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.1 2005/03/25 06:45:13 wmcoolmon
|
||||
* Initial AI code move commit - note that aigoals.cpp has some escape characters in it, I'm not sure if this is really a problem.
|
||||
*
|
||||
* Revision 2.6 2004/08/11 05:06:34 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.5 2004/07/25 00:31:31 Kazan
|
||||
* i have absolutely nothing to say about that subject
|
||||
*
|
||||
* Revision 2.4 2004/03/05 09:01:52 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.3 2003/01/07 20:06:44 Goober5000
|
||||
* added ai-chase-any-except sexp
|
||||
* --Goober5000
|
||||
@@ -192,6 +205,7 @@ struct ai_goal;
|
||||
#define AI_GOAL_PLAY_DEAD (1<<21)
|
||||
#define AI_GOAL_CHASE_WEAPON (1<<22)
|
||||
|
||||
|
||||
// Goober5000: new goals go here
|
||||
|
||||
// Goober5000: this new goal is special: it doesn't take the usual kind of argument; it takes
|
||||
@@ -201,22 +215,24 @@ struct ai_goal;
|
||||
// can only be specified through a sexp.
|
||||
#define AI_GOAL_CHASE_ANY_EXCEPT (1<<23) // hey Hoffoss! I added a new goal! :p
|
||||
|
||||
#define AI_GOAL_FLY_TO_SHIP (1<<24) // kazan
|
||||
|
||||
// now the masks for ship types
|
||||
|
||||
// Goober5000: added AI_GOAL_STAY_NEAR_SHIP and AI_GOAL_KEEP_SAFE_DISTANCE as valid for fighters
|
||||
#define AI_GOAL_ACCEPT_FIGHTER ( AI_GOAL_CHASE | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_DESTROY_SUBSYSTEM | AI_GOAL_CHASE_WING | AI_GOAL_GUARD | AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP | AI_GOAL_CHASE_ANY | AI_GOAL_IGNORE | AI_GOAL_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_CHASE_ANY_EXCEPT )
|
||||
#define AI_GOAL_ACCEPT_BOMBER ( AI_GOAL_ACCEPT_FIGHTER )
|
||||
#define AI_GOAL_ACCEPT_STEALTH ( AI_GOAL_ACCEPT_FIGHTER )
|
||||
#define AI_GOAL_ACCEPT_TRANSPORT ( AI_GOAL_CHASE | AI_GOAL_CHASE_WING | AI_GOAL_DOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_UNDOCK | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
|
||||
#define AI_GOAL_ACCEPT_FREIGHTER ( AI_GOAL_ACCEPT_TRANSPORT )
|
||||
#define AI_GOAL_ACCEPT_CRUISER ( AI_GOAL_ACCEPT_FREIGHTER )
|
||||
#define AI_GOAL_ACCEPT_CORVETTE ( AI_GOAL_ACCEPT_CRUISER )
|
||||
#define AI_GOAL_ACCEPT_GAS_MINER ( AI_GOAL_ACCEPT_CRUISER )
|
||||
#define AI_GOAL_ACCEPT_AWACS ( AI_GOAL_ACCEPT_CRUISER )
|
||||
#define AI_GOAL_ACCEPT_CAPITAL ( AI_GOAL_ACCEPT_CRUISER & ~(AI_GOAL_DOCK | AI_GOAL_UNDOCK) )
|
||||
#define AI_GOAL_ACCEPT_SUPERCAP ( AI_GOAL_ACCEPT_CAPITAL )
|
||||
#define AI_GOAL_ACCEPT_SUPPORT ( AI_GOAL_DOCK | AI_GOAL_UNDOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
|
||||
#define AI_GOAL_ACCEPT_ESCAPEPOD ( AI_GOAL_ACCEPT_TRANSPORT )
|
||||
#define AI_GOAL_ACCEPT_FIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_DESTROY_SUBSYSTEM | AI_GOAL_CHASE_WING | AI_GOAL_GUARD | AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP | AI_GOAL_CHASE_ANY | AI_GOAL_IGNORE | AI_GOAL_GUARD_WING | AI_GOAL_EVADE_SHIP | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_CHASE_ANY_EXCEPT )
|
||||
#define AI_GOAL_ACCEPT_BOMBER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_STEALTH ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FIGHTER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_TRANSPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_CHASE | AI_GOAL_CHASE_WING | AI_GOAL_DOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_WARP | AI_GOAL_UNDOCK | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD| AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_FREIGHTER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_CRUISER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_FREIGHTER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_CORVETTE ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_GAS_MINER ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_AWACS ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_CAPITAL ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CRUISER & ~(AI_GOAL_DOCK | AI_GOAL_UNDOCK) | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_SUPERCAP ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_CAPITAL | AI_GOAL_STAY_NEAR_SHIP )
|
||||
#define AI_GOAL_ACCEPT_SUPPORT ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_DOCK | AI_GOAL_UNDOCK | AI_GOAL_WAYPOINTS | AI_GOAL_WAYPOINTS_ONCE | AI_GOAL_STAY_NEAR_SHIP | AI_GOAL_KEEP_SAFE_DISTANCE | AI_GOAL_STAY_STILL | AI_GOAL_PLAY_DEAD)
|
||||
#define AI_GOAL_ACCEPT_ESCAPEPOD ( AI_GOAL_FLY_TO_SHIP | AI_GOAL_ACCEPT_TRANSPORT| AI_GOAL_STAY_NEAR_SHIP )
|
||||
|
||||
#define MAX_AI_DOCK_NAMES 25
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
||||
*
|
||||
* All source code herein is the property of Volition, Inc. You may not sell
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _AIINTERNAL_H
|
||||
#define _AIINTERNAL_H
|
||||
|
||||
//Returns the enemy team mask for the specified subobject
|
||||
int get_enemy_team_mask(int objnum);
|
||||
|
||||
//Returns true if the specified object is a stealth ship, false if not
|
||||
bool is_object_stealth_ship(object* objp);
|
||||
|
||||
//Number of live turrets on the object attacking
|
||||
int num_turrets_attacking(object *turret_parent, int target_objnum);
|
||||
|
||||
//Determine whether an object is targetable within a nebula (checks for stealth)
|
||||
int object_is_targetable(object *target, ship *viewer);
|
||||
|
||||
//Returns the number of enemy fighters within threshold of pos.
|
||||
int num_nearby_fighters(int enemy_team_mask, vec3d *pos, float threshold);
|
||||
|
||||
//Returns true if OK for *aip to fire its current weapon at its current target.
|
||||
int check_ok_to_fire(int objnum, int target_objnum, weapon_info *wip);
|
||||
|
||||
//Does all the stuff needed to aim and fire a turret.
|
||||
void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum);
|
||||
|
||||
#endif
|
||||
File renamed without changes.
File diff suppressed because it is too large.
Load diff
@@ -9,13 +9,45 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Anim/AnimPlay.cpp $
|
||||
* $Revision: 2.8 $
|
||||
* $Date: 2004-03-05 09:01:52 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 2.17 $
|
||||
* $Date: 2005-05-28 19:40:59 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* C module for playing back anim files
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.16 2005/05/23 05:58:31 taylor
|
||||
* quick catch for some corrupted anis, only a partial fix but it will do until something
|
||||
* a bit more heavy duty comes along in the near future
|
||||
*
|
||||
* Revision 2.15 2005/05/12 17:49:10 taylor
|
||||
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
|
||||
* fixes various problems and is past time to make the switch
|
||||
*
|
||||
* Revision 2.14 2005/01/30 12:50:08 taylor
|
||||
* merge with Linux/OSX tree - p0130
|
||||
*
|
||||
* Revision 2.13 2004/12/20 20:18:30 fryday
|
||||
* Commented out ATL dependencies (And changed one macro to an swprintf instead)
|
||||
* Tiny change in animplay ( pow(2.0, ...) instead of pow(2, ...)) because VS2K5
|
||||
* throws an ambiguity error over that.
|
||||
*
|
||||
* Revision 2.12 2004/10/09 17:58:48 taylor
|
||||
* one more try to fix the memory leak and end-of-mission crash for talking head anis
|
||||
*
|
||||
* Revision 2.11 2004/07/26 20:47:23 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.10 2004/07/17 18:46:06 taylor
|
||||
* various OGL and memory leak fixes
|
||||
*
|
||||
* Revision 2.9 2004/07/12 16:32:41 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.8 2004/03/05 09:01:52 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.7 2004/02/16 11:47:31 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
@@ -249,6 +281,8 @@
|
||||
#include "cfile/cfile.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
|
||||
|
||||
static color Color_xparent;
|
||||
|
||||
anim *first_anim = NULL;
|
||||
@@ -420,7 +454,7 @@ anim_instance *anim_play(anim_play_struct *aps)
|
||||
if ( anim_instance_is_streamed(instance) ) {
|
||||
instance->file_offset = instance->parent->file_offset;
|
||||
}
|
||||
instance->frame = (ubyte *) malloc(instance->parent->width * instance->parent->height * 2);
|
||||
instance->frame = (ubyte *) vm_malloc(instance->parent->width * instance->parent->height * 2);
|
||||
Assert( instance->frame != NULL );
|
||||
instance->time_elapsed = 0.0f;
|
||||
instance->stop_at = aps->stop_at;
|
||||
@@ -668,7 +702,7 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
|
||||
}
|
||||
|
||||
ubyte *temp = NULL;
|
||||
int temp_file_offset = 0;
|
||||
int temp_file_offset = -1;
|
||||
|
||||
// if we're using bitmap polys
|
||||
BM_SELECT_TEX_FORMAT();
|
||||
@@ -690,6 +724,14 @@ int anim_show_next_frame(anim_instance *instance, float frametime)
|
||||
// always go back to screen format
|
||||
BM_SELECT_SCREEN_FORMAT();
|
||||
|
||||
// see if we had an error during decode (corrupted anim stream)
|
||||
if ( (temp == NULL) && (temp_file_offset < 0) ) {
|
||||
mprintf(("ANI: Fatal ERROR at frame %i!! Aborting playback of \"%s\"...\n", instance->frame_num, instance->parent->name));
|
||||
|
||||
// return -1 to end all playing of this anim instanc
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(instance->direction == ANIM_DIRECT_FORWARD){
|
||||
if ( anim_instance_is_streamed(instance) ) {
|
||||
instance->file_offset = temp_file_offset;
|
||||
@@ -791,8 +833,10 @@ int anim_stop_playing(anim_instance* instance)
|
||||
void anim_release_render_instance(anim_instance* instance)
|
||||
{
|
||||
Assert( instance != NULL );
|
||||
Assert(instance->frame);
|
||||
free(instance->frame);
|
||||
|
||||
if (instance->frame != NULL)
|
||||
vm_free(instance->frame);
|
||||
|
||||
instance->frame = NULL;
|
||||
instance->parent->instance_count--;
|
||||
|
||||
@@ -901,7 +945,7 @@ void anim_read_header(anim *ptr, CFILE *fp)
|
||||
floor_pow++;
|
||||
}
|
||||
|
||||
int floor_size = (int) pow(2, floor_pow);
|
||||
int floor_size = (int) pow(2.0, floor_pow);
|
||||
int diff = ptr->height - floor_size;
|
||||
float waste = 100.0f * float((floor_size - diff))/(2.0f *(float)floor_size);
|
||||
|
||||
@@ -914,6 +958,7 @@ void anim_read_header(anim *ptr, CFILE *fp)
|
||||
|
||||
ptr->total_frames = cfread_short(fp);
|
||||
cfread(&ptr->packer_code, 1, 1, fp);
|
||||
ptr->packer_code = INTEL_SHORT(ptr->packer_code);
|
||||
cfread(&ptr->palette, 256, 3, fp);
|
||||
ptr->num_keys = cfread_short(fp);
|
||||
|
||||
@@ -974,7 +1019,7 @@ anim *anim_load(char *real_filename, int file_mapped)
|
||||
if ( !fp )
|
||||
return NULL;
|
||||
|
||||
ptr = (anim *) malloc(sizeof(anim));
|
||||
ptr = (anim *) vm_malloc(sizeof(anim));
|
||||
Assert(ptr);
|
||||
|
||||
ptr->flags = 0;
|
||||
@@ -992,7 +1037,7 @@ anim *anim_load(char *real_filename, int file_mapped)
|
||||
anim_read_header(ptr, fp);
|
||||
|
||||
if(ptr->num_keys > 0){
|
||||
ptr->keys = (key_frame*)malloc(sizeof(key_frame) * ptr->num_keys);
|
||||
ptr->keys = (key_frame*)vm_malloc(sizeof(key_frame) * ptr->num_keys);
|
||||
Assert(ptr->keys != NULL);
|
||||
}
|
||||
|
||||
@@ -1003,12 +1048,14 @@ anim *anim_load(char *real_filename, int file_mapped)
|
||||
ptr->keys[idx].frame_num = 0;
|
||||
cfread(&ptr->keys[idx].frame_num, 2, 1, fp);
|
||||
cfread(&ptr->keys[idx].offset, 4, 1, fp);
|
||||
ptr->keys[idx].frame_num = INTEL_INT( ptr->keys[idx].frame_num );
|
||||
ptr->keys[idx].offset = INTEL_INT( ptr->keys[idx].offset );
|
||||
}
|
||||
|
||||
/*prev_keyp = &ptr->keys;
|
||||
count = ptr->num_keys;
|
||||
while (count--) {
|
||||
keyp = (key_frame *) malloc(sizeof(key_frame));
|
||||
keyp = (key_frame *) vm_malloc(sizeof(key_frame));
|
||||
keyp->next = *prev_keyp;
|
||||
*prev_keyp = keyp;
|
||||
prev_keyp = &keyp->next;
|
||||
@@ -1018,6 +1065,7 @@ anim *anim_load(char *real_filename, int file_mapped)
|
||||
cfread(&keyp->offset, 4, 1, fp);
|
||||
}*/
|
||||
cfread(&count, 4, 1, fp); // size of compressed data
|
||||
count = INTEL_INT( count );
|
||||
|
||||
ptr->cfile_ptr = NULL;
|
||||
|
||||
@@ -1048,7 +1096,7 @@ anim *anim_load(char *real_filename, int file_mapped)
|
||||
if ( ptr->flags & ANF_STREAMED ) {
|
||||
ptr->data = NULL;
|
||||
ptr->cache_file_offset = ptr->file_offset;
|
||||
ptr->cache = (ubyte*)malloc(ANI_STREAM_CACHE_SIZE+2);
|
||||
ptr->cache = (ubyte*)vm_malloc(ANI_STREAM_CACHE_SIZE+2);
|
||||
Assert(ptr->cache);
|
||||
cfseek(ptr->cfile_ptr, offset, CF_SEEK_SET);
|
||||
cfread(ptr->cache, ANI_STREAM_CACHE_SIZE, 1, ptr->cfile_ptr);
|
||||
@@ -1059,7 +1107,7 @@ anim *anim_load(char *real_filename, int file_mapped)
|
||||
// Not a memory mapped file (or streamed)
|
||||
ptr->flags &= ~ANF_MEM_MAPPED;
|
||||
ptr->flags &= ~ANF_STREAMED;
|
||||
ptr->data = (ubyte *) malloc(count);
|
||||
ptr->data = (ubyte *) vm_malloc(count);
|
||||
ptr->file_offset = -1;
|
||||
cfread(ptr->data, count, 1, fp);
|
||||
}
|
||||
@@ -1095,7 +1143,7 @@ int anim_free(anim *ptr)
|
||||
}
|
||||
|
||||
if ( !list )
|
||||
return -1;
|
||||
return -2;
|
||||
|
||||
// only free when ref_count is 0
|
||||
ptr->ref_count--;
|
||||
@@ -1107,23 +1155,27 @@ int anim_free(anim *ptr)
|
||||
return -1;
|
||||
|
||||
if(ptr->keys != NULL){
|
||||
free(ptr->keys);
|
||||
vm_free(ptr->keys);
|
||||
ptr->keys = NULL;
|
||||
}
|
||||
|
||||
if ( ptr->flags & (ANF_MEM_MAPPED|ANF_STREAMED) ) {
|
||||
cfclose(ptr->cfile_ptr);
|
||||
if ( ptr->cache ) {
|
||||
free(ptr->cache);
|
||||
vm_free(ptr->cache);
|
||||
ptr->cache = NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Assert(ptr->data);
|
||||
free(ptr->data);
|
||||
if ( ptr->data ) {
|
||||
vm_free(ptr->data);
|
||||
ptr->data = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
*prev_anim = ptr->next;
|
||||
free(ptr);
|
||||
vm_free(ptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1191,7 +1243,7 @@ int anim_write_frames_out(char *filename)
|
||||
|
||||
ai = init_anim_instance(source_anim, 16);
|
||||
|
||||
row_data = (ubyte**)malloc((source_anim->height+1) * 4);
|
||||
row_data = (ubyte**)vm_malloc((source_anim->height+1) * 4);
|
||||
|
||||
for ( i = 0; i < source_anim->total_frames; i++ ) {
|
||||
anim_get_next_raw_buffer(ai, 0, 0, 16);
|
||||
@@ -1214,7 +1266,7 @@ int anim_write_frames_out(char *filename)
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
free(row_data);
|
||||
vm_free(row_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1247,7 +1299,7 @@ void anim_display_info(char *real_filename)
|
||||
|
||||
anim_read_header(&A, fp);
|
||||
// read the keyframe frame nums and offsets
|
||||
key_frame_nums = (int*)malloc(sizeof(int)*A.num_keys);
|
||||
key_frame_nums = (int*)vm_malloc(sizeof(int)*A.num_keys);
|
||||
Assert(key_frame_nums != NULL);
|
||||
for ( i = 0; i < A.num_keys; i++ ) {
|
||||
key_frame_nums[i] = 0;
|
||||
@@ -1288,7 +1340,7 @@ void anim_display_info(char *real_filename)
|
||||
printf("ac version: %d\n", A.version);
|
||||
|
||||
if ( key_frame_nums != NULL ) {
|
||||
free(key_frame_nums);
|
||||
vm_free(key_frame_nums);
|
||||
}
|
||||
|
||||
cfclose(fp);
|
||||
|
||||
@@ -9,13 +9,24 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Anim/AnimPlay.h $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2003-12-08 22:30:02 $
|
||||
* $Author: randomtiger $
|
||||
* $Revision: 2.6 $
|
||||
* $Date: 2005-07-13 02:50:48 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Header file for playing back anim files
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.5 2005/04/05 05:53:14 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.4 2004/08/11 05:06:18 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.3 2003/12/08 22:30:02 randomtiger
|
||||
* Put render state and other direct D3D calls repetition check back in, provides speed boost.
|
||||
* Fixed bug that caused fullscreen only crash with DXT textures
|
||||
* Put dithering back in for tgas and jpgs
|
||||
*
|
||||
* Revision 2.2 2003/11/11 02:15:41 Goober5000
|
||||
* ubercommit - basically spelling and language fixes with some additional
|
||||
* warnings disabled
|
||||
@@ -125,7 +136,7 @@ typedef struct {
|
||||
int start_at;
|
||||
int stop_at;
|
||||
int screen_id;
|
||||
vector *world_pos;
|
||||
vec3d *world_pos;
|
||||
float radius;
|
||||
int framerate_independent;
|
||||
void *color;
|
||||
|
||||
@@ -9,15 +9,33 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Anim/PackUnpack.cpp $
|
||||
* $Revision: 2.5 $
|
||||
* $Date: 2004-03-05 09:01:53 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 2.10 $
|
||||
* $Date: 2005-05-24 03:13:36 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Code for handling packing and unpacking in Hoffoss's RLE format, used for
|
||||
* Anim files. Also handles Anim loading, creating Anim instances (for
|
||||
* utilizing an Anim), and getting getting frames of the Anim.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.9 2005/05/23 05:58:31 taylor
|
||||
* quick catch for some corrupted anis, only a partial fix but it will do until something
|
||||
* a bit more heavy duty comes along in the near future
|
||||
*
|
||||
* Revision 2.8 2005/05/12 17:49:10 taylor
|
||||
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
|
||||
* fixes various problems and is past time to make the switch
|
||||
*
|
||||
* Revision 2.7 2004/07/26 20:47:23 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.6 2004/07/12 16:32:41 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.5 2004/03/05 09:01:53 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.4 2004/02/14 00:18:29 randomtiger
|
||||
* Please note that from now on OGL will only run with a registry set by Launcher v4. See forum for details.
|
||||
* OK, these changes effect a lot of file, I suggest everyone updates ASAP:
|
||||
@@ -194,6 +212,9 @@
|
||||
#include "graphics/2d.h"
|
||||
#include "anim/animplay.h"
|
||||
|
||||
|
||||
|
||||
|
||||
int packer_code = PACKER_CODE;
|
||||
int transparent_code = 254;
|
||||
|
||||
@@ -226,7 +247,7 @@ anim_instance *init_anim_instance(anim *ptr, int bpp)
|
||||
}
|
||||
|
||||
ptr->instance_count++;
|
||||
inst = (anim_instance *) malloc(sizeof(anim_instance));
|
||||
inst = (anim_instance *) vm_malloc(sizeof(anim_instance));
|
||||
Assert(inst);
|
||||
inst->frame_num = -1;
|
||||
inst->last_frame_num = -1;
|
||||
@@ -237,9 +258,9 @@ anim_instance *init_anim_instance(anim *ptr, int bpp)
|
||||
inst->aa_color = NULL;
|
||||
|
||||
if(bpp == 16){
|
||||
inst->frame = (ubyte *) malloc(inst->parent->width * inst->parent->height * 2);
|
||||
inst->frame = (ubyte *) vm_malloc(inst->parent->width * inst->parent->height * 2);
|
||||
} else {
|
||||
inst->frame = (ubyte *) malloc(inst->parent->width * inst->parent->height);
|
||||
inst->frame = (ubyte *) vm_malloc(inst->parent->width * inst->parent->height);
|
||||
}
|
||||
return inst;
|
||||
}
|
||||
@@ -247,14 +268,14 @@ anim_instance *init_anim_instance(anim *ptr, int bpp)
|
||||
void free_anim_instance(anim_instance *inst)
|
||||
{
|
||||
Assert(inst->frame);
|
||||
free(inst->frame);
|
||||
vm_free(inst->frame);
|
||||
inst->frame = NULL;
|
||||
inst->parent->instance_count--;
|
||||
inst->parent = NULL;
|
||||
inst->data = NULL;
|
||||
inst->file_offset = -1;
|
||||
|
||||
free(inst);
|
||||
vm_free(inst);
|
||||
}
|
||||
|
||||
int anim_get_next_frame(anim_instance *inst)
|
||||
@@ -995,6 +1016,9 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte
|
||||
count = value & (~STD_RLE_CODE);
|
||||
value = *ptr++;
|
||||
|
||||
if (count > size)
|
||||
count = size;
|
||||
|
||||
size -= count;
|
||||
Assert(size >= 0);
|
||||
|
||||
@@ -1081,6 +1105,9 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte
|
||||
count = value & (~STD_RLE_CODE);
|
||||
value = *ptr++;
|
||||
|
||||
if (count > size)
|
||||
count = size;
|
||||
|
||||
size -= count;
|
||||
Assert(size >= 0);
|
||||
|
||||
@@ -1099,7 +1126,8 @@ ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte
|
||||
}
|
||||
}
|
||||
else {
|
||||
Assert(0); // unknown packing method
|
||||
// Assert(0); // unknown packing method
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
@@ -1181,6 +1209,9 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal
|
||||
value = anim_instance_get_byte(ai,offset);
|
||||
offset++;
|
||||
|
||||
if (count > size)
|
||||
count = size;
|
||||
|
||||
size -= count;
|
||||
Assert(size >= 0);
|
||||
|
||||
@@ -1271,6 +1302,9 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal
|
||||
value = anim_instance_get_byte(ai,offset);
|
||||
offset++;
|
||||
|
||||
if (count > size)
|
||||
count = size;
|
||||
|
||||
size -= count;
|
||||
Assert(size >= 0);
|
||||
|
||||
@@ -1289,7 +1323,8 @@ int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal
|
||||
}
|
||||
}
|
||||
else {
|
||||
Int3(); // unknown packing method
|
||||
// Int3(); // unknown packing method
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ai->file_offset + offset;
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Anim/PackUnpack.h $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2004-03-05 09:01:53 $
|
||||
* $Revision: 2.5 $
|
||||
* $Date: 2005-07-13 02:50:48 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Code for handling packing and unpacking in Hoffoss's RLE format, used for
|
||||
@@ -18,6 +18,16 @@
|
||||
* utilizing an Anim), and getting getting frames of the Anim.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.4 2005/04/05 05:53:14 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.3 2004/08/11 05:06:18 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.2 2004/03/05 09:01:53 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.1 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
@@ -213,7 +223,7 @@ typedef struct anim {
|
||||
typedef struct anim_instance {
|
||||
anim_instance *next, *prev;
|
||||
int x,y; // coordinates anim is played at (top left corner of anim)
|
||||
vector *world_pos; // world (x,y,z) position of explosion
|
||||
vec3d *world_pos; // world (x,y,z) position of explosion
|
||||
float radius; // radius of image, needed for scaling
|
||||
int frame_num; // current frame, or last frame if between frames (first frame is 0)
|
||||
int last_frame_num;// last frame rendered
|
||||
|
||||
@@ -9,13 +9,57 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Asteroid/Asteroid.cpp $
|
||||
* $Revision: 2.7 $
|
||||
* $Date: 2004-03-31 05:42:25 $
|
||||
* $Revision: 2.20 $
|
||||
* $Date: 2005-07-22 10:18:36 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C module for asteroid code
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.19 2005/07/13 02:50:48 Goober5000
|
||||
* remove PreProcDefine #includes in FS2
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.18 2005/07/13 02:01:28 Goober5000
|
||||
* fixed a bunch of "issues" caused by me with the species stuff
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.17 2005/07/13 00:44:20 Goober5000
|
||||
* improved species support and removed need for #define
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.16 2005/06/01 09:34:59 taylor
|
||||
* newline fix
|
||||
*
|
||||
* Revision 2.15 2005/04/28 05:29:28 wmcoolmon
|
||||
* Removed FS2_DEMO defines that looked like they wouldn't cause the universe to collapse
|
||||
*
|
||||
* Revision 2.14 2005/04/28 01:32:57 wmcoolmon
|
||||
* Switch stuff_string_white to stuff_string (I don't see why _white was used in the first place)
|
||||
*
|
||||
* Revision 2.13 2005/04/15 11:41:28 taylor
|
||||
* stupid <expletive-delete> terminal, I <expletive-deleted> <expletive-deleted>!!!
|
||||
*
|
||||
* Revision 2.12 2005/04/15 11:36:55 taylor
|
||||
* new GCC = new warning messages, yippeeee!!
|
||||
*
|
||||
* Revision 2.11 2005/04/05 05:53:14 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.10 2005/03/02 21:24:43 taylor
|
||||
* more network/inferno goodness for Windows, takes care of a few warnings too
|
||||
*
|
||||
* Revision 2.9 2004/07/26 20:47:23 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.8 2004/07/12 16:32:41 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.7 2004/03/31 05:42:25 Goober5000
|
||||
* got rid of all those nasty warnings from xlocale and so forth; also added comments
|
||||
* for #pragma warning disable to indicate the message being disabled
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.6 2004/03/05 09:01:53 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
@@ -294,6 +338,7 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "object/object.h"
|
||||
#include "object/objcollide.h"
|
||||
@@ -325,59 +370,15 @@
|
||||
#include "network/multi.h"
|
||||
#endif
|
||||
|
||||
#ifndef FS2_DEMO
|
||||
|
||||
//WMC - we want asteroid ability with demo!!
|
||||
//#ifndef FS2_DEMO
|
||||
|
||||
#define ASTEROID_OBJ_USED (1<<0) // flag used in asteroid_obj struct
|
||||
#define MAX_ASTEROID_OBJS MAX_ASTEROIDS // max number of asteroids tracked in asteroid list
|
||||
asteroid_obj Asteroid_objs[MAX_ASTEROID_OBJS]; // array used to store asteroid object indexes
|
||||
asteroid_obj Asteroid_obj_list; // head of linked list of asteroid_obj structs
|
||||
|
||||
// Asteroid editor requires first set of entries to be "None" and then "Asteroid XXX"
|
||||
// Any changes to this will require changes to the asteroid editor
|
||||
debris_struct Field_debris_info[] = {
|
||||
-1, "None",
|
||||
ASTEROID_TYPE_SMALL, "Asteroid Small",
|
||||
ASTEROID_TYPE_MEDIUM, "Asteroid Medium",
|
||||
ASTEROID_TYPE_BIG, "Asteroid Large",
|
||||
|
||||
DEBRIS_TERRAN_SMALL, "Terran Small",
|
||||
DEBRIS_TERRAN_MEDIUM, "Terran Medium",
|
||||
DEBRIS_TERRAN_LARGE, "Terran Large",
|
||||
|
||||
DEBRIS_VASUDAN_SMALL, "Vasudan Small",
|
||||
DEBRIS_VASUDAN_MEDIUM, "Vasudan Medium",
|
||||
DEBRIS_VASUDAN_LARGE, "Vasudan Large",
|
||||
|
||||
DEBRIS_SHIVAN_SMALL, "Shivan Small",
|
||||
DEBRIS_SHIVAN_MEDIUM, "Shivan Medium",
|
||||
|
||||
#if !defined(MORE_SPECIES)
|
||||
DEBRIS_SHIVAN_LARGE, "Shivan Large"
|
||||
#else
|
||||
DEBRIS_SHIVAN_LARGE, "Shivan Large",
|
||||
|
||||
DEBRIS_ANCIENT_SMALL, "Ancient Small",
|
||||
DEBRIS_ANCIENT_MEDIUM, "Ancient Medium",
|
||||
DEBRIS_ANCIENT_LARGE, "Ancient Large",
|
||||
|
||||
DEBRIS_USER1_SMALL, "User1 Small",
|
||||
DEBRIS_USER1_MEDIUM, "User1 Medium",
|
||||
DEBRIS_USER1_LARGE, "User1 Large",
|
||||
|
||||
DEBRIS_USER2_SMALL, "User2 Small",
|
||||
DEBRIS_USER2_MEDIUM, "User2 Medium",
|
||||
DEBRIS_USER2_LARGE, "User2 Large",
|
||||
|
||||
DEBRIS_USER3_SMALL, "User3 Small",
|
||||
DEBRIS_USER3_MEDIUM, "User3 Medium",
|
||||
DEBRIS_USER3_LARGE, "User3 Large",
|
||||
|
||||
DEBRIS_USER4_SMALL, "User4 Small",
|
||||
DEBRIS_USER4_MEDIUM, "User4 Medium",
|
||||
DEBRIS_USER4_LARGE, "User4 Large",
|
||||
#endif
|
||||
};
|
||||
|
||||
// used for randomly generating debris type when there are multiple sizes.
|
||||
#define SMALL_DEBRIS_WEIGHT 8
|
||||
#define MEDIUM_DEBRIS_WEIGHT 4
|
||||
@@ -483,7 +484,7 @@ float asteroid_cap_speed(int asteroid_info_index, float speed)
|
||||
// Returns whether position is inside inner bounding volume
|
||||
// sum together the following: 1 inside x, 2 inside y, 4 inside z
|
||||
// inside only when sum = 7
|
||||
int asteroid_in_inner_bound_with_axes(asteroid_field *asfieldp, vector *pos, float delta)
|
||||
int asteroid_in_inner_bound_with_axes(asteroid_field *asfieldp, vec3d *pos, float delta)
|
||||
{
|
||||
Assert(asfieldp->has_inner_bound);
|
||||
|
||||
@@ -505,7 +506,7 @@ int asteroid_in_inner_bound_with_axes(asteroid_field *asfieldp, vector *pos, flo
|
||||
|
||||
// check if asteroid is within inner bound
|
||||
// return 0 if not inside or no inner bound, 1 if inside inner bound
|
||||
int asteroid_in_inner_bound(asteroid_field *asfieldp, vector *pos, float delta) {
|
||||
int asteroid_in_inner_bound(asteroid_field *asfieldp, vec3d *pos, float delta) {
|
||||
|
||||
if (!asfieldp->has_inner_bound) {
|
||||
return 0;
|
||||
@@ -516,7 +517,7 @@ int asteroid_in_inner_bound(asteroid_field *asfieldp, vector *pos, float delta)
|
||||
|
||||
// repositions asteroid outside the inner box on all 3 axes
|
||||
// moves to the other side of the inner box a distance delta from edge of box
|
||||
void inner_bound_pos_fixup(asteroid_field *asfieldp, vector *pos)
|
||||
void inner_bound_pos_fixup(asteroid_field *asfieldp, vec3d *pos)
|
||||
{
|
||||
if (!asteroid_in_inner_bound(asfieldp, pos, 0)) {
|
||||
return;
|
||||
@@ -547,7 +548,7 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
|
||||
object *objp;
|
||||
asteroid *asp;
|
||||
asteroid_info *asip;
|
||||
vector pos, delta_bound;
|
||||
vec3d pos, delta_bound;
|
||||
angles angs;
|
||||
float radius;
|
||||
ushort signature;
|
||||
@@ -662,7 +663,7 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
|
||||
radius = 1.0f;
|
||||
}
|
||||
|
||||
vector rotvel;
|
||||
vec3d rotvel;
|
||||
if ( Game_mode & GM_NORMAL ) {
|
||||
vm_vec_rand_vec_quick(&rotvel);
|
||||
vm_vec_scale(&rotvel, frand()/4.0f + 0.1f);
|
||||
@@ -715,7 +716,7 @@ object *asteroid_create(asteroid_field *asfieldp, int asteroid_type, int asteroi
|
||||
}
|
||||
|
||||
// Create asteroids when parent_objp blows up.
|
||||
void asteroid_sub_create(object *parent_objp, int asteroid_type, vector *relvec)
|
||||
void asteroid_sub_create(object *parent_objp, int asteroid_type, vec3d *relvec)
|
||||
{
|
||||
object *new_objp;
|
||||
float speed;
|
||||
@@ -804,8 +805,6 @@ int get_debris_from_same_group(int index) {
|
||||
// the weight is then used to determine the frequencty of different sizes of ship debris
|
||||
int get_debris_weight(int ship_debris_index)
|
||||
{
|
||||
|
||||
#if defined(MORE_SPECIES)
|
||||
if (ship_debris_index % 3 == 0)
|
||||
return SMALL_DEBRIS_WEIGHT;
|
||||
|
||||
@@ -816,32 +815,6 @@ int get_debris_weight(int ship_debris_index)
|
||||
return LARGE_DEBRIS_WEIGHT;
|
||||
//Int3();
|
||||
return 1;
|
||||
#else
|
||||
switch (ship_debris_index) {
|
||||
case DEBRIS_TERRAN_SMALL:
|
||||
case DEBRIS_VASUDAN_SMALL:
|
||||
case DEBRIS_SHIVAN_SMALL:
|
||||
return SMALL_DEBRIS_WEIGHT;
|
||||
break;
|
||||
|
||||
case DEBRIS_TERRAN_MEDIUM:
|
||||
case DEBRIS_VASUDAN_MEDIUM:
|
||||
case DEBRIS_SHIVAN_MEDIUM:
|
||||
return MEDIUM_DEBRIS_WEIGHT;
|
||||
break;
|
||||
|
||||
case DEBRIS_TERRAN_LARGE:
|
||||
case DEBRIS_VASUDAN_LARGE:
|
||||
case DEBRIS_SHIVAN_LARGE:
|
||||
return LARGE_DEBRIS_WEIGHT;
|
||||
break;
|
||||
|
||||
default:
|
||||
Int3();
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Create all the asteroids for the mission, called from
|
||||
@@ -1047,8 +1020,8 @@ int asteroid_is_targeted(object *objp)
|
||||
// Create an asteroid that will hit object *objp in delta_time seconds
|
||||
void asteroid_aim_at_target(object *objp, object *asteroid_objp, float delta_time)
|
||||
{
|
||||
vector predicted_center_pos;
|
||||
vector rand_vec;
|
||||
vec3d predicted_center_pos;
|
||||
vec3d rand_vec;
|
||||
float speed;
|
||||
|
||||
vm_vec_scale_add(&predicted_center_pos, &objp->pos, &objp->phys_info.vel, delta_time);
|
||||
@@ -1153,7 +1126,7 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
|
||||
}
|
||||
|
||||
if ( asteroid_should_wrap(objp, asfieldp) ) {
|
||||
vector vec_to_asteroid, old_asteroid_pos, old_vel;
|
||||
vec3d vec_to_asteroid, old_asteroid_pos, old_vel;
|
||||
float dot, dist;
|
||||
|
||||
old_asteroid_pos = objp->pos;
|
||||
@@ -1211,7 +1184,7 @@ void lerp(float *goal, float f1, float f2, float scale)
|
||||
void asteroid_process_pre( object *objp, float frame_time)
|
||||
{
|
||||
if (Asteroids_enabled) {
|
||||
vector *v, *vv;
|
||||
vec3d *v, *vv;
|
||||
|
||||
v = &objp->phys_info.vel;
|
||||
vv = &objp->phys_info.desired_vel;
|
||||
@@ -1227,7 +1200,7 @@ void asteroid_process_pre( object *objp, float frame_time)
|
||||
|
||||
#pragma warning ( push )
|
||||
#pragma warning ( disable : 4701 ) // possible use of variable without initialization
|
||||
int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpos, collision_info_struct *asteroid_hit_info)
|
||||
int asteroid_check_collision(object *pasteroid, object *other_obj, vec3d *hitpos, collision_info_struct *asteroid_hit_info)
|
||||
{
|
||||
if (!Asteroids_enabled) {
|
||||
return 0;
|
||||
@@ -1271,7 +1244,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
|
||||
object *heavy_obj = heavy;
|
||||
object *light_obj = light;
|
||||
|
||||
vector zero, p0, p1;
|
||||
vec3d zero, p0, p1;
|
||||
vm_vec_zero( &zero );
|
||||
vm_vec_sub( &p0, &light->last_pos, &heavy->last_pos );
|
||||
vm_vec_sub( &p1, &light->pos, &heavy->pos );
|
||||
@@ -1281,7 +1254,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
|
||||
mc.p1 = &p1; // Point 2 of ray to check
|
||||
|
||||
// find the light object's position in the heavy object's reference frame at last frame and also in this frame.
|
||||
vector p0_temp, p0_rotated;
|
||||
vec3d p0_temp, p0_rotated;
|
||||
|
||||
// Collision detection from rotation enabled if at rotaion is less than 30 degree in frame
|
||||
// This should account for all ships
|
||||
@@ -1314,7 +1287,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
|
||||
|
||||
// copy important data
|
||||
int copy_flags = mc.flags; // make a copy of start end positions of sphere in big ship RF
|
||||
vector copy_p0, copy_p1;
|
||||
vec3d copy_p0, copy_p1;
|
||||
copy_p0 = *mc.p0;
|
||||
copy_p1 = *mc.p1;
|
||||
|
||||
@@ -1385,7 +1358,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
vector int_light_pos, diff;
|
||||
vec3d int_light_pos, diff;
|
||||
vm_vec_sub(&diff, mc.p1, mc.p0);
|
||||
vm_vec_scale_add(&int_light_pos, mc.p0, &diff, mc.hit_dist);
|
||||
model_find_world_point(&asteroid_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_num, mc.hit_submodel, &heavy_obj->orient, &zero);
|
||||
@@ -1417,7 +1390,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
vector diff;
|
||||
vec3d diff;
|
||||
vm_vec_sub(&diff, mc.p1, mc.p0);
|
||||
vm_vec_scale_add(&asteroid_hit_info->light_collision_cm_pos, mc.p0, &diff, mc.hit_dist);
|
||||
|
||||
@@ -1448,7 +1421,7 @@ int asteroid_check_collision(object *pasteroid, object *other_obj, vector *hitpo
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
vector diff;
|
||||
vec3d diff;
|
||||
vm_vec_sub(&diff, mc.p1, mc.p0);
|
||||
vm_vec_scale_add(&asteroid_hit_info->light_collision_cm_pos, mc.p0, &diff, mc.hit_dist);
|
||||
|
||||
@@ -1506,9 +1479,9 @@ void asteroid_render(object * obj)
|
||||
}
|
||||
|
||||
// Create a normalized vector generally in the direction from *hitpos to other_obj->pos
|
||||
void asc_get_relvec(vector *relvec, object *other_obj, vector *hitpos)
|
||||
void asc_get_relvec(vec3d *relvec, object *other_obj, vec3d *hitpos)
|
||||
{
|
||||
vector tvec, rand_vec;
|
||||
vec3d tvec, rand_vec;
|
||||
int count = 0;
|
||||
|
||||
vm_vec_normalized_dir(&tvec, &other_obj->pos, hitpos);
|
||||
@@ -1571,7 +1544,6 @@ void asteriod_explode_sound(object *objp, int type, int play_loud)
|
||||
int sound_index = -1;
|
||||
float range_factor = 1.0f; // how many times sound should traver farther than normal
|
||||
|
||||
#if defined(MORE_SPECIES)
|
||||
if (type % 3 <= 1)
|
||||
{
|
||||
sound_index = SND_ASTEROID_EXPLODE_SMALL;
|
||||
@@ -1582,33 +1554,7 @@ void asteriod_explode_sound(object *objp, int type, int play_loud)
|
||||
sound_index = SND_ASTEROID_EXPLODE_BIG;
|
||||
range_factor = 10.0f;
|
||||
}
|
||||
#else
|
||||
switch (type) {
|
||||
case ASTEROID_TYPE_SMALL:
|
||||
case ASTEROID_TYPE_MEDIUM:
|
||||
case DEBRIS_TERRAN_SMALL:
|
||||
case DEBRIS_TERRAN_MEDIUM:
|
||||
case DEBRIS_VASUDAN_SMALL:
|
||||
case DEBRIS_VASUDAN_MEDIUM:
|
||||
case DEBRIS_SHIVAN_SMALL:
|
||||
case DEBRIS_SHIVAN_MEDIUM:
|
||||
sound_index = SND_ASTEROID_EXPLODE_SMALL;
|
||||
range_factor = 5.0f;
|
||||
break;
|
||||
|
||||
case ASTEROID_TYPE_BIG:
|
||||
case DEBRIS_TERRAN_LARGE:
|
||||
case DEBRIS_VASUDAN_LARGE:
|
||||
case DEBRIS_SHIVAN_LARGE:
|
||||
sound_index = SND_ASTEROID_EXPLODE_BIG;
|
||||
range_factor = 10.0f;
|
||||
break;
|
||||
|
||||
default:
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
Assert(sound_index != -1);
|
||||
|
||||
if ( !play_loud ) {
|
||||
@@ -1660,7 +1606,7 @@ void asteroid_do_area_effect(object *asteroid_objp)
|
||||
// other_obj => object that hit asteroid, can be NULL if asteroid hit by area effect
|
||||
// hitpos => world position asteroid was hit, can be NULL if hit by area effect
|
||||
// damage => amount of damage to apply to asteroid
|
||||
void asteroid_hit( object * asteroid_obj, object * other_obj, vector * hitpos, float damage )
|
||||
void asteroid_hit( object * asteroid_obj, object * other_obj, vec3d * hitpos, float damage )
|
||||
{
|
||||
float explosion_life;
|
||||
asteroid *asp;
|
||||
@@ -1698,7 +1644,7 @@ void asteroid_hit( object * asteroid_obj, object * other_obj, vector * hitpos, f
|
||||
} else {
|
||||
asp->death_hit_pos = asteroid_obj->pos;
|
||||
// randomize hit pos a bit, otherwise we will get a NULL vector when trying to find direction to toss child asteroids
|
||||
vector rand_vec;
|
||||
vec3d rand_vec;
|
||||
vm_vec_rand_vec_quick(&rand_vec);
|
||||
vm_vec_add2(&asp->death_hit_pos, &rand_vec);
|
||||
}
|
||||
@@ -1804,7 +1750,7 @@ void asteroid_maybe_break_up(object *asteroid_obj)
|
||||
asp = &Asteroids[asteroid_obj->instance];
|
||||
|
||||
if ( timestamp_elapsed(asp->final_death_time) ) {
|
||||
vector relvec, vfh, tvec;
|
||||
vec3d relvec, vfh, tvec;
|
||||
|
||||
asteroid_obj->flags |= OF_SHOULD_BE_DEAD;
|
||||
|
||||
@@ -1814,7 +1760,6 @@ void asteroid_maybe_break_up(object *asteroid_obj)
|
||||
if ( !MULTIPLAYER_CLIENT ) {
|
||||
#endif
|
||||
|
||||
#if defined(MORE_SPECIES)
|
||||
if (asp->type <= ASTEROID_TYPE_BIG) // 3
|
||||
// if this isn't true it's just debris, and debris doesn't break up
|
||||
{
|
||||
@@ -1841,7 +1786,7 @@ void asteroid_maybe_break_up(object *asteroid_obj)
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &tvec);
|
||||
|
||||
while (frand() > 0.6f) {
|
||||
vector rvec, tvec2;
|
||||
vec3d rvec, tvec2;
|
||||
vm_vec_rand_vec_quick(&rvec);
|
||||
vm_vec_scale_add(&tvec2, &vfh, &rvec, 0.75f);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec2);
|
||||
@@ -1852,54 +1797,6 @@ void asteroid_maybe_break_up(object *asteroid_obj)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
switch (asp->type) {
|
||||
case ASTEROID_TYPE_SMALL:
|
||||
break;
|
||||
case ASTEROID_TYPE_MEDIUM:
|
||||
asc_get_relvec(&relvec, asteroid_obj, &asp->death_hit_pos);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &relvec);
|
||||
|
||||
vm_vec_normalized_dir(&vfh, &asteroid_obj->pos, &asp->death_hit_pos);
|
||||
vm_vec_copy_scale(&tvec, &vfh, 2.0f);
|
||||
vm_vec_sub2(&tvec, &relvec);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec);
|
||||
|
||||
break;
|
||||
case ASTEROID_TYPE_BIG:
|
||||
asc_get_relvec(&relvec, asteroid_obj, &asp->death_hit_pos);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &relvec);
|
||||
|
||||
vm_vec_normalized_dir(&vfh, &asteroid_obj->pos, &asp->death_hit_pos);
|
||||
vm_vec_copy_scale(&tvec, &vfh, 2.0f);
|
||||
vm_vec_sub2(&tvec, &relvec);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_MEDIUM, &tvec);
|
||||
|
||||
while (frand() > 0.6f) {
|
||||
vector rvec, tvec2;
|
||||
vm_vec_rand_vec_quick(&rvec);
|
||||
vm_vec_scale_add(&tvec2, &vfh, &rvec, 0.75f);
|
||||
asteroid_sub_create(asteroid_obj, ASTEROID_TYPE_SMALL, &tvec2);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
// ship debris does not break up
|
||||
case DEBRIS_TERRAN_SMALL:
|
||||
case DEBRIS_TERRAN_MEDIUM:
|
||||
case DEBRIS_TERRAN_LARGE:
|
||||
case DEBRIS_VASUDAN_SMALL:
|
||||
case DEBRIS_VASUDAN_MEDIUM:
|
||||
case DEBRIS_VASUDAN_LARGE:
|
||||
case DEBRIS_SHIVAN_SMALL:
|
||||
case DEBRIS_SHIVAN_MEDIUM:
|
||||
case DEBRIS_SHIVAN_LARGE:
|
||||
break;
|
||||
|
||||
default:
|
||||
Int3();
|
||||
}
|
||||
#endif
|
||||
#ifndef NO_NETWORK
|
||||
}
|
||||
#endif
|
||||
@@ -1908,10 +1805,10 @@ void asteroid_maybe_break_up(object *asteroid_obj)
|
||||
}
|
||||
}
|
||||
|
||||
int asteroid_get_random_in_cone(vector *pos, vector *dir, float ang, int danger)
|
||||
int asteroid_get_random_in_cone(vec3d *pos, vec3d *dir, float ang, int danger)
|
||||
{
|
||||
int idx;
|
||||
vector asteroid_dir;
|
||||
vec3d asteroid_dir;
|
||||
|
||||
// just pick the first asteroid which satisfies our condition
|
||||
for(idx=0; idx<Num_asteroids; idx++){
|
||||
@@ -1930,7 +1827,7 @@ int asteroid_get_random_in_cone(vector *pos, vector *dir, float ang, int danger)
|
||||
void asteroid_test_collide(object *asteroid_obj, object *ship_obj, mc_info *mc)
|
||||
{
|
||||
float asteroid_ray_dist;
|
||||
vector asteroid_fvec, terminus;
|
||||
vec3d asteroid_fvec, terminus;
|
||||
|
||||
// See if ray from asteroid intersects bounding box of escort ship
|
||||
asteroid_ray_dist = vm_vec_mag_quick(&asteroid_obj->phys_info.desired_vel) * ASTEROID_MIN_COLLIDE_TIME;
|
||||
@@ -2117,14 +2014,14 @@ void asteroid_parse_section()
|
||||
stuff_string(asip->name, F_NAME, NULL);
|
||||
|
||||
required_string( "$POF file1:" );
|
||||
stuff_string_white( asip->pof_files[0] );
|
||||
stuff_string(asip->pof_files[0], F_NAME, NULL);
|
||||
|
||||
required_string( "$POF file2:" );
|
||||
stuff_string_white( asip->pof_files[1] );
|
||||
stuff_string(asip->pof_files[1], F_NAME, NULL);
|
||||
|
||||
if ( (strstr(asip->name,"Asteroid") != NULL) || (strstr(asip->name, "asteroid") != NULL) ) {
|
||||
required_string( "$POF file3:" );
|
||||
stuff_string_white( asip->pof_files[2] );
|
||||
stuff_string(asip->pof_files[2], F_NAME, NULL);
|
||||
}
|
||||
|
||||
asip->num_detail_levels = 0;
|
||||
@@ -2166,8 +2063,11 @@ void asteroid_parse_tbl()
|
||||
|
||||
required_string("#Asteroid Types");
|
||||
|
||||
// total we're expecting
|
||||
int Total_asteroid_types = ((True_NumSpecies + 1) * 3);
|
||||
|
||||
while (required_string_either("#End","$Name:")) {
|
||||
Assert( Num_asteroid_types < MAX_DEBRIS_TYPES );
|
||||
Assert( Num_asteroid_types < Total_asteroid_types );
|
||||
asteroid_parse_section();
|
||||
Num_asteroid_types++;
|
||||
}
|
||||
@@ -2175,11 +2075,7 @@ void asteroid_parse_tbl()
|
||||
required_string("#End");
|
||||
|
||||
// check all read in
|
||||
#if defined(MORE_SPECIES)
|
||||
Assert(Num_asteroid_types == (True_NumSpecies + 1) * 3);//the species + normal asteroids
|
||||
#else
|
||||
Assert(Num_asteroid_types == MAX_DEBRIS_TYPES);
|
||||
#endif
|
||||
Assert(Num_asteroid_types == Total_asteroid_types);
|
||||
|
||||
Asteroid_impact_explosion_ani = -1;
|
||||
required_string("$Impact Explosion:");
|
||||
@@ -2402,7 +2298,7 @@ void asteroid_page_in()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
#else
|
||||
|
||||
// stubbed out functions not used in the demo
|
||||
@@ -2414,8 +2310,8 @@ void asteroid_render( object *asteroid_objp ) {}
|
||||
void asteroid_delete( object *asteroid_objp ) {}
|
||||
void asteroid_process_pre( object *asteroid_objp, float frame_time) {}
|
||||
void asteroid_process_post( object *asteroid_objp, float frame_time) {}
|
||||
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vector * hitpos, collision_info_struct *asteroid_hit_info ) {return 0;}
|
||||
void asteroid_hit( object *asteroid_objp, object *other_objp, vector *hitpos, float damage ) {}
|
||||
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vec3d * hitpos, collision_info_struct *asteroid_hit_info ) {return 0;}
|
||||
void asteroid_hit( object *asteroid_objp, object *other_objp, vec3d *hitpos, float damage ) {}
|
||||
void asteroid_save_restore(CFILE *fp) {}
|
||||
int asteroid_count() {return 0;}
|
||||
int asteroid_collide_objnum(object *asteroid_objp) {return 0;}
|
||||
@@ -2423,8 +2319,9 @@ float asteroid_time_to_impact(object *asteroid_objp) {return 0.0f;}
|
||||
void asteroid_show_brackets() {}
|
||||
void asteroid_target_closest_danger() {}
|
||||
void asteroid_page_in() {}
|
||||
void asteroid_sub_create(object *parent_objp, int asteroid_type, vector *relvec) {}
|
||||
void asteroid_sub_create(object *parent_objp, int asteroid_type, vec3d *relvec) {}
|
||||
void asteroid_frame() {}
|
||||
|
||||
|
||||
#endif
|
||||
*/
|
||||
@@ -9,13 +9,31 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Asteroid/Asteroid.h $
|
||||
* $Revision: 2.4 $
|
||||
* $Date: 2004-03-05 09:01:53 $
|
||||
* $Revision: 2.9 $
|
||||
* $Date: 2005-07-13 02:50:48 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Header file for asteroids
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.8 2005/07/13 02:01:28 Goober5000
|
||||
* fixed a bunch of "issues" caused by me with the species stuff
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.7 2005/07/13 00:44:20 Goober5000
|
||||
* improved species support and removed need for #define
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.6 2005/04/05 05:53:14 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.5 2004/08/11 05:06:18 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.4 2004/03/05 09:01:53 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.3 2003/10/15 22:03:23 Kazan
|
||||
* Da Species Update :D
|
||||
*
|
||||
@@ -144,79 +162,14 @@ struct collision_info_struct;
|
||||
|
||||
#define MAX_ASTEROIDS 256
|
||||
|
||||
// DEBRIS TYPES
|
||||
|
||||
|
||||
#if defined(MORE_SPECIES)
|
||||
#define DEBRIS_NAME_MASK 0x000f
|
||||
// -----------------------------------
|
||||
// Kazan Extended Species version
|
||||
// -----------------------------------
|
||||
#define MAX_DEBRIS_TYPES 27
|
||||
|
||||
#define ASTEROID_TYPE_SMALL 0
|
||||
#define ASTEROID_TYPE_MEDIUM 1
|
||||
#define ASTEROID_TYPE_BIG 2
|
||||
// terran
|
||||
#define DEBRIS_TERRAN_SMALL 3
|
||||
#define DEBRIS_TERRAN_MEDIUM 4
|
||||
#define DEBRIS_TERRAN_LARGE 5
|
||||
// vasudan
|
||||
#define DEBRIS_VASUDAN_SMALL 6
|
||||
#define DEBRIS_VASUDAN_MEDIUM 7
|
||||
#define DEBRIS_VASUDAN_LARGE 8
|
||||
// shivan
|
||||
#define DEBRIS_SHIVAN_SMALL 9
|
||||
#define DEBRIS_SHIVAN_MEDIUM 10
|
||||
#define DEBRIS_SHIVAN_LARGE 11
|
||||
// ancient
|
||||
#define DEBRIS_ANCIENT_SMALL 12
|
||||
#define DEBRIS_ANCIENT_MEDIUM 13
|
||||
#define DEBRIS_ANCIENT_LARGE 14
|
||||
// user1
|
||||
#define DEBRIS_USER1_SMALL 15
|
||||
#define DEBRIS_USER1_MEDIUM 16
|
||||
#define DEBRIS_USER1_LARGE 17
|
||||
// user2
|
||||
#define DEBRIS_USER2_SMALL 18
|
||||
#define DEBRIS_USER2_MEDIUM 19
|
||||
#define DEBRIS_USER2_LARGE 20
|
||||
// user3
|
||||
#define DEBRIS_USER3_SMALL 21
|
||||
#define DEBRIS_USER3_MEDIUM 22
|
||||
#define DEBRIS_USER3_LARGE 23
|
||||
// user4
|
||||
#define DEBRIS_USER4_SMALL 24
|
||||
#define DEBRIS_USER4_MEDIUM 25
|
||||
#define DEBRIS_USER4_LARGE 26
|
||||
#else
|
||||
// -----------------------------------
|
||||
// Old Volition Version
|
||||
// -----------------------------------
|
||||
#define MAX_DEBRIS_TYPES 12
|
||||
//
|
||||
#define ASTEROID_TYPE_SMALL 0
|
||||
#define ASTEROID_TYPE_MEDIUM 1
|
||||
#define ASTEROID_TYPE_BIG 2
|
||||
//
|
||||
#define DEBRIS_TERRAN_SMALL 3
|
||||
#define DEBRIS_TERRAN_MEDIUM 4
|
||||
#define DEBRIS_TERRAN_LARGE 5
|
||||
//
|
||||
#define DEBRIS_VASUDAN_SMALL 6
|
||||
#define DEBRIS_VASUDAN_MEDIUM 7
|
||||
#define DEBRIS_VASUDAN_LARGE 8
|
||||
//
|
||||
#define DEBRIS_SHIVAN_SMALL 9
|
||||
#define DEBRIS_SHIVAN_MEDIUM 10
|
||||
#define DEBRIS_SHIVAN_LARGE 11
|
||||
// END DEBRIS TYPES
|
||||
#endif
|
||||
|
||||
typedef struct debris_struct {
|
||||
int index;
|
||||
char *name;
|
||||
} debris_struct;
|
||||
// This is for the asteroid types plus DEBRIS_X_Y
|
||||
// (X is each species and Y is SMALL, MEDIUM, and LARGE)
|
||||
#define MAX_DEBRIS_TYPES ((MAX_SPECIES + 1) * 3)
|
||||
|
||||
|
||||
// Data structure to track the active asteroids
|
||||
typedef struct asteroid_obj {
|
||||
@@ -226,8 +179,6 @@ typedef struct asteroid_obj {
|
||||
extern asteroid_obj Asteroid_obj_list;
|
||||
|
||||
|
||||
extern debris_struct Field_debris_info[];
|
||||
|
||||
#define MAX_ASTEROID_POFS 3 // Max number of POFs per asteroid type
|
||||
|
||||
#define AF_USED (1<<0) // Set means used.
|
||||
@@ -260,20 +211,10 @@ typedef struct asteroid {
|
||||
int final_death_time; // timestamp to swap in new models after explosion starts
|
||||
int collide_objnum; // set to objnum that asteroid will be impacting soon
|
||||
int collide_objsig; // object signature corresponding to collide_objnum
|
||||
vector death_hit_pos; // hit pos that caused death
|
||||
vec3d death_hit_pos; // hit pos that caused death
|
||||
int target_objnum; // Yes, hah! Asteroids can have targets. See asteroid_aim_at_target().
|
||||
} asteroid;
|
||||
|
||||
// TYPEDEF FOR SPECIES OF DEBRIS - BITFIELD
|
||||
#define DS_TERRAN 0x01
|
||||
#define DS_VASUDAN 0x02
|
||||
#define DS_SHIVAN 0x04
|
||||
#define DS_ANCIENT 0x08
|
||||
#define DS_USER1 0x10
|
||||
#define DS_USER2 0x20
|
||||
#define DS_USER3 0x40
|
||||
#define DS_USER4 0x80
|
||||
|
||||
// TYPEDEF FOR DEBRIS TYPE
|
||||
typedef enum {
|
||||
DG_ASTEROID,
|
||||
@@ -289,12 +230,12 @@ typedef enum {
|
||||
#define MAX_ACTIVE_DEBRIS_TYPES 3
|
||||
|
||||
typedef struct asteroid_field {
|
||||
vector min_bound; // Minimum range of field.
|
||||
vector max_bound; // Maximum range of field.
|
||||
vec3d min_bound; // Minimum range of field.
|
||||
vec3d max_bound; // Maximum range of field.
|
||||
int has_inner_bound;
|
||||
vector inner_min_bound;
|
||||
vector inner_max_bound;
|
||||
vector vel; // Average asteroid moves at this velocity.
|
||||
vec3d inner_min_bound;
|
||||
vec3d inner_max_bound;
|
||||
vec3d vel; // Average asteroid moves at this velocity.
|
||||
float speed; // Average speed of field
|
||||
int num_initial_asteroids; // Number of asteroids at creation.
|
||||
field_type_t field_type; // active throws and wraps, passive does not
|
||||
@@ -318,17 +259,17 @@ void asteroid_render( object *asteroid_objp );
|
||||
void asteroid_delete( object *asteroid_objp );
|
||||
void asteroid_process_pre( object *asteroid_objp, float frame_time);
|
||||
void asteroid_process_post( object *asteroid_objp, float frame_time);
|
||||
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vector * hitpos, collision_info_struct *asteroid_hit_info=NULL );
|
||||
void asteroid_hit( object *asteroid_objp, object *other_objp, vector *hitpos, float damage );
|
||||
int asteroid_check_collision( object *asteroid_objp, object * other_obj, vec3d * hitpos, collision_info_struct *asteroid_hit_info=NULL );
|
||||
void asteroid_hit( object *asteroid_objp, object *other_objp, vec3d *hitpos, float damage );
|
||||
int asteroid_count();
|
||||
int asteroid_collide_objnum(object *asteroid_objp);
|
||||
float asteroid_time_to_impact(object *asteroid_objp);
|
||||
void asteroid_show_brackets();
|
||||
void asteroid_target_closest_danger();
|
||||
int asteroid_get_random_in_cone(vector *pos, vector *dir, float ang, int danger = 0);
|
||||
int asteroid_get_random_in_cone(vec3d *pos, vec3d *dir, float ang, int danger = 0);
|
||||
|
||||
// need to extern for multiplayer
|
||||
void asteroid_sub_create(object *parent_objp, int asteroid_type, vector *relvec);
|
||||
void asteroid_sub_create(object *parent_objp, int asteroid_type, vec3d *relvec);
|
||||
|
||||
void asteroid_frame();
|
||||
|
||||
|
||||
@@ -0,0 +1,839 @@
|
||||
// Autopilot.cpp
|
||||
// Derek Meek
|
||||
// 4-30-2004
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Autopilot/Autopilot.cpp $
|
||||
* $Revision: 1.22 $
|
||||
* $Date: 2005-08-23 09:18:08 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.21 2005/07/23 16:25:32 Goober5000
|
||||
* remove an extraneous extern
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.20 2005/07/13 02:30:52 Goober5000
|
||||
* removed autopilot #define
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.19 2005/04/19 23:03:42 wmcoolmon
|
||||
* Lock time compression when autopilot is engaged
|
||||
*
|
||||
* Revision 1.18 2005/04/05 05:53:14 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 1.17 2005/03/25 06:57:32 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 1.16 2005/03/03 06:05:26 wmcoolmon
|
||||
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
|
||||
*
|
||||
* Revision 1.15 2005/01/31 23:27:51 taylor
|
||||
* merge with Linux/OSX tree - p0131-2
|
||||
*
|
||||
* Revision 1.14 2004/10/03 21:41:10 Kazan
|
||||
* Autopilot convergence collision fix for ai_fly_to_ship() and ai_waypoints() -- mathematically expensive, only usable by autopilot
|
||||
*
|
||||
* Revision 1.13 2004/09/28 22:51:41 Kazan
|
||||
* fix autopilot formation bug
|
||||
*
|
||||
* Revision 1.12 2004/09/28 19:54:31 Kazan
|
||||
* | is binary or, || is boolean or - please use the right one
|
||||
* autopilot velocity ramping biasing
|
||||
* made debugged+k kill guardianed ships
|
||||
*
|
||||
* Revision 1.11 2004/07/29 23:41:21 Kazan
|
||||
* bugfixes
|
||||
*
|
||||
* Revision 1.10 2004/07/27 18:52:10 Kazan
|
||||
* squished another
|
||||
*
|
||||
* Revision 1.9 2004/07/27 18:04:09 Kazan
|
||||
* i love it when bugs go crunch (autopilot ai fixup)
|
||||
*
|
||||
* Revision 1.8 2004/07/26 20:47:24 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 1.7 2004/07/26 17:54:04 Kazan
|
||||
* Autopilot system completed -- i am dropping plans for GUI nav map
|
||||
* Fixed FPS counter during time compression
|
||||
*
|
||||
* Revision 1.6 2004/07/25 19:27:51 Kazan
|
||||
* only disable afterburning during AIM_WAYPOINTS and AIM_FLY_TO_SHIP while AutoPilotEngaged
|
||||
*
|
||||
* Revision 1.5 2004/07/25 18:46:28 Kazan
|
||||
* -fred_no_warn has become -no_warn and applies to both fred and fs2
|
||||
* added new ai directive (last commit) and disabled afterburners while performing AIM_WAYPOINTS or AIM_FLY_TO_SHIP
|
||||
* fixed player ship speed bug w/ player-use-ai, now stays in formation correctly and manages speed
|
||||
* made -radar_reduce ignore itself if no parameter is given (ignoring launcher bug)
|
||||
*
|
||||
* Revision 1.4 2004/07/25 00:31:27 Kazan
|
||||
* i have absolutely nothing to say about that subject
|
||||
*
|
||||
* Revision 1.3 2004/07/12 16:32:42 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 1.2 2004/07/01 16:38:18 Kazan
|
||||
* working on autonav
|
||||
*
|
||||
* Revision 1.1 2004/05/07 23:50:14 Kazan
|
||||
* Sorry Guys!
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "autopilot/autopilot.h"
|
||||
#include "ai/ai.h"
|
||||
#include "ai/aigoals.h"
|
||||
#include "ship/ship.h"
|
||||
#include "object/object.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "freespace2/freespace.h"
|
||||
|
||||
|
||||
|
||||
// Extern functions/variables
|
||||
extern int Player_use_ai;
|
||||
extern int sexp_distance2(int obj1, char *subj);
|
||||
|
||||
|
||||
// Module variables
|
||||
bool AutoPilotEngaged;
|
||||
int CurrentNav;
|
||||
float ramp_bias;
|
||||
NavPoint Navs[MAX_NAVPOINTS];
|
||||
|
||||
// used for ramping time compression;
|
||||
int start_dist;
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
void autopilot_ai_waypoint_goal_fixup(ai_goal* aigp)
|
||||
{
|
||||
// this function sets wp_index properly;
|
||||
for (int i = 0; i < Num_waypoint_lists; i++)
|
||||
{
|
||||
if (!stricmp(aigp->ship_name, Waypoint_lists[i].name))
|
||||
{
|
||||
aigp->wp_index = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************************************************
|
||||
bool Sel_NextNav()
|
||||
{
|
||||
if (AutoPilotEngaged)
|
||||
return false;
|
||||
|
||||
int i;
|
||||
if (CurrentNav == -1)
|
||||
{
|
||||
for (i = 0; i < MAX_NAVPOINTS; i++)
|
||||
{
|
||||
if (Navs[i].flags & NP_VALIDTYPE && !(Navs[i].flags & NP_NOSELECT))
|
||||
{
|
||||
CurrentNav=i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = CurrentNav+1; i < MAX_NAVPOINTS+CurrentNav; i++)
|
||||
{
|
||||
if (Navs[i%MAX_NAVPOINTS].flags & NP_VALIDTYPE && !(Navs[i%MAX_NAVPOINTS].flags & NP_NOSELECT))
|
||||
{
|
||||
if (i != CurrentNav)
|
||||
{
|
||||
CurrentNav=i%MAX_NAVPOINTS;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************************************************
|
||||
vec3d NavPoint::GetPosition()
|
||||
{
|
||||
vec3d position;
|
||||
|
||||
if (flags & NP_WAYPOINT)
|
||||
{
|
||||
position = ((waypoint_list*)target_obj)->waypoints[waypoint_num-1];
|
||||
}
|
||||
else
|
||||
{
|
||||
position = Objects[((ship*)target_obj)->objnum].pos;
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
char* NavPoint::GetInteralName()
|
||||
{
|
||||
char *NavName;
|
||||
char strtmp[3];
|
||||
|
||||
if (flags & NP_WAYPOINT)
|
||||
{
|
||||
NavName = new char[strlen(((waypoint_list*)target_obj)->name)+5];
|
||||
memset(NavName, 0, strlen(((waypoint_list*)target_obj)->name)+5);
|
||||
strcpy(NavName, ((waypoint_list*)target_obj)->name);
|
||||
|
||||
strcat(NavName, ":");
|
||||
strcat(NavName, itoa(waypoint_num, strtmp, 10));
|
||||
}
|
||||
else
|
||||
{
|
||||
NavName = new char[strlen(((ship*)target_obj)->ship_name)+1];
|
||||
memset(NavName, 0, strlen(((ship*)target_obj)->ship_name)+1);
|
||||
strcpy(NavName, ((ship*)target_obj)->ship_name);
|
||||
}
|
||||
|
||||
return NavName;
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Tell us is autopilot is allow
|
||||
// This needs:
|
||||
// * Nav point selected
|
||||
// * No enemies within X distance
|
||||
// * Destination > 1,000 meters away
|
||||
bool CanAutopilot()
|
||||
{
|
||||
bool CanAuto = true;
|
||||
CanAuto = CanAuto && CurrentNav != -1;
|
||||
|
||||
int dist = sexp_distance2(Player_ship->objnum, "<any hostile>");
|
||||
|
||||
CanAuto = CanAuto && (5000 <= dist || dist == SEXP_NAN);
|
||||
|
||||
|
||||
if (CanAuto) // protect against no currentNav
|
||||
{
|
||||
char *name = Navs[CurrentNav].GetInteralName();
|
||||
CanAuto = CanAuto && (1000 <= sexp_distance2(Player_ship->objnum, name));
|
||||
delete[] name;
|
||||
}
|
||||
|
||||
return CanAuto;
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Engages autopilot
|
||||
// This does:
|
||||
// * Control switched from player to AI
|
||||
// * Time compression to 32x
|
||||
// * Lock time compression -WMC
|
||||
// * Tell AI to fly to targetted Nav Point (for all nav-status wings/ships)
|
||||
// * Sets max waypoint speed to the best-speed of the slowest ship tagged
|
||||
void StartAutopilot()
|
||||
{
|
||||
if (!CanAutopilot())
|
||||
return;
|
||||
|
||||
AutoPilotEngaged = true;
|
||||
|
||||
Player_use_ai = 1;
|
||||
set_time_compression(1);
|
||||
lock_time_compression(true);
|
||||
|
||||
// determine speed cap
|
||||
int i,j;
|
||||
float speed_cap = 1000000.0; // 1m is a safe starting point
|
||||
|
||||
for (i = 0; i < MAX_SHIPS; i++)
|
||||
{
|
||||
if (Ships[i].objnum != -1 &&
|
||||
(Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
|
||||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)
|
||||
)
|
||||
)
|
||||
{
|
||||
if (speed_cap > Ship_info[Ships[i].ship_info_index].max_vel.xyz.z)
|
||||
speed_cap = Ship_info[Ships[i].ship_info_index].max_vel.xyz.z;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// damp speed_cap to 90% of actual -- to make sure ships stay in formation
|
||||
speed_cap = 0.90f * speed_cap;
|
||||
ramp_bias = speed_cap/50.0f;
|
||||
|
||||
// assign ship goals
|
||||
// when assigning goals to individual ships only do so if Ships[shipnum].wingnum != -1
|
||||
// we will assign wing goals below
|
||||
|
||||
|
||||
for (i = 0; i < MAX_SHIPS; i++)
|
||||
{
|
||||
if (Ships[i].objnum != -1 &&
|
||||
(Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
|
||||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY)
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
// clear the ship goals and cap the waypoint speed
|
||||
ai_clear_ship_goals(&Ai_info[Ships[i].ai_index]);
|
||||
Ai_info[Ships[i].ai_index].waypoint_speed_cap = (int)speed_cap;
|
||||
|
||||
|
||||
// if they're not part of a wing set their goal
|
||||
if (Ships[i].wingnum == -1)
|
||||
{
|
||||
if (Navs[CurrentNav].flags & NP_WAYPOINT)
|
||||
{
|
||||
|
||||
ai_add_ship_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_WAYPOINTS_ONCE, -1, ((waypoint_list*)Navs[CurrentNav].target_obj)->name, &Ai_info[Ships[i].ai_index] );
|
||||
|
||||
//fixup has to wait until after wing goals
|
||||
}
|
||||
else
|
||||
{
|
||||
ai_add_ship_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_FLY_TO_SHIP, -1, ((ship*)Navs[CurrentNav].target_obj)->ship_name, &Ai_info[Ships[i].ai_index] );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// assign wing goals
|
||||
for (i = 0; i < MAX_WINGS; i++)
|
||||
{
|
||||
if (Wings[i].flags & WF_NAV_CARRY )
|
||||
{
|
||||
//ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip );
|
||||
|
||||
//ai_add_wing_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_STAY_NEAR_SHIP, 0, target_shipname, wingnum );
|
||||
//ai_add_wing_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_WAYPOINTS_ONCE, 0, target_shipname, wingnum );
|
||||
//ai_clear_ship_goals( &(Ai_info[Ships[num].ai_index]) );
|
||||
|
||||
ai_clear_wing_goals( i );
|
||||
if (Navs[CurrentNav].flags & NP_WAYPOINT)
|
||||
{
|
||||
|
||||
ai_add_wing_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_WAYPOINTS_ONCE, AIF_FORMATION_WING, ((waypoint_list*)Navs[CurrentNav].target_obj)->name, i );
|
||||
|
||||
|
||||
// "fix up" the goal
|
||||
for (j = 0; j < MAX_AI_GOALS; j++)
|
||||
{
|
||||
if (Wings[i].ai_goals[j].ai_mode == AI_GOAL_WAYPOINTS_ONCE ||
|
||||
Wings[i].ai_goals[j].ai_mode == AIM_WAYPOINTS )
|
||||
{
|
||||
autopilot_ai_waypoint_goal_fixup(&(Wings[i].ai_goals[j]));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ai_add_wing_goal_player( AIG_TYPE_PLAYER_WING, AI_GOAL_FLY_TO_SHIP, AIF_FORMATION_WING, ((ship*)Navs[CurrentNav].target_obj)->ship_name, i );
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fixup has to go down here because ships are assigned goals during wing goals as well
|
||||
for (i = 0; i < MAX_SHIPS; i++)
|
||||
{
|
||||
if (Ships[i].objnum != -1)
|
||||
{
|
||||
if (Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
|
||||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY))
|
||||
for (j = 0; j < MAX_AI_GOALS; j++)
|
||||
{
|
||||
if (Ai_info[Ships[i].ai_index].goals[j].ai_mode == AI_GOAL_WAYPOINTS_ONCE ||
|
||||
Ai_info[Ships[i].ai_index].goals[j].ai_mode == AIM_WAYPOINTS)
|
||||
{
|
||||
autopilot_ai_waypoint_goal_fixup( &(Ai_info[Ships[i].ai_index].goals[j]) );
|
||||
|
||||
|
||||
// formation fixup
|
||||
//ai_form_on_wing(&Objects[Ships[i].objnum], &Objects[Player_ship->objnum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
start_dist = DistanceTo(CurrentNav);
|
||||
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Checks if autopilot should automatically die
|
||||
// Returns true if:
|
||||
// * Targetted waypoint < 10,000 meters away
|
||||
// * Enemy < 10,000 meters
|
||||
bool Autopilot_AutoDiable()
|
||||
{
|
||||
return !CanAutopilot();
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Disengages autopilot
|
||||
// this does:
|
||||
// * Time compression to 1x
|
||||
// * Delete AI nav goal
|
||||
// * Control switched from AI to player
|
||||
void EndAutoPilot()
|
||||
{
|
||||
AutoPilotEngaged = false;
|
||||
|
||||
set_time_compression(1);
|
||||
lock_time_compression(false);
|
||||
Player_use_ai = 0;
|
||||
//Clear AI Goals
|
||||
|
||||
// assign ship goals
|
||||
// when assigning goals to individual ships only do so if Ships[shipnum].wingnum != -1
|
||||
// we will assign wing goals below
|
||||
int i,j;
|
||||
|
||||
for (i = 0; i < MAX_SHIPS; i++)
|
||||
|
||||
{
|
||||
if (Ships[i].objnum != -1 &&
|
||||
(
|
||||
Ships[i].flags2 & SF2_NAVPOINT_CARRY ||
|
||||
(Ships[i].wingnum != -1 && Wings[Ships[i].wingnum].flags & WF_NAV_CARRY )
|
||||
)
|
||||
)
|
||||
{
|
||||
Ai_info[Ships[i].ai_index].waypoint_speed_cap = -1; // uncap their speed
|
||||
|
||||
// old "dumb" routine
|
||||
//ai_clear_ship_goals( &(Ai_info[Ships[i].ai_index]) );
|
||||
for (j = 0; j < MAX_AI_GOALS; j++)
|
||||
{
|
||||
if (Ai_info[Ships[i].ai_index].goals[j].ai_mode == AI_GOAL_WAYPOINTS_ONCE ||
|
||||
Ai_info[Ships[i].ai_index].goals[j].ai_mode == AI_GOAL_FLY_TO_SHIP ||
|
||||
Ai_info[Ships[i].ai_index].goals[j].ai_mode == AIM_WAYPOINTS ||
|
||||
Ai_info[Ships[i].ai_index].goals[j].ai_mode == AIM_FLY_TO_SHIP)
|
||||
{
|
||||
ai_remove_ship_goal( &(Ai_info[Ships[i].ai_index]), j );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// assign wing goals
|
||||
for (i = 0; i < MAX_WINGS; i++)
|
||||
{
|
||||
if (Wings[i].flags & WF_NAV_CARRY )
|
||||
{
|
||||
// old "dumb" routine
|
||||
//ai_clear_wing_goals( i );
|
||||
for (j = 0; j < MAX_AI_GOALS; j++)
|
||||
{
|
||||
if (Wings[i].ai_goals[j].ai_mode == AI_GOAL_WAYPOINTS_ONCE ||
|
||||
Wings[i].ai_goals[j].ai_mode == AI_GOAL_FLY_TO_SHIP ||
|
||||
Wings[i].ai_goals[j].ai_mode == AIM_WAYPOINTS ||
|
||||
Wings[i].ai_goals[j].ai_mode == AIM_FLY_TO_SHIP)
|
||||
{
|
||||
Wings[i].ai_goals[j].ai_mode = AI_GOAL_NONE;
|
||||
Wings[i].ai_goals[j].signature = -1;
|
||||
Wings[i].ai_goals[j].priority = -1;
|
||||
Wings[i].ai_goals[j].flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Checks for changes every NPS_TICKRATE milliseconds
|
||||
// Checks:
|
||||
// * if we've gotten close enough to a nav point for it to be counted as "Visited"
|
||||
// * If we're current AutoNavigating it checks if we need to autodisengage
|
||||
void NavSystem_Do()
|
||||
{
|
||||
static unsigned int last_update = 0;
|
||||
|
||||
if (clock () - last_update > NPS_TICKRATE)
|
||||
{
|
||||
if (AutoPilotEngaged)
|
||||
if (Autopilot_AutoDiable())
|
||||
EndAutoPilot();
|
||||
|
||||
// check if a NavPoints target has left, delete it if so
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_NAVPOINTS; i++)
|
||||
{
|
||||
if ((Navs[i].flags & NP_SHIP) && (Navs[i].target_obj != NULL))
|
||||
{
|
||||
if (((ship*)Navs[i].target_obj)->objnum == -1)
|
||||
DelNavPoint(i);
|
||||
}
|
||||
}
|
||||
|
||||
// check if we're reached a Node
|
||||
for (i = 0; i < MAX_NAVPOINTS; i++)
|
||||
{
|
||||
if (Navs[i].target_obj != NULL)
|
||||
{
|
||||
if (Navs[i].flags & NP_VALIDTYPE && DistanceTo(i) < 1000)
|
||||
Navs[i].flags |= NP_VISITED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ramp time compression
|
||||
if (AutoPilotEngaged)
|
||||
{
|
||||
int dstfrm_start = start_dist - DistanceTo(CurrentNav);
|
||||
|
||||
// Ramp UP time compression
|
||||
if (dstfrm_start < (3500*ramp_bias))
|
||||
{
|
||||
|
||||
if (dstfrm_start >= (3000*ramp_bias) && DistanceTo(CurrentNav) > 30000)
|
||||
set_time_compression(64);
|
||||
else if (dstfrm_start >= (2000*ramp_bias))
|
||||
set_time_compression(32);
|
||||
else if (dstfrm_start >= (1600*ramp_bias))
|
||||
set_time_compression(16);
|
||||
else if (dstfrm_start >= (1200*ramp_bias))
|
||||
set_time_compression(8);
|
||||
else if (dstfrm_start >= (800*ramp_bias))
|
||||
set_time_compression(4);
|
||||
else if (dstfrm_start >= (400*ramp_bias))
|
||||
set_time_compression(2);
|
||||
}
|
||||
|
||||
// Ramp DOWN time compression
|
||||
if (DistanceTo(CurrentNav) <= (7000*ramp_bias))
|
||||
{
|
||||
int dist = DistanceTo(CurrentNav);
|
||||
if (dist >= (5000*ramp_bias))
|
||||
set_time_compression(32);
|
||||
else if (dist >= (4000*ramp_bias))
|
||||
set_time_compression(16);
|
||||
else if (dist >= (3000*ramp_bias))
|
||||
set_time_compression(8);
|
||||
else if (dist >= (2000*ramp_bias))
|
||||
set_time_compression(4);
|
||||
else if (dist >= (1000*ramp_bias))
|
||||
set_time_compression(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************************************************
|
||||
// Inits the Nav System
|
||||
void NavSystem_Init()
|
||||
{
|
||||
memset((char *)&Navs, 0, sizeof(Navs));
|
||||
AutoPilotEngaged = false;
|
||||
CurrentNav = -1;
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Finds a Nav point by name
|
||||
int FindNav(char *Nav)
|
||||
{
|
||||
for (int i = 0; i < MAX_NAVPOINTS; i++)
|
||||
{
|
||||
if (!stricmp(Navs[i].NavName, Nav))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Set A Nav point to "ZERO"
|
||||
void ZeroNav(int i)
|
||||
{
|
||||
memset((char *)&Navs[i], 0, sizeof(NavPoint));
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Removes a Nav
|
||||
bool DelNavPoint(char *Nav)
|
||||
{
|
||||
int n = FindNav(Nav);
|
||||
|
||||
return DelNavPoint(n);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool DelNavPoint(int nav)
|
||||
{
|
||||
if (nav != -1)
|
||||
{
|
||||
if (nav != MAX_NAVPOINTS-1)
|
||||
{
|
||||
for (int i = nav; i < MAX_NAVPOINTS-1; i++)
|
||||
{
|
||||
Navs[nav] = Navs[nav+1];
|
||||
}
|
||||
|
||||
}
|
||||
ZeroNav(MAX_NAVPOINTS-1);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// adds a Nav
|
||||
bool AddNav_Ship(char *Nav, char *TargetName, int flags)
|
||||
{
|
||||
// find an empty nav - should be the end
|
||||
|
||||
int empty = -1;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_NAVPOINTS && empty == -1; i++)
|
||||
{
|
||||
if (Navs[i].flags == 0)
|
||||
empty = i;
|
||||
}
|
||||
|
||||
if (empty == -1) // no empty navpoint slots
|
||||
return false;
|
||||
|
||||
// Create the NavPoint struct
|
||||
NavPoint tnav;
|
||||
|
||||
strncpy(tnav.NavName, Nav, 32);
|
||||
tnav.flags = NP_SHIP | flags;
|
||||
|
||||
Assert(!(tnav.flags & NP_WAYPOINT));
|
||||
|
||||
|
||||
for (i = 0; i < MAX_SHIPS; i++)
|
||||
{
|
||||
if (Ships[i].objnum != -1 && !stricmp(TargetName, Ships[i].ship_name))
|
||||
{
|
||||
tnav.target_obj = (void *)&Ships[i];
|
||||
}
|
||||
}
|
||||
|
||||
tnav.waypoint_num = 0; // unused for NP_SHIP
|
||||
|
||||
|
||||
// copy it into it's location
|
||||
Navs[empty] = tnav;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool AddNav_Waypoint(char *Nav, char *WP_Path, int node, int flags)
|
||||
{
|
||||
// find an empty nav - should be the end
|
||||
|
||||
int empty = -1;
|
||||
int i;
|
||||
|
||||
if (node == 0)
|
||||
node = 1;
|
||||
|
||||
for (i = 0; i < MAX_NAVPOINTS && empty == -1; i++)
|
||||
{
|
||||
if (Navs[i].flags == 0)
|
||||
empty = i;
|
||||
}
|
||||
|
||||
if (empty == -1) // no empty navpoint slots
|
||||
return false;
|
||||
|
||||
// Create the NavPoint struct
|
||||
NavPoint tnav;
|
||||
|
||||
strncpy(tnav.NavName, Nav, 32);
|
||||
tnav.flags = NP_WAYPOINT | flags;
|
||||
|
||||
Assert(!(tnav.flags & NP_SHIP));
|
||||
|
||||
|
||||
for (i = 0; i < Num_waypoint_lists; i++)
|
||||
{
|
||||
if (!stricmp(WP_Path, Waypoint_lists[i].name))
|
||||
{
|
||||
tnav.target_obj = (void *)&Waypoint_lists[i];
|
||||
}
|
||||
}
|
||||
|
||||
tnav.waypoint_num = node;
|
||||
|
||||
// copy it into it's location
|
||||
Navs[empty] = tnav;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
//Change Flags
|
||||
bool Nav_Alt_Flags(char *Nav, int flags)
|
||||
{
|
||||
flags &= ~NP_VALIDTYPE; //clear the NP_SHIP and NP_WAYPOINT bits, make sure they haven't been set
|
||||
|
||||
int nav = FindNav(Nav);
|
||||
|
||||
if (nav != -1)
|
||||
{
|
||||
Navs[nav].flags &= NP_VALIDTYPE; // Clear all bits BUT NP_SHIP or NO_WAYPOINT
|
||||
Navs[nav].flags |= flags; // merge
|
||||
}
|
||||
|
||||
return (nav != -1);
|
||||
}
|
||||
|
||||
//Get Flags
|
||||
int Nav_Get_Flags(char *Nav)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
int nav = FindNav(Nav);
|
||||
|
||||
if (nav != -1)
|
||||
flags = Navs[nav].flags;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
// Sexp Accessors
|
||||
|
||||
//Generic
|
||||
bool Nav_Set_Flag(char *Nav, int flag)
|
||||
{
|
||||
Assert(!(flag & NP_VALIDTYPE));
|
||||
int nav = FindNav(Nav);
|
||||
|
||||
if (nav != -1)
|
||||
{
|
||||
Navs[nav].flags |= flag;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
bool Nav_UnSet_Flag(char *Nav, int flag)
|
||||
{
|
||||
Assert(!(flag & NP_VALIDTYPE));
|
||||
|
||||
int nav = FindNav(Nav);
|
||||
|
||||
if (nav != -1)
|
||||
{
|
||||
Navs[nav].flags &= ~flag;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
//Named
|
||||
bool Nav_Set_Hidden(char *Nav)
|
||||
{
|
||||
return Nav_Set_Flag(Nav, NP_HIDDEN);
|
||||
|
||||
}
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
bool Nav_Set_NoAccess(char *Nav)
|
||||
{
|
||||
return Nav_Set_Flag(Nav, NP_NOACCESS);
|
||||
}
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
bool Nav_Set_Visited(char *Nav)
|
||||
{
|
||||
|
||||
return Nav_Set_Flag(Nav, NP_VISITED);
|
||||
}
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
bool Nav_UnSet_Hidden(char *Nav)
|
||||
{
|
||||
return Nav_UnSet_Flag(Nav, NP_HIDDEN);
|
||||
}
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
bool Nav_UnSet_NoAccess(char *Nav)
|
||||
{
|
||||
return Nav_UnSet_Flag(Nav, NP_NOACCESS);
|
||||
}
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
bool Nav_UnSet_Visited(char *Nav)
|
||||
{
|
||||
return Nav_UnSet_Flag(Nav, NP_VISITED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
unsigned int DistanceTo(char *nav)
|
||||
{
|
||||
int n = FindNav(nav);
|
||||
|
||||
return DistanceTo(n);
|
||||
}
|
||||
|
||||
unsigned int DistanceTo(int nav)
|
||||
{
|
||||
if (nav > MAX_NAVPOINTS && nav < 0)
|
||||
return 0xFFFFFFFF;
|
||||
|
||||
char *name = Navs[nav].GetInteralName();
|
||||
|
||||
if (name == NULL)
|
||||
return 0xFFFFFFFF;
|
||||
|
||||
int distance = sexp_distance2(Player_ship->objnum, name);
|
||||
delete[] name;
|
||||
|
||||
if (distance == SEXP_NAN)
|
||||
return 0xFFFFFFFF;
|
||||
return distance;
|
||||
}
|
||||
|
||||
//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
bool IsVisited(char *nav)
|
||||
{
|
||||
int n = FindNav(nav);
|
||||
|
||||
return IsVisited(n);
|
||||
}
|
||||
|
||||
bool IsVisited(int nav)
|
||||
{
|
||||
if (nav > MAX_NAVPOINTS && nav < 0)
|
||||
return 0;
|
||||
|
||||
if (Navs[nav].flags & NP_VISITED)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
// Autopilot.h
|
||||
// Derek Meek
|
||||
// 4-30-2004
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Autopilot/Autopilot.h $
|
||||
* $Revision: 1.8 $
|
||||
* $Date: 2005-07-13 02:50:49 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.7 2005/04/05 05:53:14 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 1.6 2004/08/11 05:06:18 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 1.5 2004/07/27 18:52:10 Kazan
|
||||
* squished another
|
||||
*
|
||||
* Revision 1.4 2004/07/25 19:27:51 Kazan
|
||||
* only disable afterburning during AIM_WAYPOINTS and AIM_FLY_TO_SHIP while AutoPilotEngaged
|
||||
*
|
||||
* Revision 1.3 2004/07/25 00:31:27 Kazan
|
||||
* i have absolutely nothing to say about that subject
|
||||
*
|
||||
* Revision 1.2 2004/07/01 16:38:18 Kazan
|
||||
* working on autonav
|
||||
*
|
||||
* Revision 1.1 2004/05/07 23:50:14 Kazan
|
||||
* Sorry Guys!
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(_AUTOPILOT_H_)
|
||||
#define _AUTOPILOT_H_
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
// milliseconds between updates
|
||||
#define NPS_TICKRATE 250
|
||||
|
||||
#define MAX_NAVPOINTS 8
|
||||
|
||||
#define NP_WAYPOINT 0x0001 // Nav Point is bound to the poistion of a single node of a waypoint path
|
||||
#define NP_SHIP 0x0002 // Nav Point is bound to the poisiton of a certain ship
|
||||
#define NP_HIDDEN 0x0004 // Nav Point doesn't show on map and isn't selectable
|
||||
#define NP_NOACCESS 0x0008 // Nav Point isn't selectable
|
||||
#define NP_VISITED 0x0100 // Whether we've been within 1,000 meters of this waypoint
|
||||
|
||||
#define NP_NOSELECT ( NP_HIDDEN | NP_NOACCESS )
|
||||
#define NP_VALIDTYPE ( NP_WAYPOINT | NP_SHIP )
|
||||
|
||||
struct NavPoint
|
||||
{
|
||||
char NavName[32];
|
||||
int flags;
|
||||
|
||||
void *target_obj;
|
||||
int waypoint_num; //only used when flags & NP_WAYPOINT
|
||||
|
||||
vec3d GetPosition();
|
||||
char* GetInteralName();
|
||||
};
|
||||
|
||||
extern bool AutoPilotEngaged;
|
||||
extern int CurrentNav;
|
||||
extern NavPoint Navs[MAX_NAVPOINTS];
|
||||
|
||||
// Cycles through the NavPoint List
|
||||
bool Sel_NextNav();
|
||||
|
||||
|
||||
// Tell us is autopilot is allow
|
||||
// This needs:
|
||||
// * Nav point selected
|
||||
// * No enemies within 5,000 meters
|
||||
// * Destination > 1,000 meters away
|
||||
bool CanAutopilot();
|
||||
|
||||
// Engages autopilot
|
||||
// This does:
|
||||
// * Control switched from player to AI
|
||||
// * Time compression to 32x
|
||||
// * Tell AI to fly to targetted Nav Point (for all nav-status wings/ships)
|
||||
// * Sets max waypoint speed to the best-speed of the slowest ship tagged
|
||||
void StartAutopilot();
|
||||
|
||||
// Checks if autopilot should automatically die
|
||||
// Returns true if:
|
||||
// * Targetted waypoint < 1,000 meters away
|
||||
// * Enemy < 5,000 meters
|
||||
bool Autopilot_AutoDiable();
|
||||
|
||||
// Disengages autopilot
|
||||
// this does:
|
||||
// * Time compression to 1x
|
||||
// * Delete AI nav goal
|
||||
// * Control switched from AI to player
|
||||
void EndAutoPilot();
|
||||
|
||||
|
||||
// Checks for changes every NPS_TICKRATE milliseconds
|
||||
// Checks:
|
||||
// * if we've gotten close enough to a nav point for it to be counted as "Visited"
|
||||
// * If we're current AutoNavigating it checks if we need to autodisengage
|
||||
void NavSystem_Do();
|
||||
|
||||
|
||||
// Inits the Nav System
|
||||
void NavSystem_Init();
|
||||
|
||||
// Finds a Nav point by name
|
||||
int FindNav(char *Nav);
|
||||
|
||||
// Set A Nav point to "ZERO"
|
||||
void ZeroNav(int i);
|
||||
|
||||
// Removes a Nav
|
||||
bool DelNavPoint(char *Nav);
|
||||
bool DelNavPoint(int nav);
|
||||
|
||||
// adds a Nav
|
||||
bool AddNav_Ship(char *Nav, char *TargetName, int flags);
|
||||
bool AddNav_Waypoint(char *Nav, char *WP_Path, int node, int flags);
|
||||
|
||||
//Change Flags
|
||||
bool Nav_Alt_Flags(char *Nav, int flags);
|
||||
|
||||
// Sexp Accessors
|
||||
bool Nav_Set_Flag(char *Nav, int flag);
|
||||
bool Nav_UnSet_Flag(char *Nav, int flag);
|
||||
|
||||
bool Nav_Set_Hidden(char *Nav);
|
||||
bool Nav_Set_NoAccess(char *Nav);
|
||||
bool Nav_Set_Visited(char *Nav);
|
||||
|
||||
bool Nav_UnSet_Hidden(char *Nav);
|
||||
bool Nav_UnSet_NoAccess(char *Nav);
|
||||
bool Nav_UnSet_Visited(char *Nav);
|
||||
|
||||
// Useful functions
|
||||
unsigned int DistanceTo(char *nav);
|
||||
unsigned int DistanceTo(int nav);
|
||||
|
||||
bool IsVisited(char *nav);
|
||||
bool IsVisited(int nav);
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
||||
*
|
||||
* All source code herein is the property of Volition, Inc. You may not sell
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/bmpman/bm_internal.h $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2005-04-21 15:49:20 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* bmpman info that's internal to bmpman related files only
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.2 2005/03/03 14:29:37 bobboau
|
||||
* fixed a small error from my earlier commit.
|
||||
*
|
||||
* Revision 2.1 2004/11/23 00:10:06 taylor
|
||||
* try and protect the bitmap_entry stuff a bit better
|
||||
* fix the transparent support ship, again, but correctly this time
|
||||
*
|
||||
*
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __BM_INTERNAL_H__
|
||||
#define __BM_INTERNAL_H__
|
||||
|
||||
|
||||
// extra check to make sure this stuff doesn't end up in normal files
|
||||
// don't use any of this unless BMPMAN_INTERNAL is defined
|
||||
#ifdef BMPMAN_INTERNAL
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
|
||||
|
||||
// keep this defined to use per-ship nondarkening pixels
|
||||
#define BMPMAN_SPECIAL_NONDARK
|
||||
|
||||
|
||||
#define BM_TYPE_NONE 0
|
||||
#define BM_TYPE_PCX 1
|
||||
#define BM_TYPE_USER 2
|
||||
#define BM_TYPE_ANI 3 // in-house ANI format
|
||||
#define BM_TYPE_EFF 4 // specifies any type of animated image, the EFF itself is just text
|
||||
|
||||
#define BM_TYPE_32_BIT_FORMATS 5 // everything after this could/should be 24/32-bit
|
||||
#define BM_TYPE_TGA 6 // 16 or 32 bit targa
|
||||
#define BM_TYPE_DDS 7 // generic identifier for DDS
|
||||
#define BM_TYPE_DXT1 8 // 24 bit with switchable alpha (compressed)
|
||||
#define BM_TYPE_DXT3 9 // 32 bit with 4 bit alpha (compressed)
|
||||
#define BM_TYPE_DXT5 10 // 32 bit with 8 bit alpha (compressed)
|
||||
#define BM_TYPE_JPG 11 // 32 bit jpeg
|
||||
#define BM_TYPE_RENDER_TARGET 12 // 32 bit setup internaly as a render target
|
||||
|
||||
|
||||
/// Moved from cpp file ///////////////////
|
||||
// Consider these 'protected' structures and functions that should only be used by special bitmap functions
|
||||
typedef struct bm_extra_info {
|
||||
struct {
|
||||
// Stuff needed for animations
|
||||
int first_frame; // used for animations -- points to index of first frame
|
||||
ubyte num_frames; // used for animation -- number of frames in the animation
|
||||
ubyte fps; // used for animation -- frames per second
|
||||
} ani;
|
||||
struct {
|
||||
// Stuff needed for user bitmaps
|
||||
void *data; // For user bitmaps, this is where the data comes from
|
||||
ubyte bpp; // For user bitmaps, this is what format the data is
|
||||
ubyte flags; // Flags passed to bm_create
|
||||
} user;
|
||||
struct {
|
||||
// Stuff for static animations
|
||||
ubyte type; // type for individual images
|
||||
char filename[MAX_FILENAME_LEN]; // filename for individual images
|
||||
} eff;
|
||||
} bm_extra_info;
|
||||
|
||||
|
||||
typedef struct bitmap_entry {
|
||||
// identification
|
||||
char filename[MAX_FILENAME_LEN]; // filename for this bitmap
|
||||
|
||||
uint signature; // a unique signature identifying the data
|
||||
uint palette_checksum; // checksum used to be sure bitmap is in current palette
|
||||
int handle; // Handle = id*MAX_BITMAPS + bitmapnum
|
||||
int last_used; // When this bitmap was last used
|
||||
|
||||
ubyte type; // PCX, USER, ANI, etc
|
||||
signed char ref_count; // Number of locks on bitmap. Can't unload unless ref_count is 0.
|
||||
|
||||
int dir_type; // which directory this was loaded from (to skip other locations with same name)
|
||||
|
||||
// compressed bitmap stuff (.dds) - RT please take a look at this and tell me if we really need it
|
||||
int mem_taken; // How much memory does this bitmap use? - UnknownPlayer
|
||||
int num_mipmaps; // number of mipmap levels, we need to read all of them
|
||||
|
||||
// Stuff to keep track of usage
|
||||
ubyte preloaded; // If set, then this was loaded from the lst file
|
||||
int preload_count; // how many times this gets used in game, for unlocking
|
||||
ubyte used_flags; // What flags it was accessed thru
|
||||
int load_count;
|
||||
|
||||
// Bitmap info
|
||||
bitmap bm;
|
||||
|
||||
// Data for animations and user bitmaps
|
||||
bm_extra_info info;
|
||||
|
||||
#ifdef BMPMAN_NDEBUG
|
||||
// bookeeping
|
||||
ubyte used_last_frame; // If set, then it was used last frame
|
||||
ubyte used_this_frame; // If set, then it was used this frame
|
||||
int data_size; // How much data this bitmap uses
|
||||
int used_count; // How many times it was accessed
|
||||
#endif
|
||||
} bitmap_entry;
|
||||
|
||||
extern bitmap_entry bm_bitmaps[MAX_BITMAPS];
|
||||
|
||||
|
||||
// image specific lock functions
|
||||
void bm_lock_ani( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
|
||||
void bm_lock_dds( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
|
||||
void bm_lock_jpg( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
|
||||
void bm_lock_pcx( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
|
||||
void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
|
||||
void bm_lock_user( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags );
|
||||
|
||||
|
||||
#endif // BMPMAN_INTERNAL
|
||||
|
||||
#endif // __BM_INTERNAL_H__
|
||||
|
||||
+1206
-818
File diff suppressed because it is too large.
Load diff
+124
-93
@@ -10,13 +10,76 @@
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Bmpman/BmpMan.h $
|
||||
*
|
||||
* $Revision: 2.13 $
|
||||
* $Date: 2004-05-06 22:35:26 $
|
||||
* $Revision: 2.25 $
|
||||
* $Date: 2005-08-20 20:34:49 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Prototypes for Bitmap Manager functions
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.24 2005/07/13 02:50:49 Goober5000
|
||||
* remove PreProcDefine #includes in FS2
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.23 2005/06/19 02:28:55 taylor
|
||||
* add a _fast version of bm_unload() to be used in modelinterp and future graphics API code
|
||||
* clean up some modelinterp code to not use memcpy() everywhere so it's more platform compatible and matches old code (Jens Granseuer)
|
||||
* NaN check to catch shards-of-death and prevent hitting an Assert() (Jens Granseuer)
|
||||
* fix jumpnode code to catch model errors and close a memory leak
|
||||
* make the call to bm_unload_all() after model_free_all() since we will get bmpman screwups otherwise
|
||||
* don't show hardware sound RAM when using OpenAL build, it will always be 0
|
||||
* print top-right memory figures in debug builds slighly further over when 1024+ res
|
||||
*
|
||||
* Revision 2.22 2005/04/24 12:56:42 taylor
|
||||
* really are too many changes here:
|
||||
* - remove all bitmap section support and fix problems with previous attempt
|
||||
* ( code/bmpman/bmpman.cpp, code/bmpman/bmpman.h, code/globalincs/pstypes.h,
|
||||
* code/graphics/2d.cpp, code/graphics/2d.h code/graphics/grd3dbmpman.cpp,
|
||||
* code/graphics/grd3dinternal.h, code/graphics/grd3drender.cpp, code/graphics/grd3dtexture.cpp,
|
||||
* code/graphics/grinternal.h, code/graphics/gropengl.cpp, code/graphics/gropengl.h,
|
||||
* code/graphics/gropengllight.cpp, code/graphics/gropengltexture.cpp, code/graphics/gropengltexture.h,
|
||||
* code/graphics/tmapper.h, code/network/multi_pinfo.cpp, code/radar/radarorb.cpp
|
||||
* code/render/3ddraw.cpp )
|
||||
* - use CLAMP() define in gropengl.h for gropengllight instead of single clamp() function
|
||||
* - remove some old/outdated code from gropengl.cpp and gropengltexture.cpp
|
||||
*
|
||||
* Revision 2.21 2005/04/21 15:49:20 taylor
|
||||
* update of bmpman and model bitmap management, well tested but things may get a bit bumpy
|
||||
* - use VM_* macros for bmpman since it didn't seem to register the memory correctly (temporary)
|
||||
* - a little "stupid" fix for dds bitmap reading
|
||||
* - fix it so that memory is released properly on bitmap read errors
|
||||
* - some cleanup to model texture loading
|
||||
* - allow model textures to get released rather than just unloaded, saves bitmap slots
|
||||
* - bump MAX_BITMAPS to 4750, should be able to decrease after public testing of new code
|
||||
*
|
||||
* Revision 2.20 2005/03/07 13:10:19 bobboau
|
||||
* commit of render target code, d3d should be totaly functional,
|
||||
* OGL still needs implementation.
|
||||
*
|
||||
* Revision 2.19 2005/02/10 14:38:50 taylor
|
||||
* fix an issue with bm_set_components()
|
||||
* abs is for ints fabsf is for floats (camera.cpp)
|
||||
* make the in-cockpit stuff OGL friendly
|
||||
*
|
||||
* Revision 2.18 2004/11/23 00:10:06 taylor
|
||||
* try and protect the bitmap_entry stuff a bit better
|
||||
* fix the transparent support ship, again, but correctly this time
|
||||
*
|
||||
* Revision 2.17 2004/11/21 15:59:45 Kazan
|
||||
* conflict res
|
||||
*
|
||||
* Revision 2.16 2004/10/31 21:26:27 taylor
|
||||
* bmpman merge, EFF animation support, better page in stuff, dozen or so smaller fixes and cleanup
|
||||
*
|
||||
* Revision 2.15 2004/10/06 22:02:54 Kazan
|
||||
* interface corruption fix - thanks taylor (MAX_BITMAPS upped to 7000)
|
||||
*
|
||||
* Revision 2.14 2004/08/11 05:06:18 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.13 2004/05/06 22:35:26 taylor
|
||||
* DDS mipmap reading, remove unneeded bm_unlock() during page in
|
||||
*
|
||||
* Revision 2.12 2004/04/01 15:31:20 taylor
|
||||
* don't use interface anis as ship textures
|
||||
*
|
||||
@@ -290,85 +353,46 @@
|
||||
#define BMPMAN_NDEBUG
|
||||
#endif
|
||||
|
||||
#define MAX_BITMAPS 3500 // How many bitmaps the game can handle
|
||||
|
||||
// this is causing problems - let's UP IT -- Kazan
|
||||
// bumped from 3500 to 4500 2004/09/21 - taylor
|
||||
// bumped to 4750 2005/02/03 - taylor
|
||||
//#define MAX_BITMAPS 3500 // How many bitmaps the game can handle
|
||||
#define MAX_BITMAPS 4750 // How many bitmaps the game can handle
|
||||
// NOTE: MAX_BITMAPS shouldn't need to be bumped again. With the fixed bm_release() and it's
|
||||
// proper use even the largest missions should stay under this number. With the largest retail
|
||||
// missions and wasteful content we should still have about 20% of the slots free. If it still
|
||||
// goes over then it's something the artists need to fix. For instance the Terran Mara fighter,
|
||||
// with -spec and -glow and using the Shinepack, needs 117 bitmap slots alone. 111 of those is
|
||||
// just for the glowmaps. This number can be greatly reduced if the number of ani frames for
|
||||
// another LOD than LOD0 has fewer or no ani frames. A 37 frame glow ani for LOD2 is little
|
||||
// more than a waste of resources. Future reports of texture corruption should be initially
|
||||
// approached with content as the cause and not code. If anything we could/should reduce
|
||||
// MAX_BITMAPS in the future. Where it's at now should accomidate even the largest mods.
|
||||
// -- Taylor
|
||||
|
||||
|
||||
// 16 bit pixel formats
|
||||
#define BM_PIXEL_FORMAT_ARGB 0 // for glide - can assume certain things, like 1555 LFB writes, whee!
|
||||
#define BM_PIXEL_FORMAT_D3D 1 // d3d - card dependant. booo!
|
||||
#define BM_PIXEL_FORMAT_ARGB_D3D 2 // this card has nice 1555 textures like Glide - ahhhhh!
|
||||
|
||||
enum
|
||||
{
|
||||
BM_TYPE_NONE,
|
||||
BM_TYPE_PCX, // 16 bit PCX
|
||||
BM_TYPE_USER, // Data created at run time
|
||||
BM_TYPE_ANI, // In-house ANI format
|
||||
// Only list 32 bit formats after this flag please
|
||||
BM_TYPE_32_BIT_FORMATS,
|
||||
BM_TYPE_TGA,
|
||||
BM_TYPE_JPG,
|
||||
BM_TYPE_DDS,
|
||||
};
|
||||
|
||||
/// Moved from cpp file ///////////////////
|
||||
// Consider these 'protected' structures and functions that should only be used by special bitmap functions
|
||||
extern int bm_inited;
|
||||
|
||||
typedef union bm_extra_info {
|
||||
struct {
|
||||
// Stuff needed for animations
|
||||
int first_frame; // used for animations -- points to index of first frame
|
||||
ubyte num_frames; // used for animation -- number of frames in the animation
|
||||
ubyte fps; // used for animation -- frames per second
|
||||
} ani;
|
||||
struct {
|
||||
// Stuff needed for user bitmaps
|
||||
void *data; // For user bitmaps, this is where the data comes from
|
||||
ubyte bpp; // For user bitmaps, this is what format the data is
|
||||
ubyte flags; // Flags passed to bm_create
|
||||
} user;
|
||||
} bm_extra_info;
|
||||
extern int Bm_paging;
|
||||
|
||||
typedef struct bitmap_entry {
|
||||
// identification
|
||||
char filename[MAX_FILENAME_LEN]; // filename for this bitmap
|
||||
void bm_init();
|
||||
|
||||
uint signature; // a unique signature identifying the data
|
||||
uint palette_checksum; // checksum used to be sure bitmap is in current palette
|
||||
int handle; // Handle = id*MAX_BITMAPS + bitmapnum
|
||||
int last_used; // When this bitmap was last used
|
||||
void bm_close();
|
||||
|
||||
ubyte type; // PCX, USER, ANI, etc
|
||||
signed char ref_count; // Number of locks on bitmap. Can't unload unless ref_count is 0.
|
||||
int bm_get_cache_slot( int bitmap_id, int separate_ani_frames );
|
||||
|
||||
// compressed bitmap stuff (.dds) - RT please take a look at this and tell me if we really need it
|
||||
int mem_taken; // How much memory does this bitmap use? - UnknownPlayer
|
||||
int num_mipmaps; // number of mipmap levels, we need to read all of them
|
||||
int bm_get_next_handle();
|
||||
|
||||
// Stuff to keep track of usage
|
||||
ubyte preloaded; // If set, then this was loaded from the lst file
|
||||
ubyte used_flags; // What flags it was accessed thru
|
||||
void *bm_malloc(int n, int size);
|
||||
|
||||
// Bitmap info
|
||||
bitmap bm;
|
||||
|
||||
// Data for animations and user bitmaps
|
||||
bm_extra_info info;
|
||||
|
||||
#ifdef BMPMAN_NDEBUG
|
||||
// bookeeping
|
||||
ubyte used_last_frame; // If set, then it was used last frame
|
||||
ubyte used_this_frame; // If set, then it was used this frame
|
||||
int data_size; // How much data this bitmap uses
|
||||
int used_count; // How many times it was accessed
|
||||
#endif
|
||||
|
||||
} bitmap_entry;
|
||||
|
||||
void bm_gfx_init();
|
||||
void bm_gfx_close();
|
||||
int bm_gfx_get_cache_slot( int bitmap_id, int separate_ani_frames );
|
||||
|
||||
int bm_gfx_get_next_handle();
|
||||
void bm_update_memory_used(int n, int size);
|
||||
|
||||
// 16 bit pixel formats
|
||||
extern int Bm_pixel_format;
|
||||
@@ -382,12 +406,12 @@ extern int bm_texture_ram;
|
||||
// It returns a negative number if it couldn't load
|
||||
// the bitmap. On success, it returns the bitmap
|
||||
// number.
|
||||
int bm_gfx_load(char * filename);
|
||||
int bm_load(char * filename);
|
||||
|
||||
// special load function. basically allows you to load a bitmap which already exists (by filename).
|
||||
// this is useful because in some cases we need to have a bitmap which is locked in screen format
|
||||
// _and_ texture format, such as pilot pics and squad logos
|
||||
int bm_gfx_load_duplicate(char *filename);
|
||||
int bm_load_duplicate(char *filename);
|
||||
|
||||
// Creates a bitmap that exists in RAM somewhere, instead
|
||||
// of coming from a disk file. You pass in a pointer to a
|
||||
@@ -397,29 +421,33 @@ int bm_gfx_load_duplicate(char *filename);
|
||||
// On success, it returns the bitmap number. You cannot
|
||||
// free that RAM until bm_release is called on that bitmap.
|
||||
// See example at bottom of this file
|
||||
int bm_gfx_create( int bpp, int w, int h, void * data, int flags = 0);
|
||||
int bm_create( int bpp, int w, int h, void * data, int flags = 0);
|
||||
|
||||
// Frees up a bitmap's data, but bitmap number 'n' can
|
||||
// still be used, it will just have to be paged in next
|
||||
// time it is locked.
|
||||
int bm_gfx_unload( int n );
|
||||
int bm_unload( int n, bool = false );
|
||||
|
||||
// like bm_unload() except that it's safe to use to free data without worrying about
|
||||
// load_count so it's safe to use in relation to bm_release() and in gr_*_texture functions
|
||||
int bm_unload_fast( int n, bool = false );
|
||||
|
||||
// Frees up a bitmap's data, and it's slot, so bitmap
|
||||
// number 'n' cannot be used anymore, and bm_load or
|
||||
// bm_create might reuse the slot.
|
||||
void bm_gfx_release(int n);
|
||||
void bm_release(int n);
|
||||
|
||||
// This loads a bitmap sequence so we can draw with it later.
|
||||
// It returns a negative number if it couldn't load
|
||||
// the bitmap. On success, it returns the bitmap
|
||||
// number of the first frame and nframes is set.
|
||||
extern int bm_gfx_load_animation( char * filename, int * nframes, int *fps = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY );
|
||||
extern int bm_load_animation( char * filename, int * nframes, int *fps = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY );
|
||||
|
||||
// This locks down a bitmap and returns a pointer to a bitmap
|
||||
// that can be accessed until you call bm_unlock. Only lock
|
||||
// a bitmap when you need it! This will convert it into the
|
||||
// appropriate format also.
|
||||
extern bitmap * bm_gfx_lock( int bitmapnum, ubyte bpp, ubyte flags );
|
||||
extern bitmap * bm_lock( int bitmapnum, ubyte bpp, ubyte flags );
|
||||
|
||||
// The signature is a field that gets filled in with
|
||||
// a unique signature for each bitmap. The signature for each bitmap
|
||||
@@ -427,10 +455,10 @@ extern bitmap * bm_gfx_lock( int bitmapnum, ubyte bpp, ubyte flags );
|
||||
extern uint bm_get_signature( int bitmapnum);
|
||||
|
||||
// Unlocks a bitmap
|
||||
extern void bm_gfx_unlock( int bitmapnum );
|
||||
extern void bm_unlock( int bitmapnum );
|
||||
|
||||
// Gets info. w,h,or flags,nframes or fps can be NULL if you don't care.
|
||||
extern void bm_gfx_get_info( int bitmapnum, int *w=NULL, int * h=NULL, ubyte * flags=NULL, int *nframes=NULL, int *fps=NULL, bitmap_section_info **sections = NULL );
|
||||
extern void bm_get_info( int bitmapnum, int *w=NULL, int * h=NULL, ubyte * flags=NULL, int *nframes=NULL, int *fps=NULL );
|
||||
|
||||
// get filename
|
||||
extern void bm_get_filename(int bitmapnum, char *filename);
|
||||
@@ -440,10 +468,10 @@ extern void bm_update();
|
||||
|
||||
// call to load all data for all bitmaps that have been requested to be loaded
|
||||
extern void bm_gfx_load_all();
|
||||
extern void bm_gfx_unload_all();
|
||||
extern void bm_unload_all();
|
||||
|
||||
// call to get the palette for a bitmap
|
||||
void bm_gfx_get_palette(int n, ubyte *pal, char *name);
|
||||
void bm_get_palette(int n, ubyte *pal, char *name);
|
||||
|
||||
// Hacked function to get a pixel from a bitmap.
|
||||
// Only works good in 8bpp mode.
|
||||
@@ -452,7 +480,7 @@ void bm_gfx_get_pixel( int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *
|
||||
// Returns number of bytes of bitmaps locked this frame
|
||||
// ntotal = number of bytes of bitmaps locked this frame
|
||||
// nnew = number of bytes of bitmaps locked this frame that weren't locked last frame
|
||||
void bm_gfx_get_frame_usage(int *ntotal, int *nnew);
|
||||
void bm_get_frame_usage(int *ntotal, int *nnew);
|
||||
|
||||
/*
|
||||
* Example on using bm_create
|
||||
@@ -499,28 +527,31 @@ void bm_gfx_get_frame_usage(int *ntotal, int *nnew);
|
||||
// Paging stuff
|
||||
//============================================================================
|
||||
|
||||
void bm_gfx_page_in_start();
|
||||
void bm_gfx_page_in_stop();
|
||||
void bm_page_in_start();
|
||||
void bm_page_in_stop();
|
||||
|
||||
// Paging code in a library should call these functions
|
||||
// in its page in function.
|
||||
|
||||
// Marks a texture as being used for this level
|
||||
// If num_frames is passed, assume this is an animation
|
||||
void bm_gfx_page_in_texture( int bitmapnum, int num_frames=1 );
|
||||
void bm_page_in_texture( int bitmapnum, int num_frames=1 );
|
||||
|
||||
// Marks a texture as being used for this level
|
||||
// If num_frames is passed, assume this is an animation
|
||||
void bm_gfx_page_in_nondarkening_texture( int bitmap, int num_frames=1 );
|
||||
void bm_page_in_nondarkening_texture( int bitmap, int num_frames=1 );
|
||||
|
||||
// marks a texture as being a transparent textyre used for this level
|
||||
// Marks a texture as being used for this level
|
||||
// If num_frames is passed, assume this is an animation
|
||||
void bm_gfx_page_in_xparent_texture( int bitmapnum, int num_frames=1 );
|
||||
void bm_page_in_xparent_texture( int bitmapnum, int num_frames=1 );
|
||||
|
||||
// Marks an aabitmap as being used for this level
|
||||
// If num_frames is passed, assume this is an animation
|
||||
void bm_gfx_page_in_aabitmap( int bitmapnum, int num_frames=1 );
|
||||
void bm_page_in_aabitmap( int bitmapnum, int num_frames=1 );
|
||||
|
||||
// unload a texture that was paged in
|
||||
int bm_page_out( int handle );
|
||||
|
||||
//
|
||||
// Mode: 0 = High memory
|
||||
@@ -536,6 +567,7 @@ void BM_SELECT_ALPHA_TEX_FORMAT();
|
||||
|
||||
// set the rgba components of a pixel, any of the parameters can be NULL
|
||||
extern void (*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
extern void (*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
void bm_set_components_argb(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
void bm_set_components_d3d(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
void bm_set_components_argb_d3d_16_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
@@ -544,21 +576,20 @@ void bm_set_components_argb_d3d_16_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *
|
||||
void bm_set_components_argb_d3d_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
// get the rgba components of a pixel, any of the parameters can be NULL
|
||||
void bm_gfx_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
//============================================================================
|
||||
// section info stuff
|
||||
//============================================================================
|
||||
|
||||
// given a bitmap and a section, return the size (w, h)
|
||||
void bm_gfx_get_section_size(int bitmapnum, int sx, int sy, int *w, int *h);
|
||||
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
|
||||
extern int GLOWMAP; //this holds a reference to a map that is a fully lit version of it's index -Bobboau
|
||||
extern int SPECMAP; //this holds a reference to a map that is for specular mapping -Bobboau
|
||||
extern int ENVMAP; //this holds a reference to a map that is for environment mapping -Bobboau
|
||||
|
||||
int bm_is_compressed(int num);
|
||||
int bm_get_tcache_type(int num);
|
||||
int bm_get_size(int num);
|
||||
int bm_get_num_mipmaps(int num);
|
||||
|
||||
void bm_print_bitmaps();
|
||||
|
||||
int bm_make_render_target( int &x_res, int &y_res, int flags );
|
||||
bool bm_is_render_target(int bitmap_id);
|
||||
bool bm_set_render_target(int handle, int face = -1);
|
||||
#endif
|
||||
@@ -0,0 +1,485 @@
|
||||
#include "camera/camera.h"
|
||||
#include "math/vecmat.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "parse/parselo.h"
|
||||
|
||||
//Some global vars
|
||||
std::vector<subtitle> Subtitles;
|
||||
std::vector<camera> Cameras;
|
||||
//Preset cameras
|
||||
camera* Free_camera = NULL;
|
||||
|
||||
//This is where the camera class beings! :D
|
||||
camera::camera()
|
||||
{
|
||||
//These are our two pointers, new'd and delete'd only by this class
|
||||
desired_position = NULL;
|
||||
desired_orientation = NULL;
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
camera::~camera()
|
||||
{
|
||||
//Cleanup
|
||||
if(desired_position != NULL)
|
||||
delete desired_position;
|
||||
|
||||
if(desired_orientation != NULL)
|
||||
delete desired_orientation;
|
||||
}
|
||||
|
||||
void camera::reset()
|
||||
{
|
||||
position = vmd_zero_vector;
|
||||
|
||||
if(desired_position != NULL)
|
||||
{
|
||||
delete desired_position;
|
||||
desired_position = NULL;
|
||||
}
|
||||
|
||||
translation_velocity = translation_vel_limit = translation_acc_limit = vmd_zero_vector;
|
||||
|
||||
vm_set_identity(&orientation);
|
||||
|
||||
if(desired_orientation != NULL)
|
||||
{
|
||||
delete desired_orientation;
|
||||
desired_orientation = NULL;
|
||||
}
|
||||
rotation_rate = rotation_vel_limit = rotation_acc_limit = vmd_zero_vector;
|
||||
}
|
||||
|
||||
void camera::set_position(vec3d *in_position, float in_translation_time, float in_translation_acceleration_time)
|
||||
{
|
||||
position = *in_position;
|
||||
}
|
||||
|
||||
void camera::set_translation_velocity(vec3d *in_velocity)
|
||||
{
|
||||
if(in_velocity == NULL)
|
||||
translation_velocity = *in_velocity;
|
||||
else
|
||||
vm_vec_zero(&translation_velocity);
|
||||
}
|
||||
|
||||
#define square(a) (a*a)
|
||||
void camera::set_rotation(matrix *in_orientation, float in_rotation_time, float in_rotation_acceleration_time)
|
||||
{
|
||||
if(in_rotation_time > 0.0f || in_rotation_acceleration_time > 0.0f)
|
||||
{
|
||||
//Safeties
|
||||
if(in_rotation_acceleration_time <= 0.0f)
|
||||
in_rotation_acceleration_time = 1.0f;
|
||||
if(in_rotation_time <= 0.0f)
|
||||
in_rotation_time = 3.0f;
|
||||
if(in_rotation_acceleration_time*2.0f > in_rotation_time)
|
||||
in_rotation_acceleration_time = in_rotation_time/2.0f;
|
||||
|
||||
//Get the angles in radians
|
||||
angles curr_orientation, new_orientation;
|
||||
vm_extract_angles_matrix(&curr_orientation, &orientation);
|
||||
vm_extract_angles_matrix(&new_orientation, in_orientation);
|
||||
|
||||
//Find the distance
|
||||
angles d;
|
||||
d.p = new_orientation.p - curr_orientation.p;
|
||||
d.b = new_orientation.b - curr_orientation.b;
|
||||
d.h = new_orientation.h - curr_orientation.h;
|
||||
/*d.p = curr_orientation.p - new_orientation.p;
|
||||
d.b = curr_orientation.b - new_orientation.b;
|
||||
d.h = curr_orientation.h - new_orientation.h;*/
|
||||
|
||||
/*ad_dist = -(V/At)square((At));
|
||||
|
||||
((Xf - Xo) - ad_dist)/V*/
|
||||
|
||||
/*v.p = (-(in_rotation_time - 2.0f*(in_rotation_acceleration_time)) + sqrt(square(in_rotation_time-2.0f*(in_rotation_acceleration_time))) + 4.0f*(curr_orientation.p - new_orientation.p))/2;
|
||||
v.b = (-(in_rotation_time - 2.0f*(in_rotation_acceleration_time)) + sqrt(square(in_rotation_time-2.0f*(in_rotation_acceleration_time))) + 4.0f*(curr_orientation.b - new_orientation.b))/2;
|
||||
v.h = (-(in_rotation_time - 2.0f*(in_rotation_acceleration_time)) + sqrt(square(in_rotation_time-2.0f*(in_rotation_acceleration_time))) + 4.0f*(curr_orientation.h - new_orientation.h))/2;*/
|
||||
/*v.p = (new_orientation.p - curr_orientation.p)/(in_rotation_time - in_rotation_acceleration_time);
|
||||
v.b = (new_orientation.p - curr_orientation.p)/(in_rotation_time - in_rotation_acceleration_time);
|
||||
v.h = (new_orientation.p - curr_orientation.p)/(in_rotation_time - in_rotation_acceleration_time);*/
|
||||
|
||||
/*
|
||||
angles *U = &rotation_rate;
|
||||
|
||||
float At = in_rotation_acceleration_time;
|
||||
float t = in_rotation_time; //- 2.0f*At*/
|
||||
/*v.p = ((d.p/At - U->p)/t);
|
||||
v.b = ((d.b/At - U->b)/t);
|
||||
v.h = ((d.h/At - U->h)/t);*/
|
||||
/*v.p = ((d.p - U->p*At)/t);
|
||||
v.b = ((d.b - U->b*At)/t);
|
||||
v.h = ((d.h - U->h*At)/t);*/
|
||||
|
||||
//Set the desired orientation
|
||||
if(desired_orientation == NULL)
|
||||
desired_orientation = new matrix;
|
||||
|
||||
if(in_orientation != NULL)
|
||||
*desired_orientation = *in_orientation;
|
||||
else
|
||||
vm_set_identity(desired_orientation);
|
||||
|
||||
//Calculate the maximum acceleration speed
|
||||
rotation_acc_limit.xyz.z = fabsf(d.p / ((in_rotation_time * in_rotation_acceleration_time) - square(in_rotation_acceleration_time)));
|
||||
rotation_acc_limit.xyz.x = fabsf(d.b / ((in_rotation_time * in_rotation_acceleration_time) - square(in_rotation_acceleration_time)));
|
||||
rotation_acc_limit.xyz.y = fabsf(d.h / ((in_rotation_time * in_rotation_acceleration_time) - square(in_rotation_acceleration_time)));
|
||||
|
||||
//Calculate the maximum velocity
|
||||
rotation_vel_limit.xyz.x = fabsf(rotation_acc_limit.xyz.x * in_rotation_acceleration_time);
|
||||
rotation_vel_limit.xyz.y = fabsf(rotation_acc_limit.xyz.y * in_rotation_acceleration_time);
|
||||
rotation_vel_limit.xyz.z = fabsf(rotation_acc_limit.xyz.z * in_rotation_acceleration_time);
|
||||
|
||||
//rotation_rate_delta_time = rotation_rate_delta_time_left = in_rotation_acceleration_time;
|
||||
//rotation_rate_decel_time_til = in_rotation_time - in_rotation_acceleration_time;
|
||||
|
||||
//set_rotation_rate(&v, in_rotation_acceleration_time);
|
||||
|
||||
//rotation_rate_decel_time_til = in_rotation_time - in_rotation_acceleration_time;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(in_orientation != NULL)
|
||||
orientation = *in_orientation;
|
||||
else
|
||||
vm_set_identity(&orientation);
|
||||
|
||||
set_rotation_velocity(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void camera::set_rotation(angles *in_angles, float in_rotation_time, float in_rotation_acceleration_time)
|
||||
{
|
||||
matrix temp_matrix = IDENTITY_MATRIX;
|
||||
|
||||
if(in_angles != NULL)
|
||||
vm_angles_2_matrix(&temp_matrix, in_angles);
|
||||
|
||||
set_rotation(&temp_matrix, in_rotation_time, in_rotation_acceleration_time);
|
||||
}
|
||||
|
||||
void camera::set_rotation_facing(vec3d *in_target, float in_rotation_time, float in_rotation_acceleration_time)
|
||||
{
|
||||
matrix temp_matrix = IDENTITY_MATRIX;
|
||||
|
||||
if(in_target != NULL)
|
||||
{
|
||||
vec3d targetvec;
|
||||
vm_vec_normalized_dir(&targetvec, in_target, &position);
|
||||
vm_vector_2_matrix(&temp_matrix, &targetvec, NULL, NULL);
|
||||
}
|
||||
|
||||
set_rotation(&temp_matrix, in_rotation_time, in_rotation_acceleration_time);
|
||||
}
|
||||
|
||||
void camera::set_rotation_velocity(vec3d *in_rotation_rate)
|
||||
{
|
||||
if(in_rotation_rate != NULL)
|
||||
rotation_rate = *in_rotation_rate;
|
||||
else
|
||||
vm_vec_zero(&rotation_rate);
|
||||
|
||||
/*if(in_rotation_rate == NULL)
|
||||
{
|
||||
rotation_rate.p = rotation_rate.b = rotation_rate.h = 0.0f;
|
||||
|
||||
rotation_rate_delta_time = rotation_rate_delta_time_left = in_rotation_acceleration_time = 0.0f;
|
||||
rotation_rate_decel_time_til = -1.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
rotation_rate_delta_time = rotation_rate_delta_time_left = in_rotation_acceleration_time;
|
||||
rotation_rate_decel_time_til = -1.0f;
|
||||
|
||||
rotation_rate_delta.p = in_rotation_rate->p / in_rotation_acceleration_time;
|
||||
rotation_rate_delta.b = in_rotation_rate->b / in_rotation_acceleration_time;
|
||||
rotation_rate_delta.h = in_rotation_rate->h / in_rotation_acceleration_time;*/
|
||||
}
|
||||
|
||||
void camera::do_frame(float in_frametime)
|
||||
{
|
||||
//float frametime, rot_frametime, trans_frametime;
|
||||
//DO ROTATION STUFF
|
||||
if(desired_orientation != NULL)
|
||||
{
|
||||
matrix ori_out;
|
||||
vec3d vel_out;
|
||||
|
||||
vm_matrix_interpolate(desired_orientation, &orientation, &rotation_rate, in_frametime, &ori_out, &vel_out, &rotation_vel_limit, &rotation_acc_limit, 1);
|
||||
orientation = ori_out;
|
||||
rotation_rate = vel_out;
|
||||
|
||||
//TODO: Make this "if(*desired_orienation == orientation)"
|
||||
//Note that this means we are finished rotating
|
||||
if(vel_out.xyz.x == 0.0f && vel_out.xyz.y == 0.0f && vel_out.xyz.z == 0.0f)
|
||||
{
|
||||
delete desired_orientation;
|
||||
desired_orientation = NULL;
|
||||
rotation_rate = rotation_vel_limit = rotation_acc_limit = vmd_zero_vector;
|
||||
}
|
||||
}
|
||||
else if(rotation_rate.xyz.x || rotation_rate.xyz.y || rotation_rate.xyz.z)
|
||||
{
|
||||
//TODO: Make this right.
|
||||
angles new_orientation;
|
||||
vm_angles_2_matrix(&orientation, &new_orientation);
|
||||
new_orientation.p += rotation_rate.xyz.z;
|
||||
new_orientation.b += rotation_rate.xyz.x;
|
||||
new_orientation.h += rotation_rate.xyz.y;
|
||||
vm_angles_2_matrix(&orientation, &new_orientation);
|
||||
}
|
||||
|
||||
/* rot_frametime = trans_frametime = in_frametime;
|
||||
|
||||
do
|
||||
{
|
||||
frametime = rot_frametime;
|
||||
if(rotation_rate_delta_time_left || rotation_rate_decel_time_til > 0.0f)
|
||||
{
|
||||
if(frametime > rotation_rate_delta_time_left && rotation_rate_delta_time_left)
|
||||
frametime = rotation_rate_delta_time_left;
|
||||
if(frametime > rotation_rate_decel_time_til && rotation_rate_decel_time_til > 0.0f)
|
||||
frametime = rotation_rate_decel_time_til;
|
||||
|
||||
if(rotation_rate_delta_time_left)
|
||||
{
|
||||
rotation_rate.p += (rotation_rate_delta.p) * frametime;
|
||||
rotation_rate.b += (rotation_rate_delta.b) * frametime;
|
||||
rotation_rate.h += (rotation_rate_delta.h) * frametime;
|
||||
}
|
||||
|
||||
//mprintf(("DX:%f DY:%f DZ:%f",rotation_rate_delta.p,rotation_rate_delta.b,rotation_rate_delta.h));
|
||||
//mprintf(( " X:%f", rotation_rate.p));
|
||||
//mprintf(( " Y:%f", rotation_rate.b));
|
||||
//mprintf(( " Z:%f\n", rotation_rate.h));
|
||||
|
||||
if(rotation_rate_delta_time_left)
|
||||
{
|
||||
rotation_rate_delta_time_left -= frametime;
|
||||
}
|
||||
if(rotation_rate_decel_time_til > 0.0f)
|
||||
{
|
||||
rotation_rate_decel_time_til -= frametime;
|
||||
if(rotation_rate_decel_time_til == 0.0f)
|
||||
{
|
||||
rotation_rate_delta.p *= -1.0f;
|
||||
rotation_rate_delta.b *= -1.0f;
|
||||
rotation_rate_delta.h *= -1.0f;
|
||||
|
||||
rotation_rate_delta_time_left = rotation_rate_delta_time;
|
||||
rotation_rate_decel_time_til = -1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
rot_frametime -= frametime;
|
||||
} while(rot_frametime);*/
|
||||
|
||||
//DO TRANSLATION STUFF
|
||||
// float frametime = in_frametime;
|
||||
/*if(translation_time_left)
|
||||
{
|
||||
if(in_frametime > translation_time_left)
|
||||
frametime = translation_time_left;
|
||||
else
|
||||
frametime = in_frametime;
|
||||
|
||||
vm_vec_scale_add2(&translation_velocity, &translation_velocity_delta, frametime);
|
||||
|
||||
translation_time_left -= frametime;
|
||||
}*/
|
||||
|
||||
vm_vec_scale_add2(&position, &translation_velocity, in_frametime);
|
||||
}
|
||||
|
||||
#define MAX_SUBTITLE_LINES 10
|
||||
subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, float in_display_time, char* in_imageanim, float in_fade_time, color *in_text_color, bool center_x, bool center_y, int in_width)
|
||||
{
|
||||
//Setup text
|
||||
int len = strlen(in_text);
|
||||
if(len == 0)
|
||||
return;
|
||||
|
||||
int num_text_lines;
|
||||
char *text_line_ptrs[MAX_SUBTITLE_LINES];
|
||||
int text_line_lens[MAX_SUBTITLE_LINES];
|
||||
num_text_lines = split_str(in_text, in_width, text_line_lens, text_line_ptrs, MAX_SUBTITLE_LINES);
|
||||
std::string temp_str;
|
||||
for(int i = 0; i < num_text_lines; i++)
|
||||
{
|
||||
temp_str.assign(text_line_ptrs[i], text_line_lens[i]);
|
||||
text_lines.push_back(temp_str);
|
||||
}
|
||||
|
||||
//Setup text color
|
||||
if(in_text_color)
|
||||
text_color = *in_text_color;
|
||||
else
|
||||
gr_init_alphacolor(&text_color, 255, 255, 255, 255);
|
||||
|
||||
//Setup display and fade time
|
||||
display_time = fl_abs(in_display_time);
|
||||
fade_time = fl_abs(in_fade_time);
|
||||
|
||||
//Setup image
|
||||
image_id = -1;
|
||||
if(in_imageanim != NULL)
|
||||
{
|
||||
len = strlen(in_imageanim);
|
||||
if(len != 0 && len < MAX_FILENAME_LEN)
|
||||
{
|
||||
image_id = bm_load(in_imageanim);
|
||||
if(image_id != -1)
|
||||
strcpy(imageanim, in_imageanim);
|
||||
}
|
||||
}
|
||||
|
||||
//Setup pos
|
||||
int w=0, h=0, tw=0, th=0;
|
||||
image_pos[0] = 0;
|
||||
image_pos[1] = 0;
|
||||
if(center_x || center_y)
|
||||
{
|
||||
//Get text size
|
||||
for(int i = 0; i < num_text_lines; i++)
|
||||
{
|
||||
gr_get_string_size(&w, &h, text_line_ptrs[i], text_line_lens[i]);
|
||||
|
||||
if(w > tw)
|
||||
tw = w;
|
||||
|
||||
th += h;
|
||||
}
|
||||
|
||||
//Get image size
|
||||
if(image_id != -1)
|
||||
{
|
||||
bm_get_info(image_id, &w, &h);
|
||||
tw += w;
|
||||
if(h > th)
|
||||
th = h;
|
||||
}
|
||||
|
||||
//Center it?
|
||||
if(center_x)
|
||||
image_pos[0] = (gr_screen.max_w - tw)/2;
|
||||
if(center_y)
|
||||
image_pos[0] = (gr_screen.max_h - th)/2;
|
||||
}
|
||||
if(in_x_pos < 0 && !center_x)
|
||||
image_pos[0] += gr_screen.max_w + in_x_pos;
|
||||
else
|
||||
image_pos[0] += in_x_pos;
|
||||
|
||||
if(in_y_pos < 0 && !center_y)
|
||||
image_pos[1] += gr_screen.max_h + in_y_pos;
|
||||
else
|
||||
image_pos[1] += in_y_pos;
|
||||
|
||||
if(image_id != -1)
|
||||
text_pos[0] = image_pos[0] + w; //Still set from bm_get_info call
|
||||
else
|
||||
text_pos[0] = image_pos[0];
|
||||
text_pos[1] = image_pos[1];
|
||||
|
||||
time_displayed = 0.0f;
|
||||
time_displayed_end = 2.0f*fade_time + display_time;
|
||||
}
|
||||
void subtitle::do_frame(float frametime)
|
||||
{
|
||||
//Figure out how much alpha
|
||||
if(time_displayed < fade_time)
|
||||
{
|
||||
text_color.alpha = (ubyte)fl2i(255.0f*(time_displayed/fade_time));
|
||||
}
|
||||
else if(time_displayed > time_displayed_end)
|
||||
{
|
||||
//We're finished
|
||||
if(image_id != -1)
|
||||
{
|
||||
bm_unload(image_id);
|
||||
image_id = -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if((time_displayed - fade_time) > display_time)
|
||||
{
|
||||
text_color.alpha = (ubyte)fl2i(255.0f*(1-(time_displayed - fade_time - display_time)/fade_time));
|
||||
}
|
||||
else
|
||||
{
|
||||
text_color.alpha = 255;
|
||||
}
|
||||
|
||||
gr_set_color_fast(&text_color);
|
||||
|
||||
int font_height = gr_get_font_height();
|
||||
int y = text_pos[1];
|
||||
|
||||
for(unsigned int i = 0; i < text_lines.size(); i++)
|
||||
{
|
||||
gr_string(text_pos[0], y, (char*)text_lines[i].c_str(), false);
|
||||
y += font_height;
|
||||
}
|
||||
|
||||
if(image_id != -1)
|
||||
{
|
||||
gr_set_bitmap(image_id, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, text_color.alpha/255.0f);
|
||||
gr_bitmap(image_pos[0], image_pos[1], false);
|
||||
}
|
||||
|
||||
time_displayed += frametime;
|
||||
}
|
||||
subtitle::~subtitle()
|
||||
{
|
||||
if(image_id != -1)
|
||||
bm_unload(image_id);
|
||||
}
|
||||
|
||||
void cameras_init()
|
||||
{
|
||||
camera handy_camera;
|
||||
|
||||
//Preset cameras
|
||||
Cameras.push_back(handy_camera);
|
||||
Free_camera = &Cameras[Cameras.size()-1];
|
||||
}
|
||||
|
||||
void cameras_close()
|
||||
{
|
||||
Cameras.clear();
|
||||
|
||||
//Preset cameras
|
||||
Free_camera = NULL;
|
||||
}
|
||||
|
||||
void cameras_do_frame(float frametime)
|
||||
{
|
||||
unsigned int i,size=Cameras.size();
|
||||
for(i = 0; i < size; i++)
|
||||
{
|
||||
Cameras[i].do_frame(frametime);
|
||||
}
|
||||
}
|
||||
|
||||
void subtitles_init()
|
||||
{
|
||||
//Do nothing!!
|
||||
}
|
||||
|
||||
void subtitles_close()
|
||||
{
|
||||
Subtitles.clear();
|
||||
}
|
||||
|
||||
void subtitles_do_frame(float frametime)
|
||||
{
|
||||
unsigned int i,size=Subtitles.size();
|
||||
for(i = 0; i < size; i++)
|
||||
{
|
||||
Subtitles[i].do_frame(frametime);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
#ifndef _CAMERA_H
|
||||
#define _CAMERA_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/2d.h"
|
||||
|
||||
class camera
|
||||
{
|
||||
private:
|
||||
vec3d position;
|
||||
vec3d *desired_position; //NULL unless we're trying to move somewhere
|
||||
vec3d translation_velocity;
|
||||
vec3d translation_vel_limit;
|
||||
vec3d translation_acc_limit;
|
||||
|
||||
matrix orientation;
|
||||
matrix *desired_orientation; //NULL unless we're trying to point somewhere
|
||||
vec3d rotation_rate;
|
||||
vec3d rotation_vel_limit;
|
||||
vec3d rotation_acc_limit;
|
||||
public:
|
||||
camera();
|
||||
~camera();
|
||||
void reset();
|
||||
|
||||
//Set
|
||||
void set_position(vec3d *in_position, float in_translation_time = 0.0f, float in_translation_acceleration_time = 0.0f);
|
||||
void set_translation_velocity(vec3d *in_velocity);
|
||||
void set_rotation(matrix *in_orientation, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
|
||||
void set_rotation(angles *in_angles, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
|
||||
void set_rotation_facing(vec3d *in_target, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f);
|
||||
void set_rotation_velocity(vec3d *in_rotation_rate);
|
||||
|
||||
//Get
|
||||
//These return values should never ever be changed, I do this in the interest of speed.
|
||||
vec3d *get_position() {return &position;}
|
||||
matrix *get_orientation() {return &orientation;}
|
||||
|
||||
//Do
|
||||
void do_frame(float in_frametime);
|
||||
};
|
||||
|
||||
class subtitle
|
||||
{
|
||||
private:
|
||||
std::vector<std::string> text_lines;
|
||||
int text_pos[2];
|
||||
|
||||
float display_time;
|
||||
float fade_time;
|
||||
color text_color;
|
||||
|
||||
//Done with set
|
||||
char imageanim[MAX_FILENAME_LEN];
|
||||
int image_id;
|
||||
int image_pos[2];
|
||||
|
||||
//Time this has been displayed
|
||||
float time_displayed;
|
||||
|
||||
//When to end it
|
||||
float time_displayed_end;
|
||||
public:
|
||||
subtitle(int in_x_pos, int in_y_pos, char* in_text, float in_display_time, char* in_imageanim = NULL, float in_fade_time = 0.0f, color *in_text_color = NULL, bool center_x = false, bool center_y = false, int in_width = 200);
|
||||
~subtitle();
|
||||
|
||||
void do_frame(float frametime);
|
||||
};
|
||||
|
||||
//Some global stuff
|
||||
extern std::vector<subtitle> Subtitles;
|
||||
extern std::vector<camera> Cameras;
|
||||
//Preset cameras
|
||||
extern camera* Free_camera;
|
||||
|
||||
//Helpful functions
|
||||
void cameras_init();
|
||||
void cameras_close();
|
||||
void cameras_do_frame(float frametime);
|
||||
void subtitles_init();
|
||||
void subtitles_close();
|
||||
void subtitles_do_frame(float frametime);
|
||||
|
||||
#endif // _CAMERA_H
|
||||
+106
-50
@@ -9,13 +9,60 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/cfile.cpp $
|
||||
* $Revision: 2.15 $
|
||||
* $Date: 2004-05-06 22:12:14 $
|
||||
* $Revision: 2.30 $
|
||||
* $Date: 2005-04-19 06:22:20 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Utilities for operating on files
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.29 2005/04/05 05:53:14 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.28 2005/03/02 03:13:00 taylor
|
||||
* that one should never have slipped passed me (Linux specific)
|
||||
*
|
||||
* Revision 2.27 2005/01/30 18:32:41 taylor
|
||||
* merge with Linux/OSX tree - p0130
|
||||
* remove extra brace in cfile.cpp
|
||||
*
|
||||
* Revision 2.26 2005/01/30 12:50:08 taylor
|
||||
* merge with Linux/OSX tree - p0130
|
||||
*
|
||||
* Revision 2.25 2005/01/09 21:40:07 wmcoolmon
|
||||
* Fix for music directory parent
|
||||
*
|
||||
* Revision 2.24 2004/12/25 00:22:54 wmcoolmon
|
||||
* Added .ogg in proper directories
|
||||
*
|
||||
* Revision 2.23 2004/10/31 21:29:00 taylor
|
||||
* EFF animation support
|
||||
*
|
||||
* Revision 2.22 2004/10/09 18:08:33 taylor
|
||||
* almost forgot this for the IBX stuff
|
||||
*
|
||||
* Revision 2.21 2004/07/26 20:47:25 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.20 2004/07/17 09:03:29 taylor
|
||||
* make sure avi and mpg movies get added to file cache
|
||||
*
|
||||
* Revision 2.19 2004/07/12 16:32:42 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.18 2004/06/22 23:14:09 wmcoolmon
|
||||
* Nonworking OGG support for sound (not music) added, disabled load-only-used-weapons code, modification to sound system registry code.
|
||||
* OGG code has been commented out, so you don't need the SDK yet.
|
||||
*
|
||||
* Revision 2.17 2004/05/26 02:29:44 wmcoolmon
|
||||
* Scratch that - .tbm is a better extension
|
||||
*
|
||||
* Revision 2.16 2004/05/26 02:26:14 wmcoolmon
|
||||
* Added table chunk extension
|
||||
*
|
||||
* Revision 2.15 2004/05/06 22:12:14 taylor
|
||||
* make sure JPG and DDS files are added to the file cache for maps and effects
|
||||
*
|
||||
* Revision 2.14 2004/03/05 09:01:54 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
@@ -249,7 +296,7 @@
|
||||
#include <winbase.h> /* needed for memory mapping of file functions */
|
||||
#endif
|
||||
|
||||
#ifdef unix
|
||||
#ifdef SCP_UNIX
|
||||
#include <sys/stat.h>
|
||||
#include <glob.h>
|
||||
#include <sys/mman.h>
|
||||
@@ -259,8 +306,14 @@
|
||||
#include "parse/encrypt.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "cfile/cfilearchive.h"
|
||||
#include "osapi/osapi.h"
|
||||
|
||||
|
||||
|
||||
char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
#ifdef SCP_UNIX
|
||||
char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN] = "";
|
||||
#endif
|
||||
|
||||
// During cfile_init, verify that Pathtypes[n].index == n for each item
|
||||
// Each path must have a valid parent that can be tracable all the way back to the root
|
||||
@@ -272,34 +325,34 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
|
||||
// What type this is Path Extensions Parent type
|
||||
{ CF_TYPE_INVALID, NULL, NULL, CF_TYPE_INVALID },
|
||||
// Root must be index 1!!
|
||||
{ CF_TYPE_ROOT, "", ".mve", CF_TYPE_ROOT },
|
||||
{ CF_TYPE_ROOT, "", ".mve .avi .mpg", CF_TYPE_ROOT },
|
||||
{ CF_TYPE_DATA, "data", ".cfg .log .txt", CF_TYPE_ROOT },
|
||||
{ CF_TYPE_MAPS, "data" DIR_SEPARATOR_STR "maps", ".pcx .ani .tga .jpg .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_MAPS, "data" DIR_SEPARATOR_STR "maps", ".pcx .ani .eff .tga .jpg .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_TEXT, "data" DIR_SEPARATOR_STR "text", ".txt .net", CF_TYPE_DATA },
|
||||
{ CF_TYPE_MISSIONS, "data" DIR_SEPARATOR_STR "missions", ".fs2 .fc2 .ntl .ssv", CF_TYPE_DATA },
|
||||
{ CF_TYPE_MODELS, "data" DIR_SEPARATOR_STR "models", ".pof", CF_TYPE_DATA },
|
||||
{ CF_TYPE_TABLES, "data" DIR_SEPARATOR_STR "tables", ".tbl", CF_TYPE_DATA },
|
||||
{ CF_TYPE_SOUNDS, "data" DIR_SEPARATOR_STR "sounds", ".wav", CF_TYPE_DATA },
|
||||
{ CF_TYPE_SOUNDS_8B22K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "8b22k", ".wav", CF_TYPE_SOUNDS },
|
||||
{ CF_TYPE_SOUNDS_16B11K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "16b11k", ".wav", CF_TYPE_SOUNDS },
|
||||
{ CF_TYPE_TABLES, "data" DIR_SEPARATOR_STR "tables", ".tbl .tbm", CF_TYPE_DATA },
|
||||
{ CF_TYPE_SOUNDS, "data" DIR_SEPARATOR_STR "sounds", ".wav .ogg", CF_TYPE_DATA },
|
||||
{ CF_TYPE_SOUNDS_8B22K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "8b22k", ".wav .ogg", CF_TYPE_SOUNDS },
|
||||
{ CF_TYPE_SOUNDS_16B11K, "data" DIR_SEPARATOR_STR "sounds" DIR_SEPARATOR_STR "16b11k", ".wav .ogg", CF_TYPE_SOUNDS },
|
||||
{ CF_TYPE_VOICE, "data" DIR_SEPARATOR_STR "voice", "", CF_TYPE_DATA },
|
||||
{ CF_TYPE_VOICE_BRIEFINGS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "briefing", ".wav", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_CMD_BRIEF, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "command_briefings", ".wav", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_DEBRIEFINGS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "debriefing", ".wav", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_PERSONAS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "personas", ".wav", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_SPECIAL, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "special", ".wav", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_TRAINING, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "training", ".wav", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_MUSIC, "data" DIR_SEPARATOR_STR "music", ".wav", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_MOVIES, "data" DIR_SEPARATOR_STR "movies", ".mve .msb", CF_TYPE_DATA },
|
||||
{ CF_TYPE_VOICE_BRIEFINGS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "briefing", ".wav .ogg", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_CMD_BRIEF, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "command_briefings", ".wav .ogg", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_DEBRIEFINGS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "debriefing", ".wav .ogg", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_PERSONAS, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "personas", ".wav .ogg", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_SPECIAL, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "special", ".wav .ogg", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_VOICE_TRAINING, "data" DIR_SEPARATOR_STR "voice" DIR_SEPARATOR_STR "training", ".wav .ogg", CF_TYPE_VOICE },
|
||||
{ CF_TYPE_MUSIC, "data" DIR_SEPARATOR_STR "music", ".wav .ogg", CF_TYPE_DATA },
|
||||
{ CF_TYPE_MOVIES, "data" DIR_SEPARATOR_STR "movies", ".mve .msb .avi .mpg", CF_TYPE_DATA },
|
||||
{ CF_TYPE_INTERFACE, "data" DIR_SEPARATOR_STR "interface", ".pcx .ani .tga", CF_TYPE_DATA },
|
||||
{ CF_TYPE_FONT, "data" DIR_SEPARATOR_STR "fonts", ".vf", CF_TYPE_DATA },
|
||||
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .pcx .neb .tga .jpg .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .eff .pcx .neb .tga .jpg .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_HUD, "data" DIR_SEPARATOR_STR "hud", ".ani .pcx .tga", CF_TYPE_DATA },
|
||||
{ CF_TYPE_PLAYER_MAIN, "data" DIR_SEPARATOR_STR "players", "", CF_TYPE_DATA },
|
||||
{ CF_TYPE_PLAYER_IMAGES_MAIN, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "images", ".pcx", CF_TYPE_PLAYER_MAIN },
|
||||
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp", CF_TYPE_DATA }, //clr=cached color
|
||||
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx", CF_TYPE_DATA }, //clr=cached color
|
||||
{ CF_TYPE_PLAYERS, "data" DIR_SEPARATOR_STR "players", ".hcf", CF_TYPE_DATA },
|
||||
{ CF_TYPE_SINGLE_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "single", ".plr .csg .css", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_SINGLE_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "single", ".pl2 .cs2 .plr .csg .css", CF_TYPE_PLAYERS },
|
||||
{ CF_TYPE_MULTI_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "multi", ".plr", CF_TYPE_DATA },
|
||||
{ CF_TYPE_MULTI_CACHE, "data" DIR_SEPARATOR_STR "multidata", ".pcx .fs2", CF_TYPE_DATA },
|
||||
{ CF_TYPE_CONFIG, "data" DIR_SEPARATOR_STR "config", ".cfg", CF_TYPE_DATA },
|
||||
@@ -331,7 +384,7 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size);
|
||||
|
||||
#if defined _WIN32
|
||||
CFILE *cf_open_mapped_fill_cfblock(HANDLE hFile, int type);
|
||||
#elif defined unix
|
||||
#elif defined SCP_UNIX
|
||||
CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type);
|
||||
#endif
|
||||
|
||||
@@ -399,11 +452,7 @@ int cfile_init(char *exe_dir, char *cdrom_dir)
|
||||
|
||||
// are we in a root directory?
|
||||
if(cfile_in_root_dir(buf)){
|
||||
#if defined _WIN32
|
||||
MessageBox((HWND)NULL, "Freespace2/Fred2 cannot be run from a drive root directory!", "Error", MB_OK);
|
||||
#elif defined unix
|
||||
fprintf(stderr, "Error: Freespace2/Fred2 cannot be run from a drive root directory!\n");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -417,16 +466,15 @@ int cfile_init(char *exe_dir, char *cdrom_dir)
|
||||
buf[i] = 0;
|
||||
cfile_chdir(buf);
|
||||
} else {
|
||||
#if defined _WIN32
|
||||
MessageBox((HWND)NULL, "Error trying to determine executable root directory!", "Error", MB_OK);
|
||||
#elif defined unix
|
||||
fprintf(stderr, "Error trying to determine executable root directory!\n");
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
// set root directory
|
||||
strncpy(Cfile_root_dir, buf, CFILE_ROOT_DIRECTORY_LEN-1);
|
||||
#ifdef SCP_UNIX
|
||||
snprintf(Cfile_user_dir, MAX_PATH, "%s/%s/", detect_home(), Osreg_user_dir);
|
||||
#endif
|
||||
|
||||
for ( i = 0; i < MAX_CFILE_BLOCKS; i++ ) {
|
||||
Cfile_block_list[i].type = CFILE_BLOCK_UNUSED;
|
||||
@@ -486,7 +534,7 @@ int cfile_push_chdir(int type)
|
||||
int e;
|
||||
char dir[128];
|
||||
char OriginalDirectory[128];
|
||||
char *Drive, *Path;
|
||||
char *Drive = NULL, *Path = NULL;
|
||||
char NoDir[] = "\\.";
|
||||
|
||||
_getcwd(OriginalDirectory, 127);
|
||||
@@ -530,7 +578,7 @@ int cfile_chdir(char *dir)
|
||||
{
|
||||
int e;
|
||||
char OriginalDirectory[128];
|
||||
char *Drive, *Path;
|
||||
char *Drive = NULL, *Path = NULL;
|
||||
char NoDir[] = "\\.";
|
||||
|
||||
_getcwd(OriginalDirectory, 127);
|
||||
@@ -575,7 +623,6 @@ int cfile_pop_dir()
|
||||
// NOTE : WILL NOT DELETE READ-ONLY FILES
|
||||
int cfile_flush_dir(int dir_type)
|
||||
{
|
||||
int find_handle;
|
||||
int del_count;
|
||||
|
||||
Assert( CF_TYPE_SPECIFIED(dir_type) );
|
||||
@@ -588,6 +635,7 @@ int cfile_flush_dir(int dir_type)
|
||||
// proceed to delete the files
|
||||
del_count = 0;
|
||||
#if defined _WIN32
|
||||
int find_handle;
|
||||
_finddata_t find;
|
||||
find_handle = _findfirst( "*", &find );
|
||||
if (find_handle != -1) {
|
||||
@@ -602,7 +650,7 @@ int cfile_flush_dir(int dir_type)
|
||||
} while (!_findnext(find_handle, &find));
|
||||
_findclose( find_handle );
|
||||
}
|
||||
#elif defined unix
|
||||
#elif defined SCP_UNIX
|
||||
glob_t globinfo;
|
||||
memset(&globinfo, 0, sizeof(globinfo));
|
||||
int status = glob("*", 0, NULL, &globinfo);
|
||||
@@ -842,7 +890,11 @@ CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize
|
||||
|
||||
if ( strchr(mode,'w') ) {
|
||||
// For write-only files, require a full path or a path type
|
||||
if ( strpbrk(file_path,"/\\:") ) {
|
||||
#ifdef SCP_UNIX
|
||||
if ( strpbrk(file_path, "/") ) {
|
||||
#else
|
||||
if ( strpbrk(file_path,"/\\:") ) {
|
||||
#endif
|
||||
// Full path given?
|
||||
strcpy(longname, file_path );
|
||||
} else {
|
||||
@@ -890,7 +942,7 @@ CFILE *cfopen(char *file_path, char *mode, int type, int dir_type, bool localize
|
||||
if (hFile != INVALID_HANDLE_VALUE) {
|
||||
return cf_open_mapped_fill_cfblock(hFile, dir_type);
|
||||
}
|
||||
#elif defined unix
|
||||
#elif defined SCP_UNIX
|
||||
FILE *fp = fopen( longname, "rb" );
|
||||
if (fp) {
|
||||
return cf_open_mapped_fill_cfblock(fp, dir_type);
|
||||
@@ -993,9 +1045,13 @@ int cfclose( CFILE * cfile )
|
||||
result = CloseHandle(cb->hMapFile);
|
||||
Assert(result); // Ensure file handle is closed properly
|
||||
result = 0;
|
||||
#elif defined unix
|
||||
result = munmap(cb->data, cb->data_length);
|
||||
Assert(result);
|
||||
#elif defined SCP_UNIX
|
||||
// FIXME: result is wrong after munmap() but it is successful
|
||||
//result = munmap(cb->data, cb->data_length);
|
||||
//Assert(result);
|
||||
munmap(cb->data, cb->data_length);
|
||||
if ( cb->fp != NULL)
|
||||
result = fclose(cb->fp);
|
||||
#endif
|
||||
|
||||
} else if ( cb->fp != NULL ) {
|
||||
@@ -1024,6 +1080,7 @@ CFILE *cf_open_fill_cfblock(FILE *fp, int type)
|
||||
|
||||
cfile_block_index = cfget_cfile_block();
|
||||
if ( cfile_block_index == -1 ) {
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
} else {
|
||||
CFILE *cfp;
|
||||
@@ -1036,13 +1093,7 @@ CFILE *cf_open_fill_cfblock(FILE *fp, int type)
|
||||
cfbp->fp = fp;
|
||||
cfbp->dir_type = type;
|
||||
|
||||
#if defined _WIN32
|
||||
cf_init_lowlevel_read_code(cfp,0,filelength(fileno(fp)) );
|
||||
#elif defined unix
|
||||
struct stat statbuf;
|
||||
fstat(fileno(fp), &statbuf);
|
||||
cf_init_lowlevel_read_code(cfp, 0, statbuf.st_size );
|
||||
#endif
|
||||
|
||||
return cfp;
|
||||
}
|
||||
@@ -1062,6 +1113,7 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
|
||||
|
||||
cfile_block_index = cfget_cfile_block();
|
||||
if ( cfile_block_index == -1 ) {
|
||||
fclose(fp);
|
||||
return NULL;
|
||||
} else {
|
||||
CFILE *cfp;
|
||||
@@ -1091,7 +1143,7 @@ CFILE *cf_open_packed_cfblock(FILE *fp, int type, int offset, int size)
|
||||
//
|
||||
#if defined _WIN32
|
||||
CFILE *cf_open_mapped_fill_cfblock(HANDLE hFile, int type)
|
||||
#elif defined unix
|
||||
#elif defined SCP_UNIX
|
||||
CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
|
||||
#endif
|
||||
{
|
||||
@@ -1099,6 +1151,9 @@ CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
|
||||
|
||||
cfile_block_index = cfget_cfile_block();
|
||||
if ( cfile_block_index == -1 ) {
|
||||
#ifdef SCP_UNIX
|
||||
fclose(fp);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
@@ -1124,8 +1179,9 @@ CFILE *cf_open_mapped_fill_cfblock(FILE *fp, int type)
|
||||
|
||||
cfbp->data = (ubyte*)MapViewOfFile(cfbp->hMapFile, FILE_MAP_READ, 0, 0, 0);
|
||||
Assert( cfbp->data != NULL );
|
||||
#elif defined unix
|
||||
#elif defined SCP_UNIX
|
||||
cfbp->fp = fp;
|
||||
cfbp->data_length = filelength( fileno(fp) );
|
||||
cfbp->data = mmap(NULL, // start
|
||||
cfbp->data_length, // length
|
||||
PROT_READ, // prot
|
||||
@@ -1183,7 +1239,7 @@ float cfread_float(CFILE *file, int ver, float deflt)
|
||||
if (cfread( &f, sizeof(f), 1, file) != 1)
|
||||
return deflt;
|
||||
|
||||
// i = INTEL_INT(i); // hmm, not sure what to do here
|
||||
f = INTEL_FLOAT(&f);
|
||||
return f;
|
||||
}
|
||||
|
||||
@@ -1256,7 +1312,7 @@ ubyte cfread_ubyte(CFILE *file, int ver, ubyte deflt)
|
||||
return b;
|
||||
}
|
||||
|
||||
void cfread_vector(vector *vec, CFILE *file, int ver, vector *deflt)
|
||||
void cfread_vector(vec3d *vec, CFILE *file, int ver, vec3d *deflt)
|
||||
{
|
||||
if (file->version < ver) {
|
||||
if (deflt)
|
||||
@@ -1329,7 +1385,7 @@ void cfread_string_len(char *buf,int n, CFILE *file)
|
||||
|
||||
int cfwrite_float(float f, CFILE *file)
|
||||
{
|
||||
// i = INTEL_INT(i); // hmm, not sure what to do here
|
||||
f = INTEL_FLOAT(&f);
|
||||
return cfwrite(&f, sizeof(f), 1, file);
|
||||
}
|
||||
|
||||
@@ -1362,7 +1418,7 @@ int cfwrite_ubyte(ubyte b, CFILE *file)
|
||||
return cfwrite(&b, sizeof(b), 1, file);
|
||||
}
|
||||
|
||||
int cfwrite_vector(vector *vec, CFILE *file)
|
||||
int cfwrite_vector(vec3d *vec, CFILE *file)
|
||||
{
|
||||
if(!cfwrite_float(vec->xyz.x, file)){
|
||||
return 0;
|
||||
|
||||
@@ -9,13 +9,28 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/cfile.h $
|
||||
* $Revision: 2.7 $
|
||||
* $Date: 2003-08-20 08:12:08 $
|
||||
* $Author: wmcoolmon $
|
||||
* $Revision: 2.12 $
|
||||
* $Date: 2005-07-13 02:50:49 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* <insert description of file here>
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.11 2005/04/05 05:53:14 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.10 2005/01/30 12:50:08 taylor
|
||||
* merge with Linux/OSX tree - p0130
|
||||
*
|
||||
* Revision 2.9 2004/08/11 05:06:19 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.8 2004/05/26 21:02:26 wmcoolmon
|
||||
* Added weapons_expl modular table, updated cfilesystem to work with modular tables, fixed loading order, fixed ship loading error messages
|
||||
*
|
||||
* Revision 2.7 2003/08/20 08:12:08 wmcoolmon
|
||||
* Made cfile_delete return 0 on failure, 1 on success
|
||||
*
|
||||
* Revision 2.6 2002/11/10 16:29:53 DTP
|
||||
* -DTP reworked mod support,
|
||||
*
|
||||
@@ -359,13 +374,14 @@
|
||||
#ifndef __CFILE_H__
|
||||
#define __CFILE_H__
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#if defined _WIN32
|
||||
#define DIR_SEPARATOR_CHAR '\\'
|
||||
#define DIR_SEPARATOR_STR "\\"
|
||||
#elif defined unix
|
||||
#elif defined SCP_UNIX
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#define DIR_SEPARATOR_STR "/"
|
||||
#else
|
||||
@@ -444,6 +460,7 @@ typedef struct {
|
||||
#define CF_SORT_NONE 0
|
||||
#define CF_SORT_NAME 1
|
||||
#define CF_SORT_TIME 2
|
||||
#define CF_SORT_REVERSE 3
|
||||
|
||||
#define cfread_fix(file) (fix)cfread_int(file)
|
||||
#define cfwrite_fix(i,file) cfwrite_int(i,file)
|
||||
@@ -455,6 +472,9 @@ extern int (*Get_file_list_filter)(char *filename);
|
||||
// cfile directory. valid after cfile_init() returns successfully
|
||||
#define CFILE_ROOT_DIRECTORY_LEN 256
|
||||
extern char Cfile_root_dir[CFILE_ROOT_DIRECTORY_LEN];
|
||||
#ifdef SCP_UNIX
|
||||
extern char Cfile_user_dir[CFILE_ROOT_DIRECTORY_LEN];
|
||||
#endif
|
||||
|
||||
//================= LOW-LEVEL FUNCTIONS ==================
|
||||
// Call this once at the beginning of the program
|
||||
@@ -586,7 +606,7 @@ ushort cfread_ushort(CFILE *file, int ver = 0, ushort deflt = 0);
|
||||
int cfread_int(CFILE *file, int ver = 0, int deflt = 0);
|
||||
uint cfread_uint(CFILE *file, int ver = 0, uint deflt = 0);
|
||||
float cfread_float(CFILE *file, int ver = 0, float deflt = 0.0f);
|
||||
void cfread_vector(vector *vec, CFILE *file, int ver = 0, vector *deflt = NULL);
|
||||
void cfread_vector(vec3d *vec, CFILE *file, int ver = 0, vec3d *deflt = NULL);
|
||||
void cfread_angles(angles *ang, CFILE *file, int ver = 0, angles *deflt = NULL);
|
||||
|
||||
// Reads variable length, null-termined string. Will only read up
|
||||
@@ -604,7 +624,7 @@ int cfwrite_uint(uint i, CFILE *file);
|
||||
int cfwrite_short(short s, CFILE *file);
|
||||
int cfwrite_ushort(ushort s, CFILE *file);
|
||||
int cfwrite_ubyte(ubyte u, CFILE *file);
|
||||
int cfwrite_vector(vector *vec, CFILE *file);
|
||||
int cfwrite_vector(vec3d *vec, CFILE *file);
|
||||
int cfwrite_angles(angles *ang, CFILE *file);
|
||||
|
||||
// writes variable length, null-termined string.
|
||||
|
||||
@@ -9,14 +9,24 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/CfileArchive.cpp $
|
||||
* $Revision: 2.4 $
|
||||
* $Date: 2004-03-05 09:01:54 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 2.7 $
|
||||
* $Date: 2005-07-24 18:31:17 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Low-level code for reading data out of large archive files or normal files. All
|
||||
* reads/seeks come through here.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.6 2004/07/26 20:47:25 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.5 2004/07/12 16:32:42 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.4 2004/03/05 09:01:54 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.3 2003/03/19 09:05:25 Goober5000
|
||||
* more housecleaning, this time for debug warnings
|
||||
* --Goober5000
|
||||
@@ -103,6 +113,8 @@
|
||||
#include "cfile/cfile.h"
|
||||
#include "cfile/cfilearchive.h"
|
||||
|
||||
|
||||
|
||||
#define CHECK_POSITION
|
||||
|
||||
// Called once to setup the low-level reading code.
|
||||
@@ -241,7 +253,7 @@ int cfseek( CFILE *cfile, int offset, int where )
|
||||
|
||||
#if defined(CHECK_POSITION) && !defined(NDEBUG)
|
||||
int tmp_offset;
|
||||
tmp_offset = ftell(cb->fp) - cb->lib_offset;
|
||||
tmp_offset = (int)ftell(cb->fp) - cb->lib_offset;
|
||||
Assert(tmp_offset==cb->raw_position);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -9,14 +9,20 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/CfileArchive.h $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-07-07 19:55:58 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2005-07-13 02:50:49 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* External def's for CfileArchive.cpp. This should only be used
|
||||
* internally by cfile stuff.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.2 2004/08/11 05:06:19 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.1 2002/07/07 19:55:58 penguin
|
||||
* Back-port to MSVC
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:21 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
|
||||
@@ -9,13 +9,25 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/CfileList.cpp $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-08-01 01:41:04 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.6 $
|
||||
* $Date: 2005-01-31 23:27:51 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Code for doing directory lists and sorts
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.5 2004/07/26 20:47:25 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.4 2004/07/17 09:26:00 taylor
|
||||
* add CF_SORT_REVERSE to real sort routine, makes CF_SORT_TIME work again
|
||||
*
|
||||
* Revision 2.3 2004/07/12 16:32:42 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.2 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
* Revision 2.1 2002/07/29 19:37:21 penguin
|
||||
* added #ifdef _WIN32 around windows-specific system headers
|
||||
*
|
||||
@@ -74,6 +86,9 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
|
||||
|
||||
|
||||
// Sorts a list of filenames using the specified sorting method (CF_SORT_*).
|
||||
// n = number of filenames in list to sort
|
||||
// list = list of filenames to be sorted
|
||||
@@ -141,6 +156,22 @@ void cf_sort_filenames( int n, char **list, int sort, file_list_info *info )
|
||||
incr /= 2;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
} else if (sort == CF_SORT_REVERSE) {
|
||||
incr = n / 2;
|
||||
char buffer[MAX_FILENAME_LEN];
|
||||
|
||||
for (i = 0; i < incr; i++) {
|
||||
t = list[n - 1 - i];
|
||||
|
||||
if ( stricmp(list[i], t) > 0 ) {
|
||||
strcpy(buffer, list[i]);
|
||||
strcpy(list[i], t);
|
||||
strcpy(t, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,6 +179,8 @@ void cf_sort_filenames( int n, char **list, int sort, file_list_info *info )
|
||||
}
|
||||
|
||||
|
||||
#if (0) // these aren't used anywhere now
|
||||
|
||||
// cf_compress - Do Run Length Compression on a block of data. Targa format.
|
||||
//
|
||||
// Usage:
|
||||
@@ -317,6 +350,8 @@ int cf_decompress(char *out, char *in )
|
||||
|
||||
}
|
||||
|
||||
#endif // 0
|
||||
|
||||
|
||||
// cfread() reads from a file and decompresses it
|
||||
//
|
||||
|
||||
+325
-143
@@ -9,9 +9,9 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/CfileSystem.cpp $
|
||||
* $Revision: 2.17 $
|
||||
* $Date: 2004-05-03 21:22:19 $
|
||||
* $Author: Kazan $
|
||||
* $Revision: 2.26 $
|
||||
* $Date: 2005-05-12 17:49:10 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Functions to keep track of and find files that can exist
|
||||
* on the harddrive, cd-rom, or in a pack file on either of those.
|
||||
@@ -20,6 +20,35 @@
|
||||
* all those locations, inherently enforcing precedence orders.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.25 2005/01/30 12:50:08 taylor
|
||||
* merge with Linux/OSX tree - p0130
|
||||
*
|
||||
* Revision 2.24 2004/11/21 11:27:31 taylor
|
||||
* some 64-bit OS comaptibility fixes
|
||||
*
|
||||
* Revision 2.23 2004/10/31 21:28:38 taylor
|
||||
* support new pilot code, Linux code tree merge, don't use same pilot directory for Inferno builds
|
||||
*
|
||||
* Revision 2.22 2004/07/26 20:47:25 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.21 2004/07/17 09:26:00 taylor
|
||||
* add CF_SORT_REVERSE to real sort routine, makes CF_SORT_TIME work again
|
||||
*
|
||||
* Revision 2.20 2004/07/12 16:32:42 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.19 2004/05/26 22:02:36 wmcoolmon
|
||||
* Fixed cf_matches_spec; small bug was introduced.
|
||||
*
|
||||
* Revision 2.18 2004/05/26 21:02:26 wmcoolmon
|
||||
* Added weapons_expl modular table, updated cfilesystem to work with modular tables, fixed loading order, fixed ship loading error messages
|
||||
*
|
||||
* Revision 2.17 2004/05/03 21:22:19 Kazan
|
||||
* Abandon strdup() usage for mod list processing - it was acting odd and causing crashing on free()
|
||||
* Fix condition where alt_tab_pause() would flipout and trigger failed assert if game minimizes during startup (like it does a lot during debug)
|
||||
* Nav Point / Auto Pilot code (All disabled via #ifdefs)
|
||||
*
|
||||
* Revision 2.16 2004/05/01 21:47:43 Kazan
|
||||
* bah! stupid me "NULL" not "null" - i hate when i do that
|
||||
*
|
||||
@@ -168,9 +197,13 @@
|
||||
#include <winbase.h> /* needed for memory mapping of file functions */
|
||||
#endif
|
||||
|
||||
#ifdef unix
|
||||
#ifdef SCP_UNIX
|
||||
#include <glob.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <fnmatch.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "cmdline/cmdline.h"
|
||||
@@ -178,9 +211,14 @@
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "localization/localize.h"
|
||||
|
||||
|
||||
|
||||
#define CF_ROOTTYPE_PATH 0
|
||||
#define CF_ROOTTYPE_PACK 1
|
||||
|
||||
// for a defined and specifically set location to get/send pilot/campaign files
|
||||
char *Pilot_file_path = NULL;
|
||||
|
||||
// Created by:
|
||||
// specifying hard drive tree
|
||||
// searching for pack files on hard drive // Found by searching all known paths
|
||||
@@ -208,7 +246,8 @@ typedef struct cf_root_block {
|
||||
|
||||
static int Num_roots = 0;
|
||||
static cf_root_block *Root_blocks[CF_MAX_ROOT_BLOCKS];
|
||||
|
||||
|
||||
static int Num_path_roots = 0;
|
||||
|
||||
// Created by searching all roots in order. This means Files is then sorted by precedence.
|
||||
typedef struct cf_file {
|
||||
@@ -247,7 +286,7 @@ cf_file *cf_create_file()
|
||||
int offset = Num_files % CF_NUM_FILES_PER_BLOCK;
|
||||
|
||||
if ( File_blocks[block] == NULL ) {
|
||||
File_blocks[block] = (cf_file_block *)malloc( sizeof(cf_file_block) );
|
||||
File_blocks[block] = (cf_file_block *)vm_malloc( sizeof(cf_file_block) );
|
||||
Assert( File_blocks[block] != NULL);
|
||||
}
|
||||
|
||||
@@ -278,7 +317,7 @@ cf_root *cf_create_root()
|
||||
int offset = Num_roots % CF_NUM_ROOTS_PER_BLOCK;
|
||||
|
||||
if ( Root_blocks[block] == NULL ) {
|
||||
Root_blocks[block] = (cf_root_block *)malloc( sizeof(cf_root_block) );
|
||||
Root_blocks[block] = (cf_root_block *)vm_malloc( sizeof(cf_root_block) );
|
||||
Assert(Root_blocks[block] != NULL);
|
||||
}
|
||||
|
||||
@@ -299,10 +338,11 @@ int cf_get_packfile_count(cf_root *root)
|
||||
for (i=CF_TYPE_ROOT; i<CF_MAX_PATH_TYPES; i++ ) {
|
||||
strcpy( filespec, root->path );
|
||||
|
||||
if(strlen(Pathtypes[i].path)) {
|
||||
strcat( filespec, Pathtypes[i].path );
|
||||
if(strlen(Pathtypes[i].path)) {
|
||||
strcat( filespec, Pathtypes[i].path );
|
||||
if ( filespec[strlen(filespec)-1] != DIR_SEPARATOR_CHAR ) {
|
||||
strcat( filespec, DIR_SEPARATOR_STR );
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
#if defined _WIN32
|
||||
@@ -323,7 +363,7 @@ int cf_get_packfile_count(cf_root *root)
|
||||
|
||||
_findclose( find_handle );
|
||||
}
|
||||
#elif defined unix
|
||||
#elif defined SCP_UNIX
|
||||
strcat( filespec, "*.[vV][pP]" );
|
||||
|
||||
glob_t globinfo;
|
||||
@@ -378,7 +418,7 @@ void cf_build_pack_list( cf_root *root )
|
||||
}
|
||||
|
||||
// allocate a temporary array of temporary roots so we can easily sort them
|
||||
temp_roots_sort = (cf_root_sort*)malloc(sizeof(cf_root_sort) * temp_root_count);
|
||||
temp_roots_sort = (cf_root_sort*)vm_malloc(sizeof(cf_root_sort) * temp_root_count);
|
||||
if(temp_roots_sort == NULL){
|
||||
Int3();
|
||||
return;
|
||||
@@ -391,7 +431,9 @@ void cf_build_pack_list( cf_root *root )
|
||||
|
||||
if(strlen(Pathtypes[i].path)) {
|
||||
strcat( filespec, Pathtypes[i].path );
|
||||
strcat( filespec, DIR_SEPARATOR_STR );
|
||||
if ( filespec[strlen(filespec)-1] != DIR_SEPARATOR_CHAR ) {
|
||||
strcat( filespec, DIR_SEPARATOR_STR );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -431,7 +473,7 @@ void cf_build_pack_list( cf_root *root )
|
||||
|
||||
_findclose( find_handle );
|
||||
}
|
||||
#elif defined unix
|
||||
#elif defined SCP_UNIX
|
||||
strcat( filespec, "*.[vV][pP]" );
|
||||
glob_t globinfo;
|
||||
memset(&globinfo, 0, sizeof(globinfo));
|
||||
@@ -478,17 +520,64 @@ void cf_build_pack_list( cf_root *root )
|
||||
}
|
||||
|
||||
// free up the temp list
|
||||
free(temp_roots_sort);
|
||||
vm_free(temp_roots_sort);
|
||||
}
|
||||
|
||||
|
||||
void cf_build_root_list(char *cdrom_dir)
|
||||
{
|
||||
Num_roots = 0;
|
||||
Num_path_roots = 0;
|
||||
|
||||
cf_root *root;
|
||||
char str_temp[128], *cur_pos;
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
// =========================================================================
|
||||
// now look for mods under the users HOME directory to use before system ones
|
||||
if (Cmdline_mod) {
|
||||
for (cur_pos=Cmdline_mod; strlen(cur_pos) != 0; cur_pos+= (strlen(cur_pos)+1))
|
||||
{
|
||||
memset(str_temp, 0, 128);
|
||||
strcpy(str_temp, cur_pos);
|
||||
|
||||
strcat(str_temp, DIR_SEPARATOR_STR);
|
||||
root = cf_create_root();
|
||||
|
||||
strcpy( root->path, Cfile_user_dir );
|
||||
|
||||
// do we already have a slash? as in the case of a root directory install
|
||||
if(strlen(root->path) && (root->path[strlen(root->path)-1] != DIR_SEPARATOR_CHAR)){
|
||||
strcat(root->path, DIR_SEPARATOR_STR); // put trailing backslash on for easier path construction
|
||||
}
|
||||
|
||||
strcat(root->path, str_temp);
|
||||
root->roottype = CF_ROOTTYPE_PATH;
|
||||
cf_build_pack_list(root);
|
||||
}
|
||||
}
|
||||
// =========================================================================
|
||||
|
||||
// =========================================================================
|
||||
// set users HOME directory as default for loading and saving files
|
||||
root = cf_create_root();
|
||||
strcpy( root->path, Cfile_user_dir );
|
||||
|
||||
// do we already have a slash? as in the case of a root directory install
|
||||
if(strlen(root->path) && (root->path[strlen(root->path)-1] != DIR_SEPARATOR_CHAR)){
|
||||
strcat(root->path, DIR_SEPARATOR_STR); // put trailing backslash on for easier path construction
|
||||
}
|
||||
root->roottype = CF_ROOTTYPE_PATH;
|
||||
|
||||
// set the default player location to here
|
||||
if ( Pilot_file_path == NULL )
|
||||
Pilot_file_path = root->path;
|
||||
|
||||
// Next, check any VP files under the current directory.
|
||||
cf_build_pack_list(root);
|
||||
// =========================================================================
|
||||
#endif
|
||||
|
||||
if(Cmdline_mod) {
|
||||
// stackable Mod support -- Kazan
|
||||
//This for statement is a work of art :D
|
||||
@@ -496,13 +585,11 @@ void cf_build_root_list(char *cdrom_dir)
|
||||
{
|
||||
|
||||
//strdup was not behaving reliably
|
||||
//str_temp = strdup(cur_pos);
|
||||
//str_temp = vm_strdup(cur_pos);
|
||||
|
||||
memset(str_temp, 0, 128);
|
||||
strcpy(str_temp, cur_pos);
|
||||
|
||||
|
||||
|
||||
strcat(str_temp, DIR_SEPARATOR_STR);
|
||||
root = cf_create_root();
|
||||
|
||||
@@ -532,9 +619,12 @@ void cf_build_root_list(char *cdrom_dir)
|
||||
strcat(root->path, DIR_SEPARATOR_STR); // put trailing backslash on for easier path construction
|
||||
}
|
||||
|
||||
|
||||
root->roottype = CF_ROOTTYPE_PATH;
|
||||
|
||||
// set the default path for pilot files
|
||||
if ( Pilot_file_path == NULL )
|
||||
Pilot_file_path = root->path;
|
||||
|
||||
//======================================================
|
||||
// Next, check any VP files under the current directory.
|
||||
cf_build_pack_list(root);
|
||||
@@ -583,11 +673,18 @@ void cf_search_root_path(int root_index)
|
||||
|
||||
for (i=CF_TYPE_ROOT; i<CF_MAX_PATH_TYPES; i++ ) {
|
||||
|
||||
// we don't want to add player files to the cache - taylor
|
||||
if ( (i == CF_TYPE_SINGLE_PLAYERS) || (i == CF_TYPE_MULTI_PLAYERS) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
strcpy( search_path, root->path );
|
||||
|
||||
if(strlen(Pathtypes[i].path)) {
|
||||
strcat( search_path, Pathtypes[i].path );
|
||||
strcat( search_path, DIR_SEPARATOR_STR );
|
||||
if ( search_path[strlen(search_path)-1] != DIR_SEPARATOR_CHAR ) {
|
||||
strcat( search_path, DIR_SEPARATOR_STR );
|
||||
}
|
||||
}
|
||||
|
||||
#if defined _WIN32
|
||||
@@ -626,37 +723,51 @@ void cf_search_root_path(int root_index)
|
||||
|
||||
_findclose( find_handle );
|
||||
}
|
||||
#elif defined unix
|
||||
strcat( search_path, "*" );
|
||||
glob_t globinfo;
|
||||
memset(&globinfo, 0, sizeof(globinfo));
|
||||
int status = glob(search_path, 0, NULL, &globinfo);
|
||||
if (status == 0) {
|
||||
for (unsigned int j = 0; j < globinfo.gl_pathc; j++) {
|
||||
// Determine if this is a regular file
|
||||
struct stat statbuf;
|
||||
memset(&statbuf, 0, sizeof(statbuf));
|
||||
stat(globinfo.gl_pathv[j], &statbuf);
|
||||
if (S_ISREG(statbuf.st_mode)) {
|
||||
char *ext = strchr(globinfo.gl_pathv[j], '.' );
|
||||
#elif defined SCP_UNIX
|
||||
DIR *dirp;
|
||||
struct dirent *dir;
|
||||
|
||||
dirp = opendir (search_path);
|
||||
if ( dirp ) {
|
||||
while ((dir = readdir (dirp)) != NULL)
|
||||
{
|
||||
if (!fnmatch ("*.*", dir->d_name, 0))
|
||||
{
|
||||
char fn[MAX_PATH];
|
||||
snprintf(fn, MAX_PATH-1, "%s%s", search_path, dir->d_name);
|
||||
fn[MAX_PATH-1] = 0;
|
||||
|
||||
struct stat buf;
|
||||
if (stat(fn, &buf) == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!S_ISREG(buf.st_mode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
char *ext = strchr( dir->d_name, '.' );
|
||||
if ( ext ) {
|
||||
if ( is_ext_in_list( Pathtypes[i].extensions, ext ) ) {
|
||||
// Found a file!!!!
|
||||
cf_file *file = cf_create_file();
|
||||
|
||||
strcpy( file->name_ext, globinfo.gl_pathv[j] );
|
||||
|
||||
strcpy( file->name_ext, dir->d_name );
|
||||
file->root_index = root_index;
|
||||
file->pathtype_index = i;
|
||||
file->write_time = statbuf.st_mtime;
|
||||
file->size = statbuf.st_size;
|
||||
|
||||
|
||||
file->write_time = buf.st_mtime;
|
||||
file->size = buf.st_size;
|
||||
|
||||
file->pack_offset = 0; // Mark as a non-packed file
|
||||
|
||||
|
||||
//mprintf(( "Found file '%s'\n", file->name_ext ));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
globfree(&globinfo);
|
||||
closedir(dirp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -674,7 +785,7 @@ typedef struct VP_FILE {
|
||||
int offset;
|
||||
int size;
|
||||
char filename[32];
|
||||
time_t write_time;
|
||||
_fs_time_t write_time;
|
||||
} VP_FILE;
|
||||
|
||||
void cf_search_root_pack(int root_index)
|
||||
@@ -695,6 +806,10 @@ void cf_search_root_pack(int root_index)
|
||||
Assert( sizeof(VP_header) == 16 );
|
||||
fread(&VP_header, 1, sizeof(VP_header), fp);
|
||||
|
||||
VP_header.version = INTEL_INT( VP_header.version );
|
||||
VP_header.index_offset = INTEL_INT( VP_header.index_offset );
|
||||
VP_header.num_files = INTEL_INT( VP_header.num_files );
|
||||
|
||||
// Read index info
|
||||
fseek(fp, VP_header.index_offset, SEEK_SET);
|
||||
|
||||
@@ -709,6 +824,10 @@ void cf_search_root_pack(int root_index)
|
||||
|
||||
fread( &find, sizeof(VP_FILE), 1, fp );
|
||||
|
||||
find.offset = INTEL_INT( find.offset );
|
||||
find.size = INTEL_INT( find.size );
|
||||
find.write_time = INTEL_INT( find.write_time );
|
||||
|
||||
if ( find.size == 0 ) {
|
||||
if ( !stricmp( find.filename, ".." )) {
|
||||
int l = strlen(search_path);
|
||||
@@ -718,8 +837,8 @@ void cf_search_root_pack(int root_index)
|
||||
}
|
||||
*p = 0;
|
||||
} else {
|
||||
if ( strlen(search_path) ) {
|
||||
strcat( search_path, DIR_SEPARATOR_STR );
|
||||
if ( strlen(search_path) && (search_path[strlen(search_path)-1] != DIR_SEPARATOR_CHAR) ) {
|
||||
strcat( search_path, DIR_SEPARATOR_STR );
|
||||
}
|
||||
strcat( search_path, find.filename );
|
||||
}
|
||||
@@ -740,7 +859,7 @@ void cf_search_root_pack(int root_index)
|
||||
strcpy( file->name_ext, find.filename );
|
||||
file->root_index = root_index;
|
||||
file->pathtype_index = j;
|
||||
file->write_time = find.write_time;
|
||||
file->write_time = (time_t)find.write_time;
|
||||
file->size = find.size;
|
||||
file->pack_offset = find.offset; // Mark as a packed file
|
||||
//mprintf(( "Found pack file '%s'\n", file->name_ext ));
|
||||
@@ -821,7 +940,7 @@ void cf_free_secondary_filelist()
|
||||
// Free the root blocks
|
||||
for (i=0; i<CF_MAX_ROOT_BLOCKS; i++ ) {
|
||||
if ( Root_blocks[i] ) {
|
||||
free( Root_blocks[i] );
|
||||
vm_free( Root_blocks[i] );
|
||||
Root_blocks[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -830,7 +949,7 @@ void cf_free_secondary_filelist()
|
||||
// Init the file blocks
|
||||
for (i=0; i<CF_MAX_FILE_BLOCKS; i++ ) {
|
||||
if ( File_blocks[i] ) {
|
||||
free( File_blocks[i] );
|
||||
vm_free( File_blocks[i] );
|
||||
File_blocks[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -859,18 +978,14 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
|
||||
// of the file
|
||||
|
||||
// NOTE: full path should also include localization, if so desired
|
||||
#ifdef SCP_UNIX
|
||||
if ( strpbrk(filespec, "/") ) { // do we have a full path already?
|
||||
#else
|
||||
if ( strpbrk(filespec,"/\\:") ) { // do we have a full path already?
|
||||
#endif
|
||||
FILE *fp = fopen(filespec, "rb" );
|
||||
if (fp) {
|
||||
if ( size ) {
|
||||
#if defined _WIN32
|
||||
*size = filelength(fileno(fp));
|
||||
#elif defined unix
|
||||
struct stat statbuf;
|
||||
fstat(fileno(fp), &statbuf);
|
||||
*size = statbuf.st_size;
|
||||
#endif
|
||||
}
|
||||
if ( size ) *size = filelength(fileno(fp));
|
||||
if ( offset ) *offset = 0;
|
||||
if ( pack_filename ) {
|
||||
strcpy( pack_filename, filespec );
|
||||
@@ -911,6 +1026,7 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
|
||||
case CF_TYPE_MULTI_PLAYERS:
|
||||
case CF_TYPE_MULTI_CACHE:
|
||||
case CF_TYPE_MISSIONS:
|
||||
case CF_TYPE_CACHE:
|
||||
cfs_slow_search = 1;
|
||||
break;
|
||||
|
||||
@@ -958,7 +1074,7 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#elif defined unix
|
||||
#elif defined SCP_UNIX
|
||||
FILE *fp = fopen(longname, "rb" );
|
||||
if (fp) {
|
||||
if ( size ) {
|
||||
@@ -1004,7 +1120,9 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
|
||||
strcpy( pack_filename, r->path );
|
||||
if ( f->pack_offset < 1 ) {
|
||||
strcat( pack_filename, Pathtypes[f->pathtype_index].path );
|
||||
strcat( pack_filename, DIR_SEPARATOR_STR );
|
||||
if ( pack_filename[strlen(pack_filename)-1] != DIR_SEPARATOR_CHAR ) {
|
||||
strcat( pack_filename, DIR_SEPARATOR_STR );
|
||||
}
|
||||
strcat( pack_filename, f->name_ext );
|
||||
}
|
||||
}
|
||||
@@ -1026,7 +1144,9 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
|
||||
|
||||
if(strlen(Pathtypes[f->pathtype_index].path)){
|
||||
strcat( pack_filename, Pathtypes[f->pathtype_index].path );
|
||||
strcat( pack_filename, DIR_SEPARATOR_STR );
|
||||
if ( pack_filename[strlen(pack_filename)-1] != DIR_SEPARATOR_CHAR ) {
|
||||
strcat( pack_filename, DIR_SEPARATOR_STR );
|
||||
}
|
||||
}
|
||||
|
||||
strcat( pack_filename, f->name_ext );
|
||||
@@ -1046,17 +1166,35 @@ int cf_matches_spec(char *filespec, char *filename)
|
||||
{
|
||||
char *src_ext, *dst_ext;
|
||||
|
||||
src_ext = strchr(filespec, '.');
|
||||
if (!src_ext)
|
||||
return 1;
|
||||
if (*src_ext == '*')
|
||||
return 1;
|
||||
src_ext = strrchr(filespec, '*');
|
||||
if(!src_ext)
|
||||
{
|
||||
src_ext = strchr(filespec, '.');
|
||||
if (!src_ext)
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
src_ext++;
|
||||
}
|
||||
|
||||
dst_ext = strchr(filename, '.');
|
||||
if(strlen(filespec) > strlen(filename))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
dst_ext = filename + strlen(filename) - ((filespec + strlen(filespec)) - src_ext);
|
||||
if (!dst_ext)
|
||||
return 1;
|
||||
|
||||
return !stricmp(dst_ext, src_ext);
|
||||
if(src_ext == filespec)
|
||||
{
|
||||
return !stricmp(dst_ext, src_ext);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (!stricmp(dst_ext, src_ext) && !strnicmp(dst_ext, src_ext, src_ext - filespec));
|
||||
}
|
||||
}
|
||||
|
||||
int (*Get_file_list_filter)(char *filename) = NULL;
|
||||
@@ -1089,7 +1227,7 @@ int cf_file_already_in_list( int num_files, char **list, char *filename )
|
||||
int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort, file_list_info *info )
|
||||
{
|
||||
char *ptr;
|
||||
int i, l, find_handle, num_files = 0, own_flag = 0;
|
||||
int i, l, num_files = 0, own_flag = 0;
|
||||
|
||||
if (max < 1) {
|
||||
Get_file_list_filter = NULL;
|
||||
@@ -1100,16 +1238,18 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
Assert(list);
|
||||
|
||||
if (!info && (sort == CF_SORT_TIME)) {
|
||||
info = (file_list_info *) malloc(sizeof(file_list_info) * max);
|
||||
info = (file_list_info *) vm_malloc(sizeof(file_list_info) * max);
|
||||
own_flag = 1;
|
||||
}
|
||||
|
||||
char filespec[MAX_PATH_LEN];
|
||||
|
||||
#if defined _WIN32
|
||||
cf_create_default_path_string( filespec, pathtype, filter );
|
||||
|
||||
#if defined _WIN32
|
||||
_finddata_t find;
|
||||
int find_handle;
|
||||
|
||||
find_handle = _findfirst( filespec, &find );
|
||||
if (find_handle != -1) {
|
||||
do {
|
||||
@@ -1125,7 +1265,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
else
|
||||
l = strlen(find.name);
|
||||
|
||||
list[num_files] = (char *)malloc(l + 1);
|
||||
list[num_files] = (char *)vm_malloc(l + 1);
|
||||
strncpy(list[num_files], find.name, l);
|
||||
list[num_files][l] = 0;
|
||||
if (info)
|
||||
@@ -1140,41 +1280,53 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
_findclose( find_handle );
|
||||
}
|
||||
|
||||
#elif defined unix
|
||||
char base_filespec[MAX_PATH_LEN];
|
||||
cf_create_default_path_string( base_filespec, pathtype );
|
||||
int base_filespec_len = strlen(base_filespec);
|
||||
glob_t globinfo;
|
||||
memset(&globinfo, 0, sizeof(globinfo));
|
||||
int status = glob(filespec, 0, NULL, &globinfo);
|
||||
if (status == 0) {
|
||||
for (unsigned int i = 0; i < globinfo.gl_pathc; i++) {
|
||||
// Determine if this is a regular file
|
||||
struct stat statbuf;
|
||||
memset(&statbuf, 0, sizeof(statbuf));
|
||||
stat(globinfo.gl_pathv[i], &statbuf);
|
||||
if (S_ISREG(statbuf.st_mode)) {
|
||||
if ( !Get_file_list_filter || (*Get_file_list_filter)(globinfo.gl_pathv[i]) ) {
|
||||
char *found_file = globinfo.gl_pathv[i];
|
||||
Assert(strncmp(found_file, base_filespec, base_filespec_len) == 0);
|
||||
found_file += base_filespec_len;
|
||||
ptr = strrchr(found_file, '.');
|
||||
if (ptr)
|
||||
l = ptr - found_file;
|
||||
else
|
||||
l = strlen(found_file);
|
||||
|
||||
list[num_files] = (char *)malloc(l + 1);
|
||||
strncpy(list[num_files], found_file, l);
|
||||
list[num_files][l] = 0;
|
||||
if (info)
|
||||
info[num_files].write_time = statbuf.st_mtime;
|
||||
|
||||
num_files++;
|
||||
}
|
||||
#elif defined SCP_UNIX
|
||||
cf_create_default_path_string( filespec, pathtype, NULL );
|
||||
|
||||
DIR *dirp;
|
||||
struct dirent *dir;
|
||||
|
||||
dirp = opendir (filespec);
|
||||
if ( dirp ) {
|
||||
while ((dir = readdir (dirp)) != NULL)
|
||||
{
|
||||
if (num_files >= max)
|
||||
break;
|
||||
|
||||
if (fnmatch(filter, dir->d_name, 0) != 0)
|
||||
continue;
|
||||
|
||||
char fn[MAX_PATH];
|
||||
snprintf(fn, MAX_PATH-1, "%s/%s", filespec, dir->d_name);
|
||||
fn[MAX_PATH-1] = 0;
|
||||
|
||||
struct stat buf;
|
||||
if (stat(fn, &buf) == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!S_ISREG(buf.st_mode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !Get_file_list_filter || (*Get_file_list_filter)(dir->d_name) ) {
|
||||
ptr = strrchr(dir->d_name, '.');
|
||||
if (ptr)
|
||||
l = ptr - dir->d_name;
|
||||
else
|
||||
l = strlen(dir->d_name);
|
||||
|
||||
list[num_files] = (char *)vm_malloc(l + 1);
|
||||
strncpy(list[num_files], dir->d_name, l);
|
||||
list[num_files][l] = 0;
|
||||
if (info)
|
||||
info[num_files].write_time = buf.st_mtime;
|
||||
|
||||
num_files++;
|
||||
}
|
||||
globfree(&globinfo);
|
||||
}
|
||||
|
||||
closedir(dirp);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1189,7 +1341,6 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
}
|
||||
|
||||
if (num_files >= max)
|
||||
|
||||
break;
|
||||
|
||||
if ( !cf_matches_spec( filter,f->name_ext)) {
|
||||
@@ -1210,7 +1361,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
else
|
||||
l = strlen(f->name_ext);
|
||||
|
||||
list[num_files] = (char *)malloc(l + 1);
|
||||
list[num_files] = (char *)vm_malloc(l + 1);
|
||||
strncpy(list[num_files], f->name_ext, l);
|
||||
list[num_files][l] = 0;
|
||||
|
||||
@@ -1230,7 +1381,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
}
|
||||
|
||||
if (own_flag) {
|
||||
free(info);
|
||||
vm_free(info);
|
||||
}
|
||||
|
||||
Get_file_list_filter = NULL;
|
||||
@@ -1281,18 +1432,20 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
}
|
||||
|
||||
if (!info && (sort == CF_SORT_TIME)) {
|
||||
info = (file_list_info *) malloc(sizeof(file_list_info) * max);
|
||||
own_flag = 1;
|
||||
info = (file_list_info *) vm_malloc(sizeof(file_list_info) * max);
|
||||
|
||||
if ( info )
|
||||
own_flag = 1;
|
||||
}
|
||||
|
||||
char filespec[MAX_PATH_LEN];
|
||||
|
||||
// Search the default directories
|
||||
#if defined _WIN32
|
||||
cf_create_default_path_string( filespec, pathtype, filter );
|
||||
mprintf(("cf_get_file_list_preallocated looking for type=%d, filter=\"%s\"\n",
|
||||
pathtype, filter));
|
||||
|
||||
// Search the default directories
|
||||
#if defined _WIN32
|
||||
int find_handle;
|
||||
_finddata_t find;
|
||||
|
||||
@@ -1325,41 +1478,51 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
_findclose( find_handle );
|
||||
}
|
||||
|
||||
#elif defined unix
|
||||
char base_filespec[MAX_PATH_LEN];
|
||||
cf_create_default_path_string( base_filespec, pathtype );
|
||||
int base_filespec_len = strlen(base_filespec);
|
||||
glob_t globinfo;
|
||||
memset(&globinfo, 0, sizeof(globinfo));
|
||||
int status = glob(filespec, 0, NULL, &globinfo);
|
||||
if (status == 0) {
|
||||
for (unsigned int i = 0; i < globinfo.gl_pathc; i++) {
|
||||
// Determine if this is a regular file
|
||||
struct stat statbuf;
|
||||
memset(&statbuf, 0, sizeof(statbuf));
|
||||
stat(globinfo.gl_pathv[i], &statbuf);
|
||||
if (S_ISREG(statbuf.st_mode)) {
|
||||
if ( !Get_file_list_filter || (*Get_file_list_filter)(globinfo.gl_pathv[i]) ) {
|
||||
|
||||
char *found_file = globinfo.gl_pathv[i];
|
||||
Assert(strncmp(found_file, base_filespec, base_filespec_len) == 0);
|
||||
found_file += base_filespec_len;
|
||||
#elif defined SCP_UNIX
|
||||
cf_create_default_path_string( filespec, pathtype, NULL );
|
||||
|
||||
strncpy(arr[num_files], found_file, MAX_FILENAME_LEN - 1 );
|
||||
char *ptr = strrchr(arr[num_files], '.');
|
||||
if ( ptr ) {
|
||||
*ptr = 0;
|
||||
}
|
||||
DIR *dirp;
|
||||
struct dirent *dir;
|
||||
|
||||
if (info) {
|
||||
info[num_files].write_time = statbuf.st_mtime;
|
||||
}
|
||||
|
||||
num_files++;
|
||||
dirp = opendir (filespec);
|
||||
if ( dirp ) {
|
||||
while ((dir = readdir (dirp)) != NULL)
|
||||
{
|
||||
if (num_files >= max)
|
||||
break;
|
||||
|
||||
if (fnmatch(filter, dir->d_name, 0) != 0)
|
||||
continue;
|
||||
|
||||
char fn[MAX_PATH];
|
||||
snprintf(fn, MAX_PATH-1, "%s/%s", filespec, dir->d_name);
|
||||
fn[MAX_PATH-1] = 0;
|
||||
|
||||
struct stat buf;
|
||||
if (stat(fn, &buf) == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!S_ISREG(buf.st_mode)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !Get_file_list_filter || (*Get_file_list_filter)(dir->d_name) ) {
|
||||
|
||||
strncpy(arr[num_files], dir->d_name, MAX_FILENAME_LEN - 1 );
|
||||
char *ptr = strrchr(arr[num_files], '.');
|
||||
if ( ptr ) {
|
||||
*ptr = 0;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
info[num_files].write_time = buf.st_mtime;
|
||||
}
|
||||
|
||||
num_files++;
|
||||
}
|
||||
}
|
||||
globfree(&globinfo);
|
||||
closedir(dirp);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1411,7 +1574,7 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
}
|
||||
|
||||
if (own_flag) {
|
||||
free(info);
|
||||
vm_free(info);
|
||||
}
|
||||
|
||||
Get_file_list_filter = NULL;
|
||||
@@ -1429,7 +1592,11 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
// Output: path - Fully qualified pathname.
|
||||
void cf_create_default_path_string( char *path, int pathtype, char *filename, bool localize )
|
||||
{
|
||||
if ( filename && strpbrk(filename,"/\\:") ) {
|
||||
#ifdef SCP_UNIX
|
||||
if ( filename && strpbrk(filename,"/") ) {
|
||||
#else
|
||||
if ( filename && strpbrk(filename,"/\\:") ) {
|
||||
#endif
|
||||
// Already has full path
|
||||
strcpy( path, filename );
|
||||
|
||||
@@ -1443,14 +1610,30 @@ void cf_create_default_path_string( char *path, int pathtype, char *filename, bo
|
||||
|
||||
Assert(CF_TYPE_SPECIFIED(pathtype));
|
||||
|
||||
strcpy(path, root->path);
|
||||
// force a specific directory to search for player files
|
||||
if ( (pathtype == CF_TYPE_SINGLE_PLAYERS) || (pathtype == CF_TYPE_MULTI_PLAYERS) ) {
|
||||
strcpy(path, Pilot_file_path);
|
||||
} else {
|
||||
strcpy(path, root->path);
|
||||
}
|
||||
|
||||
strcat(path, Pathtypes[pathtype].path);
|
||||
|
||||
// Don't add slash for root directory
|
||||
if (Pathtypes[pathtype].path[0] != '\0') {
|
||||
strcat(path, DIR_SEPARATOR_STR);
|
||||
if ( path[strlen(path)-1] != DIR_SEPARATOR_CHAR ) {
|
||||
strcat(path, DIR_SEPARATOR_STR);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef INF_BUILD
|
||||
// keep pilot files separated for an Inferno build since they aren't compatible
|
||||
if ( pathtype == CF_TYPE_SINGLE_PLAYERS ) {
|
||||
strcat(path, "inferno");
|
||||
strcat(path, DIR_SEPARATOR_STR);
|
||||
}
|
||||
#endif
|
||||
|
||||
// add filename
|
||||
if (filename) {
|
||||
strcat(path, filename);
|
||||
@@ -1475,4 +1658,3 @@ void cf_create_default_path_string( char *path, int pathtype, char *filename, bo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/CfileSystem.h $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2004-03-05 09:01:54 $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2005-07-13 02:50:49 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Functions to keep track of and find files that can exist
|
||||
@@ -20,6 +20,13 @@
|
||||
* all those locations, inherently enforcing precedence orders.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.2 2004/08/11 05:06:19 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.1 2004/03/05 09:01:54 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:21 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
|
||||
@@ -9,13 +9,20 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Cfilearchiver/CfileArchiver.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2003-11-16 09:42:37 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2005-09-08 00:09:31 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Program to create an archive file for use with cfile stuff
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.2 2005/01/30 12:50:08 taylor
|
||||
* merge with Linux/OSX tree - p0130
|
||||
*
|
||||
* Revision 2.1 2003/11/16 09:42:37 Goober5000
|
||||
* clarified and pruned debug spew messages
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:21 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -30,15 +37,28 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#include <io.h>
|
||||
#include <string.h>
|
||||
#include <conio.h>
|
||||
#else
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
static int data_error;
|
||||
static int no_dir;
|
||||
|
||||
unsigned int Total_size=16; // Start with size of header
|
||||
unsigned int Num_files =0;
|
||||
FILE * fp_out = NULL;
|
||||
FILE * fp_out_hdr = NULL;
|
||||
FILE *fp_out = NULL;
|
||||
FILE *fp_out_hdr = NULL;
|
||||
|
||||
typedef struct vp_header {
|
||||
char id[4];
|
||||
@@ -82,7 +102,7 @@ int write_index(char *hf, char *df)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void pack_file( char *filespec, char *filename, int filesize, time_t time_write )
|
||||
void pack_file( char *filespec, char *filename, int filesize, _fs_time_t time_write )
|
||||
{
|
||||
char path[1024];
|
||||
|
||||
@@ -110,13 +130,15 @@ void pack_file( char *filespec, char *filename, int filesize, time_t time_write
|
||||
fwrite( &Total_size, 1, 4, fp_out_hdr );
|
||||
fwrite( &filesize, 1, 4, fp_out_hdr );
|
||||
fwrite( &path, 1, 32, fp_out_hdr );
|
||||
fwrite( &time_write, 1, sizeof(time_t), fp_out_hdr);
|
||||
fwrite( &time_write, 1, sizeof(_fs_time_t), fp_out_hdr);
|
||||
|
||||
Total_size += filesize;
|
||||
Num_files++;
|
||||
printf( "Packing %s\\%s...", filespec, filename );
|
||||
|
||||
sprintf( path, "%s\\%s", filespec, filename );
|
||||
printf( "Packing %s%s%s...", filespec, DIR_SEPARATOR_STR, filename );
|
||||
|
||||
sprintf( path, "%s%s%s", filespec, DIR_SEPARATOR_STR, filename );
|
||||
|
||||
|
||||
FILE *fp = fopen( path, "rb" );
|
||||
|
||||
@@ -153,7 +175,7 @@ void add_directory( char * dirname)
|
||||
int i = 0;
|
||||
fwrite(&i, 1, 4, fp_out_hdr);
|
||||
// strip out any directories that this dir is a subdir of
|
||||
while ((tmpptr = strchr(pathptr, '\\')) != NULL) {
|
||||
while ((tmpptr = strchr(pathptr, DIR_SEPARATOR_CHAR)) != NULL) {
|
||||
pathptr = tmpptr+1;
|
||||
}
|
||||
fwrite(pathptr, 1, 32, fp_out_hdr);
|
||||
@@ -163,8 +185,10 @@ void add_directory( char * dirname)
|
||||
|
||||
void pack_directory( char * filespec)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int find_handle;
|
||||
_finddata_t find;
|
||||
#endif
|
||||
char tmp[512];
|
||||
char tmp1[512];
|
||||
|
||||
@@ -184,12 +208,21 @@ void pack_directory( char * filespec)
|
||||
}
|
||||
*/
|
||||
|
||||
char *ts;
|
||||
|
||||
// strip trailing slash
|
||||
ts = filespec+(strlen(filespec)-1);
|
||||
while(*ts == DIR_SEPARATOR_CHAR && ts > filespec)
|
||||
*ts = '\0';
|
||||
|
||||
strcpy( tmp1, filespec );
|
||||
|
||||
add_directory(filespec);
|
||||
strcat( tmp1, "\\*.*" );
|
||||
strcat( tmp1, DIR_SEPARATOR_STR"*.*" );
|
||||
|
||||
printf( "In dir '%s'\n", tmp1 );
|
||||
|
||||
#ifdef _WIN32
|
||||
find_handle = _findfirst( tmp1, &find );
|
||||
if( find_handle != -1 ) {
|
||||
if ( find.attrib & _A_SUBDIR ) {
|
||||
@@ -217,10 +250,95 @@ void pack_directory( char * filespec)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
DIR *dirp;
|
||||
struct dirent *dir;
|
||||
|
||||
dirp = opendir (filespec);
|
||||
if ( dirp ) {
|
||||
while ((dir = readdir(dirp)) != NULL) {
|
||||
|
||||
char fn[MAX_PATH];
|
||||
snprintf(fn, MAX_PATH-1, "%s/%s", filespec, dir->d_name);
|
||||
fn[MAX_PATH-1] = 0;
|
||||
|
||||
struct stat buf;
|
||||
if (stat(fn, &buf) == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( (strcmp(dir->d_name, ".") == 0) || (strcmp(dir->d_name, "..") == 0) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (S_ISDIR(buf.st_mode)) {
|
||||
strcpy( tmp, filespec );
|
||||
strcat( tmp, "/" );
|
||||
strcat( tmp, dir->d_name );
|
||||
pack_directory(tmp);
|
||||
} else {
|
||||
pack_file( filespec, dir->d_name, buf.st_size, buf.st_mtime );
|
||||
}
|
||||
}
|
||||
closedir(dirp);
|
||||
} else {
|
||||
printf("Error: Source directory does not exist!\n");
|
||||
no_dir = 1;
|
||||
}
|
||||
#endif
|
||||
add_directory("..");
|
||||
}
|
||||
|
||||
int verify_directory( char *filespec )
|
||||
{
|
||||
char *ts;
|
||||
char *dd;
|
||||
|
||||
// strip trailing '/'
|
||||
ts = filespec+(strlen(filespec)-1);
|
||||
while(*ts == DIR_SEPARATOR_CHAR && ts > filespec)
|
||||
*ts = '\0';
|
||||
|
||||
// make sure last directory is named "data", ignoring case
|
||||
dd = filespec+(strlen(filespec)-4);
|
||||
if ( stricmp( dd, "data" ) )
|
||||
data_error = 1;
|
||||
|
||||
return data_error;
|
||||
}
|
||||
|
||||
void print_instructions()
|
||||
{
|
||||
printf( "Creates a vp archive out of a FreeSpace data tree.\n\n" );
|
||||
printf( "Usage: cfilearchiver archive_name src_dir\n");
|
||||
printf( "Example: cfilearchiver freespace /tmp/freespace/data\n\n");
|
||||
printf( "Directory structure options:\n" );
|
||||
printf( " Effects (.ani .pcx .neb .tga)\n" );
|
||||
printf( " Fonts (.vf)\n" );
|
||||
printf( " Hud (.ani .pcx .tga\n" );
|
||||
printf( " Interface (.pcx .ani .tga)\n" );
|
||||
printf( " Maps (.pcx .ani .tga)\n" );
|
||||
printf( " Missions (.ntl .ssv), FS1(.fsm .fsc), FS2(.fs2 .fc2)\n" );
|
||||
printf( " Models (.pof)\n" );
|
||||
printf( " Music (.wav)\n" );
|
||||
printf( " Sounds/8b22k (.wav)\n" );
|
||||
printf( " Sounds/16b11k (.wav)\n" );
|
||||
printf( " Tables (.tbl)\n" );
|
||||
printf( " Voice/Briefing (.wav)\n" );
|
||||
printf( " Voice/Command briefings (.wav)\n" );
|
||||
printf( " Voice/Debriefing (.wav)\n" );
|
||||
printf( " Voice/Personas (.wav)\n" );
|
||||
printf( " Voice/Special (.wav)\n" );
|
||||
printf( " Voice/Training (.wav)\n" );
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// we end up #include'ing SDL.h which on Windows and Mac will redfine main() which is something
|
||||
// that we don't want since we don't actually link against SDL, this solves the problem...
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[] )
|
||||
{
|
||||
@@ -228,12 +346,16 @@ int main(int argc, char *argv[] )
|
||||
char *p;
|
||||
|
||||
if ( argc < 3 ) {
|
||||
#ifdef _WIN32
|
||||
printf( "Usage: %s archive_name src_dir\n", argv[0] );
|
||||
printf( "Example: %s freespace c:\\freespace\\data\n", argv[0] );
|
||||
printf( "Creates an archive named freespace out of the\nfreespace data tree\n" );
|
||||
printf( "Press any key to exit...\n" );
|
||||
getch();
|
||||
return 1;
|
||||
#else
|
||||
print_instructions();
|
||||
#endif
|
||||
}
|
||||
|
||||
strcpy( archive, argv[1] );
|
||||
@@ -248,24 +370,41 @@ int main(int argc, char *argv[] )
|
||||
|
||||
fp_out = fopen( archive_dat, "wb" );
|
||||
if ( !fp_out ) {
|
||||
printf( "out1: Couldn't open '%s'!\n", archive_dat );
|
||||
printf( "Couldn't open '%s'!\n", archive_dat );
|
||||
#ifdef _WIN32
|
||||
printf( "Press any key to exit...\n" );
|
||||
getch();
|
||||
return 1;
|
||||
#else
|
||||
exit(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
fp_out_hdr = fopen( archive_hdr, "wb" );
|
||||
if ( !fp_out_hdr ) {
|
||||
printf( "out2: Couldn't open '%s'!\n", archive_hdr );
|
||||
printf( "Couldn't open '%s'!\n", archive_hdr );
|
||||
#ifdef _WIN32
|
||||
printf( "Press any key to exit...\n" );
|
||||
getch();
|
||||
return 1;
|
||||
#else
|
||||
exit(2);
|
||||
#endif
|
||||
}
|
||||
|
||||
if ( verify_directory( argv[2] ) != 0 ) {
|
||||
printf("Warning! Last directory must be named \"data\" (not case sensitive)\n");
|
||||
exit(3);
|
||||
}
|
||||
|
||||
write_header();
|
||||
|
||||
pack_directory( argv[2] );
|
||||
|
||||
// in case the directory doesn't exist
|
||||
if ( no_dir )
|
||||
exit(4);
|
||||
|
||||
write_header();
|
||||
|
||||
fclose(fp_out);
|
||||
@@ -275,8 +414,10 @@ int main(int argc, char *argv[] )
|
||||
|
||||
if (!write_index(archive_hdr, archive_dat)) {
|
||||
printf("Error appending index!\n");
|
||||
#ifdef _WIN32
|
||||
printf("Press any key to exit...\n");
|
||||
getch();
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,476 @@
|
||||
/*
|
||||
* Copyright (C) 2005 Taylor Richards
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/cfileextractor/cfileextractor.cpp $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 2005-09-08 05:04:15 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Cross-platform cmdline extractor for VP files
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.5 2005/09/08 00:09:31 taylor
|
||||
* fix building/linking of command line tools under Linux/OSX
|
||||
* add tools as targets to OSX project file
|
||||
*
|
||||
* Revision 1.4 2005/05/24 20:52:10 taylor
|
||||
* make sure that we recursively create directories for Linux/OSX
|
||||
* replace older recursive mkdir method in cfileextractor with new method
|
||||
*
|
||||
* Revision 1.3 2005/05/24 03:12:27 taylor
|
||||
* get command sanity check right, fixes lowercase on extract too
|
||||
*
|
||||
* Revision 1.2 2005/05/18 01:57:54 taylor
|
||||
* a few help text adjustments and fix some compiler warnings
|
||||
*
|
||||
* Revision 1.1 2005/05/17 21:00:57 taylor
|
||||
* Initial import of cfileextractor, still needs some work but does what it needs to
|
||||
*
|
||||
*
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GLOBAL FUNCTIONS AND VARIABLES
|
||||
//
|
||||
|
||||
// right out of pstypes.h but we don't want to use the INTEL_INT macro here
|
||||
// since it would require SDL which isn't used on WIN32 platforms
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define INT_SWAP(x) ( \
|
||||
(x << 24) | \
|
||||
(((ulong)x) >> 24) | \
|
||||
((x & 0x0000ff00) << 8) | \
|
||||
((x & 0x00ff0000) >> 8) \
|
||||
)
|
||||
#else
|
||||
#define INT_SWAP(x) (x)
|
||||
#endif
|
||||
|
||||
FILE *fp_in = NULL;
|
||||
FILE *fp_out = NULL;
|
||||
|
||||
#define BLOCK_SIZE (1024*1024)
|
||||
|
||||
char tmp_data[BLOCK_SIZE]; // 1 MB
|
||||
|
||||
static int have_index = 0;
|
||||
static int have_header = 0;
|
||||
|
||||
#define ERR_NO_FP_IN 0
|
||||
#define ERR_NO_FP_OUT 1
|
||||
#define ERR_INVALID_VP 2
|
||||
#define ERR_NO_INDEX 3
|
||||
#define ERR_NO_HEADER 4
|
||||
|
||||
typedef struct vp_header {
|
||||
char id[4]; // 'VPVP'
|
||||
int version;
|
||||
int index_offset; // offset where the file index starts, also a total file data size count
|
||||
int num_files; // number of files, including each step in the directory structure
|
||||
} vp_header;
|
||||
|
||||
vp_header VP_Header;
|
||||
|
||||
typedef struct vp_fileinfo {
|
||||
// stuff that is actually written to the VP
|
||||
int offset; // offset of where this file is in the VP
|
||||
int file_size; // size of file
|
||||
char file_name[CF_MAX_FILENAME_LENGTH]; // filename
|
||||
_fs_time_t write_time; // date/time in _fs_time_t type (a 32-bit version of time_t)
|
||||
|
||||
// not in the VP
|
||||
char file_path[CF_MAX_PATHNAME_LENGTH]; // file path, generated here and not actually in the VP on a per file basis
|
||||
|
||||
vp_fileinfo() {
|
||||
offset = 0;
|
||||
file_size = 0;
|
||||
file_name[0] = '\0';
|
||||
file_path[0] = '\0';
|
||||
write_time = 0;
|
||||
}
|
||||
|
||||
~vp_fileinfo() {}
|
||||
} vp_fileinfo;
|
||||
|
||||
std::vector<vp_fileinfo> VP_FileInfo;
|
||||
|
||||
// just like strlwr() but without actually including it here
|
||||
void lowercase(char *s)
|
||||
{
|
||||
if (s == NULL)
|
||||
return;
|
||||
|
||||
while (*s) {
|
||||
*s = tolower(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// /////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The useful stuff...
|
||||
//
|
||||
|
||||
void print_error(int err)
|
||||
{
|
||||
switch (err) {
|
||||
case ERR_NO_FP_IN:
|
||||
printf("ERROR: The input file (fp_in) is NULL! Exiting...\n");
|
||||
break;
|
||||
case ERR_NO_FP_OUT:
|
||||
printf("ERROR: The output file (fp_out) is NULL! Exiting...\n");
|
||||
break;
|
||||
case ERR_INVALID_VP:
|
||||
printf("ERROR: The specified VP file is invalid! Exiting...\n");
|
||||
break;
|
||||
case ERR_NO_INDEX:
|
||||
printf("ERROR: No file index is available! Exiting...\n");
|
||||
break;
|
||||
case ERR_NO_HEADER:
|
||||
printf("ERROR: No file header is available! Exiting...\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void read_header()
|
||||
{
|
||||
fseek(fp_in, 0, SEEK_SET);
|
||||
fread(&VP_Header.id, 1, 4, fp_in);
|
||||
fread(&VP_Header.version, 1, sizeof(int), fp_in);
|
||||
fread(&VP_Header.index_offset, 1, sizeof(int), fp_in);
|
||||
fread(&VP_Header.num_files, 1, sizeof(int), fp_in);
|
||||
|
||||
VP_Header.version = INT_SWAP(VP_Header.version);
|
||||
VP_Header.index_offset = INT_SWAP(VP_Header.index_offset);
|
||||
VP_Header.num_files = INT_SWAP(VP_Header.num_files);
|
||||
|
||||
// check for a valid id (VPVP)
|
||||
if ( (VP_Header.id[0] != 'V') && (VP_Header.id[1] != 'P') && (VP_Header.id[2] != 'V') && (VP_Header.id[3] != 'P') )
|
||||
print_error(ERR_INVALID_VP);
|
||||
|
||||
// the index_offset needs to be greater than the size of vp_header at the very least and there should be at least one file
|
||||
if ( !(VP_Header.index_offset > (int)sizeof(vp_header)) || !(VP_Header.num_files > 1) )
|
||||
print_error(ERR_INVALID_VP);
|
||||
|
||||
|
||||
have_header = 1;
|
||||
}
|
||||
|
||||
void read_index(int lc = 0)
|
||||
{
|
||||
if (fp_in == NULL)
|
||||
print_error(ERR_NO_FP_IN);
|
||||
else if (!have_header)
|
||||
print_error(ERR_NO_HEADER);
|
||||
|
||||
int i;
|
||||
char path[CF_MAX_PATHNAME_LENGTH];
|
||||
|
||||
fseek(fp_in, VP_Header.index_offset, SEEK_SET);
|
||||
|
||||
memset(path, 0, CF_MAX_PATHNAME_LENGTH);
|
||||
|
||||
for ( i = 0; i < VP_Header.num_files; i++) {
|
||||
vp_fileinfo vpinfo;
|
||||
|
||||
fread(&vpinfo.offset, 1, sizeof(int), fp_in);
|
||||
fread(&vpinfo.file_size, 1, sizeof(int), fp_in);
|
||||
fread(&vpinfo.file_name, 1, CF_MAX_FILENAME_LENGTH, fp_in);
|
||||
fread(&vpinfo.write_time, 1, sizeof(_fs_time_t), fp_in);
|
||||
|
||||
vpinfo.offset = INT_SWAP(vpinfo.offset);
|
||||
vpinfo.file_size = INT_SWAP(vpinfo.file_size);
|
||||
vpinfo.write_time = INT_SWAP(vpinfo.write_time);
|
||||
|
||||
// check if it's a directory and if so then create a path to use for files
|
||||
if (vpinfo.file_size == 0) {
|
||||
// if we get a ".." then drop down in the path
|
||||
if (!strcmp(vpinfo.file_name, "..")) {
|
||||
char *s = strrchr(path, DIR_SEPARATOR_CHAR);
|
||||
|
||||
if (s)
|
||||
*s = '\0';
|
||||
|
||||
// skip, we don't want to add the ".." to the path
|
||||
continue;
|
||||
}
|
||||
|
||||
// don't add the very first directory separator character, easier to clean later
|
||||
if (path[0] != 0)
|
||||
strcat( path, DIR_SEPARATOR_STR );
|
||||
|
||||
// always make directory names lower case for ease of use
|
||||
lowercase( vpinfo.file_name );
|
||||
|
||||
strcat( path, vpinfo.file_name );
|
||||
} // it's a file then
|
||||
else {
|
||||
// lowercase the filename if wanted
|
||||
if (lc == 1)
|
||||
lowercase( vpinfo.file_name );
|
||||
|
||||
strcpy( vpinfo.file_path, path );
|
||||
VP_FileInfo.push_back(vpinfo);
|
||||
}
|
||||
}
|
||||
|
||||
have_index = 1;
|
||||
}
|
||||
|
||||
void extract_all_files(char *file)
|
||||
{
|
||||
if (fp_in == NULL)
|
||||
print_error(ERR_NO_FP_IN);
|
||||
else if (!have_header)
|
||||
print_error(ERR_NO_HEADER);
|
||||
else if (!have_index)
|
||||
print_error(ERR_NO_INDEX);
|
||||
|
||||
int status, m_error, nbytes, nbytes_remaining;
|
||||
char path[CF_MAX_PATHNAME_LENGTH+CF_MAX_FILENAME_LENGTH+1]; // path length + filename length + extra NULL
|
||||
char *c;
|
||||
|
||||
printf("VP file extractor - version 0.01\n");
|
||||
printf("\n");
|
||||
printf("Extracting: %s...\n", file);
|
||||
|
||||
for (uint i = 0; i < VP_FileInfo.size(); i++) {
|
||||
// save the file path to a temp location and recursively make the needed directories
|
||||
sprintf(path, "%s%s", VP_FileInfo[i].file_path, DIR_SEPARATOR_STR);
|
||||
|
||||
c = &path[0];
|
||||
|
||||
while (c++) {
|
||||
c = strchr(c, DIR_SEPARATOR_CHAR);
|
||||
|
||||
if (c) {
|
||||
*c = '\0'; // NULL at DIR_SEP char
|
||||
|
||||
#ifdef _WIN32
|
||||
status = _mkdir(path);
|
||||
#else
|
||||
status = mkdir(path, 0777);
|
||||
#endif
|
||||
|
||||
m_error = errno;
|
||||
|
||||
if (status && (m_error != EEXIST) ) {
|
||||
printf("Cannot mkdir %s: %s\n", VP_FileInfo[i].file_path, strerror(m_error));
|
||||
continue;
|
||||
}
|
||||
|
||||
*c = DIR_SEPARATOR_CHAR; // replace DIR_SEP char
|
||||
}
|
||||
}
|
||||
|
||||
// start writing out the file
|
||||
fseek(fp_in, VP_FileInfo[i].offset, SEEK_SET);
|
||||
|
||||
sprintf(path, "%s%s%s", VP_FileInfo[i].file_path, DIR_SEPARATOR_STR, VP_FileInfo[i].file_name);
|
||||
fp_out = fopen(path, "wb");
|
||||
|
||||
printf(" %s ... ", path);
|
||||
|
||||
if (fp_out == NULL) {
|
||||
printf("can't create file!\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
nbytes_remaining = VP_FileInfo[i].file_size;
|
||||
|
||||
while ( nbytes_remaining > 0 ) {
|
||||
nbytes = fread( tmp_data, 1, MIN(BLOCK_SIZE, nbytes_remaining), fp_in );
|
||||
|
||||
if (nbytes > 0) {
|
||||
fwrite( tmp_data, 1, nbytes, fp_out );
|
||||
nbytes_remaining -= nbytes;
|
||||
}
|
||||
}
|
||||
|
||||
printf("done!\n");
|
||||
|
||||
fclose(fp_out);
|
||||
fp_out = NULL;
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// TODO: the formatting of this is a bit loco but I don't care enough to make it better...
|
||||
void list_all_files(char *file)
|
||||
{
|
||||
char out_time[20];
|
||||
float one_k = 1024.0f;
|
||||
float one_m = 1048576.0f;
|
||||
char m;
|
||||
float div_by;
|
||||
time_t plat_time;
|
||||
|
||||
// if we don't have an index then bail
|
||||
if (!have_index)
|
||||
print_error(ERR_NO_INDEX);
|
||||
|
||||
|
||||
printf("VP file extractor - version 0.01\n");
|
||||
printf("\n");
|
||||
printf("%s:\n", file);
|
||||
printf("\n");
|
||||
|
||||
printf(" Name Size Offset Date/Time Path\n");
|
||||
printf("-------------------------------------------------------------------------------\n");
|
||||
for (uint i = 0; i < VP_FileInfo.size(); i++) {
|
||||
plat_time = VP_FileInfo[i].write_time; // gets rid of some platform strangeness this way
|
||||
strftime(out_time, 32, "%F %H:%M", localtime(&plat_time)); // YYYY-mm-dd HH:mm (ISO 8601 date format, 24-hr time)
|
||||
|
||||
if (VP_FileInfo[i].file_size > (int)one_m) {
|
||||
m = 'M';
|
||||
div_by = one_m;
|
||||
} else {
|
||||
m = 'K';
|
||||
div_by = one_k;
|
||||
}
|
||||
|
||||
int len = strlen( VP_FileInfo[i].file_name );
|
||||
printf("%s %*.1f%c %10i %18s %3s%s\n", VP_FileInfo[i].file_name, 33 - len, (float)VP_FileInfo[i].file_size/div_by, m, VP_FileInfo[i].offset, out_time, DIR_SEPARATOR_STR, VP_FileInfo[i].file_path);
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
|
||||
// we use the vector size here since VP_Header.num_files would include each entry
|
||||
// in the directory tree as well as individual files and that artificially inflates
|
||||
// the number of files that we show or would extract
|
||||
printf("Total files: %i\n", (int)VP_FileInfo.size());
|
||||
|
||||
// yeah, I'm just that cheap
|
||||
if (VP_Header.index_offset > (int)one_m) {
|
||||
m = 'M';
|
||||
div_by = one_m;
|
||||
} else {
|
||||
m = 'K';
|
||||
div_by = one_k;
|
||||
}
|
||||
|
||||
printf("Total size: %.1f%c\n", (float)VP_Header.index_offset/div_by, m);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void help()
|
||||
{
|
||||
printf("VP file extractor - version 0.5\n");
|
||||
printf("\n");
|
||||
printf("Usage: cfileextractor [-x | -l] [-L] <vp_filename>\n");
|
||||
printf("\n");
|
||||
printf(" Commands (only one at the time):\n");
|
||||
printf(" -x | --extract Extract all files into current directory.\n");
|
||||
printf(" -l | --list List all files in VP archive.\n");
|
||||
printf(" -h | --help Show this help text.\n");
|
||||
printf("\n");
|
||||
printf(" Options:\n");
|
||||
printf(" -L | --lowercase Force all filenames to be lower case.\n");
|
||||
printf("\n");
|
||||
printf(" (No command specified will list all files in the VP archive.)\n");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
// we end up #include'ing SDL.h which on Windows and Mac will redfine main() which is something
|
||||
// that we don't want since we don't actually link against SDL, this solves the problem...
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int extract = 0, lc = 0, list = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
help();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
|
||||
help();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// the last option should always be the VP file that we want
|
||||
fp_in = fopen(argv[argc-1], "rb");
|
||||
|
||||
if (fp_in == NULL)
|
||||
print_error(ERR_NO_FP_IN);
|
||||
|
||||
// if the header is invalid then read_header() should exit us out
|
||||
read_header();
|
||||
|
||||
// TODO: add filter based extraction
|
||||
for (int i = 1; i < argc-1; i++) {
|
||||
if (!strcmp(argv[i], "-x") || !strcmp(argv[i], "--extract")) {
|
||||
if (list) {
|
||||
help();
|
||||
exit(0);
|
||||
}
|
||||
extract = 1;
|
||||
} else if (!strcmp(argv[i], "-L") || !strcmp(argv[i], "--lowercase")) {
|
||||
lc = 1;
|
||||
} else if (!strcmp(argv[i], "-l") || !strcmp(argv[i], "--list")) {
|
||||
if (extract) {
|
||||
help();
|
||||
exit(0);
|
||||
}
|
||||
list = 1;
|
||||
} else {
|
||||
help();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// read the file index, make all filenames lowercase if wanted
|
||||
read_index( lc );
|
||||
|
||||
if (extract) {
|
||||
extract_all_files( argv[argc-1] );
|
||||
return 0;
|
||||
} else if (list) {
|
||||
list_all_files( argv[argc-1] );
|
||||
return 0;
|
||||
} else {
|
||||
// if only -L is specified or no command is specified then just list files
|
||||
list_all_files( argv[argc-1] );
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -11,11 +11,83 @@
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Cmdline/cmdline.h $
|
||||
|
||||
* $Revision: 2.54 $
|
||||
* $Date: 2004-04-26 18:23:47 $
|
||||
* $Author: Kazan $
|
||||
* $Revision: 2.73 $
|
||||
* $Date: 2005-07-25 05:24:16 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.72 2005/07/13 02:50:49 Goober5000
|
||||
* remove PreProcDefine #includes in FS2
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.71 2005/07/07 16:32:33 taylor
|
||||
* compiler warning fixes
|
||||
* add -noibx troubleshooting cmdline option to disable use of IBX files
|
||||
* don't try to set thuster object number is only one thruster bank is specified (default method should go into affect)
|
||||
*
|
||||
* Revision 2.70 2005/06/29 18:46:13 taylor
|
||||
* add option to not scale up movies to fit window/screen, default is to scale
|
||||
* (arguably not a bug but I said I would get it in before 3.6.5 and forgot)
|
||||
*
|
||||
* Revision 2.69 2005/03/13 23:07:35 taylor
|
||||
* enable 32-bit to 16-bit TGA conversion with -tga16 cmdline option (experimental)
|
||||
* fix crash when upgrading from original campaign stats file to current
|
||||
*
|
||||
* Revision 2.68 2005/02/16 10:00:13 wmcoolmon
|
||||
* "-ingame" command line option
|
||||
*
|
||||
* Revision 2.67 2005/01/30 12:50:08 taylor
|
||||
* merge with Linux/OSX tree - p0130
|
||||
*
|
||||
* Revision 2.66 2005/01/29 16:30:46 phreak
|
||||
* smart shield command line stuff. this will be changed in the future, but i want people to test it.
|
||||
* -phreak
|
||||
*
|
||||
* Revision 2.65 2005/01/21 08:29:04 taylor
|
||||
* add -rlm cmdline option to switch to local viewpoint lighting calculations (OGL only for now)
|
||||
*
|
||||
* Revision 2.64 2004/12/24 19:36:12 Goober5000
|
||||
* resorted command-line options and added an option for WMC's ballistic gauge
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.63 2004/11/23 19:29:13 taylor
|
||||
* fix 2d warp in D3D, add cmdline option for 3d warp
|
||||
*
|
||||
* Revision 2.62 2004/09/10 13:51:20 et1
|
||||
* Command line option for TBP for warp stuff, "-tbpwarpeffects"
|
||||
*
|
||||
* Revision 2.61 2004/08/11 05:06:19 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.60 2004/08/02 22:40:59 phreak
|
||||
* added -orbradar to enable orb rendering for the radar
|
||||
*
|
||||
* Revision 2.59 2004/08/01 02:31:18 phreak
|
||||
* -phreak command line changed to -dualscanlines
|
||||
*
|
||||
* Revision 2.58 2004/07/25 18:46:28 Kazan
|
||||
* -fred_no_warn has become -no_warn and applies to both fred and fs2
|
||||
* added new ai directive (last commit) and disabled afterburners while performing AIM_WAYPOINTS or AIM_FLY_TO_SHIP
|
||||
* fixed player ship speed bug w/ player-use-ai, now stays in formation correctly and manages speed
|
||||
* made -radar_reduce ignore itself if no parameter is given (ignoring launcher bug)
|
||||
*
|
||||
* Revision 2.57 2004/07/05 05:09:15 bobboau
|
||||
* FVF code, only the data that is needed is sent off to the card,,
|
||||
* OGL can take advantage of this if they want but it won't break
|
||||
* anything if they don't. also state block code has been implemented,
|
||||
* that's totaly internal to D3D no high level code is involved.
|
||||
*
|
||||
* Revision 2.56 2004/06/19 22:15:48 wmcoolmon
|
||||
* Added -nomotion debris command line option; also re-ordered categories.
|
||||
*
|
||||
* Revision 2.55 2004/06/06 12:25:19 randomtiger
|
||||
* Added new compression option -pcx32dds, build posted in RSB forum.
|
||||
* Changed flag because of launcher bug, have fixed launcher bug, will distribute later.
|
||||
* Also removed experimental flag from launcher flag list, stupid people were reporting bugs on unfinished code.
|
||||
*
|
||||
* Revision 2.54 2004/04/26 18:23:47 Kazan
|
||||
* -no_fps_capping
|
||||
*
|
||||
* Revision 2.53 2004/04/26 00:23:26 taylor
|
||||
* novbo and snd_preload cmdline options, fix moddir getting appended space
|
||||
*
|
||||
@@ -408,7 +480,6 @@
|
||||
*
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#ifndef FS_CMDLINE_HEADER_FILE
|
||||
#define FS_CMDLINE_HEADER_FILE
|
||||
|
||||
@@ -454,13 +525,16 @@ extern int Cmdline_window;
|
||||
extern char *Cmdline_almission; //DTP for autoload mission
|
||||
extern int Cmdline_gf4fix; //DTP for Random tigers GF4fix.
|
||||
extern int Cmdline_allslev;
|
||||
extern int Cmdline_phreak;
|
||||
extern int Cmdline_dualscanlines;
|
||||
extern int Cmdline_dnoshowvid; //WMC Toggles movie playing support
|
||||
extern int Cmdline_noscalevid; // disables fit-to-window for movies - taylor
|
||||
extern char *Cmdline_mod; //DTP for mod support
|
||||
extern int Cmdline_show_fps;//DTP moved here because it is the correct place for it to be.
|
||||
extern int Cmdline_show_stats;
|
||||
extern int Cmdline_safeloading;
|
||||
extern int Cmdline_nospec;
|
||||
extern int Cmdline_orb_radar;
|
||||
extern int Cmdline_TBPWarpEffects; // TBP warp effects -Et1
|
||||
|
||||
extern int Cmdline_cache_ani;
|
||||
extern int Cmdline_d3dmipmap;
|
||||
@@ -480,6 +554,14 @@ extern int Cmdline_jpgtga;
|
||||
extern int Cmdline_no_set_gamma;
|
||||
extern int Cmdline_d3d_no_vsync;
|
||||
extern int Cmdline_pcx32;
|
||||
extern int Cmdline_pcx32dds;
|
||||
extern int Cmdline_nomotiondebris;
|
||||
extern int Cmdline_rlm;
|
||||
extern int Cmdline_noibx;
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
extern int Cmdline_no_grab;
|
||||
#endif
|
||||
|
||||
extern int Cmdline_noglow;
|
||||
extern int Cmdline_timerbar;
|
||||
@@ -490,19 +572,34 @@ extern int Cmdline_d3d_particle;
|
||||
extern int Cmdline_ambient_factor;
|
||||
extern int Cmdline_show_mem_usage;
|
||||
extern int Cmdline_rt;
|
||||
extern int Cmdline_ingamejoin;
|
||||
extern char *Cmdline_start_mission;
|
||||
|
||||
extern int Cmdline_d3d_lesstmem;
|
||||
extern int Cmdline_batch_3dunlit;
|
||||
|
||||
extern int Cmdline_2d_poof;
|
||||
extern int Cmdline_3dwarp;
|
||||
|
||||
extern int Cmdline_FRED2_htl;
|
||||
extern int CmdLine_FRED2_NoWarn;
|
||||
extern int CmdLine_NoWarn;
|
||||
|
||||
extern int Cmdline_novbo;
|
||||
extern int Cmdline_snd_preload;
|
||||
extern int Cmdline_NoFPSCap;
|
||||
|
||||
extern float Cmdline_max_subdivide;
|
||||
|
||||
extern int Cmdline_alpha_env;
|
||||
extern int Cmdline_env;
|
||||
extern int Cmdline_decals;
|
||||
|
||||
extern int Cmdline_ballistic_gauge;
|
||||
extern int Cmdline_smart_shields;
|
||||
|
||||
extern int Cmdline_tga16;
|
||||
|
||||
extern int Cmdline_wcsaga;
|
||||
|
||||
//extern char FreeSpace_Directory[]; // allievating a cfilesystem problem caused by fred -- Kazan
|
||||
#endif
|
||||
@@ -9,13 +9,23 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CMeasure/CMeasure.cpp $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2004-03-05 09:01:57 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 2.6 $
|
||||
* $Date: 2005-04-05 05:53:15 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Counter measures. Created by Mike Kulas, May 12, 1997.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.5 2004/07/26 20:47:25 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.4 2004/07/12 16:32:43 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.3 2004/03/05 09:01:57 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.2 2003/03/18 10:07:00 unknownplayer
|
||||
* The big DX/main line merge. This has been uploaded to the main CVS since I can't manage to get it to upload to the DX branch. Apologies to all who may be affected adversely, but I'll work to debug it as fast as I can.
|
||||
*
|
||||
@@ -228,6 +238,8 @@
|
||||
#include "math/staticrand.h"
|
||||
#include "object/object.h"
|
||||
|
||||
|
||||
|
||||
cmeasure_info Cmeasure_info[MAX_CMEASURE_TYPES];
|
||||
cmeasure Cmeasures[MAX_CMEASURES];
|
||||
|
||||
@@ -360,7 +372,7 @@ float Skill_level_cmeasure_life_scale[NUM_SKILL_LEVELS] = {3.0f, 2.0f, 1.5f, 1.2
|
||||
// creates one countermeasure. A ship fires 1 of these per launch. rand_val is used
|
||||
// in multiplayer. If -1, then create a random number. If non-negative, use this
|
||||
// number for static_rand functions
|
||||
int cmeasure_create( object * source_obj, vector * pos, int cm_type, int rand_val )
|
||||
int cmeasure_create( object * source_obj, vec3d * pos, int cm_type, int rand_val )
|
||||
{
|
||||
int n, objnum, parent_objnum, arand;
|
||||
object * obj;
|
||||
@@ -430,7 +442,7 @@ int cmeasure_create( object * source_obj, vector * pos, int cm_type, int rand_va
|
||||
|
||||
Num_cmeasures++;
|
||||
|
||||
vector vel, rand_vec;
|
||||
vec3d vel, rand_vec;
|
||||
|
||||
vm_vec_scale_add(&vel, &source_obj->phys_info.vel, &source_obj->orient.vec.fvec, -25.0f);
|
||||
|
||||
|
||||
@@ -9,13 +9,23 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CMeasure/CMeasure.h $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2004-03-05 09:01:57 $
|
||||
* $Revision: 2.5 $
|
||||
* $Date: 2005-07-13 02:50:50 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Counter measures. Created by Mike Kulas, May 12, 1997.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.4 2005/04/05 05:53:15 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.3 2004/08/11 05:06:19 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.2 2004/03/05 09:01:57 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.1 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
@@ -121,7 +131,7 @@
|
||||
#include "globalincs/globals.h"
|
||||
|
||||
struct object;
|
||||
struct vector;
|
||||
struct vec3d;
|
||||
|
||||
#define MAX_CMEASURES 64
|
||||
|
||||
@@ -172,7 +182,7 @@ extern void cmeasure_render( object * obj );
|
||||
extern void cmeasure_delete( object * obj );
|
||||
extern void cmeasure_process_pre( object * obj, float frame_time);
|
||||
extern void cmeasure_process_post( object * obj, float frame_time);
|
||||
extern int cmeasure_create( object * source_obj, vector *pos, int cm_type, int rand_val = -1 );
|
||||
extern int cmeasure_create( object * source_obj, vec3d *pos, int cm_type, int rand_val = -1 );
|
||||
extern void cmeasure_select_next(object *objp);
|
||||
|
||||
#endif // _CMEASURE_H
|
||||
@@ -9,13 +9,54 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfig.cpp $
|
||||
* $Revision: 2.5 $
|
||||
* $Date: 2004-03-05 09:01:58 $
|
||||
* $Revision: 2.17 $
|
||||
* $Date: 2005-07-22 10:18:37 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C module for keyboard, joystick and mouse configuration
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.16 2005/07/13 02:50:50 Goober5000
|
||||
* remove PreProcDefine #includes in FS2
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.15 2005/07/07 16:36:57 taylor
|
||||
* various compiler warning fixes (some of these from dizzy)
|
||||
*
|
||||
* Revision 2.14 2005/07/02 19:42:14 taylor
|
||||
* ton of non-standard resolution fixes
|
||||
*
|
||||
* Revision 2.13 2005/05/12 17:49:11 taylor
|
||||
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
|
||||
* fixes various problems and is past time to make the switch
|
||||
*
|
||||
* Revision 2.12 2005/04/28 05:29:28 wmcoolmon
|
||||
* Removed FS2_DEMO defines that looked like they wouldn't cause the universe to collapse
|
||||
*
|
||||
* Revision 2.11 2005/04/17 05:38:28 taylor
|
||||
* updated Linux joystick code that's a bit less insane speed wise
|
||||
* remove ability to build without joystick support, no reason to keep it around
|
||||
* fix unusable warning flag with libjpeg building
|
||||
*
|
||||
* Revision 2.10 2005/03/02 21:24:43 taylor
|
||||
* more network/inferno goodness for Windows, takes care of a few warnings too
|
||||
*
|
||||
* Revision 2.9 2004/07/29 19:37:50 Kazan
|
||||
* unbug the JS bug i caused --- kazan
|
||||
*
|
||||
* Revision 2.8 2004/07/26 20:47:26 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.7 2004/07/25 00:31:28 Kazan
|
||||
* i have absolutely nothing to say about that subject
|
||||
*
|
||||
* Revision 2.6 2004/07/12 16:32:43 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.5 2004/03/05 09:01:58 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.4 2003/11/11 02:15:43 Goober5000
|
||||
* ubercommit - basically spelling and language fixes with some additional
|
||||
* warnings disabled
|
||||
@@ -324,6 +365,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "freespace2/freespace.h"
|
||||
#include "controlconfig/controlsconfig.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
@@ -350,6 +392,8 @@
|
||||
#include "hud/hud.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define NUM_SYSTEM_KEYS 14
|
||||
#define NUM_BUTTONS 19
|
||||
#define NUM_TABS 4
|
||||
@@ -718,6 +762,8 @@ int control_config_detect_axis()
|
||||
|
||||
int control_config_valid_action(int n)
|
||||
{
|
||||
//WMC - Invalid_demo_keys is never even filled!!
|
||||
/*
|
||||
#ifdef FS2_DEMO
|
||||
int i;
|
||||
|
||||
@@ -725,7 +771,7 @@ int control_config_valid_action(int n)
|
||||
if (n == Invalid_demo_keys[i])
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -831,7 +877,13 @@ void control_config_list_prepare()
|
||||
if ((Control_config[z].tab == Tab) && control_config_valid_action(z)) {
|
||||
k = Control_config[z].key_id;
|
||||
j = Control_config[z].joy_id;
|
||||
Cc_lines[Num_cc_lines].label = XSTR(Control_config[z].text, CONTROL_CONFIG_XSTR + z);
|
||||
|
||||
if (Control_config[z].hasXSTR)
|
||||
Cc_lines[Num_cc_lines].label = XSTR(Control_config[z].text, CONTROL_CONFIG_XSTR + z);
|
||||
else
|
||||
Cc_lines[Num_cc_lines].label = Control_config[z].text;
|
||||
|
||||
|
||||
Cc_lines[Num_cc_lines].cc_index = z;
|
||||
Cc_lines[Num_cc_lines++].y = y;
|
||||
y += font_height + 2;
|
||||
@@ -871,16 +923,16 @@ config_item_undo *get_undo_block(int size)
|
||||
{
|
||||
config_item_undo *ptr;
|
||||
|
||||
ptr = (config_item_undo *) malloc( sizeof(config_item_undo) );
|
||||
ptr = (config_item_undo *) vm_malloc( sizeof(config_item_undo) );
|
||||
Assert(ptr);
|
||||
ptr->next = Config_item_undo;
|
||||
Config_item_undo = ptr;
|
||||
|
||||
ptr->size = size;
|
||||
if (size) {
|
||||
ptr->index = (int *) malloc( sizeof(int) * size );
|
||||
ptr->index = (int *) vm_malloc( sizeof(int) * size );
|
||||
Assert(ptr->index);
|
||||
ptr->list = (config_item *) malloc( sizeof(config_item) * size );
|
||||
ptr->list = (config_item *) vm_malloc( sizeof(config_item) * size );
|
||||
Assert(ptr->list);
|
||||
|
||||
} else {
|
||||
@@ -902,11 +954,11 @@ void free_undo_block()
|
||||
|
||||
Config_item_undo = ptr->next;
|
||||
if (ptr->size) {
|
||||
free(ptr->list);
|
||||
free(ptr->index);
|
||||
vm_free(ptr->list);
|
||||
vm_free(ptr->index);
|
||||
}
|
||||
|
||||
free(ptr);
|
||||
vm_free(ptr);
|
||||
}
|
||||
|
||||
// undo the most recent binding changes
|
||||
@@ -965,8 +1017,9 @@ void control_config_save_axis_undo(int axis)
|
||||
config_item_undo *ptr;
|
||||
config_item item;
|
||||
|
||||
memset( &item, 0, sizeof(config_item) );
|
||||
|
||||
item.joy_id = (short) Axis_map_to[axis];
|
||||
item.used = 0;
|
||||
item.used = Invert_axis[axis];
|
||||
|
||||
ptr = get_undo_block(1);
|
||||
@@ -1082,6 +1135,8 @@ int control_config_clear_other()
|
||||
ptr = get_undo_block(total);
|
||||
for (i=j=0; i<NUM_JOY_AXIS_ACTIONS; i++)
|
||||
if ((Axis_map_to[i] == Axis_map_to[z]) && (i != z)) {
|
||||
memset( &item, 0, sizeof(config_item) );
|
||||
|
||||
item.joy_id = (short) Axis_map_to[i];
|
||||
item.used = Invert_axis[i];
|
||||
|
||||
@@ -1170,15 +1225,12 @@ int control_config_clear_all()
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef NO_JOYSTICK
|
||||
extern Joy_info joystick;
|
||||
#endif
|
||||
|
||||
int control_config_axis_default(int axis)
|
||||
{
|
||||
Assert(axis >= 0);
|
||||
|
||||
#ifndef NO_JOYSTICK
|
||||
if ( axis > 1 ) {
|
||||
if (Axis_map_to_defaults[axis] < 0)
|
||||
return -1;
|
||||
@@ -1188,9 +1240,6 @@ int control_config_axis_default(int axis)
|
||||
}
|
||||
|
||||
return Axis_map_to_defaults[axis];
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int control_config_do_reset()
|
||||
@@ -1225,6 +1274,8 @@ int control_config_do_reset()
|
||||
|
||||
for (i=0; i<NUM_JOY_AXIS_ACTIONS; i++)
|
||||
if ((Axis_map_to[i] != control_config_axis_default(i)) || (Invert_axis[i] != Invert_axis_defaults[i])) {
|
||||
memset( &item, 0, sizeof(config_item) );
|
||||
|
||||
item.joy_id = (short) Axis_map_to[i];
|
||||
item.used = Invert_axis[i];
|
||||
|
||||
@@ -1562,7 +1613,7 @@ void control_config_init()
|
||||
Control_config_backup[i] = Control_config[i];
|
||||
|
||||
common_set_interface_palette(NOX("ControlConfigPalette")); // set the interface palette
|
||||
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
|
||||
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
|
||||
Ui_window.set_mask_bmap(Conflict_background_bitmap_mask_fname[gr_screen.res]);
|
||||
Ui_window.tooltip_handler = control_config_tooltip_handler;
|
||||
|
||||
@@ -1627,26 +1678,26 @@ void control_config_init()
|
||||
control_config_conflict_check();
|
||||
|
||||
// setup strings
|
||||
Joy_axis_action_text[0] = strdup(XSTR("Turn (Yaw) Axis", 1016));
|
||||
Joy_axis_action_text[1] = strdup(XSTR("Pitch Axis", 1017));
|
||||
Joy_axis_action_text[2] = strdup(XSTR("Bank Axis", 1018));
|
||||
Joy_axis_action_text[3] = strdup(XSTR("Absolute Throttle Axis", 1019));
|
||||
Joy_axis_action_text[4] = strdup(XSTR("Relative Throttle Axis", 1020));
|
||||
Joy_axis_text[0] = strdup(XSTR("Joystick/Mouse X Axis", 1021));
|
||||
Joy_axis_text[1] = strdup(XSTR("Joystick/Mouse Y Axis", 1022));
|
||||
Joy_axis_text[2] = strdup(XSTR("Joystick Z Axis", 1023));
|
||||
Joy_axis_text[3] = strdup(XSTR("Joystick rX Axis", 1024));
|
||||
Joy_axis_text[4] = strdup(XSTR("Joystick rY Axis", 1025));
|
||||
Joy_axis_text[5] = strdup(XSTR("Joystick rZ Axis", 1026));
|
||||
Mouse_button_text[0] = strdup("");
|
||||
Mouse_button_text[1] = strdup(XSTR("Left Button", 1027));
|
||||
Mouse_button_text[2] = strdup(XSTR("Right Button", 1028));
|
||||
Mouse_button_text[3] = strdup(XSTR("Mid Button", 1029));
|
||||
Mouse_button_text[4] = strdup("");
|
||||
Mouse_axis_text[0] = strdup(XSTR("L/R", 1030));
|
||||
Mouse_axis_text[1] = strdup(XSTR("U/B", 1031));
|
||||
Invert_text[0] = strdup(XSTR("N", 1032));
|
||||
Invert_text[1] = strdup(XSTR("Y", 1033));
|
||||
Joy_axis_action_text[0] = vm_strdup(XSTR("Turn (Yaw) Axis", 1016));
|
||||
Joy_axis_action_text[1] = vm_strdup(XSTR("Pitch Axis", 1017));
|
||||
Joy_axis_action_text[2] = vm_strdup(XSTR("Bank Axis", 1018));
|
||||
Joy_axis_action_text[3] = vm_strdup(XSTR("Absolute Throttle Axis", 1019));
|
||||
Joy_axis_action_text[4] = vm_strdup(XSTR("Relative Throttle Axis", 1020));
|
||||
Joy_axis_text[0] = vm_strdup(XSTR("Joystick/Mouse X Axis", 1021));
|
||||
Joy_axis_text[1] = vm_strdup(XSTR("Joystick/Mouse Y Axis", 1022));
|
||||
Joy_axis_text[2] = vm_strdup(XSTR("Joystick Z Axis", 1023));
|
||||
Joy_axis_text[3] = vm_strdup(XSTR("Joystick rX Axis", 1024));
|
||||
Joy_axis_text[4] = vm_strdup(XSTR("Joystick rY Axis", 1025));
|
||||
Joy_axis_text[5] = vm_strdup(XSTR("Joystick rZ Axis", 1026));
|
||||
Mouse_button_text[0] = vm_strdup("");
|
||||
Mouse_button_text[1] = vm_strdup(XSTR("Left Button", 1027));
|
||||
Mouse_button_text[2] = vm_strdup(XSTR("Right Button", 1028));
|
||||
Mouse_button_text[3] = vm_strdup(XSTR("Mid Button", 1029));
|
||||
Mouse_button_text[4] = vm_strdup("");
|
||||
Mouse_axis_text[0] = vm_strdup(XSTR("L/R", 1030));
|
||||
Mouse_axis_text[1] = vm_strdup(XSTR("U/B", 1031));
|
||||
Invert_text[0] = vm_strdup(XSTR("N", 1032));
|
||||
Invert_text[1] = vm_strdup(XSTR("Y", 1033));
|
||||
|
||||
control_config_list_prepare();
|
||||
}
|
||||
@@ -1663,7 +1714,7 @@ void control_config_close()
|
||||
help_overlay_unload(CONTROL_CONFIG_OVERLAY);
|
||||
|
||||
if (Background_bitmap){
|
||||
bm_unload(Background_bitmap);
|
||||
bm_release(Background_bitmap);
|
||||
}
|
||||
|
||||
Ui_window.destroy();
|
||||
@@ -1675,31 +1726,31 @@ void control_config_close()
|
||||
// free strings
|
||||
for(idx=0; idx<NUM_JOY_AXIS_ACTIONS; idx++){
|
||||
if(Joy_axis_action_text[idx] != NULL){
|
||||
free(Joy_axis_action_text[idx]);
|
||||
vm_free(Joy_axis_action_text[idx]);
|
||||
Joy_axis_action_text[idx] = NULL;
|
||||
}
|
||||
}
|
||||
for(idx=0; idx<NUM_AXIS_TEXT; idx++){
|
||||
if(Joy_axis_text[idx] != NULL){
|
||||
free(Joy_axis_text[idx]);
|
||||
vm_free(Joy_axis_text[idx]);
|
||||
Joy_axis_text[idx] = NULL;
|
||||
}
|
||||
}
|
||||
for(idx=0; idx<NUM_MOUSE_TEXT; idx++){
|
||||
if(Mouse_button_text[idx] != NULL){
|
||||
free(Mouse_button_text[idx]);
|
||||
vm_free(Mouse_button_text[idx]);
|
||||
Mouse_button_text[idx] = NULL;
|
||||
}
|
||||
}
|
||||
for(idx=0; idx<NUM_MOUSE_AXIS_TEXT; idx++){
|
||||
if(Mouse_axis_text[idx] != NULL){
|
||||
free(Mouse_axis_text[idx]);
|
||||
vm_free(Mouse_axis_text[idx]);
|
||||
Mouse_axis_text[idx] = NULL;
|
||||
}
|
||||
}
|
||||
for(idx=0; idx<NUM_INVERT_TEXT; idx++){
|
||||
if(Invert_text[idx] != NULL){
|
||||
free(Invert_text[idx]);
|
||||
vm_free(Invert_text[idx]);
|
||||
Invert_text[idx] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -2194,7 +2245,11 @@ void control_config_do_frame(float frametime)
|
||||
gr_get_string_size(&w, NULL, str);
|
||||
gr_printf(x - w / 2, y - font_height, str);
|
||||
|
||||
strcpy(buf, XSTR(Control_config[i].text, CONTROL_CONFIG_XSTR + i));
|
||||
if (Control_config[i].hasXSTR)
|
||||
strcpy(buf, XSTR(Control_config[i].text, CONTROL_CONFIG_XSTR + i));
|
||||
else
|
||||
strcpy(buf, Control_config[i].text);
|
||||
|
||||
gr_force_fit_string(buf, 255, Conflict_wnd_coords[gr_screen.res][CONTROL_W_COORD]);
|
||||
gr_get_string_size(&w, NULL, buf);
|
||||
gr_printf(x - w / 2, y, buf);
|
||||
@@ -2466,6 +2521,7 @@ int check_control(int id, int key)
|
||||
}
|
||||
|
||||
if ((Control_config[id].key_id == key) || joy_down_count(Control_config[id].joy_id, 1) || mouse_down_count(1 << Control_config[id].joy_id)) {
|
||||
//mprintf(("Key used %d", key));
|
||||
control_used(id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,34 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfig.h $
|
||||
* $Revision: 2.7 $
|
||||
* $Date: 2004-05-03 21:22:19 $
|
||||
* $Author: Kazan $
|
||||
* $Revision: 2.13 $
|
||||
* $Date: 2005-07-13 02:50:50 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Header file for keyboard, joystick and mouse configuration
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.12 2005/07/13 02:30:52 Goober5000
|
||||
* removed autopilot #define
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.11 2005/03/03 06:05:27 wmcoolmon
|
||||
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
|
||||
*
|
||||
* Revision 2.10 2005/01/16 22:39:08 wmcoolmon
|
||||
* Added VM_TOPDOWN view; Added 2D mission mode, add 16384 to mission +Flags to use.
|
||||
*
|
||||
* Revision 2.9 2004/08/11 05:06:19 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.8 2004/07/25 00:31:28 Kazan
|
||||
* i have absolutely nothing to say about that subject
|
||||
*
|
||||
* Revision 2.7 2004/05/03 21:22:19 Kazan
|
||||
* Abandon strdup() usage for mod list processing - it was acting odd and causing crashing on free()
|
||||
* Fix condition where alt_tab_pause() would flipout and trigger failed assert if game minimizes during startup (like it does a lot during debug)
|
||||
* Nav Point / Auto Pilot code (All disabled via #ifdefs)
|
||||
*
|
||||
* Revision 2.6 2004/04/06 03:09:01 phreak
|
||||
* added a control config option for the wireframe hud targetbox i enabled ages ago
|
||||
*
|
||||
@@ -317,6 +338,7 @@ typedef struct config_item {
|
||||
short key_default; // default key bound to action
|
||||
short joy_default; // default joystick button bound to action
|
||||
char tab; // what tab (category) it belongs in
|
||||
bool hasXSTR; // whether we should translate this with an XSTR
|
||||
char *text; // describes the action in the config screen
|
||||
char type; // manner control should be checked in
|
||||
short key_id; // actual key bound to action
|
||||
@@ -475,18 +497,15 @@ typedef struct config_item {
|
||||
#define UP_SLIDE_THRUST 110
|
||||
#define DOWN_SLIDE_THRUST 111
|
||||
#define HUD_TARGETBOX_TOGGLE_WIREFRAME 112
|
||||
#define VIEW_TOPDOWN 113
|
||||
#define VIEW_TRACK_TARGET 114
|
||||
|
||||
#if defined(ENABLE_AUTO_PILOT)
|
||||
//AutoPilot - Kazan
|
||||
#define AUTO_PILOT_TOGGLE 113
|
||||
#define NAV_CYCLE 114
|
||||
#define AUTO_PILOT_TOGGLE 115
|
||||
#define NAV_CYCLE 116
|
||||
|
||||
// this should be the total number of control action defines above (or last define + 1)
|
||||
#define CCFG_MAX 115
|
||||
#else
|
||||
#define CCFG_MAX 113
|
||||
|
||||
#endif
|
||||
#define CCFG_MAX 117
|
||||
|
||||
extern int Failed_key_index;
|
||||
extern int Invert_heading;
|
||||
|
||||
@@ -9,13 +9,33 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfigCommon.cpp $
|
||||
* $Revision: 2.6 $
|
||||
* $Date: 2004-05-03 21:22:19 $
|
||||
* $Author: Kazan $
|
||||
* $Revision: 2.12 $
|
||||
* $Date: 2005-07-13 02:30:52 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* C module for keyboard, joystick and mouse configuration common stuff (between Fred and FreeSpace)
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.11 2005/03/03 06:05:27 wmcoolmon
|
||||
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
|
||||
*
|
||||
* Revision 2.10 2005/01/16 22:39:08 wmcoolmon
|
||||
* Added VM_TOPDOWN view; Added 2D mission mode, add 16384 to mission +Flags to use.
|
||||
*
|
||||
* Revision 2.9 2004/07/26 20:47:26 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.8 2004/07/25 00:31:28 Kazan
|
||||
* i have absolutely nothing to say about that subject
|
||||
*
|
||||
* Revision 2.7 2004/07/12 16:32:43 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.6 2004/05/03 21:22:19 Kazan
|
||||
* Abandon strdup() usage for mod list processing - it was acting odd and causing crashing on free()
|
||||
* Fix condition where alt_tab_pause() would flipout and trigger failed assert if game minimizes during startup (like it does a lot during debug)
|
||||
* Nav Point / Auto Pilot code (All disabled via #ifdefs)
|
||||
*
|
||||
* Revision 2.5 2004/04/06 03:09:01 phreak
|
||||
* added a control config option for the wireframe hud targetbox i enabled ages ago
|
||||
*
|
||||
@@ -398,6 +418,7 @@
|
||||
#include "io/joy.h"
|
||||
#include "localization/localize.h"
|
||||
|
||||
|
||||
#define TARGET_TAB 0
|
||||
#define SHIP_TAB 1
|
||||
#define WEAPON_TAB 2
|
||||
@@ -420,155 +441,155 @@ int Invert_axis_defaults[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
|
||||
//XSTR:OFF
|
||||
config_item Control_config[CCFG_MAX + 1] = {
|
||||
// targeting a ship
|
||||
{ KEY_T, -1, TARGET_TAB, "Target Next Ship" },
|
||||
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, "Target Previous Ship" },
|
||||
{ KEY_H, 2, TARGET_TAB, "Target Next Closest Hostile Ship" },
|
||||
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, "Target Previous Closest Hostile Ship" },
|
||||
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, "Toggle Auto Targeting" },
|
||||
{ KEY_F, -1, TARGET_TAB, "Target Next Closest Friendly Ship" },
|
||||
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, "Target Previous Closest Friendly Ship" },
|
||||
{ KEY_Y, 4, TARGET_TAB, "Target Ship in Reticle" },
|
||||
{ KEY_G, -1, TARGET_TAB, "Target Target's Nearest Attacker" },
|
||||
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, "Target Last Ship to Send Transmission" },
|
||||
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, "Turn Off Auto-Targeting" },
|
||||
{ KEY_T, -1, TARGET_TAB, true, "Target Next Ship" },
|
||||
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, true, "Target Previous Ship" },
|
||||
{ KEY_H, 2, TARGET_TAB, true, "Target Next Closest Hostile Ship" },
|
||||
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, true, "Target Previous Closest Hostile Ship" },
|
||||
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, true, "Toggle Auto Targeting" },
|
||||
{ KEY_F, -1, TARGET_TAB, true, "Target Next Closest Friendly Ship" },
|
||||
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, true, "Target Previous Closest Friendly Ship" },
|
||||
{ KEY_Y, 4, TARGET_TAB, true, "Target Ship in Reticle" },
|
||||
{ KEY_G, -1, TARGET_TAB, true, "Target Target's Nearest Attacker" },
|
||||
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, true, "Target Last Ship to Send Transmission" },
|
||||
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, true, "Turn Off Auto-Targeting" },
|
||||
|
||||
// targeting a ship's subsystem
|
||||
{ KEY_V, -1, TARGET_TAB, "Target Subsystem in Reticle" },
|
||||
{ KEY_S, -1, TARGET_TAB, "Target Next Subsystem" },
|
||||
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, "Target Previous Subsystem" },
|
||||
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, "Turn Off Auto-Targeting of Subsystems" },
|
||||
{ KEY_V, -1, TARGET_TAB, true, "Target Subsystem in Reticle" },
|
||||
{ KEY_S, -1, TARGET_TAB, true, "Target Next Subsystem" },
|
||||
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, true, "Target Previous Subsystem" },
|
||||
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, true, "Turn Off Auto-Targeting of Subsystems" },
|
||||
|
||||
// matching speed
|
||||
{ KEY_M, -1, COMPUTER_TAB, "Match Target Speed" },
|
||||
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, "Toggle Auto Speed Matching" },
|
||||
{ KEY_M, -1, COMPUTER_TAB, true, "Match Target Speed" },
|
||||
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, true, "Toggle Auto Speed Matching" },
|
||||
|
||||
// weapons
|
||||
{ KEY_LCTRL, 0, WEAPON_TAB, "Fire Primary Weapon", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_SPACEBAR, 1, WEAPON_TAB, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PERIOD, -1, WEAPON_TAB, "Cycle Forward Primary Weapon" },
|
||||
{ KEY_COMMA, -1, WEAPON_TAB, "Cycle Backward Primary Weapon" },
|
||||
{ KEY_DIVIDE, -1, WEAPON_TAB, "Cycle Secondary Weapon Bank" },
|
||||
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, "Cycle Secondary Weapon Firing Rate" },
|
||||
{ KEY_X, 3, WEAPON_TAB, "Launch Countermeasure" },
|
||||
{ KEY_LCTRL, 0, WEAPON_TAB, true, "Fire Primary Weapon", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_SPACEBAR, 1, WEAPON_TAB, true, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PERIOD, -1, WEAPON_TAB, true, "Cycle Forward Primary Weapon" },
|
||||
{ KEY_COMMA, -1, WEAPON_TAB, true, "Cycle Backward Primary Weapon" },
|
||||
{ KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Bank" },
|
||||
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Firing Rate" },
|
||||
{ KEY_X, 3, WEAPON_TAB, true, "Launch Countermeasure" },
|
||||
|
||||
// controls
|
||||
{ KEY_A, -1, SHIP_TAB, "Forward Thrust", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_Z, -1, SHIP_TAB, "Reverse Thrust", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD7, -1, SHIP_TAB, "Bank Left", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD9, -1, SHIP_TAB, "Bank Right", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD8, -1, SHIP_TAB, "Pitch Forward", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD2, -1, SHIP_TAB, "Pitch Backward", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD4, -1, SHIP_TAB, "Turn Left", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD6, -1, SHIP_TAB, "Turn Right", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_A, -1, SHIP_TAB, true, "Forward Thrust", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_Z, -1, SHIP_TAB, true, "Reverse Thrust", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD7, -1, SHIP_TAB, true, "Bank Left", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD9, -1, SHIP_TAB, true, "Bank Right", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD8, -1, SHIP_TAB, true, "Pitch Forward", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD2, -1, SHIP_TAB, true, "Pitch Backward", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD4, -1, SHIP_TAB, true, "Turn Left", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD6, -1, SHIP_TAB, true, "Turn Right", CC_TYPE_CONTINUOUS },
|
||||
|
||||
// throttle controls
|
||||
{ KEY_BACKSP, -1, SHIP_TAB, "Set Throttle to Zero" },
|
||||
{ KEY_SLASH, -1, SHIP_TAB, "Set Throttle to Max" },
|
||||
{ KEY_LBRACKET, -1, SHIP_TAB, "Set Throttle to One-Third" },
|
||||
{ KEY_RBRACKET, -1, SHIP_TAB, "Set Throttle to Two-Thirds" },
|
||||
{ KEY_EQUAL, -1, SHIP_TAB, "Increase Throttle 5 Percent" },
|
||||
{ KEY_MINUS, -1, SHIP_TAB, "Decrease Throttle 5 Percent" },
|
||||
{ KEY_BACKSP, -1, SHIP_TAB, true, "Set Throttle to Zero" },
|
||||
{ KEY_SLASH, -1, SHIP_TAB, true, "Set Throttle to Max" },
|
||||
{ KEY_LBRACKET, -1, SHIP_TAB, true, "Set Throttle to One-Third" },
|
||||
{ KEY_RBRACKET, -1, SHIP_TAB, true, "Set Throttle to Two-Thirds" },
|
||||
{ KEY_EQUAL, -1, SHIP_TAB, true, "Increase Throttle 5 Percent" },
|
||||
{ KEY_MINUS, -1, SHIP_TAB, true, "Decrease Throttle 5 Percent" },
|
||||
|
||||
// squadmate messaging
|
||||
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, "Attack My Target" },
|
||||
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, "Disarm My Target" },
|
||||
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, "Disable My Target" },
|
||||
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, "Attack my Subsystem" },
|
||||
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, "Capture My Target" },
|
||||
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, "Engage Enemy" },
|
||||
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, "Form on my Wing" },
|
||||
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, "Ignore my Target" },
|
||||
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, "Protect my Target" },
|
||||
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, "Cover me" },
|
||||
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, "Return to base" },
|
||||
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, "Rearm me" },
|
||||
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, true, "Attack My Target" },
|
||||
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, true, "Disarm My Target" },
|
||||
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, true, "Disable My Target" },
|
||||
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, true, "Attack my Subsystem" },
|
||||
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, true, "Capture My Target" },
|
||||
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Engage Enemy" },
|
||||
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, true, "Form on my Wing" },
|
||||
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, true, "Ignore my Target" },
|
||||
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, true, "Protect my Target" },
|
||||
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, true, "Cover me" },
|
||||
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, true, "Return to base" },
|
||||
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, true, "Rearm me" },
|
||||
|
||||
{ KEY_R, 6, TARGET_TAB, "Target Closest Attacking Ship" },
|
||||
{ KEY_R, 6, TARGET_TAB, true, "Target Closest Attacking Ship" },
|
||||
|
||||
// Views
|
||||
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, "Chase View" },
|
||||
{ KEY_PADPERIOD, -1, COMPUTER_TAB, "External View"},
|
||||
{ KEY_PADENTER, -1, COMPUTER_TAB, "Toggle External Camera Lock"},
|
||||
{ KEY_PAD0, -1, COMPUTER_TAB, "Free Look View", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, "Current Target View" },
|
||||
{ KEY_PADPLUS, -1, COMPUTER_TAB, "Increase View Distance", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PADMINUS, -1, COMPUTER_TAB, "Decrease View Distance", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD5, -1, COMPUTER_TAB, "Center View", CC_TYPE_CONTINUOUS },
|
||||
{ -1, 33, COMPUTER_TAB, "View Up", CC_TYPE_CONTINUOUS },
|
||||
{ -1, 32, COMPUTER_TAB, "View Rear", CC_TYPE_CONTINUOUS },
|
||||
{ -1, 34, COMPUTER_TAB, "View Left", CC_TYPE_CONTINUOUS },
|
||||
{ -1, 35, COMPUTER_TAB, "View Right", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, true, "Chase View" },
|
||||
{ KEY_PADPERIOD, -1, COMPUTER_TAB, true, "External View"},
|
||||
{ KEY_PADENTER, -1, COMPUTER_TAB, true, "Toggle External Camera Lock"},
|
||||
{ KEY_PAD0, -1, COMPUTER_TAB, true, "Free Look View", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, true, "Current Target View" },
|
||||
{ KEY_PADPLUS, -1, COMPUTER_TAB, true, "Increase View Distance", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PADMINUS, -1, COMPUTER_TAB, true, "Decrease View Distance", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_PAD5, -1, COMPUTER_TAB, true, "Center View", CC_TYPE_CONTINUOUS },
|
||||
{ -1, 33, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS },
|
||||
{ -1, 32, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS },
|
||||
{ -1, 34, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS },
|
||||
{ -1, 35, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS },
|
||||
|
||||
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, "Cycle Radar Range" },
|
||||
{ KEY_C, -1, COMPUTER_TAB, "Communications Menu" },
|
||||
{ -1, -1, -1, "Show Objectives" },
|
||||
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, "Enter Subspace (End Mission)" },
|
||||
{ KEY_J, -1, TARGET_TAB, "Target Target's Target" },
|
||||
{ KEY_TAB, 5, SHIP_TAB, "Afterburner", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, true, "Cycle Radar Range" },
|
||||
{ KEY_C, -1, COMPUTER_TAB, true, "Communications Menu" },
|
||||
{ -1, -1, -1, true, "Show Objectives" },
|
||||
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, true, "Enter Subspace (End Mission)" },
|
||||
{ KEY_J, -1, TARGET_TAB, true, "Target Target's Target" },
|
||||
{ KEY_TAB, 5, SHIP_TAB, true, "Afterburner", CC_TYPE_CONTINUOUS },
|
||||
|
||||
{ KEY_INSERT, -1, COMPUTER_TAB, "Increase Weapon Energy" },
|
||||
{ KEY_DELETE, -1, COMPUTER_TAB, "Decrease Weapon Energy" },
|
||||
{ KEY_HOME, -1, COMPUTER_TAB, "Increase Shield Energy" },
|
||||
{ KEY_END, -1, COMPUTER_TAB, "Decrease Shield Energy" },
|
||||
{ KEY_PAGEUP, -1, COMPUTER_TAB, "Increase Engine Energy" },
|
||||
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, "Decrease Engine Energy" },
|
||||
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, "Equalize Energy Settings" },
|
||||
{ KEY_INSERT, -1, COMPUTER_TAB, true, "Increase Weapon Energy" },
|
||||
{ KEY_DELETE, -1, COMPUTER_TAB, true, "Decrease Weapon Energy" },
|
||||
{ KEY_HOME, -1, COMPUTER_TAB, true, "Increase Shield Energy" },
|
||||
{ KEY_END, -1, COMPUTER_TAB, true, "Decrease Shield Energy" },
|
||||
{ KEY_PAGEUP, -1, COMPUTER_TAB, true, "Increase Engine Energy" },
|
||||
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, true, "Decrease Engine Energy" },
|
||||
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, true, "Equalize Energy Settings" },
|
||||
|
||||
{ KEY_Q, 7, COMPUTER_TAB, "Equalize Shield" },
|
||||
{ KEY_UP, -1, COMPUTER_TAB, "Augment Forward Shield" },
|
||||
{ KEY_DOWN, -1, COMPUTER_TAB, "Augment Rear Shield" },
|
||||
{ KEY_LEFT, -1, COMPUTER_TAB, "Augment Left Shield" },
|
||||
{ KEY_RIGHT, -1, COMPUTER_TAB, "Augment Right Shield" },
|
||||
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, "Transfer Energy Laser->Shield" },
|
||||
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, "Transfer Energy Shield->Laser" },
|
||||
{ -1, -1, -1, "Show Damage Popup Window" },
|
||||
{ KEY_Q, 7, COMPUTER_TAB, true, "Equalize Shield" },
|
||||
{ KEY_UP, -1, COMPUTER_TAB, true, "Augment Forward Shield" },
|
||||
{ KEY_DOWN, -1, COMPUTER_TAB, true, "Augment Rear Shield" },
|
||||
{ KEY_LEFT, -1, COMPUTER_TAB, true, "Augment Left Shield" },
|
||||
{ KEY_RIGHT, -1, COMPUTER_TAB, true, "Augment Right Shield" },
|
||||
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Laser->Shield" },
|
||||
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Shield->Laser" },
|
||||
{ -1, -1, -1, true, "Show Damage Popup Window" },
|
||||
|
||||
{ -1, -1, SHIP_TAB, "Bank When Pressed", CC_TYPE_CONTINUOUS },
|
||||
{ -1, -1, -1, "Show NavMap" },
|
||||
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, "Add or Remove Escort" },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, "Clear Escort List" },
|
||||
{ KEY_E, -1, TARGET_TAB, "Target Next Escort Ship" },
|
||||
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, "Target Closest Repair Ship" },
|
||||
{ -1, -1, SHIP_TAB, true, "Bank When Pressed", CC_TYPE_CONTINUOUS },
|
||||
{ -1, -1, -1, true, "Show NavMap" },
|
||||
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, true, "Add or Remove Escort" },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Clear Escort List" },
|
||||
{ KEY_E, -1, TARGET_TAB, true, "Target Next Escort Ship" },
|
||||
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, true, "Target Closest Repair Ship" },
|
||||
|
||||
{ KEY_U, -1, TARGET_TAB, "Target Next Uninspected Cargo" },
|
||||
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, "Target Previous Uninspected Cargo" },
|
||||
{ KEY_N, -1, TARGET_TAB, "Target Newest Ship In Area" },
|
||||
{ KEY_K, -1, TARGET_TAB, "Target Next Live Turret" },
|
||||
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, "Target Previous Live Turret" },
|
||||
{ KEY_U, -1, TARGET_TAB, true, "Target Next Uninspected Cargo" },
|
||||
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, true, "Target Previous Uninspected Cargo" },
|
||||
{ KEY_N, -1, TARGET_TAB, true, "Target Newest Ship In Area" },
|
||||
{ KEY_K, -1, TARGET_TAB, true, "Target Next Live Turret" },
|
||||
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, true, "Target Previous Live Turret" },
|
||||
|
||||
{ KEY_B, -1, TARGET_TAB, "Target Next Hostile Bomb or Bomber" },
|
||||
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, "Target Previous Hostile Bomb or Bomber" },
|
||||
{ KEY_B, -1, TARGET_TAB, true, "Target Next Hostile Bomb or Bomber" },
|
||||
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber" },
|
||||
|
||||
// multiplayer messaging keys
|
||||
{ KEY_1, -1, COMPUTER_TAB, "(Multiplayer) Message All", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_2, -1, COMPUTER_TAB, "(Multiplayer) Message Friendly", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_3, -1, COMPUTER_TAB, "(Multiplayer) Message Hostile", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_4, -1, COMPUTER_TAB, "(Multiplayer) Message Target", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, "(Multiplayer) Observer zoom to target"},
|
||||
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target", CC_TYPE_CONTINUOUS },
|
||||
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, true, "(Multiplayer) Observer zoom to target"},
|
||||
|
||||
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, "Increase time compression" },
|
||||
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, "Decrease time compression" },
|
||||
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, true, "Increase time compression" },
|
||||
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, true, "Decrease time compression" },
|
||||
|
||||
{ KEY_L, -1, COMPUTER_TAB, "Toggle high HUD contrast" },
|
||||
{ KEY_L, -1, COMPUTER_TAB, true, "Toggle high HUD contrast" },
|
||||
|
||||
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, "(Multiplayer) Toggle network info"},
|
||||
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, "(Multiplayer) Self destruct"},
|
||||
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, true, "(Multiplayer) Toggle network info"},
|
||||
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, true, "(Multiplayer) Self destruct"},
|
||||
|
||||
// Misc
|
||||
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, "Toggle HUD"},
|
||||
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, "Right Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, "Left Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, "Up Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, "Down Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, "Toggle HUD Wireframe Targetbox"},
|
||||
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, true, "Toggle HUD"},
|
||||
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, true, "Right Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, true, "Left Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, true, "Up Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, true, "Down Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, true, "Toggle HUD Wireframe Targetbox"},
|
||||
{ -1, -1, COMPUTER_TAB, false, "Top-down View"},
|
||||
{ -1, -1, COMPUTER_TAB, false, "Track targeted object", CC_TYPE_CONTINUOUS},
|
||||
|
||||
#if defined(ENABLE_AUTO_PILOT)
|
||||
// Auto Navigation Systen
|
||||
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, "Toggle Auto Pilot"},
|
||||
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, "Cycle Nav Points"},
|
||||
#endif
|
||||
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, false, "Toggle Auto Pilot"},
|
||||
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, false, "Cycle Nav Points"},
|
||||
|
||||
{ -1, -1, -1, "" }
|
||||
{ -1, -1, -1, false, "" }
|
||||
};
|
||||
|
||||
char *Scan_code_text_german[] = {
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Cryptstring/cryptstring.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:04 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2005-09-08 00:09:32 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Applet for crypting strings.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.1 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:21 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -33,6 +36,13 @@
|
||||
#include <string.h>
|
||||
#include "globalincs/crypt.h"
|
||||
|
||||
|
||||
// we end up #include'ing SDL.h which on Windows and Mac will redfine main() which is something
|
||||
// that we don't want since we don't actually link against SDL, this solves the problem...
|
||||
#ifdef main
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -9,16 +9,35 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Cutscene/Cutscenes.cpp $
|
||||
* $Revision: 2.11 $
|
||||
* $Date: 2004-04-26 13:11:11 $
|
||||
* $Revision: 2.17 $
|
||||
* $Date: 2005-07-02 19:42:14 $
|
||||
* $Author: taylor $
|
||||
* $Revision: 2.11 $
|
||||
* $Date: 2004-04-26 13:11:11 $
|
||||
* $Revision: 2.17 $
|
||||
* $Date: 2005-07-02 19:42:14 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Code for the cutscenes viewer screen
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.16 2005/05/12 17:49:11 taylor
|
||||
* use vm_malloc(), vm_free(), vm_realloc(), vm_strdup() rather than system named macros
|
||||
* fixes various problems and is past time to make the switch
|
||||
*
|
||||
* Revision 2.15 2005/02/23 04:51:55 taylor
|
||||
* some bm_unload() -> bm_release() changes to save bmpman slots
|
||||
*
|
||||
* Revision 2.14 2005/01/31 23:27:51 taylor
|
||||
* merge with Linux/OSX tree - p0131-2
|
||||
*
|
||||
* Revision 2.13 2004/07/26 20:47:26 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.12 2004/07/12 16:32:43 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.11 2004/04/26 13:11:11 taylor
|
||||
* mark view cutscenes ignoring extension and file case
|
||||
*
|
||||
* Revision 2.10 2004/03/05 09:01:58 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
@@ -219,6 +238,7 @@
|
||||
#include "localization/localize.h"
|
||||
#include "parse/parselo.h"
|
||||
|
||||
|
||||
char *Cutscene_bitmap_name[GR_NUM_RESOLUTIONS] = {
|
||||
"ViewFootage",
|
||||
"2_ViewFootage"
|
||||
@@ -236,7 +256,7 @@ cutscene_info Cutscenes[MAX_CUTSCENES];
|
||||
//extern int All_movies_enabled; // If set, all movies may be viewed. Keyed off cheat code.
|
||||
void cutsceen_close(){
|
||||
for(int i = 0; i<MAX_CUTSCENES; i++)
|
||||
if(Cutscenes[i].description)free(Cutscenes[i].description);
|
||||
if(Cutscenes[i].description)vm_free(Cutscenes[i].description);
|
||||
}
|
||||
|
||||
// initialization stuff for cutscenes
|
||||
@@ -270,7 +290,7 @@ void cutscene_init()
|
||||
stuff_string(buf, F_MULTITEXT, NULL);
|
||||
drop_white_space(buf);
|
||||
compact_multitext_string(buf);
|
||||
Cutscenes[Num_cutscenes].description = strdup(buf);
|
||||
Cutscenes[Num_cutscenes].description = vm_strdup(buf);
|
||||
required_string("$cd:");
|
||||
stuff_int( &Cutscenes[Num_cutscenes].cd );
|
||||
|
||||
@@ -289,7 +309,6 @@ void cutscene_init()
|
||||
// returns -1 on failure.
|
||||
int cutscenes_get_cd_num( char *filename )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined(OEM_BUILD)
|
||||
return 0; // only 1 cd for OEM
|
||||
#else
|
||||
@@ -303,9 +322,6 @@ int cutscenes_get_cd_num( char *filename )
|
||||
|
||||
return -1;
|
||||
#endif // defined(OEM_BUILD)
|
||||
#else // !WIN32
|
||||
return -1;
|
||||
#endif // ifdef WIN32
|
||||
}
|
||||
|
||||
// marks a cutscene as viewable
|
||||
@@ -354,7 +370,7 @@ void cutscene_mark_viewable(char *filename)
|
||||
|
||||
static int Num_files;
|
||||
static int Cutscene_list[MAX_CUTSCENES];
|
||||
static int Stats_scroll_offset;
|
||||
//static int Stats_scroll_offset; // not used - taylor
|
||||
static int Selected_line = 0; // line that is currently selected for binding
|
||||
static int Scroll_offset;
|
||||
static int Background_bitmap;
|
||||
@@ -442,7 +458,6 @@ static char *Text_lines[MAX_TEXT_LINES];
|
||||
|
||||
int cutscenes_validate_cd(char *mve_name, int prompt_for_cd)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int cd_present = 0;
|
||||
int cd_drive_num;
|
||||
int cd_mve_is_on;
|
||||
@@ -509,10 +524,7 @@ int cutscenes_validate_cd(char *mve_name, int prompt_for_cd)
|
||||
|
||||
}
|
||||
|
||||
return cd_present;
|
||||
#else // !WIN32
|
||||
return 0;
|
||||
#endif // ifdef WIN32
|
||||
return cd_present;
|
||||
}
|
||||
|
||||
void cutscenes_screen_play()
|
||||
@@ -650,7 +662,7 @@ void cutscenes_screen_init()
|
||||
int i;
|
||||
ui_button_info *b;
|
||||
|
||||
Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
|
||||
Ui_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
|
||||
Ui_window.set_mask_bmap(Cutscene_mask_name[gr_screen.res]);
|
||||
|
||||
for (i=0; i<NUM_BUTTONS; i++) {
|
||||
@@ -703,7 +715,7 @@ void cutscenes_screen_init()
|
||||
void cutscenes_screen_close()
|
||||
{
|
||||
if (Background_bitmap)
|
||||
bm_unload(Background_bitmap);
|
||||
bm_release(Background_bitmap);
|
||||
|
||||
Ui_window.destroy();
|
||||
}
|
||||
|
||||
@@ -9,13 +9,20 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Cutscene/Cutscenes.h $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2004-03-05 09:01:58 $
|
||||
* $Revision: 2.4 $
|
||||
* $Date: 2005-07-13 02:50:50 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Code for the cutscenes viewer screen
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.3 2004/08/11 05:06:20 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.2 2004/03/05 09:01:58 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.1 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
|
||||
@@ -9,22 +9,43 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/cutscene/movie.cpp $
|
||||
* $Revision: 2.20 $
|
||||
* $Date: 2004-04-26 13:09:20 $
|
||||
* $Revision: 2.26 $
|
||||
* $Date: 2005-05-12 17:37:48 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* movie player code
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.25 2005/04/24 06:52:23 wmcoolmon
|
||||
* Enabled movies in windowed mode; if this causes problems for people, they can always use -dnoshowvid
|
||||
*
|
||||
* Revision 2.24 2005/02/05 00:30:49 taylor
|
||||
* fix a few things post merge
|
||||
*
|
||||
* Revision 2.23 2004/11/27 10:42:18 taylor
|
||||
* this should get movies working again in D3D and help OGL too
|
||||
*
|
||||
* Revision 2.22 2004/07/26 20:47:26 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.21 2004/07/12 16:32:43 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.20 2004/04/26 13:09:20 taylor
|
||||
* cvs log header, mark cutscenes viewable for later, gr_flip() to fix OGL white flash
|
||||
*
|
||||
*
|
||||
*
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
|
||||
#include "movie.h"
|
||||
#include "directx/dx8show.h"
|
||||
#include "graphics/grd3dinternal.h"
|
||||
#endif
|
||||
|
||||
#include "cutscene/movie.h"
|
||||
#include "osapi/osapi.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "debugconsole/dbugfile.h"
|
||||
@@ -32,21 +53,23 @@
|
||||
#include "cutscene/cutscenes.h" // cutscene_mark_viewable()
|
||||
#include "freespace2/freespace.h" // for Game_mode, etc.
|
||||
|
||||
|
||||
|
||||
// This module links freespace movie calls to the actual API calls the play the movie.
|
||||
// This module handles all the different requires of OS and gfx API and finding the file to play
|
||||
#ifdef _WIN32
|
||||
|
||||
void process_messages()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
MSG msg;
|
||||
while(PeekMessage(&msg, (HWND) os_get_window(), 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "graphics/grd3dinternal.h"
|
||||
|
||||
// filename - file to search for
|
||||
// out_name - output, full path to file
|
||||
@@ -101,16 +124,11 @@ bool movie_play(char *name)
|
||||
cutscene_mark_viewable(name);
|
||||
}
|
||||
|
||||
// reset the gr_* stuff before trying to play a movie
|
||||
// fixes white flash in OGL and possibly other wierd stuff
|
||||
gr_reset_clip();
|
||||
gr_clear();
|
||||
gr_flip();
|
||||
|
||||
extern int Is_standalone;
|
||||
if(Is_standalone) return false;
|
||||
if(Cmdline_dnoshowvid) return false;
|
||||
if(Cmdline_window) return false;
|
||||
//Commented this out since we have dnoshowvid -WMC
|
||||
//if(Cmdline_window) return false;
|
||||
|
||||
char full_name[MAX_PATH];
|
||||
int rc = 0;
|
||||
@@ -124,6 +142,7 @@ bool movie_play(char *name)
|
||||
DBUGFILE_OUTPUT_1("About to play: %s", full_name);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
process_messages();
|
||||
|
||||
// This is a bit of a hack but it works nicely
|
||||
@@ -132,9 +151,14 @@ bool movie_play(char *name)
|
||||
GlobalD3DVars::D3D_activate = 0;
|
||||
GlobalD3DVars::lpD3DDevice->EndScene();
|
||||
GlobalD3DVars::lpD3DDevice->Present(NULL,NULL,NULL,NULL);
|
||||
d3d_lost_device();
|
||||
// d3d_lost_device();
|
||||
}
|
||||
|
||||
// reset the gr_* stuff before trying to play a movie
|
||||
gr_flip(); // in the case of D3D this should recover the device
|
||||
gr_clear();
|
||||
gr_flip(); // need an extra flip here to cycle in the clear'd buffer
|
||||
|
||||
// This clears the screen
|
||||
InvalidateRect((HWND) os_get_window(), NULL, TRUE);
|
||||
PAINTSTRUCT paint_info;
|
||||
@@ -217,7 +241,14 @@ bool movie_play(char *name)
|
||||
|
||||
// We finished playing the movie
|
||||
CloseClip((HWND) os_get_window());
|
||||
GlobalD3DVars::D3D_activate = 1;
|
||||
|
||||
if (gr_screen.mode == GR_DIRECT3D) {
|
||||
GlobalD3DVars::D3D_activate = 1;
|
||||
}
|
||||
#else
|
||||
STUB_FUNCTION;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -229,12 +260,3 @@ bool movie_play_two(char *name1, char *name2)
|
||||
|
||||
return result1 && result2;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// Stubs, preprocessor calls were making the win32 code more complex for no good reason.
|
||||
// Using stubs instead.
|
||||
bool movie_play(char *name) {return true;}
|
||||
bool movie_play_two(char *name1, char *name2) {return true;}
|
||||
|
||||
#endif
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
#ifndef _MOVIE_HEADER_FILE
|
||||
#define _MOVIE_HEADER_FILE
|
||||
|
||||
|
||||
+154
-108
@@ -1,142 +1,197 @@
|
||||
#include "ddsutils/ddsutils.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
|
||||
|
||||
int Texture_compression_enabled=0;
|
||||
|
||||
static int dds_read_header_internal(LPDDSURFACEDESC2 lpddsd, char *filename, int *width, int *height, int *bpp, int *compression_type, int *levels)
|
||||
|
||||
int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int *bpp, int *compression_type, int *levels, int *size)
|
||||
{
|
||||
char code[5];
|
||||
DDSURFACEDESC2 dds_header;
|
||||
int code = 0;
|
||||
CFILE *ddsfile;
|
||||
char real_name[MAX_FILENAME_LEN];
|
||||
char *p;
|
||||
int retval=DDS_ERROR_NONE;
|
||||
int ct;
|
||||
int bits=0;
|
||||
int retval = DDS_ERROR_NONE;
|
||||
int ct = DDS_UNCOMPRESSED;
|
||||
int bits = 0;
|
||||
int trash;
|
||||
|
||||
//this better not happen.. ever
|
||||
Assert(filename!=NULL);
|
||||
if (img_cfp == NULL) {
|
||||
// this better not happen.. ever
|
||||
Assert(filename != NULL);
|
||||
|
||||
//make sure there is an extension
|
||||
strcpy(real_name, filename);
|
||||
p=strchr(real_name, '.');
|
||||
if (p) *p=0;
|
||||
strcat(real_name, ".dds");
|
||||
// make sure there is an extension
|
||||
strcpy(real_name, filename);
|
||||
char *p = strchr(real_name, '.');
|
||||
if (p) { *p=0; }
|
||||
strcat(real_name, ".dds");
|
||||
|
||||
memset(code,0,sizeof(code));
|
||||
//try to open the file
|
||||
ddsfile = cfopen(real_name, "rb");
|
||||
// try to open the file
|
||||
ddsfile = cfopen(real_name, "rb");
|
||||
|
||||
//file not found
|
||||
if (!ddsfile)
|
||||
{
|
||||
return DDS_ERROR_INVALID_FILENAME;
|
||||
// file not found
|
||||
if (ddsfile == NULL)
|
||||
return DDS_ERROR_INVALID_FILENAME;
|
||||
} else {
|
||||
ddsfile = img_cfp;
|
||||
}
|
||||
|
||||
//read the code
|
||||
cfread(code,1,4,ddsfile);
|
||||
code[4]=0;
|
||||
// read the code
|
||||
code = cfread_int(ddsfile);
|
||||
|
||||
//check it
|
||||
if (strncmp(code,DDS_FILECODE,4)!=0)
|
||||
{
|
||||
// check it
|
||||
if (code != DDS_FILECODE)
|
||||
return DDS_ERROR_BAD_HEADER;
|
||||
|
||||
// read header variables
|
||||
dds_header.dwSize = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwSize );
|
||||
dds_header.dwFlags = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwFlags );
|
||||
dds_header.dwHeight = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwHeight );
|
||||
dds_header.dwWidth = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwWidth );
|
||||
dds_header.dwPitchOrLinearSize = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwPitchOrLinearSize );
|
||||
dds_header.dwDepth = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwDepth);
|
||||
dds_header.dwMipMapCount = cfread_uint(ddsfile); //INTEL_INT( dds_header.dwMipMapCount );
|
||||
|
||||
// skip over the crap we don't care about
|
||||
for (int i = 0; i < 11; i++)
|
||||
trash = cfread_uint(ddsfile);
|
||||
|
||||
dds_header.ddpfPixelFormat.dwSize = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwSize );
|
||||
dds_header.ddpfPixelFormat.dwFlags = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwFlags );
|
||||
dds_header.ddpfPixelFormat.dwFourCC = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwFourCC );
|
||||
dds_header.ddpfPixelFormat.dwRGBBitCount = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwRGBBitCount );
|
||||
dds_header.ddpfPixelFormat.dwRBitMask = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwRBitMask );
|
||||
dds_header.ddpfPixelFormat.dwGBitMask = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwGBitMask );
|
||||
dds_header.ddpfPixelFormat.dwBBitMask = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwBBitMask );
|
||||
dds_header.ddpfPixelFormat.dwRGBAlphaBitMask = cfread_uint(ddsfile); //INTEL_INT( dds_header.ddpfPixelFormat.dwRGBAlphaBitMask );
|
||||
|
||||
// calculate the type and size of the data
|
||||
if (dds_header.ddpfPixelFormat.dwFlags & DDPF_FOURCC) {
|
||||
// did I mention lately that I hate Microsoft?
|
||||
// this is here to fix the situation where Microsoft doesn't follow their own docs
|
||||
if ( dds_header.dwPitchOrLinearSize <= 0 ) {
|
||||
if (dds_header.dwDepth == 0)
|
||||
dds_header.dwDepth = 1;
|
||||
|
||||
// calculate the block size, mult by 8 for DXT1, 16 for DXT3 & 5
|
||||
*size = ((dds_header.dwWidth + 3)/4) * ((dds_header.dwHeight + 3)/4) * ((dds_header.dwDepth + 3)/4) * ((dds_header.ddpfPixelFormat.dwFourCC == FOURCC_DXT1) ? 8 : 16);
|
||||
} else {
|
||||
*size = dds_header.dwMipMapCount > 1 ? dds_header.dwPitchOrLinearSize * 2 : dds_header.dwPitchOrLinearSize;
|
||||
}
|
||||
|
||||
switch (dds_header.ddpfPixelFormat.dwFourCC) {
|
||||
case FOURCC_DXT1:
|
||||
bits=24;
|
||||
ct=DDS_DXT1;
|
||||
break;
|
||||
|
||||
case FOURCC_DXT3:
|
||||
bits=32;
|
||||
ct=DDS_DXT3;
|
||||
break;
|
||||
|
||||
case FOURCC_DXT5:
|
||||
bits=32;
|
||||
ct=DDS_DXT5;
|
||||
break;
|
||||
|
||||
// dxt2 and dxt4 aren't supported
|
||||
case FOURCC_DXT2:
|
||||
case FOURCC_DXT4:
|
||||
retval = DDS_ERROR_INVALID_FORMAT;
|
||||
ct = DDS_DXT_INVALID;
|
||||
break;
|
||||
|
||||
// none of the above
|
||||
default:
|
||||
retval = DDS_ERROR_UNSUPPORTED;
|
||||
ct = DDS_DXT_INVALID;
|
||||
break;
|
||||
}
|
||||
} else if (dds_header.ddpfPixelFormat.dwFlags & DDPF_RGB) {
|
||||
if (dds_header.dwDepth == 0)
|
||||
dds_header.dwDepth = 1;
|
||||
|
||||
*size = dds_header.dwWidth * dds_header.dwHeight * dds_header.dwDepth * (dds_header.ddpfPixelFormat.dwRGBBitCount / 8);
|
||||
|
||||
bits = dds_header.ddpfPixelFormat.dwRGBBitCount;
|
||||
ct = DDS_UNCOMPRESSED;
|
||||
} else {
|
||||
// it's not a readable format
|
||||
retval = DDS_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//read the header
|
||||
cfread(lpddsd,sizeof(DDSURFACEDESC2),1,ddsfile);
|
||||
// stuff important info
|
||||
if (bpp)
|
||||
*bpp = bits;
|
||||
|
||||
if (compression_type)
|
||||
*compression_type = ct;
|
||||
|
||||
//stuff important info
|
||||
if (width)
|
||||
*width = lpddsd->dwWidth;
|
||||
*width = dds_header.dwWidth;
|
||||
|
||||
if (height)
|
||||
*height = lpddsd->dwHeight;
|
||||
*height = dds_header.dwHeight;
|
||||
|
||||
if (levels)
|
||||
*levels = lpddsd->dwMipMapCount;
|
||||
*levels = dds_header.dwMipMapCount;
|
||||
|
||||
switch(lpddsd->ddpfPixelFormat.dwFourCC)
|
||||
{
|
||||
case FOURCC_DXT1:
|
||||
bits=24;
|
||||
ct=DDS_DXT1;
|
||||
break;
|
||||
|
||||
case FOURCC_DXT3:
|
||||
bits=32;
|
||||
ct=DDS_DXT3;
|
||||
break;
|
||||
|
||||
case FOURCC_DXT5:
|
||||
bits=32;
|
||||
ct=DDS_DXT5;
|
||||
break;
|
||||
|
||||
//dxt2 and dxt4 aren't supported
|
||||
case FOURCC_DXT2:
|
||||
case FOURCC_DXT4:
|
||||
retval=DDS_ERROR_INVALID_FORMAT;
|
||||
ct=DDS_DXT_INVALID;
|
||||
break;
|
||||
|
||||
//none of the above
|
||||
default:
|
||||
retval=DDS_ERROR_UNCOMPRESSED;
|
||||
ct=DDS_DXT_INVALID;
|
||||
break;
|
||||
if (img_cfp == NULL) {
|
||||
// close file and return
|
||||
cfclose(ddsfile);
|
||||
ddsfile = NULL;
|
||||
}
|
||||
|
||||
if (bpp) *bpp=bits;
|
||||
if (compression_type) *compression_type=ct;
|
||||
|
||||
//close file and return
|
||||
cfclose(ddsfile);
|
||||
return retval;
|
||||
}
|
||||
|
||||
int dds_read_header(char *filename, int *width, int *height, int *bpp, int *compression_type, int *levels)
|
||||
{
|
||||
DDSURFACEDESC2 ddsd;
|
||||
return dds_read_header_internal(&ddsd, filename, width, height, bpp, compression_type, levels);
|
||||
}
|
||||
|
||||
//reads pixel info from a dds file
|
||||
int dds_read_bitmap(char *filename, int *size, uint* data)
|
||||
int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp)
|
||||
{
|
||||
int retval;
|
||||
DDSURFACEDESC2 ddsd;
|
||||
int w,h,ct,lvl,bpp;
|
||||
int w,h,ct,lvl;
|
||||
int size = 0, bits = 0;
|
||||
CFILE *cfp;
|
||||
ubyte* tmp;
|
||||
char real_name[MAX_FILENAME_LEN];
|
||||
|
||||
//this must be set
|
||||
Assert(size!=NULL);
|
||||
|
||||
//read the header -- if its at this stage, it should be legal.
|
||||
retval=dds_read_header_internal(&ddsd, filename, &w, &h, &bpp, &ct, &lvl);
|
||||
Assert(retval==DDS_ERROR_NONE);
|
||||
// this better not happen.. ever
|
||||
Assert(filename != NULL);
|
||||
|
||||
//get some more info from the surface
|
||||
*size=ddsd.dwMipMapCount > 1 ? ddsd.dwLinearSize * 2 : ddsd.dwLinearSize;
|
||||
// make sure there is an extension
|
||||
strcpy(real_name, filename);
|
||||
char *p = strchr(real_name, '.');
|
||||
if (p) { *p = 0; }
|
||||
strcat(real_name, ".dds");
|
||||
|
||||
//open it up and go to the data section
|
||||
cfp=cfopen(filename,"rb");
|
||||
cfseek(cfp,DDS_OFFSET, CF_SEEK_SET);
|
||||
// open it up and go to the data section
|
||||
cfp = cfopen(real_name, "rb");
|
||||
|
||||
//get the data
|
||||
tmp=(ubyte*)malloc(*size);
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
cfclose(cfp);
|
||||
return DDS_ERROR_NO_MEM; //barf
|
||||
// just in case
|
||||
if (cfp == NULL)
|
||||
return DDS_ERROR_INVALID_FILENAME;
|
||||
|
||||
// read the header -- if its at this stage, it should be legal.
|
||||
retval = dds_read_header(real_name, cfp, &w, &h, &bits, &ct, &lvl, &size);
|
||||
Assert(retval == DDS_ERROR_NONE);
|
||||
|
||||
// this really shouldn't be needed but better safe than sorry
|
||||
if (retval != DDS_ERROR_NONE) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
cfread(tmp,1,*size,cfp);
|
||||
cfseek(cfp, DDS_OFFSET, CF_SEEK_SET);
|
||||
|
||||
*data=(uint)tmp;
|
||||
//we look done here
|
||||
// read in the data
|
||||
cfread(data, 1, size, cfp);
|
||||
|
||||
if (bpp)
|
||||
*bpp = (ubyte)bits;
|
||||
|
||||
// we look done here
|
||||
cfclose(cfp);
|
||||
|
||||
return DDS_ERROR_NONE;
|
||||
}
|
||||
|
||||
@@ -160,8 +215,8 @@ const char *dds_error_string(int code)
|
||||
case DDS_ERROR_INVALID_FORMAT:
|
||||
return "File was compressed, but it was DXT2 or DXT4";
|
||||
|
||||
case DDS_ERROR_UNCOMPRESSED:
|
||||
return "*.DDS files must be compressed and use DXT1, DXT3, or DXT5 compression";
|
||||
case DDS_ERROR_UNSUPPORTED:
|
||||
return "*.DDS files must be uncompressed or use DXT1, DXT3, or DXT5 compression";
|
||||
|
||||
default:
|
||||
return "Abort, retry, fail?";
|
||||
@@ -170,12 +225,3 @@ const char *dds_error_string(int code)
|
||||
//get a warning otherwise
|
||||
return "Abort, retry, fail?";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,17 +5,22 @@
|
||||
#define __DDS_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#ifdef _WIN32
|
||||
#include "directx/vddraw.h"
|
||||
#endif
|
||||
|
||||
struct CFILE;
|
||||
|
||||
#define DDS_ERROR_NONE 0 //everything went fine
|
||||
#define DDS_ERROR_INVALID_FILENAME 1 //bad filename
|
||||
#define DDS_ERROR_NO_MEM 2 //not enough mem to load
|
||||
#define DDS_ERROR_UNCOMPRESSED 3 //not using dxtc compression
|
||||
#define DDS_ERROR_UNSUPPORTED 3 //not a readable format
|
||||
#define DDS_ERROR_INVALID_FORMAT 4 //can only use dxtc1, dxtc3, dxtc5
|
||||
#define DDS_ERROR_BAD_HEADER 5 //header was not "DDS "
|
||||
|
||||
|
||||
#define DDS_DXT_INVALID -1
|
||||
#define DDS_UNCOMPRESSED 0
|
||||
#define DDS_DXT1 1
|
||||
#define DDS_DXT3 3
|
||||
#define DDS_DXT5 5
|
||||
@@ -33,7 +38,7 @@
|
||||
#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4'))
|
||||
#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5'))
|
||||
|
||||
#define DDS_FILECODE "DDS "
|
||||
#define DDS_FILECODE 0x20534444 // "DDS " in file
|
||||
|
||||
#ifndef DUMMYUNIONNAMEN
|
||||
#if defined(__cplusplus) || !defined(NONAMELESSUNION)
|
||||
@@ -43,18 +48,12 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
//these structures are the headers for a dds file
|
||||
typedef struct _DDSCAPS2
|
||||
{
|
||||
DWORD dwCaps; // capabilities of surface wanted
|
||||
DWORD dwCaps2;
|
||||
DWORD dwCaps3;
|
||||
union
|
||||
{
|
||||
DWORD dwCaps4;
|
||||
DWORD dwVolumeDepth;
|
||||
} DUMMYUNIONNAMEN(1);
|
||||
DWORD dwCaps1;
|
||||
DWORD dwCaps2;
|
||||
DWORD Reserved[2];
|
||||
} DDSCAPS2;
|
||||
|
||||
typedef struct _DDSURFACEDESC2
|
||||
@@ -63,41 +62,13 @@ typedef struct _DDSURFACEDESC2
|
||||
DWORD dwFlags; // determines what fields are valid
|
||||
DWORD dwHeight; // height of surface to be created
|
||||
DWORD dwWidth; // width of input surface
|
||||
union
|
||||
{
|
||||
LONG lPitch; // distance to start of next line (return value only)
|
||||
DWORD dwLinearSize; // Formless late-allocated optimized surface size
|
||||
} DUMMYUNIONNAMEN(1);
|
||||
union
|
||||
{
|
||||
DWORD dwBackBufferCount; // number of back buffers requested
|
||||
DWORD dwDepth; // the depth if this is a volume texture
|
||||
} DUMMYUNIONNAMEN(5);
|
||||
union
|
||||
{
|
||||
DWORD dwMipMapCount; // number of mip-map levels requestde
|
||||
// dwZBufferBitDepth removed, use ddpfPixelFormat one instead
|
||||
DWORD dwRefreshRate; // refresh rate (used when display mode is described)
|
||||
DWORD dwSrcVBHandle; // The source used in VB::Optimize
|
||||
} DUMMYUNIONNAMEN(2);
|
||||
DWORD dwAlphaBitDepth; // depth of alpha buffer requested
|
||||
DWORD dwReserved; // reserved
|
||||
LPVOID lpSurface; // pointer to the associated surface memory
|
||||
union
|
||||
{
|
||||
DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use
|
||||
DWORD dwEmptyFaceColor; // Physical color for empty cubemap faces
|
||||
} DUMMYUNIONNAMEN(3);
|
||||
DDCOLORKEY ddckCKDestBlt; // color key for destination blt use
|
||||
DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use
|
||||
DDCOLORKEY ddckCKSrcBlt; // color key for source blt use
|
||||
union
|
||||
{
|
||||
DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface
|
||||
DWORD dwFVF; // vertex format description of vertex buffers
|
||||
} DUMMYUNIONNAMEN(4);
|
||||
DWORD dwPitchOrLinearSize;
|
||||
DWORD dwDepth;
|
||||
DWORD dwMipMapCount;
|
||||
DWORD dwReserved1[11];
|
||||
DDPIXELFORMAT ddpfPixelFormat;
|
||||
DDSCAPS2 ddsCaps; // direct draw surface capabilities
|
||||
DWORD dwTextureStage; // stage in multitexture cascade
|
||||
DWORD dwReserved2;
|
||||
} DDSURFACEDESC2, FAR* LPDDSURFACEDESC2;
|
||||
|
||||
#define DDS_OFFSET 4+sizeof(DDSURFACEDESC2) //place where the data starts -- should be 128
|
||||
@@ -105,11 +76,11 @@ typedef struct _DDSURFACEDESC2
|
||||
//reads a dds header
|
||||
//returns one of the error values
|
||||
//'compression_type' comes back as one of the DDS_DXTC* defines
|
||||
int dds_read_header(char *filename, int *width, int *height, int *bpp, int *compression_type, int *levels);
|
||||
int dds_read_header(char *filename, CFILE *img_cfp = NULL, int *width = 0, int *height = 0, int *bpp = 0, int *compression_type = 0, int *levels = 0, int *size = 0);
|
||||
|
||||
//reads bitmap
|
||||
//size of the data it stored in size
|
||||
int dds_read_bitmap(char *filename, int *size, uint* data);
|
||||
int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp = NULL);
|
||||
|
||||
//returns a string from a DDS error code
|
||||
const char* dds_error_string(int code);
|
||||
|
||||
@@ -9,13 +9,54 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Debris/Debris.cpp $
|
||||
* $Revision: 2.6 $
|
||||
* $Date: 2004-03-31 05:42:26 $
|
||||
* $Revision: 2.17 $
|
||||
* $Date: 2005-07-22 10:18:37 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Code for the pieces of exploding object debris.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.16 2005/07/13 02:50:51 Goober5000
|
||||
* remove PreProcDefine #includes in FS2
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.15 2005/07/13 02:01:28 Goober5000
|
||||
* fixed a bunch of "issues" caused by me with the species stuff
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.14 2005/07/13 00:44:21 Goober5000
|
||||
* improved species support and removed need for #define
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.13 2005/04/05 05:53:15 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.12 2005/03/27 12:28:32 Goober5000
|
||||
* clarified max hull/shield strength names and added ship guardian thresholds
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.11 2005/03/02 21:24:43 taylor
|
||||
* more network/inferno goodness for Windows, takes care of a few warnings too
|
||||
*
|
||||
* Revision 2.10 2005/01/30 09:27:39 Goober5000
|
||||
* nitpicked some boolean tests, and fixed two small bugs
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.9 2004/07/26 20:47:26 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.8 2004/07/12 16:32:44 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.7 2004/07/01 01:52:20 phreak
|
||||
* function pointer radar update.
|
||||
* will enable us to make different radar styles that we can switch between
|
||||
*
|
||||
* Revision 2.6 2004/03/31 05:42:26 Goober5000
|
||||
* got rid of all those nasty warnings from xlocale and so forth; also added comments
|
||||
* for #pragma warning disable to indicate the message being disabled
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.5 2004/03/05 09:01:59 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
@@ -238,11 +279,11 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
|
||||
#include "debris/debris.h"
|
||||
#include "render/3d.h"
|
||||
#include "fireball/fireballs.h"
|
||||
#include "radar/radar.h"
|
||||
#include "mission/missionparse.h" // For MAX_SPECIES_NAMES
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "object/objectsnd.h"
|
||||
#include "globalincs/linklist.h"
|
||||
@@ -252,6 +293,7 @@
|
||||
#include "io/timer.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "ship/ship.h"
|
||||
#include "radar/radarsetup.h"
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
#include "network/multi.h"
|
||||
@@ -259,6 +301,9 @@
|
||||
#include "network/multiutil.h"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#define MAX_LIFE 10.0f
|
||||
#define MIN_RADIUS_FOR_PERSISTANT_DEBRIS 50 // ship radius at which debris from it becomes persistant
|
||||
#define DEBRIS_SOUND_DELAY 2000 // time to start debris sound after created
|
||||
@@ -277,31 +322,10 @@ int Debris_model = -1;
|
||||
int Debris_vaporize_model = -1;
|
||||
int Debris_num_submodels = 0;
|
||||
|
||||
#if defined(MORE_SPECIES)
|
||||
char Debris_texture_files[MAX_SPECIES][FILESPEC_LENGTH];
|
||||
|
||||
char Debris_texture_files[MAX_SPECIES_NAMES][MAX_DEBRIS_TNAME_LEN+1];
|
||||
|
||||
/*char * Debris_texture_files[MAX_SPECIES_NAMES] = {
|
||||
NOX("debris01a"), // Terran
|
||||
NOX("debris01b"), // Species B
|
||||
NOX("debris01c"), // Shivan
|
||||
NOX("debris01a"), // Ancient
|
||||
NOX("debris01a"), // User1
|
||||
NOX("debris01a"), // User2
|
||||
NOX("debris01a"), // User3
|
||||
NOX("debris01a"), // User4
|
||||
|
||||
};*/
|
||||
|
||||
#else
|
||||
char * Debris_texture_files[MAX_SPECIES_NAMES] = {
|
||||
NOX("debris01a"), // Terran
|
||||
NOX("debris01b"), // Species B
|
||||
NOX("debris01c"), // Shivan
|
||||
};
|
||||
#endif
|
||||
|
||||
int Debris_textures[MAX_SPECIES_NAMES];
|
||||
int Debris_textures[MAX_SPECIES];
|
||||
|
||||
#define MAX_DEBRIS_DIST 10000.0f // Debris goes away if it's this far away.
|
||||
#define DEBRIS_DISTANCE_CHECK_TIME (10*1000) // Check every 10 seconds.
|
||||
@@ -374,7 +398,7 @@ void debris_page_in()
|
||||
int i;
|
||||
|
||||
Debris_model = model_load( NOX("debris01.pof"), 0, NULL );
|
||||
if (Debris_model>-1) {
|
||||
if (Debris_model >= 0) {
|
||||
polymodel * pm;
|
||||
pm = model_get(Debris_model);
|
||||
Debris_num_submodels = pm->n_models;
|
||||
@@ -382,11 +406,7 @@ void debris_page_in()
|
||||
|
||||
Debris_vaporize_model = model_load( NOX("debris02.pof"), 0, NULL );
|
||||
|
||||
#if defined(MORE_SPECIES)
|
||||
for (i=0; i<MAX_SPECIES_NAMES && i<True_NumSpecies; i++ ) {
|
||||
#else
|
||||
for (i=0; i<MAX_SPECIES_NAMES; i++ ) {
|
||||
#endif
|
||||
for (i=0; i<True_NumSpecies; i++ ) {
|
||||
nprintf(( "Paging", "Paging in debris texture '%s'\n", Debris_texture_files[i] ));
|
||||
Debris_textures[i] = bm_load( Debris_texture_files[i] );
|
||||
if ( Debris_textures[i] < 0 ) {
|
||||
@@ -421,7 +441,7 @@ void debris_render(object * obj)
|
||||
Assert( db->flags & DEBRIS_USED );
|
||||
|
||||
// Swap in a different texture depending on the species
|
||||
if ( (db->species > -1) && (db->species < MAX_SPECIES_NAMES) ) {
|
||||
if ( (db->species > -1) && (db->species < MAX_SPECIES) ) {
|
||||
|
||||
pm = model_get( db->model_num );
|
||||
|
||||
@@ -587,7 +607,7 @@ void debris_process_post(object * obj, float frame_time)
|
||||
|
||||
int n, n_arcs = ((rand()>>5) % 3)+1; // Create 1-3 sparks
|
||||
|
||||
vector v1, v2, v3, v4;
|
||||
vec3d v1, v2, v3, v4;
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v3, &v4 );
|
||||
|
||||
@@ -630,7 +650,7 @@ void debris_process_post(object * obj, float frame_time)
|
||||
|
||||
// rotate v2 out of local coordinates into world.
|
||||
// Use v2 since it is used in every bolt. See above switch().
|
||||
vector snd_pos;
|
||||
vec3d snd_pos;
|
||||
vm_vec_unrotate(&snd_pos, &v2, &obj->orient);
|
||||
vm_vec_add2(&snd_pos, &obj->pos );
|
||||
|
||||
@@ -667,7 +687,7 @@ void debris_process_post(object * obj, float frame_time)
|
||||
// Maybe move a vertex.... 20% of the time maybe?
|
||||
int mr = myrand();
|
||||
if ( mr < RAND_MAX/5 ) {
|
||||
vector v1, v2;
|
||||
vec3d v1, v2;
|
||||
submodel_get_two_random_points( db->model_num, db->submodel_num, &v1, &v2 );
|
||||
db->arc_pts[i][mr % 2] = v1;
|
||||
}
|
||||
@@ -703,7 +723,7 @@ int debris_find_oldest()
|
||||
}
|
||||
|
||||
#define DEBRIS_ROTVEL_SCALE 5.0f
|
||||
void calc_debris_physics_properties( physics_info *pi, vector *min, vector *max );
|
||||
void calc_debris_physics_properties( physics_info *pi, vec3d *min, vec3d *max );
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// debris_create()
|
||||
//
|
||||
@@ -711,7 +731,7 @@ void calc_debris_physics_properties( physics_info *pi, vector *min, vector *max
|
||||
//
|
||||
// exp_force: Explosion force, used to assign velocity to pieces.
|
||||
// 1.0f assigns velocity like before. 2.0f assigns twice as much to non-inherited part of velocity
|
||||
object *debris_create(object *source_obj, int model_num, int submodel_num, vector *pos, vector *exp_center, int hull_flag, float exp_force)
|
||||
object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force)
|
||||
{
|
||||
int i, n, objnum, parent_objnum;
|
||||
object *obj;
|
||||
@@ -786,7 +806,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
|
||||
|
||||
for (i=0; i<MAX_DEBRIS_ARCS; i++ ) {
|
||||
db->arc_timestamp[i] = timestamp(-1);
|
||||
// vector arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
|
||||
// vec3d arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
|
||||
}
|
||||
|
||||
if ( db->is_hull ) {
|
||||
@@ -843,13 +863,13 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
|
||||
// -- No long need shield: bset_shield_strength(obj, 100.0f); // Hey! Set to some meaningful value!
|
||||
|
||||
if (source_obj->type == OBJ_SHIP) {
|
||||
obj->hull_strength = Ships[source_obj->instance].ship_initial_hull_strength/8.0f;
|
||||
obj->hull_strength = Ships[source_obj->instance].ship_max_hull_strength/8.0f;
|
||||
} else
|
||||
obj->hull_strength = 10.0f;
|
||||
|
||||
Num_debris_pieces++;
|
||||
|
||||
vector rotvel, radial_vel, to_center;
|
||||
vec3d rotvel, radial_vel, to_center;
|
||||
|
||||
if ( exp_center )
|
||||
vm_vec_sub( &to_center,pos, exp_center );
|
||||
@@ -865,7 +885,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
|
||||
|
||||
// set up physics mass and I_inv for hull debris pieces
|
||||
pm = model_get(model_num);
|
||||
vector *min, *max;
|
||||
vec3d *min, *max;
|
||||
min = &pm->submodel[submodel_num].min;
|
||||
max = &pm->submodel[submodel_num].max;
|
||||
calc_debris_physics_properties( &obj->phys_info, min, max );
|
||||
@@ -904,7 +924,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
|
||||
// DA: here we need to vel_from_rot = w x to_center, where w is world is unrotated to world coords and offset is the
|
||||
// displacement fromt the center of the parent object to the center of the debris piece
|
||||
|
||||
vector world_rotvel, vel_from_rotvel;
|
||||
vec3d world_rotvel, vel_from_rotvel;
|
||||
vm_vec_unrotate ( &world_rotvel, &source_obj->phys_info.rotvel, &source_obj->orient );
|
||||
vm_vec_crossprod ( &vel_from_rotvel, &world_rotvel, &to_center );
|
||||
vm_vec_scale ( &vel_from_rotvel, DEBRIS_ROTVEL_SCALE);
|
||||
@@ -981,7 +1001,7 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vecto
|
||||
// Alas, poor debris_obj got whacked. Fortunately, we know who did it, where and how hard, so we
|
||||
// can do something about it.
|
||||
//
|
||||
void debris_hit(object *debris_obj, object *other_obj, vector *hitpos, float damage)
|
||||
void debris_hit(object *debris_obj, object *other_obj, vec3d *hitpos, float damage)
|
||||
{
|
||||
debris *debris_p = &Debris[debris_obj->instance];
|
||||
|
||||
@@ -993,7 +1013,7 @@ void debris_hit(object *debris_obj, object *other_obj, vector *hitpos, float dam
|
||||
pe.pos = *hitpos; // Where the particles emit from
|
||||
pe.vel = debris_obj->phys_info.vel; // Initial velocity of all the particles
|
||||
|
||||
vector tmp_norm;
|
||||
vec3d tmp_norm;
|
||||
vm_vec_sub( &tmp_norm, hitpos, &debris_obj->pos );
|
||||
vm_vec_normalize_safe(&tmp_norm);
|
||||
|
||||
@@ -1047,7 +1067,7 @@ void debris_hit(object *debris_obj, object *other_obj, vector *hitpos, float dam
|
||||
//
|
||||
#pragma warning ( push )
|
||||
#pragma warning ( disable : 4701 ) // possible use of variable without initialization
|
||||
int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, collision_info_struct *debris_hit_info)
|
||||
int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, collision_info_struct *debris_hit_info)
|
||||
{
|
||||
mc_info mc;
|
||||
int num;
|
||||
@@ -1088,7 +1108,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
|
||||
object *heavy_obj = heavy;
|
||||
object *light_obj = light;
|
||||
|
||||
vector zero, p0, p1;
|
||||
vec3d zero, p0, p1;
|
||||
vm_vec_zero(&zero);
|
||||
vm_vec_sub(&p0, &light->last_pos, &heavy->last_pos);
|
||||
vm_vec_sub(&p1, &light->pos, &heavy->pos);
|
||||
@@ -1098,7 +1118,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
|
||||
mc.p1 = &p1; // Point 2 of ray to check
|
||||
|
||||
// find the light object's position in the heavy object's reference frame at last frame and also in this frame.
|
||||
vector p0_temp, p0_rotated;
|
||||
vec3d p0_temp, p0_rotated;
|
||||
|
||||
// Collision detection from rotation enabled if at rotaion is less than 30 degree in frame
|
||||
// This should account for all ships
|
||||
@@ -1125,7 +1145,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
|
||||
|
||||
// copy important data
|
||||
int copy_flags = mc.flags; // make a copy of start end positions of sphere in big ship RF
|
||||
vector copy_p0, copy_p1;
|
||||
vec3d copy_p0, copy_p1;
|
||||
copy_p0 = *mc.p0;
|
||||
copy_p1 = *mc.p1;
|
||||
|
||||
@@ -1196,7 +1216,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
vector int_light_pos, diff;
|
||||
vec3d int_light_pos, diff;
|
||||
vm_vec_sub(&diff, mc.p1, mc.p0);
|
||||
vm_vec_scale_add(&int_light_pos, mc.p0, &diff, mc.hit_dist);
|
||||
model_find_world_point(&debris_hit_info->light_collision_cm_pos, &int_light_pos, mc.model_num, mc.hit_submodel, &heavy_obj->orient, &zero);
|
||||
@@ -1228,7 +1248,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
vector diff;
|
||||
vec3d diff;
|
||||
vm_vec_sub(&diff, mc.p1, mc.p0);
|
||||
vm_vec_scale_add(&debris_hit_info->light_collision_cm_pos, mc.p0, &diff, mc.hit_dist);
|
||||
|
||||
@@ -1260,7 +1280,7 @@ int debris_check_collision(object *pdebris, object *other_obj, vector *hitpos, c
|
||||
}
|
||||
|
||||
// find position in submodel RF of light object at collison
|
||||
vector diff;
|
||||
vec3d diff;
|
||||
vm_vec_sub(&diff, mc.p1, mc.p0);
|
||||
vm_vec_scale_add(&debris_hit_info->light_collision_cm_pos, mc.p0, &diff, mc.hit_dist);
|
||||
|
||||
@@ -1310,7 +1330,7 @@ int debris_get_team(object *objp)
|
||||
}
|
||||
|
||||
// fills in debris physics properties when created, specifically mass and moment of inertia
|
||||
void calc_debris_physics_properties( physics_info *pi, vector *mins, vector *maxs )
|
||||
void calc_debris_physics_properties( physics_info *pi, vec3d *mins, vec3d *maxs )
|
||||
{
|
||||
float dx, dy, dz, mass;
|
||||
dx = maxs->xyz.x - mins->xyz.x;
|
||||
|
||||
@@ -9,13 +9,26 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Debris/Debris.h $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2004-03-05 09:01:59 $
|
||||
* $Revision: 2.5 $
|
||||
* $Date: 2005-07-13 02:50:51 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Code for the pieces of exploding object debris.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.4 2005/04/28 05:29:29 wmcoolmon
|
||||
* Removed FS2_DEMO defines that looked like they wouldn't cause the universe to collapse
|
||||
*
|
||||
* Revision 2.3 2005/04/05 05:53:15 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.2 2004/08/11 05:06:20 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.1 2004/03/05 09:01:59 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:21 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -170,7 +183,7 @@ typedef struct debris {
|
||||
fix time_started; // time when debris was created
|
||||
int next_distance_check; // timestamp to determine whether to delete this piece of debris.
|
||||
|
||||
vector arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
|
||||
vec3d arc_pts[MAX_DEBRIS_ARCS][2]; // The endpoints of each arc
|
||||
int arc_timestamp[MAX_DEBRIS_ARCS]; // When this times out, the spark goes away. -1 is not used
|
||||
int arc_frequency; // Starts at 0, gets bigger
|
||||
|
||||
@@ -182,11 +195,7 @@ typedef struct debris {
|
||||
#define DEBRIS_EXPIRE (1<<1) // debris can expire (ie hull chunks from small ships)
|
||||
|
||||
|
||||
#ifdef FS2_DEMO
|
||||
#define MAX_DEBRIS_PIECES 48
|
||||
#else
|
||||
#define MAX_DEBRIS_PIECES 64
|
||||
#endif
|
||||
#define MAX_DEBRIS_PIECES 64
|
||||
|
||||
extern debris Debris[MAX_DEBRIS_PIECES];
|
||||
|
||||
@@ -199,9 +208,9 @@ void debris_render( object * obj );
|
||||
void debris_delete( object * obj );
|
||||
void debris_process_pre( object * obj, float frame_time);
|
||||
void debris_process_post( object * obj, float frame_time);
|
||||
object *debris_create( object * source_obj, int model_num, int submodel_num, vector *pos, vector *exp_center, int hull_flag, float exp_force );
|
||||
int debris_check_collision( object * obj, object * other_obj, vector * hitpos, collision_info_struct *debris_hit_info=NULL );
|
||||
void debris_hit( object * debris_obj, object * other_obj, vector * hitpos, float damage );
|
||||
object *debris_create( object * source_obj, int model_num, int submodel_num, vec3d *pos, vec3d *exp_center, int hull_flag, float exp_force );
|
||||
int debris_check_collision( object * obj, object * other_obj, vec3d * hitpos, collision_info_struct *debris_hit_info=NULL );
|
||||
void debris_hit( object * debris_obj, object * other_obj, vec3d * hitpos, float damage );
|
||||
int debris_get_team(object *objp);
|
||||
void debris_clear_expired_flag(debris *db);
|
||||
|
||||
|
||||
@@ -9,13 +9,23 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/DebugConsole/Console.cpp $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2004-03-05 09:01:58 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 2.6 $
|
||||
* $Date: 2005-04-25 00:07:22 $
|
||||
* $Author: wmcoolmon $
|
||||
*
|
||||
* Routines for managing the debug console window.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.5 2004/07/26 20:47:27 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.4 2004/07/12 16:32:44 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.3 2004/03/05 09:01:58 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.2 2003/03/18 10:07:01 unknownplayer
|
||||
* The big DX/main line merge. This has been uploaded to the main CVS since I can't manage to get it to upload to the DX branch. Apologies to all who may be affected adversely, but I'll work to debug it as fast as I can.
|
||||
*
|
||||
@@ -124,6 +134,7 @@
|
||||
#include "osapi/osapi.h"
|
||||
#include "debugconsole/dbugfile.h"
|
||||
|
||||
|
||||
#define MAX_COMMANDS 300
|
||||
|
||||
static int Num_debug_commands = 0;
|
||||
@@ -621,7 +632,7 @@ void debug_output( char c )
|
||||
|
||||
void dc_printf(char *format, ...)
|
||||
{
|
||||
char tmp[DCOLS*2];
|
||||
char tmp[DCOLS*DROWS];
|
||||
va_list args;
|
||||
|
||||
va_start(args, format);
|
||||
@@ -629,7 +640,7 @@ void dc_printf(char *format, ...)
|
||||
va_end(args);
|
||||
|
||||
char *p = tmp;
|
||||
while( *p ) {
|
||||
while( *p != '\0' ) {
|
||||
debug_output(*p);
|
||||
p++;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "dbugfile.h"
|
||||
|
||||
|
||||
|
||||
#pragma warning(disable:4711) // function selected for inlining
|
||||
|
||||
int dbugfile_counters[MAX_COUNTERS];
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
#ifndef _DBUGFILE_HEADER_
|
||||
#define _DBUGFILE_HEADER_
|
||||
|
||||
|
||||
@@ -16,9 +16,11 @@
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
#endif
|
||||
|
||||
#include "timerbar.h"
|
||||
#include "globalincs\pstypes.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
|
||||
// Internal structure for handling frame data
|
||||
typedef struct
|
||||
@@ -38,7 +40,7 @@ LARGE_INTEGER timerbar_ultimate_start_value;
|
||||
LARGE_INTEGER timerbar_last_start_value;
|
||||
|
||||
// Data needed for push and pop functionality
|
||||
const MAX_TB_STACK_SIZE = 100;
|
||||
const int MAX_TB_STACK_SIZE = 100;
|
||||
|
||||
int timerbar_stack[MAX_TB_STACK_SIZE];
|
||||
int timerbar_current_stack_layer = 0;
|
||||
@@ -222,4 +224,3 @@ void timerbar_set_draw_func(void (*new_draw_func_ptr)(int colour, float x, float
|
||||
draw_func_ptr = new_draw_func_ptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -8,11 +8,21 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/debugconsole/timerbar.h $
|
||||
* $Revision: 1.8 $
|
||||
* $Date: 2004-02-16 11:47:31 $
|
||||
* $Author: randomtiger $
|
||||
* $Revision: 1.10 $
|
||||
* $Date: 2005-07-13 02:50:50 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.9 2004/08/11 05:06:20 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 1.8 2004/02/16 11:47:31 randomtiger
|
||||
* Removed a lot of files that we dont need anymore.
|
||||
* Changed htl to be on by default, command now -nohtl
|
||||
* Changed D3D to use a 2D vertex for 2D operations which should cut down on redundant data having to go though the system.
|
||||
* Added small change to all -start_mission flag to take you to any mission by filename, very useful for testing.
|
||||
* Removed old dshow code and took away timerbar compile flag condition since it uses a runtime flag now.
|
||||
*
|
||||
* Revision 1.7 2003/11/19 20:37:23 randomtiger
|
||||
* Almost fully working 32 bit pcx, use -pcx32 flag to activate.
|
||||
* Made some commandline variables fit the naming standard.
|
||||
|
||||
+1873
-484
File diff suppressed because it is too large.
Load diff
@@ -1,14 +1,24 @@
|
||||
//header file for makeing decals-Bobboau
|
||||
//header file for making decals-Bobboau
|
||||
|
||||
|
||||
#ifndef _DECAL_H
|
||||
#define _DECAL_H
|
||||
|
||||
#define MAX_DECAL_POLY 20
|
||||
|
||||
#include "object/object.h"
|
||||
|
||||
#define MAX_DECAL_POLY 40
|
||||
#define MAX_DECAL_POLY_POINT 10
|
||||
#define MAX_DECAL_DEFPOINTS 1000
|
||||
#define MAX_DECAL_DEFPOINTS 10000
|
||||
#define MAX_DECAL_POINT 10
|
||||
#define MAX_SHIP_DECALS 25
|
||||
#define MAX_GLOBAL_DECAL_POLYS 11000
|
||||
#define QUICKFIND_SUBDIVISION 100
|
||||
#define QUICKFIND_SEGMENT_LENGTH (MAX_GLOBAL_DECAL_POLYS/QUICKFIND_SUBDIVISION)
|
||||
#define MAX_GLOBAL_DECALS 5000
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
//#include "ship/ship.h"
|
||||
|
||||
#define DP_EOF 0
|
||||
#define DP_DEFPOINTS 1
|
||||
@@ -17,63 +27,82 @@
|
||||
#define DP_SORTNORM 4
|
||||
#define DP_BOUNDBOX 5
|
||||
|
||||
typedef struct decal_model{ //this will store a triangulated version of the ships polygons
|
||||
struct{
|
||||
int point[3]; //an index to the vert list-Bobboau
|
||||
vector center; //the center of the poly
|
||||
float radius; //the max radius of the poly
|
||||
}poly[MAX_DECAL_POLY];
|
||||
vector vert[MAX_DECAL_DEFPOINTS]; //the defpoints-Bobboau
|
||||
int n_polys;
|
||||
}decal_model;
|
||||
struct decal;
|
||||
struct decal_list;
|
||||
struct decal_list_controle;
|
||||
|
||||
//extern decal_model d_model;
|
||||
struct decal_poly{
|
||||
vec3d norm[3];
|
||||
vertex point[3];
|
||||
decal_poly *next;
|
||||
decal* parent;
|
||||
int idx;
|
||||
};
|
||||
|
||||
typedef struct decal{
|
||||
struct{
|
||||
int backfaced; //flag that this poly uses the backfaced texture
|
||||
uv_pair uv[MAX_DECAL_POLY_POINT]; //uv coordanants
|
||||
int point[MAX_DECAL_POLY_POINT]; //an index to the vert list-Bobboau
|
||||
int n_poly;
|
||||
vector norm; //the normal used for lighting
|
||||
}poly[MAX_DECAL_POLY];
|
||||
vector position;
|
||||
struct decal{
|
||||
int n_poly;
|
||||
int timestamp; //when this decal was created
|
||||
int burn_time; //how long it takes for the glow texture to fade
|
||||
int vertex_buffer_start; //were is the start of this decal's polys in the vertex buffer
|
||||
decal_poly* poly;
|
||||
decal_poly* add_poly();
|
||||
decal_poly* get_last_poly();
|
||||
void remove_last_poly();
|
||||
decal_list_controle *parent;
|
||||
};
|
||||
|
||||
struct decal_list{
|
||||
decal dec;
|
||||
decal_list *next;
|
||||
};
|
||||
|
||||
struct decal_item{
|
||||
decal_list dec;
|
||||
bool used;
|
||||
};
|
||||
|
||||
struct decal_list_controle{
|
||||
int n_decals;
|
||||
int buffer;
|
||||
int texture;
|
||||
int n_poly;
|
||||
int burn_texture;
|
||||
int glow_texture;
|
||||
bool modifyed;
|
||||
decal_list *d_list;
|
||||
decal_list *end;
|
||||
decal_list *add_new();
|
||||
void trim();
|
||||
void clear();
|
||||
~decal_list_controle();
|
||||
decal_list_controle();
|
||||
};
|
||||
|
||||
struct decal_system{
|
||||
decal_list_controle *decals;
|
||||
int n_decal_textures;
|
||||
bool decals_modified;
|
||||
int max_decals;
|
||||
decal_system():decals(NULL),n_decal_textures(0),decals_modified(false){};
|
||||
};
|
||||
|
||||
|
||||
//this is used to give all the data to the generation data to the functions that make them
|
||||
|
||||
struct decal_point{
|
||||
vec3d pnt;
|
||||
matrix orient;
|
||||
float radius;
|
||||
int submodel_parent; //the submodel this is part of
|
||||
vector vert[1000]; //the defpoints-Bobboau
|
||||
int frames; //number of frames in an animation
|
||||
int fps; //frames per second
|
||||
int starting_keyframe; //the frame that indicates the end of the inital nonlooped portion and the start of the middle looped part
|
||||
int ending_keyframe; //the frame that indicates the end of the loopable portion and the start of the end part
|
||||
int texture; //the texture to be used, first in animation
|
||||
int backfaced_texture; //the texture to be used by backfaced polys, first in animation
|
||||
int is_valid; //this means it is a good decal that should be rendered-Bobboau
|
||||
int n_poly; //the number of polys
|
||||
int timestamp; //this is when the decal was made-Bobboau
|
||||
int lifetime; //this is how long the decal should be alive for-Bobboau
|
||||
int importance; //this is for big things large beam marks and bomb craters should last longer than the odd laser impacts-Bobboau
|
||||
int state; //1 starting, 2 looping(mostly for beams), 3 ending, 4 static
|
||||
}decal;
|
||||
};
|
||||
|
||||
typedef struct decal_point{
|
||||
vector pnt;
|
||||
matrix orient;
|
||||
float radius;
|
||||
}decal_point;
|
||||
|
||||
int decal_create(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture = -1);//makes the decal
|
||||
|
||||
#endif
|
||||
int decal_create(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture = -1, int glow_texture = -1, int burn_texture = -1, int burn_time = 1000);//makes the decal
|
||||
|
||||
int decal_create_simple(object * obj, decal_point *point, int texture);//makes a simple non-clipped decal
|
||||
|
||||
void decal_render_all(object * obj); //renders all decals
|
||||
|
||||
int decal_create(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture);//makes the decal
|
||||
|
||||
int decal_create_sub(void *model_ptr);
|
||||
|
||||
/*
|
||||
void clear_decals(decal_system *system);
|
||||
|
||||
int decal_is_in_face(int n, vertex vertlist[n]);//sees if a poly is inside a decal: 0 is yes, 1 is sort of, -1 is no
|
||||
*/
|
||||
#endif
|
||||
@@ -9,12 +9,28 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Demo/Demo.cpp $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2004-03-05 09:01:59 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 2.8 $
|
||||
* $Date: 2005-05-12 17:49:11 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.7 2005/04/05 05:53:15 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.6 2005/01/31 23:27:52 taylor
|
||||
* merge with Linux/OSX tree - p0131-2
|
||||
*
|
||||
* Revision 2.5 2004/07/26 20:47:27 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.4 2004/07/12 16:32:45 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.3 2004/03/05 09:01:59 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.2 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
@@ -52,7 +68,7 @@
|
||||
|
||||
#include "demo/demo.h"
|
||||
#include "ship/ship.h"
|
||||
#include "Weapon/weapon.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "object/object.h"
|
||||
@@ -64,6 +80,8 @@
|
||||
#include "ship/shiphit.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------------------
|
||||
// DEMO DEFINES/VARS
|
||||
//
|
||||
@@ -139,7 +157,7 @@ int Demo_error = DEMO_ERROR_NONE;
|
||||
#define DEMO_BYTE(vl) do { DEMO_DATA(vl, sizeof(char)); } while(0)
|
||||
#define DEMO_UBYTE(vl) do { DEMO_DATA(vl, sizeof(ubyte)); } while(0)
|
||||
#define DEMO_FLOAT(vl) do { DEMO_DATA(vl, sizeof(float)); } while(0)
|
||||
#define DEMO_VECTOR(vl) do { DEMO_DATA(vl, sizeof(vector)); } while(0)
|
||||
#define DEMO_VECTOR(vl) do { DEMO_DATA(vl, sizeof(vec3d)); } while(0)
|
||||
#define DEMO_MATRIX(vl) do { DEMO_DATA(vl, sizeof(matrix)); } while(0)
|
||||
#define DEMO_STRING(vl) do { int stlen; if(Game_mode & GM_DEMO_RECORD){ stlen = strlen(vl); if(stlen <= 0){ break; } DEMO_DATA(stlen, sizeof(ushort)); DEMO_DATA(*vl, strlen(vl)); } else { ushort len = 0; DEMO_USHORT(len); DEMO_DATA(*vl, len); vl[len] = '\0'; } } while(0)
|
||||
|
||||
@@ -286,7 +304,7 @@ int demo_start_record(char *file)
|
||||
char full_name[MAX_FILENAME_LEN] = "";
|
||||
|
||||
// try and allocate the buffer
|
||||
Demo_buf = (char*)malloc(DEMO_BUF_SIZE);
|
||||
Demo_buf = (char*)vm_malloc(DEMO_BUF_SIZE);
|
||||
if(Demo_buf == NULL){
|
||||
DEMO_ERROR(DEMO_ERROR_DISK_ACCESS);
|
||||
return 0;
|
||||
@@ -330,7 +348,7 @@ int demo_start_playback(char *file)
|
||||
char full_name[MAX_FILENAME_LEN] = "";
|
||||
|
||||
// try and allocate the buffer
|
||||
Demo_buf = (char*)malloc(DEMO_BUF_SIZE);
|
||||
Demo_buf = (char*)vm_malloc(DEMO_BUF_SIZE);
|
||||
if(Demo_buf == NULL){
|
||||
DEMO_ERROR(DEMO_ERROR_DISK_ACCESS);
|
||||
return 0;
|
||||
@@ -380,7 +398,7 @@ void demo_close()
|
||||
|
||||
// free the buffer
|
||||
if(Demo_buf != NULL){
|
||||
free(Demo_buf);
|
||||
vm_free(Demo_buf);
|
||||
Demo_buf = NULL;
|
||||
}
|
||||
|
||||
@@ -818,7 +836,7 @@ int demo_playback_seek_sub(int frame_size)
|
||||
ushort obj_count = 0;
|
||||
int obj_sig = 0;
|
||||
ubyte team = 0;
|
||||
vector obj_pos = vmd_zero_vector;
|
||||
vec3d obj_pos = vmd_zero_vector;
|
||||
matrix obj_orient = vmd_identity_matrix;
|
||||
float obj_fthrust = 0;
|
||||
int ship_index = 0;
|
||||
|
||||
@@ -9,12 +9,18 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Demo/Demo.h $
|
||||
* $Revision: 2.0 $
|
||||
* $Date: 2002-06-03 04:02:21 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2005-07-13 02:50:51 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.1 2004/08/11 05:06:21 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:21 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
* Revision 1.1 2002/05/02 18:03:04 mharris
|
||||
* Initial checkin - converted filenames and includes to lower case
|
||||
*
|
||||
@@ -31,6 +37,7 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FS2_DEMO_SYSTEM_HEADER_FILE
|
||||
#define _FS2_DEMO_SYSTEM_HEADER_FILE
|
||||
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "osapi/osapi.h"
|
||||
#include "dx8show.h"
|
||||
#include "directx/dx8show.h"
|
||||
#include "debugconsole/dbugfile.h"
|
||||
#include "graphics/2d.h"
|
||||
|
||||
#include <commctrl.h>
|
||||
#include <commdlg.h>
|
||||
#include <tchar.h>
|
||||
#include <atlbase.h>
|
||||
//#include <atlbase.h> // No dependecy on ATL!!!
|
||||
|
||||
|
||||
|
||||
enum PLAYSTATE {Stopped, Paused, Running, Init};
|
||||
@@ -93,7 +94,7 @@ BOOL IsAudioOnly()
|
||||
|
||||
HRESULT PlayMovieInWindow(HWND ghApp, LPTSTR szFile)
|
||||
{
|
||||
USES_CONVERSION;
|
||||
// USES_CONVERSION;
|
||||
WCHAR wFile[MAX_PATH];
|
||||
HRESULT hr;
|
||||
|
||||
@@ -101,7 +102,8 @@ HRESULT PlayMovieInWindow(HWND ghApp, LPTSTR szFile)
|
||||
UpdateWindow(ghApp);
|
||||
|
||||
// Convert filename to wide character string
|
||||
wcscpy(wFile, T2W(szFile));
|
||||
// wcscpy(wFile, T2W(szFile)); // requires ATL
|
||||
swprintf(wFile, L"%S", szFile); // Uses libc to convert instead
|
||||
|
||||
// Get the interface for DirectShow's GraphBuilder
|
||||
JIF(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
|
||||
@@ -157,7 +159,8 @@ HRESULT PlayMovieInWindow(HWND ghApp, LPTSTR szFile)
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
extern int Cmdline_window;
|
||||
extern int Cmdline_noscalevid;
|
||||
HRESULT InitVideoWindow(HWND ghApp, long video_w, long video_h)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
@@ -168,11 +171,25 @@ HRESULT InitVideoWindow(HWND ghApp, long video_w, long video_h)
|
||||
int screen_w = rect.right;
|
||||
int screen_h = rect.bottom;
|
||||
|
||||
int video_rescale_w = (video_w * screen_w) / video_w;
|
||||
int video_rescale_h = (video_rescale_w * video_h) / video_w;
|
||||
int video_rescale_w;
|
||||
int video_rescale_h;
|
||||
|
||||
if (Cmdline_noscalevid && (video_w < screen_w) && (video_h < screen_h)) {
|
||||
video_rescale_w = video_w;
|
||||
video_rescale_h = video_h;
|
||||
} else {
|
||||
video_rescale_w = (video_w * screen_w) / video_w;
|
||||
video_rescale_h = (video_rescale_w * video_h) / video_w;
|
||||
}
|
||||
|
||||
int extra_w = (screen_w - video_rescale_w) / 2;
|
||||
int extra_h = (screen_h - video_rescale_h) / 2;
|
||||
|
||||
if (Cmdline_window)
|
||||
{
|
||||
rect.right += GetSystemMetrics(SM_CXFIXEDFRAME) * 2;
|
||||
rect.bottom += 2 * GetSystemMetrics(SM_CYFIXEDFRAME) + GetSystemMetrics(SM_CYCAPTION);
|
||||
}
|
||||
|
||||
if(SetWindowPos(ghApp, 0, 0, 0, rect.right, rect.bottom, SWP_NOMOVE | SWP_NOOWNERZORDER) == FALSE) {
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
#ifndef _DX8SHOW_HEADER_FILE
|
||||
#define _DX8SHOW_HEADER_FILE
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* File: async.h
|
||||
* Content: AsyncData object include file
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __ASYNC_INCLUDED__
|
||||
#define __ASYNC_INCLUDED__
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* File: dplobby.h
|
||||
* Content: DirectPlayLobby include file
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __DPLOBBY_INCLUDED__
|
||||
#define __DPLOBBY_INCLUDED__
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Content: DirectXSetup, error codes and flags
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef __DSETUP_H__
|
||||
#define __DSETUP_H__
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifndef __DSOUND_INCLUDED__
|
||||
#define __DSOUND_INCLUDED__
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef __DVP_INCLUDED__
|
||||
#define __DVP_INCLUDED__
|
||||
#if defined( _WIN32 ) && !defined( _NO_COM )
|
||||
|
||||
@@ -9,13 +9,24 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/ExceptionHandler/ExceptionHandler.cpp $
|
||||
* $Revision: 2.5 $
|
||||
* $Date: 2004-03-31 05:42:26 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 2.8 $
|
||||
* $Date: 2005-01-31 23:27:52 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Main file for dealing with exception handling
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.7 2004/07/26 20:47:27 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.6 2004/07/12 16:32:45 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.5 2004/03/31 05:42:26 Goober5000
|
||||
* got rid of all those nasty warnings from xlocale and so forth; also added comments
|
||||
* for #pragma warning disable to indicate the message being disabled
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.4 2004/03/06 23:28:22 bobboau
|
||||
* fixed motion debris
|
||||
* animated laser textures
|
||||
@@ -65,9 +76,11 @@ information after crashes. See exceptionhandler.h for information
|
||||
on how to hook it in.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
#pragma warning(disable:4711) // function selected for inlining
|
||||
|
||||
// --------------------
|
||||
@@ -550,3 +563,5 @@ int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message)
|
||||
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
|
||||
#endif // _WIN32
|
||||
@@ -9,13 +9,23 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/ExceptionHandler/ExceptionHandler.h $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-07-07 19:55:58 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.4 $
|
||||
* $Date: 2005-07-13 02:50:52 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Header file for program exception handling
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.3 2005/04/12 05:26:36 taylor
|
||||
* many, many compiler warning and header fixes (Jens Granseuer)
|
||||
* fix free on possible NULL in modelinterp.cpp (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.2 2004/08/11 05:06:22 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.1 2002/07/07 19:55:58 penguin
|
||||
* Back-port to MSVC
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:22 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -35,13 +45,12 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once // Include this file only once
|
||||
#endif
|
||||
|
||||
#ifndef __EXCEPTION_HANDLER_H
|
||||
#define __EXCEPTION_HANDLER_H
|
||||
|
||||
|
||||
|
||||
// --------------------
|
||||
//
|
||||
// Defines
|
||||
|
||||
@@ -9,13 +9,73 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Fireball/FireBalls.cpp $
|
||||
* $Revision: 2.12 $
|
||||
* $Date: 2004-05-12 22:49:14 $
|
||||
* $Author: phreak $
|
||||
* $Revision: 2.26 $
|
||||
* $Date: 2005-04-05 05:53:15 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Code to move, render and otherwise deal with fireballs.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.25 2005/03/19 18:02:33 bobboau
|
||||
* added new graphic functions for state blocks
|
||||
* also added a class formanageing a new effect
|
||||
*
|
||||
* Revision 2.24 2005/03/14 03:24:25 taylor
|
||||
* speedup grow/shrink time for the warp to avoid the big size skips
|
||||
*
|
||||
* Revision 2.23 2005/03/10 08:00:02 taylor
|
||||
* change min/max to MIN/MAX to fix GCC problems
|
||||
* add lab stuff to Makefile
|
||||
* build unbreakage for everything that's not MSVC++ 6
|
||||
* lots of warning fixes
|
||||
* fix OpenGL rendering problem with ship insignias
|
||||
* no Warnings() in non-debug mode for Linux (like Windows)
|
||||
* some campaign savefile fixage to stop reverting everyones data
|
||||
*
|
||||
* Revision 2.22 2005/03/01 06:55:40 bobboau
|
||||
* oh, hey look I've commited something :D
|
||||
* animation system, weapon models detail box alt-tab bug, probly other stuff
|
||||
*
|
||||
* Revision 2.21 2005/02/23 05:05:39 taylor
|
||||
* compiler warning fixes (for MSVC++ 6)
|
||||
* have the warp effect only load as many LODs as will get used
|
||||
* head off strange bug in release when corrupt soundtrack number gets used
|
||||
* (will still Assert in debug)
|
||||
* don't ever try and save a campaign savefile in multi or standalone modes
|
||||
* first try at 32bit->16bit color conversion for TGA code (for TGA only ship textures)
|
||||
*
|
||||
* Revision 2.20 2005/01/30 09:27:39 Goober5000
|
||||
* nitpicked some boolean tests, and fixed two small bugs
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.19 2004/11/01 20:57:03 taylor
|
||||
* make use of Knossos_warp_ani_used flag - thanks Goober5000
|
||||
*
|
||||
* Revision 2.18 2004/10/31 02:26:15 Goober5000
|
||||
* whoops
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.17 2004/10/31 02:04:33 Goober5000
|
||||
* added Knossos_warp_ani_used flag for taylor
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.16 2004/09/17 07:12:22 Goober5000
|
||||
* changed around the logic for the 3D warp effect
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.15 2004/08/23 04:32:39 Goober5000
|
||||
* warp effect is back to FS2 default
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.14 2004/07/26 20:47:28 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.13 2004/07/12 16:32:45 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.12 2004/05/12 22:49:14 phreak
|
||||
* renamed the warp model variable from 'wm' to 'Warp_model'
|
||||
*
|
||||
* Revision 2.11 2004/03/17 04:07:29 bobboau
|
||||
* new fighter beam code
|
||||
* fixed old after burner trails
|
||||
@@ -388,14 +448,18 @@
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "parse/parselo.h"
|
||||
|
||||
int Warp_model;
|
||||
|
||||
#define WARPHOLE_GROW_TIME (3.5f) // time for warphole to reach max size (also time to shrink to nothing once it begins to shrink)
|
||||
int Warp_model;
|
||||
int Knossos_warp_ani_used;
|
||||
|
||||
#define WARPHOLE_GROW_TIME (2.5f) // time for warphole to reach max size (also time to shrink to nothing once it begins to shrink)
|
||||
|
||||
#define MAX_FIREBALL_LOD 4
|
||||
|
||||
#define MAX_FIREBALLS 200
|
||||
|
||||
#define MAX_WARP_LOD 0
|
||||
|
||||
fireball Fireballs[MAX_FIREBALLS];
|
||||
|
||||
fireball_info Fireball_info[MAX_FIREBALL_TYPES];
|
||||
@@ -405,6 +469,7 @@ int Num_fireballs = 0;
|
||||
int fireballs_inited = 0;
|
||||
|
||||
int Warp_glow_bitmap = -1;
|
||||
int Warp_ball_bitmap = -1;
|
||||
|
||||
#define FB_INDEX(fb) (fb-Fireballs)
|
||||
|
||||
@@ -524,6 +589,10 @@ void fireball_load_data()
|
||||
fd = &Fireball_info[i];
|
||||
|
||||
for(idx=0; idx<fd->lod_count; idx++){
|
||||
// we won't use a warp effect lod greater than MAX_WARP_LOD so don't load it either
|
||||
if ( (i == FIREBALL_WARP_EFFECT) && (idx > MAX_WARP_LOD) )
|
||||
continue;
|
||||
|
||||
fd->lod[idx].bitmap_id = bm_load_animation( fd->lod[idx].filename, &fd->lod[idx].num_frames, &fd->lod[idx].fps, 1 );
|
||||
if ( fd->lod[idx].bitmap_id < 0 ) {
|
||||
Error(LOCATION, "Could not load %s anim file\n", fd->lod[idx].filename);
|
||||
@@ -534,6 +603,9 @@ void fireball_load_data()
|
||||
if ( Warp_glow_bitmap == -1 ) {
|
||||
Warp_glow_bitmap = bm_load( NOX("warpglow01") );
|
||||
}
|
||||
if ( Warp_ball_bitmap == -1 ) {
|
||||
Warp_ball_bitmap = bm_load( NOX("warpball01") );
|
||||
}
|
||||
|
||||
// polymodel Warp_pm;
|
||||
|
||||
@@ -564,6 +636,9 @@ void fireball_init()
|
||||
Fireballs[i].objnum = -1;
|
||||
}
|
||||
|
||||
// Goober5000 - reset Knossos warp flag
|
||||
Knossos_warp_ani_used = 0;
|
||||
|
||||
mprintf(("loading warp model"));
|
||||
Warp_model = -1;
|
||||
Warp_model = model_load("warp.pof", 0, NULL, 0);
|
||||
@@ -652,7 +727,7 @@ void fireball_render(object * obj)
|
||||
// obj->alt_rad = rad;
|
||||
|
||||
|
||||
warpin_render(obj, &obj->orient, &obj->pos, Fireballs[num].current_bitmap, rad, percent_life, obj->radius, (Fireballs[num].flags & FBF_WARP_FORCE_OLD) );
|
||||
warpin_render(obj, &obj->orient, &obj->pos, Fireballs[num].current_bitmap, rad, percent_life, obj->radius, (Fireballs[num].flags & FBF_WARP_3D) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -795,7 +870,7 @@ int fireball_free_one()
|
||||
fb = &Fireballs[i];
|
||||
|
||||
// only remove the ones that aren't warp effects
|
||||
if ( (fb->objnum>-1) && fireball_is_perishable(&Objects[fb->objnum]) ) {
|
||||
if ( (fb->objnum >= 0) && fireball_is_perishable(&Objects[fb->objnum]) ) {
|
||||
|
||||
lifeleft = fb->total_time - fb->time_elapsed;
|
||||
if ( (oldest_objnum < 0) || (lifeleft < oldest_lifeleft) ) {
|
||||
@@ -911,11 +986,15 @@ float fireball_lifeleft_percent( object *obj )
|
||||
|
||||
fb = &Fireballs[num];
|
||||
|
||||
return (fb->total_time - fb->time_elapsed) / fb->total_time;
|
||||
// Assert((fb->total_time - fb->time_elapsed) / fb->total_time >=0);
|
||||
|
||||
float p = (fb->total_time - fb->time_elapsed) / fb->total_time;
|
||||
if (p < 0)p=0.0f;
|
||||
return p;
|
||||
}
|
||||
|
||||
// determine LOD to use
|
||||
int fireball_get_lod(vector *pos, fireball_info *fd, float size)
|
||||
int fireball_get_lod(vec3d *pos, fireball_info *fd, float size)
|
||||
{
|
||||
vertex v;
|
||||
int x, y, w, h, bm_size;
|
||||
@@ -944,7 +1023,7 @@ int fireball_get_lod(vector *pos, fireball_info *fd, float size)
|
||||
// if vertex is behind, find size if in front, then drop down 1 LOD
|
||||
if (v.codes & CC_BEHIND) {
|
||||
float dist = vm_vec_dist_quick(&Eye_position, pos);
|
||||
vector temp;
|
||||
vec3d temp;
|
||||
|
||||
behind = 1;
|
||||
vm_vec_scale_add(&temp, &Eye_position, &Eye_matrix.vec.fvec, dist);
|
||||
@@ -993,11 +1072,11 @@ int fireball_get_lod(vector *pos, fireball_info *fd, float size)
|
||||
}
|
||||
|
||||
// return the best lod
|
||||
return min(ret_lod, fd->lod_count - 1);
|
||||
return MIN(ret_lod, fd->lod_count - 1);
|
||||
}
|
||||
|
||||
// Create a fireball, return object index.
|
||||
int fireball_create( vector * pos, int fireball_type, int parent_obj, float size, int reverse, vector *velocity, float warp_lifetime, int ship_class, matrix *orient_override, int low_res, int extra_flags, int warp_open_sound, int warp_close_sound)
|
||||
int fireball_create( vec3d * pos, int fireball_type, int parent_obj, float size, int reverse, vec3d *velocity, float warp_lifetime, int ship_class, matrix *orient_override, int low_res, int extra_flags, int warp_open_sound, int warp_close_sound)
|
||||
{
|
||||
int n, objnum, fb_lod;
|
||||
object *obj;
|
||||
@@ -1051,7 +1130,7 @@ int fireball_create( vector * pos, int fireball_type, int parent_obj, float size
|
||||
// change lod if low res is desired
|
||||
if (low_res) {
|
||||
fb_lod++;
|
||||
fb_lod = min(fb_lod, fd->lod_count - 1);
|
||||
fb_lod = MIN(fb_lod, fd->lod_count - 1);
|
||||
}
|
||||
|
||||
// if this is a warpout fireball, never go higher than LOD 1
|
||||
@@ -1061,7 +1140,7 @@ int fireball_create( vector * pos, int fireball_type, int parent_obj, float size
|
||||
fb_lod = 1;
|
||||
}
|
||||
*/
|
||||
fb_lod = 0;
|
||||
fb_lod = MAX_WARP_LOD;
|
||||
}
|
||||
fl = &fd->lod[fb_lod];
|
||||
|
||||
@@ -1191,7 +1270,15 @@ void fireballs_page_in()
|
||||
for ( i = 0; i < MAX_FIREBALL_TYPES ; i++ ) {
|
||||
fd = &Fireball_info[i];
|
||||
|
||||
for(idx=0; idx<fd->lod_count; idx++){
|
||||
// if this is a Knossos ani, only load if Knossos_warp_ani_used is true
|
||||
if ( (i == FIREBALL_KNOSSOS_EFFECT) && !Knossos_warp_ani_used)
|
||||
continue;
|
||||
|
||||
for(idx=0; idx<fd->lod_count; idx++) {
|
||||
// we won't use a warp effect lod greater than MAX_WARP_LOD so don't load it either
|
||||
if ( (i == FIREBALL_WARP_EFFECT) && (idx > MAX_WARP_LOD) )
|
||||
continue;
|
||||
|
||||
bm_page_in_texture( fd->lod[idx].bitmap_id, fd->lod[idx].num_frames );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,38 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Fireball/FireBalls.h $
|
||||
* $Revision: 2.7 $
|
||||
* $Date: 2004-05-12 22:49:13 $
|
||||
* $Author: phreak $
|
||||
* $Revision: 2.14 $
|
||||
* $Date: 2005-07-13 02:50:52 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Prototypes for fireball functions
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.13 2005/04/05 05:53:15 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.12 2005/03/19 18:02:33 bobboau
|
||||
* added new graphic functions for state blocks
|
||||
* also added a class formanageing a new effect
|
||||
*
|
||||
* Revision 2.11 2004/10/31 02:04:33 Goober5000
|
||||
* added Knossos_warp_ani_used flag for taylor
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.10 2004/09/17 07:12:22 Goober5000
|
||||
* changed around the logic for the 3D warp effect
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.9 2004/08/23 04:32:39 Goober5000
|
||||
* warp effect is back to FS2 default
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.8 2004/08/11 05:06:22 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.7 2004/05/12 22:49:13 phreak
|
||||
* renamed the warp model variable from 'wm' to 'Warp_model'
|
||||
*
|
||||
* Revision 2.6 2004/03/17 04:07:29 bobboau
|
||||
* new fighter beam code
|
||||
* fixed old after burner trails
|
||||
@@ -220,7 +245,7 @@ typedef struct fireball_info {
|
||||
#define FBF_WARP_CLOSE_SOUND_PLAYED (1<<0)
|
||||
#define FBF_WARP_CAPITAL_SIZE (1<<1)
|
||||
#define FBF_WARP_CRUISER_SIZE (1<<2)
|
||||
#define FBF_WARP_FORCE_OLD (1<<3) // Goober5000
|
||||
#define FBF_WARP_3D (1<<3) // Goober5000
|
||||
#define FBF_WARP_VIA_SEXP (1<<4) // Goober5000
|
||||
|
||||
typedef struct fireball {
|
||||
@@ -246,7 +271,7 @@ void fireball_process_post(object * obj, float frame_time);
|
||||
// reversed is for warp_in/out effects
|
||||
// Velocity: If not NULL, the fireball will move at a constant velocity.
|
||||
// warp_lifetime: If warp_lifetime > 0.0f then makes the explosion loop so it lasts this long. Only works for warp effect
|
||||
int fireball_create(vector *pos, int fireball_type, int parent_obj, float size, int reversed=0, vector *velocity=NULL, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=NULL, int low_res=0, int extra_flags=0, int warp_open_sound=0, int warp_close_sound=0);
|
||||
int fireball_create(vec3d *pos, int fireball_type, int parent_obj, float size, int reversed=0, vec3d *velocity=NULL, float warp_lifetime=0.0f, int ship_class=-1, matrix *orient=NULL, int low_res=0, int extra_flags=0, int warp_open_sound=0, int warp_close_sound=0);
|
||||
void fireball_render_plane(int plane);
|
||||
void fireball_close();
|
||||
void fireball_level_close();
|
||||
@@ -265,9 +290,13 @@ float fireball_lifeleft( object *obj );
|
||||
float fireball_lifeleft_percent( object *obj );
|
||||
|
||||
// internal function to draw warp grid.
|
||||
extern void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int force_old = 0 );
|
||||
extern void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d = 0 );
|
||||
extern int Warp_glow_bitmap; // Internal
|
||||
extern int Warp_ball_bitmap; // Internal
|
||||
|
||||
extern int Warp_model;
|
||||
|
||||
// Goober5000
|
||||
extern int Knossos_warp_ani_used;
|
||||
|
||||
#endif /* _FIREBALLS_H */
|
||||
@@ -9,13 +9,66 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Fireball/WarpInEffect.cpp $
|
||||
* $Revision: 2.15 $
|
||||
* $Date: 2004-05-12 22:49:13 $
|
||||
* $Author: phreak $
|
||||
* $Revision: 2.30 $
|
||||
* $Date: 2005-08-25 22:40:02 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Code for rendering the warp in effects for ships
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.29 2005/07/25 05:24:17 Goober5000
|
||||
* cleaned up some command line and mission flag stuff
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.28 2005/07/23 17:27:50 Goober5000
|
||||
* remove Bobboau's extra warp thing
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.27 2005/05/22 22:47:19 phreak
|
||||
* compile warning fixage.
|
||||
*
|
||||
* Revision 2.26 2005/04/05 05:53:15 taylor
|
||||
* s/vector/vec3d/g, better support for different compilers (Jens Granseuer)
|
||||
*
|
||||
* Revision 2.25 2005/03/25 06:57:33 wmcoolmon
|
||||
* Big, massive, codebase commit. I have not removed the old ai files as the ones I uploaded aren't up-to-date (But should work with the rest of the codebase)
|
||||
*
|
||||
* Revision 2.24 2005/03/19 18:02:33 bobboau
|
||||
* added new graphic functions for state blocks
|
||||
* also added a class formanageing a new effect
|
||||
*
|
||||
* Revision 2.23 2005/01/01 19:47:26 taylor
|
||||
* make use of MR_NO_FOGGING to render models without fog
|
||||
*
|
||||
* Revision 2.22 2004/11/23 19:29:13 taylor
|
||||
* fix 2d warp in D3D, add cmdline option for 3d warp
|
||||
*
|
||||
* Revision 2.21 2004/09/17 07:12:22 Goober5000
|
||||
* changed around the logic for the 3D warp effect
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.20 2004/08/23 04:32:39 Goober5000
|
||||
* warp effect is back to FS2 default
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.19 2004/07/26 20:47:28 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.18 2004/07/17 09:29:13 taylor
|
||||
* make old warpmap and new glow bitmap 3D unlit to render right in OGL
|
||||
*
|
||||
* Revision 2.17 2004/07/12 16:32:46 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.16 2004/07/05 05:09:18 bobboau
|
||||
* FVF code, only the data that is needed is sent off to the card,,
|
||||
* OGL can take advantage of this if they want but it won't break
|
||||
* anything if they don't. also state block code has been implemented,
|
||||
* that's totaly internal to D3D no high level code is involved.
|
||||
*
|
||||
* Revision 2.15 2004/05/12 22:49:13 phreak
|
||||
* renamed the warp model variable from 'wm' to 'Warp_model'
|
||||
*
|
||||
* Revision 2.14 2004/05/08 01:08:48 Goober5000
|
||||
* small fix
|
||||
* --Goober5000
|
||||
@@ -186,26 +239,31 @@
|
||||
#include "render/3d.h"
|
||||
#include "fireball/fireballs.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "Nebula/Neb.h"
|
||||
#include "nebula/neb.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "model/model.h"
|
||||
|
||||
|
||||
extern int Warp_model;
|
||||
extern int Cmdline_nohtl;
|
||||
extern int Cmdline_3dwarp;
|
||||
|
||||
|
||||
DCF(norm,"normalize a zero length vector")
|
||||
{
|
||||
if ( Dc_command ) {
|
||||
vector tmp = vmd_zero_vector;
|
||||
vec3d tmp = vmd_zero_vector;
|
||||
vm_vec_normalize(&tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void draw_face( vertex *v1, vertex *v2, vertex *v3 )
|
||||
{
|
||||
vector norm;
|
||||
vec3d norm;
|
||||
vertex *vertlist[3];
|
||||
|
||||
vm_vec_perp(&norm,(vector *)&v1->x,(vector *)&v2->x,(vector *)&v3->x);
|
||||
if ( vm_vec_dot(&norm,(vector *)&v1->x ) >= 0.0 ) {
|
||||
vm_vec_perp(&norm,(vec3d *)&v1->x,(vec3d *)&v2->x,(vec3d *)&v3->x);
|
||||
if ( vm_vec_dot(&norm,(vec3d *)&v1->x ) >= 0.0 ) {
|
||||
vertlist[0] = v3;
|
||||
vertlist[1] = v2;
|
||||
vertlist[2] = v1;
|
||||
@@ -215,7 +273,7 @@ void draw_face( vertex *v1, vertex *v2, vertex *v3 )
|
||||
vertlist[2] = v3;
|
||||
}
|
||||
|
||||
g3_draw_poly( 3, vertlist, TMAP_FLAG_TEXTURED );
|
||||
g3_draw_poly( 3, vertlist, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT );
|
||||
|
||||
}
|
||||
|
||||
@@ -223,8 +281,10 @@ void draw_face( vertex *v1, vertex *v2, vertex *v3 )
|
||||
#define wR_VERTICES() do { g3_rotate_vertex(verts[0], &bottom1); g3_rotate_vertex(verts[1], &bottom2); g3_rotate_vertex(verts[2], &top2); g3_rotate_vertex(verts[3], &top1); } while(0);
|
||||
#define wP_VERTICES() do { for(idx=0; idx<4; idx++){ g3_project_vertex(verts[idx]); } } while(0);
|
||||
|
||||
void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int force_old)
|
||||
void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d)
|
||||
{
|
||||
static flash_ball warp_ball(20, .1f,.25f, &vmd_z_vector, &vmd_zero_vector, 4.0f, 0.5f);
|
||||
|
||||
int i;
|
||||
|
||||
int saved_gr_zbuffering = gr_zbuffer_get();
|
||||
@@ -234,35 +294,87 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
|
||||
|
||||
float Grid_depth = radius/2.5f;
|
||||
|
||||
vector center;
|
||||
vec3d center;
|
||||
|
||||
vm_vec_scale_add( ¢er, pos, &orient->vec.fvec, -(max_radius/2.5f)/3.0f );
|
||||
|
||||
// Warp_Map = texture_bitmap_num;//sets the warp map, and thus sets the interp flag for this being a warpin effect
|
||||
vector vecs[5];
|
||||
vec3d vecs[5];
|
||||
vertex verts[5];
|
||||
|
||||
if(Warp_model > -1 && !force_old && !(The_mission.flags & MISSION_FLAG_OLD_WARP_EFFECT)){
|
||||
float model_Interp_scale_x = radius /20;
|
||||
float model_Interp_scale_y = radius /20;
|
||||
float model_Interp_scale_z = radius /20;
|
||||
vecs[4] = center; //this is for the warp glow-Bobboau
|
||||
verts[4].u = 0.5f; verts[4].v = 0.5f;
|
||||
|
||||
set_warp_globals(model_Interp_scale_x, model_Interp_scale_y, model_Interp_scale_z, texture_bitmap_num, (radius/max_radius) );
|
||||
if (Cmdline_nohtl) {
|
||||
g3_rotate_vertex( &verts[4], &vecs[4] );
|
||||
} else {
|
||||
g3_transfer_vertex( &verts[4], &vecs[4] );
|
||||
}
|
||||
|
||||
if ( Warp_glow_bitmap != -1 ) {
|
||||
gr_set_bitmap( Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, (The_mission.flags & MISSION_FLAG_FULLNEB)?(1.0f - neb2_get_fog_intensity(obj)):1.0f );
|
||||
|
||||
float r = radius;
|
||||
|
||||
int render_it;
|
||||
|
||||
#define OUT_PERCENT1 0.80f
|
||||
#define OUT_PERCENT2 0.90f
|
||||
|
||||
#define IN_PERCENT1 0.10f
|
||||
#define IN_PERCENT2 0.20f
|
||||
|
||||
if ( life_percent < IN_PERCENT1 ) {
|
||||
// do nothing
|
||||
render_it = 1;
|
||||
} else if ( life_percent < IN_PERCENT2 ) {
|
||||
r *= ( life_percent-IN_PERCENT1 ) / (IN_PERCENT2-IN_PERCENT1);
|
||||
render_it = 1;
|
||||
} else if ( life_percent < OUT_PERCENT1 ) {
|
||||
// do nothing
|
||||
render_it = 1;
|
||||
} else if ( life_percent < OUT_PERCENT2 ) {
|
||||
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2-OUT_PERCENT1);
|
||||
render_it = 1;
|
||||
} else {
|
||||
// do nothing
|
||||
render_it = 1;
|
||||
}
|
||||
|
||||
if (render_it) {
|
||||
int saved_gr_zbuffering = gr_zbuffer_get();
|
||||
gr_zbuffer_set(GR_ZBUFF_READ);
|
||||
|
||||
// Add in noise
|
||||
//float Noise[NOISE_NUM_FRAMES] = {
|
||||
int noise_frame = fl2i(Missiontime/15.0f) % NOISE_NUM_FRAMES;
|
||||
|
||||
r *= (0.40f + Noise[noise_frame]*0.30f);
|
||||
|
||||
//Bobboau's warp thingie; this should be an option somewhere
|
||||
//r += (float)pow((2.0f*life_percent) - 1.0f,24.0f)*max_radius*2.0f;
|
||||
|
||||
g3_draw_bitmap( &verts[4], 0, r, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT );
|
||||
gr_zbuffer_set(saved_gr_zbuffering);
|
||||
}
|
||||
}
|
||||
|
||||
if((Warp_model >= 0) && (warp_3d || Cmdline_3dwarp))
|
||||
{
|
||||
float model_Interp_scale_xyz = radius / 20.0f;
|
||||
|
||||
set_warp_globals(model_Interp_scale_xyz, model_Interp_scale_xyz, model_Interp_scale_xyz, texture_bitmap_num, (radius/max_radius) );
|
||||
|
||||
float dist = vm_vec_dist_quick( pos, &Eye_position );
|
||||
|
||||
model_set_detail_level((int)(dist / (radius * 10.0f)));
|
||||
gr_set_cull(0);
|
||||
model_render( Warp_model, orient, pos, MR_NO_LIGHTING | MR_NORMAL);
|
||||
model_render( Warp_model, orient, pos, MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING);
|
||||
gr_set_cull(1);
|
||||
|
||||
// Warp_Map = -1;//un sets the warp map
|
||||
|
||||
model_Interp_scale_x = 1.0f;
|
||||
model_Interp_scale_y = 1.0f;
|
||||
model_Interp_scale_z = 1.0f;
|
||||
|
||||
set_warp_globals(model_Interp_scale_x, model_Interp_scale_y, model_Interp_scale_z, -1, -1.0f);
|
||||
set_warp_globals(1.0f, 1.0f, 1.0f, -1, -1.0f);
|
||||
|
||||
/*
|
||||
//this is that half done effect that was pissing people off-Bobboau
|
||||
@@ -270,7 +382,7 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
|
||||
gr_set_cull(0);
|
||||
|
||||
matrix m;
|
||||
vector ray_dir;
|
||||
vec3d ray_dir;
|
||||
vm_vector_2_matrix(&m, &orient->vec.fvec, NULL, NULL);//this is the beam things that will come outof the point-Bobboau
|
||||
float angle = ANG_TO_RAD(135.0f);
|
||||
if(life_percent < 0.2f){
|
||||
@@ -279,13 +391,13 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
|
||||
for(int idx=0; idx<1; idx++){
|
||||
vm_vec_random_cone(&ray_dir, &orient->vec.fvec, angle, &m);
|
||||
mprintf(( "ray direction %f %f %f, orentation %f %f %f, angle %f\n",ray_dir.xyz.x, ray_dir.xyz.y, ray_dir.xyz.z, orient->vec.fvec.xyz.x, orient->vec.fvec.xyz.y, orient->vec.fvec.xyz.z, angle));
|
||||
vector p_temp = *pos;
|
||||
vec3d p_temp = *pos;
|
||||
vm_vec_scale_add(&p_temp, pos, &ray_dir, (max_radius * 10 * frand_range(0.75f, 0.9f)));
|
||||
mprintf(( "end %f %f %f",p_temp.xyz.x, p_temp.xyz.y, p_temp.xyz.z));
|
||||
|
||||
vertex h1[4]; // halves of a beam section
|
||||
vertex *verts[4] = { &h1[0], &h1[1], &h1[2], &h1[3] };
|
||||
vector top1, bottom1, top2, bottom2;
|
||||
vec3d top1, bottom1, top2, bottom2;
|
||||
|
||||
beam_calc_facing_pts(&top1, &bottom1, &ray_dir, pos, 1.0f, 1.0f);
|
||||
beam_calc_facing_pts(&top2, &bottom2, &ray_dir, &p_temp, 1.0f, 1.0f);
|
||||
@@ -303,9 +415,6 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
|
||||
gr_set_cull(1);
|
||||
*/
|
||||
|
||||
vecs[4] = center; //this is for the warp glow-Bobboau
|
||||
verts[4].u = 0.5f; verts[4].v = 0.5f;
|
||||
g3_rotate_vertex( &verts[4], &vecs[4] );
|
||||
|
||||
}else{
|
||||
gr_set_bitmap( texture_bitmap_num, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
|
||||
@@ -336,59 +445,30 @@ void warpin_render(object *obj, matrix *orient, vector *pos, int texture_bitmap_
|
||||
verts[4].u = 0.5f; verts[4].v = 0.5f;
|
||||
|
||||
for (i=0; i<5; i++ ) {
|
||||
g3_rotate_vertex( &verts[i], &vecs[i] );
|
||||
if (Cmdline_nohtl) {
|
||||
g3_rotate_vertex( &verts[i], &vecs[i] );
|
||||
} else {
|
||||
g3_transfer_vertex( &verts[i], &vecs[i] );
|
||||
}
|
||||
}
|
||||
|
||||
gr_set_cull(0); // fixes rendering problem in D3D - taylor
|
||||
draw_face( &verts[0], &verts[4], &verts[1] );
|
||||
draw_face( &verts[1], &verts[4], &verts[2] );
|
||||
draw_face( &verts[4], &verts[3], &verts[2] );
|
||||
draw_face( &verts[0], &verts[3], &verts[4] );
|
||||
}
|
||||
if ( Warp_glow_bitmap != -1 ) {
|
||||
gr_set_bitmap( Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, (The_mission.flags & MISSION_FLAG_FULLNEB)?(1.0f - neb2_get_fog_intensity(obj)):1.0f );
|
||||
|
||||
float r = radius;
|
||||
|
||||
int render_it;
|
||||
|
||||
#define OUT_PERCENT1 0.80f
|
||||
#define OUT_PERCENT2 0.90f
|
||||
|
||||
#define IN_PERCENT1 0.10f
|
||||
#define IN_PERCENT2 0.20f
|
||||
|
||||
if ( life_percent < IN_PERCENT1 ) {
|
||||
// do nothing
|
||||
render_it = 0;
|
||||
} else if ( life_percent < IN_PERCENT2 ) {
|
||||
r *= ( life_percent-IN_PERCENT1 ) / (IN_PERCENT2-IN_PERCENT1);
|
||||
render_it = 1;
|
||||
} else if ( life_percent < OUT_PERCENT1 ) {
|
||||
// do nothing
|
||||
render_it = 1;
|
||||
} else if ( life_percent < OUT_PERCENT2 ) {
|
||||
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2-OUT_PERCENT1);
|
||||
render_it = 1;
|
||||
} else {
|
||||
// do nothing
|
||||
render_it = 0;
|
||||
}
|
||||
|
||||
if (render_it) {
|
||||
int saved_gr_zbuffering = gr_zbuffer_get();
|
||||
gr_zbuffer_set(GR_ZBUFF_READ);
|
||||
|
||||
// Add in noise
|
||||
//float Noise[NOISE_NUM_FRAMES] = {
|
||||
int noise_frame = fl2i(Missiontime/15.0f) % NOISE_NUM_FRAMES;
|
||||
|
||||
r *= (0.40f + Noise[noise_frame]*0.30f);
|
||||
|
||||
g3_draw_bitmap( &verts[4], 0,r, TMAP_FLAG_TEXTURED );
|
||||
gr_zbuffer_set(saved_gr_zbuffering);
|
||||
}
|
||||
gr_set_cull(1);
|
||||
}
|
||||
|
||||
if ( Warp_ball_bitmap > -1 ){
|
||||
g3_start_instance_matrix(pos,orient, true);
|
||||
gr_set_bitmap(Warp_ball_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.9999f);
|
||||
float adg = (2.0f*life_percent) - 1.0f;
|
||||
float pct= (float)(pow(adg,4.0f)-pow(adg,128.0f))*4.0f;
|
||||
if(pct > 0.00001f)
|
||||
warp_ball.render(max_radius*pct/2.0f,adg*adg,adg*adg*6.0f);
|
||||
g3_done_instance(true);
|
||||
}
|
||||
gr_zbuffer_set( saved_gr_zbuffering );
|
||||
}
|
||||
|
||||
+1557
-350
File diff suppressed because it is too large.
Load diff
@@ -9,13 +9,28 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/FREESPACE2/FreeSpace.h $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2004-04-07 03:31:53 $
|
||||
* $Author: righteous1 $
|
||||
* $Revision: 2.7 $
|
||||
* $Date: 2005-07-13 02:50:52 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* FreeSpace, the game, not the project, header information.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.6 2005/06/03 06:39:26 taylor
|
||||
* better audio pause/unpause support when game window loses focus or is minimized
|
||||
*
|
||||
* Revision 2.5 2005/03/03 06:05:27 wmcoolmon
|
||||
* Merge of WMC's codebase. "Features and bugs, making Goober say "Grr!", as release would be stalled now for two months for sure"
|
||||
*
|
||||
* Revision 2.4 2004/10/31 21:31:34 taylor
|
||||
* bump COUNT_ESTIMATE, reset time compression at the start of a mission, new pilot file support, add feature_disabled popup
|
||||
*
|
||||
* Revision 2.3 2004/08/11 05:06:22 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.2 2004/04/07 03:31:53 righteous1
|
||||
* Updated to add alt_tab_pause() function to draw pause screen and discontinue sounds when the game is minimized. -R1
|
||||
*
|
||||
* Revision 2.1 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
@@ -189,6 +204,7 @@
|
||||
|
||||
// frametime/missiontime variables
|
||||
extern fix Frametime;
|
||||
extern float flRealframetime;
|
||||
extern float flFrametime;
|
||||
extern fix Missiontime;
|
||||
|
||||
@@ -203,6 +219,7 @@ extern int Game_mode;
|
||||
extern int Game_do_state_should_skip;
|
||||
|
||||
// time compression
|
||||
extern bool Time_compression_locked;
|
||||
extern fix Game_time_compression;
|
||||
|
||||
// Set if subspace is active this level
|
||||
@@ -266,6 +283,15 @@ int game_poll();
|
||||
// function to read keyboard stuff
|
||||
void game_process_keys();
|
||||
|
||||
// call this when you don't want the user changing time compression
|
||||
void lock_time_compression(bool is_locked);
|
||||
|
||||
// call this to set time compression properly
|
||||
void set_time_compression(float multiplier, float change_time = 0);
|
||||
|
||||
//call this to change the relative time compression (ie double it)
|
||||
void change_time_compression(float multiplier);
|
||||
|
||||
// call this to set frametime properly (once per frame)
|
||||
void game_set_frametime(int state);
|
||||
|
||||
@@ -344,6 +370,9 @@ int game_do_cd_mission_check(char *filename);
|
||||
// Used to tell the player that a feature isn't available in the demo version of FreeSpace
|
||||
void game_feature_not_in_demo_popup();
|
||||
|
||||
// Used to tell the player that a feature is disabled by build settings
|
||||
void game_feature_disabled_popup();
|
||||
|
||||
// Return version string for demo or full version, depending on build.
|
||||
void get_version_string(char *str);
|
||||
|
||||
@@ -356,9 +385,9 @@ int game_hacked_data();
|
||||
// show the oem upsell screens (end of campaign, or close of game
|
||||
void oem_upsell_show_screens();
|
||||
|
||||
// function to handle pausing the game when the game is minimized
|
||||
// called from osapi.cpp
|
||||
void alt_tab_pause();
|
||||
// calls to be executed when the game is put in or restored from minimized or inactive state
|
||||
void game_pause();
|
||||
void game_unpause();
|
||||
|
||||
#endif // endif of #ifndef STAMPER_PROGRAM
|
||||
#endif
|
||||
@@ -9,13 +9,33 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Freespace2/LevelPaging.cpp $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2004-03-05 09:02:01 $
|
||||
* $Author: Goober5000 $
|
||||
* $Revision: 2.8 $
|
||||
* $Date: 2005-04-21 15:58:07 $
|
||||
* $Author: taylor $
|
||||
*
|
||||
* Code to page in all the bitmaps at the beginning of a level.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.7 2005/02/04 20:06:03 taylor
|
||||
* merge with Linux/OSX tree - p0204-2
|
||||
*
|
||||
* Revision 2.6 2004/07/26 20:47:29 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 2.5 2004/07/12 16:32:46 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 2.4 2004/07/01 01:53:00 phreak
|
||||
* function pointer radar update.
|
||||
* will enable us to make different radar styles that we can switch between
|
||||
*
|
||||
* Revision 2.3 2004/06/18 04:59:53 wmcoolmon
|
||||
* Only used weapons paged in instead of all, fixed music box in FRED, sound quality settable with SoundSampleRate and SoundSampleBits registry values
|
||||
*
|
||||
* Revision 2.2 2004/03/05 09:02:01 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.1 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
@@ -62,13 +82,14 @@
|
||||
#include "freespace2/freespace.h"
|
||||
#include "freespace2/levelpaging.h"
|
||||
|
||||
|
||||
// All the page in functions
|
||||
extern void ship_page_in();
|
||||
extern void debris_page_in();
|
||||
extern void particle_page_in();
|
||||
extern void stars_page_in();
|
||||
extern void hud_page_in();
|
||||
extern void radar_page_in();
|
||||
extern void (*radar_page_in)();
|
||||
extern void weapons_page_in();
|
||||
extern void fireballs_page_in();
|
||||
extern void shockwave_page_in();
|
||||
@@ -77,20 +98,23 @@ extern void asteroid_page_in();
|
||||
extern void training_mission_page_in();
|
||||
extern void neb2_page_in();
|
||||
extern void message_pagein_mission_messages();
|
||||
extern void model_page_in_stop();
|
||||
|
||||
// Pages in all the texutures for the currently
|
||||
// loaded mission. Call game_busy() occasionally...
|
||||
void level_page_in()
|
||||
{
|
||||
|
||||
mprintf(( "Beginning level bitmap paging...\n" ));
|
||||
|
||||
if(!(Game_mode & GM_STANDALONE_SERVER)){
|
||||
bm_page_in_start();
|
||||
}
|
||||
// moved to freespace.cpp on 2005/04/18 - taylor
|
||||
// mprintf(( "Beginning level bitmap paging...\n" ));
|
||||
//
|
||||
// if(!(Game_mode & GM_STANDALONE_SERVER)){
|
||||
// bm_page_in_start();
|
||||
// }
|
||||
|
||||
// Most important ones first
|
||||
ship_page_in();
|
||||
//Must be called after paging in ships
|
||||
weapons_page_in();
|
||||
fireballs_page_in();
|
||||
particle_page_in();
|
||||
@@ -110,6 +134,7 @@ void level_page_in()
|
||||
}
|
||||
|
||||
if(!(Game_mode & GM_STANDALONE_SERVER)){
|
||||
model_page_in_stop(); // free any loaded models that aren't used
|
||||
bm_page_in_stop();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,13 +9,19 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/FREESPACE2/LevelPaging.h $
|
||||
* $Revision: 2.0 $
|
||||
* $Date: 2002-06-03 04:02:22 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2005-07-13 02:50:52 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* Code to page in all the bitmaps at the beginning of a level.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.1 2004/08/11 05:06:22 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:22 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
* Revision 1.1 2002/05/02 18:03:07 mharris
|
||||
* Initial checkin - converted filenames and includes to lower case
|
||||
*
|
||||
|
||||
@@ -10,12 +10,45 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/fs2open_pxo/Client.cpp $
|
||||
* $Revision: 1.13 $
|
||||
* $Date: 2004-03-07 23:07:20 $
|
||||
* $Author: Kazan $
|
||||
* $Revision: 1.21 $
|
||||
* $Date: 2005-07-13 02:50:49 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.20 2005/03/02 21:18:18 taylor
|
||||
* better support for Inferno builds (in PreProcDefines.h now, no networking support)
|
||||
* make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
|
||||
* revert a timeout in Client.h back to the original value before Linux merge
|
||||
*
|
||||
* Revision 1.19 2005/02/23 13:17:04 taylor
|
||||
* few more compiler warning fixes (didn't mean to commit iostream.h change)
|
||||
* lower warning level to 3 to stop MSVC6 from complaining about C++ headers
|
||||
*
|
||||
* Revision 1.18 2005/02/23 05:05:37 taylor
|
||||
* compiler warning fixes (for MSVC++ 6)
|
||||
* have the warp effect only load as many LODs as will get used
|
||||
* head off strange bug in release when corrupt soundtrack number gets used
|
||||
* (will still Assert in debug)
|
||||
* don't ever try and save a campaign savefile in multi or standalone modes
|
||||
* first try at 32bit->16bit color conversion for TGA code (for TGA only ship textures)
|
||||
*
|
||||
* Revision 1.17 2005/02/04 20:06:03 taylor
|
||||
* merge with Linux/OSX tree - p0204-2
|
||||
*
|
||||
* Revision 1.16 2004/11/21 16:07:22 Kazan
|
||||
* dumbbugfix
|
||||
*
|
||||
* Revision 1.15 2004/11/18 00:05:36 Goober5000
|
||||
* #pragma'd a bunch of warnings
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.14 2004/05/25 00:21:39 wmcoolmon
|
||||
* Updated to use <iostream> instead of <iostream.h>
|
||||
*
|
||||
* Revision 1.13 2004/03/07 23:07:20 Kazan
|
||||
* [Incomplete] Readd of Software renderer so Standalone server works
|
||||
*
|
||||
* Revision 1.12 2004/03/05 09:01:56 Goober5000
|
||||
* Uber pass at reducing #includes
|
||||
* --Goober5000
|
||||
@@ -51,15 +84,29 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "Client.h"
|
||||
//#include "protocol.h"
|
||||
#include "udpsocket.h"
|
||||
#include <iostream.h>
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
|
||||
// 4711 = function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4711)
|
||||
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
|
||||
|
||||
#include "fs2open_pxo/Client.h"
|
||||
//#include "fs2open_pxo/protocol.h"
|
||||
#include "fs2open_pxo/udpsocket.h"
|
||||
#include "network/multi_log.h"
|
||||
#include "playerman/player.h"
|
||||
#include "ship/ship.h"
|
||||
|
||||
PXO_Socket FS2OpenPXO_Socket;
|
||||
|
||||
// NOTE: CLK_TCK is depreciated but available for compatibility, use CLOCKS_PER_SEC instead
|
||||
#ifndef CLK_TCK
|
||||
#define CLK_TCK CLOCKS_PER_SEC
|
||||
#endif
|
||||
|
||||
#define PXO_ADDINT(n) *((int *)cur) = (n); cur += sizeof(int);
|
||||
#define PXO_ADDSTRING(x, y) memcpy(cur, x, y); cur += y;
|
||||
@@ -84,7 +131,7 @@ int CheckSingleMission(const char* mission, unsigned int crc32, UDP_Socket &Sock
|
||||
|
||||
|
||||
if (Socket.SendPacket((char *) &checkpack, sizeof(fs2open_file_check_single), sender, port) == -1)
|
||||
return NULL;
|
||||
return -1;
|
||||
|
||||
|
||||
fs2open_fcheck_reply c_reply;
|
||||
@@ -168,7 +215,7 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
|
||||
|
||||
// send Packet
|
||||
if (Socket.SendPacket(PacketBuffer, packet_size, sender, port) == -1)
|
||||
return NULL;
|
||||
return -1;
|
||||
|
||||
|
||||
fs2open_pilot_updatereply u_reply;
|
||||
@@ -216,7 +263,7 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
|
||||
|
||||
// send Packet
|
||||
if (Socket.SendPacket((char *)&prq_packet, sizeof(fs2open_get_pilot), sender, port) == -1)
|
||||
return NULL;
|
||||
return -1;
|
||||
|
||||
char PacketBuffer[16384]; // 16K should be enough i think..... I HOPE!
|
||||
fs2open_pilot_reply *p_reply = (fs2open_pilot_reply *) PacketBuffer;
|
||||
@@ -408,7 +455,7 @@ int Fs2OpenPXO_Login(const char* username, const char* password, UDP_Socket &Soc
|
||||
|
||||
if (Socket.SendPacket((char *) &loginpckt, sizeof(loginpckt), sender, port) == -1)
|
||||
{
|
||||
cout << "Error Sending Packet" << endl;
|
||||
std::cout << "Error Sending Packet" << std::endl;
|
||||
}
|
||||
|
||||
// await reply
|
||||
@@ -457,8 +504,8 @@ void SendHeartBeat(const char* masterserver, int targetport, UDP_Socket &Socket,
|
||||
hbpack.players = (short) players;
|
||||
hbpack.port = port;
|
||||
|
||||
|
||||
Socket.SendPacket((char *) &hbpack, sizeof(serverlist_hb_packet), std::string(masterserver), targetport);
|
||||
std::string ms = masterserver;
|
||||
Socket.SendPacket((char *) &hbpack, (int)sizeof(serverlist_hb_packet), ms, targetport);
|
||||
}
|
||||
|
||||
|
||||
@@ -541,7 +588,7 @@ int Ping(const char* target)
|
||||
UDP_Socket Socket(FS2OPEN_CLIENT_PORT);
|
||||
if (!Socket.InitSocket())
|
||||
{
|
||||
cout << "Initialization Error!" << endl;
|
||||
std::cout << "Initialization Error!" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -557,4 +604,6 @@ int Ping(const char* target)
|
||||
Socket.GetPacket((char *)&rping, sizeof(fs2open_pingreply), rctp);
|
||||
|
||||
return int( float(time(0) - rping.time)/2.0 );
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !NO_NETWORK
|
||||
@@ -10,12 +10,31 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/fs2open_pxo/Client.h $
|
||||
* $Revision: 1.14 $
|
||||
* $Date: 2004-03-31 05:42:26 $
|
||||
* $Revision: 1.19 $
|
||||
* $Date: 2005-07-13 02:50:49 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.18 2005/03/02 21:18:18 taylor
|
||||
* better support for Inferno builds (in PreProcDefines.h now, no networking support)
|
||||
* make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
|
||||
* revert a timeout in Client.h back to the original value before Linux merge
|
||||
*
|
||||
* Revision 1.17 2005/02/04 20:06:03 taylor
|
||||
* merge with Linux/OSX tree - p0204-2
|
||||
*
|
||||
* Revision 1.16 2004/08/11 05:06:23 Kazan
|
||||
* added preprocdefines.h to prevent what happened with fred -- make sure to make all fred2 headers include this file as the _first_ include -- i have already modified fs2 files to do this
|
||||
*
|
||||
* Revision 1.15 2004/07/07 21:00:06 Kazan
|
||||
* FS2NetD: C2S Ping/Pong, C2S Ping/Pong, Global IP Banlist, Global Network Messages
|
||||
*
|
||||
* Revision 1.14 2004/03/31 05:42:26 Goober5000
|
||||
* got rid of all those nasty warnings from xlocale and so forth; also added comments
|
||||
* for #pragma warning disable to indicate the message being disabled
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.13 2004/03/09 00:02:16 Kazan
|
||||
* more fs2netd stuff
|
||||
*
|
||||
@@ -49,6 +68,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__pxo_client_h_)
|
||||
#define __pxo_client_h_
|
||||
|
||||
|
||||
#pragma warning(disable:4018) // signed/unsigned mismatch
|
||||
#pragma warning(disable:4100) // unreferenced formal parameter
|
||||
#pragma warning(disable:4511) // copy constructor could not be generated
|
||||
@@ -56,18 +80,20 @@
|
||||
#pragma warning(disable:4663) // new template specification syntax
|
||||
#pragma warning(disable:4710) // function not inlined
|
||||
|
||||
#if !defined(__pxo_client_h_)
|
||||
#define __pxo_client_h_
|
||||
|
||||
#define MAX_SERVERS 512
|
||||
#include "protocol.h"
|
||||
#include "fs2open_pxo/protocol.h"
|
||||
|
||||
#if !defined(PXO_TCP)
|
||||
#include "udpsocket.h"
|
||||
#include "fs2open_pxo/udpsocket.h"
|
||||
typedef UDP_Socket PXO_Socket;
|
||||
#else
|
||||
#include "TCP_Socket.h"
|
||||
#include "fs2open_pxo/TCP_Socket.h"
|
||||
typedef TCP_Socket PXO_Socket;
|
||||
#endif
|
||||
|
||||
extern PXO_Socket FS2OpenPXO_Socket;
|
||||
|
||||
struct player;
|
||||
|
||||
struct net_server
|
||||
@@ -83,43 +109,21 @@ struct net_server
|
||||
int port;
|
||||
};
|
||||
|
||||
int SendPlayerData(int SID, const char* player_name, const char* user, player *pl, const char* masterserver, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
int GetPlayerData(int SID, const char* player_name, player *pl, const char* masterserver, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, bool CanCreate=false, int timeout=15);
|
||||
int CheckSingleMission(const char* mission, unsigned int crc32, PXO_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
|
||||
#if !defined(PXO_TCP)
|
||||
// ********************************************************************************************************
|
||||
// UDP Version of PXO
|
||||
// ********************************************************************************************************
|
||||
// Variants of the above functions with persistant connections
|
||||
int SendPlayerData(int SID, const char* player_name, const char* user, player *pl, const char* masterserver, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
int GetPlayerData(int SID, const char* player_name, player *pl, const char* masterserver, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, bool CanCreate=false, int timeout=15);
|
||||
int CheckSingleMission(const char* mission, unsigned int crc32, UDP_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
|
||||
net_server* GetServerList(const char* masterserver, int &numServersFound, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
int Ping(const char* target, UDP_Socket &Socket);
|
||||
void SendHeartBeat(const char* masterserver, int targetport, UDP_Socket &Socket, const char* myName, const char* MisName, const char* title, int flags, int port, int players)
|
||||
int Fs2OpenPXO_Login(const char* username, const char* password, UDP_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
|
||||
net_server* GetServerList(const char* masterserver, int &numServersFound, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
int Ping(const char* target, PXO_Socket &Socket);
|
||||
void SendHeartBeat(const char* masterserver, int targetport, PXO_Socket &Socket, const char* myName, const char* MisName, const char* title, int flags, int port, int players);
|
||||
int Fs2OpenPXO_Login(const char* username, const char* password, PXO_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
int GetPingReply(PXO_Socket &Socket);
|
||||
void SendPingReply(PXO_Socket &Socket, int tstamp);
|
||||
fs2open_banmask* GetBanList(int &numBanMasks, PXO_Socket &Socket, int timeout=15);
|
||||
|
||||
// longer timeouts - mySQL operations
|
||||
file_record* GetTablesList(int &numTables, const char *masterserver, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
|
||||
file_record* GetMissionsList(int &numMissions, const char *masterserver, UDP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
|
||||
#else
|
||||
// ********************************************************************************************************
|
||||
// TCP Version of PXO
|
||||
// ********************************************************************************************************
|
||||
int SendPlayerData(int SID, const char* player_name, const char* user, player *pl, const char* masterserver, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
int GetPlayerData(int SID, const char* player_name, player *pl, const char* masterserver, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, bool CanCreate=false, int timeout=15);
|
||||
int CheckSingleMission(const char* mission, unsigned int crc32, TCP_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
|
||||
net_server* GetServerList(const char* masterserver, int &numServersFound, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
int Ping(const char* target, TCP_Socket &Socket);
|
||||
void SendHeartBeat(const char* masterserver, int targetport, TCP_Socket &Socket, const char* myName, const char* MisName, const char* title, int flags, int port, int players);
|
||||
int Fs2OpenPXO_Login(const char* username, const char* password, TCP_Socket &Socket, const char* masterserver, int port=FS2OPEN_PXO_PORT, int timeout=15);
|
||||
int GetPingReply(TCP_Socket &Socket);
|
||||
|
||||
// longer timeouts - mySQL operations
|
||||
file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
|
||||
file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
|
||||
#endif
|
||||
file_record* GetTablesList(int &numTables, const char *masterserver, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
|
||||
file_record* GetMissionsList(int &numMissions, const char *masterserver, PXO_Socket &Socket, int port=FS2OPEN_PXO_PORT, int timeout=30);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -11,11 +11,76 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/fs2open_pxo/TCP_Client.cpp $
|
||||
* $Revision: 1.15 $
|
||||
* $Date: 2004-03-31 05:42:26 $
|
||||
* $Revision: 1.31 $
|
||||
* $Date: 2005-07-13 02:50:49 $
|
||||
* $Author: Goober5000 $
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 1.30 2005/06/29 18:49:37 taylor
|
||||
* various FS2NetD fixes:
|
||||
* - replace timer stuff with something that more accurately works cross-platform and without being affected by load
|
||||
* - better sanity checking for the server list
|
||||
* - working Linux compatibility that's not dog slow
|
||||
* - when calling DataReady() make sure that the data is properly valid
|
||||
* - fix messed up cvs merge cleanup from the Linux merge which did nasty things
|
||||
*
|
||||
* Revision 1.29 2005/06/21 00:13:47 taylor
|
||||
* add some better error checking/handling for when GetServerList messes up
|
||||
*
|
||||
* Revision 1.28 2005/05/08 20:28:57 wmcoolmon
|
||||
* Dynamically allocated medals
|
||||
*
|
||||
* Revision 1.27 2005/03/08 03:50:25 Goober5000
|
||||
* edited for language ;)
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.26 2005/03/02 21:18:18 taylor
|
||||
* better support for Inferno builds (in PreProcDefines.h now, no networking support)
|
||||
* make sure NO_NETWORK builds are as friendly on Windows as it is on Linux/OSX
|
||||
* revert a timeout in Client.h back to the original value before Linux merge
|
||||
*
|
||||
* Revision 1.25 2005/02/23 13:17:04 taylor
|
||||
* few more compiler warning fixes (didn't mean to commit iostream.h change)
|
||||
* lower warning level to 3 to stop MSVC6 from complaining about C++ headers
|
||||
*
|
||||
* Revision 1.24 2005/02/23 05:05:37 taylor
|
||||
* compiler warning fixes (for MSVC++ 6)
|
||||
* have the warp effect only load as many LODs as will get used
|
||||
* head off strange bug in release when corrupt soundtrack number gets used
|
||||
* (will still Assert in debug)
|
||||
* don't ever try and save a campaign savefile in multi or standalone modes
|
||||
* first try at 32bit->16bit color conversion for TGA code (for TGA only ship textures)
|
||||
*
|
||||
* Revision 1.23 2005/02/04 20:06:03 taylor
|
||||
* merge with Linux/OSX tree - p0204-2
|
||||
*
|
||||
* Revision 1.22 2004/11/18 00:05:36 Goober5000
|
||||
* #pragma'd a bunch of warnings
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.21 2004/07/26 20:47:29 Kazan
|
||||
* remove MCD complete
|
||||
*
|
||||
* Revision 1.20 2004/07/12 16:32:46 Kazan
|
||||
* MCD - define _MCD_CHECK to use memory tracking
|
||||
*
|
||||
* Revision 1.19 2004/07/09 22:05:32 Kazan
|
||||
* fs2netd 1.0 RC5 full support - Rank and Medal updates
|
||||
*
|
||||
* Revision 1.18 2004/07/07 21:00:06 Kazan
|
||||
* FS2NetD: C2S Ping/Pong, C2S Ping/Pong, Global IP Banlist, Global Network Messages
|
||||
*
|
||||
* Revision 1.17 2004/07/06 23:45:34 Kazan
|
||||
* minor multi fix
|
||||
*
|
||||
* Revision 1.16 2004/05/25 00:21:39 wmcoolmon
|
||||
* Updated to use <iostream> instead of <iostream.h>
|
||||
*
|
||||
* Revision 1.15 2004/03/31 05:42:26 Goober5000
|
||||
* got rid of all those nasty warnings from xlocale and so forth; also added comments
|
||||
* for #pragma warning disable to indicate the message being disabled
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 1.14 2004/03/09 17:59:01 Kazan
|
||||
* Disabled multithreaded TCP_Socket in favor of safer single threaded
|
||||
* FS2NetD doesn't kill the game on connection failure now - just gives warning message and effectively dsiables itself until they try to connect again
|
||||
@@ -62,7 +127,7 @@
|
||||
*
|
||||
* Revision 1.3 2003/10/13 05:57:47 Kazan
|
||||
* Removed a bunch of Useless *_printf()s in the rendering pipeline that were just slowing stuff down
|
||||
* Commented out the "warning null vector in vector normalize" crap since we don't give a rats arse
|
||||
* Commented out the "warning null vector in vector normalize" crap
|
||||
* Added "beam no whack" flag for beams - said beams NEVER whack
|
||||
* Some reliability updates in FS2NetD
|
||||
*
|
||||
@@ -70,19 +135,25 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
|
||||
// 4018 = signed/unsigned mismatch
|
||||
// 4663 = new template specification syntax
|
||||
// 4245 = signed/unsigned mismatch in conversion of const value
|
||||
#pragma warning(disable: 4663 4018 4663 4245)
|
||||
// 4711 = function selected for automatic inline expansion
|
||||
#pragma warning(disable: 4663 4018 4663 4245 4711)
|
||||
|
||||
#include "Client.h"
|
||||
#include "protocol.h"
|
||||
#include "TCP_Socket.h"
|
||||
#include <iostream.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
#include "fs2open_pxo/Client.h"
|
||||
#include "fs2open_pxo/protocol.h"
|
||||
#include "fs2open_pxo/TCP_Socket.h"
|
||||
#include "network/multi_log.h"
|
||||
#include "playerman/player.h"
|
||||
#include "ship/ship.h"
|
||||
#include <time.h>
|
||||
#include "network/multi_log.h"
|
||||
#include "io/timer.h"
|
||||
|
||||
|
||||
#define PXO_ADDINT(n) *((int *)cur) = (n); cur += sizeof(int);
|
||||
@@ -98,8 +169,7 @@ int CheckSingleMission(const char* mission, unsigned int crc32, TCP_Socket &Sock
|
||||
// Clear any old dead crap data
|
||||
Socket.IgnorePackets();
|
||||
|
||||
timeout = timeout * CLK_TCK;
|
||||
int starttime = clock();
|
||||
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
|
||||
|
||||
std::string sender = masterserver;
|
||||
|
||||
@@ -113,12 +183,12 @@ int CheckSingleMission(const char* mission, unsigned int crc32, TCP_Socket &Sock
|
||||
|
||||
|
||||
if (Socket.SendData((char *) &checkpack, sizeof(fs2open_file_check_single)) == -1)
|
||||
return NULL;
|
||||
return -1;
|
||||
|
||||
|
||||
fs2open_fcheck_reply c_reply;
|
||||
|
||||
while ((clock() - starttime) <= timeout)
|
||||
while ( timer_get_fixed_seconds() <= end_time )
|
||||
{
|
||||
|
||||
if (Socket.DataReady() && Socket.GetData((char *) &c_reply, sizeof(fs2open_fcheck_reply)) != -1)
|
||||
@@ -148,25 +218,23 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
|
||||
// Clear any old dead crap data
|
||||
Socket.IgnorePackets();
|
||||
|
||||
|
||||
|
||||
timeout = timeout * CLK_TCK;
|
||||
int starttime = clock();
|
||||
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
|
||||
|
||||
|
||||
std::string sender = masterserver;
|
||||
|
||||
|
||||
|
||||
char PacketBuffer[16384]; // 16K should be enough i think..... I HOPE!
|
||||
memset(PacketBuffer,0, 16384);
|
||||
// char *cur = PacketBuffer;
|
||||
|
||||
fs2open_pilot_update *p_update = (fs2open_pilot_update *) PacketBuffer;
|
||||
fs2open_ship_typekill *type_kills = (fs2open_ship_typekill *) (PacketBuffer + (sizeof(fs2open_pilot_update) - sizeof(fs2open_ship_typekill *)));
|
||||
fs2open_ship_typekill *type_kills = (fs2open_ship_typekill *) (PacketBuffer + 204);
|
||||
int *medals = (int*)(PacketBuffer + 204 + (sizeof(fs2open_ship_typekill) * MAX_SHIP_TYPES));
|
||||
|
||||
|
||||
p_update->pid = PCKT_PILOT_UPDATE;
|
||||
p_update->pid = PCKT_PILOT_UPDATE2;
|
||||
p_update->sid = SID;
|
||||
|
||||
strncpy(p_update->name, player_name, 65);
|
||||
@@ -186,29 +254,38 @@ int SendPlayerData(int SID, const char* player_name, const char* user, player *p
|
||||
p_update->SecHits = pl->stats.s_shots_hit;
|
||||
p_update->SecFHits = pl->stats.s_bonehead_hits;
|
||||
p_update->ship_types = MAX_SHIP_TYPES;
|
||||
p_update->num_medals = MAX_MEDALS;
|
||||
p_update->rank = pl->stats.rank;
|
||||
|
||||
for (int i = 0; i < MAX_SHIP_TYPES; i++)
|
||||
int i;
|
||||
for (i = 0; i < MAX_SHIP_TYPES; i++)
|
||||
{
|
||||
|
||||
strncpy(type_kills[i].name, Ship_info[i].name, 32);
|
||||
type_kills[i].kills = pl->stats.kills[i];
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < MAX_MEDALS; i++)
|
||||
{
|
||||
medals[i] = pl->stats.medals[i];
|
||||
}
|
||||
|
||||
int packet_size = 194; // size of all the ints only
|
||||
int packet_size = 204; // size of all the ints only
|
||||
packet_size += sizeof(fs2open_ship_typekill) * MAX_SHIP_TYPES; // add the size of the ship_kills array
|
||||
packet_size += sizeof(int) * MAX_MEDALS; // add the size of the ship_kills array
|
||||
|
||||
// send Packet
|
||||
if (Socket.SendData(PacketBuffer, packet_size) == -1)
|
||||
return NULL;
|
||||
return -1;
|
||||
|
||||
|
||||
fs2open_pilot_updatereply u_reply;
|
||||
|
||||
while ((clock() - starttime) <= timeout)
|
||||
while ( timer_get_fixed_seconds() <= end_time )
|
||||
{
|
||||
|
||||
if (Socket.DataReady() && Socket.GetData((char *) &u_reply, sizeof(fs2open_pilot_updatereply)) != -1)
|
||||
if (Socket.DataReady() && (Socket.GetData((char *) &u_reply, sizeof(fs2open_pilot_updatereply)) != -1))
|
||||
{
|
||||
|
||||
if (u_reply.pid != PCKT_PILOT_UREPLY) // ignore packet
|
||||
@@ -238,10 +315,8 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
|
||||
|
||||
fs2open_get_pilot prq_packet;
|
||||
|
||||
timeout = timeout * CLK_TCK;
|
||||
|
||||
memset((char *) &prq_packet, 0, sizeof(fs2open_get_pilot));
|
||||
prq_packet.pid = PCKT_PILOT_GET;
|
||||
prq_packet.pid = PCKT_PILOT_GET2;
|
||||
prq_packet.sid = SID;
|
||||
strncpy(prq_packet.pilotname, player_name, 64);
|
||||
prq_packet.create = CanCreate;
|
||||
@@ -250,23 +325,23 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
|
||||
|
||||
// send Packet
|
||||
if (Socket.SendData((char *)&prq_packet, sizeof(fs2open_get_pilot)) == -1)
|
||||
return NULL;
|
||||
return -1;
|
||||
|
||||
char PacketBuffer[16384]; // 16K should be enough i think..... I HOPE!
|
||||
fs2open_pilot_reply *p_reply = (fs2open_pilot_reply *) PacketBuffer;
|
||||
memset(PacketBuffer, 0, 16384);
|
||||
fs2open_ship_typekill *type_kills = (fs2open_ship_typekill *) (PacketBuffer + sizeof(fs2open_pilot_reply) - sizeof(fs2open_ship_typekill *));
|
||||
fs2open_ship_typekill *type_kills = (fs2open_ship_typekill *) (PacketBuffer + 72);
|
||||
int *medals = NULL; //(int*)(PacketBuffer+72+(sizeof(fs2open_ship_typekill) * pilotrep.ship_types));
|
||||
|
||||
int CheckSize = sizeof(fs2open_pilot_reply) - sizeof(fs2open_ship_typekill *) - 2; //2 for the weird stinking msvc stuff
|
||||
int CheckSize = 72, i;
|
||||
int recvsize = 0, rs2;
|
||||
Sleep(2); // give them a second
|
||||
int starttime = clock();
|
||||
|
||||
while ((clock() - starttime) <= timeout)
|
||||
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
|
||||
|
||||
while ( timer_get_fixed_seconds() <= end_time )
|
||||
{
|
||||
|
||||
|
||||
if (Socket.DataReady() && (recvsize = Socket.GetData((char *) &PacketBuffer, 16384)) != -1)
|
||||
if (Socket.DataReady() && ((recvsize = Socket.GetData((char *) &PacketBuffer, 16384)) != -1))
|
||||
{
|
||||
|
||||
if (p_reply->pid != PCKT_PILOT_REPLY) // ignore packet
|
||||
@@ -274,10 +349,13 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
|
||||
continue;
|
||||
}
|
||||
|
||||
CheckSize += sizeof(fs2open_ship_typekill) * p_reply->ship_types;
|
||||
if (p_reply->replytype == 0)
|
||||
CheckSize += (sizeof(fs2open_ship_typekill) * p_reply->ship_types) + (sizeof(int) * p_reply->num_medals);
|
||||
else
|
||||
CheckSize = 8;
|
||||
|
||||
ml_printf("Precompletion Pilot Update: CheckSize = %d, recvsize = %d", CheckSize, recvsize);
|
||||
while (CheckSize - recvsize > 0 && (clock() - starttime) <= timeout)
|
||||
while (CheckSize - recvsize > 0 && timer_get_fixed_seconds() <= end_time)
|
||||
{
|
||||
if (Socket.DataReady())
|
||||
{
|
||||
@@ -289,13 +367,14 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
|
||||
ml_printf("PostCompletion Tables Get: CheckSize = %u, recvsize = %u", CheckSize, recvsize);
|
||||
|
||||
// if we timed out
|
||||
if ((clock() - starttime) >= timeout)
|
||||
if ( timer_get_fixed_seconds() >= end_time )
|
||||
{
|
||||
ml_printf("Pilot Update completetion timed out");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
medals = (int*)(PacketBuffer+72+(sizeof(fs2open_ship_typekill) * p_reply->ship_types));
|
||||
|
||||
|
||||
if (p_reply->replytype > 1)
|
||||
@@ -315,6 +394,7 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
|
||||
pl->stats.s_shots_fired = p_reply->SecShots;
|
||||
pl->stats.s_shots_hit = p_reply->SecHits;
|
||||
pl->stats.s_bonehead_hits = p_reply->SecFHits;
|
||||
pl->stats.rank = p_reply->rank;
|
||||
|
||||
|
||||
if (p_reply->ship_types == 0)
|
||||
@@ -322,12 +402,22 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
|
||||
else
|
||||
{
|
||||
// i should really assert p_reply->ship_types == MAX_SHIP_TYPES
|
||||
for (int i = 0; i < MAX_SHIP_TYPES && p_reply->ship_types; i++)
|
||||
for (i = 0; i < MAX_SHIP_TYPES && p_reply->ship_types; i++)
|
||||
{
|
||||
pl->stats.kills[i] = type_kills[i].kills;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (p_reply->num_medals == 0)
|
||||
memset(pl->stats.medals, 0, sizeof(int) * MAX_MEDALS);
|
||||
else
|
||||
{
|
||||
// i should really assert p_reply->ship_types == MAX_SHIP_TYPES
|
||||
for (i = 0; i < MAX_MEDALS && p_reply->num_medals; i++)
|
||||
{
|
||||
pl->stats.medals[i] = medals[i];
|
||||
}
|
||||
}
|
||||
|
||||
// ignored on load... fs2 doesn't need this
|
||||
// type_kills[index].name[65] = Ship_info[index].name[32]
|
||||
@@ -342,7 +432,85 @@ int GetPlayerData(int SID, const char* player_name, player *pl, const char* mast
|
||||
|
||||
return -1;
|
||||
}
|
||||
//**************************************************************************************************************************************************
|
||||
|
||||
|
||||
|
||||
fs2open_banmask* GetBanList(int &numBanMasks, TCP_Socket &Socket, int timeout)
|
||||
{
|
||||
// Clear any old dead crap data
|
||||
Socket.IgnorePackets();
|
||||
|
||||
fs2open_banlist_request br_packet;
|
||||
br_packet.pid = PCKT_BANLIST_RQST;
|
||||
br_packet.reserved = 0;
|
||||
|
||||
|
||||
//std::string sender = masterserver;
|
||||
|
||||
// send Packet
|
||||
if (Socket.SendData((char *)&br_packet, sizeof(fs2open_banlist_request)) == -1)
|
||||
return NULL;
|
||||
|
||||
char PacketBuffer[16384]; // 16K should be enough i think..... I HOPE!
|
||||
fs2open_banlist_reply *banreply_ptr = (fs2open_banlist_reply *) PacketBuffer;
|
||||
|
||||
fs2open_banmask *masks = NULL;
|
||||
numBanMasks = 0;
|
||||
Sleep(1); //lets give them a second
|
||||
|
||||
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
|
||||
|
||||
int recvsize = 0, rs2;
|
||||
int CheckSize = sizeof(int) * 2;
|
||||
|
||||
|
||||
while ( timer_get_fixed_seconds() <= end_time )
|
||||
{
|
||||
|
||||
if (Socket.DataReady() && ((recvsize = Socket.GetData(PacketBuffer, 16384)) != -1))
|
||||
{
|
||||
if (banreply_ptr->pid != PCKT_BANLIST_RPLY)
|
||||
{
|
||||
continue; // skip and ignore this packet
|
||||
}
|
||||
|
||||
|
||||
CheckSize += banreply_ptr->num_ban_masks * sizeof(fs2open_banmask);
|
||||
|
||||
ml_printf("Precompletion Table Get: CheckSize = %d, recvsize = %d", CheckSize, recvsize);
|
||||
while (CheckSize - recvsize > 0 && timer_get_fixed_seconds() <= end_time)
|
||||
{
|
||||
if (Socket.DataReady())
|
||||
{
|
||||
rs2 = Socket.GetData(PacketBuffer+recvsize, 16384-recvsize);
|
||||
ml_printf("Banlist Completetion: Got Additional %u bytes", rs2);
|
||||
recvsize += rs2;
|
||||
}
|
||||
}
|
||||
ml_printf("PostCompletion Banlist Get: CheckSize = %u, recvsize = %u", CheckSize, recvsize);
|
||||
|
||||
if ( timer_get_fixed_seconds() >= end_time )
|
||||
{
|
||||
ml_printf("Banlist Transfer completetion timed out");
|
||||
break;
|
||||
}
|
||||
|
||||
masks = new fs2open_banmask[banreply_ptr->num_ban_masks];
|
||||
memcpy(masks, PacketBuffer + 8, sizeof(fs2open_banmask) * banreply_ptr->num_ban_masks); // packet buffer will be two ints then the array;
|
||||
numBanMasks = banreply_ptr->num_ban_masks;
|
||||
|
||||
|
||||
return masks;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
//**************************************************************************************************************************************************
|
||||
|
||||
|
||||
@@ -355,8 +523,6 @@ file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket
|
||||
fs2open_file_check fc_packet;
|
||||
fc_packet.pid = PCKT_TABLES_RQST;
|
||||
|
||||
timeout = timeout * CLK_TCK;
|
||||
|
||||
std::string sender = masterserver;
|
||||
|
||||
// send Packet
|
||||
@@ -370,15 +536,14 @@ file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket
|
||||
numTables = 0;
|
||||
Sleep(2); //lets give them a second
|
||||
|
||||
int starttime = clock();
|
||||
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
|
||||
|
||||
int recvsize = 0, rs2;
|
||||
int CheckSize = sizeof(int) * 2;
|
||||
|
||||
while ((clock() - starttime) <= timeout)
|
||||
while ( timer_get_fixed_seconds() <= end_time )
|
||||
{
|
||||
|
||||
if (Socket.DataReady() && (recvsize = Socket.GetData(PacketBuffer, 16384)) != -1)
|
||||
if (Socket.DataReady() && ((recvsize = Socket.GetData(PacketBuffer, 16384)) != -1))
|
||||
{
|
||||
if (misreply_ptr->pid != PCKT_TABLES_REPLY)
|
||||
{
|
||||
@@ -389,7 +554,7 @@ file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket
|
||||
CheckSize += misreply_ptr->num_files * sizeof(file_record);
|
||||
|
||||
ml_printf("Precompletion Table Get: CheckSize = %d, recvsize = %d", CheckSize, recvsize);
|
||||
while (CheckSize - recvsize > 0 && (clock() - starttime) <= timeout)
|
||||
while (CheckSize - recvsize > 0 && timer_get_fixed_seconds() <= end_time)
|
||||
{
|
||||
if (Socket.DataReady())
|
||||
{
|
||||
@@ -400,7 +565,7 @@ file_record* GetTablesList(int &numTables, const char *masterserver, TCP_Socket
|
||||
}
|
||||
ml_printf("PostCompletion Tables Get: CheckSize = %u, recvsize = %u", CheckSize, recvsize);
|
||||
|
||||
if ((clock() - starttime) >= timeout)
|
||||
if ( timer_get_fixed_seconds() >= end_time )
|
||||
{
|
||||
ml_printf("Tables Transfer completetion timed out");
|
||||
break;
|
||||
@@ -444,7 +609,6 @@ file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Soc
|
||||
fs2open_file_check fc_packet;
|
||||
fc_packet.pid = PCKT_MISSIONS_RQST;
|
||||
|
||||
timeout = timeout * CLK_TCK;
|
||||
|
||||
std::string sender = masterserver;
|
||||
|
||||
@@ -461,15 +625,16 @@ file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Soc
|
||||
numMissions = 0;
|
||||
//int depth = 0;
|
||||
Sleep(2); // lets give it a second
|
||||
int starttime = clock();
|
||||
|
||||
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
|
||||
|
||||
int recvsize = 0, rs2;
|
||||
int CheckSize = sizeof(int) * 2;
|
||||
|
||||
while ((clock() - starttime) <= timeout)
|
||||
while ( timer_get_fixed_seconds() <= end_time )
|
||||
{
|
||||
|
||||
if (Socket.DataReady() && (recvsize = Socket.GetData(PacketBuffer, 16384)) != -1)
|
||||
if (Socket.DataReady() && ((recvsize = Socket.GetData(PacketBuffer, 16384)) != -1))
|
||||
{
|
||||
|
||||
if (misreply_ptr->pid != PCKT_MISSIONS_REPLY)
|
||||
@@ -480,7 +645,7 @@ file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Soc
|
||||
CheckSize += misreply_ptr->num_files * sizeof(file_record);
|
||||
|
||||
ml_printf("Precompletion Missions Get: CheckSize = %d, recvsize = %d", CheckSize, recvsize);
|
||||
while (CheckSize - recvsize > 0 && (clock() - starttime) <= timeout)
|
||||
while (CheckSize - recvsize > 0 && timer_get_fixed_seconds() <= end_time)
|
||||
{
|
||||
if (Socket.DataReady())
|
||||
{
|
||||
@@ -491,7 +656,7 @@ file_record* GetMissionsList(int &numMissions, const char *masterserver, TCP_Soc
|
||||
}
|
||||
ml_printf("PostCompletion Missions Get: CheckSize = %u, recvsize = %u", CheckSize, recvsize);
|
||||
|
||||
if ((clock() - starttime) >= timeout)
|
||||
if ( timer_get_fixed_seconds() >= end_time )
|
||||
{
|
||||
ml_printf("Missions Transfer completetion timed out");
|
||||
break;
|
||||
@@ -531,9 +696,6 @@ int Fs2OpenPXO_Login(const char* username, const char* password, TCP_Socket &Soc
|
||||
// Clear any old dead crap data
|
||||
Socket.IgnorePackets();
|
||||
|
||||
timeout = timeout * CLK_TCK;
|
||||
int starttime = clock();
|
||||
|
||||
std::string sender = masterserver;
|
||||
|
||||
// create and send login packet
|
||||
@@ -546,13 +708,16 @@ int Fs2OpenPXO_Login(const char* username, const char* password, TCP_Socket &Soc
|
||||
|
||||
if (Socket.SendData((char *) &loginpckt, sizeof(loginpckt)) == -1)
|
||||
{
|
||||
cout << "Error Sending Packet" << endl;
|
||||
std::cout << "Error Sending Packet" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
|
||||
|
||||
// await reply
|
||||
fs2open_pxo_lreply loginreply;
|
||||
while ((clock() - starttime) <= timeout)
|
||||
|
||||
while ( timer_get_fixed_seconds() <= end_time )
|
||||
{
|
||||
|
||||
if (Socket.DataReady() && Socket.GetData((char *)&loginreply, sizeof(fs2open_pxo_lreply)) != -1)
|
||||
@@ -563,7 +728,9 @@ int Fs2OpenPXO_Login(const char* username, const char* password, TCP_Socket &Soc
|
||||
}
|
||||
|
||||
if (loginreply.login_status == false)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return loginreply.sid;
|
||||
}
|
||||
@@ -613,10 +780,7 @@ net_server* GetServerList(const char* masterserver, int &numServersFound, TCP_So
|
||||
|
||||
numServersFound = 0;
|
||||
|
||||
|
||||
|
||||
timeout = timeout * CLK_TCK;
|
||||
int starttime = clock();
|
||||
|
||||
// ---------- Prepair and send request packet ------------
|
||||
serverlist_request_packet rpack;
|
||||
rpack.pid = PCKT_SLIST_REQUEST;
|
||||
@@ -630,28 +794,32 @@ net_server* GetServerList(const char* masterserver, int &numServersFound, TCP_So
|
||||
// ---------- Receive Reply ------------
|
||||
|
||||
serverlist_reply_packet NewServer;
|
||||
net_server *retlist, templist[MAX_SERVERS];
|
||||
net_server *retlist = NULL, templist[MAX_SERVERS];
|
||||
|
||||
while ((clock() - starttime) <= timeout)
|
||||
fix end_time = timer_get_fixed_seconds() + (timeout * F1_0);
|
||||
|
||||
while ( timer_get_fixed_seconds() <= end_time )
|
||||
{
|
||||
if (Socket.DataReady() && Socket.GetData((char *)&NewServer, sizeof(serverlist_reply_packet)) != -1)
|
||||
if (Socket.DataReady() && Socket.GetData((char *)&NewServer, sizeof(serverlist_reply_packet)) == sizeof(serverlist_reply_packet))
|
||||
{
|
||||
|
||||
if (!strcmp(NewServer.name, "TERM") && NewServer.flags == 0 && NewServer.players == 0)
|
||||
{
|
||||
starttime = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy((char *)&templist[numServersFound], (char *)&NewServer, sizeof(serverlist_reply_packet));
|
||||
|
||||
|
||||
numServersFound++;
|
||||
}
|
||||
|
||||
|
||||
if (numServersFound >= MAX_SERVERS) {
|
||||
numServersFound = MAX_SERVERS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!numServersFound)
|
||||
return NULL;
|
||||
|
||||
// ---------- Prepair and return list ------------
|
||||
retlist = new net_server[numServersFound];
|
||||
@@ -699,4 +867,19 @@ int GetPingReply(TCP_Socket &Socket)
|
||||
Socket.GetData((char *)&rping, sizeof(fs2open_pingreply));
|
||||
|
||||
return int( float(clock() - rping.time)/2.0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************************************************************************************
|
||||
|
||||
void SendPingReply(TCP_Socket &Socket, int tstamp)
|
||||
{
|
||||
|
||||
fs2open_pingreply rping;
|
||||
rping.pid = PCKT_PINGREPLY;
|
||||
rping.time = tstamp;
|
||||
|
||||
Socket.SendData((char*)&rping, sizeof(rping));
|
||||
}
|
||||
|
||||
#endif // !NO_NETWORK
|
||||
Loaded 100 of 718 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user