mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 17:48:46 -10:00
Compare commits
2188
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
4afe186dc4 | ||
|
|
87c5d993dc | ||
|
|
a0666e9591 | ||
|
|
593285a975 | ||
|
|
7096ffbc98 | ||
|
|
490678193a | ||
|
|
3d3c197dc0 | ||
|
|
7ac03c7835 | ||
|
|
887239e1d4 | ||
|
|
ea415cce97 | ||
|
|
409e068104 | ||
|
|
b4ec7e4e34 | ||
|
|
7ad5b133ff | ||
|
|
01bc1043e4 | ||
|
|
dad23b95db | ||
|
|
23a79af4dc | ||
|
|
39bbccebfc | ||
|
|
b32d1c7fa9 | ||
|
|
b318f01819 | ||
|
|
7e8ca9a005 | ||
|
|
6f657470fe | ||
|
|
dfc59ef087 | ||
|
|
b09c3b3491 | ||
|
|
c63f80dbaf | ||
|
|
66556fe514 | ||
|
|
d4d41d8eff | ||
|
|
12d6469ee7 | ||
|
|
d0f604c81a | ||
|
|
f5f347109c | ||
|
|
4195c0e9fa | ||
|
|
f87fbdb857 | ||
|
|
d97912ce37 | ||
|
|
1b725c3ac4 | ||
|
|
ab23820319 | ||
|
|
8c7614ac34 | ||
|
|
63b9d44968 | ||
|
|
8887c8a07e | ||
|
|
8367ed5943 | ||
|
|
6ceeeb7239 | ||
|
|
1e5fe42652 | ||
|
|
b9802a0d6e | ||
|
|
343423adc2 | ||
|
|
961cfbe12e | ||
|
|
1207801f77 | ||
|
|
fd816a1a5b | ||
|
|
e086613047 | ||
|
|
c121c18b4f | ||
|
|
5e0b6a687f | ||
|
|
2ccaf8f927 | ||
|
|
c94d4bea59 | ||
|
|
7528ef0fef | ||
|
|
901e565798 | ||
|
|
7323c9e0da | ||
|
|
054bcf6dec | ||
|
|
79a01657a7 | ||
|
|
ff5ee510a3 | ||
|
|
b4f3e252d0 | ||
|
|
c10a141861 | ||
|
|
a83e3a6223 | ||
|
|
76d820d0f4 | ||
|
|
b0ece8eb3a | ||
|
|
e5f836df4b | ||
|
|
e4256a1cd3 | ||
|
|
06e8db1bf8 | ||
|
|
c84fbacb8b | ||
|
|
cba0190e05 | ||
|
|
39e9479ac8 | ||
|
|
f8f1ef779e | ||
|
|
9fccd4c2d0 | ||
|
|
8dc2c082c3 | ||
|
|
7ec25aa692 | ||
|
|
3835d0758b | ||
|
|
e4ab7f2254 | ||
|
|
abbd2a260e | ||
|
|
892cf38736 | ||
|
|
cc9afc7d3e | ||
|
|
f210455827 | ||
|
|
55f84acd98 | ||
|
|
b6f02b52cb | ||
|
|
b21ab3282d | ||
|
|
1f3318524b | ||
|
|
e2e5a24926 | ||
|
|
1120cdaa03 | ||
|
|
25c7c7c8af | ||
|
|
07a01628a0 | ||
|
|
edae245b0e | ||
|
|
fdde5a6713 | ||
|
|
28508f0be4 | ||
|
|
1502269102 | ||
|
|
d496969846 | ||
|
|
e7ee4f4ef1 | ||
|
|
7f25fcf05f | ||
|
|
4551cda108 | ||
|
|
105e95a991 | ||
|
|
2257b4efde | ||
|
|
d53c6289dc | ||
|
|
d5bc0051fb | ||
|
|
4477777cd4 | ||
|
|
d81cfcbbba | ||
|
|
42e936b6b1 | ||
|
|
f6007413de | ||
|
|
12b3ffb6b9 | ||
|
|
034f987d38 | ||
|
|
d3ca761e30 | ||
|
|
f8dcf11f99 | ||
|
|
a780021f7b | ||
|
|
f43da62c3e | ||
|
|
6487bd1ff4 | ||
|
|
bb870a6926 | ||
|
|
6216fb09da | ||
|
|
a1751c30ab | ||
|
|
98e7e86697 | ||
|
|
c488360abc | ||
|
|
c38d9601c8 | ||
|
|
aa60ef5bcc | ||
|
|
e611d3d74e | ||
|
|
24a9694494 | ||
|
|
55671189f0 | ||
|
|
8e595a903c | ||
|
|
2e49d55faf | ||
|
|
08d8e0799a | ||
|
|
5d54009c21 | ||
|
|
fcc33b856f | ||
|
|
b8d48fac23 | ||
|
|
4c27f96902 | ||
|
|
9fde027411 | ||
|
|
2af460314d | ||
|
|
a639da2973 | ||
|
|
9cbbb6fd03 | ||
|
|
20a083c859 | ||
|
|
685880a7b6 | ||
|
|
9010d21b32 | ||
|
|
841774f69f | ||
|
|
04e34810e0 | ||
|
|
dcfc77364e | ||
|
|
be2d15fc4f | ||
|
|
014e261af1 | ||
|
|
f343c2f7b1 | ||
|
|
30ae2da9cd | ||
|
|
9236bd6d7c | ||
|
|
85f05019b5 | ||
|
|
6509badc36 | ||
|
|
21856a78e5 | ||
|
|
6ee175e65d | ||
|
|
2f067ae8aa | ||
|
|
fcc38162c5 | ||
|
|
771e6b2faa | ||
|
|
28cc2957c8 | ||
|
|
1e99847291 | ||
|
|
2edd420943 | ||
|
|
852ec76549 | ||
|
|
7caf442717 | ||
|
|
e1ca009d9a | ||
|
|
5b591c2c4c | ||
|
|
55c7d0e0fc | ||
|
|
6a2cadb08f | ||
|
|
0ccb8a19dc | ||
|
|
7d87db1939 | ||
|
|
e94733df9c | ||
|
|
a69f3bd271 | ||
|
|
d7905cd06a | ||
|
|
244b9718d5 | ||
|
|
020379cf40 | ||
|
|
183587f8b4 | ||
|
|
a963f3ccc1 | ||
|
|
e540947704 | ||
|
|
b94f8cddde | ||
|
|
6fd1ef440b | ||
|
|
cd2b9d9871 | ||
|
|
eb1b936ff1 | ||
|
|
8bf7c4076b | ||
|
|
9a76ae8d12 | ||
|
|
a9dc8db3bb | ||
|
|
b99a6b6af2 | ||
|
|
397699ec31 | ||
|
|
3529db4d37 | ||
|
|
694d089fe0 | ||
|
|
de560ceb29 | ||
|
|
73c417bf70 | ||
|
|
dfc06acfd3 | ||
|
|
1b0a949dc5 | ||
|
|
4e7667842b | ||
|
|
5129749cb8 | ||
|
|
1fe6fa8b06 | ||
|
|
7034e99aa5 | ||
|
|
47e55fe686 | ||
|
|
668ddde68b | ||
|
|
ea259b8961 | ||
|
|
3428289778 | ||
|
|
12c9238f62 | ||
|
|
360060f59d | ||
|
|
720b16befb | ||
|
|
def739c279 | ||
|
|
0e9af797e5 | ||
|
|
17665a6333 | ||
|
|
58b82fefd8 | ||
|
|
66cb87e18f | ||
|
|
564fb3fd19 | ||
|
|
89fe89775c | ||
|
|
e112deb37a | ||
|
|
a6189c4fdd | ||
|
|
ff7dca2d05 | ||
|
|
d83d4098de | ||
|
|
3c2e1de05e | ||
|
|
492597e3b2 | ||
|
|
9078d2aea6 | ||
|
|
c74f634e79 | ||
|
|
72f0a923e0 | ||
|
|
23be3b5605 | ||
|
|
49491fac75 | ||
|
|
8ebf284993 | ||
|
|
0a072d7403 | ||
|
|
e862231feb | ||
|
|
f7df30b549 | ||
|
|
3f87bea143 | ||
|
|
e1dce56a56 | ||
|
|
9ae52aa90a | ||
|
|
2523a62878 | ||
|
|
1762e4a6be | ||
|
|
e691cbc995 | ||
|
|
f98f7e12be | ||
|
|
7034b6a0f0 | ||
|
|
d240e24ef1 | ||
|
|
8f497bfac7 | ||
|
|
23601fda0d | ||
|
|
278eedf7ad | ||
|
|
efe43d3466 | ||
|
|
e19577e35c | ||
|
|
42568915bd | ||
|
|
6ca2f86255 | ||
|
|
32b0a71369 | ||
|
|
2cf3e96a6b | ||
|
|
cc187b758d | ||
|
|
ea11ea8a63 | ||
|
|
33212b6499 | ||
|
|
ef1880b03a | ||
|
|
077d4b2a54 | ||
|
|
07b00e2fae | ||
|
|
018159b822 | ||
|
|
7f20e9109f | ||
|
|
2cb5a44f3e | ||
|
|
450ac81a1e | ||
|
|
dd840fe227 | ||
|
|
57772da95b | ||
|
|
e672918122 | ||
|
|
6b00a67df0 | ||
|
|
8e68228c86 | ||
|
|
0cae377b72 | ||
|
|
d343e5b73a | ||
|
|
72cb0142b2 | ||
|
|
ffdef38781 | ||
|
|
0578517f3a | ||
|
|
f994cdac45 | ||
|
|
1f16f9dc23 | ||
|
|
dbaf87c202 | ||
|
|
391c18e9e7 | ||
|
|
026e23d8ed | ||
|
|
8a579733c0 | ||
|
|
cfc99c4f23 | ||
|
|
dac33aeb71 | ||
|
|
29af6aefbc | ||
|
|
99e6883251 | ||
|
|
2513b23ad9 | ||
|
|
d64d8ce6e0 | ||
|
|
2f994399e9 | ||
|
|
ad100d79dc | ||
|
|
c11ed4873b | ||
|
|
bbc8d83f37 | ||
|
|
9e0128f705 | ||
|
|
c90c94b39f | ||
|
|
9fc627aee5 | ||
|
|
edbc336888 | ||
|
|
70ed9547a7 | ||
|
|
70ae616b0d | ||
|
|
5801e69441 | ||
|
|
d77dccf068 | ||
|
|
c157da28f6 | ||
|
|
a09b61d39e | ||
|
|
ecfd1a015f | ||
|
|
046e438380 | ||
|
|
0fd9bdff5e | ||
|
|
01e93d672c | ||
|
|
cd417c2158 | ||
|
|
2a522859ad | ||
|
|
1e6803a7fd | ||
|
|
1cf142d5d7 | ||
|
|
f1c749650c | ||
|
|
4356a59467 | ||
|
|
d3374eaabf | ||
|
|
3ce9785fde | ||
|
|
4c6e954a04 | ||
|
|
84cffa91f2 | ||
|
|
59bfbd24b1 | ||
|
|
cf61ab2454 | ||
|
|
9cb8408105 | ||
|
|
82524891f5 | ||
|
|
3b43f42ac8 | ||
|
|
aa3fe0ae83 | ||
|
|
90adfed3f4 | ||
|
|
694cab8b52 | ||
|
|
28d7008b91 | ||
|
|
baad5ab1a1 | ||
|
|
f0a1351b3d | ||
|
|
ea3b09b621 | ||
|
|
0cc2b10c45 | ||
|
|
fc0d71bd72 | ||
|
|
76dd81e73b | ||
|
|
eb1e903fbb | ||
|
|
22f7acf0fb | ||
|
|
9ccd7a9006 | ||
|
|
731f460f7d | ||
|
|
2851362007 | ||
|
|
7fe84d4e7c | ||
|
|
a5729efca3 | ||
|
|
38aa953754 | ||
|
|
ad224416de | ||
|
|
c2e8ed3074 | ||
|
|
f4821c63f2 | ||
|
|
4c0f6ab31f | ||
|
|
bbe7d70bb1 | ||
|
|
112f2cb5c8 | ||
|
|
f6bdec81fe | ||
|
|
6e93c0772a | ||
|
|
eeb0bcc3c6 | ||
|
|
5132c845b0 | ||
|
|
ea32ed86c9 | ||
|
|
2488f81b45 | ||
|
|
c40b01e40e | ||
|
|
9a4d8e46ef | ||
|
|
c9c0b38de5 | ||
|
|
591c5baca0 | ||
|
|
c9c5bdd7bb | ||
|
|
8ab51d480c | ||
|
|
cae9cec74b | ||
|
|
16a51d7bf8 | ||
|
|
a338355f78 | ||
|
|
84cec97f57 | ||
|
|
79f0e02ec2 | ||
|
|
08dd57a3f9 | ||
|
|
e30a7913b7 | ||
|
|
4d337c3fa7 | ||
|
|
5895ef7a46 | ||
|
|
9e870cd2d1 | ||
|
|
f51b8ec8bb | ||
|
|
773556dd2d | ||
|
|
ae39e8614f | ||
|
|
4ffeb7d3db | ||
|
|
f58c06b028 | ||
|
|
d865f3520c | ||
|
|
3c19786ae3 | ||
|
|
25939ab572 | ||
|
|
a5fcf64a5f | ||
|
|
562f5e7f6a | ||
|
|
3106f14f92 | ||
|
|
436276a812 | ||
|
|
1a2be91e2a | ||
|
|
0b87224e39 | ||
|
|
eff6a6efc4 | ||
|
|
edd5287f84 | ||
|
|
71f159840b | ||
|
|
854041749b | ||
|
|
a4a77744d6 | ||
|
|
dac335f3dd | ||
|
|
275ba09a3b | ||
|
|
40ab7fc0f3 | ||
|
|
3b16380936 | ||
|
|
67e18e30a7 | ||
|
|
293e984d60 | ||
|
|
35bf641cb7 | ||
|
|
c86461fd22 | ||
|
|
498edeb86e | ||
|
|
e6c7719bf4 | ||
|
|
e907a052e5 | ||
|
|
6f089c21c5 | ||
|
|
3d8ad87da9 | ||
|
|
92a0ed3c6d | ||
|
|
988b86238f | ||
|
|
f2c019adc3 | ||
|
|
bda256f095 | ||
|
|
77e48b4849 | ||
|
|
0ea85483dc | ||
|
|
54a034da9a | ||
|
|
84d249db18 | ||
|
|
5a1b5233b8 | ||
|
|
3a88ee37ed | ||
|
|
67464a2ad4 | ||
|
|
e1775947ec | ||
|
|
f18771b309 | ||
|
|
1716850f80 | ||
|
|
9ff5945744 | ||
|
|
13d91d590b | ||
|
|
4611c36631 | ||
|
|
0d5eb222a9 | ||
|
|
3508e8d309 | ||
|
|
cafe8965c1 | ||
|
|
5604bced59 | ||
|
|
08e2943edb | ||
|
|
656623be9c | ||
|
|
3ccc1da630 | ||
|
|
01c12c8010 | ||
|
|
dbd2ee4f3c | ||
|
|
84a5ae3268 | ||
|
|
949d8446f1 | ||
|
|
f7e17e90a7 | ||
|
|
f0078cc8fc | ||
|
|
833164823d | ||
|
|
77deede2de | ||
|
|
085a0aa0d4 | ||
|
|
3edcb0a519 | ||
|
|
c6ba1645a1 | ||
|
|
e1d2dfcf9e | ||
|
|
dccaa30202 | ||
|
|
e205ab47a2 | ||
|
|
a2e351779d | ||
|
|
f85ca67666 | ||
|
|
e1261c0340 | ||
|
|
89e4dc4fd5 | ||
|
|
fa480451d1 | ||
|
|
a42cf30bdb | ||
|
|
225bc96739 | ||
|
|
e15beaa7f9 | ||
|
|
fcc1ea98c4 | ||
|
|
afb0e066b0 | ||
|
|
7b5548642a | ||
|
|
5f1898c503 | ||
|
|
7854fb293f | ||
|
|
1e04df322c | ||
|
|
fb12c1df6e | ||
|
|
c4fcafccc5 | ||
|
|
cfbc2ebb46 | ||
|
|
4a85d415e5 | ||
|
|
94c2fab5b0 | ||
|
|
d6b179d3b5 | ||
|
|
32f7fd2c11 | ||
|
|
5a858562cc | ||
|
|
eb800ebbbc | ||
|
|
f3bd46dab2 | ||
|
|
b11a8c02a0 | ||
|
|
7564ecb19f | ||
|
|
65fd9ef338 | ||
|
|
aab49a95db | ||
|
|
f0110fab45 | ||
|
|
3c053feb30 | ||
|
|
68fde7a8ce | ||
|
|
abf067f708 | ||
|
|
0151279a55 | ||
|
|
633c391b4d | ||
|
|
fee9ff59ef | ||
|
|
290da64ffe | ||
|
|
46479ac3a0 | ||
|
|
016e525f62 | ||
|
|
58cb8f4a36 | ||
|
|
240c74da4e | ||
|
|
897d3f8ad5 | ||
|
|
3916653149 | ||
|
|
0baf2f7bc9 | ||
|
|
ef83ecbc05 | ||
|
|
53834ee415 | ||
|
|
7dcc40de8a | ||
|
|
edfd3fdc85 | ||
|
|
39e9cddb5f | ||
|
|
450ea5c63e | ||
|
|
36668ce6a1 | ||
|
|
8cacc9b1a0 | ||
|
|
03dd93b79d | ||
|
|
ee79809edc | ||
|
|
257675bb93 | ||
|
|
d9a01620f6 | ||
|
|
3b15d779d6 | ||
|
|
19796f7538 | ||
|
|
e594563d00 | ||
|
|
15d394edbf | ||
|
|
b07476fc96 | ||
|
|
d3e4c5c30b | ||
|
|
839be403b1 | ||
|
|
5c2c0ab09f | ||
|
|
81f8a9e375 | ||
|
|
4386cab9bc | ||
|
|
00773de340 | ||
|
|
450bd1e213 | ||
|
|
2092c2705f | ||
|
|
e592c64d8f | ||
|
|
0f275acc12 | ||
|
|
af1da198b3 | ||
|
|
e75e4b5640 | ||
|
|
9ed49694bf | ||
|
|
b0088c67ba | ||
|
|
3505a530d0 | ||
|
|
ec87a1f3ad | ||
|
|
0c9c758dbd | ||
|
|
17a9178c8b | ||
|
|
7628e19f26 | ||
|
|
97b506ca15 | ||
|
|
7c1c973917 | ||
|
|
e7340e703b | ||
|
|
1fa5e2bf54 | ||
|
|
dc12e5dd1e | ||
|
|
2c62498b62 | ||
|
|
2eb193101a | ||
|
|
11d8d11b04 | ||
|
|
37b0bd28ce | ||
|
|
13cccac317 | ||
|
|
4fce3b9610 | ||
|
|
fc22d35695 | ||
|
|
091c8b4d7e | ||
|
|
8d4512a612 | ||
|
|
c80bab1fcc | ||
|
|
ca0683ecfa | ||
|
|
31cfd8011f | ||
|
|
371f2e3869 | ||
|
|
cd48667a38 | ||
|
|
45d02246ee | ||
|
|
25e339a4d6 | ||
|
|
155f0f1cce | ||
|
|
807ee34c9d | ||
|
|
123515a33d | ||
|
|
cc741f5029 | ||
|
|
0fc5f831fc | ||
|
|
ecf181a2c7 | ||
|
|
000257bd8e | ||
|
|
30cbbfedf3 | ||
|
|
47cd793262 | ||
|
|
ed6be03aa0 | ||
|
|
afd83a21fb | ||
|
|
4a030dfb73 | ||
|
|
e4b6bc70bc | ||
|
|
fcaa985c2d | ||
|
|
3574628259 | ||
|
|
be71b9f6b5 | ||
|
|
5f5fe2b8cc | ||
|
|
5ff5467673 | ||
|
|
809b0155df | ||
|
|
1e6670c1b7 | ||
|
|
bda9f63f59 | ||
|
|
ea966211b5 | ||
|
|
1771fd2d3b | ||
|
|
7dd22631a9 | ||
|
|
7146c9f90c | ||
|
|
63a90da345 | ||
|
|
29a0e77753 | ||
|
|
1760554305 | ||
|
|
3f391d36b2 | ||
|
|
fee9efe1db | ||
|
|
c8a2551a6e | ||
|
|
9e5a3781b7 | ||
|
|
fa960dc625 | ||
|
|
364767a0b4 | ||
|
|
abdd8a6a79 | ||
|
|
15be002888 | ||
|
|
af9f703302 | ||
|
|
944981b835 | ||
|
|
f7760d69c0 | ||
|
|
b63c14fcb7 | ||
|
|
7ec2608d58 | ||
|
|
881b31f7fa | ||
|
|
6be53b57e1 | ||
|
|
13338a1c76 | ||
|
|
f843302d16 | ||
|
|
f4fe757d5d | ||
|
|
1a410e1f09 | ||
|
|
79fff22d2e | ||
|
|
e6536f612a | ||
|
|
031c50768a | ||
|
|
a805b8e293 | ||
|
|
7145251058 | ||
|
|
5a5e364bee | ||
|
|
6351a06b68 | ||
|
|
4dd27db603 | ||
|
|
d01ed806b9 | ||
|
|
2b6c194af7 | ||
|
|
87409846f0 | ||
|
|
88dca1dbea | ||
|
|
4bf29edec3 | ||
|
|
d1abacf7ae | ||
|
|
9d6126086c | ||
|
|
4c74af0b4a | ||
|
|
fb738a9319 | ||
|
|
c470ecc598 | ||
|
|
47302dd5ad | ||
|
|
431b588cef | ||
|
|
0f931f0275 | ||
|
|
0a3a0c525f | ||
|
|
c818bd61d5 | ||
|
|
3e220d87f0 | ||
|
|
58691c0d15 | ||
|
|
a59a1bbaad | ||
|
|
1d84bd94ea | ||
|
|
e777b3806e | ||
|
|
74afd2522f | ||
|
|
da831bf833 | ||
|
|
d21190d765 | ||
|
|
ae2eefeb92 | ||
|
|
c0968ba348 | ||
|
|
d469a505c4 | ||
|
|
34244e313b | ||
|
|
d77c3feef5 | ||
|
|
0fa9b99445 | ||
|
|
433688cc92 | ||
|
|
790af7d332 | ||
|
|
4fb733df43 | ||
|
|
0794d14a7a | ||
|
|
324747af39 | ||
|
|
5377b50e53 | ||
|
|
b745b8e545 | ||
|
|
cfa65cfe5c | ||
|
|
7d52af37fa | ||
|
|
d8f9376d55 | ||
|
|
2c95fa52f8 | ||
|
|
993740e06f | ||
|
|
da67b2b53c | ||
|
|
7d08fec7cc | ||
|
|
6ec2c31678 | ||
|
|
e469a54429 | ||
|
|
2352055d98 | ||
|
|
7892625474 | ||
|
|
58a1497614 | ||
|
|
76d94278a8 | ||
|
|
47b2c3cd88 | ||
|
|
1f55e87876 | ||
|
|
cdd1a0b743 | ||
|
|
f864a28bb3 | ||
|
|
993a176572 | ||
|
|
414a344f33 | ||
|
|
28848dcbc8 | ||
|
|
ea32341410 | ||
|
|
ad53507f1c | ||
|
|
8f9e7cf941 | ||
|
|
1f1339cb01 | ||
|
|
e5eafea546 | ||
|
|
373d2c201c | ||
|
|
ec63b64b1f | ||
|
|
e6da9a6d68 | ||
|
|
4fac9708ec | ||
|
|
71d4bd62b2 | ||
|
|
3e96899ace | ||
|
|
51c590c6a6 | ||
|
|
e7d1452827 | ||
|
|
137e7a8cdd | ||
|
|
77f769b328 | ||
|
|
c85cb1377b | ||
|
|
f3362d6a2f | ||
|
|
043310f88a | ||
|
|
46f524706c | ||
|
|
7b7df3caba | ||
|
|
a47ff4d7a5 | ||
|
|
70fc3119e7 | ||
|
|
830be35c58 | ||
|
|
2fff39194f | ||
|
|
fffa377d2f | ||
|
|
a819e73388 | ||
|
|
0562965e69 | ||
|
|
7928823b96 | ||
|
|
3b92333b16 | ||
|
|
7238ae9025 | ||
|
|
f6634e882c | ||
|
|
f99a3916de | ||
|
|
cc9f972e80 | ||
|
|
609da60af3 | ||
|
|
7b794ea056 | ||
|
|
3f66617c68 | ||
|
|
f8f60965a9 | ||
|
|
6f0832c6d8 | ||
|
|
33c321d328 | ||
|
|
16fdb53870 | ||
|
|
b5ab80797d | ||
|
|
1385a9c6ac | ||
|
|
a11c390fd5 | ||
|
|
a498b79b2d | ||
|
|
6a22f2443e | ||
|
|
cd2597f3a2 | ||
|
|
d32a38c267 | ||
|
|
64bcc9942e | ||
|
|
cf750429cb | ||
|
|
32843f18f8 | ||
|
|
d7bd110ffe | ||
|
|
36176b8eb4 | ||
|
|
8c94fbd199 | ||
|
|
d9e1e01afc | ||
|
|
8edec19426 | ||
|
|
5419f3b5de | ||
|
|
6df0403964 | ||
|
|
2bef522bfc | ||
|
|
4e86a928b3 | ||
|
|
254b4f6603 | ||
|
|
7373203236 | ||
|
|
55a4c34bab | ||
|
|
b060ac5928 | ||
|
|
ab27958761 | ||
|
|
dca1600f46 | ||
|
|
218ac8a0d7 | ||
|
|
cac96f1a44 | ||
|
|
55948f0db1 | ||
|
|
c80033de55 | ||
|
|
dd378506ee | ||
|
|
9e890d8df5 | ||
|
|
f4030700dc | ||
|
|
b7f924ea6b | ||
|
|
c5c4fd08e9 | ||
|
|
bf7871905e | ||
|
|
28ef47c26f | ||
|
|
7a6e12df06 | ||
|
|
97130623dc | ||
|
|
a1ad295557 | ||
|
|
ecc552eda8 | ||
|
|
56d7afd8a0 | ||
|
|
46e465b1d2 | ||
|
|
4c52cb0441 | ||
|
|
4da09ccefc | ||
|
|
389921bd48 | ||
|
|
e9f6827211 | ||
|
|
042d935a80 | ||
|
|
1f7fee5baa | ||
|
|
ff33077291 | ||
|
|
70c909302c | ||
|
|
900f57bc94 | ||
|
|
41fabe25bd | ||
|
|
1e634da6dd | ||
|
|
a4386862f5 | ||
|
|
7435ddd89b | ||
|
|
f1e5508023 | ||
|
|
0fd8e46ea2 | ||
|
|
cb4764e8d0 | ||
|
|
0c55ff682b | ||
|
|
8659222b82 | ||
|
|
64b2332534 | ||
|
|
303278228a | ||
|
|
16baec8877 | ||
|
|
0b7cc9aa9d | ||
|
|
77bc1ed93b | ||
|
|
d2969046d4 | ||
|
|
b3c67343e5 | ||
|
|
f26624902f | ||
|
|
f96196c271 | ||
|
|
f47b3c0fd0 | ||
|
|
170ac43ebe | ||
|
|
93e0b43b03 | ||
|
|
b9c9069c5a | ||
|
|
fdc9b42d14 | ||
|
|
6cb690996d | ||
|
|
eb63396934 | ||
|
|
f1aa394d29 | ||
|
|
415969fca0 | ||
|
|
dfbd9ad9d0 | ||
|
|
a50424930b | ||
|
|
9843ff7b49 | ||
|
|
7ea79b3ed4 | ||
|
|
b783b7e364 | ||
|
|
60d0011159 | ||
|
|
e730044cc1 | ||
|
|
60ea566ecc | ||
|
|
fd797419dd | ||
|
|
3a5a785f51 | ||
|
|
65564198ef | ||
|
|
def0b0ceb0 | ||
|
|
01776721ab | ||
|
|
6f7d012184 | ||
|
|
7d4d468e58 | ||
|
|
d1a870b372 | ||
|
|
680e55e493 | ||
|
|
c779bae39a | ||
|
|
5a4fafec31 | ||
|
|
cfcc94c2bb | ||
|
|
8d1c8fad7c | ||
|
|
c6cc437092 | ||
|
|
6a30e96439 | ||
|
|
95d7869aa6 | ||
|
|
95a26b87ce | ||
|
|
6c0bfdd0b7 | ||
|
|
0e19a3a614 | ||
|
|
35350315b7 | ||
|
|
8f97380d75 | ||
|
|
fe6bac98c7 | ||
|
|
77c5502b19 | ||
|
|
065eb6f1d5 | ||
|
|
103e4b2b22 | ||
|
|
cb4e5b551f | ||
|
|
c22d9a7e99 | ||
|
|
2b52cf3896 | ||
|
|
5b16bd3748 | ||
|
|
40bbe0cd39 | ||
|
|
661dc39d9c | ||
|
|
07c240e9a1 | ||
|
|
93f20cb8e4 | ||
|
|
e512f60386 | ||
|
|
59442ea786 | ||
|
|
ee8a7f67a7 | ||
|
|
c2c24787da | ||
|
|
60f69cb79b | ||
|
|
3bc70fc2c2 | ||
|
|
f09a3c0a09 | ||
|
|
f15a879898 | ||
|
|
984f3f0aa7 | ||
|
|
1559d18757 | ||
|
|
c2c0ca0eeb | ||
|
|
754c35f2f5 | ||
|
|
2bbd5a806b | ||
|
|
5891192fda | ||
|
|
5effb36530 | ||
|
|
bc72cea911 | ||
|
|
ec8886cf09 | ||
|
|
bce0cc4ca0 | ||
|
|
66eaf28ac8 | ||
|
|
d728b3d745 | ||
|
|
11426ed5a2 | ||
|
|
386abb7000 | ||
|
|
476fb7bbfc | ||
|
|
c825720ae0 | ||
|
|
6e407fff7b | ||
|
|
11b24d23aa | ||
|
|
2135e20299 | ||
|
|
123277167b | ||
|
|
4a9f85674f | ||
|
|
719579177e | ||
|
|
3f6a1f33d4 | ||
|
|
688dee73c2 | ||
|
|
5fa10d82f4 | ||
|
|
4cde77929f | ||
|
|
41f66ee2f3 | ||
|
|
2ee9db9479 | ||
|
|
f87883712e | ||
|
|
ea22ebfe09 | ||
|
|
0edd905be5 | ||
|
|
47e2ff7500 | ||
|
|
c011621363 | ||
|
|
8c47d95901 | ||
|
|
e08be40462 | ||
|
|
d7022ad67b | ||
|
|
38f435eba8 | ||
|
|
6f429c16ee | ||
|
|
dfaebd0908 | ||
|
|
d6abb06544 | ||
|
|
d950369202 | ||
|
|
745fc385e9 | ||
|
|
f02a1caced | ||
|
|
e547962d31 | ||
|
|
31fe8e2a4c | ||
|
|
1b1dc86fb6 | ||
|
|
7539390fc3 | ||
|
|
ad7b508184 | ||
|
|
0fa37a5b62 | ||
|
|
1cbfc73384 | ||
|
|
c58ae29dd5 | ||
|
|
96e442b564 | ||
|
|
e817f867af | ||
|
|
8c8c96bb89 | ||
|
|
f0e7af10bb | ||
|
|
4e44bcfdef | ||
|
|
d4cea3a9ff | ||
|
|
f06b7dfd20 | ||
|
|
6dd4f692e2 | ||
|
|
d860dc0011 | ||
|
|
d5d8e66dee | ||
|
|
ad4843b8ea | ||
|
|
3162ede091 | ||
|
|
f9e3871b3e | ||
|
|
53abc32182 | ||
|
|
39267bcb05 | ||
|
|
7398df34ec | ||
|
|
62c8792c2a | ||
|
|
e561a547a7 | ||
|
|
5128907c07 | ||
|
|
5ddef96ccc | ||
|
|
e75251141a | ||
|
|
4f419025fe | ||
|
|
c6cf69e4a3 | ||
|
|
10e444df95 | ||
|
|
eeab39d62d | ||
|
|
28e46d411b | ||
|
|
1195eb3ada | ||
|
|
5f779fae4c | ||
|
|
cdb274654e | ||
|
|
b486c02ac8 | ||
|
|
9bcb08776c | ||
|
|
d36c788e00 | ||
|
|
00bbac6ae1 | ||
|
|
40db1ce831 | ||
|
|
bbf18d5667 | ||
|
|
377f78db0f | ||
|
|
ad96da3537 | ||
|
|
db8cf9134f | ||
|
|
0d65873a0b | ||
|
|
c38ff6302d | ||
|
|
abc9a3ddb1 | ||
|
|
650c4dea46 | ||
|
|
a2d1cf8f37 | ||
|
|
23c449af6c | ||
|
|
2d548f46bf | ||
|
|
c3c4ce064c | ||
|
|
fb7a0d5257 | ||
|
|
f8351a9818 | ||
|
|
5aefddd246 | ||
|
|
facefe5872 | ||
|
|
ef794efbb3 | ||
|
|
573a1f2fa3 | ||
|
|
a763d84b56 | ||
|
|
c06ccbb602 | ||
|
|
ffd8a5ae2a | ||
|
|
aa753d5d6e | ||
|
|
1cf042064f | ||
|
|
a4e14a94d2 | ||
|
|
5871d644cc | ||
|
|
145a149873 | ||
|
|
7492c51ee6 | ||
|
|
be4954a69e | ||
|
|
875a95b82e | ||
|
|
f6b129577b | ||
|
|
4d30bbba3e | ||
|
|
8823dc67eb | ||
|
|
8690c9d7f6 | ||
|
|
f70d242903 | ||
|
|
5b4306dbd6 | ||
|
|
013870fc6a | ||
|
|
0e3d4e562f | ||
|
|
48d1ec4575 | ||
|
|
32ad077676 | ||
|
|
9942308fc8 | ||
|
|
af3b97aae5 | ||
|
|
c3c0b0e1f4 | ||
|
|
9d5863bc76 | ||
|
|
4b2d436b04 | ||
|
|
404195d389 | ||
|
|
df29aad213 | ||
|
|
026601e350 | ||
|
|
05a48addc6 | ||
|
|
a1e9e62b6e | ||
|
|
64ea61c93a | ||
|
|
a0bbf8fd54 | ||
|
|
15e9872bb5 | ||
|
|
a1f592ffef | ||
|
|
07de43ffc4 | ||
|
|
522fa4c906 | ||
|
|
7611e0a2d2 | ||
|
|
9290659edf | ||
|
|
3a88c2f9e3 | ||
|
|
a732686bf6 | ||
|
|
2ede27a557 | ||
|
|
8300b018f0 | ||
|
|
93aed25251 | ||
|
|
591563118c | ||
|
|
b59b5dd5d8 | ||
|
|
bb0bde6409 | ||
|
|
66a392ddae | ||
|
|
8bfc9fa709 | ||
|
|
ccbdeeff67 | ||
|
|
0f1176adaf | ||
|
|
b75fce3d5c | ||
|
|
ab68ad4855 | ||
|
|
426cf0b969 | ||
|
|
2d1f7ba50f | ||
|
|
69145e65f1 | ||
|
|
3dcb4b380a | ||
|
|
8e996fdf67 | ||
|
|
7367d8a31f | ||
|
|
d5fcfc773c | ||
|
|
5cdd3a676d | ||
|
|
fd95da4c0a | ||
|
|
1aa613e0f5 | ||
|
|
7d91a35878 | ||
|
|
fa2c566b3f | ||
|
|
f2b7f9718a | ||
|
|
08c0bd3aee | ||
|
|
3a39133e04 | ||
|
|
c3ec5825a4 | ||
|
|
baddd6703d | ||
|
|
0c3733d2cd | ||
|
|
c536d49afd | ||
|
|
b031aee73a | ||
|
|
c480e2c944 | ||
|
|
c7cd913df4 | ||
|
|
58a465e805 | ||
|
|
cf08ff0cd5 | ||
|
|
c839e8168a | ||
|
|
3257777c18 | ||
|
|
1028e14398 | ||
|
|
b733679875 | ||
|
|
723cbd5938 | ||
|
|
0e48ea11ac | ||
|
|
57ab92645c | ||
|
|
2431f5db2c | ||
|
|
34d960638a | ||
|
|
3bb26b10a3 | ||
|
|
3cdc511b2d | ||
|
|
4543d0c80c | ||
|
|
2a740ad2c8 | ||
|
|
7187da0233 | ||
|
|
ab43e4d987 | ||
|
|
8056476db1 | ||
|
|
4b471d6045 | ||
|
|
8b19d7c8eb | ||
|
|
90c6679f03 | ||
|
|
4c73e5fe20 | ||
|
|
dd3a3138a7 | ||
|
|
9e8a091172 | ||
|
|
5d72560a30 | ||
|
|
2a9c65bd3f | ||
|
|
6b4cca55be | ||
|
|
c18139e73f | ||
|
|
be6ee814c2 | ||
|
|
ea6130e542 | ||
|
|
48a566a2d5 | ||
|
|
dab5b293d4 | ||
|
|
2a2cd3c873 | ||
|
|
51ffb56b16 | ||
|
|
211e7a4284 | ||
|
|
24643586f1 | ||
|
|
08986cb47e | ||
|
|
c3d878b1b3 |
No files matched your search
@@ -0,0 +1,15 @@
|
||||
# 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
|
||||
@@ -0,0 +1,17 @@
|
||||
# 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
|
||||
@@ -0,0 +1,14 @@
|
||||
# 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
|
||||
@@ -0,0 +1,23 @@
|
||||
# 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'
|
||||
@@ -0,0 +1,21 @@
|
||||
# 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.
|
||||
@@ -0,0 +1,30 @@
|
||||
# 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}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# 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.
|
||||
Executable
+104
@@ -0,0 +1,104 @@
|
||||
#!/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));
|
||||
Executable
+757
@@ -0,0 +1,757 @@
|
||||
#!/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);
|
||||
@@ -0,0 +1,12 @@
|
||||
# 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"
|
||||
@@ -0,0 +1,19 @@
|
||||
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
|
||||
@@ -0,0 +1,13 @@
|
||||
# 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".
|
||||
@@ -0,0 +1,20 @@
|
||||
# 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".
|
||||
@@ -0,0 +1,21 @@
|
||||
# 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.
|
||||
@@ -0,0 +1,18 @@
|
||||
drevil
|
||||
inquisitor
|
||||
mysterial
|
||||
DTP
|
||||
randomtiger
|
||||
wmcoolmon
|
||||
unknownplayer
|
||||
phreak
|
||||
bobboau
|
||||
righteous1
|
||||
sesquipedalian
|
||||
Goober5000
|
||||
dkharrat
|
||||
daveb
|
||||
EdrickV
|
||||
OldMan
|
||||
komet
|
||||
penguin
|
||||
-889
@@ -1,889 +0,0 @@
|
||||
# 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)
|
||||
])
|
||||
|
||||
# Configure paths for libogg
|
||||
# Jack Moffitt <[email protected]> 10-21-2000
|
||||
# Shamelessly stolen from Owen Taylor and Manish Singh
|
||||
|
||||
dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS
|
||||
dnl
|
||||
AC_DEFUN([XIPH_PATH_OGG],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(ogg,[ --with-ogg=PFX Prefix where libogg is installed (optional)], ogg_prefix="$withval", ogg_prefix="")
|
||||
AC_ARG_WITH(ogg-libraries,[ --with-ogg-libraries=DIR Directory where libogg library is installed (optional)], ogg_libraries="$withval", ogg_libraries="")
|
||||
AC_ARG_WITH(ogg-includes,[ --with-ogg-includes=DIR Directory where libogg header files are installed (optional)], ogg_includes="$withval", ogg_includes="")
|
||||
AC_ARG_ENABLE(oggtest, [ --disable-oggtest Do not try to compile and run a test Ogg program],, enable_oggtest=yes)
|
||||
|
||||
if test "x$ogg_libraries" != "x" ; then
|
||||
OGG_LIBS="-L$ogg_libraries"
|
||||
elif test "x$ogg_prefix" != "x" ; then
|
||||
OGG_LIBS="-L$ogg_prefix/lib"
|
||||
elif test "x$prefix" != "xNONE" ; then
|
||||
OGG_LIBS="-L$libdir"
|
||||
fi
|
||||
|
||||
OGG_LIBS="$OGG_LIBS -logg"
|
||||
|
||||
if test "x$ogg_includes" != "x" ; then
|
||||
OGG_CFLAGS="-I$ogg_includes"
|
||||
elif test "x$ogg_prefix" != "x" ; then
|
||||
OGG_CFLAGS="-I$ogg_prefix/include"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
OGG_CFLAGS=""
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for Ogg)
|
||||
no_ogg=""
|
||||
|
||||
|
||||
if test "x$enable_oggtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $OGG_CFLAGS"
|
||||
LIBS="$LIBS $OGG_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed Ogg is sufficiently new.
|
||||
dnl
|
||||
rm -f conf.oggtest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
system("touch conf.oggtest");
|
||||
return 0;
|
||||
}
|
||||
|
||||
],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$no_ogg" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.oggtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run Ogg test program, checking why..."
|
||||
CFLAGS="$CFLAGS $OGG_CFLAGS"
|
||||
LIBS="$LIBS $OGG_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <ogg/ogg.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding Ogg or finding the wrong"
|
||||
echo "*** version of Ogg. If it is not finding Ogg, 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 Ogg was incorrectly installed"
|
||||
echo "*** or that you have moved Ogg since it was installed." ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
OGG_CFLAGS=""
|
||||
OGG_LIBS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
AC_SUBST(OGG_CFLAGS)
|
||||
AC_SUBST(OGG_LIBS)
|
||||
rm -f conf.oggtest
|
||||
])
|
||||
|
||||
# Configure paths for libvorbis
|
||||
# Jack Moffitt <[email protected]> 10-21-2000
|
||||
# Shamelessly stolen from Owen Taylor and Manish Singh
|
||||
# thomasvs added check for vorbis_bitrate_addblock which is new in rc3
|
||||
|
||||
dnl XIPH_PATH_VORBIS([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libvorbis, and define VORBIS_CFLAGS and VORBIS_LIBS
|
||||
dnl
|
||||
AC_DEFUN([XIPH_PATH_VORBIS],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(vorbis,[ --with-vorbis=PFX Prefix where libvorbis is installed (optional)], vorbis_prefix="$withval", vorbis_prefix="")
|
||||
AC_ARG_WITH(vorbis-libraries,[ --with-vorbis-libraries=DIR Directory where libvorbis library is installed (optional)], vorbis_libraries="$withval", vorbis_libraries="")
|
||||
AC_ARG_WITH(vorbis-includes,[ --with-vorbis-includes=DIR Directory where libvorbis header files are installed (optional)], vorbis_includes="$withval", vorbis_includes="")
|
||||
AC_ARG_ENABLE(vorbistest, [ --disable-vorbistest Do not try to compile and run a test Vorbis program],, enable_vorbistest=yes)
|
||||
|
||||
if test "x$vorbis_libraries" != "x" ; then
|
||||
VORBIS_LIBS="-L$vorbis_libraries"
|
||||
elif test "x$vorbis_prefix" != "x" ; then
|
||||
VORBIS_LIBS="-L$vorbis_prefix/lib"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
VORBIS_LIBS="-L$libdir"
|
||||
fi
|
||||
|
||||
VORBIS_LIBS="$VORBIS_LIBS -lvorbis -lm"
|
||||
VORBISFILE_LIBS="-lvorbisfile"
|
||||
VORBISENC_LIBS="-lvorbisenc"
|
||||
|
||||
if test "x$vorbis_includes" != "x" ; then
|
||||
VORBIS_CFLAGS="-I$vorbis_includes"
|
||||
elif test "x$vorbis_prefix" != "x" ; then
|
||||
VORBIS_CFLAGS="-I$vorbis_prefix/include"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
VORBIS_CFLAGS=""
|
||||
fi
|
||||
|
||||
|
||||
AC_MSG_CHECKING(for Vorbis)
|
||||
no_vorbis=""
|
||||
|
||||
|
||||
if test "x$enable_vorbistest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $VORBIS_CFLAGS $OGG_CFLAGS"
|
||||
LIBS="$LIBS $VORBIS_LIBS $VORBISENC_LIBS $OGG_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed Vorbis is sufficiently new.
|
||||
dnl
|
||||
rm -f conf.vorbistest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vorbis/codec.h>
|
||||
#include <vorbis/vorbisenc.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
vorbis_block vb;
|
||||
vorbis_dsp_state vd;
|
||||
vorbis_info vi;
|
||||
|
||||
vorbis_info_init (&vi);
|
||||
vorbis_encode_init (&vi, 2, 44100, -1, 128000, -1);
|
||||
vorbis_analysis_init (&vd, &vi);
|
||||
vorbis_block_init (&vd, &vb);
|
||||
/* this function was added in 1.0rc3, so this is what we're testing for */
|
||||
vorbis_bitrate_addblock (&vb);
|
||||
|
||||
system("touch conf.vorbistest");
|
||||
return 0;
|
||||
}
|
||||
|
||||
],, no_vorbis=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$no_vorbis" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.vorbistest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run Vorbis test program, checking why..."
|
||||
CFLAGS="$CFLAGS $VORBIS_CFLAGS"
|
||||
LIBS="$LIBS $VORBIS_LIBS $OGG_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <vorbis/codec.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding Vorbis or finding the wrong"
|
||||
echo "*** version of Vorbis. If it is not finding Vorbis, 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 Vorbis was incorrectly installed"
|
||||
echo "*** or that you have moved Vorbis since it was installed." ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
VORBIS_CFLAGS=""
|
||||
VORBIS_LIBS=""
|
||||
VORBISFILE_LIBS=""
|
||||
VORBISENC_LIBS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
AC_SUBST(VORBIS_CFLAGS)
|
||||
AC_SUBST(VORBIS_LIBS)
|
||||
AC_SUBST(VORBISFILE_LIBS)
|
||||
AC_SUBST(VORBISENC_LIBS)
|
||||
rm -f conf.vorbistest
|
||||
])
|
||||
|
||||
dnl XIPH_PATH_THEORA([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for libtheora, and define THEORA_CFLAGS and THEORA_LIBS
|
||||
dnl
|
||||
AC_DEFUN([XIPH_PATH_THEORA],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(theora,[ --with-theora=PFX Prefix where libtheora is installed (optional)], theora_prefix="$withval", theora_prefix="")
|
||||
AC_ARG_WITH(theora-libraries,[ --with-theora-libraries=DIR Directory where libtheora library is installed (optional)], theora_libraries="$withval", theora_libraries="")
|
||||
AC_ARG_WITH(theora-includes,[ --with-theora-includes=DIR Directory where libtheora header files are installed (optional)], theora_includes="$withval", theora_includes="")
|
||||
AC_ARG_ENABLE(theoratest, [ --disable-theoratest Do not try to compile and run a test Theora program],, enable_theoratest=yes)
|
||||
|
||||
if test "x$theora_libraries" != "x" ; then
|
||||
THEORA_LIBS="-L$theora_libraries"
|
||||
elif test "x$theora_prefix" != "x" ; then
|
||||
THEORA_LIBS="-L$theora_prefix/lib"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
THEORA_LIBS="-L$libdir"
|
||||
fi
|
||||
|
||||
THEORA_LIBS="$THEORA_LIBS -ltheora"
|
||||
|
||||
if test "x$theora_includes" != "x" ; then
|
||||
THEORA_CFLAGS="-I$theora_includes"
|
||||
elif test "x$theora_prefix" != "x" ; then
|
||||
THEORA_CFLAGS="-I$theora_prefix/include"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
THEORA_CFLAGS=""
|
||||
fi
|
||||
|
||||
|
||||
AC_MSG_CHECKING(for Theora)
|
||||
no_theora=""
|
||||
|
||||
|
||||
if test "x$enable_theoratest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $THEORA_CFLAGS $OGG_CFLAGS"
|
||||
LIBS="$LIBS $THEORA_LIBS $OGG_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed Theora is sufficiently new.
|
||||
dnl
|
||||
rm -f conf.theoratest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <theora/theora.h>
|
||||
#include <vorbis/codec.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
theora_info ti;
|
||||
theora_state ts;
|
||||
|
||||
theora_info_init(&ti);
|
||||
|
||||
system("touch conf.theoratest");
|
||||
return 0;
|
||||
}
|
||||
|
||||
],, no_theora=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$no_theora" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.theoratest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run Theora test program, checking why..."
|
||||
CFLAGS="$CFLAGS $THEORA_CFLAGS"
|
||||
LIBS="$LIBS $THEORA_LIBS $OGG_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <vorbis/codec.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding Theora or finding the wrong"
|
||||
echo "*** version of Theora. If it is not finding Theora, 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 Theora was incorrectly installed"
|
||||
echo "*** or that you have moved Theora since it was installed." ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
THEORA_CFLAGS=""
|
||||
THEORA_LIBS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
AC_SUBST(THEORA_CFLAGS)
|
||||
AC_SUBST(THEORA_LIBS)
|
||||
rm -f conf.theoratest
|
||||
])
|
||||
|
||||
|
||||
dnl AM_PATH_OPENAL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for OpenAL, and define OPENAL_CFLAGS and OPENAL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_OPENAL],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(openal,[ --with-openal=PFX Prefix where OpenAL is installed (optional)], openal_prefix="$withval", openal_prefix="")
|
||||
AC_ARG_WITH(openal-libraries,[ --with-openal-libraries=DIR Directory where OpenAL library is installed (optional)], openal_libraries="$withval", openal_libraries="")
|
||||
AC_ARG_WITH(openal-includes,[ --with-openal-includes=DIR Directory where OpenAL header files are installed (optional)], openal_includes="$withval", openal_includes="")
|
||||
AC_ARG_ENABLE(openaltest, [ --disable-openaltest Do not try to compile and run a test OpenAL program],, enable_openaltest=yes)
|
||||
|
||||
if test "x$openal_libraries" != "x" ; then
|
||||
OPENAL_LIBS="-L$openal_libraries"
|
||||
elif test "x$openal_prefix" != "x" ; then
|
||||
OPENAL_LIBS="-L$openal_prefix/lib"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
OPENAL_LIBS="-L$libdir"
|
||||
fi
|
||||
|
||||
OPENAL_LIBS="$OPENAL_LIBS -lopenal"
|
||||
|
||||
if test "x$openal_includes" != "x" ; then
|
||||
OPENAL_CFLAGS="-I$openal_includes"
|
||||
elif test "x$openal_prefix" != "x" ; then
|
||||
OPENAL_CFLAGS="-I$openal_prefix/include"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
OPENAL_CFLAGS=""
|
||||
fi
|
||||
|
||||
|
||||
AC_MSG_CHECKING(for OpenAL)
|
||||
no_openal=""
|
||||
|
||||
|
||||
if test "x$enable_openaltest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $OPENAL_CFLAGS"
|
||||
LIBS="$LIBS $OPENAL_LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed OpenAL is sufficiently new.
|
||||
dnl
|
||||
rm -f conf.openaltest
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <AL/al.h>
|
||||
#include <AL/alc.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
#ifdef AL_VERSION_1_1
|
||||
alcIsExtensionPresent(NULL, (const ALCchar*)"ALC_ENUMERATION_EXT");
|
||||
|
||||
system("touch conf.openaltest");
|
||||
return 0;
|
||||
#else
|
||||
printf("\n*** OpenAL version 1.1 or greater is required.\n");
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
],, no_openal=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$no_openal" = "x" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test -f conf.openaltest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run OpenAL test program, checking why..."
|
||||
CFLAGS="$CFLAGS $OPENAL_CFLAGS"
|
||||
LIBS="$LIBS $OPENAL_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <stdio.h>
|
||||
#include <AL/al.h>
|
||||
], [ return 0; ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding OpenAL or finding the wrong"
|
||||
echo "*** version of OpenAL. If it is not finding OpenAL, 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 OpenAL was incorrectly installed"
|
||||
echo "*** or that you have moved OpenAL since it was installed." ])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
OPENAL_CFLAGS=""
|
||||
OPENAL_LIBS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
AC_SUBST(OPENAL_CFLAGS)
|
||||
AC_SUBST(OPENAL_LIBS)
|
||||
rm -f conf.openaltest
|
||||
])
|
||||
|
||||
dnl AM_PATH_OPENGL([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||
dnl Test for OpenGL, and define OPENGL_CFLAGS and OPENGL_LIBS
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_OPENGL],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries
|
||||
dnl
|
||||
AC_ARG_WITH(opengl,[ --with-opengl=PFX Prefix where OpenGL is installed (optional)], opengl_prefix="$withval", opengl_prefix="")
|
||||
AC_ARG_WITH(opengl-libraries,[ --with-opengl-libraries=DIR Directory where OpenGL library is installed (optional)], opengl_libraries="$withval", opengl_libraries="")
|
||||
AC_ARG_WITH(opengl-includes,[ --with-opengl-includes=DIR Directory where OpenGL header files are installed (optional)], opengl_includes="$withval", opengl_includes="")
|
||||
AC_ARG_ENABLE(opengltest, [ --disable-opengltest Do not try to compile and run a test OpenGL program],, enable_opengltest=yes)
|
||||
|
||||
if test "x$opengl_libraries" != "x" ; then
|
||||
OPENGL_LIBS="-L$opengl_libraries"
|
||||
elif test "x$opengl_prefix" != "x" ; then
|
||||
OPENGL_LIBS="-L$opengl_prefix/lib"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
OPENGL_LIBS="-L$libdir"
|
||||
fi
|
||||
|
||||
OPENGL_LIBS="$OPENGL_LIBS -lGL -lGLU"
|
||||
|
||||
if test "x$opengl_includes" != "x" ; then
|
||||
OPENGL_CFLAGS="-I$opengl_includes"
|
||||
elif test "x$opengl_prefix" != "x" ; then
|
||||
OPENGL_CFLAGS="-I$opengl_prefix/include"
|
||||
elif test "x$prefix" != "xNONE"; then
|
||||
OPENGL_CFLAGS=""
|
||||
fi
|
||||
|
||||
|
||||
no_opengl=""
|
||||
|
||||
|
||||
if test "x$enable_opengltest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $OPENGL_CFLAGS"
|
||||
LIBS="$LIBS $OPENGL_LIBS"
|
||||
|
||||
AC_CHECK_LIB(GL, glPushMatrix,
|
||||
[AC_CHECK_HEADER(GL/gl.h,
|
||||
[AC_CHECK_LIB(GLU, gluPerspective,
|
||||
[AC_CHECK_HEADER(GL/glu.h, ,
|
||||
dnl NOTE: this is a failure
|
||||
no_opengl=yes
|
||||
)]
|
||||
)]
|
||||
)]
|
||||
)
|
||||
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$no_opengl" = "x" ; then
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
OPENGL_CFLAGS=""
|
||||
OPENGL_LIBS=""
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
AC_SUBST(OPENGL_CFLAGS)
|
||||
AC_SUBST(OPENGL_LIBS)
|
||||
])
|
||||
@@ -1,548 +0,0 @@
|
||||
/*
|
||||
* Created by Ian "Goober5000" Warfield for the FreeSpace2 Source Code Project.
|
||||
* You may not sell or otherwise commercially exploit the source or things you
|
||||
* create based on the source.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/def_files.h"
|
||||
#include "ai/ai_profiles.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "localization/localize.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "ship/ship.h"
|
||||
|
||||
|
||||
// global stuff
|
||||
int Num_ai_profiles;
|
||||
int Default_ai_profile;
|
||||
ai_profile_t Ai_profiles[MAX_AI_PROFILES];
|
||||
|
||||
// local to this file
|
||||
static int Ai_profiles_initted = 0;
|
||||
static char Default_profile_name[NAME_LENGTH];
|
||||
|
||||
|
||||
// utility
|
||||
void set_flag(ai_profile_t *profile, char *name, int flag, int type)
|
||||
{
|
||||
if (optional_string(name))
|
||||
{
|
||||
bool val;
|
||||
stuff_boolean(&val);
|
||||
|
||||
if (type == AIP_FLAG) {
|
||||
if (val)
|
||||
profile->flags |= flag;
|
||||
else
|
||||
profile->flags &= ~flag;
|
||||
} else {
|
||||
if (val)
|
||||
profile->flags2 |= flag;
|
||||
else
|
||||
profile->flags2 &= ~flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char *AI_path_types[] = {
|
||||
"normal",
|
||||
"alt1",
|
||||
};
|
||||
|
||||
int Num_ai_path_types = sizeof(AI_path_types)/sizeof(char*);
|
||||
|
||||
int ai_path_type_match(char *p)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < Num_ai_path_types; i++)
|
||||
{
|
||||
if(!stricmp(AI_path_types[i], p))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void parse_ai_profiles_tbl(char *filename)
|
||||
{
|
||||
int i, rval;
|
||||
char profile_name[NAME_LENGTH];
|
||||
ai_profile_t dummy_profile;
|
||||
char *saved_Mp = NULL;
|
||||
char buf[NAME_LENGTH];
|
||||
|
||||
// open localization
|
||||
lcl_ext_open();
|
||||
|
||||
if ((rval = setjmp(parse_abort)) != 0)
|
||||
{
|
||||
mprintf(("TABLES: Unable to parse '%s'! Error code = %i.\n", (filename) ? filename : "<default ai_profiles.tbl>", rval));
|
||||
lcl_ext_close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (filename == NULL)
|
||||
read_file_text_from_array(defaults_get_file("ai_profiles.tbl"));
|
||||
else
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
|
||||
reset_parse();
|
||||
|
||||
|
||||
// start parsing
|
||||
required_string("#AI Profiles");
|
||||
|
||||
// new default?
|
||||
if (optional_string("$Default Profile:"))
|
||||
stuff_string(Default_profile_name, F_NAME, NAME_LENGTH);
|
||||
|
||||
// begin reading data
|
||||
while (required_string_either("#End","$Profile Name:"))
|
||||
{
|
||||
ai_profile_t *profile = &dummy_profile;
|
||||
ai_profile_t *previous_profile = NULL;
|
||||
bool no_create = false;
|
||||
|
||||
// get the name
|
||||
required_string("$Profile Name:");
|
||||
stuff_string(profile_name, F_NAME, NAME_LENGTH);
|
||||
|
||||
// see if it exists
|
||||
for (i = 0; i < Num_ai_profiles; i++)
|
||||
{
|
||||
if (!stricmp(Ai_profiles[i].profile_name, profile_name))
|
||||
{
|
||||
previous_profile = &Ai_profiles[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// modular table stuff
|
||||
if (optional_string("+nocreate"))
|
||||
{
|
||||
no_create = true;
|
||||
|
||||
// use the previous one if possible,
|
||||
// otherwise continue to use the dummy one
|
||||
if (previous_profile != NULL)
|
||||
profile = previous_profile;
|
||||
}
|
||||
else
|
||||
{
|
||||
// don't create multiple profiles with the same name
|
||||
if (previous_profile != NULL)
|
||||
{
|
||||
Warning(LOCATION, "An ai profile named '%s' already exists! The new one will not be created.\n", profile_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// make sure we're under the limit
|
||||
if (Num_ai_profiles >= MAX_AI_PROFILES)
|
||||
{
|
||||
Warning(LOCATION, "Too many profiles in ai_profiles.tbl! Max is %d.\n", MAX_AI_PROFILES-1); // -1 because one is built-in
|
||||
skip_to_string("#End", NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
profile = &Ai_profiles[Num_ai_profiles];
|
||||
Num_ai_profiles++;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize profile if we're not building from a previously parsed one
|
||||
if (!no_create)
|
||||
{
|
||||
// base profile, so zero it out
|
||||
if (profile == &Ai_profiles[0])
|
||||
{
|
||||
memset(profile, 0, sizeof(ai_profile_t));
|
||||
}
|
||||
// brand new profile, so set it to the base defaults
|
||||
else
|
||||
{
|
||||
memcpy(profile, &Ai_profiles[0], sizeof(ai_profile_t));
|
||||
}
|
||||
}
|
||||
|
||||
// set the name
|
||||
strcpy_s(profile->profile_name, profile_name);
|
||||
|
||||
|
||||
// fill in any and all settings; they're all optional and can be in any order
|
||||
while (!check_for_string("$Profile Name:") && !check_for_string("#End"))
|
||||
{
|
||||
if (optional_string("$Player Afterburner Recharge Scale:"))
|
||||
parse_float_list(profile->afterburner_recharge_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Beam Friendly Fire Damage:"))
|
||||
parse_float_list(profile->beam_friendly_damage_cap, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Countermeasure Life Scale:"))
|
||||
parse_float_list(profile->cmeasure_life_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Countermeasure Firing Chance:"))
|
||||
parse_float_list(profile->cmeasure_fire_chance, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI In Range Time:"))
|
||||
parse_float_list(profile->in_range_time, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Always Links Ammo Weapons:"))
|
||||
parse_float_list(profile->link_ammo_levels_always, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Maybe Links Ammo Weapons:"))
|
||||
parse_float_list(profile->link_ammo_levels_maybe, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Primary Ammo Burst Multiplier:"))
|
||||
parse_float_list(profile->primary_ammo_burst_mult, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Always Links Energy Weapons:"))
|
||||
parse_float_list(profile->link_energy_levels_always, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Maybe Links Energy Weapons:"))
|
||||
parse_float_list(profile->link_energy_levels_maybe, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Missles Locked on Player:"))
|
||||
parse_int_list(profile->max_allowed_player_homers, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Player Attackers:"))
|
||||
parse_int_list(profile->max_attackers, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Incoming Asteroids:"))
|
||||
parse_int_list(profile->max_incoming_asteroids, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Damage Factor:") || optional_string("$AI Damage Reduction to Player Hull:"))
|
||||
parse_float_list(profile->player_damage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
|
||||
parse_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
// represented in fractions of F1_0
|
||||
if (optional_string("$Predict Position Delay:"))
|
||||
{
|
||||
int iLoop;
|
||||
float temp_list[NUM_SKILL_LEVELS];
|
||||
|
||||
parse_float_list(temp_list, NUM_SKILL_LEVELS);
|
||||
|
||||
for (iLoop = 0; iLoop < NUM_SKILL_LEVELS; iLoop++)
|
||||
profile->predict_position_delay[iLoop] = fl2f(temp_list[iLoop]);
|
||||
}
|
||||
|
||||
if (optional_string("$Player Shield Recharge Scale:"))
|
||||
parse_float_list(profile->shield_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Shield Manage Delay:") || optional_string("$AI Shield Manage Delays:"))
|
||||
parse_float_list(profile->shield_manage_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Friendly AI Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_delay_scale_friendly, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Hostile AI Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Friendly AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_friendly, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Hostile AI Secondary Fire Delay Scale:"))
|
||||
parse_float_list(profile->ship_fire_secondary_delay_scale_hostile, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Subsys Damage Factor:") || optional_string("$AI Damage Reduction to Player Subsys:"))
|
||||
parse_float_list(profile->subsys_damage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$AI Turn Time Scale:"))
|
||||
parse_float_list(profile->turn_time_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Glide Attack Percent:")) {
|
||||
parse_float_list(profile->glide_attack_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->glide_attack_percent[i] < 0.0f || profile->glide_attack_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Glide Attack Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_attack_percent[i]);
|
||||
profile->glide_attack_percent[i] = 0.0f;
|
||||
}
|
||||
profile->glide_attack_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Circle Strafe Percent:")) {
|
||||
parse_float_list(profile->circle_strafe_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->circle_strafe_percent[i] < 0.0f || profile->circle_strafe_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Circle Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->circle_strafe_percent[i]);
|
||||
profile->circle_strafe_percent[i] = 0.0f;
|
||||
}
|
||||
profile->circle_strafe_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Glide Strafe Percent:")) {
|
||||
parse_float_list(profile->glide_strafe_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->glide_strafe_percent[i] < 0.0f || profile->glide_strafe_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Glide Strafe Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->glide_strafe_percent[i]);
|
||||
profile->glide_strafe_percent[i] = 0.0f;
|
||||
}
|
||||
profile->glide_strafe_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Random Sidethrust Percent:")) {
|
||||
parse_float_list(profile->random_sidethrust_percent, NUM_SKILL_LEVELS);
|
||||
//Percent is nice for modders, but here in the code we want it betwwen 0 and 1.0
|
||||
//While we're at it, verify the range
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
|
||||
if (profile->random_sidethrust_percent[i] < 0.0f || profile->random_sidethrust_percent[i] > 100.0f) {
|
||||
Warning(LOCATION, "$Random Sidethrust Percent should be between 0 and 100.0 (read %f). Setting to 0.", profile->random_sidethrust_percent[i]);
|
||||
profile->random_sidethrust_percent[i] = 0.0f;
|
||||
}
|
||||
profile->random_sidethrust_percent[i] /= 100.0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Stalemate Time Threshold:"))
|
||||
parse_float_list(profile->stalemate_time_thresh, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Stalemate Distance Threshold:"))
|
||||
parse_float_list(profile->stalemate_dist_thresh, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Weapon Recharge Scale:"))
|
||||
parse_float_list(profile->weapon_energy_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Turret Target Ownage:"))
|
||||
parse_int_list(profile->max_turret_ownage_target, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Turret Player Ownage:"))
|
||||
parse_int_list(profile->max_turret_ownage_player, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Required For Kill Scale:"))
|
||||
parse_float_list(profile->kill_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Required For Assist Scale:"))
|
||||
parse_float_list(profile->assist_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Percentage Awarded For Capship Assist:"))
|
||||
parse_float_list(profile->assist_award_percentage_scale, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Repair Penalty:"))
|
||||
parse_int_list(profile->repair_penalty, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Delay Before Allowing Bombs to Be Shot Down:"))
|
||||
parse_float_list(profile->delay_bomb_arm_timer, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Chance AI Has to Fire Missiles at Player:"))
|
||||
parse_int_list(profile->chance_to_use_missiles_on_plr, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Max Aim Update Delay:"))
|
||||
parse_float_list(profile->max_aim_update_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Turret Max Aim Update Delay:"))
|
||||
parse_float_list(profile->turret_max_aim_update_delay, NUM_SKILL_LEVELS);
|
||||
|
||||
if (optional_string("$Player Autoaim FOV:"))
|
||||
{
|
||||
float fov_list[NUM_SKILL_LEVELS];
|
||||
parse_float_list(fov_list, NUM_SKILL_LEVELS);
|
||||
for (i = 0; i < NUM_SKILL_LEVELS; i++)
|
||||
{
|
||||
//Enforce range
|
||||
if (fov_list[i] < 0.0f || fov_list[i] >= 360.0f)
|
||||
{
|
||||
Warning(LOCATION, "$Player Autoaim FOV should be >= 0 and < 360.0 (read %f). Setting to 0.", fov_list[i]);
|
||||
fov_list[i] = 0.0f;
|
||||
}
|
||||
|
||||
//Convert units
|
||||
profile->player_autoaim_fov[i] = fov_list[i] * PI / 180.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Detail Distance Multiplier:"))
|
||||
parse_float_list(profile->detail_distance_mult, NUM_SKILL_LEVELS);
|
||||
|
||||
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart secondary weapon selection:", AIPF_SMART_SECONDARY_WEAPON_SELECTION, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart shield management:", AIPF_SMART_SHIELD_MANAGEMENT, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart afterburner management:", AIPF_SMART_AFTERBURNER_MANAGEMENT, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow rapid secondary dumbfire:", AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$huge turret weapons ignore bombs:", AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$don't insert random turret fire delay:", AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$hack improve non-homing swarm turret fire accuracy:", AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$shockwaves damage small ship subsystems:", AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$navigation subsystem governs warpout capability:", AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$ignore lower bound for minimum speed of docked ship:", AIPF_NO_MIN_DOCK_SPEED_CAP, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$disable linked fire penalty:", AIPF_DISABLE_LINKED_FIRE_PENALTY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$disable weapon damage scaling:", AIPF_DISABLE_WEAPON_DAMAGE_SCALING, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$use additive weapon velocity:", AIPF_USE_ADDITIVE_WEAPON_VELOCITY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$use newtonian dampening:", AIPF_USE_NEWTONIAN_DAMPENING, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$include beams for kills and assists:", AIPF_INCLUDE_BEAMS_IN_STAT_CALCS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$score kills based on damage caused:", AIPF_KILL_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$score assists based on damage caused:", AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow event and goal scoring in multiplayer:", AIPF_ALLOW_MULTI_EVENT_SCORING, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$fix linked primary weapon decision bug:", AIPF_FIX_LINKED_PRIMARY_BUG, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$prevent turrets targeting too distant bombs:", AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$smart subsystem targeting for turrets:", AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$fix heat seekers homing on stealth ships bug:", AIPF_FIX_HEAT_SEEKER_STEALTH_BUG, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$multi allow empty primaries:", AIPF_MULTI_ALLOW_EMPTY_PRIMARIES, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$multi allow empty secondaries:", AIPF_MULTI_ALLOW_EMPTY_SECONDARIES, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow turrets target weapons freely:", AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$use only single fov for turrets:", AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$allow vertical dodge:", AIPF_ALLOW_VERTICAL_DODGE, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$force beam turrets to use normal fov:", AIPF_FORCE_BEAM_TURRET_FOV, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$fix ai class bug:", AIPF_FIX_AI_CLASS_BUG, AIP_FLAG);
|
||||
|
||||
set_flag(profile, "$turrets ignore targets radius in range checks:", AIPF2_TURRETS_IGNORE_TARGET_RADIUS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$no extra collision avoidance vs player:", AIPF2_NO_SPECIAL_PLAYER_AVOID, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$perform less checks for death screams:", AIPF2_PERFORM_LESS_SCREAM_CHECKS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$advanced turret fov edge checks:", AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$require turrets to have target in fov:", AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$all ships manage shields:", AIPF2_ALL_SHIPS_MANAGE_SHIELDS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$ai aims from ship center:", AIPF2_AI_AIMS_FROM_SHIP_CENTER, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$allow primary link delay:", AIPF2_ALLOW_PRIMARY_LINK_DELAY, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$allow beams to damage bombs:", AIPF2_BEAMS_DAMAGE_WEAPONS, AIP_FLAG2);
|
||||
|
||||
set_flag(profile, "$disable weapon damage scaling for player:", AIPF2_PLAYER_WEAPON_SCALE_FIX, AIP_FLAG2);
|
||||
|
||||
profile->ai_path_mode = AI_PATH_MODE_NORMAL;
|
||||
if(optional_string("$ai path mode:"))
|
||||
{
|
||||
stuff_string(buf, F_NAME, NAME_LENGTH);
|
||||
int j = ai_path_type_match(buf);
|
||||
if(j >= 0) {
|
||||
profile->ai_path_mode = j;
|
||||
} else {
|
||||
Warning(LOCATION, "Invalid ai path mode '%s' specified", buf);
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Default weapon select effect:")) {
|
||||
char effect[NAME_LENGTH];
|
||||
stuff_string(effect, F_NAME, NAME_LENGTH);
|
||||
if (!stricmp(effect, "FS1"))
|
||||
Default_weapon_select_effect = 1;
|
||||
if (!stricmp(effect, "off"))
|
||||
Default_weapon_select_effect = 0;
|
||||
}
|
||||
|
||||
if (optional_string("$Default ship select effect:")) {
|
||||
char effect[NAME_LENGTH];
|
||||
stuff_string(effect, F_NAME, NAME_LENGTH);
|
||||
if (!stricmp(effect, "FS1"))
|
||||
Default_ship_select_effect = 1;
|
||||
if (!stricmp(effect, "off"))
|
||||
Default_ship_select_effect = 0;
|
||||
}
|
||||
|
||||
set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
|
||||
|
||||
// if we've been through once already and are at the same place, force a move
|
||||
if ( saved_Mp && (saved_Mp == Mp) )
|
||||
{
|
||||
char buf[60];
|
||||
memset(buf, 0, 60);
|
||||
strncpy(buf, Mp, 59);
|
||||
mprintf(("WARNING: Unrecognized parameter in ai_profiles: %s\n", buf));
|
||||
|
||||
Mp++;
|
||||
}
|
||||
|
||||
// find next valid option
|
||||
skip_to_start_of_string_either("$", "#");
|
||||
saved_Mp = Mp;
|
||||
}
|
||||
}
|
||||
|
||||
required_string("#End");
|
||||
|
||||
// add tbl/tbm to multiplayer validation list
|
||||
extern void fs2netd_add_table_validation(char *tblname);
|
||||
fs2netd_add_table_validation(filename);
|
||||
|
||||
// close localization
|
||||
lcl_ext_close();
|
||||
}
|
||||
|
||||
void ai_profiles_init()
|
||||
{
|
||||
int temp;
|
||||
|
||||
if (Ai_profiles_initted)
|
||||
return;
|
||||
|
||||
Num_ai_profiles = 0;
|
||||
Default_ai_profile = 0;
|
||||
Default_profile_name[0] = '\0';
|
||||
|
||||
// init retail entry first
|
||||
parse_ai_profiles_tbl(NULL);
|
||||
|
||||
// now parse the supplied table (if any)
|
||||
if (cf_exists_full("ai_profiles.tbl", CF_TYPE_TABLES))
|
||||
parse_ai_profiles_tbl("ai_profiles.tbl");
|
||||
|
||||
// parse any modular tables
|
||||
parse_modular_table("*-aip.tbm", parse_ai_profiles_tbl);
|
||||
|
||||
// set default if specified
|
||||
temp = ai_profile_lookup(Default_profile_name);
|
||||
if (temp >= 0)
|
||||
Default_ai_profile = temp;
|
||||
|
||||
Ai_profiles_initted = 1;
|
||||
}
|
||||
|
||||
int ai_profile_lookup(char *name)
|
||||
{
|
||||
for (int i = 0; i < Num_ai_profiles; i++)
|
||||
if (!stricmp(name, Ai_profiles[i].profile_name))
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
/*
|
||||
* Created by Ian "Goober5000" Warfield for the FreeSpace2 Source Code Project.
|
||||
* You may not sell or otherwise commercially exploit the source or things you
|
||||
* create based on the source.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _AI_PROFILES_H_
|
||||
#define _AI_PROFILES_H_
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
|
||||
// flag int defines
|
||||
#define AIP_FLAG 1
|
||||
#define AIP_FLAG2 2
|
||||
|
||||
// flags
|
||||
#define AIPF_SMART_SHIELD_MANAGEMENT (1 << 0)
|
||||
#define AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS (1 << 1)
|
||||
#define AIPF_SMART_PRIMARY_WEAPON_SELECTION (1 << 2)
|
||||
#define AIPF_SMART_SECONDARY_WEAPON_SELECTION (1 << 3)
|
||||
#define AIPF_ALLOW_RAPID_SECONDARY_DUMBFIRE (1 << 4)
|
||||
#define AIPF_HUGE_TURRET_WEAPONS_IGNORE_BOMBS (1 << 5)
|
||||
#define AIPF_DONT_INSERT_RANDOM_TURRET_FIRE_DELAY (1 << 6)
|
||||
#define AIPF_HACK_IMPROVE_NON_HOMING_SWARM_TURRET_FIRE_ACCURACY (1 << 7)
|
||||
#define AIPF_SHOCKWAVES_DAMAGE_SMALL_SHIP_SUBSYSTEMS (1 << 8)
|
||||
#define AIPF_NAVIGATION_SUBSYS_GOVERNS_WARP (1 << 9)
|
||||
#define AIPF_NO_MIN_DOCK_SPEED_CAP (1 << 10)
|
||||
#define AIPF_DISABLE_LINKED_FIRE_PENALTY (1 << 11)
|
||||
#define AIPF_DISABLE_WEAPON_DAMAGE_SCALING (1 << 12)
|
||||
#define AIPF_USE_ADDITIVE_WEAPON_VELOCITY (1 << 13)
|
||||
#define AIPF_USE_NEWTONIAN_DAMPENING (1 << 14)
|
||||
#define AIPF_INCLUDE_BEAMS_IN_STAT_CALCS (1 << 15)
|
||||
#define AIPF_KILL_SCORING_SCALES_WITH_DAMAGE (1 << 16)
|
||||
#define AIPF_ASSIST_SCORING_SCALES_WITH_DAMAGE (1 << 17)
|
||||
#define AIPF_ALLOW_MULTI_EVENT_SCORING (1 << 18)
|
||||
#define AIPF_SMART_AFTERBURNER_MANAGEMENT (1 << 19)
|
||||
#define AIPF_FIX_LINKED_PRIMARY_BUG (1 << 20)
|
||||
#define AIPF_PREVENT_TARGETING_BOMBS_BEYOND_RANGE (1 << 21)
|
||||
#define AIPF_SMART_SUBSYSTEM_TARGETING_FOR_TURRETS (1 << 22)
|
||||
#define AIPF_FIX_HEAT_SEEKER_STEALTH_BUG (1 << 23)
|
||||
#define AIPF_MULTI_ALLOW_EMPTY_PRIMARIES (1 << 24)
|
||||
#define AIPF_MULTI_ALLOW_EMPTY_SECONDARIES (1 << 25)
|
||||
#define AIPF_ALLOW_TURRETS_TARGET_WEAPONS_FREELY (1 << 26)
|
||||
#define AIPF_USE_ONLY_SINGLE_FOV_FOR_TURRETS (1 << 27)
|
||||
#define AIPF_ALLOW_VERTICAL_DODGE (1 << 28) //Allows AI ships to evade weapons vertically as well as horizontally
|
||||
#define AIPF_FORCE_BEAM_TURRET_FOV (1 << 29)
|
||||
#define AIPF_FIX_AI_CLASS_BUG (1 << 30)
|
||||
|
||||
// flags2
|
||||
#define AIPF2_TURRETS_IGNORE_TARGET_RADIUS (1 << 0)
|
||||
#define AIPF2_NO_SPECIAL_PLAYER_AVOID (1 << 1)
|
||||
#define AIPF2_PERFORM_LESS_SCREAM_CHECKS (1 << 2)
|
||||
#define AIPF2_ALL_SHIPS_MANAGE_SHIELDS (1 << 3)
|
||||
#define AIPF2_ADVANCED_TURRET_FOV_EDGE_CHECKS (1 << 4)
|
||||
#define AIPF2_REQUIRE_TURRET_TO_HAVE_TARGET_IN_FOV (1 << 5)
|
||||
#define AIPF2_AI_AIMS_FROM_SHIP_CENTER (1 << 6)
|
||||
#define AIPF2_ALLOW_PRIMARY_LINK_DELAY (1 << 7)
|
||||
#define AIPF2_BEAMS_DAMAGE_WEAPONS (1 << 8)
|
||||
#define AIPF2_PLAYER_WEAPON_SCALE_FIX (1 << 9)
|
||||
#define AIPF2_NO_WARP_CAMERA (1 << 10)
|
||||
|
||||
// AI Path types
|
||||
#define AI_PATH_MODE_NORMAL 0
|
||||
#define AI_PATH_MODE_ALT1 1
|
||||
|
||||
#define MAX_AI_PROFILES 5
|
||||
|
||||
typedef struct ai_profile_t {
|
||||
|
||||
char profile_name[NAME_LENGTH];
|
||||
|
||||
int flags;
|
||||
int flags2;
|
||||
|
||||
// difficulty-related values
|
||||
int max_incoming_asteroids[NUM_SKILL_LEVELS]; // max number of asteroids thrown at friendlies
|
||||
int max_allowed_player_homers[NUM_SKILL_LEVELS]; // max number of simultaneous homing weapons on player
|
||||
int max_attackers[NUM_SKILL_LEVELS]; // max number of ships that can attack a ship
|
||||
fix predict_position_delay[NUM_SKILL_LEVELS]; // how long until AI predicts a ship position
|
||||
float in_range_time[NUM_SKILL_LEVELS]; // seconds to add to time it takes to get enemy in range (only for player's enemies)
|
||||
float shield_manage_delay[NUM_SKILL_LEVELS]; // how long before AI manages shields (note that the player's team always uses the average skill's delay)
|
||||
|
||||
// AI ships link primaries if energy levels greater than these percents
|
||||
float link_energy_levels_always[NUM_SKILL_LEVELS]; // always link
|
||||
float link_energy_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low
|
||||
|
||||
// AI ships link primaries if ammunition levels greater than these percents
|
||||
float link_ammo_levels_always[NUM_SKILL_LEVELS]; // always link
|
||||
float link_ammo_levels_maybe[NUM_SKILL_LEVELS]; // link if hull strength low
|
||||
float primary_ammo_burst_mult[NUM_SKILL_LEVELS]; // SUSHI: Multiplier adjusting burst frequency for ballistic primary weapons
|
||||
|
||||
// difficulty-related scales
|
||||
float cmeasure_life_scale[NUM_SKILL_LEVELS]; // life of countermeasures
|
||||
float cmeasure_fire_chance[NUM_SKILL_LEVELS]; // chance a countermeasure will be fired based on skill level (also scaled by ai_class)
|
||||
float weapon_energy_scale[NUM_SKILL_LEVELS]; // weapon energy available
|
||||
float shield_energy_scale[NUM_SKILL_LEVELS]; // shield energy available
|
||||
float afterburner_recharge_scale[NUM_SKILL_LEVELS]; // speed of afterburner recharge
|
||||
float player_damage_scale[NUM_SKILL_LEVELS]; // damage applied to the player
|
||||
|
||||
float subsys_damage_scale[NUM_SKILL_LEVELS]; // damage applied to a player subsystem
|
||||
float beam_friendly_damage_cap[NUM_SKILL_LEVELS]; // damage cap values for friendly beam fire
|
||||
float turn_time_scale[NUM_SKILL_LEVELS]; // speed at which enemy ships turn
|
||||
float glide_attack_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "glide attack" move
|
||||
float circle_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use the "circle strafe" move
|
||||
float glide_strafe_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to use glide when strafing capships
|
||||
float random_sidethrust_percent[NUM_SKILL_LEVELS]; // SUSHI: The likelihood (0.0-1.0) of the AI to randomly use sidethrust while dogfihthing
|
||||
float stalemate_time_thresh[NUM_SKILL_LEVELS]; // SUSHI: The amount of time required for the AI to detect (and try to break) dogfight stalemate
|
||||
float stalemate_dist_thresh[NUM_SKILL_LEVELS]; // SUSHI: The maximum distance the AI and target must be within for a stalemate
|
||||
float max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: The maximum delay before the AI updates their aim against small ships
|
||||
float turret_max_aim_update_delay[NUM_SKILL_LEVELS]; // SUSHI: As above, but for turrets updating their aim
|
||||
|
||||
// Multiplicative delay factors for increasing skill levels.
|
||||
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS];
|
||||
float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS];
|
||||
|
||||
// Multiplicative secondary delay factors for increasing skill levels.
|
||||
float ship_fire_secondary_delay_scale_hostile[NUM_SKILL_LEVELS];
|
||||
float ship_fire_secondary_delay_scale_friendly[NUM_SKILL_LEVELS];
|
||||
|
||||
// Maximum turrets of one ship allowed to shoot the same target
|
||||
int max_turret_ownage_target[NUM_SKILL_LEVELS];
|
||||
int max_turret_ownage_player[NUM_SKILL_LEVELS];
|
||||
|
||||
// percentage of damage caused required for a kill/assist
|
||||
float kill_percentage_scale[NUM_SKILL_LEVELS];
|
||||
float assist_percentage_scale[NUM_SKILL_LEVELS];
|
||||
|
||||
// percentage of the capships score given to other team mates on a kill
|
||||
float assist_award_percentage_scale[NUM_SKILL_LEVELS];
|
||||
|
||||
// the number of points subtracted from score for a rearm started on a player
|
||||
int repair_penalty[NUM_SKILL_LEVELS];
|
||||
|
||||
float delay_bomb_arm_timer[NUM_SKILL_LEVELS];
|
||||
|
||||
// the chance (x/7) that ship is allowed to fire missiles at player ship.
|
||||
int chance_to_use_missiles_on_plr[NUM_SKILL_LEVELS];
|
||||
|
||||
// Player-specific autoaim FOV override
|
||||
float player_autoaim_fov[NUM_SKILL_LEVELS];
|
||||
|
||||
float detail_distance_mult[MAX_DETAIL_LEVEL + 1]; //MAX_DETAIL_LEVEL really needs to be 4
|
||||
|
||||
int ai_path_mode;
|
||||
|
||||
} ai_profile_t;
|
||||
|
||||
|
||||
extern int Num_ai_profiles;
|
||||
extern int Default_ai_profile;
|
||||
extern ai_profile_t Ai_profiles[MAX_AI_PROFILES];
|
||||
|
||||
|
||||
void ai_profiles_init();
|
||||
|
||||
int ai_profile_lookup(char *name);
|
||||
|
||||
#endif
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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 __AIBIG_H__
|
||||
#define __AIBIG_H__
|
||||
|
||||
struct object;
|
||||
struct ai_info;
|
||||
struct vec3d;
|
||||
struct ship_subsys;
|
||||
|
||||
void ai_big_ship(object *objp);
|
||||
void ai_big_chase();
|
||||
void ai_big_subsys_path_cleanup(ai_info *aip);
|
||||
|
||||
// strafe functions
|
||||
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, 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
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* 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 _AIGOALS_H
|
||||
#define _AIGOALS_H
|
||||
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
struct wing;
|
||||
struct ai_info;
|
||||
struct ai_goal;
|
||||
|
||||
// macros for goals which get set via sexpressions in the mission code
|
||||
|
||||
// IMPORTANT! If you add a new AI_GOAL_x define, be sure to update the functions
|
||||
// ai_update_goal_references() and query_referenced_in_ai_goals() or else risk breaking
|
||||
// Fred. If the goal you add doesn't have a target (such as chase_any), then you don't have
|
||||
// to worry about doing this. Also add it to list in Fred\Management.cpp, and let Hoffoss know!
|
||||
// WMC - Oh and add them to Ai_goal_names plz. TY! :)
|
||||
#define AI_GOAL_CHASE (1<<1) // 0x00000002
|
||||
#define AI_GOAL_DOCK (1<<2) // 0x00000004 // used for undocking as well
|
||||
#define AI_GOAL_WAYPOINTS (1<<3) // 0x00000008
|
||||
#define AI_GOAL_WAYPOINTS_ONCE (1<<4) // 0x00000010
|
||||
#define AI_GOAL_WARP (1<<5) // 0x00000020
|
||||
#define AI_GOAL_DESTROY_SUBSYSTEM (1<<6) // 0x00000040
|
||||
#define AI_GOAL_FORM_ON_WING (1<<7) // 0x00000080
|
||||
#define AI_GOAL_UNDOCK (1<<8) // 0x00000100
|
||||
#define AI_GOAL_CHASE_WING (1<<9) // 0x00000200
|
||||
#define AI_GOAL_GUARD (1<<10) // 0x00000400
|
||||
#define AI_GOAL_DISABLE_SHIP (1<<11) // 0x00000800
|
||||
#define AI_GOAL_DISARM_SHIP (1<<12) // 0x00001000
|
||||
#define AI_GOAL_CHASE_ANY (1<<13) // 0x00002000
|
||||
#define AI_GOAL_IGNORE (1<<14) // 0x00004000
|
||||
#define AI_GOAL_GUARD_WING (1<<15) // 0x00008000
|
||||
#define AI_GOAL_EVADE_SHIP (1<<16) // 0x00010000
|
||||
|
||||
// the next goals are for support ships only
|
||||
#define AI_GOAL_STAY_NEAR_SHIP (1<<17) // 0x00020000
|
||||
#define AI_GOAL_KEEP_SAFE_DISTANCE (1<<18) // 0x00040000
|
||||
#define AI_GOAL_REARM_REPAIR (1<<19) // 0x00080000
|
||||
|
||||
// resume regular goals
|
||||
#define AI_GOAL_STAY_STILL (1<<20) // 0x00100000
|
||||
#define AI_GOAL_PLAY_DEAD (1<<21) // 0x00200000
|
||||
#define AI_GOAL_CHASE_WEAPON (1<<22) // 0x00400000
|
||||
|
||||
#define AI_GOAL_FLY_TO_SHIP (1<<23) // 0x00800000
|
||||
#define AI_GOAL_IGNORE_NEW (1<<24) // 0x01000000
|
||||
|
||||
// now the masks for ship types
|
||||
|
||||
// Goober5000: added AI_GOAL_STAY_NEAR_SHIP and AI_GOAL_KEEP_SAFE_DISTANCE as valid for fighters
|
||||
//WMC - Don't need these anymore. Whee!
|
||||
/*
|
||||
#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_IGNORE_NEW | 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 )
|
||||
#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
|
||||
|
||||
typedef flag_def_list ai_goal_list;
|
||||
|
||||
extern ai_goal_list Ai_goal_names[];
|
||||
extern int Num_ai_goals;
|
||||
|
||||
extern int Num_ai_dock_names;
|
||||
extern char Ai_dock_names[MAX_AI_DOCK_NAMES][NAME_LENGTH];
|
||||
|
||||
extern char *Ai_goal_text(int goal);
|
||||
|
||||
// extern function definitions
|
||||
extern void ai_post_process_mission();
|
||||
extern void ai_maybe_add_form_goal( wing *wingp );
|
||||
extern void ai_process_mission_orders( int objnum, ai_info *aip );
|
||||
|
||||
extern int ai_goal_num(ai_goal *goals);
|
||||
|
||||
// adds goals to ships/wing through sexpressions
|
||||
extern void ai_add_ship_goal_scripting(int mode, int submode, int priority, char *shipname, ai_info *aip);
|
||||
extern void ai_add_ship_goal_sexp( int sexp, int type, ai_info *aip );
|
||||
extern void ai_add_wing_goal_sexp( int sexp, int type, int wingnum );
|
||||
extern void ai_add_goal_sub_sexp( int sexp, int type, ai_goal *aigp );
|
||||
|
||||
extern int ai_remove_goal_sexp_sub( int sexp, ai_goal* aigp );
|
||||
extern void ai_remove_wing_goal_sexp(int sexp, int wingnum);
|
||||
|
||||
// adds goals to ships/sings through player orders
|
||||
extern void ai_add_ship_goal_player( int type, int mode, int submode, char *shipname, ai_info *aip );
|
||||
extern void ai_add_wing_goal_player( int type, int mode, int submode, char *shipname, int wingnum );
|
||||
|
||||
extern void ai_remove_ship_goal( ai_info *aip, int index );
|
||||
extern void ai_clear_ship_goals( ai_info *aip );
|
||||
extern void ai_clear_wing_goals( int wingnum );
|
||||
|
||||
extern void ai_copy_mission_wing_goal( ai_goal *aigp, ai_info *aip );
|
||||
|
||||
extern void ai_mission_goal_complete( ai_info *aip );
|
||||
extern void ai_mission_wing_goal_complete( int wingnum, ai_goal *remove_goalp );
|
||||
|
||||
extern void ai_update_goal_references(ai_goal *goals, int type, char *old_name, char *new_name);
|
||||
extern int query_referenced_in_ai_goals(ai_goal *goals, int type, char *name);
|
||||
extern char *ai_add_dock_name(char *str);
|
||||
|
||||
extern int ai_query_goal_valid( int ship, int ai_goal );
|
||||
|
||||
extern void ai_add_goal_ship_internal( ai_info *aip, int goal_type, char *name, int docker_point, int dockee_point, int immediate = 1 );
|
||||
extern void ai_add_goal_wing_internal( wing *wingp, int goal_type, char *name, int immediate = 1 );
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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 __ANIMPLAY_H__
|
||||
#define __ANIMPLAY_H__
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
struct anim;
|
||||
struct anim_info;
|
||||
struct anim_instance;
|
||||
|
||||
// structure passed in when playing an anim. Talk about overkill..
|
||||
typedef struct {
|
||||
anim *anim_info;
|
||||
int x;
|
||||
int y;
|
||||
int base_w;
|
||||
int base_h;
|
||||
int start_at;
|
||||
int stop_at;
|
||||
int screen_id;
|
||||
vec3d *world_pos;
|
||||
float radius;
|
||||
int framerate_independent;
|
||||
void *color;
|
||||
int skip_frames;
|
||||
int looped;
|
||||
int ping_pong;
|
||||
} anim_play_struct;
|
||||
|
||||
enum
|
||||
{
|
||||
PAGE_FROM_MEM = 0,
|
||||
PAGE_FROM_DISK = 1,
|
||||
PAGE_FROM_DISK_FORCED = 2
|
||||
};
|
||||
|
||||
extern int Anim_paused;
|
||||
|
||||
void anim_init();
|
||||
void anim_level_init();
|
||||
void anim_level_close();
|
||||
void anim_render_all(int screen_id, float frametime);
|
||||
void anim_render_one(int screen_id, anim_instance *ani, float frametime);
|
||||
void anim_play_init(anim_play_struct *aps, anim *a_info, int x, int y, int max_x = -1, int max_y = -1);
|
||||
anim_instance *anim_play(anim_play_struct *aps);
|
||||
void anim_ignore_next_frametime();
|
||||
int anim_stop_playing(anim_instance* anim_instance);
|
||||
int anim_show_next_frame(anim_instance *instance, float frametime);
|
||||
void anim_release_all_instances(int screen_id = 0);
|
||||
void anim_release_render_instance(anim_instance* instance);
|
||||
anim *anim_load(char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_MEM);
|
||||
int anim_free(anim *ptr);
|
||||
int anim_playing(anim_instance *ai);
|
||||
int anim_write_frames_out(char *filename);
|
||||
void anim_display_info(char *filename);
|
||||
void anim_read_header(anim *ptr, CFILE *fp);
|
||||
void anim_reverse_direction(anim_instance *ai); // called automatically for ping-ponging, and can also be called externally
|
||||
void anim_pause(anim_instance *ai);
|
||||
void anim_unpause(anim_instance *ai);
|
||||
|
||||
int anim_instance_is_streamed(anim_instance *ai);
|
||||
unsigned char anim_instance_get_byte(anim_instance *ai, int offset);
|
||||
|
||||
#endif /* __ANIMPLAY_H__ */
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* 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 __PACKUNPACK_H__
|
||||
#define __PACKUNPACK_H__
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
struct CFILE;
|
||||
|
||||
#define ANI_STREAM_CACHE_SIZE 4096
|
||||
|
||||
#define PACKER_CODE 0xEE /// Used by PACKING_METHOD_RLE
|
||||
#define PACKING_METHOD_RLE 0 /// Hoffoss's RLE format
|
||||
#define PACKING_METHOD_RLE_KEY 1 /// Hoffoss's key frame RLE format
|
||||
#define PACKING_METHOD_STD_RLE 2 /// Standard RLE format (high bit is count)
|
||||
#define PACKING_METHOD_STD_RLE_KEY 3 /// Standard RLE format key frame
|
||||
|
||||
#define STD_RLE_CODE 0x80
|
||||
|
||||
typedef struct key_frame {
|
||||
int frame_num; // which frame number this key frame is
|
||||
int offset; // offset from the start of data block
|
||||
} key_frame;
|
||||
|
||||
#define ANF_MEM_MAPPED (1<<0) // animation is memory-mapped file
|
||||
#define ANF_STREAMED (1<<1)
|
||||
#define ANF_XPARENT (1<<2) // animation has transparency
|
||||
#define ANF_ALL_KEYFRAMES (1<<3) // all the frames are keyframes (this is necessary if we want to play the file backwards)
|
||||
|
||||
typedef struct anim {
|
||||
anim *next;
|
||||
char name[MAX_PATH_LEN];
|
||||
ubyte packer_code;
|
||||
int width;
|
||||
int height;
|
||||
int total_frames;
|
||||
int instance_count; // number of instances that are currently playing
|
||||
int ref_count; // number of times this anim has been loaded
|
||||
float time; // playback time in seconds
|
||||
int num_keys;
|
||||
key_frame *keys;
|
||||
ubyte palette[768];
|
||||
ubyte palette_translation[256];
|
||||
ubyte *data; // points to compressed data
|
||||
CFILE* cfile_ptr;
|
||||
int version;
|
||||
int fps;
|
||||
ubyte xparent_r; // red component for the transparent color in source image
|
||||
ubyte xparent_g; // green component for the transparent color in source image
|
||||
ubyte xparent_b; // blue component for the transparent color in source image
|
||||
int flags;
|
||||
uint screen_sig;
|
||||
int file_offset; // file offset to start of frame data
|
||||
int cache_file_offset;
|
||||
ubyte *cache;
|
||||
} anim;
|
||||
|
||||
// the direction to play the anim (forwards or backwards)
|
||||
#define ANIM_DIRECT_FORWARD 0
|
||||
#define ANIM_DIRECT_REVERSE 1
|
||||
|
||||
typedef struct anim_instance {
|
||||
anim_instance *next, *prev;
|
||||
int x,y; // coordinates anim is played at (top left corner of anim)
|
||||
int base_w, base_h; // coordinate scale this anim is played in.
|
||||
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
|
||||
anim *parent; // pointer to anim structure, which holds compressed data
|
||||
ubyte *data; // pointer to next frame's compressed data
|
||||
ubyte *frame; // uncompressed frame
|
||||
float time_elapsed; // how long the anim has played for (in seconds)
|
||||
int start_at; // frame anim playing should start
|
||||
int stop_at; // frame anim playing should stop
|
||||
int framerate_independent; // animation should play back in same amount of time, regardless
|
||||
int skip_frames; // should anim skip frames during framerate independent playback
|
||||
int looped; // should anim keep playing over and over...
|
||||
int stop_now; // flag to indicate time to stop the animation
|
||||
int last_bitmap; // id of last bitmap that was rendered out from animation
|
||||
int screen_id; // 0 means all screens should render, otherwise screen specific
|
||||
void *aa_color; // anti-aliased bitmap color
|
||||
int xlate_pal;
|
||||
int direction; // playing forwards or backwards ?
|
||||
int ping_pong; // should be played ping-pong style
|
||||
int paused; // pause the anim
|
||||
int file_offset; // current offset into frame (like data, put offset into file)
|
||||
int loop_count; // starts at 0, and is incremented each time it loops
|
||||
} anim_instance;
|
||||
|
||||
int pack_key_frame(ubyte *frame, ubyte *save, long size, long max, int compress_type);
|
||||
int pack_frame(ubyte *frame, ubyte *frame2, ubyte *save, long size, long max, int compress_type);
|
||||
|
||||
ubyte *unpack_frame(anim_instance *ai, ubyte *ptr, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp);
|
||||
int unpack_frame_from_file(anim_instance *ai, ubyte *frame, int size, ubyte *pal_translate, int aabitmap, int bpp);
|
||||
|
||||
void anim_init();
|
||||
anim_instance *init_anim_instance(anim *ptr, int bpp);
|
||||
void free_anim_instance(anim_instance *inst);
|
||||
int anim_get_next_frame(anim_instance *inst);
|
||||
ubyte *anim_get_next_raw_buffer(anim_instance *inst, int xlate_pal, int aabitmap, int bpp);
|
||||
void anim_set_palette(anim *a);
|
||||
void anim_check_for_palette_change(anim_instance *inst);
|
||||
|
||||
|
||||
#endif /* __PACKUNPACK_H__ */
|
||||
@@ -1,161 +0,0 @@
|
||||
/*
|
||||
* 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 __ASTEROID_H__
|
||||
#define __ASTEROID_H__
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h" // for NAME_LENGTH
|
||||
|
||||
|
||||
struct object;
|
||||
struct polymodel;
|
||||
struct collision_info_struct;
|
||||
|
||||
#define MAX_ASTEROIDS 512
|
||||
|
||||
#define NUM_DEBRIS_SIZES 3
|
||||
#define NUM_DEBRIS_POFS 3 // Number of POFs per debris size
|
||||
|
||||
#define ASTEROID_TYPE_SMALL 0
|
||||
#define ASTEROID_TYPE_MEDIUM 1
|
||||
#define ASTEROID_TYPE_LARGE 2
|
||||
|
||||
// these should always be equal for the benefit of generic asteroids (c.f. asteroid_page_in)
|
||||
#define MAX_ACTIVE_DEBRIS_TYPES NUM_DEBRIS_SIZES
|
||||
|
||||
// Goober5000 - currently same as MAX_SHIP_DETAIL_LEVELS (put here to avoid an #include)
|
||||
#define MAX_ASTEROID_DETAIL_LEVELS 5
|
||||
|
||||
|
||||
// Data structure to track the active asteroids
|
||||
typedef struct asteroid_obj {
|
||||
asteroid_obj *next, *prev;
|
||||
int flags, objnum;
|
||||
} asteroid_obj;
|
||||
extern asteroid_obj Asteroid_obj_list;
|
||||
|
||||
|
||||
// Data structure for determining a type and amount of other asteroids an
|
||||
// asteroid will split to when destroyed.
|
||||
typedef struct asteroid_split_info {
|
||||
int asteroid_type;
|
||||
int min;
|
||||
int max;
|
||||
} asteroid_split_info;
|
||||
|
||||
typedef struct asteroid_info {
|
||||
char name[NAME_LENGTH]; // name for the asteroid
|
||||
char pof_files[NUM_DEBRIS_POFS][MAX_FILENAME_LEN]; // POF files to load/associate with ship
|
||||
int num_detail_levels; // number of detail levels for this ship
|
||||
int detail_distance[MAX_ASTEROID_DETAIL_LEVELS]; // distance to change detail levels at
|
||||
float max_speed; // cap on speed for asteroid
|
||||
int damage_type_idx; //Damage type of the asteroid
|
||||
int damage_type_idx_sav; // stored value from table used to reset damage_type_idx
|
||||
float inner_rad; // radius within which maximum area effect damage is applied
|
||||
float outer_rad; // radius at which no area effect damage is applied
|
||||
float damage; // maximum damage applied from area effect explosion
|
||||
float blast; // maximum blast impulse from area effect explosion
|
||||
float initial_asteroid_strength; // starting strength of asteroid
|
||||
SCP_vector< asteroid_split_info > split_info;
|
||||
polymodel *modelp[NUM_DEBRIS_POFS];
|
||||
int model_num[NUM_DEBRIS_POFS];
|
||||
SCP_vector<int> explosion_bitmap_anims;
|
||||
float fireball_radius_multiplier; // the model radius is multiplied by this to determine the fireball size
|
||||
|
||||
asteroid_info( )
|
||||
: num_detail_levels( 0 ), max_speed( 0 ), damage_type_idx( 0 ),
|
||||
damage_type_idx_sav( -1 ), inner_rad( 0 ), outer_rad( 0 ),
|
||||
damage( 0 ), blast( 0 ), initial_asteroid_strength( 0 ),
|
||||
fireball_radius_multiplier( -1 )
|
||||
{
|
||||
name[ 0 ] = NULL;
|
||||
memset( pof_files, 0, sizeof( pof_files ) );
|
||||
memset( detail_distance, 0, sizeof( detail_distance ) );
|
||||
memset( modelp, 0, sizeof( modelp ) );
|
||||
memset( model_num, 0, sizeof( model_num ) );
|
||||
}
|
||||
} asteroid_info;
|
||||
|
||||
|
||||
#define AF_USED (1<<0) // Set means used.
|
||||
|
||||
typedef struct asteroid {
|
||||
int flags;
|
||||
int objnum;
|
||||
int asteroid_type; // 0..MAX_DEBRIS_TYPES
|
||||
int asteroid_subtype; // Index in asteroid_info for modelnum and modelp
|
||||
int check_for_wrap; // timestamp to check for asteroid wrapping around field
|
||||
int check_for_collide; // timestamp to check for asteroid colliding with escort ships
|
||||
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
|
||||
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 DEBRIS TYPE
|
||||
typedef enum {
|
||||
DG_ASTEROID,
|
||||
DG_SHIP
|
||||
} debris_genre_t;
|
||||
|
||||
// TYPEDEF FOR FIELD TYPE
|
||||
typedef enum {
|
||||
FT_ACTIVE,
|
||||
FT_PASSIVE
|
||||
} field_type_t;
|
||||
|
||||
typedef struct asteroid_field {
|
||||
vec3d min_bound; // Minimum range of field.
|
||||
vec3d max_bound; // Maximum range of field.
|
||||
int has_inner_bound;
|
||||
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
|
||||
debris_genre_t debris_genre; // type of debris (ship or asteroid) [generic type]
|
||||
int field_debris_type[MAX_ACTIVE_DEBRIS_TYPES]; // one of the debris type defines above
|
||||
} asteroid_field;
|
||||
|
||||
extern SCP_vector< asteroid_info > Asteroid_info;
|
||||
extern asteroid Asteroids[MAX_ASTEROIDS];
|
||||
extern asteroid_field Asteroid_field;
|
||||
|
||||
extern int Num_asteroids;
|
||||
extern int Asteroids_enabled;
|
||||
|
||||
void asteroid_init();
|
||||
void asteroid_level_init();
|
||||
void asteroid_level_close();
|
||||
void asteroid_create_all();
|
||||
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, 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(vec3d *pos, vec3d *dir, float ang, int danger = 0);
|
||||
|
||||
// need to extern for multiplayer
|
||||
void asteroid_sub_create(object *parent_objp, int asteroid_type, vec3d *relvec);
|
||||
|
||||
void asteroid_frame();
|
||||
|
||||
#endif // __ASTEROID_H__
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,283 +0,0 @@
|
||||
/*
|
||||
* 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 _BMPMAN_H
|
||||
#define _BMPMAN_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define BMPMAN_NDEBUG
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
|
||||
#define BMP_AABITMAP (1<<0) // antialiased bitmap
|
||||
#define BMP_TEX_XPARENT (1<<1) // transparent texture
|
||||
#define BMP_TEX_OTHER (1<<2) // so we can identify all "normal" textures
|
||||
#define BMP_TEX_DXT1 (1<<3) // dxt1 compressed 8r8g8b1a (24bit)
|
||||
#define BMP_TEX_DXT3 (1<<4) // dxt3 compressed 8r8g8b4a (32bit)
|
||||
#define BMP_TEX_DXT5 (1<<5) // dxt5 compressed 8r8g8b8a (32bit)
|
||||
#define BMP_TEX_CUBEMAP (1<<6) // a texture made for cubic environment map
|
||||
// ***** NOTE: bitmap.flags is an 8-bit value, no more BMP_TEX_* flags can be added unless the type is changed!! ******
|
||||
|
||||
//compressed texture types
|
||||
#define BMP_TEX_COMP ( BMP_TEX_DXT1 | BMP_TEX_DXT3 | BMP_TEX_DXT5 )
|
||||
|
||||
//non compressed textures
|
||||
#define BMP_TEX_NONCOMP ( BMP_TEX_XPARENT | BMP_TEX_OTHER )
|
||||
|
||||
// any texture type
|
||||
#define BMP_TEX_ANY ( BMP_TEX_COMP | BMP_TEX_NONCOMP )
|
||||
|
||||
#define BMP_FLAG_RENDER_TARGET_STATIC (1<<0)
|
||||
#define BMP_FLAG_RENDER_TARGET_DYNAMIC (1<<1)
|
||||
#define BMP_FLAG_CUBEMAP (1<<2)
|
||||
|
||||
typedef struct bitmap {
|
||||
short w, h; // Width and height
|
||||
short rowsize; // What you need to add to go to next row
|
||||
ubyte bpp; // How many bits per pixel it is. (7,8,15,16,24,32) (what is requested)
|
||||
ubyte true_bpp; // How many bits per pixel the image actually is.
|
||||
ubyte flags; // See the BMP_???? defines for values (this isn't for the BMP_FLAG_* stuff)
|
||||
ptr_u data; // Pointer to data, or maybe offset into VRAM.
|
||||
ubyte *palette; // If bpp==8, this is pointer to palette. If the BMP_NO_PALETTE_MAP flag
|
||||
// is not set, this palette just points to the screen palette. (gr_palette)
|
||||
} bitmap;
|
||||
|
||||
|
||||
extern int Bm_paging;
|
||||
|
||||
void bm_init();
|
||||
|
||||
void bm_close();
|
||||
|
||||
int bm_get_cache_slot( int bitmap_id, int separate_ani_frames );
|
||||
|
||||
int bm_get_next_handle();
|
||||
|
||||
void *bm_malloc(int n, int size);
|
||||
|
||||
void bm_update_memory_used(int n, int size);
|
||||
|
||||
// how many bytes of textures are used.
|
||||
extern int bm_texture_ram;
|
||||
|
||||
// This loads a bitmap 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.
|
||||
int bm_load(char * filename);
|
||||
int bm_load(const SCP_string& 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_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
|
||||
// block of data. The data can be in the following formats:
|
||||
// 8 bpp (mapped into game palette)
|
||||
// 32 bpp
|
||||
// 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_create( int bpp, int w, int h, void *data = NULL, 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_unload( int n, int clear_render_targets = 0 );
|
||||
|
||||
// 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, int clear_render_targets = 0 );
|
||||
|
||||
// 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.
|
||||
int bm_release( int n, int clear_render_targets = 0 );
|
||||
|
||||
// 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_load_animation( char * filename, int * nframes = NULL, int *fps = NULL, int *keyframe = NULL, int can_drop_frames = 0, int dir_type = CF_TYPE_ANY );
|
||||
|
||||
//Loads either animation (bm_load_animation) or still image (bm_load)
|
||||
extern int bm_load_either(char *filename, int *nframes = NULL, int *fps = NULL, int *keyframe = 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_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
|
||||
// will also change when the bitmap's data changes.
|
||||
extern uint bm_get_signature( int bitmapnum);
|
||||
|
||||
//gets the image type
|
||||
ubyte bm_get_type(int handle);
|
||||
|
||||
// Unlocks a bitmap
|
||||
extern void bm_unlock( int bitmapnum );
|
||||
|
||||
//WMC - Returns 0 if invalid, nonzero if valid
|
||||
extern int bm_is_valid(int handle);
|
||||
|
||||
// Gets info. w,h,or flags,nframes or fps can be NULL if you don't care.
|
||||
//WMC - Returns -1 on failure, handle or first frame handle on success.
|
||||
int 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);
|
||||
|
||||
// call to load all data for all bitmaps that have been requested to be loaded
|
||||
extern void bm_gfx_load_all();
|
||||
extern void bm_unload_all();
|
||||
|
||||
// call to get the palette for a bitmap
|
||||
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.
|
||||
void bm_gfx_get_pixel( int bitmap, float u, float v, ubyte *r, ubyte *g, ubyte *b );
|
||||
|
||||
// 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_get_frame_usage(int *ntotal, int *nnew);
|
||||
|
||||
/*
|
||||
* Example on using bm_create
|
||||
*
|
||||
{
|
||||
static int test_inited = 0;
|
||||
static int test_bmp;
|
||||
static uint test_bmp_data[128*64];
|
||||
|
||||
if ( !test_inited ) {
|
||||
test_inited = 1;
|
||||
// Create the new bitmap and fill in its data.
|
||||
// When you're done with it completely, call
|
||||
// bm_release to free up the bitmap handle
|
||||
test_bmp = bm_create( 32, 128, 64, test_bmp_data );
|
||||
int i,j;
|
||||
for (i=0; i<64; i++ ) {
|
||||
for (j=0; j<64; j++ ) {
|
||||
uint r=i*4;
|
||||
test_bmp_data[j+i*128] = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bm_unload(test_bmp); // this pages out the data, so that the
|
||||
// next bm_lock will convert the new data to the
|
||||
// correct bpp
|
||||
|
||||
// put in new data
|
||||
int x,y;
|
||||
gr_reset_clip();
|
||||
for (y=0; y<64; y++)
|
||||
for (x=0; x<128; x++ )
|
||||
test_bmp_data[y*128+x] = 15;
|
||||
|
||||
// Draw the bitmap to upper left corner
|
||||
gr_set_bitmap(test_bmp);
|
||||
gr_bitmap( 0,0 );
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//============================================================================
|
||||
// Paging stuff
|
||||
//============================================================================
|
||||
|
||||
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_page_in_texture( int bitmapnum, int num_frames = 0 );
|
||||
|
||||
// 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_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_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
|
||||
// 1 = Low memory ( every other frame of ani's)
|
||||
// 2 = Debug low memory ( only use first frame of each ani )
|
||||
void bm_set_low_mem( int mode );
|
||||
|
||||
char *bm_get_filename(int handle);
|
||||
|
||||
void BM_SELECT_SCREEN_FORMAT();
|
||||
void BM_SELECT_TEX_FORMAT();
|
||||
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_d3d_16_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
void bm_set_components_argb_d3d_32_screen(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
void bm_set_components_argb_d3d_16_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
|
||||
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_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 its 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
|
||||
extern int NORMMAP; // normal mapping
|
||||
extern int HEIGHTMAP; // height map for normal mapping
|
||||
|
||||
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);
|
||||
int bm_has_alpha_channel(int handle);
|
||||
|
||||
void bm_print_bitmaps();
|
||||
|
||||
int bm_make_render_target( int width, int height, int flags );
|
||||
int bm_is_render_target(int bitmap_id);
|
||||
int bm_set_render_target(int handle, int face = -1);
|
||||
|
||||
#endif
|
||||
@@ -1,973 +0,0 @@
|
||||
#include "camera/camera.h"
|
||||
#include "math/vecmat.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "physics/physics.h" //apply_physics
|
||||
#include "globalincs/systemvars.h" //VM_FREECAMERA etc
|
||||
#include "hud/hud.h" //hud_get_draw
|
||||
#include "model/model.h" //polymodel, model_get
|
||||
#include "playerman/player.h" //player_get_padlock_orient
|
||||
#include "ship/ship.h" //compute_slew_matrix
|
||||
#include "graphics/font.h"
|
||||
|
||||
//*************************IMPORTANT GLOBALS*************************
|
||||
float VIEWER_ZOOM_DEFAULT = 0.75f; // Default viewer zoom, 0.625 as per multi-lateral agreement on 3/24/97
|
||||
float Sexp_fov = 0.0f;
|
||||
warp_camera Warp_camera;
|
||||
|
||||
//*************************OTHER STUFF*************************
|
||||
//Some global vars
|
||||
SCP_vector<subtitle> Subtitles;
|
||||
SCP_vector<camera*> Cameras;
|
||||
//Preset cameras
|
||||
camid Current_camera;
|
||||
camid Main_camera;
|
||||
|
||||
//*************************CLASS: camera*************************
|
||||
//This is where the camera class beings! :D
|
||||
camera::camera(char *in_name, int in_signature)
|
||||
{
|
||||
set_name(in_name);
|
||||
sig = in_signature;
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
camera::~camera()
|
||||
{
|
||||
//Check if this is in use
|
||||
if(Current_camera.getSignature() == this->sig)
|
||||
{
|
||||
Current_camera = camid();
|
||||
}
|
||||
}
|
||||
|
||||
void camera::clear()
|
||||
{
|
||||
strcpy_s(name, "");
|
||||
sig = -1;
|
||||
reset();
|
||||
}
|
||||
|
||||
void camera::reset()
|
||||
{
|
||||
flags = CAM_DEFAULT_FLAGS;
|
||||
|
||||
object_host = object_target = object_h();
|
||||
object_host_submodel = object_target_submodel = -1;
|
||||
|
||||
c_fov = VIEWER_ZOOM_DEFAULT;
|
||||
c_pos = vmd_zero_vector;
|
||||
c_ori = vmd_identity_matrix;
|
||||
|
||||
func_custom_position = NULL;
|
||||
func_custom_orientation = NULL;
|
||||
|
||||
fov.clear();
|
||||
fov.set(VIEWER_ZOOM_DEFAULT);
|
||||
|
||||
pos_x.clear();
|
||||
pos_y.clear();
|
||||
pos_z.clear();
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
ori[i].clear();
|
||||
ori[i].set(vmd_identity_matrix.a1d[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void camera::set_name(char *in_name)
|
||||
{
|
||||
if(name != NULL)
|
||||
strncpy(name, in_name, NAME_LENGTH-1);
|
||||
}
|
||||
|
||||
void camera::set_fov(float in_fov, float in_fov_time, float in_fov_acceleration_time, float in_fov_deceleration_time)
|
||||
{
|
||||
if(in_fov_time == 0.0f && in_fov_acceleration_time == 0.0f && in_fov_deceleration_time == 0.0f)
|
||||
{
|
||||
flags |= CAM_STATIONARY_FOV;
|
||||
c_fov = in_fov;
|
||||
return;
|
||||
}
|
||||
|
||||
flags &= ~CAM_STATIONARY_FOV;
|
||||
if(in_fov <= 0.0f)
|
||||
{
|
||||
fov.setVD(in_fov_time, in_fov_acceleration_time, 0.0f);
|
||||
}
|
||||
|
||||
fov.setAVD(in_fov, in_fov_time, in_fov_acceleration_time, in_fov_deceleration_time, 0.0f);
|
||||
}
|
||||
|
||||
void camera::set_object_host(object *objp, int n_object_host_submodel)
|
||||
{
|
||||
if(objp == NULL)
|
||||
object_host = object_h();
|
||||
|
||||
object_host = object_h(objp);
|
||||
object_host_submodel = n_object_host_submodel;
|
||||
}
|
||||
|
||||
void camera::set_object_target(object *objp, int n_object_target_submodel)
|
||||
{
|
||||
if(objp == NULL)
|
||||
object_target = object_h();
|
||||
|
||||
object_target = object_h(objp);
|
||||
object_target_submodel = n_object_target_submodel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom function receives the already-modified current position value.
|
||||
* It should be replaced or added to as the custom function modifier sees fit.
|
||||
*/
|
||||
void camera::set_custom_position_function(void (*n_func_custom_position)(camera *cam, vec3d *camera_pos))
|
||||
{
|
||||
func_custom_position = n_func_custom_position;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom function receives the already-modified current orientation value.
|
||||
* It should be replaced or added to as the custom function modifier sees fit.
|
||||
*/
|
||||
void camera::set_custom_orientation_function(void (*n_func_custom_orientation)(camera *cam, matrix *camera_ori))
|
||||
{
|
||||
func_custom_orientation = n_func_custom_orientation;
|
||||
}
|
||||
|
||||
void camera::set_position(vec3d *in_position, float in_translation_time, float in_translation_acceleration_time, float in_translation_deceleration_time, float in_end_velocity)
|
||||
{
|
||||
if(in_translation_time == 0.0f && in_translation_acceleration_time == 0.0f && in_translation_deceleration_time == 0.0f)
|
||||
{
|
||||
c_pos = *in_position;
|
||||
pos_x.set(c_pos.xyz.x);
|
||||
pos_y.set(c_pos.xyz.y);
|
||||
pos_z.set(c_pos.xyz.z);
|
||||
flags |= CAM_STATIONARY_POS;
|
||||
return;
|
||||
}
|
||||
|
||||
flags &= ~CAM_STATIONARY_POS;
|
||||
if(in_position == NULL)
|
||||
{
|
||||
pos_x.setVD(in_translation_time, in_translation_acceleration_time, in_end_velocity);
|
||||
pos_y.setVD(in_translation_time, in_translation_acceleration_time, in_end_velocity);
|
||||
pos_z.setVD(in_translation_time, in_translation_acceleration_time, in_end_velocity);
|
||||
return;
|
||||
}
|
||||
|
||||
pos_x.setAVD(in_position->xyz.x, in_translation_time, in_translation_acceleration_time, in_translation_deceleration_time, in_end_velocity);
|
||||
pos_y.setAVD(in_position->xyz.y, in_translation_time, in_translation_acceleration_time, in_translation_deceleration_time, in_end_velocity);
|
||||
pos_z.setAVD(in_position->xyz.z, in_translation_time, in_translation_acceleration_time, in_translation_deceleration_time, in_end_velocity);
|
||||
}
|
||||
|
||||
void camera::set_translation_velocity(vec3d *in_velocity, float in_acceleration_time)
|
||||
{
|
||||
pos_x.setVD(in_acceleration_time, in_acceleration_time, in_velocity->xyz.x);
|
||||
pos_y.setVD(in_acceleration_time, in_acceleration_time, in_velocity->xyz.y);
|
||||
pos_z.setVD(in_acceleration_time, in_acceleration_time, in_velocity->xyz.z);
|
||||
}
|
||||
|
||||
void camera::set_rotation(matrix *in_orientation, float in_rotation_time, float in_rotation_acceleration_time, float in_rotation_deceleration_time)
|
||||
{
|
||||
if(in_rotation_time == 0.0f && in_rotation_acceleration_time == 0.0f && in_rotation_deceleration_time == 0.0f)
|
||||
{
|
||||
c_ori = *in_orientation;
|
||||
for(int i = 0; i < 9; i++)
|
||||
ori[i].set(in_orientation->a1d[i]);
|
||||
flags |= CAM_STATIONARY_ORI;
|
||||
return;
|
||||
}
|
||||
|
||||
flags &= ~CAM_STATIONARY_ORI;
|
||||
if(in_orientation == NULL)
|
||||
{
|
||||
for(int i = 0; i < 9; i++)
|
||||
ori[i].setVD(in_rotation_time, in_rotation_acceleration_time, 0.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
ori[i].setAVD(in_orientation->a1d[i], in_rotation_time, in_rotation_acceleration_time, in_rotation_deceleration_time, 0.0f);
|
||||
}
|
||||
|
||||
void camera::set_rotation(angles *in_angles, float in_rotation_time, float in_rotation_acceleration_time, float in_rotation_deceleration_time)
|
||||
{
|
||||
matrix mtx = IDENTITY_MATRIX;
|
||||
vm_rotate_matrix_by_angles(&mtx, in_angles);
|
||||
this->set_rotation(&mtx, in_rotation_time, in_rotation_acceleration_time, in_rotation_deceleration_time);
|
||||
}
|
||||
|
||||
void camera::set_rotation_facing(vec3d *in_target, float in_rotation_time, float in_rotation_acceleration_time, float in_rotation_deceleration_time)
|
||||
{
|
||||
matrix temp_matrix = IDENTITY_MATRIX;
|
||||
|
||||
if(in_target != NULL)
|
||||
{
|
||||
vec3d position = vmd_zero_vector;
|
||||
this->get_info(&position, NULL);
|
||||
|
||||
if(in_target->xyz.x == position.xyz.x && in_target->xyz.y == position.xyz.y && in_target->xyz.z == position.xyz.z)
|
||||
{
|
||||
Warning(LOCATION, "Camera tried to point to self");
|
||||
return;
|
||||
}
|
||||
|
||||
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, in_rotation_deceleration_time);
|
||||
}
|
||||
|
||||
void camera::set_rotation_velocity(angles *in_rotation_rate, float in_acceleration_time)
|
||||
{
|
||||
Error(LOCATION, "This function is disabled until further notice.");
|
||||
}
|
||||
|
||||
void camera::do_frame(float in_frametime)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
object *camera::get_object_host()
|
||||
{
|
||||
if(object_host.IsValid())
|
||||
return object_host.objp;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int camera::get_object_host_submodel()
|
||||
{
|
||||
return object_host_submodel;
|
||||
}
|
||||
|
||||
object *camera::get_object_target()
|
||||
{
|
||||
if(object_target.IsValid())
|
||||
return object_target.objp;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int camera::get_object_target_submodel()
|
||||
{
|
||||
return object_target_submodel;
|
||||
}
|
||||
|
||||
float camera::get_fov()
|
||||
{
|
||||
if(!(flags & CAM_STATIONARY_FOV))
|
||||
{
|
||||
fov.get(&c_fov, NULL);
|
||||
}
|
||||
|
||||
return c_fov;
|
||||
}
|
||||
|
||||
void camera::get_info(vec3d *position, matrix *orientation)
|
||||
{
|
||||
if(position == NULL && orientation == NULL)
|
||||
return;
|
||||
|
||||
//POSITION
|
||||
if(!(flags & CAM_STATIONARY_POS) || object_host.IsValid())
|
||||
{
|
||||
c_pos = vmd_zero_vector;
|
||||
|
||||
vec3d pt;
|
||||
pos_x.get(&pt.xyz.x, NULL);
|
||||
pos_y.get(&pt.xyz.y, NULL);
|
||||
pos_z.get(&pt.xyz.z, NULL);
|
||||
|
||||
if(object_host.IsValid())
|
||||
{
|
||||
object *objp = object_host.objp;
|
||||
int model_num = object_get_model(objp);
|
||||
polymodel *pm = NULL;
|
||||
|
||||
if(model_num > -1)
|
||||
{
|
||||
pm = model_get(model_num);
|
||||
}
|
||||
|
||||
if(object_host_submodel < 0 || pm == NULL)
|
||||
{
|
||||
vm_vec_unrotate(&c_pos, &pt, &object_host.objp->orient);
|
||||
vm_vec_add2(&c_pos, &object_host.objp->pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
model_find_world_point( &c_pos, &pt, pm->id, object_host_submodel, &objp->orient, &objp->pos );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
c_pos = pt;
|
||||
}
|
||||
|
||||
//Do custom position stuff, if needed
|
||||
if(func_custom_position != NULL)
|
||||
{
|
||||
func_custom_position(this, &c_pos);
|
||||
}
|
||||
}
|
||||
|
||||
if(position != NULL)
|
||||
*position = c_pos;
|
||||
|
||||
//ORIENTATION
|
||||
if(orientation != NULL)
|
||||
{
|
||||
if(!(flags & CAM_STATIONARY_ORI) || object_target.IsValid() || object_host.IsValid())
|
||||
{
|
||||
if(object_target.IsValid())
|
||||
{
|
||||
object *objp = object_target.objp;
|
||||
int model_num = object_get_model(objp);
|
||||
polymodel *pm = NULL;
|
||||
vec3d target_pos = vmd_zero_vector;
|
||||
|
||||
//See if we can get the model
|
||||
if(model_num > -1)
|
||||
{
|
||||
pm = model_get(model_num);
|
||||
}
|
||||
|
||||
//If we don't have a submodel or don't have the model use object pos
|
||||
//Otherwise, find the submodel pos as it is rotated
|
||||
if(object_target_submodel < 0 || pm == NULL)
|
||||
{
|
||||
target_pos = objp->pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
model_find_world_point( &target_pos, &vmd_zero_vector, pm->id, object_target_submodel, &objp->orient, &objp->pos );
|
||||
}
|
||||
|
||||
vec3d targetvec;
|
||||
vm_vec_normalized_dir(&targetvec, &target_pos, &c_pos);
|
||||
vm_vector_2_matrix(&c_ori, &targetvec, NULL, NULL);
|
||||
}
|
||||
else if(object_host.IsValid())
|
||||
{
|
||||
c_ori = object_host.objp->orient;
|
||||
}
|
||||
else
|
||||
{
|
||||
c_ori = vmd_identity_matrix;
|
||||
}
|
||||
|
||||
matrix mtxA = c_ori;
|
||||
matrix mtxB = IDENTITY_MATRIX;
|
||||
float pos = 0.0f;
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
ori[i].get(&pos, NULL);
|
||||
mtxB.a1d[i] = pos;
|
||||
}
|
||||
vm_matrix_x_matrix(&c_ori, &mtxA, &mtxB);
|
||||
|
||||
vm_orthogonalize_matrix(&c_ori);
|
||||
}
|
||||
//Do custom orientation stuff, if needed
|
||||
if(func_custom_orientation != NULL)
|
||||
{
|
||||
func_custom_orientation(this, &c_ori);
|
||||
}
|
||||
*orientation = c_ori;
|
||||
}
|
||||
}
|
||||
|
||||
//*************************warp_camera*************************
|
||||
warp_camera::warp_camera()
|
||||
{
|
||||
this->reset();
|
||||
}
|
||||
warp_camera::warp_camera(object *objp)
|
||||
{
|
||||
this->reset();
|
||||
|
||||
vec3d object_pos = objp->pos;
|
||||
matrix tmp;
|
||||
ship_get_eye(&object_pos, &tmp, objp);
|
||||
|
||||
vm_vec_scale_add2( &object_pos, &Player_obj->orient.vec.rvec, 0.0f );
|
||||
vm_vec_scale_add2( &object_pos, &Player_obj->orient.vec.uvec, 0.952f );
|
||||
vm_vec_scale_add2( &object_pos, &Player_obj->orient.vec.fvec, -1.782f );
|
||||
|
||||
vec3d tmp_vel = { { { 0.0f, 5.1919f, 14.7f } } };
|
||||
|
||||
this->set_position( &object_pos );
|
||||
this->set_rotation( &objp->orient );
|
||||
this->set_velocity( &tmp_vel, true);
|
||||
}
|
||||
|
||||
void warp_camera::reset()
|
||||
{
|
||||
c_pos = c_vel = c_desired_vel = vmd_zero_vector;
|
||||
c_ori = vmd_identity_matrix;
|
||||
c_damping = 1.0f;
|
||||
c_time = 0.0f;
|
||||
}
|
||||
|
||||
void warp_camera::set_position( vec3d *in_pos )
|
||||
{
|
||||
c_pos = *in_pos;
|
||||
}
|
||||
|
||||
void warp_camera::set_rotation( matrix *in_ori )
|
||||
{
|
||||
c_ori = *in_ori;
|
||||
}
|
||||
|
||||
void warp_camera::set_velocity( vec3d *in_vel, bool instantaneous )
|
||||
{
|
||||
c_desired_vel.xyz.x = 0.0f;
|
||||
c_desired_vel.xyz.y = 0.0f;
|
||||
c_desired_vel.xyz.z = 0.0f;
|
||||
|
||||
vm_vec_scale_add2( &c_desired_vel, &c_ori.vec.rvec, in_vel->xyz.x );
|
||||
vm_vec_scale_add2( &c_desired_vel, &c_ori.vec.uvec, in_vel->xyz.y );
|
||||
vm_vec_scale_add2( &c_desired_vel, &c_ori.vec.fvec, in_vel->xyz.z );
|
||||
|
||||
if ( instantaneous ) {
|
||||
c_vel = c_desired_vel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void warp_camera::do_frame(float in_frametime)
|
||||
{
|
||||
vec3d new_vel, delta_pos;
|
||||
|
||||
apply_physics( c_damping, c_desired_vel.xyz.x, c_vel.xyz.x, in_frametime, &new_vel.xyz.x, &delta_pos.xyz.x );
|
||||
apply_physics( c_damping, c_desired_vel.xyz.y, c_vel.xyz.y, in_frametime, &new_vel.xyz.y, &delta_pos.xyz.y );
|
||||
apply_physics( c_damping, c_desired_vel.xyz.z, c_vel.xyz.z, in_frametime, &new_vel.xyz.z, &delta_pos.xyz.z );
|
||||
|
||||
c_vel = new_vel;
|
||||
|
||||
vm_vec_add2( &c_pos, &delta_pos );
|
||||
|
||||
float ot = c_time+0.0f;
|
||||
|
||||
c_time += in_frametime;
|
||||
|
||||
if ( (ot < 0.667f) && ( c_time >= 0.667f ) ) {
|
||||
vec3d tmp;
|
||||
|
||||
tmp.xyz.z = 4.739f; // always go this fast forward.
|
||||
|
||||
// pick x and y velocities so they are always on a
|
||||
// circle with a 25 m radius.
|
||||
|
||||
float tmp_angle = frand()*PI2;
|
||||
|
||||
tmp.xyz.x = 22.0f * (float)sin(tmp_angle);
|
||||
tmp.xyz.y = -22.0f * (float)cos(tmp_angle);
|
||||
|
||||
this->set_velocity( &tmp, 0 );
|
||||
}
|
||||
|
||||
if ( (ot < 3.0f ) && ( c_time >= 3.0f ) ) {
|
||||
vec3d tmp = ZERO_VECTOR;
|
||||
this->set_velocity( &tmp, 0 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void warp_camera::get_info(vec3d *position, matrix *orientation)
|
||||
{
|
||||
if(position != NULL)
|
||||
*position = c_pos;
|
||||
|
||||
if(orientation != NULL)
|
||||
*orientation = c_ori;
|
||||
}
|
||||
|
||||
//*************************subtitle*************************
|
||||
|
||||
#define MAX_SUBTITLE_LINES 64
|
||||
subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, char* in_imageanim, float in_display_time, float in_fade_time, color *in_text_color, int in_text_fontnum, bool center_x, bool center_y, int in_width, int in_height, bool in_post_shaded)
|
||||
{
|
||||
// basic init, this always has to be done
|
||||
memset( imageanim, 0, sizeof(imageanim) );
|
||||
memset( &text_pos, 0, 2*sizeof(int) );
|
||||
memset( &image_pos, 0, 4*sizeof(int) );
|
||||
image_id = -1;
|
||||
|
||||
if ( ((in_text != NULL) && (strlen(in_text) <= 0)) && ((in_imageanim != NULL) && (strlen(in_imageanim) <= 0)) )
|
||||
return;
|
||||
|
||||
char text_buf[256];
|
||||
if (in_text != NULL && in_text[0] != '\0')
|
||||
{
|
||||
strcpy_s(text_buf, in_text);
|
||||
sexp_replace_variable_names_with_values(text_buf, 256);
|
||||
in_text = text_buf;
|
||||
}
|
||||
|
||||
|
||||
int num_text_lines = 0;
|
||||
char *text_line_ptrs[MAX_SUBTITLE_LINES];
|
||||
int text_line_lens[MAX_SUBTITLE_LINES];
|
||||
|
||||
//Setup text
|
||||
if ( (in_text != NULL) && (in_text[0] != '\0') ) {
|
||||
int split_width = (in_width > 0) ? in_width : 200;
|
||||
|
||||
num_text_lines = split_str(in_text, split_width, text_line_lens, text_line_ptrs, MAX_SUBTITLE_LINES);
|
||||
SCP_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 != NULL)
|
||||
text_color = *in_text_color;
|
||||
else
|
||||
gr_init_alphacolor(&text_color, 255, 255, 255, 255);
|
||||
text_fontnum = in_text_fontnum;
|
||||
|
||||
//Setup display and fade time
|
||||
display_time = fl_abs(in_display_time);
|
||||
fade_time = fl_abs(in_fade_time);
|
||||
|
||||
//Setup image
|
||||
if ( (in_imageanim != NULL) && (in_imageanim[0] != '\0') )
|
||||
{
|
||||
image_id = bm_load(in_imageanim);
|
||||
|
||||
if (image_id >= 0)
|
||||
strncpy(imageanim, in_imageanim, sizeof(imageanim) - 1);
|
||||
}
|
||||
|
||||
//Setup pos
|
||||
int w=0, h=0, tw=0, th=0;
|
||||
if(center_x || center_y)
|
||||
{
|
||||
// switch font because we need to measure it
|
||||
int old_fontnum;
|
||||
if (text_fontnum >= 0)
|
||||
{
|
||||
old_fontnum = gr_get_current_fontnum();
|
||||
gr_set_font(text_fontnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
old_fontnum = -1;
|
||||
}
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
// restore old font
|
||||
if (old_fontnum >= 0)
|
||||
{
|
||||
gr_set_font(old_fontnum);
|
||||
}
|
||||
|
||||
//Get image size
|
||||
if(image_id != -1)
|
||||
{
|
||||
bm_get_info(image_id, &w, &h);
|
||||
if (in_width > 0)
|
||||
w = in_width;
|
||||
if (in_height > 0)
|
||||
h = in_height;
|
||||
|
||||
tw += w;
|
||||
if(h > th)
|
||||
th = h;
|
||||
}
|
||||
|
||||
//Center it?
|
||||
if(center_x)
|
||||
image_pos.x = (gr_screen.max_w - tw)/2;
|
||||
if(center_y)
|
||||
image_pos.y = (gr_screen.max_h - th)/2;
|
||||
}
|
||||
|
||||
if(in_x_pos < 0 && !center_x)
|
||||
image_pos.x += gr_screen.max_w + in_x_pos;
|
||||
else if(!center_x)
|
||||
image_pos.x += in_x_pos;
|
||||
|
||||
if(in_y_pos < 0 && !center_y)
|
||||
image_pos.y += gr_screen.max_h + in_y_pos;
|
||||
else if(!center_y)
|
||||
image_pos.y += in_y_pos;
|
||||
|
||||
image_pos.w = in_width;
|
||||
image_pos.h = in_height;
|
||||
|
||||
if(image_id != -1)
|
||||
text_pos.x = image_pos.x + w; //Still set from bm_get_info call
|
||||
else
|
||||
text_pos.x = image_pos.x;
|
||||
text_pos.y = image_pos.y;
|
||||
|
||||
time_displayed = 0.0f;
|
||||
time_displayed_end = 2.0f*fade_time + display_time;
|
||||
|
||||
post_shaded = in_post_shaded;
|
||||
}
|
||||
|
||||
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
|
||||
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);
|
||||
|
||||
// save old font and set new font
|
||||
int old_fontnum;
|
||||
if (text_fontnum >= 0)
|
||||
{
|
||||
old_fontnum = gr_get_current_fontnum();
|
||||
gr_set_font(text_fontnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
old_fontnum = -1;
|
||||
}
|
||||
|
||||
int font_height = gr_get_font_height();
|
||||
int x = text_pos.x;
|
||||
int y = text_pos.y;
|
||||
|
||||
|
||||
for(SCP_vector<SCP_string>::iterator line = text_lines.begin(); line != text_lines.end(); ++line)
|
||||
{
|
||||
gr_string(x, y, (char*)line->c_str(), false);
|
||||
y += font_height;
|
||||
}
|
||||
|
||||
// restore old font
|
||||
if (old_fontnum >= 0)
|
||||
{
|
||||
gr_set_font(old_fontnum);
|
||||
}
|
||||
|
||||
if(image_id >= 0)
|
||||
{
|
||||
gr_set_bitmap(image_id, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, text_color.alpha/255.0f);
|
||||
|
||||
// scaling?
|
||||
if (image_pos.w > 0 || image_pos.h > 0)
|
||||
{
|
||||
int orig_w, orig_h;
|
||||
vec3d scale;
|
||||
|
||||
bm_get_info(image_id, &orig_w, &orig_h);
|
||||
scale.xyz.x = image_pos.w / (float) orig_w;
|
||||
scale.xyz.y = image_pos.h / (float) orig_h;
|
||||
scale.xyz.z = 1.0f;
|
||||
|
||||
gr_push_scale_matrix(&scale);
|
||||
gr_bitmap(image_pos.x, image_pos.y, false);
|
||||
gr_pop_scale_matrix();
|
||||
}
|
||||
// no scaling
|
||||
else
|
||||
{
|
||||
gr_bitmap(image_pos.x, image_pos.y, false);
|
||||
}
|
||||
}
|
||||
|
||||
time_displayed += frametime;
|
||||
}
|
||||
|
||||
subtitle::~subtitle()
|
||||
{
|
||||
if (image_id != -1) {
|
||||
if ( bm_release(image_id) ) {
|
||||
image_id = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void subtitle::clone(const subtitle &sub)
|
||||
{
|
||||
|
||||
text_lines = sub.text_lines;
|
||||
text_fontnum = sub.text_fontnum;
|
||||
|
||||
// copy the structs
|
||||
text_pos = sub.text_pos;
|
||||
image_pos = sub.image_pos;
|
||||
|
||||
display_time = sub.display_time;
|
||||
fade_time = sub.fade_time;
|
||||
memcpy( &text_color, &sub.text_color, sizeof(color) );
|
||||
|
||||
if ( strlen(sub.imageanim) ) {
|
||||
memcpy( imageanim, sub.imageanim, MAX_FILENAME_LEN );
|
||||
// we bm_load() again here to kick the refcount up
|
||||
image_id = bm_load(imageanim);
|
||||
} else {
|
||||
memset( imageanim, 0, MAX_FILENAME_LEN );
|
||||
image_id = -1;
|
||||
}
|
||||
|
||||
time_displayed = sub.time_displayed;
|
||||
time_displayed_end = sub.time_displayed_end;
|
||||
|
||||
post_shaded = sub.post_shaded;
|
||||
}
|
||||
|
||||
const subtitle &subtitle::operator=(const subtitle &sub)
|
||||
{
|
||||
if (this != &sub) {
|
||||
if (image_id != -1) {
|
||||
if ( bm_release(image_id) ) {
|
||||
image_id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
clone(sub);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//*************************camid*************************
|
||||
camid::camid()
|
||||
{
|
||||
idx = 0;
|
||||
sig = -1;
|
||||
}
|
||||
|
||||
camid::camid(int n_idx, int n_sig)
|
||||
{
|
||||
idx = n_idx;
|
||||
sig = n_sig;
|
||||
}
|
||||
|
||||
camera* camid::getCamera()
|
||||
{
|
||||
if(!isValid())
|
||||
return NULL;
|
||||
|
||||
return Cameras[idx];
|
||||
}
|
||||
|
||||
uint camid::getIndex()
|
||||
{
|
||||
return idx;
|
||||
}
|
||||
|
||||
int camid::getSignature()
|
||||
{
|
||||
return sig;
|
||||
}
|
||||
|
||||
bool camid::isValid()
|
||||
{
|
||||
if(idx >= Cameras.size())
|
||||
return false;
|
||||
|
||||
if(Cameras[idx] == NULL)
|
||||
return false;
|
||||
|
||||
if(Cameras[idx]->get_signature() != this->sig)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//*************************camera functions*************************
|
||||
void cam_init()
|
||||
{
|
||||
//Rest FOV override
|
||||
Sexp_fov = 0.0;
|
||||
}
|
||||
|
||||
void cam_close()
|
||||
{
|
||||
//Set Current_camera to nothing
|
||||
Current_camera = camid();
|
||||
Cameras.clear();
|
||||
}
|
||||
|
||||
int cam_get_next_sig()
|
||||
{
|
||||
static int next_sig = 0;
|
||||
return next_sig++;
|
||||
}
|
||||
|
||||
camid cam_create(char *n_name, vec3d *n_pos, vec3d *n_norm, object *n_object, int n_object_host_submodel)
|
||||
{
|
||||
matrix ori;
|
||||
vm_vector_2_matrix_norm(&ori, n_norm);
|
||||
return cam_create(n_name, n_pos, &ori, n_object, n_object_host_submodel);
|
||||
}
|
||||
|
||||
camid cam_create(char *n_name, vec3d *n_pos, matrix *n_ori, object *n_object, int n_object_host_submodel)
|
||||
{
|
||||
camera *cam = NULL;
|
||||
camid cid;
|
||||
|
||||
//Get signature
|
||||
int sig = cam_get_next_sig();
|
||||
|
||||
//Get name
|
||||
char buf[NAME_LENGTH] = {'\0'};
|
||||
if(n_name == NULL)
|
||||
sprintf(buf, "Camera %d", cid.getSignature());
|
||||
else
|
||||
strncpy(buf, n_name, NAME_LENGTH-1);
|
||||
|
||||
//Find a free slot
|
||||
cam = new camera(buf, sig);
|
||||
cid = camid(Cameras.size(), sig);
|
||||
Cameras.push_back(cam);
|
||||
|
||||
//Set attributes
|
||||
if(n_pos != NULL)
|
||||
cam->set_position(n_pos);
|
||||
if(n_ori != NULL)
|
||||
cam->set_rotation(n_ori);
|
||||
if(n_object != NULL)
|
||||
cam->set_object_host(n_object, n_object_host_submodel);
|
||||
|
||||
return cid;
|
||||
}
|
||||
|
||||
void cam_delete(camid cid)
|
||||
{
|
||||
if(cid.isValid())
|
||||
{
|
||||
cid.getCamera()->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void cam_do_frame(float frametime)
|
||||
{
|
||||
size_t i,size=Cameras.size();
|
||||
for(i = 0; i < size; i++)
|
||||
{
|
||||
if(Cameras[i] != NULL)
|
||||
Cameras[i]->do_frame(frametime);
|
||||
}
|
||||
}
|
||||
|
||||
camid cam_get_camera(uint idx)
|
||||
{
|
||||
if(idx >= Cameras.size())
|
||||
return camid();
|
||||
|
||||
return camid(idx, Cameras[idx]->get_signature());
|
||||
}
|
||||
|
||||
camid cam_get_current()
|
||||
{
|
||||
return Current_camera;
|
||||
}
|
||||
|
||||
uint cam_get_num()
|
||||
{
|
||||
return Cameras.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up camera by name, returns -1 on failure
|
||||
*/
|
||||
camid cam_lookup(char *name)
|
||||
{
|
||||
size_t i, size=Cameras.size();
|
||||
for(i = 0; i < size; i++)
|
||||
{
|
||||
if(Cameras[i] != NULL && !stricmp(Cameras[i]->get_name(), name))
|
||||
return camid(i, Cameras[i]->get_signature());
|
||||
}
|
||||
|
||||
return camid();
|
||||
}
|
||||
|
||||
static bool Camera_hud_draw_saved = false;
|
||||
static int Camera_hud_draw_value = 0;
|
||||
|
||||
bool cam_set_camera(camid cid)
|
||||
{
|
||||
if(!cid.isValid())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Viewer_mode |= VM_FREECAMERA;
|
||||
Current_camera = cid;
|
||||
|
||||
if(!Camera_hud_draw_saved)
|
||||
{
|
||||
Camera_hud_draw_value = hud_get_draw();
|
||||
Camera_hud_draw_saved = true;
|
||||
}
|
||||
hud_set_draw(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
void cam_reset_camera()
|
||||
{
|
||||
Viewer_mode &= ~VM_FREECAMERA;
|
||||
|
||||
hud_set_draw(Camera_hud_draw_value);
|
||||
Camera_hud_draw_saved = false;
|
||||
}
|
||||
|
||||
void subtitles_close()
|
||||
{
|
||||
Subtitles.clear();
|
||||
}
|
||||
|
||||
void subtitles_do_frame(float frametime)
|
||||
{
|
||||
SCP_vector<subtitle>::iterator sub;
|
||||
for(sub = Subtitles.begin(); sub != Subtitles.end(); ++sub)
|
||||
{
|
||||
if ( !sub->is_post_shaded( ) )
|
||||
sub->do_frame(frametime);
|
||||
}
|
||||
}
|
||||
|
||||
void subtitles_do_frame_post_shaded(float frametime)
|
||||
{
|
||||
SCP_vector<subtitle>::iterator sub;
|
||||
for(sub = Subtitles.begin(); sub != Subtitles.end(); ++sub)
|
||||
{
|
||||
if ( sub->is_post_shaded( ) )
|
||||
sub->do_frame(frametime);
|
||||
}
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
|
||||
#ifndef _CAMERA_H
|
||||
#define _CAMERA_H
|
||||
|
||||
#include "graphics/2d.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "globalincs/globals.h"
|
||||
#include "physics/physics.h" //for avd
|
||||
#include "object/object.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#define CAM_STATIONARY_FOV (1<<0)
|
||||
#define CAM_STATIONARY_ORI (1<<1)
|
||||
#define CAM_STATIONARY_POS (1<<2)
|
||||
#define CAM_DEFAULT_FLAGS 0
|
||||
|
||||
class camera
|
||||
{
|
||||
friend class avd_camera;
|
||||
protected:
|
||||
char name[NAME_LENGTH];
|
||||
int sig;
|
||||
int flags;
|
||||
|
||||
object_h object_host;
|
||||
int object_host_submodel;
|
||||
|
||||
object_h object_target;
|
||||
int object_target_submodel;
|
||||
|
||||
void (*func_custom_position)(camera *cam, vec3d *pos);
|
||||
void (*func_custom_orientation)(camera *cam, matrix *ori);
|
||||
|
||||
avd_movement fov;
|
||||
avd_movement pos_x;
|
||||
avd_movement pos_y;
|
||||
avd_movement pos_z;
|
||||
avd_movement ori[9];
|
||||
|
||||
//Cache stuff
|
||||
float c_fov;
|
||||
vec3d c_pos;
|
||||
matrix c_ori;
|
||||
public:
|
||||
camera(char *in_name=NULL, int in_signature=-1);
|
||||
~camera();
|
||||
void clear();
|
||||
void reset();
|
||||
|
||||
//Set
|
||||
void set_name(char *in_name);
|
||||
|
||||
void set_object_host(object *objp, int n_object_host_submodel = -1);
|
||||
void set_object_target(object *objp, int n_object_target_submodel = -1);
|
||||
|
||||
void set_custom_position_function(void (*n_func_custom_position)(camera *cam, vec3d *pos));
|
||||
void set_custom_orientation_function(void (*n_func_custom_orientation)(camera *cam, matrix *ori));
|
||||
|
||||
void set_fov(float in_fov, float in_fov_time = 0.0f, float in_fov_acceleration_time = 0.0f, float in_deceleration_time = 0.0f);
|
||||
|
||||
void set_position(vec3d *in_position = NULL, float in_translation_time = 0.0f, float in_translation_acceleration_time = 0.0f, float in_translation_deceleration_time = 0.0f, float in_end_velocity = 0.0f);
|
||||
void set_translation_velocity(vec3d *in_velocity, float in_acceleration_time = 0.0f);
|
||||
|
||||
void set_rotation(matrix *in_orientation = NULL, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation(angles *in_angles, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation_facing(vec3d *in_target, float in_rotation_time = 0.0f, float in_rotation_acceleration_time = 0.0f, float in_rotation_deceleration_time = 0.0f);
|
||||
void set_rotation_velocity(angles *in_rotation_rate, float in_acceleration_time = 0.0f);
|
||||
|
||||
//Get
|
||||
char *get_name() {return name;}
|
||||
int get_signature() {return sig;}
|
||||
object *get_object_host();
|
||||
int get_object_host_submodel();
|
||||
object *get_object_target();
|
||||
int get_object_target_submodel();
|
||||
float get_fov();
|
||||
void get_info(vec3d *position, matrix *orientation);
|
||||
|
||||
//Is
|
||||
bool is_empty(){return sig < 0;}
|
||||
|
||||
//Do
|
||||
void do_frame(float in_frametime);
|
||||
};
|
||||
|
||||
class warp_camera
|
||||
{
|
||||
private:
|
||||
float c_time;
|
||||
float c_damping;
|
||||
|
||||
vec3d c_vel;
|
||||
vec3d c_desired_vel;
|
||||
|
||||
vec3d c_pos;
|
||||
matrix c_ori;
|
||||
public:
|
||||
warp_camera();
|
||||
warp_camera(object *objp);
|
||||
void reset();
|
||||
|
||||
void set_position(vec3d *in_pos);
|
||||
void set_rotation(matrix *in_ori);
|
||||
void set_velocity(vec3d *in_vel, bool instantaneous);
|
||||
|
||||
void do_frame(float in_frametime);
|
||||
|
||||
void get_info(vec3d *position, matrix *orientation);
|
||||
};
|
||||
|
||||
extern warp_camera Warp_camera;
|
||||
|
||||
class subtitle
|
||||
{
|
||||
private:
|
||||
void clone(const subtitle &sub);
|
||||
|
||||
SCP_vector<SCP_string> text_lines;
|
||||
struct { int x; int y; } text_pos;
|
||||
|
||||
float display_time;
|
||||
float fade_time;
|
||||
color text_color;
|
||||
int text_fontnum;
|
||||
|
||||
//Done with set
|
||||
char imageanim[MAX_FILENAME_LEN];
|
||||
int image_id;
|
||||
struct { int x; int y; int w; int h; } image_pos;
|
||||
|
||||
//Time this has been displayed
|
||||
float time_displayed;
|
||||
|
||||
//When to end it
|
||||
float time_displayed_end;
|
||||
|
||||
bool post_shaded;
|
||||
public:
|
||||
subtitle(int in_x_pos, int in_y_pos, char* in_text = NULL, char* in_imageanim = NULL,
|
||||
float in_display_time = 0, float in_fade_time = 0.0f, color *in_text_color = NULL, int in_text_fontnum = -1,
|
||||
bool center_x = false, bool center_y = false, int in_width = 0, int in_height = 0, bool post_shaded=false);
|
||||
~subtitle();
|
||||
|
||||
subtitle(const subtitle &sub) { clone(sub); }
|
||||
const subtitle &operator=(const subtitle &sub);
|
||||
|
||||
void do_frame(float frametime);
|
||||
bool is_post_shaded( ) { return post_shaded; }
|
||||
};
|
||||
|
||||
//Some global stuff
|
||||
extern SCP_vector<subtitle> Subtitles;
|
||||
extern float VIEWER_ZOOM_DEFAULT;
|
||||
extern float Sexp_fov;
|
||||
|
||||
//Helpful functions
|
||||
void cam_init();
|
||||
void cam_close();
|
||||
void cam_do_frame(float frametime);
|
||||
camid cam_create(char *n_name=NULL, vec3d *n_pos=NULL, matrix *n_ori=NULL, object *n_object=NULL, int n_submodel_parent=-1);
|
||||
camid cam_create(char *n_name, vec3d *n_pos, vec3d *n_norm, object *n_object=NULL, int n_submodel_parent=-1);
|
||||
void cam_delete(camid cid);
|
||||
bool cam_set_camera(camid cid);
|
||||
void cam_reset_camera();
|
||||
camid cam_lookup(char *name);
|
||||
camid cam_get_camera(uint index);
|
||||
camid cam_get_current();
|
||||
uint cam_get_num();
|
||||
|
||||
void subtitles_close();
|
||||
void subtitles_do_frame(float frametime);
|
||||
void subtitles_do_frame_post_shaded(float frametime);
|
||||
|
||||
#endif // _CAMERA_H
|
||||
@@ -1,392 +0,0 @@
|
||||
/*
|
||||
* 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 __CFILE_H__
|
||||
#define __CFILE_H__
|
||||
|
||||
|
||||
#include <time.h>
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
|
||||
#define CF_EOF (-1)
|
||||
|
||||
#define CF_SEEK_SET (0)
|
||||
#define CF_SEEK_CUR (1)
|
||||
#define CF_SEEK_END (2)
|
||||
|
||||
typedef struct CFILE {
|
||||
int id; // Index into cfile.cpp specific structure
|
||||
int version; // version of this file
|
||||
} CFILE;
|
||||
|
||||
// extra info that can be returned when getting a file listing
|
||||
typedef struct {
|
||||
time_t write_time;
|
||||
} file_list_info;
|
||||
|
||||
|
||||
#define CF_MAX_FILENAME_LENGTH 32 // Includes null terminater, so real length is 31
|
||||
#define CF_MAX_PATHNAME_LENGTH 256 // Includes null terminater, so real length is 255
|
||||
|
||||
#define CF_TYPE_ANY -1 // Used to check in any directory
|
||||
|
||||
#define CF_TYPE_INVALID 0
|
||||
#define CF_TYPE_ROOT 1 // Root must be 1!!
|
||||
#define CF_TYPE_DATA 2
|
||||
#define CF_TYPE_MAPS 3
|
||||
#define CF_TYPE_TEXT 4
|
||||
#define CF_TYPE_MODELS 5
|
||||
#define CF_TYPE_TABLES 6
|
||||
#define CF_TYPE_SOUNDS 7
|
||||
#define CF_TYPE_SOUNDS_8B22K 8
|
||||
#define CF_TYPE_SOUNDS_16B11K 9
|
||||
#define CF_TYPE_VOICE 10
|
||||
#define CF_TYPE_VOICE_BRIEFINGS 11
|
||||
#define CF_TYPE_VOICE_CMD_BRIEF 12
|
||||
#define CF_TYPE_VOICE_DEBRIEFINGS 13
|
||||
#define CF_TYPE_VOICE_PERSONAS 14
|
||||
#define CF_TYPE_VOICE_SPECIAL 15
|
||||
#define CF_TYPE_VOICE_TRAINING 16
|
||||
#define CF_TYPE_MUSIC 17
|
||||
#define CF_TYPE_MOVIES 18
|
||||
#define CF_TYPE_INTERFACE 19
|
||||
#define CF_TYPE_FONT 20
|
||||
#define CF_TYPE_EFFECTS 21
|
||||
#define CF_TYPE_HUD 22
|
||||
#define CF_TYPE_PLAYERS 23
|
||||
#define CF_TYPE_PLAYER_IMAGES 24
|
||||
#define CF_TYPE_SQUAD_IMAGES 25
|
||||
#define CF_TYPE_SINGLE_PLAYERS 26
|
||||
#define CF_TYPE_MULTI_PLAYERS 27
|
||||
#define CF_TYPE_CACHE 28
|
||||
#define CF_TYPE_MULTI_CACHE 29
|
||||
#define CF_TYPE_MISSIONS 30
|
||||
#define CF_TYPE_CONFIG 31
|
||||
#define CF_TYPE_DEMOS 32
|
||||
#define CF_TYPE_CBANIMS 33
|
||||
#define CF_TYPE_INTEL_ANIMS 34
|
||||
#define CF_TYPE_SCRIPTS 35
|
||||
#define CF_TYPE_FICTION 36
|
||||
|
||||
#define CF_MAX_PATH_TYPES 37 // Can be as high as you'd like //DTP; yeah but beware alot of things uses CF_MAX_PATH_TYPES
|
||||
|
||||
|
||||
// TRUE if type is specified and valid
|
||||
#define CF_TYPE_SPECIFIED(path_type) (((path_type)>CF_TYPE_INVALID) && ((path_type)<CF_MAX_PATH_TYPES))
|
||||
|
||||
// #define's for the type parameter in cfopen.
|
||||
#define CFILE_NORMAL 0 // open file normally
|
||||
#define CFILE_MEMORY_MAPPED (1<<0) // open file as a memory-mapped file
|
||||
|
||||
#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)
|
||||
|
||||
// callback function used for get_file_list() to filter files to be added to list. Return 1
|
||||
// to add file to list, or 0 to not add it.
|
||||
extern int (*Get_file_list_filter)(char *filename);
|
||||
|
||||
// extra check for child directory under CF_TYPE_*
|
||||
// NOTE: if specified cf_get_file_list() will not search pack files!
|
||||
// NOTE: specified string must not contain ':' or spaces or begin with DIR_SEPARATOR!
|
||||
extern const char *Get_file_list_child;
|
||||
|
||||
// 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
|
||||
int cfile_init(char *exe_dir,char *cdrom_dir=NULL);
|
||||
|
||||
// Call this if pack files got added or removed or the
|
||||
// cdrom changed. This will refresh the list of filenames
|
||||
// stored in packfiles and on the cdrom.
|
||||
void cfile_refresh();
|
||||
|
||||
// add an extension to a filename if it doesn't already have it
|
||||
char *cf_add_ext(char *filename, char *ext);
|
||||
|
||||
// return CF_TYPE (directory location type) of a CFILE you called cfopen() successfully on.
|
||||
int cf_get_dir_type(CFILE *cfile);
|
||||
|
||||
// Opens the file. If no path is given, use the extension to look into the
|
||||
// default path. If mode is NULL, delete the file.
|
||||
CFILE *cfopen(char *filename, char *mode, int type = CFILE_NORMAL, int dir_type = CF_TYPE_ANY, bool localize = false);
|
||||
|
||||
// like cfopen(), but it accepts a fully qualified path only (ie, the result of a cf_find_file_location() call)
|
||||
// NOTE: only supports reading files!!
|
||||
CFILE *cfopen_special(char *file_path, char *mode, const int size, const int offset, int dir_type = CF_TYPE_ANY);
|
||||
|
||||
// Flush the open file buffer
|
||||
int cflush(CFILE *cfile);
|
||||
|
||||
// version number of opened file. Will be 0 unless you put something else here after you
|
||||
// open a file. Once set, you can use minimum version numbers with the read functions.
|
||||
void cf_set_version( CFILE * cfile, int version );
|
||||
|
||||
// will throw an error if cfread*() functions read past this mark
|
||||
// converted to raw offsets when used, but gets passed actual length from current position
|
||||
// setting 'len' to zero will disable the check
|
||||
void cf_set_max_read_len(CFILE *cfile, size_t len);
|
||||
|
||||
// Deletes a file. Returns 0 on error, 1 if successful
|
||||
int cf_delete(char *filename, int dir_type);
|
||||
|
||||
// Same as _access function to read a file's access bits
|
||||
int cf_access(char *filename, int dir_type, int mode);
|
||||
|
||||
// Returns 1 if the file exists, 0 if not.
|
||||
// Checks only the file system.
|
||||
int cf_exists(char *filename, int dir_type);
|
||||
|
||||
// Goober5000
|
||||
// Returns 1 if the file exists, 0 if not.
|
||||
// Checks both the file system and the VPs.
|
||||
int cf_exists_full(char *filename, int dir_type);
|
||||
// check num_ext worth of ext_list extensions
|
||||
int cf_exists_full_ext(char *filename, int dir_type, const int num_ext, const char **ext_list);
|
||||
|
||||
// ctmpfile() opens a temporary file stream. File is deleted automatically when closed
|
||||
CFILE *ctmpfile();
|
||||
|
||||
// Closes the file
|
||||
int cfclose(CFILE *cfile);
|
||||
|
||||
//Checks if the given handle is valid
|
||||
int cf_is_valid(CFILE *cfile);
|
||||
|
||||
// Returns size of file...
|
||||
int cfilelength(CFILE *fp);
|
||||
|
||||
// Reads data
|
||||
int cfread(void *buf, int elsize, int nelem, CFILE *fp);
|
||||
|
||||
// cfwrite() writes to the file
|
||||
int cfwrite(const void *buf, int elsize, int nelem, CFILE *cfile);
|
||||
|
||||
// Reads/writes RLE compressed data.
|
||||
int cfread_compressed(void *buf, int elsize, int nelem, CFILE *cfile);
|
||||
int cfwrite_compressed(void *param_buf, int param_elsize, int param_nelem, CFILE *cfile);
|
||||
|
||||
// Moves the file pointer
|
||||
int cfseek(CFILE *fp, int offset, int where);
|
||||
|
||||
// Returns current position of file.
|
||||
int cftell(CFILE *fp);
|
||||
|
||||
// cfputc() writes a character to a file
|
||||
int cfputc(int c, CFILE *cfile);
|
||||
|
||||
// cfputs() writes a string to a file
|
||||
int cfputs(char *str, CFILE *cfile);
|
||||
|
||||
// cfgetc() reads a character to a file
|
||||
int cfgetc(CFILE *cfile);
|
||||
|
||||
// cfgets() reads a string from a file
|
||||
char *cfgets(char *buf, int n, CFILE *cfile);
|
||||
|
||||
// cfeof() Tests for end-of-file on a stream
|
||||
int cfeof(CFILE *cfile);
|
||||
|
||||
// Return the data pointer associated with the CFILE structure (for memory mapped files)
|
||||
void *cf_returndata(CFILE *cfile);
|
||||
|
||||
// get the 2 byte checksum of the passed filename - return 0 if operation failed, 1 if succeeded
|
||||
int cf_chksum_short(char *filename, ushort *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
|
||||
|
||||
// get the 2 byte checksum of the passed file - return 0 if operation failed, 1 if succeeded
|
||||
// NOTE : preserves current file position
|
||||
int cf_chksum_short(CFILE *file, ushort *chksum, int max_size = -1);
|
||||
|
||||
// get the 32 bit CRC checksum of the passed filename - return 0 if operation failed, 1 if succeeded
|
||||
int cf_chksum_long(char *filename, uint *chksum, int max_size = -1, int cf_type = CF_TYPE_ANY );
|
||||
|
||||
// get the 32 bit CRC checksum of the passed file - return 0 if operation failed, 1 if succeeded
|
||||
// NOTE : preserves current file position
|
||||
int cf_chksum_long(CFILE *file, uint *chksum, int max_size = -1);
|
||||
|
||||
int cf_chksum_pack(char *filename, uint *chk_long, bool full = false);
|
||||
|
||||
// convenient for misc checksumming purposes ------------------------------------------
|
||||
|
||||
// update cur_chksum with the chksum of the new_data of size new_data_size
|
||||
ushort cf_add_chksum_short(ushort seed, ubyte *buffer, int size);
|
||||
|
||||
// update cur_chksum with the chksum of the new_data of size new_data_size
|
||||
uint cf_add_chksum_long(uint seed, ubyte *buffer, int size);
|
||||
|
||||
// convenient for misc checksumming purposes ------------------------------------------
|
||||
|
||||
//================= HIGH LEVEL FUNCTIONS ==================
|
||||
int cfexist(char *filename); // Returns true if file exists on disk (1) or in hog (2).
|
||||
|
||||
// rename a file, utilizing the extension to determine where file is.
|
||||
#define CF_RENAME_SUCCESS 0 // successfully renamed the file
|
||||
#define CF_RENAME_FAIL_ACCESS 1 // new name could not be created
|
||||
#define CF_RENAME_FAIL_EXIST 2 // old name does not exist
|
||||
int cf_rename(char *old_name, char *name, int type = CF_TYPE_ANY );
|
||||
|
||||
// changes the attributes of a file
|
||||
void cf_attrib(char *name, int set, int clear, int type);
|
||||
|
||||
// flush (delete all files in) the passed directory (by type), return the # of files deleted
|
||||
// NOTE : WILL NOT DELETE READ-ONLY FILES
|
||||
int cfile_flush_dir(int type);
|
||||
|
||||
// functions for reading from cfile
|
||||
// These are all high level, built up from
|
||||
// cfread.
|
||||
int cfgetc(CFILE *fp);
|
||||
char *cfgets(char *buf, size_t n, CFILE *fp);
|
||||
char cfread_char(CFILE *file, int ver = 0, char deflt = 0);
|
||||
ubyte cfread_ubyte(CFILE *file, int ver = 0, ubyte deflt = 0);
|
||||
short cfread_short(CFILE *file, int ver = 0, short deflt = 0);
|
||||
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(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
|
||||
// to n characters.
|
||||
void cfread_string(char *buf,int n, CFILE *file);
|
||||
/**
|
||||
* @brief Read a fixed length string that is not null-terminated, with the length stored in file
|
||||
*
|
||||
* @param buf Pre-allocated array to store string
|
||||
* @param n Size of pre-allocated array
|
||||
* @param file File to read from
|
||||
*
|
||||
* @note Appends NULL character to string (buf)
|
||||
*/
|
||||
void cfread_string_len(char *buf,int n, CFILE *file);
|
||||
|
||||
// functions for writing cfiles
|
||||
int cfwrite_char(char c, CFILE *file);
|
||||
int cfwrite_float(float f, CFILE *file);
|
||||
int cfwrite_int(int i, CFILE *file);
|
||||
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(vec3d *vec, CFILE *file);
|
||||
int cfwrite_angles(angles *ang, CFILE *file);
|
||||
|
||||
// writes variable length, null-termined string.
|
||||
int cfwrite_string(char *buf, CFILE *file);
|
||||
|
||||
/**
|
||||
* @brief Write a fixed length string (not including its null terminator), with the length stored in file
|
||||
*
|
||||
* @param buf String to write to file
|
||||
* @param file File to write to
|
||||
*/
|
||||
int cfwrite_string_len(const char *buf, CFILE *file);
|
||||
|
||||
int cf_get_file_list( SCP_vector<SCP_string> &list, int pathtype, char *filter, int sort = CF_SORT_NONE, SCP_vector<file_list_info> *info = NULL );
|
||||
int cf_get_file_list( int max, char **list, int type, char *filter, int sort = CF_SORT_NONE, file_list_info *info = NULL );
|
||||
int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char **list, int type, char *filter, int sort = CF_SORT_NONE, file_list_info *info = NULL );
|
||||
void cf_sort_filenames( int n, char **list, int sort, file_list_info *info = NULL );
|
||||
void cf_sort_filenames( SCP_vector<SCP_string> &list, int sort, SCP_vector<file_list_info> *info = NULL );
|
||||
|
||||
// Searches for a file. Follows all rules and precedence and searches
|
||||
// CD's and pack files.
|
||||
// Input: filespace - Filename & extension
|
||||
// pathtype - See CF_TYPE_ defines in CFILE.H
|
||||
// max_out - Maximum string size to be stuffed into pack_filename
|
||||
// Output: pack_filename - Absolute path and filename of this file. Could be a packfile or the actual file.
|
||||
// size - File size
|
||||
// offset - Offset into pack file. 0 if not a packfile.
|
||||
// Returns: If not found returns 0.
|
||||
int cf_find_file_location( char *filespec, int pathtype, int max_out, char *pack_filename, int *size, int *offset, bool localize = false);
|
||||
|
||||
// Searches for a file. Follows all rules and precedence and searches
|
||||
// CD's and pack files. Searches all locations in order for first filename using ext filter list.
|
||||
// Input: filename - Filename & extension
|
||||
// ext_num - number of extensions to look for
|
||||
// ext_list - extension filter list
|
||||
// pathtype - See CF_TYPE_ defines in CFILE.H
|
||||
// max_out - Maximum string length that should be stuffed into pack_filename
|
||||
// Output: pack_filename - Absolute path and filename of this file. Could be a packfile or the actual file.
|
||||
// size - File size
|
||||
// offset - Offset into pack file. 0 if not a packfile.
|
||||
// Returns: If not found returns -1, else returns offset into ext_list.
|
||||
// (NOTE: This function is exponentially slow, so don't use it unless truely needed!!)
|
||||
int cf_find_file_location_ext(char *filename, const int ext_num, const char **ext_list, int pathtype, int max_out = 0, char *pack_filename = NULL, int *size = NULL, int *offset = NULL, bool localize = false);
|
||||
|
||||
// Functions to change directories
|
||||
int cfile_chdir(char *dir);
|
||||
|
||||
#ifdef _WIN32
|
||||
int cfile_chdrive(int DriveNum, int flag);
|
||||
#endif
|
||||
|
||||
// push current directory on a 'stack' (so we can restore it) and change the directory
|
||||
int cfile_push_chdir(int type);
|
||||
|
||||
// restore directory on top of the stack
|
||||
int cfile_pop_dir();
|
||||
|
||||
namespace cfile
|
||||
{
|
||||
// exceptions and other errors
|
||||
class cfile_error : public std::exception
|
||||
{
|
||||
public:
|
||||
cfile_error() : m_excuse("CFILE Exception")
|
||||
{
|
||||
}
|
||||
|
||||
cfile_error(const std::string &excuse) : m_excuse(excuse)
|
||||
{
|
||||
}
|
||||
|
||||
~cfile_error() throw()
|
||||
{
|
||||
}
|
||||
|
||||
virtual const char *what() const throw()
|
||||
{
|
||||
return m_excuse.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_excuse;
|
||||
};
|
||||
|
||||
class max_read_length : public cfile_error
|
||||
{
|
||||
public:
|
||||
max_read_length(const std::string &excuse) : cfile_error(excuse)
|
||||
{
|
||||
}
|
||||
|
||||
max_read_length() : cfile_error("Attempted to read beyond length limit")
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif /* __CFILE_H__ */
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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 _CFILEARCHIVE_H
|
||||
#define _CFILEARCHIVE_H
|
||||
|
||||
#ifndef _CFILE_INTERNAL
|
||||
#error This file should only be included internally in CFILE!!
|
||||
#endif
|
||||
|
||||
// The following Cfile_block data is private to cfile.cpp
|
||||
// DO NOT MOVE the Cfile_block* information to cfile.h / do not extern this data
|
||||
//
|
||||
#define CFILE_BLOCK_UNUSED 0
|
||||
#define CFILE_BLOCK_USED 1
|
||||
|
||||
typedef struct Cfile_block {
|
||||
int type; // CFILE_BLOCK_UNUSED, CFILE_BLOCK_USED
|
||||
int dir_type; // directory location
|
||||
FILE *fp; // File pointer if opening an individual file
|
||||
void *data; // Pointer for memory-mapped file access. NULL if not mem-mapped.
|
||||
#ifdef _WIN32
|
||||
HANDLE hInFile; // Handle from CreateFile()
|
||||
HANDLE hMapFile; // Handle from CreateFileMapping()
|
||||
#else
|
||||
// int fd; // file descriptor
|
||||
size_t data_length; // length of data for mmap
|
||||
#endif
|
||||
int lib_offset;
|
||||
int raw_position;
|
||||
int size; // for packed files
|
||||
|
||||
size_t max_read_len; // max read offset, for special error handling
|
||||
} Cfile_block;
|
||||
|
||||
#define MAX_CFILE_BLOCKS 64
|
||||
extern Cfile_block Cfile_block_list[MAX_CFILE_BLOCKS];
|
||||
extern CFILE Cfile_list[MAX_CFILE_BLOCKS];
|
||||
|
||||
// Called once to setup the low-level reading code.
|
||||
void cf_init_lowlevel_read_code( CFILE * cfile, int lib_offset, int size, int pos );
|
||||
|
||||
#endif
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* 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 _CFILESYSTEM_H
|
||||
#define _CFILESYSTEM_H
|
||||
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
// Builds a list of all the files
|
||||
void cf_build_secondary_filelist( char *cdrom_path );
|
||||
void cf_free_secondary_filelist();
|
||||
|
||||
// Internal stuff
|
||||
typedef struct cf_pathtype {
|
||||
int index; // To verify that the CF_TYPE define is correctly indexed into this array
|
||||
char *path; // Path relative to FreeSpace root, has ending backslash.
|
||||
char *extensions; // Extensions used in this pathtype, separated by spaces
|
||||
int parent_index; // Index of this directory's parent. Used for creating directories when writing.
|
||||
} cf_pathtype;
|
||||
|
||||
// During cfile_init, verify that Pathtypes[n].index == n for each item
|
||||
extern cf_pathtype Pathtypes[CF_MAX_PATH_TYPES];
|
||||
|
||||
// Returns the default storage path for files given a
|
||||
// particular pathtype. In other words, the path to
|
||||
// the unpacked, non-cd'd, stored on hard drive path.
|
||||
// If filename isn't null it will also tack the filename
|
||||
// on the end, creating a completely valid filename.
|
||||
// Input: pathtype - CF_TYPE_??
|
||||
// path_max - Maximum characters in the path
|
||||
// filename - optional, if set, tacks the filename onto end of path.
|
||||
// Output: path - Fully qualified pathname.
|
||||
//Returns 0 if result would be too long (invalid result)
|
||||
int cf_create_default_path_string( char *path, uint path_max, int pathtype, char *filename=NULL, bool localize = false);
|
||||
int cf_create_default_path_string( SCP_string &path, int pathtype, char *filename=NULL, bool localize = false );
|
||||
|
||||
#endif //_CFILESYSTEM_H
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,150 +0,0 @@
|
||||
/*
|
||||
* 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 FS_CMDLINE_HEADER_FILE
|
||||
#define FS_CMDLINE_HEADER_FILE
|
||||
|
||||
|
||||
int parse_cmdline(char *cmdline);
|
||||
|
||||
int fred2_parse_cmdline(int argc, char *argv[]);
|
||||
// COMMAND LINE SETTINGS
|
||||
// This section is for reference by all the *_init() functions. For example, the multiplayer init function
|
||||
// could check to see if (int Cmdline_multi_stream_chat_to_file) has been set by the command line parser.
|
||||
//
|
||||
// Add any extern definitions here and put the actual variables inside of cmdline.cpp for ease of use
|
||||
// Also, check to make sure anything you add doesn't break Fred or TestCode
|
||||
|
||||
|
||||
// RETAIL OPTIONS ----------------------------------------------
|
||||
extern char *Cmdline_connect_addr;
|
||||
extern char *Cmdline_game_name;
|
||||
extern char *Cmdline_game_password;
|
||||
extern char *Cmdline_rank_above;
|
||||
extern char *Cmdline_rank_below;
|
||||
extern int Cmdline_cd_check;
|
||||
extern int Cmdline_client_dodamage;
|
||||
extern int Cmdline_closed_game;
|
||||
extern int Cmdline_freespace_no_music;
|
||||
extern int Cmdline_freespace_no_sound;
|
||||
extern int Cmdline_gimme_all_medals;
|
||||
extern int Cmdline_mouse_coords;
|
||||
extern int Cmdline_multi_log;
|
||||
extern int Cmdline_multi_stream_chat_to_file;
|
||||
extern int Cmdline_network_port;
|
||||
extern int Cmdline_restricted_game;
|
||||
extern int Cmdline_spew_pof_info;
|
||||
extern int Cmdline_start_netgame;
|
||||
extern int Cmdline_timeout;
|
||||
extern int Cmdline_use_last_pilot;
|
||||
extern int Cmdline_window;
|
||||
extern int Cmdline_fullscreen_window;
|
||||
extern char *Cmdline_res;
|
||||
|
||||
|
||||
// FSO OPTIONS -------------------------------------------------
|
||||
|
||||
// Graphics related
|
||||
extern double specular_exponent_value;
|
||||
extern float Cmdline_clip_dist;
|
||||
extern float Cmdline_fov;
|
||||
extern float Cmdline_ogl_spec;
|
||||
extern float static_light_factor;
|
||||
extern float static_point_factor;
|
||||
extern float static_tube_factor;
|
||||
extern int Cmdline_ambient_factor;
|
||||
extern int Cmdline_env;
|
||||
extern int Cmdline_missile_lighting;
|
||||
extern int Cmdline_glow;
|
||||
extern int Cmdline_nomotiondebris;
|
||||
extern int Cmdline_noscalevid; // disables fit-to-window for movies - taylor
|
||||
extern int Cmdline_spec;
|
||||
extern int Cmdline_normal;
|
||||
extern int Cmdline_height;
|
||||
extern int Cmdline_enable_3d_shockwave;
|
||||
extern int Cmdline_softparticles;
|
||||
extern int Cmdline_postprocess;
|
||||
extern int Cmdline_bloom_intensity;
|
||||
extern bool Cmdline_fxaa;
|
||||
extern int Cmdline_fxaa_preset;
|
||||
extern bool Cmdline_fb_explosions;
|
||||
|
||||
// Game Speed related
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
extern int Cmdline_img2dds;
|
||||
extern int Cmdline_NoFPSCap;
|
||||
extern int Cmdline_no_vsync;
|
||||
|
||||
// HUD related
|
||||
extern int Cmdline_ballistic_gauge;
|
||||
extern int Cmdline_dualscanlines;
|
||||
extern int Cmdline_orb_radar;
|
||||
extern int Cmdline_rearm_timer;
|
||||
extern int Cmdline_targetinfo;
|
||||
|
||||
// Gameplay related
|
||||
extern int Cmdline_3dwarp;
|
||||
extern int Cmdline_ship_choice_3d;
|
||||
extern int Cmdline_weapon_choice_3d;
|
||||
extern int Cmdline_warp_flash;
|
||||
extern int Cmdline_autopilot_interruptable;
|
||||
|
||||
// Audio related
|
||||
extern int Cmdline_query_speech;
|
||||
extern int Cmdline_snd_preload;
|
||||
extern int Cmdline_voice_recognition;
|
||||
|
||||
// MOD related
|
||||
extern char *Cmdline_mod; // DTP for mod support
|
||||
// Multiplayer/Network related
|
||||
extern char *Cmdline_almission; // DTP for autoload mission (for multi only)
|
||||
extern int Cmdline_ingamejoin;
|
||||
extern int Cmdline_mpnoreturn;
|
||||
extern char *Cmdline_spew_mission_crcs;
|
||||
extern char *Cmdline_spew_table_crcs;
|
||||
extern int Cmdline_objupd;
|
||||
|
||||
// Troubleshooting
|
||||
extern int Cmdline_load_all_weapons;
|
||||
extern int Cmdline_nohtl;
|
||||
extern int Cmdline_noibx;
|
||||
extern int Cmdline_nomovies; // WMC Toggles movie playing support
|
||||
extern int Cmdline_no_set_gamma;
|
||||
extern int Cmdline_novbo;
|
||||
extern int Cmdline_no_fbo;
|
||||
extern int Cmdline_noglsl;
|
||||
extern int Cmdline_mipmap;
|
||||
extern int Cmdline_ati_color_swap;
|
||||
extern int Cmdline_no_3d_sound;
|
||||
extern int Cmdline_no_glsl_model_rendering;
|
||||
extern int Cmdline_no_di_mouse;
|
||||
extern int Cmdline_drawelements;
|
||||
extern char* Cmdline_keyboard_layout;
|
||||
|
||||
// Developer/Testing related
|
||||
extern char *Cmdline_start_mission;
|
||||
extern int Cmdline_dis_collisions;
|
||||
extern int Cmdline_dis_weapons;
|
||||
extern int Cmdline_noparseerrors;
|
||||
extern int Cmdline_nowarn;
|
||||
extern int Cmdline_extra_warn;
|
||||
extern int Cmdline_show_mem_usage;
|
||||
extern int Cmdline_show_pos;
|
||||
extern int Cmdline_show_stats;
|
||||
extern int Cmdline_save_render_targets;
|
||||
extern int Cmdline_debug_window;
|
||||
extern int Cmdline_verify_vps;
|
||||
#ifdef SCP_UNIX
|
||||
extern int Cmdline_no_grab;
|
||||
#endif
|
||||
extern int Cmdline_reparse_mainhall;
|
||||
|
||||
#endif
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "cmeasure/cmeasure.h"
|
||||
#include "ship/ship.h"
|
||||
#include "math/staticrand.h"
|
||||
#include "object/object.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "hud/hud.h"
|
||||
#include "gamesnd/gamesnd.h"
|
||||
#include "network/multimsgs.h"
|
||||
#include "mission/missionparse.h"
|
||||
|
||||
int Cmeasures_homing_check = 0;
|
||||
int Countermeasures_enabled = 1; // Debug, set to 0 means no one can fire countermeasures.
|
||||
|
||||
//Used to set a countermeasure velocity after being launched from a ship as a countermeasure
|
||||
//ie not as a primary or secondary.
|
||||
void cmeasure_set_ship_launch_vel(object *objp, object *parent_objp, int arand)
|
||||
{
|
||||
vec3d vel, rand_vec;
|
||||
|
||||
//Get cmeasure rear velocity in world
|
||||
vm_vec_scale_add(&vel, &parent_objp->phys_info.vel, &parent_objp->orient.vec.fvec, -25.0f);
|
||||
|
||||
//Get random velocity vector
|
||||
static_randvec(arand+1, &rand_vec);
|
||||
|
||||
//Add it to the rear velocity
|
||||
vm_vec_scale_add2(&vel, &rand_vec, 2.0f);
|
||||
|
||||
objp->phys_info.vel = vel;
|
||||
|
||||
//Zero out this stuff so it isn't moving
|
||||
vm_vec_zero(&objp->phys_info.rotvel);
|
||||
vm_vec_zero(&objp->phys_info.max_vel);
|
||||
vm_vec_zero(&objp->phys_info.max_rotvel);
|
||||
|
||||
// blow out his reverse thrusters. Or drag, same thing.
|
||||
objp->phys_info.rotdamp = 10000.0f;
|
||||
objp->phys_info.side_slip_time_const = 10000.0f;
|
||||
|
||||
objp->phys_info.max_vel.xyz.z = -25.0f;
|
||||
vm_vec_copy_scale(&objp->phys_info.desired_vel, &objp->orient.vec.fvec, objp->phys_info.max_vel.xyz.z );
|
||||
}
|
||||
|
||||
void cmeasure_select_next(ship *shipp)
|
||||
{
|
||||
Assert(shipp != NULL);
|
||||
int i, new_index;
|
||||
|
||||
for (i = 1; i < Num_weapon_types; i++)
|
||||
{
|
||||
new_index = (shipp->current_cmeasure + i) % Num_weapon_types;
|
||||
|
||||
if(Weapon_info[new_index].wi_flags & WIF_CMEASURE)
|
||||
{
|
||||
shipp->current_cmeasure = new_index;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mprintf(("Countermeasure type set to %i in frame %i\n", shipp->current_cmeasure, Framecount));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief If this is a player countermeasure, let the player know they evaded a missile.
|
||||
* @param objp [description]
|
||||
*
|
||||
* During single player games, this function notifies the player that evasion has occurred.
|
||||
* Multiplayer games ensure that #send_countermeasure_success_packet() is called to notify the other player.
|
||||
*/
|
||||
|
||||
void cmeasure_maybe_alert_success(object *objp)
|
||||
{
|
||||
//Is this a countermeasure, and does it have a parent
|
||||
if ( objp->type != OBJ_WEAPON || objp->parent < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Assert(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags & WIF_CMEASURE);
|
||||
|
||||
if ( objp->parent == OBJ_INDEX(Player_obj) ) {
|
||||
hud_start_text_flash(XSTR("Evaded", 1430), 800);
|
||||
snd_play(&Snds[ship_get_sound(Player_obj, SND_MISSILE_EVADED_POPUP)]);
|
||||
} else if ( Objects[objp->parent].flags & OF_PLAYER_SHIP ) {
|
||||
send_countermeasure_success_packet( objp->parent );
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* 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 _CMEASURE_H
|
||||
#define _CMEASURE_H
|
||||
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
|
||||
struct object;
|
||||
|
||||
#define CMEASURE_WAIT 333 // delay in milliseconds between countermeasure firing.
|
||||
|
||||
// Maximum distance at which a countermeasure can be tracked
|
||||
// If this value is too large, missiles will always be tracking countermeasures.
|
||||
#define MAX_CMEASURE_TRACK_DIST 300.0f
|
||||
|
||||
extern int Cmeasures_homing_check;
|
||||
extern int Countermeasures_enabled;
|
||||
|
||||
extern void cmeasure_set_ship_launch_vel(object *objp, object *parent_objp, int arand);
|
||||
extern void cmeasure_select_next(object *objp);
|
||||
extern void cmeasure_maybe_alert_success(object *objp);
|
||||
|
||||
#endif // _CMEASURE_H
|
||||
@@ -1,253 +0,0 @@
|
||||
/*
|
||||
* 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 CONTROLS_CONFIG_H
|
||||
#define CONTROLS_CONFIG_H
|
||||
|
||||
#define CONTROL_CONFIG_XSTR 507
|
||||
|
||||
#define JOY_X_AXIS 0
|
||||
#define JOY_Y_AXIS 1
|
||||
#define JOY_Z_AXIS 2
|
||||
#define JOY_RX_AXIS 3
|
||||
#define JOY_RY_AXIS 4
|
||||
#define JOY_RZ_AXIS 5
|
||||
|
||||
#define NUM_JOY_AXIS_ACTIONS 5
|
||||
|
||||
#define JOY_HEADING_AXIS 0
|
||||
#define JOY_PITCH_AXIS 1
|
||||
#define JOY_BANK_AXIS 2
|
||||
#define JOY_ABS_THROTTLE_AXIS 3
|
||||
#define JOY_REL_THROTTLE_AXIS 4
|
||||
|
||||
// --------------------------------------------------
|
||||
// different types of controls that can be assigned
|
||||
// --------------------------------------------------
|
||||
|
||||
#define CC_TYPE_TRIGGER 0
|
||||
#define CC_TYPE_CONTINUOUS 1
|
||||
|
||||
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
|
||||
short joy_id; // joystick button bound to action
|
||||
int used; // has control been used yet in mission? If so, this is the timestamp
|
||||
} config_item;
|
||||
|
||||
/**
|
||||
* All available actions
|
||||
* This is the value of the id field in config_item
|
||||
*/
|
||||
enum IoActionId {
|
||||
// targeting a ship
|
||||
TARGET_NEXT =0, //!< target next
|
||||
TARGET_PREV =1, //!< target previous
|
||||
TARGET_NEXT_CLOSEST_HOSTILE =2, //!< target the next hostile target
|
||||
TARGET_PREV_CLOSEST_HOSTILE =3, //!< target the previous closest hostile
|
||||
TOGGLE_AUTO_TARGETING =4, //!< toggle auto-targeting
|
||||
TARGET_NEXT_CLOSEST_FRIENDLY =5, //!< target the next friendly ship
|
||||
TARGET_PREV_CLOSEST_FRIENDLY =6, //!< target the closest friendly ship
|
||||
TARGET_SHIP_IN_RETICLE =7, //!< target ship closest to center of reticle
|
||||
TARGET_CLOSEST_SHIP_ATTACKING_TARGET =8, //!< target the closest ship attacking current target
|
||||
TARGET_LAST_TRANMISSION_SENDER =9, //!< TARGET_LAST_TRANMISSION_SENDER
|
||||
STOP_TARGETING_SHIP =10, //!< stop targeting ship
|
||||
|
||||
// targeting a ship's subsystem
|
||||
TARGET_SUBOBJECT_IN_RETICLE =11, //!< target ships subsystem in reticle
|
||||
TARGET_NEXT_SUBOBJECT =12, //!< target next subsystem on current target
|
||||
TARGET_PREV_SUBOBJECT =13, //!< TARGET_PREV_SUBOBJECT
|
||||
STOP_TARGETING_SUBSYSTEM =14, //!< stop targeting subsystems on ship
|
||||
|
||||
// speed matching
|
||||
MATCH_TARGET_SPEED =15, //!< match target speed
|
||||
TOGGLE_AUTO_MATCH_TARGET_SPEED =16, //!< toggle auto-match target speed
|
||||
|
||||
// weapons
|
||||
FIRE_PRIMARY =17, //!< FIRE_PRIMARY
|
||||
FIRE_SECONDARY =18, //!< FIRE_SECONDARY
|
||||
CYCLE_NEXT_PRIMARY =19, //!< cycle to next primary weapon
|
||||
CYCLE_PREV_PRIMARY =20, //!< cycle to previous primary weapon
|
||||
CYCLE_SECONDARY =21, //!< cycle to next secondary weapon
|
||||
CYCLE_NUM_MISSLES =22, //!< cycle number of missiles fired from secondary bank
|
||||
LAUNCH_COUNTERMEASURE =23, //!< LAUNCH_COUNTERMEASURE
|
||||
|
||||
// controls
|
||||
FORWARD_THRUST =24, //!< FORWARD_THRUST
|
||||
REVERSE_THRUST =25, //!< REVERSE_THRUST
|
||||
BANK_LEFT =26, //!< BANK_LEFT
|
||||
BANK_RIGHT =27, //!< BANK_RIGHT
|
||||
PITCH_FORWARD =28, //!< PITCH_FORWARD
|
||||
PITCH_BACK =29, //!< PITCH_BACK
|
||||
YAW_LEFT =30, //!< YAW_LEFT
|
||||
YAW_RIGHT =31, //!< YAW_RIGHT
|
||||
|
||||
// throttle control
|
||||
ZERO_THROTTLE =32, //!< ZERO_THROTTLE
|
||||
MAX_THROTTLE =33, //!< MAX_THROTTLE
|
||||
ONE_THIRD_THROTTLE =34, //!< ONE_THIRD_THROTTLE
|
||||
TWO_THIRDS_THROTTLE =35, //!< TWO_THIRDS_THROTTLE
|
||||
PLUS_5_PERCENT_THROTTLE =36, //!< PLUS_5_PERCENT_THROTTLE
|
||||
MINUS_5_PERCENT_THROTTLE =37, //!< MINUS_5_PERCENT_THROTTLE
|
||||
|
||||
// squadmate messaging keys
|
||||
ATTACK_MESSAGE =38, //!< wingman message: attack current target
|
||||
DISARM_MESSAGE =39, //!< wingman message: disarm current target
|
||||
DISABLE_MESSAGE =40, //!< wingman message: disable current target
|
||||
ATTACK_SUBSYSTEM_MESSAGE =41, //!< wingman message: disable current target
|
||||
CAPTURE_MESSAGE =42, //!< wingman message: capture current target
|
||||
ENGAGE_MESSAGE =43, //!< wingman message: engage enemy
|
||||
FORM_MESSAGE =44, //!< wingman message: form on my wing
|
||||
IGNORE_MESSAGE =45, //!< IGNORE_MESSAGE
|
||||
PROTECT_MESSAGE =46, //!< wingman message: protect current target
|
||||
COVER_MESSAGE =47, //!< wingman message: cover me
|
||||
WARP_MESSAGE =48, //!< wingman message: warp out
|
||||
REARM_MESSAGE =49, //!< REARM_MESSAGE
|
||||
TARGET_CLOSEST_SHIP_ATTACKING_SELF =50, //!< target closest ship that is attacking player
|
||||
|
||||
// Views
|
||||
VIEW_CHASE =51, //!< VIEW_CHASE
|
||||
VIEW_EXTERNAL =52, //!< VIEW_EXTERNAL
|
||||
VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK =53, //!< VIEW_EXTERNAL_TOGGLE_CAMERA_LOCK
|
||||
VIEW_SLEW =54, //!< VIEW_SLEW
|
||||
VIEW_OTHER_SHIP =55, //!< VIEW_OTHER_SHIP
|
||||
VIEW_DIST_INCREASE =56, //!< VIEW_DIST_INCREASE
|
||||
VIEW_DIST_DECREASE =57, //!< VIEW_DIST_DECREASE
|
||||
VIEW_CENTER =58, //!< VIEW_CENTER
|
||||
PADLOCK_UP =59, //!< PADLOCK_UP
|
||||
PADLOCK_DOWN =60, //!< PADLOCK_DOWN
|
||||
PADLOCK_LEFT =61, //!< PADLOCK_LEFT
|
||||
PADLOCK_RIGHT =62, //!< PADLOCK_RIGHT
|
||||
|
||||
RADAR_RANGE_CYCLE =63, //!< cycle to next radar range
|
||||
SQUADMSG_MENU =64, //!< toggle the squadmate messaging menu
|
||||
SHOW_GOALS =65, //!< show the mission goals screen
|
||||
END_MISSION =66, //!< end the mission
|
||||
TARGET_TARGETS_TARGET =67, //!< target your target's target
|
||||
AFTERBURNER =68, //!< AFTERBURNER
|
||||
|
||||
INCREASE_WEAPON =69, //!< increase weapon recharge rate
|
||||
DECREASE_WEAPON =70, //!< decrease weapon recharge rate
|
||||
INCREASE_SHIELD =71, //!< increase shield recharge rate
|
||||
DECREASE_SHIELD =72, //!< decrease shield recharge rate
|
||||
INCREASE_ENGINE =73, //!< increase energy to engines
|
||||
DECREASE_ENGINE =74, //!< decrease energy to engines
|
||||
ETS_EQUALIZE =75, //!< equalize recharge rates
|
||||
SHIELD_EQUALIZE =76, //!< equalize shield energy to all quadrants
|
||||
SHIELD_XFER_TOP =77, //!< transfer shield energy to front
|
||||
SHIELD_XFER_BOTTOM =78, //!< transfer shield energy to rear
|
||||
SHIELD_XFER_LEFT =79, //!< transfer shield energy to left
|
||||
SHIELD_XFER_RIGHT =80, //!< transfer shield energy to right
|
||||
|
||||
XFER_SHIELD =81, //!< transfer energy to shield from weapons
|
||||
XFER_LASER =82, //!< transfer energy to weapons from shield
|
||||
|
||||
//Backslash -- this was a convenient place for Glide When Pressed, since Show Damage Popup isn't used
|
||||
GLIDE_WHEN_PRESSED =83, //!< GLIDE_WHEN_PRESSED
|
||||
BANK_WHEN_PRESSED =84, //!< BANK_WHEN_PRESSED
|
||||
SHOW_NAVMAP =85, //!< SHOW_NAVMAP
|
||||
ADD_REMOVE_ESCORT =86, //!< ADD_REMOVE_ESCORT
|
||||
ESCORT_CLEAR =87, //!< ESCORT_CLEAR
|
||||
TARGET_NEXT_ESCORT_SHIP =88, //!< TARGET_NEXT_ESCORT_SHIP
|
||||
TARGET_CLOSEST_REPAIR_SHIP =89, //!< target the closest repair ship
|
||||
TARGET_NEXT_UNINSPECTED_CARGO =90, //!< TARGET_NEXT_UNINSPECTED_CARGO
|
||||
TARGET_PREV_UNINSPECTED_CARGO =91, //!< TARGET_PREV_UNINSPECTED_CARGO
|
||||
TARGET_NEWEST_SHIP =92, //!< TARGET_NEWEST_SHIP
|
||||
TARGET_NEXT_LIVE_TURRET =93, //!< TARGET_NEXT_LIVE_TURRET
|
||||
TARGET_PREV_LIVE_TURRET =94, //!< TARGET_PREV_LIVE_TURRET
|
||||
|
||||
TARGET_NEXT_BOMB =95, //!< TARGET_NEXT_BOMB
|
||||
TARGET_PREV_BOMB =96, //!< TARGET_PREV_BOMB
|
||||
|
||||
// multiplayer messaging keys
|
||||
MULTI_MESSAGE_ALL =97, //!< message all netplayers
|
||||
MULTI_MESSAGE_FRIENDLY =98, //!< message all friendlies
|
||||
MULTI_MESSAGE_HOSTILE =99, //!< message all hostiles
|
||||
MULTI_MESSAGE_TARGET =100, //!< message targeted ship (if player)
|
||||
|
||||
// multiplayer misc keys
|
||||
MULTI_OBSERVER_ZOOM_TO =101, //!< if i'm an observer, zoom to my targeted object
|
||||
|
||||
TIME_SPEED_UP =102, //!< TIME_SPEED_UP
|
||||
TIME_SLOW_DOWN =103, //!< TIME_SLOW_DOWN
|
||||
|
||||
TOGGLE_HUD_CONTRAST =104, //!< toggle between high and low HUD contrast
|
||||
|
||||
MULTI_TOGGLE_NETINFO =105, //!< toggle network info
|
||||
|
||||
MULTI_SELF_DESTRUCT =106, //!< self destruct (multiplayer only)
|
||||
|
||||
TOGGLE_HUD =107, //!< TOGGLE_HUD
|
||||
RIGHT_SLIDE_THRUST =108, //!< RIGHT_SLIDE_THRUST
|
||||
LEFT_SLIDE_THRUST =109, //!< LEFT_SLIDE_THRUST
|
||||
UP_SLIDE_THRUST =110, //!< UP_SLIDE_THRUST
|
||||
DOWN_SLIDE_THRUST =111, //!< DOWN_SLIDE_THRUST
|
||||
HUD_TARGETBOX_TOGGLE_WIREFRAME =112, //!< HUD_TARGETBOX_TOGGLE_WIREFRAME
|
||||
VIEW_TOPDOWN =113, //!< VIEW_TOPDOWN
|
||||
VIEW_TRACK_TARGET =114, //!< VIEW_TRACK_TARGET
|
||||
|
||||
//AutoPilot - Kazan
|
||||
AUTO_PILOT_TOGGLE =115, //!< Autopilot key control
|
||||
NAV_CYCLE =116, //!< NAV_CYCLE
|
||||
|
||||
//Gliding
|
||||
TOGGLE_GLIDING =117, //!< TOGGLE_GLIDING
|
||||
|
||||
/**
|
||||
* This must always be below the last defined action
|
||||
*/
|
||||
CCFG_MAX //!< The total number of defined control actions (or last define + 1)
|
||||
};
|
||||
|
||||
extern int Failed_key_index;
|
||||
extern int Invert_heading;
|
||||
extern int Invert_pitch;
|
||||
extern int Invert_roll;
|
||||
extern int Invert_thrust;
|
||||
extern int Disable_axis2;
|
||||
extern int Disable_axis3;
|
||||
|
||||
extern int Axis_map_to[];
|
||||
extern int Invert_axis[];
|
||||
extern int Invert_axis_defaults[];
|
||||
|
||||
extern config_item Control_config[]; // stores the keyboard configuration
|
||||
extern char **Scan_code_text;
|
||||
extern char **Joy_button_text;
|
||||
|
||||
// initialize common control config stuff - call at game startup after localization has been initialized
|
||||
void control_config_common_init();
|
||||
|
||||
void control_config_init();
|
||||
void control_config_do_frame(float frametime);
|
||||
void control_config_close();
|
||||
|
||||
void control_config_cancel_exit();
|
||||
|
||||
void control_config_reset_defaults();
|
||||
int translate_key_to_index(char *key);
|
||||
char *translate_key(char *key);
|
||||
char *textify_scancode(int code);
|
||||
float check_control_timef(int id);
|
||||
int check_control(int id, int key = -1);
|
||||
void control_get_axes_readings(int *h, int *p, int *b, int *ta, int *tr);
|
||||
void control_used(int id);
|
||||
void control_config_clear();
|
||||
void clear_key_binding(short key);
|
||||
void control_check_indicate();
|
||||
void control_config_clear_used_status();
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* 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 _FREESPACE_CUTSCENES_SCREEN_HEADER_FILE
|
||||
#define _FREESPACE_CUTSCENES_SCREEN_HEADER_FILE
|
||||
|
||||
#include "globalincs/globals.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
// this cutscene is always available.
|
||||
#define INTRO_CUTSCENE_FLAG (1<<0)
|
||||
|
||||
typedef struct cutscene_info
|
||||
{
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
char name[NAME_LENGTH];
|
||||
char *description;
|
||||
int cd;
|
||||
} cutscene_info;
|
||||
|
||||
extern SCP_vector<cutscene_info> Cutscenes;
|
||||
extern int Cutscenes_viewable;
|
||||
|
||||
// initializa table data
|
||||
void cutscene_init();
|
||||
int cutscene_get_cd_num(char *filename);
|
||||
|
||||
|
||||
void cutscenes_screen_init();
|
||||
void cutscenes_screen_close();
|
||||
void cutscenes_screen_do_frame();
|
||||
|
||||
int cutscenes_validate_cd(char *mve_name, int prompt_for_cd = 1);
|
||||
void cutscene_mark_viewable(char *filename);
|
||||
|
||||
#endif
|
||||
@@ -1,570 +0,0 @@
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
extern int g_width, g_height;
|
||||
extern void *g_vBackBuf1, *g_vBackBuf2;
|
||||
|
||||
/* 16 bit decoding routines */
|
||||
|
||||
static ushort *backBuf1, *backBuf2;
|
||||
static int lookup_initialized;
|
||||
|
||||
static void dispatchDecoder16(ushort **pFrame, ubyte codeType, ubyte **pData, ubyte **pOffData, int *pDataRemain, int *curXb, int *curYb);
|
||||
static void genLoopkupTable();
|
||||
|
||||
void decodeFrame16(ubyte *pFrame, ubyte *pMap, int mapRemain, unsigned char *pData, int dataRemain)
|
||||
{
|
||||
ubyte *pOrig, *pOffData, *pEnd, op;
|
||||
ushort offset;
|
||||
int length = 0, i, j, xb, yb;
|
||||
|
||||
if (!lookup_initialized) {
|
||||
genLoopkupTable();
|
||||
}
|
||||
|
||||
backBuf1 = (ushort *)g_vBackBuf1;
|
||||
backBuf2 = (ushort *)g_vBackBuf2;
|
||||
|
||||
xb = g_width >> 3;
|
||||
yb = g_height >> 3;
|
||||
|
||||
offset = pData[0]|(pData[1]<<8);
|
||||
|
||||
pOffData = pData + offset;
|
||||
pEnd = pData + offset;
|
||||
|
||||
pData += 2;
|
||||
|
||||
pOrig = pData;
|
||||
length = offset - 2; /*dataRemain-2;*/
|
||||
|
||||
for (j=0; j<yb; j++) {
|
||||
for (i=0; i<xb/2; i++) {
|
||||
op = (*pMap) & 0xf;
|
||||
dispatchDecoder16((ushort **)&pFrame, op, &pData, &pOffData, &dataRemain, &i, &j);
|
||||
|
||||
op = ((*pMap) >> 4) & 0xf;
|
||||
dispatchDecoder16((ushort **)&pFrame, op, &pData, &pOffData, &dataRemain, &i, &j);
|
||||
|
||||
pMap++;
|
||||
mapRemain--;
|
||||
}
|
||||
|
||||
pFrame += 7*g_width*2;
|
||||
}
|
||||
|
||||
if ((length-(pData-pOrig)) != 0) {
|
||||
nprintf(("MVE", "DEBUG: junk left over: %d,%d,%d\n", (pData-pOrig), length, (length-(pData-pOrig))));
|
||||
}
|
||||
}
|
||||
|
||||
static ushort GETPIXEL(unsigned char **buf, int off)
|
||||
{
|
||||
ushort val = (*buf)[0+off] | ((*buf)[1+off] << 8);
|
||||
return val;
|
||||
}
|
||||
|
||||
static ushort GETPIXELI(unsigned char **buf, int off)
|
||||
{
|
||||
ushort val = (*buf)[0+off] | ((*buf)[1+off] << 8);
|
||||
(*buf) += 2;
|
||||
return val;
|
||||
}
|
||||
|
||||
static void relClose(int i, int *x, int *y)
|
||||
{
|
||||
int ma, mi;
|
||||
|
||||
ma = i >> 4;
|
||||
mi = i & 0xf;
|
||||
|
||||
*x = mi - 8;
|
||||
*y = ma - 8;
|
||||
}
|
||||
|
||||
static void relFar(int i, int sign, int *x, int *y)
|
||||
{
|
||||
if (i < 56) {
|
||||
*x = sign * (8 + (i % 7));
|
||||
*y = sign * (i / 7);
|
||||
} else {
|
||||
*x = sign * (-14 + (i - 56) % 29);
|
||||
*y = sign * (8 + (i - 56) / 29);
|
||||
}
|
||||
}
|
||||
|
||||
static int close_table[512];
|
||||
static int far_p_table[512];
|
||||
static int far_n_table[512];
|
||||
|
||||
static void genLoopkupTable()
|
||||
{
|
||||
int i;
|
||||
int x, y;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
relClose(i, &x, &y);
|
||||
|
||||
close_table[i*2+0] = x;
|
||||
close_table[i*2+1] = y;
|
||||
|
||||
relFar(i, 1, &x, &y);
|
||||
|
||||
far_p_table[i*2+0] = x;
|
||||
far_p_table[i*2+1] = y;
|
||||
|
||||
relFar(i, -1, &x, &y);
|
||||
|
||||
far_n_table[i*2+0] = x;
|
||||
far_n_table[i*2+1] = y;
|
||||
}
|
||||
|
||||
lookup_initialized = 1;
|
||||
}
|
||||
|
||||
static void copyFrame(ushort *pDest, ushort *pSrc)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<8; i++) {
|
||||
memcpy(pDest, pSrc, 16);
|
||||
pDest += g_width;
|
||||
pSrc += g_width;
|
||||
}
|
||||
}
|
||||
|
||||
static void patternRow4Pixels(ushort *pFrame, unsigned char pat0, unsigned char pat1, ushort *p)
|
||||
{
|
||||
ushort mask=0x0003;
|
||||
ushort shift=0;
|
||||
ushort pattern = (pat1 << 8) | pat0;
|
||||
|
||||
while (mask != 0) {
|
||||
*pFrame++ = p[(mask & pattern) >> shift];
|
||||
mask <<= 2;
|
||||
shift += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void patternRow4Pixels2(ushort *pFrame, unsigned char pat0, ushort *p)
|
||||
{
|
||||
unsigned char mask=0x03;
|
||||
unsigned char shift=0;
|
||||
ushort pel;
|
||||
|
||||
while (mask != 0) {
|
||||
pel = p[(mask & pat0) >> shift];
|
||||
pFrame[0] = pel;
|
||||
pFrame[1] = pel;
|
||||
pFrame[g_width + 0] = pel;
|
||||
pFrame[g_width + 1] = pel;
|
||||
pFrame += 2;
|
||||
mask <<= 2;
|
||||
shift += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void patternRow4Pixels2x1(ushort *pFrame, unsigned char pat, ushort *p)
|
||||
{
|
||||
unsigned char mask=0x03;
|
||||
unsigned char shift=0;
|
||||
ushort pel;
|
||||
|
||||
while (mask != 0) {
|
||||
pel = p[(mask & pat) >> shift];
|
||||
pFrame[0] = pel;
|
||||
pFrame[1] = pel;
|
||||
pFrame += 2;
|
||||
mask <<= 2;
|
||||
shift += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void patternQuadrant4Pixels(ushort *pFrame, unsigned char pat0, unsigned char pat1, unsigned char pat2, unsigned char pat3, ushort *p)
|
||||
{
|
||||
unsigned long mask = 0x00000003UL;
|
||||
int shift=0;
|
||||
int i;
|
||||
unsigned long pat = (pat3 << 24) | (pat2 << 16) | (pat1 << 8) | pat0;
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
pFrame[i&3] = p[(pat & mask) >> shift];
|
||||
if ((i&3) == 3) {
|
||||
pFrame += g_width;
|
||||
}
|
||||
mask <<= 2;
|
||||
shift += 2;
|
||||
}
|
||||
}
|
||||
|
||||
static void patternRow2Pixels(ushort *pFrame, unsigned char pat, ushort *p)
|
||||
{
|
||||
unsigned char mask=0x01;
|
||||
|
||||
while (mask != 0) {
|
||||
*pFrame++ = p[(mask & pat) ? 1 : 0];
|
||||
mask <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void patternRow2Pixels2(ushort *pFrame, unsigned char pat, ushort *p)
|
||||
{
|
||||
ushort pel;
|
||||
unsigned char mask=0x1;
|
||||
|
||||
while (mask != 0x10) {
|
||||
pel = p[(mask & pat) ? 1 : 0];
|
||||
|
||||
pFrame[0] = pel;
|
||||
pFrame[1] = pel;
|
||||
pFrame[g_width + 0] = pel;
|
||||
pFrame[g_width + 1] = pel;
|
||||
pFrame += 2;
|
||||
|
||||
mask <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void patternQuadrant2Pixels(ushort *pFrame, unsigned char pat0, unsigned char pat1, ushort *p)
|
||||
{
|
||||
ushort mask = 0x0001;
|
||||
int i;
|
||||
ushort pat = (pat1 << 8) | pat0;
|
||||
|
||||
for (i=0; i<16; i++) {
|
||||
pFrame[i&3] = p[(pat & mask) ? 1 : 0];
|
||||
if ((i&3) == 3) {
|
||||
pFrame += g_width;
|
||||
}
|
||||
mask <<= 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void dispatchDecoder16(ushort **pFrame, unsigned char codeType, unsigned char **pData, unsigned char **pOffData, int *pDataRemain, int *curXb, int *curYb)
|
||||
{
|
||||
ushort p[4];
|
||||
unsigned char pat[16];
|
||||
int i, j, k;
|
||||
int x, y;
|
||||
ushort *pDstBak;
|
||||
|
||||
pDstBak = *pFrame;
|
||||
|
||||
switch(codeType) {
|
||||
case 0x0:
|
||||
copyFrame(*pFrame, *pFrame + (backBuf2 - backBuf1));
|
||||
break; // ADDED
|
||||
|
||||
case 0x1:
|
||||
break;
|
||||
|
||||
case 0x2:
|
||||
k = *(*pOffData)++;
|
||||
x = far_p_table[k*2+0];
|
||||
y = far_p_table[k*2+1];
|
||||
copyFrame(*pFrame, *pFrame + x + y*g_width);
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x3:
|
||||
k = *(*pOffData)++;
|
||||
x = far_n_table[k*2+0];
|
||||
y = far_n_table[k*2+1];
|
||||
copyFrame(*pFrame, *pFrame + x + y*g_width);
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x4:
|
||||
k = *(*pOffData)++;
|
||||
x = close_table[k*2+0];
|
||||
y = close_table[k*2+1];
|
||||
copyFrame(*pFrame, *pFrame + (backBuf2 - backBuf1) + x + y*g_width);
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x5:
|
||||
x = (char)*(*pData)++;
|
||||
y = (char)*(*pData)++;
|
||||
copyFrame(*pFrame, *pFrame + (backBuf2 - backBuf1) + x + y*g_width);
|
||||
*pDataRemain -= 2;
|
||||
break;
|
||||
|
||||
case 0x6:
|
||||
nprintf(("MVE", "STUB: encoding 6 not tested\n"));
|
||||
for (i=0; i<2; i++) {
|
||||
*pFrame += 16;
|
||||
if (++*curXb == (g_width >> 3)) {
|
||||
*pFrame += 7*g_width;
|
||||
*curXb = 0;
|
||||
if (++*curYb == (g_height >> 3)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x7:
|
||||
p[0] = GETPIXELI(pData, 0);
|
||||
p[1] = GETPIXELI(pData, 0);
|
||||
if (!((p[0]/*|p[1]*/)&0x8000)) {
|
||||
for (i=0; i<8; i++) {
|
||||
patternRow2Pixels(*pFrame, *(*pData), p);
|
||||
(*pData)++;
|
||||
*pFrame += g_width;
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<2; i++) {
|
||||
patternRow2Pixels2(*pFrame, *(*pData) & 0xf, p);
|
||||
*pFrame += 2*g_width;
|
||||
patternRow2Pixels2(*pFrame, *(*pData) >> 4, p);
|
||||
(*pData)++;
|
||||
*pFrame += 2*g_width;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x8:
|
||||
p[0] = GETPIXEL(pData, 0);
|
||||
if (!(p[0] & 0x8000)) {
|
||||
for (i=0; i<4; i++) {
|
||||
p[0] = GETPIXELI(pData, 0);
|
||||
p[1] = GETPIXELI(pData, 0);
|
||||
pat[0] = (*pData)[0];
|
||||
pat[1] = (*pData)[1];
|
||||
(*pData) += 2;
|
||||
patternQuadrant2Pixels(*pFrame, pat[0], pat[1], p);
|
||||
if (i & 1) {
|
||||
*pFrame -= (4*g_width - 4);
|
||||
} else {
|
||||
*pFrame += 4*g_width;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p[2] = GETPIXEL(pData, 8);
|
||||
if (!(p[2]&0x8000)) {
|
||||
for (i=0; i<4; i++) {
|
||||
if ((i & 1) == 0) {
|
||||
p[0] = GETPIXELI(pData, 0);
|
||||
p[1] = GETPIXELI(pData, 0);
|
||||
}
|
||||
pat[0] = *(*pData)++;
|
||||
pat[1] = *(*pData)++;
|
||||
patternQuadrant2Pixels(*pFrame, pat[0], pat[1], p);
|
||||
if (i & 1) {
|
||||
*pFrame -= (4*g_width - 4);
|
||||
} else {
|
||||
*pFrame += 4*g_width;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<8; i++) {
|
||||
if ((i & 3) == 0) {
|
||||
p[0] = GETPIXELI(pData, 0);
|
||||
p[1] = GETPIXELI(pData, 0);
|
||||
}
|
||||
patternRow2Pixels(*pFrame, *(*pData), p);
|
||||
(*pData)++;
|
||||
*pFrame += g_width;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x9:
|
||||
p[0] = GETPIXELI(pData, 0);
|
||||
p[1] = GETPIXELI(pData, 0);
|
||||
p[2] = GETPIXELI(pData, 0);
|
||||
p[3] = GETPIXELI(pData, 0);
|
||||
*pDataRemain -= 8;
|
||||
if (!(p[0] & 0x8000)) {
|
||||
if (!(p[2] & 0x8000)) {
|
||||
for (i=0; i<8; i++) {
|
||||
pat[0] = (*pData)[0];
|
||||
pat[1] = (*pData)[1];
|
||||
(*pData) += 2;
|
||||
patternRow4Pixels(*pFrame, pat[0], pat[1], p);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
*pDataRemain -= 16;
|
||||
} else {
|
||||
patternRow4Pixels2(*pFrame, (*pData)[0], p);
|
||||
*pFrame += 2*g_width;
|
||||
patternRow4Pixels2(*pFrame, (*pData)[1], p);
|
||||
*pFrame += 2*g_width;
|
||||
patternRow4Pixels2(*pFrame, (*pData)[2], p);
|
||||
*pFrame += 2*g_width;
|
||||
patternRow4Pixels2(*pFrame, (*pData)[3], p);
|
||||
(*pData) += 4;
|
||||
*pDataRemain -= 4;
|
||||
}
|
||||
} else {
|
||||
if (!(p[2] & 0x8000)) {
|
||||
for (i=0; i<8; i++) {
|
||||
pat[0] = (*pData)[0];
|
||||
(*pData) += 1;
|
||||
patternRow4Pixels2x1(*pFrame, pat[0], p);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
*pDataRemain -= 8;
|
||||
} else {
|
||||
for (i=0; i<4; i++) {
|
||||
pat[0] = (*pData)[0];
|
||||
pat[1] = (*pData)[1];
|
||||
(*pData) += 2;
|
||||
patternRow4Pixels(*pFrame, pat[0], pat[1], p);
|
||||
*pFrame += g_width;
|
||||
patternRow4Pixels(*pFrame, pat[0], pat[1], p);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
*pDataRemain -= 8;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xa:
|
||||
p[0] = GETPIXEL(pData, 0);
|
||||
if (!(p[0] & 0x8000)) {
|
||||
for (i=0; i<4; i++) {
|
||||
p[0] = GETPIXELI(pData, 0);
|
||||
p[1] = GETPIXELI(pData, 0);
|
||||
p[2] = GETPIXELI(pData, 0);
|
||||
p[3] = GETPIXELI(pData, 0);
|
||||
pat[0] = (*pData)[0];
|
||||
pat[1] = (*pData)[1];
|
||||
pat[2] = (*pData)[2];
|
||||
pat[3] = (*pData)[3];
|
||||
(*pData) += 4;
|
||||
patternQuadrant4Pixels(*pFrame, pat[0], pat[1], pat[2], pat[3], p);
|
||||
if (i & 1) {
|
||||
*pFrame -= (4*g_width - 4);
|
||||
} else {
|
||||
*pFrame += 4*g_width;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p[0] = GETPIXEL(pData, 16);
|
||||
if (!(p[0] & 0x8000)) {
|
||||
for (i=0; i<4; i++) {
|
||||
if ((i&1) == 0) {
|
||||
p[0] = GETPIXELI(pData, 0);
|
||||
p[1] = GETPIXELI(pData, 0);
|
||||
p[2] = GETPIXELI(pData, 0);
|
||||
p[3] = GETPIXELI(pData, 0);
|
||||
}
|
||||
pat[0] = (*pData)[0];
|
||||
pat[1] = (*pData)[1];
|
||||
pat[2] = (*pData)[2];
|
||||
pat[3] = (*pData)[3];
|
||||
(*pData) += 4;
|
||||
patternQuadrant4Pixels(*pFrame, pat[0], pat[1], pat[2], pat[3], p);
|
||||
if (i & 1) {
|
||||
*pFrame -= (4*g_width - 4);
|
||||
} else {
|
||||
*pFrame += 4*g_width;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i=0; i<8; i++) {
|
||||
if ((i&3) == 0) {
|
||||
p[0] = GETPIXELI(pData, 0);
|
||||
p[1] = GETPIXELI(pData, 0);
|
||||
p[2] = GETPIXELI(pData, 0);
|
||||
p[3] = GETPIXELI(pData, 0);
|
||||
}
|
||||
pat[0] = (*pData)[0];
|
||||
pat[1] = (*pData)[1];
|
||||
patternRow4Pixels(*pFrame, pat[0], pat[1], p);
|
||||
*pFrame += g_width;
|
||||
(*pData) += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xb:
|
||||
for (i=0; i<8; i++) {
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
ubyte frame_tmp[16];
|
||||
memcpy(&frame_tmp, *pData, 16);
|
||||
ushort *swap_tmp;
|
||||
for (j = 0; j < 16; j += 2) {
|
||||
swap_tmp = (ushort*)(frame_tmp + j);
|
||||
*swap_tmp = INTEL_SHORT(*swap_tmp);
|
||||
}
|
||||
memcpy(*pFrame, &frame_tmp, 16);
|
||||
#else
|
||||
memcpy(*pFrame, *pData, 16);
|
||||
#endif
|
||||
*pFrame += g_width;
|
||||
*pData += 16;
|
||||
*pDataRemain -= 16;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xc:
|
||||
for (i=0; i<4; i++) {
|
||||
p[0] = GETPIXEL(pData, 0);
|
||||
p[1] = GETPIXEL(pData, 2);
|
||||
p[2] = GETPIXEL(pData, 4);
|
||||
p[3] = GETPIXEL(pData, 6);
|
||||
for (j=0; j<2; j++) {
|
||||
for (k=0; k<4; k++) {
|
||||
(*pFrame)[2*k] = p[k];
|
||||
(*pFrame)[2*k+1] = p[k];
|
||||
}
|
||||
*pFrame += g_width;
|
||||
}
|
||||
*pData += 8;
|
||||
*pDataRemain -= 8;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xd:
|
||||
for (i=0; i<2; i++) {
|
||||
p[0] = GETPIXEL(pData, 0);
|
||||
p[1] = GETPIXEL(pData, 2);
|
||||
for (j=0; j<4; j++) {
|
||||
for (k=0; k<4; k++) {
|
||||
(*pFrame)[k*g_width+j] = p[0];
|
||||
(*pFrame)[k*g_width+j+4] = p[1];
|
||||
}
|
||||
}
|
||||
*pFrame += 4*g_width;
|
||||
*pData += 4;
|
||||
*pDataRemain -= 4;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xe:
|
||||
p[0] = GETPIXEL(pData, 0);
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (j = 0; j < 8; j++) {
|
||||
(*pFrame)[j] = p[0];
|
||||
}
|
||||
*pFrame += g_width;
|
||||
}
|
||||
*pData += 2;
|
||||
*pDataRemain -= 2;
|
||||
break;
|
||||
|
||||
case 0xf:
|
||||
p[0] = GETPIXEL(pData, 0);
|
||||
p[1] = GETPIXEL(pData, 1);
|
||||
for (i=0; i<8; i++) {
|
||||
for (j=0; j<8; j++) {
|
||||
(*pFrame)[j] = p[(i+j)&1];
|
||||
}
|
||||
*pFrame += g_width;
|
||||
}
|
||||
*pData += 4;
|
||||
*pDataRemain -= 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
*pFrame = pDstBak+8;
|
||||
}
|
||||
@@ -1,533 +0,0 @@
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
|
||||
extern int g_width, g_height;
|
||||
extern void *g_vBackBuf1, *g_vBackBuf2;
|
||||
|
||||
static void dispatchDecoder8(ubyte **pFrame, ubyte codeType, ubyte **pData, int *pDataRemain, int *curXb, int *curYb);
|
||||
|
||||
void decodeFrame8(ubyte *pFrame, ubyte *pMap, int mapRemain, ubyte *pData, int dataRemain)
|
||||
{
|
||||
int i, j;
|
||||
int xb, yb;
|
||||
|
||||
xb = g_width >> 3;
|
||||
yb = g_height >> 3;
|
||||
|
||||
for (j = 0; j < yb; j++) {
|
||||
for (i = 0; i < (xb / 2); i++) {
|
||||
dispatchDecoder8(&pFrame, (*pMap) & 0xf, &pData, &dataRemain, &i, &j);
|
||||
|
||||
dispatchDecoder8(&pFrame, (*pMap) >> 4, &pData, &dataRemain, &i, &j);
|
||||
|
||||
pMap++;
|
||||
mapRemain--;
|
||||
}
|
||||
|
||||
pFrame += 7*g_width;
|
||||
}
|
||||
}
|
||||
|
||||
static void relClose(int i, int *x, int *y)
|
||||
{
|
||||
int ma, mi;
|
||||
|
||||
ma = i >> 4;
|
||||
mi = i & 0xf;
|
||||
|
||||
*x = mi - 8;
|
||||
*y = ma - 8;
|
||||
}
|
||||
|
||||
static void relFar(int i, int sign, int *x, int *y)
|
||||
{
|
||||
if (i < 56) {
|
||||
*x = sign * (8 + (i % 7));
|
||||
*y = sign * (i / 7);
|
||||
} else {
|
||||
*x = sign * (-14 + (i - 56) % 29);
|
||||
*y = sign * (8 + (i - 56) / 29);
|
||||
}
|
||||
}
|
||||
|
||||
/* copies an 8x8 block from pSrc to pDest.
|
||||
pDest and pSrc are both g_width bytes wide */
|
||||
static void copyFrame(ubyte *pDest, ubyte *pSrc)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
memcpy(pDest, pSrc, 8);
|
||||
pDest += g_width;
|
||||
pSrc += g_width;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in the next eight bytes with p[0], p[1], p[2], or p[3],
|
||||
// depending on the corresponding two-bit value in pat0 and pat1
|
||||
static void patternRow4Pixels(ubyte *pFrame, ubyte pat0, ubyte pat1, ubyte *p)
|
||||
{
|
||||
ushort mask = 0x0003;
|
||||
ushort shift = 0;
|
||||
ushort pattern = (pat1 << 8) | pat0;
|
||||
|
||||
while (mask != 0) {
|
||||
*pFrame++ = p[(mask & pattern) >> shift];
|
||||
mask <<= 2;
|
||||
shift += 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in the next four 2x2 pixel blocks with p[0], p[1], p[2], or p[3],
|
||||
// depending on the corresponding two-bit value in pat0.
|
||||
static void patternRow4Pixels2(ubyte *pFrame, ubyte pat0, ubyte *p)
|
||||
{
|
||||
ubyte mask = 0x03;
|
||||
ubyte shift = 0;
|
||||
ubyte pel;
|
||||
|
||||
while (mask != 0) {
|
||||
pel = p[(mask & pat0) >> shift];
|
||||
pFrame[0] = pel;
|
||||
pFrame[1] = pel;
|
||||
pFrame[g_width + 0] = pel;
|
||||
pFrame[g_width + 1] = pel;
|
||||
pFrame += 2;
|
||||
mask <<= 2;
|
||||
shift += 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in the next four 2x1 pixel blocks with p[0], p[1], p[2], or p[3],
|
||||
// depending on the corresponding two-bit value in pat.
|
||||
static void patternRow4Pixels2x1(ubyte *pFrame, ubyte pat, ubyte *p)
|
||||
{
|
||||
ubyte mask = 0x03;
|
||||
ubyte shift = 0;
|
||||
ubyte pel;
|
||||
|
||||
while (mask != 0) {
|
||||
pel = p[(mask & pat) >> shift];
|
||||
pFrame[0] = pel;
|
||||
pFrame[1] = pel;
|
||||
pFrame += 2;
|
||||
mask <<= 2;
|
||||
shift += 2;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in the next 4x4 pixel block with p[0], p[1], p[2], or p[3],
|
||||
// depending on the corresponding two-bit value in pat0, pat1, pat2, and pat3.
|
||||
static void patternQuadrant4Pixels(ubyte *pFrame, ubyte pat0, ubyte pat1, ubyte pat2, ubyte pat3, ubyte *p)
|
||||
{
|
||||
unsigned long mask = 0x00000003UL;
|
||||
int shift=0;
|
||||
int i;
|
||||
unsigned long pat = (pat3 << 24) | (pat2 << 16) | (pat1 << 8) | pat0;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
pFrame[i&3] = p[(pat & mask) >> shift];
|
||||
|
||||
if ( (i & 3) == 3 )
|
||||
pFrame += g_width;
|
||||
|
||||
mask <<= 2;
|
||||
shift += 2;
|
||||
}
|
||||
}
|
||||
|
||||
// fills the next 8 pixels with either p[0] or p[1], depending on pattern
|
||||
static void patternRow2Pixels(ubyte *pFrame, ubyte pat, ubyte *p)
|
||||
{
|
||||
ubyte mask=0x01;
|
||||
|
||||
while (mask != 0) {
|
||||
*pFrame++ = p[(mask & pat) ? 1 : 0];
|
||||
mask <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// fills the next four 2 x 2 pixel boxes with either p[0] or p[1], depending on pattern
|
||||
static void patternRow2Pixels2(ubyte *pFrame, ubyte pat, ubyte *p)
|
||||
{
|
||||
ubyte pel;
|
||||
ubyte mask=0x1;
|
||||
|
||||
while (mask != 0x10) {
|
||||
pel = p[(mask & pat) ? 1 : 0];
|
||||
|
||||
pFrame[0] = pel; // upper-left
|
||||
pFrame[1] = pel; // upper-right
|
||||
pFrame[g_width + 0] = pel; // lower-left
|
||||
pFrame[g_width + 1] = pel; // lower-right
|
||||
pFrame += 2;
|
||||
|
||||
mask <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
// fills pixels in the next 4 x 4 pixel boxes with either p[0] or p[1], depending on pat0 and pat1.
|
||||
static void patternQuadrant2Pixels(ubyte *pFrame, ubyte pat0, ubyte pat1, ubyte *p)
|
||||
{
|
||||
ubyte pel;
|
||||
ushort mask = 0x0001;
|
||||
int i, j;
|
||||
ushort pat = (pat1 << 8) | pat0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
pel = p[(pat & mask) ? 1 : 0];
|
||||
|
||||
pFrame[j + i * g_width] = pel;
|
||||
|
||||
mask <<= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void dispatchDecoder8(ubyte **pFrame, ubyte codeType, ubyte **pData, int *pDataRemain, int *curXb, int *curYb)
|
||||
{
|
||||
ubyte p[4];
|
||||
ubyte pat[16];
|
||||
int i, j, k;
|
||||
int x, y;
|
||||
|
||||
switch(codeType) {
|
||||
case 0x0:
|
||||
copyFrame(*pFrame, *pFrame + ((ubyte *)g_vBackBuf2 - (ubyte *)g_vBackBuf1));
|
||||
*pFrame += 8;
|
||||
break;
|
||||
|
||||
case 0x1:
|
||||
*pFrame += 8;
|
||||
break;
|
||||
|
||||
case 0x2:
|
||||
relFar(*(*pData)++, 1, &x, &y);
|
||||
copyFrame(*pFrame, *pFrame + x + y*g_width);
|
||||
*pFrame += 8;
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x3:
|
||||
relFar(*(*pData)++, -1, &x, &y);
|
||||
copyFrame(*pFrame, *pFrame + x + y*g_width);
|
||||
*pFrame += 8;
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x4:
|
||||
relClose(*(*pData)++, &x, &y);
|
||||
copyFrame(*pFrame, *pFrame + ((ubyte *)g_vBackBuf2 - (ubyte *)g_vBackBuf1) + x + y*g_width);
|
||||
*pFrame += 8;
|
||||
(*pDataRemain)--;
|
||||
break;
|
||||
|
||||
case 0x5:
|
||||
x = (signed char)*(*pData)++;
|
||||
y = (signed char)*(*pData)++;
|
||||
copyFrame(*pFrame, *pFrame + ((ubyte *)g_vBackBuf2 - (ubyte *)g_vBackBuf1) + x + y*g_width);
|
||||
*pFrame += 8;
|
||||
*pDataRemain -= 2;
|
||||
break;
|
||||
|
||||
case 0x6:
|
||||
for (i = 0; i < 2; i++) {
|
||||
*pFrame += 16;
|
||||
|
||||
if (++*curXb == (g_width >> 3)) {
|
||||
*pFrame += 7*g_width;
|
||||
*curXb = 0;
|
||||
|
||||
if (++*curYb == (g_height >> 3))
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x7:
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
|
||||
if (p[0] <= p[1]) {
|
||||
for (i = 0; i < 8; i++) {
|
||||
patternRow2Pixels(*pFrame, *(*pData)++, p);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 2; i++) {
|
||||
patternRow2Pixels2(*pFrame, *(*pData) & 0xf, p);
|
||||
*pFrame += 2*g_width;
|
||||
|
||||
patternRow2Pixels2(*pFrame, *(*pData)++ >> 4, p);
|
||||
*pFrame += 2*g_width;
|
||||
}
|
||||
}
|
||||
|
||||
*pFrame -= (8*g_width - 8);
|
||||
break;
|
||||
|
||||
case 0x8:
|
||||
if ( (*pData)[0] <= (*pData)[1] ) {
|
||||
// four quadrant case
|
||||
for (i = 0; i < 4; i++) {
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
pat[0] = *(*pData)++;
|
||||
pat[1] = *(*pData)++;
|
||||
patternQuadrant2Pixels(*pFrame, pat[0], pat[1], p);
|
||||
|
||||
// alternate between moving down and moving up and right
|
||||
if (i & 1)
|
||||
*pFrame += 4 - 4*g_width; // up and right
|
||||
else
|
||||
*pFrame += 4*g_width; // down
|
||||
}
|
||||
} else if ( (*pData)[6] <= (*pData)[7] ) {
|
||||
// split horizontal
|
||||
for (i = 0; i < 4; i++) {
|
||||
if ((i & 1) == 0) {
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
}
|
||||
|
||||
pat[0] = *(*pData)++;
|
||||
pat[1] = *(*pData)++;
|
||||
patternQuadrant2Pixels(*pFrame, pat[0], pat[1], p);
|
||||
|
||||
if (i & 1)
|
||||
*pFrame -= (4*g_width - 4);
|
||||
else
|
||||
*pFrame += 4*g_width;
|
||||
}
|
||||
} else {
|
||||
// split vertical
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((i & 3) == 0) {
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
}
|
||||
|
||||
patternRow2Pixels(*pFrame, *(*pData)++, p);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
|
||||
*pFrame -= (8*g_width - 8);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x9:
|
||||
if ( (*pData)[0] <= (*pData)[1] ) {
|
||||
if ( (*pData)[2] <= (*pData)[3] ) {
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
p[2] = *(*pData)++;
|
||||
p[3] = *(*pData)++;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
pat[0] = *(*pData)++;
|
||||
pat[1] = *(*pData)++;
|
||||
|
||||
patternRow4Pixels(*pFrame, pat[0], pat[1], p);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
|
||||
*pFrame -= (8*g_width - 8);
|
||||
} else {
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
p[2] = *(*pData)++;
|
||||
p[3] = *(*pData)++;
|
||||
|
||||
patternRow4Pixels2(*pFrame, *(*pData)++, p);
|
||||
*pFrame += 2*g_width;
|
||||
|
||||
patternRow4Pixels2(*pFrame, *(*pData)++, p);
|
||||
*pFrame += 2*g_width;
|
||||
|
||||
patternRow4Pixels2(*pFrame, *(*pData)++, p);
|
||||
*pFrame += 2*g_width;
|
||||
|
||||
patternRow4Pixels2(*pFrame, *(*pData)++, p);
|
||||
*pFrame -= (6*g_width - 8);
|
||||
}
|
||||
} else {
|
||||
if ( (*pData)[2] <= (*pData)[3] ) {
|
||||
// draw 2x1 strips
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
p[2] = *(*pData)++;
|
||||
p[3] = *(*pData)++;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
pat[0] = *(*pData)++;
|
||||
|
||||
patternRow4Pixels2x1(*pFrame, pat[0], p);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
|
||||
*pFrame -= (8*g_width - 8);
|
||||
} else {
|
||||
// draw 1x2 strips
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
p[2] = *(*pData)++;
|
||||
p[3] = *(*pData)++;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
pat[0] = *(*pData)++;
|
||||
pat[1] = *(*pData)++;
|
||||
|
||||
patternRow4Pixels(*pFrame, pat[0], pat[1], p);
|
||||
*pFrame += g_width;
|
||||
|
||||
patternRow4Pixels(*pFrame, pat[0], pat[1], p);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
|
||||
*pFrame -= (8*g_width - 8);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xa:
|
||||
if ( (*pData)[0] <= (*pData)[1] ) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
p[2] = *(*pData)++;
|
||||
p[3] = *(*pData)++;
|
||||
pat[0] = *(*pData)++;
|
||||
pat[1] = *(*pData)++;
|
||||
pat[2] = *(*pData)++;
|
||||
pat[3] = *(*pData)++;
|
||||
|
||||
patternQuadrant4Pixels(*pFrame, pat[0], pat[1], pat[2], pat[3], p);
|
||||
|
||||
if (i & 1)
|
||||
*pFrame -= (4*g_width - 4);
|
||||
else
|
||||
*pFrame += 4*g_width;
|
||||
}
|
||||
} else {
|
||||
if ( (*pData)[12] <= (*pData)[13] ) {
|
||||
// split vertical
|
||||
for (i = 0; i < 4; i++) {
|
||||
if ((i&1) == 0) {
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
p[2] = *(*pData)++;
|
||||
p[3] = *(*pData)++;
|
||||
}
|
||||
|
||||
pat[0] = *(*pData)++;
|
||||
pat[1] = *(*pData)++;
|
||||
pat[2] = *(*pData)++;
|
||||
pat[3] = *(*pData)++;
|
||||
|
||||
patternQuadrant4Pixels(*pFrame, pat[0], pat[1], pat[2], pat[3], p);
|
||||
|
||||
if (i & 1)
|
||||
*pFrame -= (4*g_width - 4);
|
||||
else
|
||||
*pFrame += 4*g_width;
|
||||
}
|
||||
} else {
|
||||
// split horizontal
|
||||
for (i = 0; i < 8; i++) {
|
||||
if ((i&3) == 0) {
|
||||
p[0] = *(*pData)++;
|
||||
p[1] = *(*pData)++;
|
||||
p[2] = *(*pData)++;
|
||||
p[3] = *(*pData)++;
|
||||
}
|
||||
|
||||
pat[0] = *(*pData)++;
|
||||
pat[1] = *(*pData)++;
|
||||
|
||||
patternRow4Pixels(*pFrame, pat[0], pat[1], p);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
|
||||
*pFrame -= (8*g_width - 8);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xb:
|
||||
for (i = 0; i < 8; i++) {
|
||||
memcpy(*pFrame, *pData, 8);
|
||||
*pFrame += g_width;
|
||||
*pData += 8;
|
||||
*pDataRemain -= 8;
|
||||
}
|
||||
|
||||
*pFrame -= (8*g_width - 8);
|
||||
break;
|
||||
|
||||
case 0xc:
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 2; j++) {
|
||||
for (k = 0; k < 4; k++) {
|
||||
(*pFrame)[2*k] = (*pData)[k];
|
||||
(*pFrame)[2*k+1] = (*pData)[k];
|
||||
}
|
||||
|
||||
*pFrame += g_width;
|
||||
}
|
||||
|
||||
*pData += 4;
|
||||
*pDataRemain -= 4;
|
||||
}
|
||||
|
||||
*pFrame -= (8*g_width - 8);
|
||||
break;
|
||||
|
||||
case 0xd:
|
||||
for (i = 0; i < 2; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
for (k = 0; k < 4; k++) {
|
||||
(*pFrame)[k*g_width+j] = (*pData)[0];
|
||||
(*pFrame)[k*g_width+j+4] = (*pData)[1];
|
||||
}
|
||||
}
|
||||
|
||||
*pFrame += 4*g_width;
|
||||
*pData += 2;
|
||||
*pDataRemain -= 2;
|
||||
}
|
||||
|
||||
*pFrame -= (8*g_width - 8);
|
||||
break;
|
||||
|
||||
case 0xe:
|
||||
for (i = 0; i < 8; i++) {
|
||||
memset(*pFrame, **pData, 8);
|
||||
*pFrame += g_width;
|
||||
}
|
||||
|
||||
(*pData)++;
|
||||
(*pDataRemain)--;
|
||||
*pFrame -= (8*g_width - 8);
|
||||
break;
|
||||
|
||||
case 0xf:
|
||||
for (i = 0; i < 8; i++) {
|
||||
for (j = 0; j < 8; j++) {
|
||||
(*pFrame)[j] = (*pData)[(i+j)&1];
|
||||
}
|
||||
|
||||
*pFrame += g_width;
|
||||
}
|
||||
|
||||
*pData += 2;
|
||||
*pDataRemain -= 2;
|
||||
*pFrame -= (8*g_width - 8);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "graphics/2d.h"
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "cutscene/movie.h"
|
||||
#include "osapi/osapi.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "cutscene/cutscenes.h" // cutscene_mark_viewable()
|
||||
#include "cutscene/mvelib.h"
|
||||
#include "cutscene/oggplayer.h"
|
||||
|
||||
extern int Game_mode;
|
||||
|
||||
|
||||
#define MOVIE_NONE -1
|
||||
#define MOVIE_OGG 0
|
||||
#define MOVIE_MVE 1
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
// filename - file to search for
|
||||
// out_name - output, full path to file
|
||||
// returns non-zero if file is found
|
||||
int movie_find(char *filename, char *out_name)
|
||||
{
|
||||
char full_path[MAX_PATH];
|
||||
char tmp_name[MAX_PATH];
|
||||
int size, offset = 0;
|
||||
const int NUM_EXT = 2;
|
||||
const char *movie_ext[NUM_EXT] = { ".ogg", ".mve" };
|
||||
|
||||
if (out_name == NULL)
|
||||
return MOVIE_NONE;
|
||||
|
||||
|
||||
memset( full_path, 0, sizeof(full_path) );
|
||||
memset( tmp_name, 0, sizeof(tmp_name) );
|
||||
|
||||
// remove extension
|
||||
strcpy_s( tmp_name, filename );
|
||||
char *p = strrchr(tmp_name, '.');
|
||||
if ( p ) *p = 0;
|
||||
|
||||
int rc = cf_find_file_location_ext(tmp_name, NUM_EXT, movie_ext, CF_TYPE_ANY, sizeof(full_path) - 1, full_path, &size, &offset, 0);
|
||||
|
||||
if (rc == MOVIE_NONE)
|
||||
return MOVIE_NONE;
|
||||
|
||||
strcpy( out_name, full_path );
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Play one movie
|
||||
bool movie_play(char *name)
|
||||
{
|
||||
// mark the movie as viewable to the player when in a campaign
|
||||
// do this before anything else so that we're sure the movie is available
|
||||
// to the player even if it's not going to play right now
|
||||
if (Game_mode & GM_CAMPAIGN_MODE) {
|
||||
cutscene_mark_viewable(name);
|
||||
}
|
||||
|
||||
extern int Mouse_hidden;
|
||||
extern int Is_standalone;
|
||||
|
||||
if (Cmdline_nomovies || Is_standalone)
|
||||
return false;
|
||||
|
||||
|
||||
char full_name[MAX_PATH];
|
||||
int rc = 0;
|
||||
|
||||
memset(full_name, 0, sizeof(full_name));
|
||||
|
||||
rc = movie_find(name, full_name);
|
||||
|
||||
if (rc == MOVIE_NONE) {
|
||||
strcpy_s(full_name, name);
|
||||
char *p = strrchr(full_name, '.');
|
||||
if ( p ) *p = 0;
|
||||
|
||||
mprintf(("Movie Error: Unable to open '%s' movie in any supported format.\n", full_name));
|
||||
return false;
|
||||
}
|
||||
|
||||
// clear the screen and hide the mouse cursor
|
||||
Mouse_hidden++;
|
||||
gr_reset_clip();
|
||||
gr_set_color(255, 255, 255);
|
||||
gr_set_clear_color(0, 0, 0);
|
||||
gr_zbuffer_clear(0);
|
||||
// clear first buffer
|
||||
gr_clear();
|
||||
gr_flip();
|
||||
// clear second buffer (may not be one, but that's ok)
|
||||
gr_clear();
|
||||
gr_flip();
|
||||
// clear third buffer (may not be one, but that's ok)
|
||||
gr_clear();
|
||||
|
||||
if (rc == MOVIE_OGG) {
|
||||
THEORAFILE *movie_ogg = theora_open(name);
|
||||
|
||||
if (movie_ogg) {
|
||||
// start playing ...
|
||||
theora_play(movie_ogg);
|
||||
|
||||
// ... done playing, close the movie
|
||||
theora_close(movie_ogg);
|
||||
} else {
|
||||
// uh-oh, movie is invalid... Abory, Retry, Fail?
|
||||
mprintf(("MOVIE ERROR: Found invalid movie! (%s)\n", name));
|
||||
return false;
|
||||
}
|
||||
} else if (rc == MOVIE_MVE) {
|
||||
MVESTREAM *movie_mve = mve_open(name);
|
||||
|
||||
if (movie_mve) {
|
||||
// start playing ...
|
||||
mve_init(movie_mve);
|
||||
mve_play(movie_mve);
|
||||
|
||||
// ... done playing, close the movie
|
||||
mve_shutdown();
|
||||
mve_close(movie_mve);
|
||||
} else {
|
||||
// uh-oh, movie is invalid... Abory, Retry, Fail?
|
||||
mprintf(("MOVIE ERROR: Found invalid movie! (%s)\n", name));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// show the mouse cursor again
|
||||
Mouse_hidden--;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void movie_play_two(char *name1, char *name2)
|
||||
{
|
||||
if ( movie_play(name1) )
|
||||
movie_play(name2);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* 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 _MOVIE_HEADER_FILE
|
||||
#define _MOVIE_HEADER_FILE
|
||||
|
||||
bool movie_play(char *name);
|
||||
void movie_play_two(char *name1, char *name2);
|
||||
|
||||
#endif
|
||||
@@ -1,56 +0,0 @@
|
||||
|
||||
|
||||
static int audio_exp_table[256] =
|
||||
{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 47, 51, 56, 61,
|
||||
66, 72, 79, 86, 94, 102, 112, 122, 133, 145, 158, 173, 189, 206, 225, 245,
|
||||
267, 292, 318, 348, 379, 414, 452, 493, 538, 587, 640, 699, 763, 832, 908, 991,
|
||||
1081, 1180, 1288, 1405, 1534, 1673, 1826, 1993, 2175, 2373, 2590, 2826, 3084, 3365, 3672, 4008,
|
||||
4373, 4772, 5208, 5683, 6202, 6767, 7385, 8059, 8794, 9597, 10472, 11428, 12471, 13609, 14851, 16206,
|
||||
17685, 19298, 21060, 22981, 25078, 27367, 29864, 32589, -29973, -26728, -23186, -19322, -15105, -10503, -5481, -1,
|
||||
1, 1, 5481, 10503, 15105, 19322, 23186, 26728, 29973, -32589, -29864, -27367, -25078, -22981, -21060, -19298,
|
||||
-17685, -16206, -14851, -13609, -12471, -11428, -10472, -9597, -8794, -8059, -7385, -6767, -6202, -5683, -5208, -4772,
|
||||
-4373, -4008, -3672, -3365, -3084, -2826, -2590, -2373, -2175, -1993, -1826, -1673, -1534, -1405, -1288, -1180,
|
||||
-1081, -991, -908, -832, -763, -699, -640, -587, -538, -493, -452, -414, -379, -348, -318, -292,
|
||||
-267, -245, -225, -206, -189, -173, -158, -145, -133, -122, -112, -102, -94, -86, -79, -72,
|
||||
-66, -61, -56, -51, -47, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34, -33,
|
||||
-32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17,
|
||||
-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1
|
||||
};
|
||||
|
||||
static int getWord(unsigned char **fin)
|
||||
{
|
||||
int value = ((*fin)[1] << 8) | (*fin)[0];
|
||||
*fin += 2;
|
||||
return value;
|
||||
}
|
||||
|
||||
static void sendWord(short **fout, int nOffset)
|
||||
{
|
||||
*(*fout)++ = (short)nOffset;
|
||||
}
|
||||
|
||||
static void processSwath(short *fout, unsigned char *data, int swath, int *offsets)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<swath; i++) {
|
||||
offsets[i&1] += audio_exp_table[data[i]];
|
||||
sendWord(&fout, offsets[i&1]);
|
||||
}
|
||||
}
|
||||
|
||||
void mveaudio_uncompress(short *buffer, unsigned char *data)
|
||||
{
|
||||
int nCurOffsets[2];
|
||||
int swath;
|
||||
|
||||
data += 4;
|
||||
swath = getWord(&data) / 2;
|
||||
nCurOffsets[0] = getWord(&data);
|
||||
nCurOffsets[1] = getWord(&data);
|
||||
sendWord(&buffer, nCurOffsets[0]);
|
||||
sendWord(&buffer, nCurOffsets[1]);
|
||||
processSwath(buffer, data, swath, nCurOffsets);
|
||||
}
|
||||
@@ -1,371 +0,0 @@
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cutscene/mvelib.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
|
||||
static const char MVE_HEADER[] = "Interplay MVE File\x1A";
|
||||
static const short MVE_HDRCONST1 = 0x001A;
|
||||
static const short MVE_HDRCONST2 = 0x0100;
|
||||
static const short MVE_HDRCONST3 = 0x1133;
|
||||
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// public MVEFILE functions
|
||||
// -----------------------------------------------------------
|
||||
|
||||
// utility functions for mvefile and mveplayer
|
||||
short mve_get_short(ubyte *data)
|
||||
{
|
||||
short value;
|
||||
value = data[0] | (data[1] << 8);
|
||||
return value;
|
||||
}
|
||||
|
||||
ushort mve_get_ushort(ubyte *data)
|
||||
{
|
||||
ushort value;
|
||||
value = data[0] | (data[1] << 8);
|
||||
return value;
|
||||
}
|
||||
|
||||
int mve_get_int(ubyte *data)
|
||||
{
|
||||
int value;
|
||||
value = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
|
||||
return value;
|
||||
}
|
||||
|
||||
// open an MVE file
|
||||
MVEFILE *mvefile_open(char *filename)
|
||||
{
|
||||
int cf_opened = 0;
|
||||
int mve_valid = 1;
|
||||
char lower_name[MAX_FILENAME_LEN];
|
||||
char buffer[20];
|
||||
MVEFILE *file;
|
||||
|
||||
// create the file
|
||||
file = (MVEFILE *)vm_malloc(sizeof(MVEFILE));
|
||||
|
||||
// set defaults
|
||||
file->stream = NULL;
|
||||
file->cur_chunk = NULL;
|
||||
file->buf_size = 0;
|
||||
file->cur_fill = 0;
|
||||
file->next_segment = 0;
|
||||
|
||||
// lower case filename for checking
|
||||
strncpy(lower_name, filename, strlen(filename)+1);
|
||||
strlwr(lower_name);
|
||||
|
||||
char *p = strchr( lower_name, '.' );
|
||||
if ( p ) *p = 0;
|
||||
|
||||
strcat_s( lower_name, ".mve" );
|
||||
|
||||
// NOTE: CF_TYPE *must* be ANY to get movies off of the CDs
|
||||
// assume lower case filename for *nix
|
||||
file->stream = cfopen(lower_name, "rb", CFILE_NORMAL, CF_TYPE_ANY);
|
||||
if ( file->stream ) {
|
||||
cf_opened = 1;
|
||||
}
|
||||
|
||||
if (!cf_opened) {
|
||||
mvefile_close(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// initialize the buffer
|
||||
file->cur_chunk = (ubyte *)vm_malloc(100 + 1024);
|
||||
file->buf_size = 100 + 1024;
|
||||
|
||||
// verify the file's header
|
||||
cfread_string(buffer, 20, file->stream);
|
||||
|
||||
if (strcmp(buffer, MVE_HEADER))
|
||||
mve_valid = 0;
|
||||
|
||||
if (cfread_short(file->stream) != MVE_HDRCONST1)
|
||||
mve_valid = 0;
|
||||
|
||||
if (cfread_short(file->stream) != MVE_HDRCONST2)
|
||||
mve_valid = 0;
|
||||
|
||||
if (cfread_short(file->stream) != MVE_HDRCONST3)
|
||||
mve_valid = 0;
|
||||
|
||||
if (!mve_valid) {
|
||||
mvefile_close(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// now, prefetch the next chunk
|
||||
mvefile_fetch_next_chunk(file);
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
// close a MVE file
|
||||
void mvefile_close(MVEFILE *file)
|
||||
{
|
||||
// free the stream
|
||||
if (file->stream)
|
||||
cfclose(file->stream);
|
||||
|
||||
file->stream = NULL;
|
||||
|
||||
// free the buffer
|
||||
if (file->cur_chunk)
|
||||
vm_free(file->cur_chunk);
|
||||
|
||||
file->cur_chunk = NULL;
|
||||
|
||||
// not strictly necessary
|
||||
file->buf_size = 0;
|
||||
file->cur_fill = 0;
|
||||
file->next_segment = 0;
|
||||
|
||||
// free the struct
|
||||
vm_free(file);
|
||||
}
|
||||
|
||||
// get the size of the next segment
|
||||
int mvefile_get_next_segment_size(MVEFILE *file)
|
||||
{
|
||||
// if nothing is cached, fail
|
||||
if (file->cur_chunk == NULL || file->next_segment >= file->cur_fill)
|
||||
return -1;
|
||||
|
||||
// if we don't have enough data to get a segment, fail
|
||||
if (file->cur_fill - file->next_segment < 4)
|
||||
return -1;
|
||||
|
||||
// otherwise, get the data length
|
||||
return mve_get_short(file->cur_chunk + file->next_segment);
|
||||
}
|
||||
|
||||
// get type of next segment in chunk (0xff if no more segments in chunk)
|
||||
ubyte mvefile_get_next_segment_major(MVEFILE *file)
|
||||
{
|
||||
// if nothing is cached, fail
|
||||
if (file->cur_chunk == NULL || file->next_segment >= file->cur_fill)
|
||||
return 0xff;
|
||||
|
||||
// if we don't have enough data to get a segment, fail
|
||||
if (file->cur_fill - file->next_segment < 4)
|
||||
return 0xff;
|
||||
|
||||
// otherwise, get the data length
|
||||
return file->cur_chunk[file->next_segment + 2];
|
||||
}
|
||||
|
||||
// get subtype (version) of next segment in chunk (0xff if no more segments in chunk)
|
||||
ubyte mvefile_get_next_segment_minor(MVEFILE *file)
|
||||
{
|
||||
// if nothing is cached, fail
|
||||
if (file->cur_chunk == NULL || file->next_segment >= file->cur_fill)
|
||||
return 0xff;
|
||||
|
||||
// if we don't have enough data to get a segment, fail
|
||||
if (file->cur_fill - file->next_segment < 4)
|
||||
return 0xff;
|
||||
|
||||
// otherwise, get the data length
|
||||
return file->cur_chunk[file->next_segment + 3];
|
||||
}
|
||||
|
||||
// see next segment (return NULL if no next segment)
|
||||
ubyte *mvefile_get_next_segment(MVEFILE *file)
|
||||
{
|
||||
// if nothing is cached, fail
|
||||
if (file->cur_chunk == NULL || file->next_segment >= file->cur_fill)
|
||||
return NULL;
|
||||
|
||||
// if we don't have enough data to get a segment, fail
|
||||
if (file->cur_fill - file->next_segment < 4)
|
||||
return NULL;
|
||||
|
||||
// otherwise, get the data length
|
||||
return file->cur_chunk + file->next_segment + 4;
|
||||
}
|
||||
|
||||
// advance to next segment
|
||||
void mvefile_advance_segment(MVEFILE *file)
|
||||
{
|
||||
// if nothing is cached, fail
|
||||
if (file->cur_chunk == NULL || file->next_segment >= file->cur_fill)
|
||||
return;
|
||||
|
||||
// if we don't have enough data to get a segment, fail
|
||||
if (file->cur_fill - file->next_segment < 4)
|
||||
return;
|
||||
|
||||
// else, advance to next segment
|
||||
file->next_segment += (4 + mve_get_ushort(file->cur_chunk + file->next_segment));
|
||||
}
|
||||
|
||||
// fetch the next chunk (return 0 if at end of stream)
|
||||
int mvefile_fetch_next_chunk(MVEFILE *file)
|
||||
{
|
||||
ubyte buffer[4];
|
||||
ubyte *new_buffer;
|
||||
ushort length;
|
||||
|
||||
// fail if not open
|
||||
if (file->stream == NULL)
|
||||
return 0;
|
||||
|
||||
// fail if we can't read the next segment descriptor
|
||||
if (cfread(buffer, 1, 4, file->stream) < 4)
|
||||
return 0;
|
||||
|
||||
// pull out the next length
|
||||
length = mve_get_short(buffer);
|
||||
|
||||
// setup a new buffer if needed --
|
||||
// only allocate new buffer is old one is too small
|
||||
if (length > file->buf_size) {
|
||||
// allocate new buffer
|
||||
new_buffer = (ubyte *)vm_malloc(100 + length);
|
||||
|
||||
// copy old data
|
||||
if (file->cur_chunk && file->cur_fill)
|
||||
memcpy(new_buffer, file->cur_chunk, file->cur_fill);
|
||||
|
||||
// free old buffer
|
||||
if (file->cur_chunk) {
|
||||
vm_free(file->cur_chunk);
|
||||
file->cur_chunk = NULL;
|
||||
}
|
||||
|
||||
// install new buffer
|
||||
file->cur_chunk = new_buffer;
|
||||
file->buf_size = 100 + length;
|
||||
}
|
||||
|
||||
// read the chunk
|
||||
if (length > 0) {
|
||||
if (cfread(file->cur_chunk, 1, length, file->stream) < length)
|
||||
return 0;
|
||||
}
|
||||
|
||||
file->cur_fill = length;
|
||||
file->next_segment = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// public MVESTREAM functions
|
||||
// -----------------------------------------------------------
|
||||
|
||||
// open an MVE stream
|
||||
MVESTREAM *mve_open(char *filename)
|
||||
{
|
||||
MVESTREAM *stream;
|
||||
|
||||
// allocate
|
||||
stream = (MVESTREAM *)vm_malloc(sizeof(MVESTREAM));
|
||||
|
||||
// defaults
|
||||
stream->movie = NULL;
|
||||
|
||||
// open
|
||||
stream->movie = mvefile_open(filename);
|
||||
|
||||
if (stream->movie == NULL) {
|
||||
mve_close(stream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
// close an MVE stream
|
||||
void mve_close(MVESTREAM *stream)
|
||||
{
|
||||
// close MVEFILE
|
||||
if (stream->movie)
|
||||
mvefile_close(stream->movie);
|
||||
|
||||
stream->movie = NULL;
|
||||
|
||||
vm_free(stream);
|
||||
}
|
||||
|
||||
// play next chunk
|
||||
int mve_play_next_chunk(MVESTREAM *stream)
|
||||
{
|
||||
ubyte major, minor;
|
||||
ubyte *data;
|
||||
int len;
|
||||
|
||||
// loop over segments
|
||||
major = mvefile_get_next_segment_major(stream->movie);
|
||||
while (major != 0xff) {
|
||||
// check whether to handle the segment
|
||||
if (major < 32) {
|
||||
minor = mvefile_get_next_segment_minor(stream->movie);
|
||||
len = mvefile_get_next_segment_size(stream->movie);
|
||||
data = mvefile_get_next_segment(stream->movie);
|
||||
|
||||
switch (major) {
|
||||
case 0x00:
|
||||
mve_end_movie();
|
||||
break;
|
||||
case 0x01:
|
||||
mve_end_chunk();
|
||||
break;
|
||||
case 0x02:
|
||||
mve_timer_create(data);
|
||||
break;
|
||||
case 0x03:
|
||||
mve_audio_createbuf(minor, data);
|
||||
break;
|
||||
case 0x04:
|
||||
mve_audio_play();
|
||||
break;
|
||||
case 0x05:
|
||||
if (!mve_video_createbuf(minor, data))
|
||||
return 0;
|
||||
break;
|
||||
case 0x07:
|
||||
mve_video_display();
|
||||
break;
|
||||
case 0x08:
|
||||
mve_audio_data(major, data);
|
||||
break;
|
||||
case 0x09:
|
||||
mve_audio_data(major, data);
|
||||
break;
|
||||
case 0x0a:
|
||||
if (!mve_video_init(data))
|
||||
return 0;
|
||||
break;
|
||||
case 0x0c:
|
||||
mve_video_palette(data);
|
||||
break;
|
||||
case 0x0f:
|
||||
mve_video_codemap(data, len);
|
||||
break;
|
||||
case 0x11:
|
||||
mve_video_data(data, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// advance to next segment
|
||||
mvefile_advance_segment(stream->movie);
|
||||
major = mvefile_get_next_segment_major(stream->movie);
|
||||
}
|
||||
|
||||
if (!mvefile_fetch_next_chunk(stream->movie))
|
||||
return 0;
|
||||
|
||||
// return status
|
||||
return 1;
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
|
||||
|
||||
#ifndef INCLUDED_MVELIB_H
|
||||
#define INCLUDED_MVELIB_H
|
||||
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
struct CFILE;
|
||||
|
||||
// structure for maintaining info on a MVEFILE stream
|
||||
typedef struct MVEFILE
|
||||
{
|
||||
CFILE *stream;
|
||||
ubyte *cur_chunk;
|
||||
int buf_size;
|
||||
int cur_fill;
|
||||
int next_segment;
|
||||
} MVEFILE;
|
||||
|
||||
// open a .MVE file
|
||||
MVEFILE *mvefile_open(char *filename);
|
||||
|
||||
// close a .MVE file
|
||||
void mvefile_close(MVEFILE *movie);
|
||||
|
||||
// get size of next segment in chunk (-1 if no more segments in chunk)
|
||||
int mvefile_get_next_segment_size(MVEFILE *movie);
|
||||
|
||||
// get type of next segment in chunk (0xff if no more segments in chunk)
|
||||
ubyte mvefile_get_next_segment_major(MVEFILE *movie);
|
||||
|
||||
// get subtype (version) of next segment in chunk (0xff if no more segments in chunk)
|
||||
ubyte mvefile_get_next_segment_minor(MVEFILE *movie);
|
||||
|
||||
// see next segment (return NULL if no next segment)
|
||||
ubyte *mvefile_get_next_segment(MVEFILE *movie);
|
||||
|
||||
// advance to next segment
|
||||
void mvefile_advance_segment(MVEFILE *movie);
|
||||
|
||||
// fetch the next chunk (return 0 if at end of stream)
|
||||
int mvefile_fetch_next_chunk(MVEFILE *movie);
|
||||
|
||||
// structure for maintaining an MVE stream
|
||||
typedef struct MVESTREAM
|
||||
{
|
||||
MVEFILE *movie;
|
||||
} MVESTREAM;
|
||||
|
||||
// open an MVE stream
|
||||
MVESTREAM *mve_open(char *filename);
|
||||
|
||||
// close an MVE stream
|
||||
void mve_close(MVESTREAM *movie);
|
||||
|
||||
// play next chunk
|
||||
int mve_play_next_chunk(MVESTREAM *movie);
|
||||
|
||||
// basic movie playing functions
|
||||
void mve_init(MVESTREAM *mve);
|
||||
void mve_play(MVESTREAM *mve);
|
||||
void mve_shutdown();
|
||||
|
||||
// utility functions
|
||||
short mve_get_short(ubyte *data);
|
||||
ushort mve_get_ushort(ubyte *data);
|
||||
int mve_get_int(ubyte *data);
|
||||
|
||||
// callbacks for data handling
|
||||
// audio
|
||||
void mve_audio_createbuf(ubyte minor, ubyte *data);
|
||||
int mve_audio_data(ubyte major, ubyte *data);
|
||||
void mve_audio_play();
|
||||
// video
|
||||
int mve_video_createbuf(ubyte minor, ubyte *data);
|
||||
int mve_video_init(ubyte *data);
|
||||
void mve_video_palette(ubyte *data);
|
||||
void mve_video_data(ubyte *data, int len);
|
||||
void mve_video_codemap(ubyte *data, int len);
|
||||
void mve_video_display();
|
||||
// misc
|
||||
void mve_end_movie();
|
||||
void mve_end_chunk();
|
||||
int mve_timer_create(ubyte *data);
|
||||
|
||||
typedef short mves;
|
||||
|
||||
#endif /* INCLUDED_MVELIB_H */
|
||||
@@ -1,806 +0,0 @@
|
||||
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropenglstate.h"
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cutscene/mvelib.h"
|
||||
#include "cutscene/movie.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "io/key.h"
|
||||
#include "osapi/osapi.h"
|
||||
#include "io/timer.h"
|
||||
#include "sound/sound.h"
|
||||
#include "sound/openal.h"
|
||||
#include "bmpman/bmpman.h"
|
||||
//#include "sound/audiostr.h"
|
||||
|
||||
|
||||
extern int Cmdline_noscalevid;
|
||||
|
||||
static int mve_playing;
|
||||
|
||||
// timer variables
|
||||
static int micro_frame_delay = 0;
|
||||
static int timer_started = 0;
|
||||
#ifdef SCP_UNIX
|
||||
static struct timeval timer_expire = { 0, 0 };
|
||||
#else
|
||||
static int timer_expire;
|
||||
#endif
|
||||
|
||||
// audio variables
|
||||
#define MVE_AUDIO_BUFFERS 64 // total buffers to interact with stream
|
||||
static int mve_audio_buffer_tail = 0;
|
||||
static int mve_audio_playing = 0;
|
||||
static int mve_audio_canplay = 0;
|
||||
static int mve_audio_compressed = 0;
|
||||
static int audiobuf_created;
|
||||
|
||||
// struct for the audio stream information
|
||||
typedef struct MVE_AUDIO_T {
|
||||
ALenum format;
|
||||
int sample_rate;
|
||||
int bytes_per_sec;
|
||||
int channels;
|
||||
int bitsize;
|
||||
ALuint source_id;
|
||||
ALuint audio_buffer[MVE_AUDIO_BUFFERS];
|
||||
} mve_audio_t;
|
||||
|
||||
mve_audio_t *mas; // mve_audio_stream
|
||||
|
||||
// audio decompressor
|
||||
extern void mveaudio_uncompress(short *buffer, unsigned char *data);
|
||||
|
||||
// video variables
|
||||
int g_width, g_height;
|
||||
void *g_vBuffers = NULL;
|
||||
void *g_vBackBuf1, *g_vBackBuf2;
|
||||
ushort *pixelbuf = NULL;
|
||||
static GLuint GLtex = 0;
|
||||
static GLint gl_screenYH = 0;
|
||||
static GLint gl_screenXW = 0;
|
||||
static GLfloat gl_screenU = 0;
|
||||
static GLfloat gl_screenV = 0;
|
||||
static int g_screenWidth, g_screenHeight;
|
||||
static int g_screenX, g_screenY;
|
||||
static int g_truecolor = 0;
|
||||
static ubyte g_palette[768];
|
||||
static ubyte *g_pCurMap = NULL;
|
||||
static int g_nMapLength = 0;
|
||||
static int videobuf_created, video_inited;
|
||||
static int hp2, wp2;
|
||||
static uint mve_video_skiptimer = 0;
|
||||
static int mve_scale_video = 0;
|
||||
|
||||
// video externs from API graphics functions
|
||||
extern void opengl_tcache_get_adjusted_texture_size(int w_in, int h_in, int *w_out, int *h_out);
|
||||
extern GLenum GL_previous_texture_target;
|
||||
|
||||
// the decoders
|
||||
extern void decodeFrame16(ubyte *pFrame, ubyte *pMap, int mapRemain, ubyte *pData, int dataRemain);
|
||||
extern void decodeFrame8(ubyte *pFrame, ubyte *pMap, int mapRemain, ubyte *pData, int dataRemain);
|
||||
|
||||
|
||||
/*************************
|
||||
* general handlers
|
||||
*************************/
|
||||
void mve_end_movie()
|
||||
{
|
||||
mve_playing = 0;
|
||||
}
|
||||
|
||||
/*************************
|
||||
* timer handlers
|
||||
*************************/
|
||||
|
||||
int mve_timer_create(ubyte *data)
|
||||
{
|
||||
int rate = mve_get_int(data);
|
||||
int subd = mve_get_short(data+4);
|
||||
|
||||
micro_frame_delay = rate * subd;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void mve_timer_start(void)
|
||||
{
|
||||
#ifdef SCP_UNIX
|
||||
int nsec = 0;
|
||||
|
||||
gettimeofday(&timer_expire, NULL);
|
||||
|
||||
timer_expire.tv_usec += micro_frame_delay;
|
||||
|
||||
if (timer_expire.tv_usec > 1000000) {
|
||||
nsec = timer_expire.tv_usec / 1000000;
|
||||
timer_expire.tv_sec += nsec;
|
||||
timer_expire.tv_usec -= nsec * 1000000;
|
||||
}
|
||||
#else
|
||||
timer_expire = timer_get_microseconds();
|
||||
timer_expire += micro_frame_delay;
|
||||
#endif
|
||||
|
||||
timer_started = 1;
|
||||
}
|
||||
|
||||
static int mve_do_timer_wait(void)
|
||||
{
|
||||
if (!timer_started) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef SCP_UNIX
|
||||
int nsec = 0;
|
||||
struct timespec ts, tsRem;
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
if (tv.tv_sec > timer_expire.tv_sec) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ( (tv.tv_sec == timer_expire.tv_sec) && (tv.tv_usec >= timer_expire.tv_usec) ) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
ts.tv_sec = timer_expire.tv_sec - tv.tv_sec;
|
||||
ts.tv_nsec = 1000 * (timer_expire.tv_usec - tv.tv_usec);
|
||||
|
||||
if (ts.tv_nsec < 0) {
|
||||
ts.tv_nsec += 1000000000UL;
|
||||
--ts.tv_sec;
|
||||
}
|
||||
|
||||
if ( (nanosleep(&ts, &tsRem) == -1) && (errno == EINTR) ) {
|
||||
// so we got an error that was a signal interupt, try to sleep again with remainder of time
|
||||
if ( (nanosleep(&tsRem, NULL) == -1) && (errno == EINTR) ) {
|
||||
mprintf(("MVE: Timer error! Aborting movie playback!\n"));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
timer_expire.tv_usec += micro_frame_delay;
|
||||
|
||||
if (timer_expire.tv_usec > 1000000) {
|
||||
nsec = timer_expire.tv_usec / 1000000;
|
||||
timer_expire.tv_sec += nsec;
|
||||
timer_expire.tv_usec -= nsec * 1000000;
|
||||
}
|
||||
#else
|
||||
int tv, ts, ts2;
|
||||
|
||||
tv = timer_get_microseconds();
|
||||
|
||||
if (tv > timer_expire) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
ts = timer_expire - tv;
|
||||
ts2 = ts/1000;
|
||||
Sleep(ts2);
|
||||
|
||||
end:
|
||||
timer_expire += micro_frame_delay;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mve_timer_stop()
|
||||
{
|
||||
#ifdef SCP_UNIX
|
||||
timer_expire.tv_sec = 0;
|
||||
timer_expire.tv_usec = 0;
|
||||
#else
|
||||
timer_expire = 0;
|
||||
#endif
|
||||
timer_started = 0;
|
||||
}
|
||||
|
||||
/*************************
|
||||
* audio handlers
|
||||
*************************/
|
||||
|
||||
// setup the audio information from the data stream
|
||||
void mve_audio_createbuf(ubyte minor, ubyte *data)
|
||||
{
|
||||
if (audiobuf_created) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if game sound disabled don't try and play movie audio
|
||||
if (!Sound_enabled) {
|
||||
mve_audio_canplay = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
int flags, desired_buffer, sample_rate;
|
||||
|
||||
mas = (mve_audio_t *) vm_malloc ( sizeof(mve_audio_t) );
|
||||
memset(mas, 0, sizeof(mve_audio_t));
|
||||
|
||||
mas->format = AL_INVALID;
|
||||
|
||||
flags = mve_get_ushort(data + 2);
|
||||
sample_rate = mve_get_ushort(data + 4);
|
||||
desired_buffer = mve_get_int(data + 6);
|
||||
|
||||
mas->channels = (flags & 0x0001) ? 2 : 1;
|
||||
mas->bitsize = (flags & 0x0002) ? 16 : 8;
|
||||
|
||||
mas->sample_rate = sample_rate;
|
||||
|
||||
if (minor > 0) {
|
||||
mve_audio_compressed = flags & 0x0004 ? 1 : 0;
|
||||
} else {
|
||||
mve_audio_compressed = 0;
|
||||
}
|
||||
|
||||
if (mas->bitsize == 16) {
|
||||
if (mas->channels == 2) {
|
||||
mas->format = AL_FORMAT_STEREO16;
|
||||
} else if (mas->channels == 1) {
|
||||
mas->format = AL_FORMAT_MONO16;
|
||||
}
|
||||
} else if (mas->bitsize == 8) {
|
||||
if (mas->channels == 2) {
|
||||
mas->format = AL_FORMAT_STEREO8;
|
||||
} else if (mas->channels == 1) {
|
||||
mas->format = AL_FORMAT_MONO8;
|
||||
}
|
||||
}
|
||||
|
||||
// somethings wrong, bail now
|
||||
if (mas->format == AL_INVALID) {
|
||||
mve_audio_canplay = 0;
|
||||
audiobuf_created = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
OpenAL_ErrorCheck( alGenSources(1, &mas->source_id), { mve_audio_canplay = 0; return; } );
|
||||
|
||||
mve_audio_canplay = 1;
|
||||
|
||||
OpenAL_ErrorPrint( alSourcef(mas->source_id, AL_GAIN, 1.0f) );
|
||||
|
||||
memset(mas->audio_buffer, 0, MVE_AUDIO_BUFFERS * sizeof(ALuint));
|
||||
|
||||
mve_audio_buffer_tail = 0;
|
||||
|
||||
audiobuf_created = 1;
|
||||
}
|
||||
|
||||
// play and stream the audio
|
||||
void mve_audio_play()
|
||||
{
|
||||
if (mve_audio_canplay) {
|
||||
ALint status, bqueued;
|
||||
|
||||
OpenAL_ErrorCheck( alGetSourcei(mas->source_id, AL_SOURCE_STATE, &status), return );
|
||||
|
||||
OpenAL_ErrorCheck( alGetSourcei(mas->source_id, AL_BUFFERS_QUEUED, &bqueued), return );
|
||||
|
||||
mve_audio_playing = 1;
|
||||
|
||||
if (status != AL_PLAYING && bqueued > 0) {
|
||||
OpenAL_ErrorPrint( alSourcePlay(mas->source_id) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// call this in shutdown to stop and close audio
|
||||
static void mve_audio_stop()
|
||||
{
|
||||
if (!audiobuf_created) {
|
||||
return;
|
||||
}
|
||||
|
||||
ALint p = 0;
|
||||
|
||||
mve_audio_playing = 0;
|
||||
|
||||
OpenAL_ErrorPrint( alSourceStop(mas->source_id) );
|
||||
OpenAL_ErrorPrint( alGetSourcei(mas->source_id, AL_BUFFERS_PROCESSED, &p) );
|
||||
OpenAL_ErrorPrint( alSourceUnqueueBuffers(mas->source_id, p, mas->audio_buffer) );
|
||||
OpenAL_ErrorPrint( alDeleteSources(1, &mas->source_id) );
|
||||
|
||||
for (int i = 0; i < MVE_AUDIO_BUFFERS; i++) {
|
||||
// make sure that the buffer is real before trying to delete, it could crash for some otherwise
|
||||
if ( (mas->audio_buffer[i] != 0) && alIsBuffer(mas->audio_buffer[i]) ) {
|
||||
OpenAL_ErrorPrint( alDeleteBuffers(1, &mas->audio_buffer[i]) );
|
||||
}
|
||||
}
|
||||
|
||||
if (mas != NULL) {
|
||||
vm_free(mas);
|
||||
mas = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int mve_audio_data(ubyte major, ubyte *data)
|
||||
{
|
||||
static const int selected_chan=1;
|
||||
int chan;
|
||||
int nsamp;
|
||||
|
||||
if (mve_audio_canplay) {
|
||||
chan = mve_get_ushort(data + 2);
|
||||
nsamp = mve_get_ushort(data + 4);
|
||||
|
||||
if (chan & selected_chan) {
|
||||
ALint bprocessed, bqueued, status;
|
||||
ALuint bid;
|
||||
|
||||
OpenAL_ErrorCheck( alGetSourcei(mas->source_id, AL_BUFFERS_PROCESSED, &bprocessed), return 0 );
|
||||
|
||||
while (bprocessed-- > 2) {
|
||||
OpenAL_ErrorPrint( alSourceUnqueueBuffers(mas->source_id, 1, &bid) );
|
||||
}
|
||||
|
||||
OpenAL_ErrorCheck( alGetSourcei(mas->source_id, AL_BUFFERS_QUEUED, &bqueued), return 0 );
|
||||
|
||||
if (bqueued == 0) {
|
||||
mprintf(("MVE: Buffer underun (First is normal)\n"));
|
||||
}
|
||||
|
||||
OpenAL_ErrorCheck( alGetSourcei(mas->source_id, AL_SOURCE_STATE, &status), return 0 );
|
||||
|
||||
if ( (mve_audio_playing) && (status != AL_PLAYING) && (bqueued > 0) ) {
|
||||
OpenAL_ErrorCheck( alSourcePlay(mas->source_id), return 0 );
|
||||
}
|
||||
|
||||
if (bqueued < MVE_AUDIO_BUFFERS) {
|
||||
short *buf = NULL;
|
||||
|
||||
/* HACK: +4 mveaudio_uncompress adds 4 more bytes */
|
||||
if (major == 8) {
|
||||
if (mve_audio_compressed) {
|
||||
nsamp += 4;
|
||||
buf = (short *)vm_malloc(nsamp);
|
||||
mveaudio_uncompress(buf, data); /* XXX */
|
||||
} else {
|
||||
nsamp -= 8;
|
||||
data += 8;
|
||||
buf = (short *)vm_malloc(nsamp);
|
||||
memcpy(buf, data, nsamp);
|
||||
}
|
||||
} else {
|
||||
buf = (short *)vm_malloc(nsamp);
|
||||
memset(buf, 0, nsamp); /* XXX */
|
||||
}
|
||||
|
||||
if (!mas->audio_buffer[mve_audio_buffer_tail]) {
|
||||
OpenAL_ErrorCheck( alGenBuffers(1,&mas->audio_buffer[mve_audio_buffer_tail]), { vm_free(buf); return 0; } );
|
||||
}
|
||||
|
||||
OpenAL_ErrorCheck( alBufferData(mas->audio_buffer[mve_audio_buffer_tail], mas->format, buf, nsamp, mas->sample_rate), { vm_free(buf); return 0; } );
|
||||
|
||||
OpenAL_ErrorCheck( alSourceQueueBuffers(mas->source_id, 1, &mas->audio_buffer[mve_audio_buffer_tail]), { vm_free(buf); return 0;} );
|
||||
|
||||
//fprintf(stderr,"Queued buffer %d(%d)\n", mve_audio_buftail, mas->audio_buffer[mve_audio_buftail]);
|
||||
|
||||
if (++mve_audio_buffer_tail == MVE_AUDIO_BUFFERS) {
|
||||
mve_audio_buffer_tail = 0;
|
||||
}
|
||||
|
||||
bqueued++;
|
||||
vm_free(buf);
|
||||
} else {
|
||||
mprintf(("MVE: Buffer overrun: Queue full\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*************************
|
||||
* video handlers
|
||||
*************************/
|
||||
|
||||
int mve_video_createbuf(ubyte minor, ubyte *data)
|
||||
{
|
||||
if (videobuf_created) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
short w, h;
|
||||
short count, truecolor;
|
||||
w = mve_get_short(data);
|
||||
h = mve_get_short(data+2);
|
||||
|
||||
if (minor > 0) {
|
||||
count = mve_get_short(data+4);
|
||||
} else {
|
||||
count = 1;
|
||||
}
|
||||
|
||||
if (minor > 1) {
|
||||
truecolor = mve_get_short(data+6);
|
||||
} else {
|
||||
truecolor = 0;
|
||||
}
|
||||
|
||||
g_width = w << 3;
|
||||
g_height = h << 3;
|
||||
|
||||
g_vBackBuf1 = g_vBuffers = vm_malloc(g_width * g_height * 4);
|
||||
|
||||
if (g_vBackBuf1 == NULL) {
|
||||
nprintf(("MOVIE", "ERROR: Can't allocate video buffer"));
|
||||
videobuf_created = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (truecolor) {
|
||||
g_vBackBuf2 = (ushort *)g_vBackBuf1 + (g_width * g_height);
|
||||
} else {
|
||||
g_vBackBuf2 = (ubyte *)g_vBackBuf1 + (g_width * g_height);
|
||||
}
|
||||
memset(g_vBackBuf1, 0, g_width * g_height * 4);
|
||||
|
||||
g_truecolor = truecolor;
|
||||
videobuf_created = 1;
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
GLfloat scale_by = 1.0f;
|
||||
|
||||
float screen_ratio = (float)gr_screen.max_w / (float)gr_screen.max_h;
|
||||
float movie_ratio = (float)g_width / (float)g_height;
|
||||
|
||||
if (screen_ratio > movie_ratio) {
|
||||
scale_by = (float)gr_screen.max_h / (float)g_height;
|
||||
} else {
|
||||
scale_by = (float)gr_screen.max_w / (float)g_width;
|
||||
}
|
||||
|
||||
// don't bother setting anything if we aren't going to need it
|
||||
if (!Cmdline_noscalevid && (scale_by != 1.0f)) {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
glScalef( scale_by, scale_by, 1.0f );
|
||||
mve_scale_video = 1;
|
||||
}
|
||||
|
||||
if (mve_scale_video) {
|
||||
g_screenX = ((fl2i(gr_screen.max_w / scale_by + 0.5f) - g_width) / 2);
|
||||
g_screenY = ((fl2i(gr_screen.max_h / scale_by + 0.5f) - g_height) / 2);
|
||||
} else {
|
||||
// centers on 1024x768, fills on 640x480
|
||||
g_screenX = ((gr_screen.max_w - g_width) / 2);
|
||||
g_screenY = ((gr_screen.max_h - g_height) / 2);
|
||||
}
|
||||
|
||||
// set additional values for screen width/height and UV coords
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
gl_screenYH = g_screenY + g_height;
|
||||
gl_screenXW = g_screenX + g_width;
|
||||
|
||||
gl_screenU = i2fl(g_width) / i2fl(wp2);
|
||||
gl_screenV = i2fl(g_height) / i2fl(hp2);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void mve_convert_and_draw()
|
||||
{
|
||||
ushort *pDests;
|
||||
ushort *pSrcs = NULL;
|
||||
ushort *pixels = (ushort *)g_vBackBuf1;
|
||||
int x, y;
|
||||
|
||||
ubyte *pSrcs8 = NULL;
|
||||
ubyte *pixels8 = (ubyte *)g_vBackBuf1;
|
||||
ubyte r, g, b;
|
||||
ushort bit_16;
|
||||
|
||||
if (g_truecolor) {
|
||||
pSrcs = pixels;
|
||||
} else {
|
||||
pSrcs8 = pixels8;
|
||||
}
|
||||
pDests = pixelbuf;
|
||||
|
||||
if (gr_screen.mode != GR_OPENGL) {
|
||||
if (g_screenWidth > g_width) {
|
||||
pDests += ((g_screenWidth - g_width) / 2) / 2;
|
||||
}
|
||||
if (g_screenHeight > g_height) {
|
||||
pDests += ((g_screenHeight - g_height) / 2) * g_screenWidth;
|
||||
}
|
||||
}
|
||||
|
||||
for (y=0; y<g_height; y++) {
|
||||
for (x = 0; x < g_width; x++) {
|
||||
if (g_truecolor) {
|
||||
Assert( pSrcs != NULL );
|
||||
pDests[x] = (1<<15)|*pSrcs;
|
||||
pSrcs++;
|
||||
} else {
|
||||
Assert( pSrcs8 != NULL );
|
||||
|
||||
// grab rgb color
|
||||
r = (g_palette[(*pSrcs8)*3] / 2);
|
||||
g = (g_palette[(*pSrcs8)*3 + 1] / 2);
|
||||
b = (g_palette[(*pSrcs8)*3 + 2] / 2);
|
||||
|
||||
// stuff the color
|
||||
bit_16 = (ushort)(r << Gr_t_red.shift);
|
||||
bit_16 |= (ushort)(g << Gr_t_green.shift);
|
||||
bit_16 |= (ushort)(b << Gr_t_blue.shift);
|
||||
bit_16 |= (ushort)(Gr_t_alpha.mask);
|
||||
|
||||
// stuff the pixel
|
||||
pDests[x] = (1<<15)|bit_16;
|
||||
|
||||
pSrcs8++;
|
||||
}
|
||||
}
|
||||
|
||||
pDests += g_screenWidth;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void mve_video_display()
|
||||
{
|
||||
fix t1 = timer_get_fixed_seconds();
|
||||
|
||||
mve_convert_and_draw();
|
||||
|
||||
// this thing is basically stupid but I don't care
|
||||
// micro_frame_delay is divided by 10 to match mve_video_skiptimer overflow catch
|
||||
if ( mve_video_skiptimer > (uint)(micro_frame_delay/10) ) {
|
||||
// we are running slow so subtract desired time from actual and skip this frame
|
||||
mve_video_skiptimer -= (micro_frame_delay/10);
|
||||
return;
|
||||
} else {
|
||||
// zero out so we can get a new count
|
||||
mve_video_skiptimer = 0;
|
||||
}
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);
|
||||
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2i(g_screenX, g_screenY);
|
||||
|
||||
glTexCoord2f(0, gl_screenV);
|
||||
glVertex2i(g_screenX, gl_screenYH);
|
||||
|
||||
glTexCoord2f(gl_screenU, gl_screenV);
|
||||
glVertex2i(gl_screenXW, gl_screenYH);
|
||||
|
||||
glTexCoord2f(gl_screenU, 0);
|
||||
glVertex2i(gl_screenXW, g_screenY);
|
||||
glEnd();
|
||||
} else {
|
||||
// DDOI - This is probably really fricking slow
|
||||
int bitmap = bm_create (16, g_screenWidth, g_screenHeight, pixelbuf, 0);
|
||||
gr_set_bitmap (bitmap);
|
||||
gr_bitmap (g_screenX, g_screenY, true);
|
||||
bm_release (bitmap);
|
||||
}
|
||||
|
||||
gr_flip();
|
||||
os_poll();
|
||||
|
||||
fix t2 = timer_get_fixed_seconds();
|
||||
|
||||
// only get a new count if we are definitely through with old count
|
||||
if ( mve_video_skiptimer == 0 ) {
|
||||
// for a more accurate count convert the frame rate to a float and multiply
|
||||
// by one-hundred-thousand before converting to an uint.
|
||||
mve_video_skiptimer = (uint)(f2fl(t2-t1) * 100000);
|
||||
}
|
||||
|
||||
int k = key_inkey();
|
||||
switch (k) {
|
||||
case KEY_ESC:
|
||||
case KEY_ENTER:
|
||||
case KEY_SPACEBAR:
|
||||
mve_playing = 0;
|
||||
}
|
||||
|
||||
//mprintf(("mve frame took this long: %.6f\n", f2fl(t2-t1) / 1000.0f));
|
||||
}
|
||||
|
||||
int mve_video_init(ubyte *data)
|
||||
{
|
||||
if (video_inited) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
short width, height;
|
||||
|
||||
width = mve_get_short(data);
|
||||
height = mve_get_short(data+2);
|
||||
|
||||
g_screenWidth = width;
|
||||
g_screenHeight = height;
|
||||
|
||||
// DDOI - Allocate RGB565 pixel buffer
|
||||
pixelbuf = (ushort *)vm_malloc(g_screenWidth * g_screenHeight * 2);
|
||||
|
||||
if (pixelbuf == NULL) {
|
||||
nprintf(("MOVIE", "ERROR: Can't allocate memory for pixelbuf"));
|
||||
video_inited = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(pixelbuf, 0, g_screenWidth * g_screenHeight * 2);
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
opengl_set_texture_target(GL_TEXTURE_2D);
|
||||
opengl_tcache_get_adjusted_texture_size(g_screenWidth, g_screenHeight, &wp2, &hp2);
|
||||
|
||||
glGenTextures(1, &GLtex);
|
||||
|
||||
Assert( GLtex != 0 );
|
||||
|
||||
if ( GLtex == 0 ) {
|
||||
nprintf(("MOVIE", "ERROR: Can't create a GL texture"));
|
||||
video_inited = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
gr_set_lighting(false, false);
|
||||
GL_state.Texture.DisableAll();
|
||||
|
||||
GL_state.Texture.SetActiveUnit(0);
|
||||
GL_state.Texture.SetTarget(GL_texture_target);
|
||||
GL_state.Texture.Enable(GLtex);
|
||||
|
||||
GL_state.SetTextureSource(TEXTURE_SOURCE_DECAL);
|
||||
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
|
||||
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
|
||||
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
|
||||
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
|
||||
|
||||
// set our color so that we can make sure that it's correct
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
memset(g_palette, 0, 768);
|
||||
video_inited = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void mve_video_palette(ubyte *data)
|
||||
{
|
||||
short start, count;
|
||||
start = mve_get_short(data);
|
||||
count = mve_get_short(data+2);
|
||||
memcpy(g_palette + 3*start, data+4, 3*count);
|
||||
}
|
||||
|
||||
void mve_video_codemap(ubyte *data, int len)
|
||||
{
|
||||
g_pCurMap = data;
|
||||
g_nMapLength = len;
|
||||
}
|
||||
|
||||
void mve_video_data(ubyte *data, int len)
|
||||
{
|
||||
short nFrameHot, nFrameCold;
|
||||
short nXoffset, nYoffset;
|
||||
short nXsize, nYsize;
|
||||
ushort nFlags;
|
||||
ubyte *temp;
|
||||
|
||||
nFrameHot = mve_get_short(data);
|
||||
nFrameCold = mve_get_short(data+2);
|
||||
nXoffset = mve_get_short(data+4);
|
||||
nYoffset = mve_get_short(data+6);
|
||||
nXsize = mve_get_short(data+8);
|
||||
nYsize = mve_get_short(data+10);
|
||||
nFlags = mve_get_ushort(data+12);
|
||||
|
||||
if (nFlags & 1) {
|
||||
temp = (ubyte *)g_vBackBuf1;
|
||||
g_vBackBuf1 = g_vBackBuf2;
|
||||
g_vBackBuf2 = temp;
|
||||
}
|
||||
|
||||
if (g_truecolor) {
|
||||
decodeFrame16((ubyte *)g_vBackBuf1, g_pCurMap, g_nMapLength, data+14, len-14);
|
||||
} else {
|
||||
decodeFrame8((ubyte *)g_vBackBuf1, g_pCurMap, g_nMapLength, data+14, len-14);
|
||||
}
|
||||
}
|
||||
|
||||
void mve_end_chunk()
|
||||
{
|
||||
g_pCurMap = NULL;
|
||||
}
|
||||
|
||||
void mve_init(MVESTREAM *mve)
|
||||
{
|
||||
// reset to default values
|
||||
mve_audio_buffer_tail = 0;
|
||||
mve_audio_playing = 0;
|
||||
mve_audio_canplay = 0;
|
||||
mve_audio_compressed = 0;
|
||||
audiobuf_created = 0;
|
||||
|
||||
videobuf_created = 0;
|
||||
video_inited = 0;
|
||||
mve_scale_video = 0;
|
||||
|
||||
mve_playing = 1;
|
||||
}
|
||||
|
||||
void mve_play(MVESTREAM *mve)
|
||||
{
|
||||
int init_timer = 0, timer_error = 0;
|
||||
int cont = 1;
|
||||
|
||||
if (!timer_started) {
|
||||
mve_timer_start();
|
||||
}
|
||||
|
||||
while (cont && mve_playing && !timer_error) {
|
||||
cont = mve_play_next_chunk(mve);
|
||||
|
||||
if (micro_frame_delay && !init_timer) {
|
||||
mve_timer_start();
|
||||
init_timer = 1;
|
||||
}
|
||||
|
||||
timer_error = mve_do_timer_wait();
|
||||
}
|
||||
}
|
||||
|
||||
void mve_shutdown()
|
||||
{
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
if (mve_scale_video) {
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
GL_state.Texture.Disable();
|
||||
GL_state.Texture.Delete(GLtex);
|
||||
glDeleteTextures(1, &GLtex);
|
||||
GLtex = 0;
|
||||
}
|
||||
|
||||
if (pixelbuf != NULL) {
|
||||
vm_free(pixelbuf);
|
||||
pixelbuf = NULL;
|
||||
}
|
||||
|
||||
if (g_vBuffers != NULL) {
|
||||
vm_free(g_vBuffers);
|
||||
g_vBuffers = NULL;
|
||||
}
|
||||
|
||||
mve_audio_stop();
|
||||
mve_timer_stop();
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,40 +0,0 @@
|
||||
|
||||
|
||||
#ifndef _OGGPLAYER_H
|
||||
#define _OGGPLAYER_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#include "theora/theora.h"
|
||||
#include "vorbis/codec.h"
|
||||
|
||||
struct CFILE;
|
||||
|
||||
// structure for maintaining info on a THEORAFILE stream
|
||||
typedef struct THEORAFILE
|
||||
{
|
||||
CFILE *cfp;
|
||||
ubyte theora_p;
|
||||
ubyte vorbis_p;
|
||||
|
||||
ogg_sync_state osyncstate;
|
||||
ogg_page opage;
|
||||
ogg_packet opacket;
|
||||
ogg_stream_state v_osstate;
|
||||
ogg_stream_state t_osstate;
|
||||
|
||||
theora_info tinfo;
|
||||
theora_comment tcomment;
|
||||
theora_state tstate;
|
||||
|
||||
vorbis_info vinfo;
|
||||
vorbis_dsp_state vstate;
|
||||
vorbis_block vblock;
|
||||
vorbis_comment vcomment;
|
||||
} THEORAFILE;
|
||||
|
||||
void theora_play(THEORAFILE *movie);
|
||||
THEORAFILE *theora_open(char *filename);
|
||||
void theora_close(THEORAFILE *movie);
|
||||
|
||||
#endif
|
||||
@@ -1,498 +0,0 @@
|
||||
|
||||
#include "ddsutils/ddsutils.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "osapi/osregistry.h"
|
||||
|
||||
|
||||
/* Currently supported formats:
|
||||
* DXT1a (compressed)
|
||||
* DXT1c (compressed)
|
||||
* DXT3 (compressed)
|
||||
* DXT5 (compressed)
|
||||
* uncompressed 1555 (16-bit, 1-bit being alpha)
|
||||
* uncompressed 8888 (32-bit)
|
||||
* uncompressed 888 (24-bit, no alpha)
|
||||
* paletted 8-bit (256 colors)
|
||||
*/
|
||||
|
||||
|
||||
int Texture_compression_available = 0;
|
||||
int Use_compressed_textures = 0;
|
||||
|
||||
// power of two check, to verify that a given DDS will always be usable since
|
||||
// some may not be power-of-2
|
||||
static inline int is_power_of_two(int w, int h)
|
||||
{
|
||||
return ( (w && !(w & (w-1))) && (h && !(h & (h-1))) );
|
||||
}
|
||||
|
||||
|
||||
int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int *bpp, int *compression_type, int *levels, int *size, ubyte *palette)
|
||||
{
|
||||
DDSURFACEDESC2 dds_header;
|
||||
int code = 0;
|
||||
CFILE *ddsfile;
|
||||
char real_name[MAX_FILENAME_LEN];
|
||||
int retval = DDS_ERROR_NONE;
|
||||
int ct = DDS_UNCOMPRESSED;
|
||||
int bits = 0;
|
||||
int i, trash, is_cubemap = 0;
|
||||
int d_width = 0, d_height = 0, d_depth = 0, d_size = 0;
|
||||
|
||||
|
||||
if (img_cfp == NULL) {
|
||||
// this better not happen.. ever
|
||||
Assert(filename != NULL);
|
||||
|
||||
// make sure there is an extension
|
||||
strcpy_s(real_name, filename);
|
||||
char *p = strchr(real_name, '.');
|
||||
if (p) { *p=0; }
|
||||
strcat_s(real_name, ".dds");
|
||||
|
||||
// try to open the file
|
||||
ddsfile = cfopen(real_name, "rb");
|
||||
|
||||
// file not found
|
||||
if (ddsfile == NULL)
|
||||
return DDS_ERROR_INVALID_FILENAME;
|
||||
} else {
|
||||
ddsfile = img_cfp;
|
||||
}
|
||||
|
||||
// read the code
|
||||
code = cfread_int(ddsfile);
|
||||
|
||||
// check it
|
||||
if (code != DDS_FILECODE) {
|
||||
retval = DDS_ERROR_BAD_HEADER;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
// read header variables
|
||||
dds_header.dwSize = cfread_uint(ddsfile);
|
||||
dds_header.dwFlags = cfread_uint(ddsfile);
|
||||
dds_header.dwHeight = cfread_uint(ddsfile);
|
||||
dds_header.dwWidth = cfread_uint(ddsfile);
|
||||
dds_header.dwPitchOrLinearSize = cfread_uint(ddsfile);
|
||||
dds_header.dwDepth = cfread_uint(ddsfile);
|
||||
dds_header.dwMipMapCount = cfread_uint(ddsfile);
|
||||
|
||||
// skip over the crap we don't care about
|
||||
for (i = 0; i < 11; i++)
|
||||
trash = cfread_uint(ddsfile);
|
||||
|
||||
dds_header.ddpfPixelFormat.dwSize = cfread_uint(ddsfile);
|
||||
dds_header.ddpfPixelFormat.dwFlags = cfread_uint(ddsfile);
|
||||
dds_header.ddpfPixelFormat.dwFourCC = cfread_uint(ddsfile);
|
||||
dds_header.ddpfPixelFormat.dwRGBBitCount = cfread_uint(ddsfile);
|
||||
dds_header.ddpfPixelFormat.dwRBitMask = cfread_uint(ddsfile);
|
||||
dds_header.ddpfPixelFormat.dwGBitMask = cfread_uint(ddsfile);
|
||||
dds_header.ddpfPixelFormat.dwBBitMask = cfread_uint(ddsfile);
|
||||
dds_header.ddpfPixelFormat.dwRGBAlphaBitMask = cfread_uint(ddsfile);
|
||||
|
||||
dds_header.ddsCaps.dwCaps1 = cfread_uint(ddsfile);
|
||||
dds_header.ddsCaps.dwCaps2 = cfread_uint(ddsfile);
|
||||
|
||||
// sanity
|
||||
if (dds_header.dwDepth == 0)
|
||||
dds_header.dwDepth = 1;
|
||||
|
||||
if (dds_header.dwMipMapCount < 1)
|
||||
dds_header.dwMipMapCount = 1;
|
||||
|
||||
d_width = dds_header.dwWidth;
|
||||
d_height = dds_header.dwHeight;
|
||||
d_depth = dds_header.dwDepth;
|
||||
|
||||
// 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 ) {
|
||||
// calculate the block size, mult by 8 for DXT1, 16 for DXT3 & 5
|
||||
d_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 {
|
||||
d_size = dds_header.dwPitchOrLinearSize;
|
||||
}
|
||||
|
||||
// if we have mipmaps then compute them into the final size too
|
||||
for (i = 1; i < (int)dds_header.dwMipMapCount; i++) {
|
||||
// reduce size by half for the next pass
|
||||
d_width /= 2;
|
||||
d_height /= 2;
|
||||
|
||||
if (d_width <= 0)
|
||||
d_width = 1;
|
||||
|
||||
if (d_height <= 0)
|
||||
d_height = 1;
|
||||
|
||||
// size of data block (4x4)
|
||||
d_size += ((d_width + 3) / 4) * ((d_height + 3) / 4) * ((dds_header.ddpfPixelFormat.dwFourCC == FOURCC_DXT1) ? 8 : 16);
|
||||
}
|
||||
|
||||
if ( dds_header.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP ) {
|
||||
if ( !(dds_header.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) ) {
|
||||
retval = DDS_ERROR_CUBEMAP_FACES;
|
||||
ct = DDS_DXT_INVALID;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
// it's a valid cubemap, probably
|
||||
is_cubemap = 1;
|
||||
|
||||
// the previously computed size is just per face, mult by 6 for full size
|
||||
d_size *= 6;
|
||||
}
|
||||
|
||||
Assert( d_size > 0 );
|
||||
*size = d_size;
|
||||
|
||||
switch (dds_header.ddpfPixelFormat.dwFourCC) {
|
||||
case FOURCC_DXT1:
|
||||
bits = 24;
|
||||
ct = (is_cubemap) ? DDS_CUBEMAP_DXT1 : DDS_DXT1;
|
||||
break;
|
||||
|
||||
case FOURCC_DXT3:
|
||||
bits = 32;
|
||||
ct = (is_cubemap) ? DDS_CUBEMAP_DXT3 : DDS_DXT3;
|
||||
break;
|
||||
|
||||
case FOURCC_DXT5:
|
||||
bits = 32;
|
||||
ct = (is_cubemap) ? DDS_CUBEMAP_DXT5 : DDS_DXT5;
|
||||
break;
|
||||
|
||||
// dxt2 and dxt4 aren't supported
|
||||
case FOURCC_DXT2:
|
||||
case FOURCC_DXT4:
|
||||
retval = DDS_ERROR_UNSUPPORTED;
|
||||
ct = DDS_DXT_INVALID;
|
||||
goto Done;
|
||||
break;
|
||||
|
||||
// none of the above
|
||||
default:
|
||||
retval = DDS_ERROR_INVALID_FORMAT;
|
||||
ct = DDS_DXT_INVALID;
|
||||
goto Done;
|
||||
break;
|
||||
}
|
||||
} else if ( dds_header.ddpfPixelFormat.dwFlags & (DDPF_RGB | DDPF_PALETTEINDEXED8) ) {
|
||||
d_size += d_width * d_height * d_depth * (dds_header.ddpfPixelFormat.dwRGBBitCount / 8);
|
||||
|
||||
// calculate full data size for all mipmap levels
|
||||
for (i = 1; i < (int)dds_header.dwMipMapCount; i++) {
|
||||
d_width /= 2;
|
||||
d_height /= 2;
|
||||
d_depth /= 2;
|
||||
|
||||
if (d_width < 1)
|
||||
d_width = 1;
|
||||
|
||||
if (d_height < 1)
|
||||
d_height = 1;
|
||||
|
||||
if (d_depth < 1)
|
||||
d_depth = 1;
|
||||
|
||||
d_size += d_width * d_height * d_depth * (dds_header.ddpfPixelFormat.dwRGBBitCount / 8);
|
||||
}
|
||||
|
||||
Assert( d_size > 0 );
|
||||
|
||||
if ( dds_header.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP ) {
|
||||
if ( !(dds_header.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES) ) {
|
||||
retval = DDS_ERROR_CUBEMAP_FACES;
|
||||
ct = DDS_DXT_INVALID;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
// it's a valid cubemap, probably
|
||||
is_cubemap = 1;
|
||||
|
||||
// the previously computed size is just per face, mult by 6 for full size
|
||||
d_size *= 6;
|
||||
}
|
||||
|
||||
*size = d_size;
|
||||
|
||||
bits = dds_header.ddpfPixelFormat.dwRGBBitCount;
|
||||
ct = (is_cubemap) ? DDS_CUBEMAP_UNCOMPRESSED : DDS_UNCOMPRESSED;
|
||||
} else {
|
||||
// it's not a readable format
|
||||
retval = DDS_ERROR_INVALID_FORMAT;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
// we don't support compressed, non-power-of-2 images
|
||||
if ( (ct != DDS_UNCOMPRESSED) && (!is_power_of_two(dds_header.dwWidth, dds_header.dwHeight)) ) {
|
||||
retval = DDS_ERROR_NON_POWER_OF_2;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
// make sure that the video card can handle compressed textures before using them
|
||||
if ( !Use_compressed_textures && (ct != DDS_UNCOMPRESSED) && (ct != DDS_DXT_INVALID) ) {
|
||||
retval = DDS_ERROR_NO_COMPRESSION;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
// stuff important info
|
||||
if (bpp)
|
||||
*bpp = bits;
|
||||
|
||||
if (compression_type)
|
||||
*compression_type = ct;
|
||||
|
||||
if (width)
|
||||
*width = dds_header.dwWidth;
|
||||
|
||||
if (height)
|
||||
*height = dds_header.dwHeight;
|
||||
|
||||
if (levels)
|
||||
*levels = dds_header.dwMipMapCount;
|
||||
|
||||
if (palette && (bits == 8)) {
|
||||
cfseek(ddsfile, DDS_OFFSET, CF_SEEK_SET);
|
||||
cfread(palette, 1, 1024, ddsfile);
|
||||
}
|
||||
|
||||
|
||||
Done:
|
||||
if (img_cfp == NULL) {
|
||||
// close file and return
|
||||
cfclose(ddsfile);
|
||||
ddsfile = NULL;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
//reads pixel info from a dds file
|
||||
int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp, int cf_type)
|
||||
{
|
||||
int retval;
|
||||
int w,h,ct,lvl;
|
||||
int size = 0, bits = 0;
|
||||
CFILE *cfp;
|
||||
char real_name[MAX_FILENAME_LEN];
|
||||
|
||||
// this better not happen.. ever
|
||||
Assert(filename != NULL);
|
||||
|
||||
// make sure there is an extension
|
||||
strcpy_s(real_name, filename);
|
||||
char *p = strchr(real_name, '.');
|
||||
if (p) { *p = 0; }
|
||||
strcat_s(real_name, ".dds");
|
||||
|
||||
// open it up and go to the data section
|
||||
cfp = cfopen(real_name, "rb", CFILE_NORMAL, cf_type);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
cfseek(cfp, DDS_OFFSET, CF_SEEK_SET);
|
||||
|
||||
// read in the data
|
||||
cfread(data, 1, size, cfp);
|
||||
|
||||
if (bpp)
|
||||
*bpp = (ubyte)bits;
|
||||
|
||||
// we look done here
|
||||
cfclose(cfp);
|
||||
|
||||
return DDS_ERROR_NONE;
|
||||
}
|
||||
|
||||
// save some image data as a DDS image
|
||||
// NOTE: we only support, uncompressed, 24-bit RGB and 32-bit RGBA images here!!
|
||||
void dds_save_image(int width, int height, int bpp, int num_mipmaps, ubyte *data, int cubemap, char *filename)
|
||||
{
|
||||
DDSURFACEDESC2 dds_header;
|
||||
char real_filename[MAX_FILENAME_LEN];
|
||||
|
||||
if (data == NULL) {
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
// header size check
|
||||
if (sizeof(DDSURFACEDESC2) != 124) {
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// not that that's out of the way we can get down to business, constructing a sane filename
|
||||
memset( &real_filename, 0, sizeof(real_filename) );
|
||||
|
||||
int count = os_config_read_uint(NULL, "ImageExportNum", 0);
|
||||
|
||||
if (count > 999)
|
||||
count = 0;
|
||||
|
||||
if (filename == NULL) {
|
||||
if (cubemap) {
|
||||
sprintf(real_filename, "cubemap%.3d.dds", count++);
|
||||
} else {
|
||||
sprintf(real_filename, "image%.3d.dds", count++);
|
||||
}
|
||||
os_config_write_uint(NULL, "ImageExportNum", count);
|
||||
} else {
|
||||
Assert( strlen(filename) < MAX_FILENAME_LEN-5 );
|
||||
|
||||
strcpy_s(real_filename, filename);
|
||||
|
||||
char *p = strchr(real_filename, '.');
|
||||
if (p) { *p = 0; }
|
||||
|
||||
strcat_s(real_filename, ".dds");
|
||||
}
|
||||
|
||||
CFILE *image = cfopen( real_filename, "wb", CFILE_NORMAL, CF_TYPE_CACHE );
|
||||
|
||||
if (image == NULL) {
|
||||
mprintf(("Unable to open DDS image for saving!!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (num_mipmaps < 1)
|
||||
num_mipmaps = 1;
|
||||
|
||||
// we have a filename and file handle, so now lets create our DDS header...
|
||||
memset( &dds_header, 0, sizeof(DDSURFACEDESC2) );
|
||||
|
||||
uint flags = (DDSD_CAPS | DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT);
|
||||
uint pixel_flags = DDPF_RGB;
|
||||
uint caps1 = DDSCAPS_TEXTURE;
|
||||
uint caps2 = 0;
|
||||
|
||||
if (bpp == 32) {
|
||||
pixel_flags |= DDPF_ALPHAPIXELS;
|
||||
}
|
||||
|
||||
if (num_mipmaps > 1) {
|
||||
flags |= DDSD_MIPMAPCOUNT;
|
||||
caps1 |= (DDSCAPS_COMPLEX | DDSCAPS_MIPMAP);
|
||||
}
|
||||
|
||||
if (cubemap) {
|
||||
caps1 |= DDSCAPS_COMPLEX;
|
||||
caps2 |= (DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_ALLFACES);
|
||||
}
|
||||
|
||||
dds_header.dwSize = 124;
|
||||
dds_header.dwFlags = flags;
|
||||
dds_header.dwHeight = height;
|
||||
dds_header.dwWidth = width;
|
||||
dds_header.dwPitchOrLinearSize = (width * (bpp >> 3));
|
||||
dds_header.dwDepth = 0;
|
||||
dds_header.dwMipMapCount = num_mipmaps;
|
||||
|
||||
dds_header.ddpfPixelFormat.dwSize = 32;
|
||||
dds_header.ddpfPixelFormat.dwFlags = pixel_flags;
|
||||
dds_header.ddpfPixelFormat.dwFourCC = 0;
|
||||
dds_header.ddpfPixelFormat.dwRGBBitCount = bpp;
|
||||
dds_header.ddpfPixelFormat.dwRBitMask = 0x00ff0000;
|
||||
dds_header.ddpfPixelFormat.dwGBitMask = 0x0000ff00;
|
||||
dds_header.ddpfPixelFormat.dwBBitMask = 0x000000ff;
|
||||
dds_header.ddpfPixelFormat.dwRGBAlphaBitMask = (bpp == 32) ? 0xff000000 : 0x00000000;
|
||||
|
||||
dds_header.ddsCaps.dwCaps1 = caps1;
|
||||
dds_header.ddsCaps.dwCaps2 = caps2;
|
||||
|
||||
// now save it all...
|
||||
uint dds_id = DDS_FILECODE;
|
||||
cfwrite(&dds_id, 1, 4, image);
|
||||
cfwrite(&dds_header, 1, sizeof(DDSURFACEDESC2), image);
|
||||
|
||||
int faces = (cubemap) ? 6 : 1;
|
||||
int f_width = width;
|
||||
int f_height = height;
|
||||
int f_size = 0, f_offset = 0;
|
||||
|
||||
// cubemaps are written:
|
||||
// face 1
|
||||
// all face 1 mipmaps
|
||||
// face 2
|
||||
// all face 2 mipmaps
|
||||
// ... etc.
|
||||
|
||||
for (int i = 0; i < faces; i++) {
|
||||
for (int j = 0; j < num_mipmaps; j++) {
|
||||
f_size = (f_width * f_height * (bpp >> 3));
|
||||
|
||||
cfwrite(data + f_offset, 1, f_size, image);
|
||||
|
||||
// increase offset for next mipmap level
|
||||
f_offset += f_size;
|
||||
|
||||
// half width and height for next mipmap level
|
||||
f_width /= 2;
|
||||
f_height /= 2;
|
||||
|
||||
if (f_width < 1)
|
||||
f_width = 1;
|
||||
|
||||
if (f_height < 1)
|
||||
f_height = 1;
|
||||
}
|
||||
|
||||
// reset width and height to original values for the next face
|
||||
f_width = width;
|
||||
f_height = height;
|
||||
}
|
||||
|
||||
// done! now lets go get something to eat...
|
||||
cfclose(image);
|
||||
}
|
||||
|
||||
|
||||
// returns string representation of DDS_** error code
|
||||
const char *dds_error_string(int code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case DDS_ERROR_NONE:
|
||||
return "No error";
|
||||
|
||||
case DDS_ERROR_INVALID_FILENAME:
|
||||
return "File not found";
|
||||
|
||||
case DDS_ERROR_BAD_HEADER:
|
||||
return "Filecode did not equal \"DDS \"";
|
||||
|
||||
case DDS_ERROR_INVALID_FORMAT:
|
||||
return "DDS was in an unsupported/unknown format";
|
||||
|
||||
case DDS_ERROR_UNSUPPORTED:
|
||||
return "DDS format was known but is not supported (ie. DXT2/DXT4)";
|
||||
|
||||
case DDS_ERROR_NO_COMPRESSION:
|
||||
return "DDS is compressed but compression support is not enabled";
|
||||
|
||||
case DDS_ERROR_NON_POWER_OF_2:
|
||||
return "Cannot load DDS if not power-of-2";
|
||||
|
||||
case DDS_ERROR_CUBEMAP_FACES:
|
||||
return "Cubemaps must have all 6 faces";
|
||||
|
||||
default:
|
||||
return "Abort, retry, fail?";
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
//header file to load .dds files
|
||||
//these use dxtc texture compression
|
||||
|
||||
#ifndef __DDS_H
|
||||
#define __DDS_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
|
||||
#define DDS_ERROR_NONE 0 // everything went fine
|
||||
#define DDS_ERROR_INVALID_FILENAME 1 // bad or missing file
|
||||
#define DDS_ERROR_UNSUPPORTED 2 // a known format but one we don't support
|
||||
#define DDS_ERROR_INVALID_FORMAT 3 // format that's not supported
|
||||
#define DDS_ERROR_BAD_HEADER 4 // header was not "DDS "
|
||||
#define DDS_ERROR_NO_COMPRESSION 5 // file is compressed, compression isn't supported
|
||||
#define DDS_ERROR_NON_POWER_OF_2 6 // file is not a power of 2 in dimensions
|
||||
#define DDS_ERROR_CUBEMAP_FACES 7 // file is a cubemap, but doesn't have all six faces
|
||||
|
||||
|
||||
#define DDS_DXT_INVALID -1
|
||||
#define DDS_UNCOMPRESSED 0
|
||||
#define DDS_DXT1 1
|
||||
#define DDS_DXT3 3
|
||||
#define DDS_DXT5 5
|
||||
#define DDS_CUBEMAP_UNCOMPRESSED 10
|
||||
#define DDS_CUBEMAP_DXT1 11
|
||||
#define DDS_CUBEMAP_DXT3 13
|
||||
#define DDS_CUBEMAP_DXT5 15
|
||||
|
||||
#ifndef MAKEFOURCC
|
||||
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
|
||||
((uint)(ubyte)(ch0) | ((uint)(ubyte)(ch1) << 8) | \
|
||||
((uint)(ubyte)(ch2) << 16) | ((uint)(ubyte)(ch3) << 24 ))
|
||||
#endif //defined(MAKEFOURCC)
|
||||
|
||||
// FOURCC codes for DX compressed-texture pixel formats
|
||||
#define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1'))
|
||||
#define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2'))
|
||||
#define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3'))
|
||||
#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4'))
|
||||
#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5'))
|
||||
|
||||
#define DDS_FILECODE 0x20534444 // "DDS " in file
|
||||
|
||||
// DDS format stuff ...
|
||||
#define DDSD_LINEARSIZE 0x00080000
|
||||
#define DDSD_PITCH 0x00000008
|
||||
#define DDPF_ALPHAPIXELS 0x00000001
|
||||
#define DDPF_FOURCC 0x00000004
|
||||
#define DDPF_PALETTEINDEXED4 0x00000008
|
||||
#define DDPF_PALETTEINDEXEDTO8 0x00000010
|
||||
#define DDPF_PALETTEINDEXED8 0x00000020
|
||||
#define DDPF_RGB 0x00000040
|
||||
#define DDSD_PIXELFORMAT 0x00001000
|
||||
#define DDSD_WIDTH 0x00000004
|
||||
#define DDSD_HEIGHT 0x00000002
|
||||
#define DDSD_CAPS 0x00000001
|
||||
#define DDSD_MIPMAPCOUNT 0x00020000
|
||||
|
||||
#define DDSCAPS_COMPLEX 0x00000008
|
||||
#define DDSCAPS_PRIMARYSURFACE 0x00000200
|
||||
#define DDSCAPS_MIPMAP 0x00400000
|
||||
#define DDSCAPS_TEXTURE 0x00001000
|
||||
|
||||
#define DDSCAPS2_CUBEMAP 0x00000200
|
||||
#define DDSCAPS2_VOLUME 0x00200000
|
||||
#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400
|
||||
#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800
|
||||
#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000
|
||||
#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000
|
||||
#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000
|
||||
#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000
|
||||
|
||||
#define DDSCAPS2_CUBEMAP_ALLFACES ( DDSCAPS2_CUBEMAP_POSITIVEX | \
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEX | \
|
||||
DDSCAPS2_CUBEMAP_POSITIVEY | \
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEY | \
|
||||
DDSCAPS2_CUBEMAP_POSITIVEZ | \
|
||||
DDSCAPS2_CUBEMAP_NEGATIVEZ )
|
||||
|
||||
#pragma pack(1)
|
||||
// these structures are the headers for a dds file
|
||||
/*typedef struct _DDPIXELFORMAT {
|
||||
uint dwSize;
|
||||
uint dwFlags;
|
||||
uint dwFourCC;
|
||||
uint dwRGBBitCount;
|
||||
uint dwRBitMask;
|
||||
uint dwGBitMask;
|
||||
uint dwBBitMask;
|
||||
uint dwRGBAlphaBitMask;
|
||||
} DDPIXELFORMAT;
|
||||
|
||||
typedef struct _DDSCAPS2
|
||||
{
|
||||
uint dwCaps1;
|
||||
uint dwCaps2;
|
||||
uint Reserved[2];
|
||||
} DDSCAPS2;*/
|
||||
|
||||
typedef struct _DDSURFACEDESC2
|
||||
{
|
||||
uint dwSize; // size of the DDSURFACEDESC structure
|
||||
uint dwFlags; // determines what fields are valid
|
||||
uint dwHeight; // height of surface to be created
|
||||
uint dwWidth; // width of input surface
|
||||
uint dwPitchOrLinearSize;
|
||||
uint dwDepth;
|
||||
uint dwMipMapCount;
|
||||
uint dwReserved1[11];
|
||||
|
||||
struct {
|
||||
uint dwSize;
|
||||
uint dwFlags;
|
||||
uint dwFourCC;
|
||||
uint dwRGBBitCount;
|
||||
uint dwRBitMask;
|
||||
uint dwGBitMask;
|
||||
uint dwBBitMask;
|
||||
uint dwRGBAlphaBitMask;
|
||||
} ddpfPixelFormat;
|
||||
|
||||
struct {
|
||||
uint dwCaps1;
|
||||
uint dwCaps2;
|
||||
uint Reserved[2];
|
||||
} ddsCaps;
|
||||
|
||||
// DDPIXELFORMAT ddpfPixelFormat;
|
||||
// DDSCAPS2 ddsCaps; // direct draw surface capabilities
|
||||
uint dwReserved2;
|
||||
} DDSURFACEDESC2;
|
||||
#pragma pack()
|
||||
|
||||
#define DDS_OFFSET 4+sizeof(DDSURFACEDESC2) //place where the data starts -- should be 128
|
||||
|
||||
//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, CFILE *img_cfp = NULL, int *width = 0, int *height = 0, int *bpp = 0, int *compression_type = 0, int *levels = 0, int *size = 0, ubyte *palette = NULL);
|
||||
|
||||
//reads bitmap
|
||||
//size of the data it stored in size
|
||||
int dds_read_bitmap(char *filename, ubyte *data, ubyte *bpp = NULL, int cf_type = CF_TYPE_ANY);
|
||||
|
||||
// writes a DDS file using given data
|
||||
void dds_save_image(int width, int height, int bpp, int num_mipmaps, ubyte *data = NULL, int cubemap = 0, char *filename = NULL);
|
||||
|
||||
//returns a string from a DDS error code
|
||||
const char *dds_error_string(int code);
|
||||
|
||||
extern int Texture_compression_available;
|
||||
extern int Use_compressed_textures;
|
||||
|
||||
#endif //__DDS_H
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* 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 _DEBRIS_H
|
||||
#define _DEBRIS_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
struct object;
|
||||
struct CFILE;
|
||||
|
||||
#define MAX_DEBRIS_ARCS 8 // Must be less than MAX_ARC_EFFECTS in model.h
|
||||
|
||||
typedef struct debris {
|
||||
debris *next, *prev; // used for a linked list of the hull debris chunks
|
||||
int flags; // See DEBRIS_??? defines
|
||||
int source_objnum; // What object this came from
|
||||
int source_sig; // Signature of the source object
|
||||
int ship_info_index; // Ship info index of the ship type debris came from
|
||||
int team; // Team of the ship where the debris came from
|
||||
int objnum; // What object this is linked to
|
||||
float lifeleft; // When 0 or less object dies
|
||||
int must_survive_until; //WMC - timestamp of earliest point that it can be murthered.
|
||||
int model_num; // What model this uses
|
||||
int submodel_num; // What submodel this uses
|
||||
int next_fireball; // When to start a fireball
|
||||
int is_hull; // indicates a large hull chunk of debris
|
||||
int species; // What species this is from. -1 if don't care.
|
||||
int fire_timeout; // timestamp that holds time for fireballs to stop appearing
|
||||
int sound_delay; // timestamp to signal when sound should start
|
||||
fix time_started; // time when debris was created
|
||||
int next_distance_check; // timestamp to determine whether to delete this piece of debris.
|
||||
|
||||
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
|
||||
int parent_alt_name;
|
||||
float damage_mult;
|
||||
|
||||
} debris;
|
||||
|
||||
|
||||
// flags for debris pieces
|
||||
#define DEBRIS_USED (1<<0)
|
||||
#define DEBRIS_EXPIRE (1<<1) // debris can expire (ie hull chunks from small ships)
|
||||
|
||||
#define MAX_DEBRIS_PIECES 64
|
||||
|
||||
extern debris Debris[MAX_DEBRIS_PIECES];
|
||||
|
||||
extern int Num_debris_pieces;
|
||||
|
||||
struct collision_info_struct;
|
||||
|
||||
void debris_init();
|
||||
void debris_render( object * obj );
|
||||
void debris_delete( object * obj );
|
||||
void debris_process_post( object * obj, float frame_time);
|
||||
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);
|
||||
|
||||
#endif // _DEBRIS_H
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Code created by Thomas Whittaker (RT) for a FreeSpace 2 source code project
|
||||
*
|
||||
* You may not sell or otherwise commercially exploit the source or things you
|
||||
* created based on the source.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef _TIMERBAR_HEADER_
|
||||
#define _TIMERBAR_HEADER_
|
||||
|
||||
const int MAX_NUM_TIMERBARS = 20;
|
||||
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
// These functions should never be used directly, always use macros below
|
||||
void timerbar_start_frame();
|
||||
void timerbar_end_frame();
|
||||
void timerbar_set_draw_func(void (*new_draw_func_ptr)(int colour, float x, float y, float w, float h));
|
||||
|
||||
void timerbar_push(int value);
|
||||
void timerbar_pop();
|
||||
|
||||
// This function shouldnt not be used any more or it will break push and pop calls
|
||||
void timerbar_switch_type(int num);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifdef GAME_ERRORLOG_TXT
|
||||
|
||||
#ifndef __EXCEPTION_HANDLER_H
|
||||
#define __EXCEPTION_HANDLER_H
|
||||
|
||||
|
||||
|
||||
// --------------------
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
// --------------------
|
||||
|
||||
|
||||
// --------------------
|
||||
//
|
||||
// Enumerated types
|
||||
//
|
||||
// --------------------
|
||||
|
||||
|
||||
// --------------------
|
||||
//
|
||||
// Structures
|
||||
//
|
||||
// --------------------
|
||||
|
||||
// this is a forward declaration so we don't need to include windows.h
|
||||
|
||||
typedef struct _EXCEPTION_POINTERS EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
|
||||
|
||||
// --------------------
|
||||
//
|
||||
// Classes
|
||||
//
|
||||
// --------------------
|
||||
|
||||
|
||||
// --------------------
|
||||
//
|
||||
// Variables
|
||||
//
|
||||
// --------------------
|
||||
|
||||
|
||||
// --------------------
|
||||
//
|
||||
// Prototypes
|
||||
//
|
||||
// --------------------
|
||||
|
||||
int __cdecl RecordExceptionInfo(PEXCEPTION_POINTERS data, const char *Message);
|
||||
|
||||
// --------------------
|
||||
//
|
||||
// Helper Macros
|
||||
//
|
||||
// --------------------
|
||||
|
||||
|
||||
#endif // __EXCEPTION_HANDLER_H
|
||||
#endif
|
||||
@@ -1,106 +0,0 @@
|
||||
#ifndef EXTERNALCODE_H_INCLUDED_
|
||||
#define EXTERNALCODE_H_INCLUDED_
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
/* We must have windows.h anywhere SCP_ExternalCode is used under windows */
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
/* This class loads external libraries for FSO use.
|
||||
* Different platforms have different ways of doing this, so use your ifdefs!
|
||||
*/
|
||||
class SCP_ExternalCode
|
||||
{
|
||||
public:
|
||||
SCP_ExternalCode( )
|
||||
#ifdef _WIN32
|
||||
: m_dll( NULL )
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~SCP_ExternalCode( )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if ( m_dll )
|
||||
::FreeLibrary( m_dll );
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
BOOL LoadExternal( const char* externlib )
|
||||
{
|
||||
if ( !externlib )
|
||||
return FALSE;
|
||||
|
||||
#ifdef _WIN32
|
||||
m_dll = ::LoadLibrary( externlib );
|
||||
|
||||
if ( m_dll )
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void* LoadFunction( const char* functionname )
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if ( m_dll != NULL && functionname != NULL )
|
||||
return ::GetProcAddress( m_dll, functionname );
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
HMODULE m_dll;
|
||||
#endif
|
||||
};
|
||||
|
||||
/* These are available if you're compiling an external DLL
|
||||
* So far we have trackir, and speech is on the way
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
# define SCP_EXT_CALLCONV __cdecl
|
||||
# ifdef SCPDLL_EXTERNAL_LIB
|
||||
# define SCPDLL_EXTERNAL __declspec( dllexport )
|
||||
# else
|
||||
# define SCPDLL_EXTERNAL __declspec( dllimport )
|
||||
# endif
|
||||
/* Must be in a CPP file in your DLL code
|
||||
* If you want to write your own, you shouldn't.
|
||||
*/
|
||||
# define SCPDLL_DLLMAIN( ) \
|
||||
SCP_EXTERN_C BOOL APIENTRY DllMain( HANDLE, DWORD, LPVOID ) { return TRUE; }
|
||||
#else
|
||||
# define SCP_EXT_CALLCONV
|
||||
# define SCPDLL_EXTERNAL
|
||||
# define SCPDLL_DLLMAIN( )
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define SCP_EXTERN_C extern "C"
|
||||
#else
|
||||
# define SCP_EXTERN_C
|
||||
#endif
|
||||
|
||||
/* Version information */
|
||||
typedef struct _SCPDLL_Version
|
||||
{
|
||||
int major;
|
||||
int minor;
|
||||
int patch;
|
||||
} SCPDLL_Version;
|
||||
|
||||
typedef int ( SCP_EXT_CALLCONV *SCPDLL_PFVERSION )( SCPDLL_Version* );
|
||||
|
||||
/* Must be in a CPP file in your DLL code */
|
||||
#define SCPDLL_VERSION_FUNCTION( Major, Minor, Patch ) \
|
||||
SCP_EXTERN_C int SCPDLL_EXTERNAL SCPDLL_GetVersion( SCPDLL_Version* v ) { \
|
||||
if ( !v ) return -1;\
|
||||
v->major = Major; v->minor = Minor; v->patch = Patch;\
|
||||
return 0; }
|
||||
|
||||
#endif /* EXTERNALCODE_H_INCLUDED_ */
|
||||
@@ -1,4 +0,0 @@
|
||||
#include "trackirpublic.h"
|
||||
|
||||
/* The TrackIR Interface */
|
||||
TrackIRDLL gTirDll_TrackIR;
|
||||
@@ -1,170 +0,0 @@
|
||||
#ifndef TRACKIRPUBLIC_H_INCLUDED_
|
||||
#define TRACKIRPUBLIC_H_INCLUDED_
|
||||
|
||||
#include "external_dll/externalcode.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
#define TRACKIRBRIDGEDLLNAME "scptrackir.dll"
|
||||
|
||||
#define SCP_INITRESULT_SUCCESS 0
|
||||
#define SCP_INITRESULT_BADKEY 1
|
||||
#define SCP_INITRESULT_BADPATH 2
|
||||
#define SCP_INITRESULT_PATHTOOLONG 3
|
||||
#define SCP_INITRESULT_NODLL 4
|
||||
#define SCP_INITRESULT_BADSIGNATURE 5
|
||||
#define SCP_INITRESULT_UNABLETOREGISTER 6
|
||||
#define SCP_INITRESULT_BADDATAFIELDS 7
|
||||
#define SCP_INITRESULT_BADREGISTRATION 8
|
||||
#define SCP_INITRESULT_BADTRANSMISSION 9
|
||||
|
||||
/* Exported functions */
|
||||
/* HWND comes from externalcode.h */
|
||||
/* These are function pointer prototypes provided for library loading */
|
||||
|
||||
/* Only one function doesn't return an int or a float */
|
||||
typedef int ( SCP_EXT_CALLCONV *SCPTRACKIR_PFINIT )( HWND );
|
||||
|
||||
/* All other trackir functions return an int or a float
|
||||
* and take no parameters
|
||||
*/
|
||||
typedef int ( SCP_EXT_CALLCONV *SCPTRACKIR_PFINTVOID )( );
|
||||
typedef float ( SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID )( );
|
||||
|
||||
class TrackIRDLL : public SCP_ExternalCode
|
||||
{
|
||||
public:
|
||||
TrackIRDLL( )
|
||||
{
|
||||
/* Load the DLL and functions
|
||||
* If this is done globally, we'll be found by MSPDBDEBUGGING :)
|
||||
*/
|
||||
|
||||
Reset( );
|
||||
|
||||
if ( !LoadExternal( TRACKIRBRIDGEDLLNAME ) )
|
||||
return;
|
||||
|
||||
m_Init = (SCPTRACKIR_PFINIT)LoadFunction( "SCPTIR_Init" );
|
||||
m_Close = (SCPTRACKIR_PFINTVOID)LoadFunction( "SCPTIR_Close" );
|
||||
m_Query = (SCPTRACKIR_PFINTVOID)LoadFunction( "SCPTIR_Query" );
|
||||
|
||||
m_GetX = (SCPTRACKIR_PFFLOATVOID)LoadFunction( "SCPTIR_GetX" );
|
||||
m_GetY = (SCPTRACKIR_PFFLOATVOID)LoadFunction( "SCPTIR_GetY" );
|
||||
m_GetZ = (SCPTRACKIR_PFFLOATVOID)LoadFunction( "SCPTIR_GetZ" );
|
||||
m_GetRoll = (SCPTRACKIR_PFFLOATVOID)LoadFunction( "SCPTIR_GetRoll" );
|
||||
m_GetPitch = (SCPTRACKIR_PFFLOATVOID)LoadFunction( "SCPTIR_GetPitch" );
|
||||
m_GetYaw = (SCPTRACKIR_PFFLOATVOID)LoadFunction( "SCPTIR_GetYaw" );
|
||||
m_enabled = true;
|
||||
}
|
||||
|
||||
bool Enabled( )
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
virtual ~TrackIRDLL( )
|
||||
{
|
||||
/* Prevent further use of the DLL */
|
||||
Reset( );
|
||||
}
|
||||
|
||||
void Reset( )
|
||||
{
|
||||
m_Init = NULL;
|
||||
m_Close = NULL;
|
||||
m_Query = NULL;
|
||||
m_GetX = NULL;
|
||||
m_GetY = NULL;
|
||||
m_GetZ = NULL;
|
||||
m_GetPitch = NULL;
|
||||
m_GetRoll = NULL;
|
||||
m_GetYaw = NULL;
|
||||
m_enabled = false;
|
||||
}
|
||||
|
||||
/* Returns 0 on success */
|
||||
int Init( HWND hwnd )
|
||||
{
|
||||
if ( m_Init )
|
||||
return m_Init( hwnd );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Close( )
|
||||
{
|
||||
if ( m_Close )
|
||||
return m_Close( );
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Query( )
|
||||
{
|
||||
if ( m_Query )
|
||||
return m_Query( );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
float GetX( )
|
||||
{
|
||||
if ( m_GetX )
|
||||
return m_GetX( );
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float GetY( )
|
||||
{
|
||||
if ( m_GetY )
|
||||
return m_GetY( );
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float GetZ( )
|
||||
{
|
||||
if ( m_GetZ )
|
||||
return m_GetZ( );
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float GetPitch( )
|
||||
{
|
||||
if ( m_GetPitch )
|
||||
return m_GetPitch( );
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float GetRoll( )
|
||||
{
|
||||
if ( m_GetRoll )
|
||||
return m_GetRoll( );
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
float GetYaw( )
|
||||
{
|
||||
if ( m_GetYaw )
|
||||
return m_GetYaw( );
|
||||
return 0.0f;
|
||||
}
|
||||
private:
|
||||
/* Functions */
|
||||
SCPTRACKIR_PFINIT m_Init;
|
||||
SCPTRACKIR_PFINTVOID m_Close;
|
||||
SCPTRACKIR_PFINTVOID m_Query;
|
||||
|
||||
SCPTRACKIR_PFFLOATVOID m_GetX;
|
||||
SCPTRACKIR_PFFLOATVOID m_GetY;
|
||||
SCPTRACKIR_PFFLOATVOID m_GetZ;
|
||||
SCPTRACKIR_PFFLOATVOID m_GetPitch;
|
||||
SCPTRACKIR_PFFLOATVOID m_GetRoll;
|
||||
SCPTRACKIR_PFFLOATVOID m_GetYaw;
|
||||
|
||||
bool m_enabled;
|
||||
};
|
||||
|
||||
/* Added to trackirpublic.h */
|
||||
#ifndef SCPDLL_EXTERNAL_LIB
|
||||
extern TrackIRDLL gTirDll_TrackIR;
|
||||
#endif
|
||||
|
||||
#endif /* TRACKIRPUBLIC_H_INCLUDED_ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* 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 _FIREBALLS_H
|
||||
#define _FIREBALLS_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
|
||||
struct object;
|
||||
struct ship_info;
|
||||
struct asteroid_info;
|
||||
|
||||
// values correspond to the fireball render types
|
||||
#define FIREBALL_MEDIUM_EXPLOSION 0
|
||||
#define FIREBALL_LARGE_EXPLOSION 1
|
||||
#define FIREBALL_WARP_EFFECT 2
|
||||
|
||||
// these values correspond to the fireball.tbl default entries
|
||||
#define FIREBALL_EXPLOSION_MEDIUM 0 // Used for the 4 little explosions before a ship explodes
|
||||
#define FIREBALL_WARP 1 // Used for the warp in / warp out effect
|
||||
#define FIREBALL_KNOSSOS 2 // Used for the KNOSSOS warp in / warp out effect
|
||||
#define FIREBALL_ASTEROID 3
|
||||
#define FIREBALL_EXPLOSION_LARGE1 4 // Used for the big explosion when a ship breaks into pieces
|
||||
#define FIREBALL_EXPLOSION_LARGE2 5 // Used for the big explosion when a ship breaks into pieces
|
||||
|
||||
#define MAX_FIREBALL_TYPES 32 // The maximum number of fireballs that can be defined
|
||||
#define NUM_DEFAULT_FIREBALLS 6
|
||||
|
||||
#define FIREBALL_NUM_LARGE_EXPLOSIONS 2
|
||||
|
||||
extern int fireball_used[MAX_FIREBALL_TYPES];
|
||||
extern int Num_fireball_types;
|
||||
|
||||
// all this moved here by Goober5000 because it makes more sense in the H file
|
||||
typedef struct fireball_lod {
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
int bitmap_id;
|
||||
int num_frames;
|
||||
int fps;
|
||||
} fireball_lod;
|
||||
|
||||
typedef struct fireball_info {
|
||||
int lod_count;
|
||||
float exp_color[3];
|
||||
fireball_lod lod[4];
|
||||
} fireball_info;
|
||||
|
||||
// flag values for fireball struct flags member
|
||||
#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_3D (1<<3) // Goober5000
|
||||
#define FBF_WARP_VIA_SEXP (1<<4) // Goober5000
|
||||
|
||||
typedef struct fireball {
|
||||
int objnum; // If -1 this object is unused
|
||||
int fireball_info_index; // Index into Fireball_info array
|
||||
int fireball_render_type;
|
||||
int current_bitmap;
|
||||
int orient; // For fireballs, which orientation. For warps, 0 is warpin, 1 is warpout
|
||||
int flags; // see #define FBF_*
|
||||
char lod; // current LOD
|
||||
float time_elapsed; // in seconds
|
||||
float total_time; // total lifetime of animation in seconds
|
||||
int warp_open_sound_index; // for warp-effect - Goober5000
|
||||
int warp_close_sound_index; // for warp-effect - Goober5000
|
||||
} fireball;
|
||||
// end move
|
||||
|
||||
void fireball_init();
|
||||
void fireball_render(object * obj);
|
||||
void fireball_delete( object * obj );
|
||||
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(vec3d *pos, int fireball_type, int render_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=-1, int warp_close_sound=-1);
|
||||
void fireball_render_plane(int plane);
|
||||
void fireball_close();
|
||||
|
||||
// Returns 1 if you can remove this fireball
|
||||
int fireball_is_perishable(object * obj);
|
||||
|
||||
// Returns 1 if this fireball is a warp
|
||||
int fireball_is_warp(object * obj);
|
||||
|
||||
// Returns life left of a fireball in seconds
|
||||
float fireball_lifeleft( object *obj );
|
||||
|
||||
// Returns life left of a fireball in percent
|
||||
float fireball_lifeleft_percent( object *obj );
|
||||
|
||||
// returns the lighting color (in [0...1] range) to use for explosion
|
||||
void fireball_get_color(int idx, float *red, float *green, float *blue);
|
||||
|
||||
// returns the index of the fireball bitmap for this ship. -1 if there is none.
|
||||
int fireball_ship_explosion_type(ship_info *sip);
|
||||
|
||||
// returns the index of the fireball bitmap for this asteroid. -1 if there is none.
|
||||
int fireball_asteroid_explosion_type(asteroid_info *aip);
|
||||
|
||||
// returns the intensity of a wormhole
|
||||
float fireball_wormhole_intensity( object *obj );
|
||||
|
||||
// internal function to draw warp grid.
|
||||
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_model;
|
||||
|
||||
// Goober5000
|
||||
extern int Knossos_warp_ani_used;
|
||||
|
||||
#endif /* _FIREBALLS_H */
|
||||
@@ -1,198 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include "math/vecmat.h"
|
||||
#include "graphics/tmapper.h"
|
||||
#include "render/3d.h"
|
||||
#include "fireball/fireballs.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "nebula/neb.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "model/model.h"
|
||||
#include "ship/ship.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
|
||||
extern int Warp_model;
|
||||
extern int Warp_glow_bitmap;
|
||||
extern int Warp_ball_bitmap;
|
||||
|
||||
|
||||
void draw_face( vertex *v1, vertex *v2, vertex *v3 )
|
||||
{
|
||||
vec3d norm;
|
||||
vertex *vertlist[3];
|
||||
|
||||
vm_vec_perp(&norm,&v1->world, &v2->world, &v3->world);
|
||||
if ( vm_vec_dot(&norm, &v1->world ) >= 0.0 ) {
|
||||
vertlist[0] = v3;
|
||||
vertlist[1] = v2;
|
||||
vertlist[2] = v1;
|
||||
} else {
|
||||
vertlist[0] = v1;
|
||||
vertlist[1] = v2;
|
||||
vertlist[2] = v3;
|
||||
}
|
||||
|
||||
g3_draw_poly( 3, vertlist, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT );
|
||||
|
||||
}
|
||||
|
||||
void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d)
|
||||
{
|
||||
vec3d center;
|
||||
vec3d vecs[5];
|
||||
vertex verts[5];
|
||||
int saved_gr_zbuffering = gr_zbuffer_get();
|
||||
|
||||
gr_zbuffer_set(GR_ZBUFF_READ);
|
||||
|
||||
vm_vec_scale_add( ¢er, pos, &orient->vec.fvec, -(max_radius/2.5f)/3.0f );
|
||||
|
||||
|
||||
if (Warp_glow_bitmap >= 0) {
|
||||
float r = radius;
|
||||
bool render_it = true;
|
||||
|
||||
#define OUT_PERCENT1 0.80f
|
||||
#define OUT_PERCENT2 0.90f
|
||||
|
||||
#define IN_PERCENT1 0.10f
|
||||
#define IN_PERCENT2 0.20f
|
||||
|
||||
if (Cmdline_warp_flash)
|
||||
{
|
||||
if ( (life_percent >= IN_PERCENT1) && (life_percent < IN_PERCENT2) ) {
|
||||
r *= (life_percent - IN_PERCENT1) / (IN_PERCENT2 - IN_PERCENT1);
|
||||
//render_it = true;
|
||||
} else if ( (life_percent >= OUT_PERCENT1) && (life_percent < OUT_PERCENT2) ) {
|
||||
r *= (OUT_PERCENT2 - life_percent) / (OUT_PERCENT2 - OUT_PERCENT1);
|
||||
//render_it = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (render_it) {
|
||||
// Add in noise
|
||||
int noise_frame = fl2i(Missiontime/15.0f) % NOISE_NUM_FRAMES;
|
||||
|
||||
r *= (0.40f + Noise[noise_frame] * 0.30f);
|
||||
|
||||
// Bobboau's warp thingie, toggled by cmdline
|
||||
if (Cmdline_warp_flash) {
|
||||
r += powf((2.0f * life_percent) - 1.0f, 24.0f) * max_radius * 1.5f;
|
||||
}
|
||||
|
||||
vecs[4] = center;
|
||||
verts[4].texture_position.u = 0.5f; verts[4].texture_position.v = 0.5f;
|
||||
|
||||
if (Cmdline_nohtl) {
|
||||
g3_rotate_vertex( &verts[4], &vecs[4] );
|
||||
} else {
|
||||
g3_transfer_vertex( &verts[4], &vecs[4] );
|
||||
}
|
||||
|
||||
float alpha = (The_mission.flags & MISSION_FLAG_FULLNEB) ? (1.0f - neb2_get_fog_intensity(obj)) : 1.0f;
|
||||
gr_set_bitmap( Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, alpha );
|
||||
|
||||
g3_draw_bitmap( &verts[4], 0, r, TMAP_FLAG_TEXTURED | TMAP_HTL_3D_UNLIT );
|
||||
}
|
||||
}
|
||||
|
||||
if ( (Warp_model >= 0) && (warp_3d || Cmdline_3dwarp) ) {
|
||||
float scale = radius / 25.0f;
|
||||
model_set_warp_globals(scale, scale, scale, texture_bitmap_num, (radius/max_radius) );
|
||||
|
||||
float dist = vm_vec_dist_quick( pos, &Eye_position );
|
||||
model_set_detail_level((int)(dist / (radius * 10.0f)));
|
||||
|
||||
model_render( Warp_model, orient, pos, MR_LOCK_DETAIL | MR_NO_LIGHTING | MR_NORMAL | MR_NO_FOGGING | MR_NO_CULL );
|
||||
|
||||
model_set_warp_globals();
|
||||
} else {
|
||||
float Grid_depth = radius/2.5f;
|
||||
|
||||
gr_set_bitmap( texture_bitmap_num, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
|
||||
|
||||
vm_vec_scale_add( &vecs[0], ¢er, &orient->vec.uvec, radius );
|
||||
vm_vec_scale_add2( &vecs[0], &orient->vec.rvec, -radius );
|
||||
vm_vec_scale_add2( &vecs[0], &orient->vec.fvec, Grid_depth );
|
||||
|
||||
vm_vec_scale_add( &vecs[1], ¢er, &orient->vec.uvec, radius );
|
||||
vm_vec_scale_add2( &vecs[1], &orient->vec.rvec, radius );
|
||||
vm_vec_scale_add2( &vecs[1], &orient->vec.fvec, Grid_depth );
|
||||
|
||||
vm_vec_scale_add( &vecs[2], ¢er, &orient->vec.uvec, -radius );
|
||||
vm_vec_scale_add2( &vecs[2], &orient->vec.rvec, radius );
|
||||
vm_vec_scale_add2( &vecs[2], &orient->vec.fvec, Grid_depth );
|
||||
|
||||
vm_vec_scale_add( &vecs[3], ¢er, &orient->vec.uvec, -radius );
|
||||
vm_vec_scale_add2( &vecs[3], &orient->vec.rvec, -radius );
|
||||
vm_vec_scale_add2( &vecs[3], &orient->vec.fvec, Grid_depth );
|
||||
|
||||
// vm_vec_scale_add( &vecs[4], ¢er, &orient->vec.fvec, -Grid_depth );
|
||||
vecs[4] = center;
|
||||
|
||||
verts[0].texture_position.u = 0.01f;
|
||||
verts[0].texture_position.v = 0.01f;
|
||||
|
||||
verts[1].texture_position.u = 0.99f;
|
||||
verts[1].texture_position.v = 0.01f;
|
||||
|
||||
verts[2].texture_position.u = 0.99f;
|
||||
verts[2].texture_position.v = 0.99f;
|
||||
|
||||
verts[3].texture_position.u = 0.01f;
|
||||
verts[3].texture_position.v = 0.99f;
|
||||
|
||||
verts[4].texture_position.u = 0.5f;
|
||||
verts[4].texture_position.v = 0.5f;
|
||||
|
||||
if (Cmdline_nohtl) {
|
||||
g3_rotate_vertex( &verts[0], &vecs[0] );
|
||||
g3_rotate_vertex( &verts[1], &vecs[1] );
|
||||
g3_rotate_vertex( &verts[2], &vecs[2] );
|
||||
g3_rotate_vertex( &verts[3], &vecs[3] );
|
||||
g3_rotate_vertex( &verts[4], &vecs[4] );
|
||||
} else {
|
||||
g3_transfer_vertex( &verts[0], &vecs[0] );
|
||||
g3_transfer_vertex( &verts[1], &vecs[1] );
|
||||
g3_transfer_vertex( &verts[2], &vecs[2] );
|
||||
g3_transfer_vertex( &verts[3], &vecs[3] );
|
||||
g3_transfer_vertex( &verts[4], &vecs[4] );
|
||||
}
|
||||
|
||||
int cull = 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] );
|
||||
gr_set_cull(cull);
|
||||
}
|
||||
|
||||
if (Warp_ball_bitmap > -1 && Cmdline_warp_flash == 1) {
|
||||
flash_ball warp_ball(20, .1f,.25f, &vmd_z_vector, &vmd_zero_vector, 4.0f, 0.5f);
|
||||
float adg = (2.0f * life_percent) - 1.0f;
|
||||
float pct = (powf(adg, 4.0f) - powf(adg, 128.0f)) * 4.0f;
|
||||
|
||||
if (pct > 0.00001f) {
|
||||
g3_start_instance_matrix(pos, orient, true);
|
||||
|
||||
gr_set_bitmap(Warp_ball_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.9999f);
|
||||
|
||||
warp_ball.render(max_radius * pct * 0.5f, adg * adg, adg * adg * 6.0f);
|
||||
|
||||
g3_done_instance(true);
|
||||
}
|
||||
}
|
||||
|
||||
gr_zbuffer_set( saved_gr_zbuffering );
|
||||
}
|
||||
@@ -1,406 +0,0 @@
|
||||
/*
|
||||
* Created by Hassan "Karajorma" Kazmi for the FreeSpace2 Source Code Project.
|
||||
* You may not sell or otherwise commercially exploit the source or things you
|
||||
* create based on the source.
|
||||
*/
|
||||
|
||||
// AltShipClassDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "fred.h"
|
||||
#include "AltShipClassDlg.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "ship/ship.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// AltShipClassDlg dialog
|
||||
|
||||
|
||||
AltShipClassDlg::AltShipClassDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(AltShipClassDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(AltShipClassDlg)
|
||||
m_selected_variable = -1;
|
||||
m_selected_class = -1;
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
multi_edit = false;
|
||||
player_ships_only = true;
|
||||
num_string_variables = 0;
|
||||
|
||||
memset(string_variable_indices, -1, sizeof (int)*MAX_SEXP_VARIABLES);
|
||||
memset(ship_class_indices, -1, sizeof (int)*MAX_SHIP_CLASSES);
|
||||
}
|
||||
|
||||
|
||||
void AltShipClassDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(AltShipClassDlg)
|
||||
DDX_Control(pDX, IDC_DEFAULT_TO_CLASS, m_default_to_class);
|
||||
DDX_Control(pDX, IDC_ALT_CLASS_LIST, m_alt_class_list);
|
||||
DDX_Control(pDX, IDC_SET_FROM_SHIP_CLASS, m_set_from_ship_class);
|
||||
DDX_Control(pDX, IDC_SET_FROM_VARIABLES, m_set_from_variables);
|
||||
DDX_CBIndex(pDX, IDC_SET_FROM_VARIABLES, m_selected_variable);
|
||||
DDX_CBIndex(pDX, IDC_SET_FROM_SHIP_CLASS, m_selected_class);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(AltShipClassDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(AltShipClassDlg)
|
||||
ON_BN_CLICKED(IDC_ALT_CLASS_ADD, OnAltClassAdd)
|
||||
ON_BN_CLICKED(IDC_ALT_CLASS_INSERT, OnAltClassInsert)
|
||||
ON_BN_CLICKED(IDC_ALT_CLASS_DELETE, OnAltClassDelete)
|
||||
ON_BN_CLICKED(IDC_ALT_CLASS_UP, OnMoveUp)
|
||||
ON_BN_CLICKED(IDC_ALT_CLASS_DOWN, OnMoveDown)
|
||||
ON_CBN_SELENDOK(IDC_SET_FROM_SHIP_CLASS, OnSelendokSetFromShipClass)
|
||||
ON_CBN_SELENDOK(IDC_SET_FROM_VARIABLES, OnSelendokSetFromVariables)
|
||||
ON_LBN_SELCHANGE(IDC_ALT_CLASS_LIST, OnSelchangeAltClassList)
|
||||
ON_BN_CLICKED(IDC_DEFAULT_TO_CLASS, OnDefaultToClass)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// AltShipClassDlg message handlers
|
||||
|
||||
|
||||
BOOL AltShipClassDlg::OnInitDialog()
|
||||
{
|
||||
int i, count;
|
||||
char buff[TOKEN_LENGTH + TOKEN_LENGTH + 2]; // VariableName[VariableValue]
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// have we got multiple selected ships?
|
||||
num_selected_ships = 0;
|
||||
object *objp;
|
||||
|
||||
objp = GET_FIRST(&obj_used_list);
|
||||
while (objp != END_OF_LIST(&obj_used_list)) {
|
||||
if ((objp->type == OBJ_START) || (objp->type == OBJ_SHIP)) {
|
||||
if (objp->flags & OF_MARKED) {
|
||||
m_selected_ships[num_selected_ships++] = objp->instance;
|
||||
}
|
||||
}
|
||||
objp = GET_NEXT(objp);
|
||||
}
|
||||
|
||||
Assert (num_selected_ships > 0);
|
||||
Assert (Objects[cur_object_index].flags & OF_MARKED);
|
||||
|
||||
if (num_selected_ships > 1)
|
||||
{
|
||||
multi_edit = true;
|
||||
}
|
||||
|
||||
// Fill the variable combo box
|
||||
m_set_from_variables.ResetContent();
|
||||
m_set_from_variables.AddString("Set From Ship Class");
|
||||
for (i=0; i < MAX_SEXP_VARIABLES; i++)
|
||||
{
|
||||
if (Sexp_variables[i].type & SEXP_VARIABLE_STRING)
|
||||
{
|
||||
sprintf(buff, "%s[%s]", Sexp_variables[i].variable_name, Sexp_variables[i].text);
|
||||
m_set_from_variables.AddString(buff);
|
||||
string_variable_indices[num_string_variables++] = i;
|
||||
}
|
||||
}
|
||||
m_set_from_variables.SetCurSel(0);
|
||||
if (!num_string_variables) {
|
||||
m_set_from_variables.EnableWindow(FALSE);
|
||||
}
|
||||
|
||||
// Fill the ship classes combo box
|
||||
m_set_from_ship_class.ResetContent();
|
||||
// Add the default entry if we need one followed by all the ship classes
|
||||
if (num_string_variables) {
|
||||
m_set_from_ship_class.AddString("Set From Variable");
|
||||
}
|
||||
count = 0;
|
||||
for (i=0; i<Num_ship_classes; i++)
|
||||
{
|
||||
if (player_ships_only && !(Ship_info[i].flags & SIF_PLAYER_SHIP)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ship_class_indices[count++] = i;
|
||||
m_set_from_ship_class.AddString(Ship_info[i].name);
|
||||
}
|
||||
m_set_from_ship_class.SetCurSel(num_string_variables?1:0); // Set to the first ship class
|
||||
|
||||
// Set up the actual list of alt classes
|
||||
alt_class_pool.clear();
|
||||
alt_class_pool = Ships[Objects[cur_object_index].instance].s_alt_classes;
|
||||
alt_class_list_rebuild();
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
|
||||
void AltShipClassDlg::alt_class_list_rebuild()
|
||||
{
|
||||
int i, j;
|
||||
char buff[TOKEN_LENGTH + TOKEN_LENGTH + 2]; // VariableName[VariableValue]
|
||||
|
||||
j = m_alt_class_list.GetCount();
|
||||
for ( i=0; i < j ; i++) {
|
||||
m_alt_class_list.DeleteString(0);
|
||||
}
|
||||
|
||||
for (i = 0; i < (int)alt_class_pool.size() ; i++) {
|
||||
// Default classes should be at the end of the list
|
||||
if(alt_class_pool[i].default_to_this_class && (i < (int)alt_class_pool.size() - 1) ) {
|
||||
// Int3();
|
||||
// TO DO : we should fix this.
|
||||
}
|
||||
|
||||
if (alt_class_pool[i].variable_index != -1) {
|
||||
Assert (alt_class_pool[i].variable_index > -1 && alt_class_pool[i].variable_index < MAX_SEXP_VARIABLES);
|
||||
Assert (Sexp_variables[alt_class_pool[i].variable_index].type & SEXP_VARIABLE_STRING);
|
||||
|
||||
sprintf(buff, "%s[%s]", Sexp_variables[alt_class_pool[i].variable_index].variable_name, Sexp_variables[alt_class_pool[i].variable_index].text);
|
||||
|
||||
// add it to the list
|
||||
m_alt_class_list.AddString(buff);
|
||||
}
|
||||
else {
|
||||
if (alt_class_pool[i].ship_class >= 0 && alt_class_pool[i].ship_class < MAX_SHIP_CLASSES) {
|
||||
m_alt_class_list.AddString(Ship_info[alt_class_pool[i].ship_class].name);
|
||||
}
|
||||
else {
|
||||
m_alt_class_list.AddString("Invalid Ship Class");
|
||||
Int3();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnCancel()
|
||||
{
|
||||
// TODO: Add extra cleanup here
|
||||
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnOK()
|
||||
{
|
||||
// TODO: Add extra validation here
|
||||
|
||||
for (int i=0; i < num_selected_ships; i++) {
|
||||
Ships[m_selected_ships[i]].s_alt_classes = alt_class_pool;
|
||||
}
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnAltClassAdd()
|
||||
{
|
||||
alt_class new_list_item;
|
||||
|
||||
alt_class_update_entry(new_list_item);
|
||||
|
||||
alt_class_pool.push_back(new_list_item);
|
||||
alt_class_list_rebuild();
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnAltClassInsert()
|
||||
{
|
||||
int index;
|
||||
alt_class new_list_item;
|
||||
alt_class_update_entry(new_list_item);
|
||||
|
||||
index = m_alt_class_list.GetCurSel();
|
||||
|
||||
// If nothing is selected just add it
|
||||
if ( index == -1) {
|
||||
alt_class_pool.push_back(new_list_item);
|
||||
}
|
||||
// Stick it in front of the current selection
|
||||
else {
|
||||
alt_class_pool.insert(alt_class_pool.begin() + index, new_list_item );
|
||||
}
|
||||
|
||||
alt_class_list_rebuild();
|
||||
|
||||
// If we inserted the user will probably want to edit the selection
|
||||
if (index > -1) {
|
||||
m_alt_class_list.SetCurSel(index);
|
||||
}
|
||||
}
|
||||
|
||||
// Updates the currently selected list entry
|
||||
void AltShipClassDlg::alt_class_update_entry(alt_class &list_item)
|
||||
{
|
||||
int index;
|
||||
|
||||
// Add a string variable to the list
|
||||
if (num_string_variables && m_set_from_variables.GetCurSel() > 0) {
|
||||
index = string_variable_indices[m_set_from_variables.GetCurSel() -1];
|
||||
|
||||
Assert (index >= 0);
|
||||
list_item.variable_index = index;
|
||||
list_item.ship_class = ship_info_lookup(Sexp_variables[index].text);
|
||||
}
|
||||
// Add a ship class to the list
|
||||
else {
|
||||
index = m_set_from_ship_class.GetCurSel();
|
||||
|
||||
// Correct the index if the first entry isn't actually a ship class
|
||||
if (num_string_variables) {
|
||||
Assert (index > 0);
|
||||
index--;
|
||||
}
|
||||
|
||||
list_item.variable_index = -1;
|
||||
list_item.ship_class = ship_class_indices[index];
|
||||
}
|
||||
|
||||
// check the default tickbox
|
||||
list_item.default_to_this_class = m_default_to_class.GetCheck() ? true:false;
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnAltClassDelete()
|
||||
{
|
||||
int index = m_alt_class_list.GetCurSel();
|
||||
|
||||
// Nothing selected
|
||||
if (index == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
Assert (index < (int) alt_class_pool.size());
|
||||
alt_class_pool.erase(alt_class_pool.begin()+index);
|
||||
alt_class_list_rebuild();
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnMoveUp()
|
||||
{
|
||||
int index = m_alt_class_list.GetCurSel();
|
||||
|
||||
// Nothing selected or already at the top
|
||||
if (index < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::swap(alt_class_pool[index], alt_class_pool[index-1]);
|
||||
alt_class_list_rebuild();
|
||||
m_alt_class_list.SetCurSel(index-1);
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnMoveDown()
|
||||
{
|
||||
int index = m_alt_class_list.GetCurSel();
|
||||
int inext = index + 1;
|
||||
|
||||
// Nothing selected or already at the bottom
|
||||
if (index == -1 || (index >= m_alt_class_list.GetCount() - 1) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::swap(alt_class_pool[index], alt_class_pool[inext]);
|
||||
alt_class_list_rebuild();
|
||||
m_alt_class_list.SetCurSel(index);
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnSelendokSetFromShipClass()
|
||||
{
|
||||
int current_selection;
|
||||
|
||||
if (m_set_from_ship_class.GetCurSel() == 0 && num_string_variables) {
|
||||
m_set_from_variables.SetCurSel(1);
|
||||
}
|
||||
else {
|
||||
m_set_from_variables.SetCurSel(0);
|
||||
}
|
||||
|
||||
// if a list entry is selected we should update it
|
||||
current_selection = m_alt_class_list.GetCurSel();
|
||||
if (current_selection >= 0) {
|
||||
alt_class_update_entry(alt_class_pool[m_alt_class_list.GetCurSel()]);
|
||||
alt_class_list_rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnSelendokSetFromVariables()
|
||||
{
|
||||
int current_selection;
|
||||
|
||||
if (m_set_from_variables.GetCurSel() == 0) {
|
||||
m_set_from_ship_class.SetCurSel(num_string_variables ? 1 : 0);
|
||||
}
|
||||
else {
|
||||
m_set_from_ship_class.SetCurSel(0);
|
||||
}
|
||||
|
||||
// if a list entry is selected we should update it
|
||||
current_selection = m_alt_class_list.GetCurSel();
|
||||
if (current_selection >= 0) {
|
||||
alt_class_update_entry(alt_class_pool[m_alt_class_list.GetCurSel()]);
|
||||
alt_class_list_rebuild();
|
||||
}
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnSelchangeAltClassList()
|
||||
{
|
||||
int i;
|
||||
int variable_selection = 0;
|
||||
int ship_selection = 0;
|
||||
int index = m_alt_class_list.GetCurSel();
|
||||
|
||||
// Selected nothing
|
||||
if (index == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we have a variable selected
|
||||
if (alt_class_pool[index].variable_index != -1) {
|
||||
for (i=0; i < MAX_SEXP_VARIABLES; i++)
|
||||
{
|
||||
if (string_variable_indices[i] == alt_class_pool[index].variable_index) {
|
||||
variable_selection = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Ship selected
|
||||
else {
|
||||
for (i=0; i < MAX_SHIP_CLASSES; i++) {
|
||||
if (ship_class_indices[i] == alt_class_pool[index].ship_class) {
|
||||
ship_selection = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if we have string variables in the mission the first entry on the list won't be a ship
|
||||
if (num_string_variables) {
|
||||
ship_selection++;
|
||||
}
|
||||
}
|
||||
|
||||
m_set_from_variables.SetCurSel(variable_selection);
|
||||
m_set_from_ship_class.SetCurSel(ship_selection);
|
||||
m_default_to_class.SetCheck(alt_class_pool[index].default_to_this_class ? 1:0);
|
||||
}
|
||||
|
||||
void AltShipClassDlg::OnDefaultToClass()
|
||||
{
|
||||
int index = m_alt_class_list.GetCurSel();
|
||||
|
||||
// Nothing selected
|
||||
if (index == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
alt_class_pool[index].default_to_this_class = m_default_to_class.GetCheck() ? true:false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Created by Hassan "Karajorma" Kazmi for the FreeSpace2 Source Code Project.
|
||||
* You may not sell or otherwise commercially exploit the source or things you
|
||||
* create based on the source.
|
||||
*/
|
||||
|
||||
#if !defined(AFX_AltShipClassDlg_H__2FE2C917_C7DA_4C05_A11F_DCC46BFB26BB__INCLUDED_)
|
||||
#define AFX_AltShipClassDlg_H__2FE2C917_C7DA_4C05_A11F_DCC46BFB26BB__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// AltShipClassDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// AltShipClassDlg dialog
|
||||
|
||||
class AltShipClassDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
AltShipClassDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(AltShipClassDlg)
|
||||
enum { IDD = IDD_ALT_SHIP_CLASS };
|
||||
CButton m_default_to_class;
|
||||
CListBox m_alt_class_list;
|
||||
CComboBox m_set_from_ship_class;
|
||||
CComboBox m_set_from_variables;
|
||||
int m_selected_variable;
|
||||
int m_selected_class;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(AltShipClassDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(AltShipClassDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual void OnCancel();
|
||||
virtual void OnOK();
|
||||
afx_msg void OnAltClassAdd();
|
||||
afx_msg void OnAltClassInsert();
|
||||
afx_msg void OnAltClassDelete();
|
||||
afx_msg void OnMoveUp();
|
||||
afx_msg void OnMoveDown();
|
||||
afx_msg void OnSelendokSetFromShipClass();
|
||||
afx_msg void OnSelendokSetFromVariables();
|
||||
afx_msg void OnSelchangeAltClassList();
|
||||
afx_msg void OnDefaultToClass();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
|
||||
bool player_ships_only; // Whether we only add player ships to the alt classes or if we can add any ship
|
||||
|
||||
SCP_vector<alt_class> alt_class_pool;
|
||||
int num_string_variables; // Number of string variables in the mission
|
||||
int string_variable_indices[MAX_SEXP_VARIABLES]; // maps string variables to their index in Sexp_variables
|
||||
int ship_class_indices[MAX_SHIP_CLASSES]; // maps ships in the ships combobox to their index in Ship_info
|
||||
|
||||
|
||||
// variables to handle selection of multiple ships
|
||||
bool multi_edit;
|
||||
int m_selected_ships[MAX_SHIPS];
|
||||
int num_selected_ships;
|
||||
|
||||
void AltShipClassDlg::alt_class_list_rebuild();
|
||||
void AltShipClassDlg::alt_class_update_entry(alt_class &list_item);
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_AltShipClassDlg_H__2FE2C917_C7DA_4C05_A11F_DCC46BFB26BB__INCLUDED_)
|
||||
@@ -1,115 +0,0 @@
|
||||
// FictionViewerDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "fred.h"
|
||||
#include "FictionViewerDlg.h"
|
||||
#include "missionui/fictionviewer.h"
|
||||
#include "gamesnd/eventmusic.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FictionViewerDlg dialog
|
||||
|
||||
|
||||
FictionViewerDlg::FictionViewerDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(FictionViewerDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(FictionViewerDlg)
|
||||
m_story_file = _T("");
|
||||
m_font_file = _T("");
|
||||
m_fiction_music = 0;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void FictionViewerDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(FictionViewerDlg)
|
||||
DDX_Text(pDX, IDC_STORY_FILE, m_story_file);
|
||||
DDX_Text(pDX, IDC_FONT_FILE, m_font_file);
|
||||
DDX_CBIndex(pDX, IDC_FICTION_MUSIC, m_fiction_music);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(FictionViewerDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(FictionViewerDlg)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FictionViewerDlg message handlers
|
||||
|
||||
BOOL FictionViewerDlg::OnInitDialog()
|
||||
{
|
||||
int i;
|
||||
CComboBox *box;
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_FICTION_MUSIC);
|
||||
box->AddString("None");
|
||||
for (i=0; i<Num_music_files; i++){
|
||||
box->AddString(Spooled_music[i].name);
|
||||
}
|
||||
|
||||
// init variables
|
||||
m_story_file = _T(fiction_file());
|
||||
m_font_file = _T(fiction_font());
|
||||
m_fiction_music = Mission_music[SCORE_FICTION_VIEWER] + 1;
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
UpdateData(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void FictionViewerDlg::OnOK()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
|
||||
// load it up
|
||||
fiction_viewer_reset();
|
||||
fiction_viewer_load((char *)(LPCSTR) m_story_file, (char *)(LPCSTR) m_font_file);
|
||||
|
||||
// set music
|
||||
Mission_music[SCORE_FICTION_VIEWER] = m_fiction_music - 1;
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void FictionViewerDlg::OnCancel()
|
||||
{
|
||||
// TODO: Add extra cleanup here
|
||||
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
void FictionViewerDlg::OnClose()
|
||||
{
|
||||
int z;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
if (query_modified()) {
|
||||
z = MessageBox("Do you want to keep your changes?", "Close", MB_ICONQUESTION | MB_YESNOCANCEL);
|
||||
if (z == IDCANCEL){
|
||||
return;
|
||||
}
|
||||
|
||||
if (z == IDYES) {
|
||||
OnOK();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CDialog::OnClose();
|
||||
}
|
||||
|
||||
int FictionViewerDlg::query_modified()
|
||||
{
|
||||
return strcmp(m_story_file, fiction_file()) || strcmp(m_font_file, fiction_font()) || m_fiction_music != (Mission_music[SCORE_FICTION_VIEWER] + 1);
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#if !defined(AFX_FICTIONVIEWERDLG_H__46BAD1B6_F9DC_4414_9C33_18EC17FD491F__INCLUDED_)
|
||||
#define AFX_FICTIONVIEWERDLG_H__46BAD1B6_F9DC_4414_9C33_18EC17FD491F__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// FictionViewerDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// FictionViewerDlg dialog
|
||||
|
||||
class FictionViewerDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
FictionViewerDlg(CWnd* pParent = NULL); // standard constructor
|
||||
int query_modified();
|
||||
void OnOK();
|
||||
void OnCancel();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(FictionViewerDlg)
|
||||
enum { IDD = IDD_FICTION_VIEWER };
|
||||
CString m_story_file;
|
||||
CString m_font_file;
|
||||
int m_fiction_music;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(FictionViewerDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(FictionViewerDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnClose();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_FICTIONVIEWERDLG_H__46BAD1B6_F9DC_4414_9C33_18EC17FD491F__INCLUDED_)
|
||||
@@ -1,287 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// AddVariableDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "AddVariableDlg.h"
|
||||
#include "parse/sexp.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define NO_RESET_FOCUS 0
|
||||
#define RESET_FOCUS 1
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAddVariableDlg dialog
|
||||
|
||||
|
||||
CAddVariableDlg::CAddVariableDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CAddVariableDlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CAddVariableDlg)
|
||||
m_default_value = _T("");
|
||||
m_variable_name = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CAddVariableDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CAddVariableDlg)
|
||||
DDX_Text(pDX, IDC_ADD_VARIABLE_DEFAULT_VALUE, m_default_value);
|
||||
DDV_MaxChars(pDX, m_default_value, 31);
|
||||
DDX_Text(pDX, IDC_ADD_VARIABLE_NAME, m_variable_name);
|
||||
DDV_MaxChars(pDX, m_variable_name, 31);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAddVariableDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CAddVariableDlg)
|
||||
ON_BN_CLICKED(IDC_TYPE_NUMBER, OnTypeNumber)
|
||||
ON_BN_CLICKED(IDC_TYPE_STRING, OnTypeString)
|
||||
ON_BN_CLICKED(IDC_TYPE_CAMPAIGN_PERSISTENT, OnTypeCampaignPersistent)
|
||||
ON_BN_CLICKED(IDC_TYPE_PLAYER_PERSISTENT, OnTypePlayerPersistent)
|
||||
ON_BN_CLICKED(IDC_TYPE_NETWORK_VARIABLE, OnTypeNetworkVariable)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAddVariableDlg message handlers
|
||||
|
||||
void CAddVariableDlg::OnOK()
|
||||
{
|
||||
// validation name
|
||||
validate_variable_name(RESET_FOCUS);
|
||||
|
||||
// validate data
|
||||
if ( m_name_validated ) {
|
||||
validate_data(RESET_FOCUS);
|
||||
}
|
||||
|
||||
// both ok, then store results
|
||||
if ( m_name_validated && m_data_validated ) {
|
||||
// int sexp_add_variable(char *text, char*, int type);
|
||||
// char temp_name[32];
|
||||
// char temp_value[32];
|
||||
// strcpy_s(temp_name, m_variable_name);
|
||||
// strcpy_s(temp_value, m_default_value);
|
||||
// SEXP_VARIABLE_NUMBER SEXP_VARIABLE_STRING
|
||||
// int type;
|
||||
//
|
||||
// if (m_type_number) {
|
||||
// type = SEXP_VARIABLE_NUMBER;
|
||||
// } else {
|
||||
// type = SEXP_VARIABLE_STRING;
|
||||
// }
|
||||
//
|
||||
// // Goober5000
|
||||
// if (m_type_player_persistent) {
|
||||
// type |= SEXP_VARIABLE_PLAYER_PERSISTENT;
|
||||
// } else if (m_type_campaign_persistent) {
|
||||
// type |= SEXP_VARIABLE_CAMPAIGN_PERSISTENT;
|
||||
// }
|
||||
//
|
||||
// m_sexp_var_index = sexp_add_variable(temp_value, temp_name, type);
|
||||
// this get done for free CDialog::OnOk() UpdateData(TRUE);
|
||||
m_create = true;
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CAddVariableDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
m_variable_name = "<Variable Name>";
|
||||
m_default_value = "<Default Value>";
|
||||
|
||||
// Set variable type to number
|
||||
m_type_number = true;
|
||||
m_type_campaign_persistent = false;
|
||||
m_type_player_persistent = false;
|
||||
m_type_network_variable = false;
|
||||
set_variable_type();
|
||||
|
||||
m_name_validated = false;
|
||||
m_data_validated = false;
|
||||
m_create = false;
|
||||
|
||||
// Send default name and values into dialog box
|
||||
UpdateData(FALSE);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
bool is_sexp_variable_name(const char* temp_name)
|
||||
{
|
||||
for (int i=0; i<MAX_SEXP_VARIABLES; i++) {
|
||||
if (Sexp_variables[i].type & SEXP_VARIABLE_SET) {
|
||||
if ( !strcmp(Sexp_variables[i].text, temp_name) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// name not found
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Check variable name (1) changed (2) > 0 length (3) does not already exist
|
||||
void CAddVariableDlg::validate_variable_name(int set_focus)
|
||||
{
|
||||
CString temp_name;
|
||||
|
||||
CEdit *edit = (CEdit *) GetDlgItem(IDC_ADD_VARIABLE_NAME);
|
||||
edit->GetWindowText(temp_name);
|
||||
|
||||
// Check if any change and not already in list
|
||||
if ( stricmp(temp_name, "<Variable Name>") ) {
|
||||
if ( (strlen(temp_name) > 0) && (get_index_sexp_variable_name(LPCTSTR(temp_name)) == -1) ) { //not already in list and length > 0 { //-V805
|
||||
// Goober5000 - replace spaces with hyphens
|
||||
if (strchr(temp_name, ' ') != NULL)
|
||||
{
|
||||
// display msg
|
||||
MessageBox("Variable names cannot contain spaces. Replacing with hyphens.");
|
||||
|
||||
// replace chars
|
||||
//Modified to make the code build. - Thunderbird
|
||||
temp_name.Replace((TCHAR) ' ', (TCHAR) '-');
|
||||
//temp_name.Replace((TCHAR) ' ', (TCHAR) '-'));
|
||||
|
||||
// fix what's displayed
|
||||
edit->SetFocus();
|
||||
edit->SetWindowText(temp_name);
|
||||
edit->SetSel(0, -1);
|
||||
}
|
||||
|
||||
m_name_validated = true;
|
||||
} else {
|
||||
// conflicting variable name
|
||||
if (strlen(temp_name) == 0) { //-V805
|
||||
edit->SetWindowText("<Variable Name>");
|
||||
}
|
||||
m_name_validated = false;
|
||||
if (set_focus == RESET_FOCUS) {
|
||||
MessageBox("Conflicting variable name");
|
||||
edit->SetFocus();
|
||||
edit->SetSel(0, -1);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// name unchanged from default
|
||||
m_name_validated = false;
|
||||
if (set_focus == RESET_FOCUS) {
|
||||
MessageBox("Invalid variable name");
|
||||
edit->SetFocus();
|
||||
edit->SetSel(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CAddVariableDlg::validate_data(int set_focus)
|
||||
{
|
||||
CString temp_data;
|
||||
|
||||
CEdit *edit = (CEdit *) GetDlgItem(IDC_ADD_VARIABLE_DEFAULT_VALUE);
|
||||
edit->GetWindowText(temp_data);
|
||||
|
||||
// check for 0 string length
|
||||
if (strlen(temp_data) == 0) { //-V805
|
||||
m_data_validated = false;
|
||||
} else {
|
||||
if (m_type_number) {
|
||||
// verify valid number
|
||||
int temp_num = atoi(temp_data);
|
||||
char buf[TOKEN_LENGTH];
|
||||
sprintf(buf, "%d", temp_num);
|
||||
|
||||
if ( stricmp(buf, temp_data) ) {
|
||||
m_data_validated = false;
|
||||
} else {
|
||||
m_data_validated = true;
|
||||
}
|
||||
} else {
|
||||
m_data_validated = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Display message and reset focus
|
||||
if ( (!m_data_validated) && (set_focus == RESET_FOCUS) ) {
|
||||
MessageBox("Invalid Default Value.");
|
||||
edit->SetFocus();
|
||||
edit->SetSel(0, -1);
|
||||
}
|
||||
}
|
||||
|
||||
// Set type to number
|
||||
void CAddVariableDlg::OnTypeNumber()
|
||||
{
|
||||
m_type_number = true;
|
||||
set_variable_type();
|
||||
}
|
||||
|
||||
// Set type to string
|
||||
void CAddVariableDlg::OnTypeString()
|
||||
{
|
||||
m_type_number = false;
|
||||
set_variable_type();
|
||||
}
|
||||
|
||||
void CAddVariableDlg::OnTypePlayerPersistent()
|
||||
{
|
||||
m_type_player_persistent = ((CButton *) GetDlgItem(IDC_TYPE_PLAYER_PERSISTENT))->GetCheck() ? true : false;
|
||||
|
||||
if (m_type_player_persistent)
|
||||
m_type_campaign_persistent = false;
|
||||
|
||||
set_variable_type();
|
||||
}
|
||||
|
||||
void CAddVariableDlg::OnTypeCampaignPersistent()
|
||||
{
|
||||
m_type_campaign_persistent = ((CButton *) GetDlgItem(IDC_TYPE_CAMPAIGN_PERSISTENT))->GetCheck() ? true : false;
|
||||
|
||||
if (m_type_campaign_persistent)
|
||||
m_type_player_persistent = false;
|
||||
|
||||
set_variable_type();
|
||||
}
|
||||
|
||||
void CAddVariableDlg::OnTypeNetworkVariable()
|
||||
{
|
||||
m_type_network_variable = ((CButton *) GetDlgItem(IDC_TYPE_NETWORK_VARIABLE))->GetCheck() ? true : false;
|
||||
set_variable_type();
|
||||
}
|
||||
|
||||
// Set type check boxes
|
||||
void CAddVariableDlg::set_variable_type()
|
||||
{
|
||||
|
||||
CButton *button_string = (CButton *) GetDlgItem(IDC_TYPE_STRING);
|
||||
CButton *button_number = (CButton *) GetDlgItem(IDC_TYPE_NUMBER);
|
||||
|
||||
button_number->SetCheck( m_type_number);
|
||||
button_string->SetCheck(!m_type_number);
|
||||
|
||||
((CButton *) GetDlgItem(IDC_TYPE_CAMPAIGN_PERSISTENT))->SetCheck(m_type_campaign_persistent);
|
||||
((CButton *) GetDlgItem(IDC_TYPE_PLAYER_PERSISTENT))->SetCheck(m_type_player_persistent);
|
||||
((CButton *) GetDlgItem(IDC_TYPE_NETWORK_VARIABLE))->SetCheck(m_type_network_variable);
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(AFX_ADDVARIABLEDLG_H__0F668CB5_AAEE_11D2_A899_0060088FAE88__INCLUDED_)
|
||||
#define AFX_ADDVARIABLEDLG_H__0F668CB5_AAEE_11D2_A899_0060088FAE88__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// AddVariableDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAddVariableDlg dialog
|
||||
|
||||
class CAddVariableDlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CAddVariableDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CAddVariableDlg)
|
||||
enum { IDD = IDD_ADD_VARIABLE };
|
||||
CString m_default_value;
|
||||
CString m_variable_name;
|
||||
bool m_name_validated;
|
||||
bool m_data_validated;
|
||||
bool m_type_number;
|
||||
bool m_type_campaign_persistent;
|
||||
bool m_type_player_persistent;
|
||||
bool m_type_network_variable;
|
||||
bool m_create;
|
||||
int m_sexp_var_index;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CAddVariableDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CAddVariableDlg)
|
||||
virtual void OnOK();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void validate_variable_name(int set_focus);
|
||||
afx_msg void validate_data(int set_focus);
|
||||
afx_msg void OnTypeNumber();
|
||||
afx_msg void OnTypeString();
|
||||
afx_msg void OnTypePlayerPersistent();
|
||||
afx_msg void OnTypeCampaignPersistent();
|
||||
afx_msg void OnTypeNetworkVariable();
|
||||
afx_msg void set_variable_type();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_ADDVARIABLEDLG_H__0F668CB5_AAEE_11D2_A899_0060088FAE88__INCLUDED_)
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "AdjustGridDlg.h"
|
||||
#include "mission/missiongrid.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// adjust_grid_dlg dialog
|
||||
|
||||
adjust_grid_dlg::adjust_grid_dlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(adjust_grid_dlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(adjust_grid_dlg)
|
||||
m_x = 0;
|
||||
m_y = 0;
|
||||
m_z = 0;
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void adjust_grid_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(adjust_grid_dlg)
|
||||
DDX_Control(pDX, IDC_SPIN_Z, m_spinz);
|
||||
DDX_Control(pDX, IDC_SPIN_Y, m_spiny);
|
||||
DDX_Control(pDX, IDC_SPIN_X, m_spinx);
|
||||
DDX_Text(pDX, IDC_EDIT_X, m_x);
|
||||
DDX_Text(pDX, IDC_EDIT_Y, m_y);
|
||||
DDX_Text(pDX, IDC_EDIT_Z, m_z);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(adjust_grid_dlg, CDialog)
|
||||
//{{AFX_MSG_MAP(adjust_grid_dlg)
|
||||
ON_BN_CLICKED(IDC_XY_PLANE, OnXyPlane)
|
||||
ON_BN_CLICKED(IDC_XZ_PLANE, OnXzPlane)
|
||||
ON_BN_CLICKED(IDC_YZ_PLANE, OnYzPlane)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// adjust_grid_dlg message handlers
|
||||
|
||||
BOOL adjust_grid_dlg::OnInitDialog()
|
||||
{
|
||||
m_x = (int) The_grid->center.xyz.x;
|
||||
m_y = (int) The_grid->center.xyz.y;
|
||||
m_z = (int) The_grid->center.xyz.z;
|
||||
CDialog::OnInitDialog();
|
||||
if (The_grid->gmatrix.vec.uvec.xyz.y) {
|
||||
((CButton *) GetDlgItem(IDC_XZ_PLANE))->SetCheck(TRUE);
|
||||
GetDlgItem(IDC_EDIT_X)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_EDIT_Z)->EnableWindow(FALSE);
|
||||
|
||||
} else if (The_grid->gmatrix.vec.uvec.xyz.z) {
|
||||
((CButton *) GetDlgItem(IDC_XY_PLANE))->SetCheck(TRUE);
|
||||
GetDlgItem(IDC_EDIT_X)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_EDIT_Y)->EnableWindow(FALSE);
|
||||
|
||||
} else {
|
||||
((CButton *) GetDlgItem(IDC_YZ_PLANE))->SetCheck(TRUE);
|
||||
GetDlgItem(IDC_EDIT_Y)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_EDIT_Z)->EnableWindow(FALSE);
|
||||
}
|
||||
|
||||
m_spinx.SetRange(SHRT_MIN, SHRT_MAX);
|
||||
m_spiny.SetRange(SHRT_MIN, SHRT_MAX);
|
||||
m_spinz.SetRange(SHRT_MIN, SHRT_MAX);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void adjust_grid_dlg::OnOK()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
The_grid->center.xyz.x = (float) m_x;
|
||||
The_grid->center.xyz.y = (float) m_y;
|
||||
The_grid->center.xyz.z = (float) m_z;
|
||||
|
||||
if (((CButton *) GetDlgItem(IDC_XY_PLANE)) -> GetCheck()) {
|
||||
The_grid->gmatrix.vec.fvec = vmd_x_vector;
|
||||
The_grid->gmatrix.vec.rvec = vmd_y_vector;
|
||||
|
||||
} else if (((CButton *) GetDlgItem(IDC_YZ_PLANE)) -> GetCheck()) {
|
||||
The_grid->gmatrix.vec.fvec = vmd_y_vector;
|
||||
The_grid->gmatrix.vec.rvec = vmd_z_vector;
|
||||
|
||||
} else { // XZ plane
|
||||
The_grid->gmatrix.vec.fvec = vmd_x_vector;
|
||||
The_grid->gmatrix.vec.rvec = vmd_z_vector;
|
||||
}
|
||||
|
||||
modify_grid(The_grid);
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void adjust_grid_dlg::OnXyPlane()
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_X)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SPIN_X)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_EDIT_Y)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SPIN_Y)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_EDIT_Z)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_SPIN_Z)->EnableWindow(TRUE);
|
||||
}
|
||||
|
||||
void adjust_grid_dlg::OnXzPlane()
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_X)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SPIN_X)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_EDIT_Y)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_SPIN_Y)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_EDIT_Z)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SPIN_Z)->EnableWindow(FALSE);
|
||||
}
|
||||
|
||||
void adjust_grid_dlg::OnYzPlane()
|
||||
{
|
||||
GetDlgItem(IDC_EDIT_X)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_SPIN_X)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_EDIT_Y)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SPIN_Y)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_EDIT_Z)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SPIN_Z)->EnableWindow(FALSE);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// adjust_grid_dlg dialog
|
||||
|
||||
class adjust_grid_dlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void OnOK();
|
||||
adjust_grid_dlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(adjust_grid_dlg)
|
||||
enum { IDD = IDD_ADJUST_GRID };
|
||||
CSpinButtonCtrl m_spinz;
|
||||
CSpinButtonCtrl m_spiny;
|
||||
CSpinButtonCtrl m_spinx;
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_z;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(adjust_grid_dlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(adjust_grid_dlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnXyPlane();
|
||||
afx_msg void OnXzPlane();
|
||||
afx_msg void OnYzPlane();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
@@ -1,679 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// AsteroidEditorDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "AsteroidEditorDlg.h"
|
||||
#include "starfield/starfield.h"
|
||||
#include "FREDDoc.h"
|
||||
#include "debris/debris.h" // Asteroid stuff.
|
||||
#include "species_defs/species_defs.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
#define ID_FIELD_MENU 9000
|
||||
|
||||
// helps in looping over combo boxes
|
||||
int Dlg_id[MAX_ACTIVE_DEBRIS_TYPES] = {IDC_SHIP_DEBRIS1, IDC_SHIP_DEBRIS2, IDC_SHIP_DEBRIS3};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// asteroid_editor dialog
|
||||
|
||||
asteroid_editor::asteroid_editor(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(asteroid_editor::IDD, pParent)
|
||||
{
|
||||
int i;
|
||||
|
||||
//{{AFX_DATA_INIT(asteroid_editor)
|
||||
m_avg_speed = 0;
|
||||
m_density = 0;
|
||||
m_enable_asteroids = FALSE;
|
||||
m_max_x = _T("");
|
||||
m_max_y = _T("");
|
||||
m_max_z = _T("");
|
||||
m_min_x = _T("");
|
||||
m_min_y = _T("");
|
||||
m_min_z = _T("");
|
||||
m_enable_inner_bounds = FALSE;
|
||||
m_field_type = FT_ACTIVE;
|
||||
m_box_max_x = _T("");
|
||||
m_box_max_y = _T("");
|
||||
m_box_max_z = _T("");
|
||||
m_box_min_x = _T("");
|
||||
m_box_min_y = _T("");
|
||||
m_box_min_z = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
last_field = -1;
|
||||
i=0;
|
||||
// for (i=0; i<MAX_ASTEROID_FIELDS; i++)
|
||||
a_field[i] = Asteroid_field; // Only supporting one field per mission.
|
||||
}
|
||||
|
||||
void asteroid_editor::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(asteroid_editor)
|
||||
DDX_Control(pDX, IDC_DENSITY_SPIN, m_density_spin);
|
||||
DDX_Text(pDX, IDC_AVG_SPEED, m_avg_speed);
|
||||
DDX_Text(pDX, IDC_DENSITY, m_density);
|
||||
DDX_Check(pDX, IDC_ENABLE_ASTEROIDS, m_enable_asteroids);
|
||||
DDX_Text(pDX, IDC_MAX_X, m_max_x);
|
||||
DDX_Text(pDX, IDC_MAX_Y, m_max_y);
|
||||
DDX_Text(pDX, IDC_MAX_Z, m_max_z);
|
||||
DDX_Text(pDX, IDC_MIN_X, m_min_x);
|
||||
DDX_Text(pDX, IDC_MIN_Y, m_min_y);
|
||||
DDX_Text(pDX, IDC_MIN_Z, m_min_z);
|
||||
DDX_Check(pDX, IDC_ENABLE_INNER_BOX, m_enable_inner_bounds);
|
||||
DDX_Text(pDX, IDC_INNER_MAX_X, m_box_max_x);
|
||||
DDX_Text(pDX, IDC_INNER_MAX_Y, m_box_max_y);
|
||||
DDX_Text(pDX, IDC_INNER_MAX_Z, m_box_max_z);
|
||||
DDX_Text(pDX, IDC_INNER_MIN_X, m_box_min_x);
|
||||
DDX_Text(pDX, IDC_INNER_MIN_Y, m_box_min_y);
|
||||
DDX_Text(pDX, IDC_INNER_MIN_Z, m_box_min_z);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(asteroid_editor, CDialog)
|
||||
//{{AFX_MSG_MAP(asteroid_editor)
|
||||
ON_WM_INITMENU()
|
||||
ON_BN_CLICKED(IDC_ENABLE_ASTEROIDS, OnEnableAsteroids)
|
||||
ON_WM_CLOSE()
|
||||
ON_BN_CLICKED(IDC_ENABLE_INNER_BOX, OnEnableInnerBox)
|
||||
ON_BN_CLICKED(IDC_PASSIVE_FIELD, OnPassiveField)
|
||||
ON_BN_CLICKED(IDC_FIELD_SHIP, OnFieldShip)
|
||||
ON_BN_CLICKED(IDC_ACTIVE_FIELD, OnActiveField)
|
||||
ON_BN_CLICKED(IDC_FIELD_ASTEROID, OnFieldAsteroid)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// asteroid_editor message handlers
|
||||
|
||||
void asteroid_editor::OnInitMenu(CMenu* pMenu)
|
||||
{
|
||||
int i;
|
||||
CString str;
|
||||
CMenu *m;
|
||||
|
||||
m = pMenu->GetSubMenu(0);
|
||||
clear_menu(m);
|
||||
i = 0; //for (i=0; i<MAX_ASTEROID_FIELDS; i++) {
|
||||
str.Format("Asteroid Field %d", i);
|
||||
m->AppendMenu(MF_ENABLED | MF_STRING, ID_FIELD_MENU + i, str);
|
||||
//}
|
||||
|
||||
m->DeleteMenu(ID_PLACEHOLDER, MF_BYCOMMAND);
|
||||
if (cur_field != -1)
|
||||
m->CheckMenuItem(ID_FIELD_MENU + cur_field, MF_BYCOMMAND | MF_CHECKED);
|
||||
|
||||
CDialog::OnInitMenu(pMenu);
|
||||
}
|
||||
|
||||
BOOL asteroid_editor::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int id;
|
||||
|
||||
id = LOWORD(wParam);
|
||||
if (id >= ID_FIELD_MENU && id < ID_FIELD_MENU + 1) { //MAX_ASTEROID_FIELDS) {
|
||||
cur_field = id - ID_FIELD_MENU;
|
||||
update_init();
|
||||
}
|
||||
|
||||
return CDialog::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
int asteroid_editor::query_modified()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<1 /*MAX_ASTEROID_FIELDS*/; i++) {
|
||||
if (a_field[i].num_initial_asteroids != Asteroid_field.num_initial_asteroids)
|
||||
return 1;
|
||||
if (vm_vec_dist_quick(&a_field[i].vel, &Asteroid_field.vel) == 0.0f)
|
||||
return 1;
|
||||
if (a_field[i].min_bound.xyz.x != Asteroid_field.min_bound.xyz.x)
|
||||
return 1;
|
||||
if (a_field[i].min_bound.xyz.y != Asteroid_field.min_bound.xyz.y)
|
||||
return 1;
|
||||
if (a_field[i].min_bound.xyz.z != Asteroid_field.min_bound.xyz.z)
|
||||
return 1;
|
||||
if (a_field[i].max_bound.xyz.x != Asteroid_field.max_bound.xyz.x)
|
||||
return 1;
|
||||
if (a_field[i].max_bound.xyz.y != Asteroid_field.max_bound.xyz.y)
|
||||
return 1;
|
||||
if (a_field[i].max_bound.xyz.z != Asteroid_field.max_bound.xyz.z)
|
||||
return 1;
|
||||
|
||||
|
||||
if (a_field[i].has_inner_bound != Asteroid_field.has_inner_bound)
|
||||
return 1;
|
||||
|
||||
if (a_field[i].field_type != Asteroid_field.field_type)
|
||||
return 1;
|
||||
|
||||
if (a_field[i].has_inner_bound) {
|
||||
if (a_field[i].inner_max_bound.xyz.x != Asteroid_field.inner_max_bound.xyz.x)
|
||||
return 1;
|
||||
|
||||
if (a_field[i].inner_max_bound.xyz.y != Asteroid_field.inner_max_bound.xyz.y)
|
||||
return 1;
|
||||
|
||||
if (a_field[i].inner_max_bound.xyz.z != Asteroid_field.inner_max_bound.xyz.z)
|
||||
return 1;
|
||||
|
||||
if (a_field[i].inner_min_bound.xyz.x != Asteroid_field.inner_min_bound.xyz.x)
|
||||
return 1;
|
||||
|
||||
if (a_field[i].inner_min_bound.xyz.y != Asteroid_field.inner_min_bound.xyz.y)
|
||||
return 1;
|
||||
|
||||
if (a_field[i].inner_min_bound.xyz.z != Asteroid_field.inner_min_bound.xyz.z)
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define MIN_BOX_THICKNESS 400
|
||||
int asteroid_editor::validate_data()
|
||||
{
|
||||
if (!m_enable_asteroids) {
|
||||
return 1;
|
||||
} else {
|
||||
// check x
|
||||
if (a_field[0].max_bound.xyz.x < a_field[0].min_bound.xyz.x) {
|
||||
MessageBox("Asteroid x min is greater than max");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check y
|
||||
if (a_field[0].max_bound.xyz.y < a_field[0].min_bound.xyz.y) {
|
||||
MessageBox("Asteroid y min is greater than max");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check z
|
||||
if (a_field[0].max_bound.xyz.z < a_field[0].min_bound.xyz.z) {
|
||||
MessageBox("Asteroid z min is greater than max");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check if inner bounds enabled
|
||||
if (a_field[0].has_inner_bound) {
|
||||
if (a_field[0].inner_max_bound.xyz.x < a_field[0].inner_min_bound.xyz.x) {
|
||||
MessageBox("Asteroid x inner min is greater than inner max");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a_field[0].inner_max_bound.xyz.y < a_field[0].inner_min_bound.xyz.y) {
|
||||
MessageBox("Asteroid y inner min is greater than inner max");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a_field[0].inner_max_bound.xyz.z < a_field[0].inner_min_bound.xyz.z) {
|
||||
MessageBox("Asteroid z inner min is greater than inner max");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check x thickness
|
||||
if (a_field[0].inner_min_bound.xyz.x - MIN_BOX_THICKNESS < a_field[0].min_bound.xyz.x) {
|
||||
MessageBox("Asteroid x thickness from outer box to inner box must be > 400");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a_field[0].inner_max_bound.xyz.x + MIN_BOX_THICKNESS > a_field[0].max_bound.xyz.x) {
|
||||
MessageBox("Asteroid x thickness from outer box to inner box must be > 400");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check y thickness
|
||||
if (a_field[0].inner_min_bound.xyz.y - MIN_BOX_THICKNESS < a_field[0].min_bound.xyz.y) {
|
||||
MessageBox("Asteroid y thickness from outer box to inner box must be > 400");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a_field[0].inner_max_bound.xyz.y + MIN_BOX_THICKNESS > a_field[0].max_bound.xyz.y) {
|
||||
MessageBox("Asteroid y thickness from outer box to inner box must be > 400");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// check z thickness
|
||||
if (a_field[0].inner_min_bound.xyz.z - MIN_BOX_THICKNESS < a_field[0].min_bound.xyz.z) {
|
||||
MessageBox("Asteroid z thickness from outer box to inner box must be > 400");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a_field[0].inner_max_bound.xyz.z + MIN_BOX_THICKNESS > a_field[0].max_bound.xyz.z) {
|
||||
MessageBox("Asteroid z thickness from outer box to inner box must be > 400");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// check if passive, ship debris field, at least one speceis selected
|
||||
if (a_field[0].field_type == FT_PASSIVE) {
|
||||
if (a_field[0].debris_genre == DG_SHIP) {
|
||||
if ( (a_field[0].field_debris_type[0] == -1) && (a_field[0].field_debris_type[1] == -1) && (a_field[0].field_debris_type[2] == -1) ) {
|
||||
MessageBox("You must choose one or more types of ship debris");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check at least one asteroid subtype is selected
|
||||
if (a_field[0].debris_genre == DG_ASTEROID) {
|
||||
if ( (a_field[0].field_debris_type[0] == -1) && (a_field[0].field_debris_type[1] == -1) && (a_field[0].field_debris_type[2] == -1) ) {
|
||||
MessageBox("You must choose one or more asteroid subtypes");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void asteroid_editor::OnOK()
|
||||
{
|
||||
int i;
|
||||
|
||||
update_init();
|
||||
if (!validate_data()) {
|
||||
return;
|
||||
}
|
||||
for (i=0; i<1 /*MAX_ASTEROID_FIELDS*/; i++)
|
||||
Asteroid_field = a_field[i];
|
||||
|
||||
update_map_window();
|
||||
theApp.record_window_data(&Asteroid_wnd_data, this);
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
BOOL asteroid_editor::OnInitDialog()
|
||||
{
|
||||
|
||||
|
||||
cur_field = 0;
|
||||
CDialog::OnInitDialog();
|
||||
update_init();
|
||||
theApp.init_window(&Asteroid_wnd_data, this);
|
||||
|
||||
m_density_spin.SetRange(1, MAX_ASTEROIDS);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void asteroid_editor::update_init()
|
||||
{
|
||||
int num_asteroids, idx, cur_choice;
|
||||
|
||||
UpdateData(TRUE);
|
||||
if (last_field >= 0) {
|
||||
// store into temp asteroid field
|
||||
num_asteroids = a_field[last_field].num_initial_asteroids;
|
||||
a_field[last_field].num_initial_asteroids = m_enable_asteroids ? m_density : 0;
|
||||
if (a_field[last_field].num_initial_asteroids < 0)
|
||||
a_field[last_field].num_initial_asteroids = 0;
|
||||
|
||||
if (a_field[last_field].num_initial_asteroids > MAX_ASTEROIDS)
|
||||
a_field[last_field].num_initial_asteroids = MAX_ASTEROIDS;
|
||||
|
||||
if (num_asteroids != a_field[last_field].num_initial_asteroids)
|
||||
set_modified();
|
||||
|
||||
vec3d vel_vec = {1.0f, 0.0f, 0.0f};
|
||||
vm_vec_scale(&vel_vec, (float) m_avg_speed);
|
||||
|
||||
MODIFY(a_field[last_field].vel.xyz.x, vel_vec.xyz.x);
|
||||
MODIFY(a_field[last_field].vel.xyz.y, vel_vec.xyz.y);
|
||||
MODIFY(a_field[last_field].vel.xyz.z, vel_vec.xyz.z);
|
||||
|
||||
MODIFY(a_field[last_field].min_bound.xyz.x, (float) atof(m_min_x));
|
||||
MODIFY(a_field[last_field].min_bound.xyz.y, (float) atof(m_min_y));
|
||||
MODIFY(a_field[last_field].min_bound.xyz.z, (float) atof(m_min_z));
|
||||
MODIFY(a_field[last_field].max_bound.xyz.x, (float) atof(m_max_x));
|
||||
MODIFY(a_field[last_field].max_bound.xyz.y, (float) atof(m_max_y));
|
||||
MODIFY(a_field[last_field].max_bound.xyz.z, (float) atof(m_max_z));
|
||||
|
||||
// type of field
|
||||
MODIFY(a_field[last_field].field_type, m_field_type);
|
||||
MODIFY(a_field[last_field].debris_genre, m_debris_genre);
|
||||
if ( (m_field_type == FT_PASSIVE) && (m_debris_genre == DG_SHIP) ) {
|
||||
// we should have ship debris
|
||||
for (idx=0; idx<MAX_ACTIVE_DEBRIS_TYPES; idx++) {
|
||||
// loop over combo boxes, store the item data of the cur selection, -1 in no cur selection
|
||||
int cur_sel = ((CComboBox*)GetDlgItem(Dlg_id[idx]))->GetCurSel();
|
||||
if (cur_sel != CB_ERR) {
|
||||
cur_choice = ((CComboBox*)GetDlgItem(Dlg_id[idx]))->GetItemData(cur_sel);
|
||||
} else {
|
||||
cur_choice = -1;
|
||||
}
|
||||
MODIFY(a_field[cur_field].field_debris_type[idx], cur_choice);
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_debris_genre == DG_ASTEROID ) {
|
||||
if ( ((CButton *)GetDlgItem(IDC_SUBTYPE1))->GetCheck() == 1) {
|
||||
cur_choice = 1;
|
||||
} else {
|
||||
cur_choice = -1;
|
||||
}
|
||||
MODIFY(a_field[cur_field].field_debris_type[0], cur_choice);
|
||||
|
||||
|
||||
if ( ((CButton *)GetDlgItem(IDC_SUBTYPE2))->GetCheck() == 1) {
|
||||
cur_choice = 1;
|
||||
} else {
|
||||
cur_choice = -1;
|
||||
}
|
||||
MODIFY(a_field[cur_field].field_debris_type[1], cur_choice);
|
||||
|
||||
|
||||
if ( ((CButton *)GetDlgItem(IDC_SUBTYPE3))->GetCheck() == 1) {
|
||||
cur_choice = 1;
|
||||
} else {
|
||||
cur_choice = -1;
|
||||
}
|
||||
MODIFY(a_field[cur_field].field_debris_type[2], cur_choice);
|
||||
}
|
||||
|
||||
MODIFY(a_field[last_field].has_inner_bound, m_enable_inner_bounds);
|
||||
|
||||
MODIFY(a_field[last_field].inner_min_bound.xyz.x, (float) atof(m_box_min_x));
|
||||
MODIFY(a_field[last_field].inner_min_bound.xyz.y, (float) atof(m_box_min_y));
|
||||
MODIFY(a_field[last_field].inner_min_bound.xyz.z, (float) atof(m_box_min_z));
|
||||
MODIFY(a_field[last_field].inner_max_bound.xyz.x, (float) atof(m_box_max_x));
|
||||
MODIFY(a_field[last_field].inner_max_bound.xyz.y, (float) atof(m_box_max_y));
|
||||
MODIFY(a_field[last_field].inner_max_bound.xyz.z, (float) atof(m_box_max_z));
|
||||
}
|
||||
|
||||
Assert(cur_field >= 0);
|
||||
// get from temp asteroid field into class
|
||||
m_enable_asteroids = a_field[cur_field].num_initial_asteroids ? TRUE : FALSE;
|
||||
m_enable_inner_bounds = a_field[cur_field].has_inner_bound ? TRUE : FALSE;
|
||||
m_density = a_field[cur_field].num_initial_asteroids;
|
||||
if (!m_enable_asteroids)
|
||||
m_density = 10;
|
||||
|
||||
// set field type
|
||||
m_field_type = a_field[cur_field].field_type;
|
||||
m_debris_genre = a_field[cur_field].debris_genre;
|
||||
// m_debris_species = a_field[cur_field].debris_species;
|
||||
|
||||
m_avg_speed = (int) vm_vec_mag(&a_field[cur_field].vel);
|
||||
m_min_x.Format("%.1f", a_field[cur_field].min_bound.xyz.x);
|
||||
m_min_y.Format("%.1f", a_field[cur_field].min_bound.xyz.y);
|
||||
m_min_z.Format("%.1f", a_field[cur_field].min_bound.xyz.z);
|
||||
m_max_x.Format("%.1f", a_field[cur_field].max_bound.xyz.x);
|
||||
m_max_y.Format("%.1f", a_field[cur_field].max_bound.xyz.y);
|
||||
m_max_z.Format("%.1f", a_field[cur_field].max_bound.xyz.z);
|
||||
|
||||
m_box_min_x.Format("%.1f", a_field[cur_field].inner_min_bound.xyz.x);
|
||||
m_box_min_y.Format("%.1f", a_field[cur_field].inner_min_bound.xyz.y);
|
||||
m_box_min_z.Format("%.1f", a_field[cur_field].inner_min_bound.xyz.z);
|
||||
m_box_max_x.Format("%.1f", a_field[cur_field].inner_max_bound.xyz.x);
|
||||
m_box_max_y.Format("%.1f", a_field[cur_field].inner_max_bound.xyz.y);
|
||||
m_box_max_z.Format("%.1f", a_field[cur_field].inner_max_bound.xyz.z);
|
||||
|
||||
// set up combo boxes
|
||||
uint i;
|
||||
int j, k, index, box_index;
|
||||
|
||||
// add "None" to each box
|
||||
for (k = 0; k < MAX_ACTIVE_DEBRIS_TYPES; k++)
|
||||
{
|
||||
box_index = ((CComboBox*)GetDlgItem(Dlg_id[k]))->AddString("None");
|
||||
((CComboBox*)GetDlgItem(Dlg_id[k]))->SetItemData(box_index, -1);
|
||||
}
|
||||
|
||||
// now add each kind of debris to each box
|
||||
CString name;
|
||||
char *debris_size[NUM_DEBRIS_SIZES] = { "Small", "Medium", "Large" };
|
||||
|
||||
// each species
|
||||
for (i = 0; i < Species_info.size(); i++)
|
||||
{
|
||||
// each size
|
||||
for (j = 0; j < NUM_DEBRIS_SIZES; j++)
|
||||
{
|
||||
name = CString(Species_info[i].species_name) + " " + debris_size[j];
|
||||
index = NUM_DEBRIS_SIZES + ((i * NUM_DEBRIS_SIZES) + j);
|
||||
|
||||
// each box
|
||||
for (k = 0; k < MAX_ACTIVE_DEBRIS_TYPES; k++)
|
||||
{
|
||||
box_index = ((CComboBox*)GetDlgItem(Dlg_id[k]))->AddString(name);
|
||||
((CComboBox*)GetDlgItem(Dlg_id[k]))->SetItemData(box_index, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set active debris type for each combo box
|
||||
int box_count, cur_box_data;
|
||||
for (idx=0;idx<MAX_ACTIVE_DEBRIS_TYPES; idx++) {
|
||||
// Only set selection if not "None"
|
||||
if (a_field[cur_field].field_debris_type[idx] != -1) {
|
||||
box_count = ((CComboBox*)GetDlgItem(Dlg_id[idx]))->GetCount();
|
||||
for (box_index=0; box_index<box_count; box_index++) {
|
||||
cur_box_data = ((CComboBox*)GetDlgItem(Dlg_id[idx]))->GetItemData(box_index);
|
||||
if (cur_box_data == a_field[cur_field].field_debris_type[idx]) {
|
||||
// set cur sel
|
||||
((CComboBox*)GetDlgItem(Dlg_id[idx]))->SetCurSel(box_index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set up asteroid subtype checkboxes
|
||||
((CButton*)GetDlgItem(IDC_SUBTYPE1))->SetCheck(a_field[cur_field].field_debris_type[0] == 1);
|
||||
((CButton*)GetDlgItem(IDC_SUBTYPE2))->SetCheck(a_field[cur_field].field_debris_type[1] == 1);
|
||||
((CButton*)GetDlgItem(IDC_SUBTYPE3))->SetCheck(a_field[cur_field].field_debris_type[2] == 1);
|
||||
|
||||
|
||||
UpdateData(FALSE);
|
||||
OnEnableAsteroids();
|
||||
|
||||
last_field = cur_field;
|
||||
}
|
||||
|
||||
void asteroid_editor::OnEnableAsteroids()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
GetDlgItem(IDC_DENSITY)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_DENSITY_SPIN)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_AVG_SPEED)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_MIN_X)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_MIN_Y)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_MIN_Z)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_MAX_X)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_MAX_Y)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_MAX_Z)->EnableWindow(m_enable_asteroids);
|
||||
|
||||
GetDlgItem(IDC_ENABLE_INNER_BOX)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_PASSIVE_FIELD)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_ACTIVE_FIELD)->EnableWindow(m_enable_asteroids);
|
||||
|
||||
GetDlgItem(IDC_FIELD_SHIP)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_FIELD_ASTEROID)->EnableWindow(m_enable_asteroids);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS1)->EnableWindow(m_enable_asteroids && (Asteroid_field.debris_genre == DG_SHIP));
|
||||
GetDlgItem(IDC_SHIP_DEBRIS2)->EnableWindow(m_enable_asteroids && (Asteroid_field.debris_genre == DG_SHIP));
|
||||
GetDlgItem(IDC_SHIP_DEBRIS3)->EnableWindow(m_enable_asteroids && (Asteroid_field.debris_genre == DG_SHIP));
|
||||
GetDlgItem(IDC_SUBTYPE1)->EnableWindow(m_enable_asteroids && (Asteroid_field.debris_genre == DG_ASTEROID));
|
||||
GetDlgItem(IDC_SUBTYPE2)->EnableWindow(m_enable_asteroids && (Asteroid_field.debris_genre == DG_ASTEROID));
|
||||
GetDlgItem(IDC_SUBTYPE3)->EnableWindow(m_enable_asteroids && (Asteroid_field.debris_genre == DG_ASTEROID));
|
||||
|
||||
OnEnableInnerBox();
|
||||
OnEnableField();
|
||||
}
|
||||
|
||||
void asteroid_editor::OnCancel()
|
||||
{
|
||||
theApp.record_window_data(&Asteroid_wnd_data, this);
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
void asteroid_editor::OnClose()
|
||||
{
|
||||
int z;
|
||||
|
||||
update_init();
|
||||
if (query_modified()) {
|
||||
z = MessageBox("Do you want to keep your changes?", "Close", MB_ICONQUESTION | MB_YESNOCANCEL);
|
||||
if (z == IDCANCEL)
|
||||
return;
|
||||
|
||||
if (z == IDYES) {
|
||||
OnOK();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CDialog::OnClose();
|
||||
}
|
||||
|
||||
// enable inner box (asteroid free zone)
|
||||
// only allowed for active debris field
|
||||
void asteroid_editor::OnEnableInnerBox()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
|
||||
GetDlgItem(IDC_INNER_MIN_X)->EnableWindow(m_enable_inner_bounds && m_enable_asteroids);
|
||||
GetDlgItem(IDC_INNER_MAX_X)->EnableWindow(m_enable_inner_bounds && m_enable_asteroids);
|
||||
GetDlgItem(IDC_INNER_MIN_Y)->EnableWindow(m_enable_inner_bounds && m_enable_asteroids);
|
||||
GetDlgItem(IDC_INNER_MAX_Y)->EnableWindow(m_enable_inner_bounds && m_enable_asteroids);
|
||||
GetDlgItem(IDC_INNER_MIN_Z)->EnableWindow(m_enable_inner_bounds && m_enable_asteroids);
|
||||
GetDlgItem(IDC_INNER_MAX_Z)->EnableWindow(m_enable_inner_bounds && m_enable_asteroids);
|
||||
}
|
||||
|
||||
//
|
||||
void asteroid_editor::OnEnableField()
|
||||
{
|
||||
// set check in active
|
||||
if (m_enable_asteroids) {
|
||||
if (m_field_type == FT_ACTIVE) {
|
||||
OnActiveField();
|
||||
} else {
|
||||
OnPassiveField();
|
||||
}
|
||||
}
|
||||
|
||||
// maybe enable species
|
||||
if ( m_enable_asteroids && (m_field_type == FT_PASSIVE) && (m_debris_genre == DG_SHIP) ) {
|
||||
OnFieldShip();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void asteroid_editor::OnActiveField()
|
||||
{
|
||||
// set field type
|
||||
m_field_type = FT_ACTIVE;
|
||||
m_debris_genre = DG_ASTEROID;
|
||||
|
||||
// gray out ship and species
|
||||
GetDlgItem(IDC_FIELD_SHIP)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS1)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS2)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS3)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SUBTYPE1)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_SUBTYPE2)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_SUBTYPE3)->EnableWindow(TRUE);
|
||||
|
||||
// force check of asteroid
|
||||
((CButton*)GetDlgItem(IDC_FIELD_ASTEROID))->SetCheck(1);
|
||||
((CButton*)GetDlgItem(IDC_FIELD_SHIP))->SetCheck(0);
|
||||
|
||||
// force check of active field
|
||||
((CButton*)GetDlgItem(IDC_ACTIVE_FIELD))->SetCheck(1);
|
||||
((CButton*)GetDlgItem(IDC_PASSIVE_FIELD))->SetCheck(0);
|
||||
|
||||
// enable inner box
|
||||
GetDlgItem(IDC_ENABLE_INNER_BOX)->EnableWindow(TRUE);
|
||||
}
|
||||
|
||||
void asteroid_editor::OnPassiveField()
|
||||
{
|
||||
// set field type
|
||||
m_field_type = FT_PASSIVE;
|
||||
|
||||
// acivate ship
|
||||
GetDlgItem(IDC_FIELD_SHIP)->EnableWindow(TRUE);
|
||||
|
||||
// maybe activate species
|
||||
GetDlgItem(IDC_SHIP_DEBRIS1)->EnableWindow(m_debris_genre == DG_SHIP);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS2)->EnableWindow(m_debris_genre == DG_SHIP);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS3)->EnableWindow(m_debris_genre == DG_SHIP);
|
||||
|
||||
// maybe activate asteroid subtype
|
||||
GetDlgItem(IDC_SUBTYPE1)->EnableWindow(m_debris_genre == DG_ASTEROID);
|
||||
GetDlgItem(IDC_SUBTYPE2)->EnableWindow(m_debris_genre == DG_ASTEROID);
|
||||
GetDlgItem(IDC_SUBTYPE3)->EnableWindow(m_debris_genre == DG_ASTEROID);
|
||||
|
||||
|
||||
// force check of current debris type
|
||||
((CButton*)GetDlgItem(IDC_FIELD_ASTEROID))->SetCheck(m_debris_genre == DG_ASTEROID);
|
||||
((CButton*)GetDlgItem(IDC_FIELD_SHIP))->SetCheck(m_debris_genre == DG_SHIP);
|
||||
|
||||
// force check of passive field
|
||||
((CButton*)GetDlgItem(IDC_ACTIVE_FIELD))->SetCheck(0);
|
||||
((CButton*)GetDlgItem(IDC_PASSIVE_FIELD))->SetCheck(1);
|
||||
|
||||
// disable inner box
|
||||
GetDlgItem(IDC_ENABLE_INNER_BOX)->EnableWindow(FALSE);
|
||||
}
|
||||
|
||||
void asteroid_editor::OnFieldShip()
|
||||
{
|
||||
// set debris type
|
||||
m_debris_genre = DG_SHIP;
|
||||
|
||||
GetDlgItem(IDC_SHIP_DEBRIS1)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS2)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS3)->EnableWindow(TRUE);
|
||||
|
||||
GetDlgItem(IDC_SUBTYPE1)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SUBTYPE2)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SUBTYPE3)->EnableWindow(FALSE);
|
||||
|
||||
// force check of ship
|
||||
((CButton*)GetDlgItem(IDC_FIELD_ASTEROID))->SetCheck(0);
|
||||
((CButton*)GetDlgItem(IDC_FIELD_SHIP))->SetCheck(1);
|
||||
|
||||
}
|
||||
|
||||
void asteroid_editor::OnFieldAsteroid()
|
||||
{
|
||||
// set debris type
|
||||
m_debris_genre = DG_ASTEROID;
|
||||
|
||||
GetDlgItem(IDC_SHIP_DEBRIS1)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS2)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_SHIP_DEBRIS3)->EnableWindow(FALSE);
|
||||
|
||||
|
||||
GetDlgItem(IDC_SUBTYPE1)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_SUBTYPE2)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_SUBTYPE3)->EnableWindow(TRUE);
|
||||
|
||||
// force check of asteroid
|
||||
((CButton*)GetDlgItem(IDC_FIELD_ASTEROID))->SetCheck(1);
|
||||
((CButton*)GetDlgItem(IDC_FIELD_SHIP))->SetCheck(0);
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// AsteroidEditorDlg.h : header file
|
||||
//
|
||||
|
||||
#include "starfield/starfield.h"
|
||||
#include "asteroid/asteroid.h"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// asteroid_editor dialog
|
||||
|
||||
class asteroid_editor : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void update_init();
|
||||
int query_modified();
|
||||
void OnCancel();
|
||||
void OnOK();
|
||||
void OnEnableField();
|
||||
int validate_data();
|
||||
|
||||
asteroid_editor(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(asteroid_editor)
|
||||
enum { IDD = IDD_ASTEROID_EDITOR };
|
||||
CSpinButtonCtrl m_density_spin;
|
||||
int m_avg_speed;
|
||||
int m_density;
|
||||
BOOL m_enable_asteroids;
|
||||
CString m_max_x;
|
||||
CString m_max_y;
|
||||
CString m_max_z;
|
||||
CString m_min_x;
|
||||
CString m_min_y;
|
||||
CString m_min_z;
|
||||
BOOL m_enable_inner_bounds;
|
||||
field_type_t m_field_type; // active or passive
|
||||
debris_genre_t m_debris_genre; // ship or asteroid
|
||||
int m_field_debris_type[3]; // species and size of ship debris
|
||||
CString m_box_max_x;
|
||||
CString m_box_max_y;
|
||||
CString m_box_max_z;
|
||||
CString m_box_min_x;
|
||||
CString m_box_min_y;
|
||||
CString m_box_min_z;
|
||||
//}}AFX_DATA
|
||||
|
||||
int cur_field, last_field;
|
||||
asteroid_field a_field[1 /*MAX_ASTEROID_FIELDS*/];
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(asteroid_editor)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(asteroid_editor)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnInitMenu(CMenu* pMenu);
|
||||
afx_msg void OnEnableAsteroids();
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnEnableInnerBox();
|
||||
afx_msg void OnPassiveField();
|
||||
afx_msg void OnFieldShip();
|
||||
afx_msg void OnActiveField();
|
||||
afx_msg void OnFieldAsteroid();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
@@ -1,87 +0,0 @@
|
||||
// BackgroundChooser.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "fred.h"
|
||||
#include "BackgroundChooser.h"
|
||||
#include "ship/ship.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// BackgroundChooser dialog
|
||||
|
||||
|
||||
BackgroundChooser::BackgroundChooser(int numBackgrounds)
|
||||
: CDialog(BackgroundChooser::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(BackgroundChooser)
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
m_numBackgrounds = numBackgrounds;
|
||||
m_chosenBackground = -1;
|
||||
}
|
||||
|
||||
|
||||
void BackgroundChooser::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(BackgroundChooser)
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(BackgroundChooser, CDialog)
|
||||
//{{AFX_MSG_MAP(BackgroundChooser)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// BackgroundChooser message handlers
|
||||
|
||||
BOOL BackgroundChooser::OnInitDialog()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < m_numBackgrounds; i++)
|
||||
{
|
||||
char temp[NAME_LENGTH];
|
||||
sprintf(temp, "Background %d", i + 1);
|
||||
|
||||
((CComboBox*) GetDlgItem(IDC_BACKGROUND))->AddString(temp);
|
||||
}
|
||||
((CComboBox*) GetDlgItem(IDC_BACKGROUND))->SetCurSel(0);
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
UpdateData(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void BackgroundChooser::OnOK()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
|
||||
m_chosenBackground = ((CComboBox*) GetDlgItem(IDC_BACKGROUND))->GetCurSel();
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void BackgroundChooser::OnCancel()
|
||||
{
|
||||
// TODO: Add extra cleanup here
|
||||
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
void BackgroundChooser::OnClose()
|
||||
{
|
||||
OnCancel();
|
||||
}
|
||||
|
||||
int BackgroundChooser::GetChosenBackground()
|
||||
{
|
||||
return m_chosenBackground;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
#if !defined(_BACKGROUND_CHOOSER_H_)
|
||||
#define _BACKGROUND_CHOOSER_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// BackgroundChooser.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// BackgroundChooser dialog
|
||||
|
||||
class BackgroundChooser : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
BackgroundChooser(int numBackgrounds); // standard constructor
|
||||
void OnOK();
|
||||
void OnCancel();
|
||||
|
||||
int GetChosenBackground();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(BackgroundChooser)
|
||||
enum { IDD = IDD_BACKGROUND_CHOOSER};
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(BackgroundChooser)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
int m_numBackgrounds;
|
||||
int m_chosenBackground;
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(BackgroundChooser)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnClose();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(_BACKGROUND_CHOOSER_H_)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* 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 _BG_BITMAP_DLG_H
|
||||
#define _BG_BITMAP_DLG_H
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// bg_bitmap_dlg dialog
|
||||
|
||||
class bg_bitmap_dlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void update_data(int update = 1);
|
||||
void create();
|
||||
|
||||
// sun data functions
|
||||
void sun_data_init();
|
||||
void sun_data_close();
|
||||
void sun_data_save_current();
|
||||
|
||||
// bitmap data functions
|
||||
void bitmap_data_init();
|
||||
void bitmap_data_close();
|
||||
void bitmap_data_save_current();
|
||||
|
||||
void get_data_spinner(NM_UPDOWN* pUD, int id, int *var, int min, int max);
|
||||
void get_data_int(int id, int *var, int min, int max);
|
||||
void get_data_float(int id, float *var, float max, float min);
|
||||
|
||||
bg_bitmap_dlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(bg_bitmap_dlg)
|
||||
enum { IDD = IDD_BG_BITMAP };
|
||||
CSliderCtrl m_amb_blue;
|
||||
CSliderCtrl m_amb_green;
|
||||
CSliderCtrl m_amb_red;
|
||||
CString m_neb_intensity;
|
||||
int m_nebula_color;
|
||||
int m_nebula_index;
|
||||
int m_bank;
|
||||
int m_heading;
|
||||
int m_pitch;
|
||||
CSliderCtrl m_slider;
|
||||
int m_neb2_texture;
|
||||
BOOL m_subspace;
|
||||
BOOL m_fullneb;
|
||||
int m_poof_0;
|
||||
int m_poof_1;
|
||||
int m_poof_2;
|
||||
int m_poof_3;
|
||||
int m_poof_4;
|
||||
int m_poof_5;
|
||||
BOOL m_toggle_trails;
|
||||
CString m_storm_name;
|
||||
CString s_name;
|
||||
int s_pitch;
|
||||
int s_bank;
|
||||
int s_heading;
|
||||
float s_scale;
|
||||
int s_index;
|
||||
CString b_name;
|
||||
int b_pitch;
|
||||
int b_bank;
|
||||
int b_heading;
|
||||
float b_scale_x;
|
||||
float b_scale_y;
|
||||
int b_div_x;
|
||||
int b_div_y;
|
||||
int b_index;
|
||||
int m_sky_flag_1;
|
||||
int m_sky_flag_2;
|
||||
int m_sky_flag_3;
|
||||
int m_sky_flag_4;
|
||||
int m_sky_flag_5;
|
||||
int m_sky_flag_6;
|
||||
CString m_skybox_model;
|
||||
CString m_envmap;
|
||||
float m_neb_near_multi;
|
||||
float m_neb_far_multi;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(bg_bitmap_dlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
// clear and build the nebula filename list appropriately
|
||||
void build_nebfile_list();
|
||||
|
||||
int get_active_background();
|
||||
int get_swap_background();
|
||||
void reinitialize_lists();
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(bg_bitmap_dlg)
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnCancel();
|
||||
afx_msg void OnOK();
|
||||
afx_msg void OnSelchangeNebcolor();
|
||||
afx_msg void OnSelchangeNebpattern();
|
||||
afx_msg void OnFullNeb();
|
||||
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
|
||||
afx_msg void OnSunChange();
|
||||
afx_msg void OnAddSun();
|
||||
afx_msg void OnDelSun();
|
||||
afx_msg void OnSunDropdownChange();
|
||||
afx_msg void OnBitmapChange();
|
||||
afx_msg void OnAddBitmap();
|
||||
afx_msg void OnDelBitmap();
|
||||
afx_msg void OnBitmapDropdownChange();
|
||||
afx_msg void OnDeltaposSbitmapPSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnDeltaposSbitmapBSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnDeltaposSbitmapHSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnKillfocusSbitmapScaleX();
|
||||
afx_msg void OnKillfocusSbitmapScaleY();
|
||||
afx_msg void OnKillfocusSbitmapDivX();
|
||||
afx_msg void OnKillfocusSbitmapDivY();
|
||||
afx_msg void OnKillfocusSbitmapP();
|
||||
afx_msg void OnKillfocusSbitmapB();
|
||||
afx_msg void OnKillfocusSbitmapH();
|
||||
afx_msg void OnDeltaposSun1PSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnDeltaposSun1HSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnDeltaposSun1BSpin(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnKillfocusSun1P();
|
||||
afx_msg void OnKillfocusSun1H();
|
||||
afx_msg void OnKillfocusSun1B();
|
||||
afx_msg void OnKillfocusSun1Scale();
|
||||
afx_msg void OnImportBackground();
|
||||
afx_msg void OnSwapBackground();
|
||||
afx_msg void OnBackgroundDropdownChange();
|
||||
afx_msg void OnSkyboxBrowse();
|
||||
afx_msg void OnEnvmapBrowse();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* 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 __BRIEFINGEDITORDLG_H__
|
||||
#define __BRIEFINGEDITORDLG_H__
|
||||
|
||||
#include "parse/sexp.h"
|
||||
#include "mission/missionbriefcommon.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// briefing_editor_dlg dialog
|
||||
|
||||
class briefing_editor_dlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void focus_sexp(int select_sexp_node);
|
||||
int calc_num_lines_for_icons(int num);
|
||||
void batch_render();
|
||||
void save_editor_state();
|
||||
void restore_editor_state();
|
||||
void reset_icon_loop(int stage);
|
||||
int get_next_icon(int id);
|
||||
void OnOK();
|
||||
void OnCancel();
|
||||
int find_icon(int id, int stage);
|
||||
void propagate_icon(int num);
|
||||
void reset_editor();
|
||||
int check_mouse_hit(int x, int y);
|
||||
void delete_icon(int num);
|
||||
void update_positions();
|
||||
void icon_select(int num);
|
||||
void draw_icon(object *objp);
|
||||
void create();
|
||||
void update_data(int update = 1);
|
||||
briefing_editor_dlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(briefing_editor_dlg)
|
||||
enum { IDD = IDD_BRIEFING_EDITOR };
|
||||
sexp_tree m_tree;
|
||||
CButton m_lines;
|
||||
BOOL m_hilight;
|
||||
int m_icon_image;
|
||||
CString m_icon_label;
|
||||
CString m_stage_title;
|
||||
CString m_text;
|
||||
CString m_time;
|
||||
CString m_voice;
|
||||
CString m_icon_text;
|
||||
int m_icon_team;
|
||||
int m_ship_type;
|
||||
BOOL m_change_local;
|
||||
int m_id;
|
||||
int m_briefing_music;
|
||||
CString m_substitute_briefing_music;
|
||||
BOOL m_cut_next;
|
||||
BOOL m_cut_prev;
|
||||
int m_current_briefing;
|
||||
BOOL m_flipicon;
|
||||
//}}AFX_DATA
|
||||
|
||||
CBitmap m_play_bm;
|
||||
|
||||
// copy view variables
|
||||
int m_copy_view_set;
|
||||
vec3d m_copy_view_pos;
|
||||
matrix m_copy_view_orient;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(briefing_editor_dlg)
|
||||
public:
|
||||
virtual BOOL DestroyWindow();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
brief_icon *iconp;
|
||||
briefing *save_briefing;
|
||||
int icon_loop, stage_loop;
|
||||
int m_cur_stage;
|
||||
int m_last_stage;
|
||||
int m_cur_icon;
|
||||
int m_last_icon;
|
||||
int m_voice_id;
|
||||
int stage_saved;
|
||||
int icon_saved;
|
||||
int modified;
|
||||
// int point_obj;
|
||||
int icon_obj[MAX_STAGE_ICONS];
|
||||
int icon_marked[MAX_STAGE_ICONS];
|
||||
int line_marked[MAX_BRIEF_STAGE_LINES];
|
||||
|
||||
void copy_stage(int from, int to);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(briefing_editor_dlg)
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnNext();
|
||||
afx_msg void OnPrev();
|
||||
afx_msg void OnBrowse();
|
||||
afx_msg void OnAddStage();
|
||||
afx_msg void OnDeleteStage();
|
||||
afx_msg void OnInsertStage();
|
||||
afx_msg void OnMakeIcon();
|
||||
afx_msg void OnDeleteIcon();
|
||||
afx_msg void OnGotoView();
|
||||
afx_msg void OnSaveView();
|
||||
afx_msg void OnSelchangeIconImage();
|
||||
afx_msg void OnSelchangeTeam();
|
||||
afx_msg void OnPropagateIcons();
|
||||
afx_msg void OnInitMenu(CMenu* pMenu);
|
||||
afx_msg void OnLines();
|
||||
afx_msg void OnRclickTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnBeginlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnEndlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnPlay();
|
||||
afx_msg void OnCopyView();
|
||||
afx_msg void OnPasteView();
|
||||
afx_msg void OnFlipIcon();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,901 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// CampaignEditorDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include <setjmp.h>
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "CampaignEditorDlg.h"
|
||||
#include "CampaignTreeView.h"
|
||||
#include "CampaignTreeWnd.h"
|
||||
#include "Management.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "FREDDoc.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "mission/missiongoals.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
int Cur_campaign_mission = -1;
|
||||
int Cur_campaign_link = -1;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_editor dialog
|
||||
|
||||
IMPLEMENT_DYNCREATE(campaign_editor, CFormView)
|
||||
|
||||
campaign_editor *Campaign_tree_formp;
|
||||
|
||||
campaign_editor::campaign_editor()
|
||||
: CFormView(campaign_editor::IDD)
|
||||
{
|
||||
//{{AFX_DATA_INIT(campaign_editor)
|
||||
m_name = _T("");
|
||||
m_type = -1;
|
||||
m_num_players = _T("");
|
||||
m_desc = _T("");
|
||||
m_branch_desc = _T("");
|
||||
m_branch_brief_anim = _T("");
|
||||
m_branch_brief_sound = _T("");
|
||||
m_custom_tech_db = FALSE;
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
m_tree.m_mode = MODE_CAMPAIGN;
|
||||
m_num_links = 0;
|
||||
m_tree.link_modified(&Campaign_modified);
|
||||
m_last_mission = -1;
|
||||
}
|
||||
|
||||
campaign_editor::~campaign_editor()
|
||||
{
|
||||
}
|
||||
|
||||
void campaign_editor::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CFormView::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(campaign_editor)
|
||||
DDX_Control(pDX, IDC_SEXP_TREE, m_tree);
|
||||
DDX_Control(pDX, IDC_FILELIST, m_filelist);
|
||||
DDX_Text(pDX, IDC_NAME, m_name);
|
||||
DDX_CBIndex(pDX, IDC_CAMPAIGN_TYPE, m_type);
|
||||
DDX_Text(pDX, IDC_NUM_PLAYERS, m_num_players);
|
||||
DDX_Text(pDX, IDC_DESC2, m_desc);
|
||||
DDX_Text(pDX, IDC_MISSISON_LOOP_DESC, m_branch_desc);
|
||||
DDX_Text(pDX, IDC_LOOP_BRIEF_ANIM, m_branch_brief_anim);
|
||||
DDX_Text(pDX, IDC_LOOP_BRIEF_SOUND, m_branch_brief_sound);
|
||||
DDX_Check(pDX, IDC_CUSTOM_TECH_DB, m_custom_tech_db);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
DDV_MaxChars(pDX, m_desc, MISSION_DESC_LENGTH - 1);
|
||||
DDV_MaxChars(pDX, m_branch_desc, MISSION_DESC_LENGTH - 1);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(campaign_editor, CFormView)
|
||||
//{{AFX_MSG_MAP(campaign_editor)
|
||||
ON_BN_CLICKED(ID_LOAD, OnLoad)
|
||||
ON_BN_CLICKED(IDC_ALIGN, OnAlign)
|
||||
ON_BN_CLICKED(ID_CPGN_CLOSE, OnCpgnClose)
|
||||
ON_NOTIFY(NM_RCLICK, IDC_SEXP_TREE, OnRclickTree)
|
||||
ON_NOTIFY(TVN_BEGINLABELEDIT, IDC_SEXP_TREE, OnBeginlabeleditSexpTree)
|
||||
ON_NOTIFY(TVN_ENDLABELEDIT, IDC_SEXP_TREE, OnEndlabeleditSexpTree)
|
||||
ON_NOTIFY(TVN_SELCHANGED, IDC_SEXP_TREE, OnSelchangedSexpTree)
|
||||
ON_BN_CLICKED(IDC_MOVE_UP, OnMoveUp)
|
||||
ON_BN_CLICKED(IDC_MOVE_DOWN, OnMoveDown)
|
||||
ON_COMMAND(ID_END_EDIT, OnEndEdit)
|
||||
ON_EN_CHANGE(IDC_BRIEFING_CUTSCENE, OnChangeBriefingCutscene)
|
||||
ON_CBN_SELCHANGE(IDC_CAMPAIGN_TYPE, OnSelchangeType)
|
||||
ON_BN_CLICKED(IDC_TOGGLE_LOOP, OnToggleLoop)
|
||||
ON_BN_CLICKED(IDC_LOOP_BRIEF_BROWSE, OnBrowseLoopAni)
|
||||
ON_BN_CLICKED(IDC_LOOP_BRIEF_SOUND_BROWSE, OnBrowseLoopSound)
|
||||
ON_EN_CHANGE(IDC_MAIN_HALL, OnChangeMainHall)
|
||||
ON_EN_CHANGE(IDC_DEBRIEFING_PERSONA, OnChangeDebriefingPersona)
|
||||
ON_BN_CLICKED(IDC_CUSTOM_TECH_DB, OnCustomTechDB)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_editor diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void campaign_editor::AssertValid() const
|
||||
{
|
||||
CFormView::AssertValid();
|
||||
}
|
||||
|
||||
void campaign_editor::Dump(CDumpContext& dc) const
|
||||
{
|
||||
CFormView::Dump(dc);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_editor message handlers
|
||||
|
||||
void campaign_editor::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
|
||||
{
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
void campaign_editor::OnLoad()
|
||||
{
|
||||
char buf[512];
|
||||
int size, offset;
|
||||
|
||||
if (Cur_campaign_mission < 0){
|
||||
return;
|
||||
}
|
||||
|
||||
if (Campaign_modified){
|
||||
if (Campaign_wnd->save_modified()){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
cf_find_file_location(Campaign.missions[Cur_campaign_mission].name, CF_TYPE_MISSIONS, 512, buf, &size, &offset, false);
|
||||
|
||||
FREDDoc_ptr->SetPathName(buf);
|
||||
Campaign_wnd->DestroyWindow();
|
||||
|
||||
// if (FREDDoc_ptr->OnOpenDocument(Campaign.missions[Cur_campaign_mission].name)) {
|
||||
// Bypass_clear_mission = 1;
|
||||
// Campaign_wnd->DestroyWindow();
|
||||
//
|
||||
// } else {
|
||||
// MessageBox("Failed to load mission!", "Error");
|
||||
// }
|
||||
}
|
||||
|
||||
BOOL campaign_editor::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
|
||||
{
|
||||
int i;
|
||||
BOOL r;
|
||||
CComboBox *box;
|
||||
|
||||
r = CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
|
||||
if (r) {
|
||||
box = (CComboBox *) GetDlgItem(IDC_CAMPAIGN_TYPE);
|
||||
box->ResetContent();
|
||||
for (i=0; i<MAX_CAMPAIGN_TYPES; i++){
|
||||
box->AddString(campaign_types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void campaign_editor::load_campaign()
|
||||
{
|
||||
Cur_campaign_mission = Cur_campaign_link = -1;
|
||||
load_tree(0);
|
||||
|
||||
if (!strlen(Campaign.filename))
|
||||
strcpy_s(Campaign.filename, BUILTIN_CAMPAIGN);
|
||||
|
||||
if (mission_campaign_load(Campaign.filename, NULL, 0)) {
|
||||
MessageBox("Couldn't open Campaign file!", "Error");
|
||||
Campaign_wnd->OnCpgnFileNew();
|
||||
return;
|
||||
}
|
||||
|
||||
Campaign_modified = 0;
|
||||
Campaign_tree_viewp->construct_tree();
|
||||
initialize();
|
||||
}
|
||||
|
||||
void campaign_editor::OnAlign()
|
||||
{
|
||||
Campaign_tree_viewp->sort_elements();
|
||||
Campaign_tree_viewp->realign_tree();
|
||||
Campaign_tree_viewp->Invalidate();
|
||||
}
|
||||
|
||||
void campaign_editor::initialize( int init_files )
|
||||
{
|
||||
Cur_campaign_mission = Cur_campaign_link = -1;
|
||||
m_tree.setup((CEdit *) GetDlgItem(IDC_HELP_BOX));
|
||||
load_tree(0);
|
||||
Campaign_tree_viewp->initialize();
|
||||
|
||||
// only initialize the file dialog box when the parameter says to. This should
|
||||
// only happen when a campaign type changes
|
||||
if ( init_files ){
|
||||
m_filelist.initialize();
|
||||
}
|
||||
|
||||
m_name = Campaign.name;
|
||||
m_type = Campaign.type;
|
||||
m_num_players.Format("%d", Campaign.num_players);
|
||||
|
||||
if (Campaign.desc) {
|
||||
m_desc = convert_multiline_string(Campaign.desc);
|
||||
} else {
|
||||
m_desc = _T("");
|
||||
}
|
||||
|
||||
m_branch_desc = _T("");
|
||||
|
||||
m_branch_brief_anim = _T("");
|
||||
m_branch_brief_sound = _T("");
|
||||
|
||||
// single player should hide the two dialog items about number of players allowed
|
||||
if ( m_type == CAMPAIGN_TYPE_SINGLE ) {
|
||||
GetDlgItem(IDC_NUM_PLAYERS)->ShowWindow( SW_HIDE );
|
||||
GetDlgItem(IDC_PLAYERS_LABEL)->ShowWindow( SW_HIDE );
|
||||
} else {
|
||||
GetDlgItem(IDC_NUM_PLAYERS)->ShowWindow( SW_SHOW );
|
||||
GetDlgItem(IDC_PLAYERS_LABEL)->ShowWindow( SW_SHOW );
|
||||
}
|
||||
|
||||
// set up the tech db checkbox
|
||||
m_custom_tech_db = (BOOL)(Campaign.flags & CF_CUSTOM_TECH_DATABASE);
|
||||
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
void campaign_editor::mission_selected(int num)
|
||||
{
|
||||
CEdit *bc_dialog, *bc_hall, *bc_persona;
|
||||
char mainhalltext[10];
|
||||
char personatext[10];
|
||||
|
||||
bc_dialog = (CEdit *) GetDlgItem(IDC_BRIEFING_CUTSCENE);
|
||||
bc_hall = (CEdit *) GetDlgItem(IDC_MAIN_HALL);
|
||||
bc_persona = (CEdit *) GetDlgItem(IDC_DEBRIEFING_PERSONA);
|
||||
|
||||
// clear out the text for the briefing cutscene, and put in new text if specified
|
||||
bc_dialog->SetWindowText("");
|
||||
if ( strlen(Campaign.missions[num].briefing_cutscene) )
|
||||
bc_dialog->SetWindowText(Campaign.missions[num].briefing_cutscene);
|
||||
|
||||
// new main hall stuff
|
||||
sprintf(mainhalltext, "%d", Campaign.missions[num].main_hall);
|
||||
bc_hall->SetWindowText(CString(mainhalltext));
|
||||
|
||||
// new debriefing persona stuff
|
||||
sprintf(personatext, "%d", Campaign.missions[num].debrief_persona_index);
|
||||
bc_persona->SetWindowText(CString(personatext));
|
||||
}
|
||||
|
||||
void campaign_editor::update()
|
||||
{
|
||||
char buf[MISSION_DESC_LENGTH];
|
||||
|
||||
// get data from dlog box
|
||||
UpdateData(TRUE);
|
||||
|
||||
// update campaign name
|
||||
string_copy(Campaign.name, m_name, NAME_LENGTH);
|
||||
Campaign.type = m_type;
|
||||
|
||||
// update campaign desc
|
||||
deconvert_multiline_string(buf, m_desc, MISSION_DESC_LENGTH);
|
||||
if (Campaign.desc) {
|
||||
free(Campaign.desc);
|
||||
}
|
||||
|
||||
Campaign.desc = NULL;
|
||||
if (strlen(buf)) {
|
||||
Campaign.desc = strdup(buf);
|
||||
}
|
||||
|
||||
// update flags
|
||||
Campaign.flags = CF_DEFAULT_VALUE;
|
||||
if (m_custom_tech_db)
|
||||
Campaign.flags |= CF_CUSTOM_TECH_DATABASE;
|
||||
|
||||
// maybe update mission loop text
|
||||
save_loop_desc_window();
|
||||
|
||||
// set the number of players in a multiplayer mission equal to the number of players in the first mission
|
||||
if ( Campaign.type != CAMPAIGN_TYPE_SINGLE ) {
|
||||
if ( Campaign.num_missions == 0 ) {
|
||||
Campaign.num_players = 0;
|
||||
} else {
|
||||
mission a_mission;
|
||||
|
||||
get_mission_info(Campaign.missions[0].name, &a_mission);
|
||||
Campaign.num_players = a_mission.num_players;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::OnCpgnClose()
|
||||
{
|
||||
Campaign_wnd->OnClose();
|
||||
}
|
||||
|
||||
void campaign_editor::load_tree(int save_first)
|
||||
{
|
||||
char text[80];
|
||||
int i;
|
||||
HTREEITEM h;
|
||||
|
||||
if (save_first)
|
||||
save_tree();
|
||||
|
||||
m_tree.clear_tree();
|
||||
m_tree.DeleteAllItems();
|
||||
m_num_links = 0;
|
||||
UpdateData(TRUE);
|
||||
update_loop_desc_window();
|
||||
|
||||
m_last_mission = Cur_campaign_mission;
|
||||
if (Cur_campaign_mission < 0) {
|
||||
GetDlgItem(IDC_SEXP_TREE)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_BRIEFING_CUTSCENE)->EnableWindow(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
GetDlgItem(IDC_SEXP_TREE)->EnableWindow(TRUE);
|
||||
GetDlgItem(IDC_BRIEFING_CUTSCENE)->EnableWindow(TRUE);
|
||||
|
||||
GetDlgItem(IDC_MISSISON_LOOP_DESC)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_LOOP_BRIEF_ANIM)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_LOOP_BRIEF_SOUND)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_LOOP_BRIEF_BROWSE)->EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_LOOP_BRIEF_SOUND_BROWSE)->EnableWindow(FALSE);
|
||||
|
||||
for (i=0; i<Total_links; i++) {
|
||||
if (Links[i].from == Cur_campaign_mission) {
|
||||
Links[i].node = m_tree.load_sub_tree(Links[i].sexp, true, "do-nothing");
|
||||
m_num_links++;
|
||||
|
||||
if (Links[i].from == Links[i].to) {
|
||||
strcpy_s(text, "Repeat mission");
|
||||
} else if ( (Links[i].to == -1) && (Links[i].from != -1) ) {
|
||||
strcpy_s(text, "End of Campaign");
|
||||
} else {
|
||||
sprintf(text, "Branch to %s", Campaign.missions[Links[i].to].name);
|
||||
}
|
||||
|
||||
// insert item into tree
|
||||
int image, sel_image;
|
||||
if (Links[i].is_mission_loop || Links[i].is_mission_fork) {
|
||||
image = BITMAP_BLUE_DOT;
|
||||
sel_image = BITMAP_GREEN_DOT;
|
||||
} else {
|
||||
image = BITMAP_BLACK_DOT;
|
||||
sel_image = BITMAP_RED_DOT;
|
||||
}
|
||||
|
||||
h = m_tree.insert(text, image, sel_image);
|
||||
|
||||
m_tree.SetItemData(h, Links[i].node);
|
||||
m_tree.add_sub_tree(Links[i].node, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::OnRclickTree(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
m_tree.right_clicked(MODE_CAMPAIGN);
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void campaign_editor::OnBeginlabeleditSexpTree(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
|
||||
|
||||
if (m_tree.edit_label(pTVDispInfo->item.hItem) == 1) {
|
||||
*pResult = 0;
|
||||
Campaign_modified = 1;
|
||||
} else {
|
||||
*pResult = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::OnEndlabeleditSexpTree(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
|
||||
|
||||
*pResult = m_tree.end_label_edit(pTVDispInfo->item);
|
||||
}
|
||||
|
||||
int campaign_editor::handler(int code, int node, char *str)
|
||||
{
|
||||
int i;
|
||||
|
||||
switch (code) {
|
||||
case ROOT_DELETED:
|
||||
for (i=0; i<Total_links; i++){
|
||||
if ((Links[i].from == Cur_campaign_mission) && (Links[i].node == node)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Campaign_tree_viewp->delete_link(i);
|
||||
m_num_links--;
|
||||
return node;
|
||||
|
||||
default:
|
||||
Int3();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void campaign_editor::save_tree(int clear)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (m_last_mission < 0){
|
||||
return; // nothing to save
|
||||
}
|
||||
|
||||
for (i=0; i<Total_links; i++){
|
||||
if (Links[i].from == m_last_mission) {
|
||||
sexp_unmark_persistent(Links[i].sexp);
|
||||
free_sexp2(Links[i].sexp);
|
||||
Links[i].sexp = m_tree.save_tree(Links[i].node);
|
||||
sexp_mark_persistent(Links[i].sexp);
|
||||
}
|
||||
}
|
||||
|
||||
if (clear){
|
||||
m_last_mission = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::OnSelchangedSexpTree(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
int i, node;
|
||||
HTREEITEM h, h2;
|
||||
|
||||
// get handle of selected item
|
||||
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
|
||||
h = pNMTreeView->itemNew.hItem;
|
||||
Assert(h);
|
||||
|
||||
// update help on sexp
|
||||
m_tree.update_help(h);
|
||||
|
||||
// get handle of parent
|
||||
while ((h2 = m_tree.GetParentItem(h))>0){
|
||||
h = h2;
|
||||
}
|
||||
|
||||
// get identifier of parent
|
||||
node = m_tree.GetItemData(h);
|
||||
for (i=0; i<Total_links; i++){
|
||||
if ((Links[i].from == Cur_campaign_mission) && (Links[i].node == node)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == Total_links) {
|
||||
Cur_campaign_link = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
// update mission loop text
|
||||
UpdateData(TRUE);
|
||||
save_loop_desc_window();
|
||||
|
||||
Cur_campaign_link = i;
|
||||
update_loop_desc_window();
|
||||
Campaign_tree_viewp->Invalidate();
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void campaign_editor::OnMoveUp()
|
||||
{
|
||||
int i, last = -1;
|
||||
campaign_tree_link temp;
|
||||
HTREEITEM h1, h2;
|
||||
|
||||
if (Cur_campaign_link >= 0) {
|
||||
save_tree();
|
||||
for (i=0; i<Total_links; i++){
|
||||
if (Links[i].from == Cur_campaign_mission) {
|
||||
if (i == Cur_campaign_link){
|
||||
break;
|
||||
}
|
||||
|
||||
last = i;
|
||||
}
|
||||
}
|
||||
|
||||
if ((last != -1) && (i < Total_links)) {
|
||||
h1 = m_tree.GetParentItem(m_tree.handle(Links[i].node));
|
||||
h2 = m_tree.GetParentItem(m_tree.handle(Links[last].node));
|
||||
m_tree.swap_roots(h1, h2);
|
||||
m_tree.SelectItem(m_tree.GetParentItem(m_tree.handle(Links[i].node)));
|
||||
|
||||
temp = Links[last];
|
||||
Links[last] = Links[i];
|
||||
Links[i] = temp;
|
||||
Cur_campaign_link = last;
|
||||
}
|
||||
}
|
||||
|
||||
GetDlgItem(IDC_SEXP_TREE)->SetFocus();
|
||||
}
|
||||
|
||||
void campaign_editor::OnMoveDown()
|
||||
{
|
||||
int i, j;
|
||||
campaign_tree_link temp;
|
||||
HTREEITEM h1, h2;
|
||||
|
||||
if (Cur_campaign_link >= 0) {
|
||||
save_tree();
|
||||
for (i=0; i<Total_links; i++)
|
||||
if (Links[i].from == Cur_campaign_mission)
|
||||
if (i == Cur_campaign_link)
|
||||
break;
|
||||
|
||||
for (j=i+1; j<Total_links; j++)
|
||||
if (Links[j].from == Cur_campaign_mission)
|
||||
break;
|
||||
|
||||
if (j < Total_links) {
|
||||
h1 = m_tree.GetParentItem(m_tree.handle(Links[i].node));
|
||||
h2 = m_tree.GetParentItem(m_tree.handle(Links[j].node));
|
||||
m_tree.swap_roots(h1, h2);
|
||||
m_tree.SelectItem(m_tree.GetParentItem(m_tree.handle(Links[i].node)));
|
||||
|
||||
temp = Links[j];
|
||||
Links[j] = Links[i];
|
||||
Links[i] = temp;
|
||||
Cur_campaign_link = j;
|
||||
}
|
||||
}
|
||||
|
||||
GetDlgItem(IDC_SEXP_TREE)->SetFocus();
|
||||
}
|
||||
|
||||
void campaign_editor::swap_handler(int node1, int node2)
|
||||
{
|
||||
int index1, index2;
|
||||
campaign_tree_link temp;
|
||||
|
||||
for (index1=0; index1<Total_links; index1++){
|
||||
if ((Links[index1].from == Cur_campaign_mission) && (Links[index1].node == node1)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(index1 < Total_links);
|
||||
for (index2=0; index2<Total_links; index2++){
|
||||
if ((Links[index2].from == Cur_campaign_mission) && (Links[index2].node == node2)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(index2 < Total_links);
|
||||
temp = Links[index1];
|
||||
// Links[index1] = Links[index2];
|
||||
while (index1 < index2) {
|
||||
Links[index1] = Links[index1 + 1];
|
||||
index1++;
|
||||
}
|
||||
|
||||
while (index1 > index2 + 1) {
|
||||
Links[index1] = Links[index1 - 1];
|
||||
index1--;
|
||||
}
|
||||
|
||||
// update Cur_campaign_link
|
||||
Cur_campaign_link = index1;
|
||||
|
||||
Links[index1] = temp;
|
||||
}
|
||||
|
||||
void campaign_editor::insert_handler(int old, int node)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<Total_links; i++){
|
||||
if ((Links[i].from == Cur_campaign_mission) && (Links[i].node == old)){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Assert(i < Total_links);
|
||||
Links[i].node = node;
|
||||
return;
|
||||
}
|
||||
|
||||
void campaign_editor::OnEndEdit()
|
||||
{
|
||||
HWND h;
|
||||
CWnd *w;
|
||||
|
||||
w = GetFocus();
|
||||
if (w) {
|
||||
h = w->m_hWnd;
|
||||
GetDlgItem(IDC_SEXP_TREE)->SetFocus();
|
||||
::SetFocus(h);
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::OnChangeBriefingCutscene()
|
||||
{
|
||||
CEdit *bc_dialog;
|
||||
|
||||
bc_dialog = (CEdit *) GetDlgItem(IDC_BRIEFING_CUTSCENE);
|
||||
|
||||
// maybe save off the current cutscene names.
|
||||
if ( Cur_campaign_mission != -1 ) {
|
||||
|
||||
// see if the contents of the edit box have changed. Luckily, this returns 0 when the edit box is
|
||||
// cleared.
|
||||
if ( bc_dialog->GetModify() ) {
|
||||
bc_dialog->GetWindowText( Campaign.missions[Cur_campaign_mission].briefing_cutscene, NAME_LENGTH );
|
||||
Campaign_modified = 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// what to do when changing campaign type
|
||||
void campaign_editor::OnSelchangeType()
|
||||
{
|
||||
// if campaign type is single player, then disable the multiplayer items
|
||||
update();
|
||||
initialize();
|
||||
Campaign_modified = 1;
|
||||
}
|
||||
|
||||
|
||||
// update the loop mission text
|
||||
void campaign_editor::save_loop_desc_window()
|
||||
{
|
||||
char buffer[MISSION_DESC_LENGTH];
|
||||
|
||||
// update only if active link and there is a mission has mission loop or fork
|
||||
if ( (Cur_campaign_link >= 0) && (Links[Cur_campaign_link].is_mission_loop || Links[Cur_campaign_link].is_mission_fork) ) {
|
||||
deconvert_multiline_string(buffer, m_branch_desc, MISSION_DESC_LENGTH);
|
||||
if (Links[Cur_campaign_link].mission_branch_txt) {
|
||||
free(Links[Cur_campaign_link].mission_branch_txt);
|
||||
}
|
||||
if (Links[Cur_campaign_link].mission_branch_brief_anim) {
|
||||
free(Links[Cur_campaign_link].mission_branch_brief_anim);
|
||||
}
|
||||
if (Links[Cur_campaign_link].mission_branch_brief_sound) {
|
||||
free(Links[Cur_campaign_link].mission_branch_brief_sound);
|
||||
}
|
||||
|
||||
if (strlen(buffer)) {
|
||||
Links[Cur_campaign_link].mission_branch_txt = strdup(buffer);
|
||||
} else {
|
||||
Links[Cur_campaign_link].mission_branch_txt = NULL;
|
||||
}
|
||||
|
||||
deconvert_multiline_string(buffer, m_branch_brief_anim, MAX_FILENAME_LEN);
|
||||
if(strlen(buffer)){
|
||||
Links[Cur_campaign_link].mission_branch_brief_anim = strdup(buffer);
|
||||
} else {
|
||||
Links[Cur_campaign_link].mission_branch_brief_anim = NULL;
|
||||
}
|
||||
|
||||
deconvert_multiline_string(buffer, m_branch_brief_sound, MAX_FILENAME_LEN);
|
||||
if(strlen(buffer)){
|
||||
Links[Cur_campaign_link].mission_branch_brief_sound = strdup(buffer);
|
||||
} else {
|
||||
Links[Cur_campaign_link].mission_branch_brief_sound = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::update_loop_desc_window()
|
||||
{
|
||||
bool enable_branch_desc_window;
|
||||
|
||||
enable_branch_desc_window = false;
|
||||
if ((Cur_campaign_link >= 0) && (Links[Cur_campaign_link].is_mission_loop || Links[Cur_campaign_link].is_mission_fork)) {
|
||||
enable_branch_desc_window = true;
|
||||
}
|
||||
|
||||
// maybe enable description window
|
||||
GetDlgItem(IDC_MISSISON_LOOP_DESC)->EnableWindow(enable_branch_desc_window);
|
||||
GetDlgItem(IDC_LOOP_BRIEF_ANIM)->EnableWindow(enable_branch_desc_window);
|
||||
GetDlgItem(IDC_LOOP_BRIEF_SOUND)->EnableWindow(enable_branch_desc_window);
|
||||
GetDlgItem(IDC_LOOP_BRIEF_BROWSE)->EnableWindow(enable_branch_desc_window);
|
||||
GetDlgItem(IDC_LOOP_BRIEF_SOUND_BROWSE)->EnableWindow(enable_branch_desc_window);
|
||||
|
||||
// set new text
|
||||
if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_branch_txt && enable_branch_desc_window) {
|
||||
m_branch_desc = convert_multiline_string(Links[Cur_campaign_link].mission_branch_txt);
|
||||
} else {
|
||||
m_branch_desc = _T("");
|
||||
}
|
||||
|
||||
// set new text
|
||||
if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_branch_brief_anim && enable_branch_desc_window) {
|
||||
m_branch_brief_anim = convert_multiline_string(Links[Cur_campaign_link].mission_branch_brief_anim);
|
||||
} else {
|
||||
m_branch_brief_anim = _T("");
|
||||
}
|
||||
|
||||
// set new text
|
||||
if ((Cur_campaign_link >= 0) && Links[Cur_campaign_link].mission_branch_brief_sound && enable_branch_desc_window) {
|
||||
m_branch_brief_sound = convert_multiline_string(Links[Cur_campaign_link].mission_branch_brief_sound);
|
||||
} else {
|
||||
m_branch_brief_sound = _T("");
|
||||
}
|
||||
|
||||
// reset text
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
void campaign_editor::OnToggleLoop()
|
||||
{
|
||||
// check if branch selected
|
||||
if (Cur_campaign_link == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// store mission loop text
|
||||
UpdateData(TRUE);
|
||||
|
||||
if ( (Cur_campaign_link >= 0) && (Links[Cur_campaign_link].is_mission_loop || Links[Cur_campaign_link].is_mission_fork) ) {
|
||||
if (Links[Cur_campaign_link].mission_branch_txt) {
|
||||
free(Links[Cur_campaign_link].mission_branch_txt);
|
||||
}
|
||||
|
||||
if (Links[Cur_campaign_link].mission_branch_brief_anim) {
|
||||
free(Links[Cur_campaign_link].mission_branch_brief_anim);
|
||||
}
|
||||
|
||||
if (Links[Cur_campaign_link].mission_branch_brief_sound) {
|
||||
free(Links[Cur_campaign_link].mission_branch_brief_sound);
|
||||
}
|
||||
|
||||
char buffer[MISSION_DESC_LENGTH];
|
||||
|
||||
deconvert_multiline_string(buffer, m_branch_desc, MISSION_DESC_LENGTH);
|
||||
if (m_branch_desc && strlen(buffer)) {
|
||||
Links[Cur_campaign_link].mission_branch_txt = strdup(buffer);
|
||||
} else {
|
||||
Links[Cur_campaign_link].mission_branch_txt = NULL;
|
||||
}
|
||||
|
||||
deconvert_multiline_string(buffer, m_branch_brief_anim, MISSION_DESC_LENGTH);
|
||||
if (m_branch_brief_anim && strlen(buffer)) {
|
||||
Links[Cur_campaign_link].mission_branch_brief_anim = strdup(buffer);
|
||||
} else {
|
||||
Links[Cur_campaign_link].mission_branch_brief_anim = NULL;
|
||||
}
|
||||
|
||||
deconvert_multiline_string(buffer, m_branch_brief_sound, MISSION_DESC_LENGTH);
|
||||
if (m_branch_brief_sound && strlen(buffer)) {
|
||||
Links[Cur_campaign_link].mission_branch_brief_sound = strdup(buffer);
|
||||
} else {
|
||||
Links[Cur_campaign_link].mission_branch_brief_sound = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// toggle to mission_loop setting
|
||||
Links[Cur_campaign_link].is_mission_loop = !Links[Cur_campaign_link].is_mission_loop;
|
||||
Links[Cur_campaign_link].is_mission_fork = false;
|
||||
|
||||
// reset loop desc window (gray if inactive)
|
||||
update_loop_desc_window();
|
||||
|
||||
// set root icon
|
||||
int bitmap1, bitmap2;
|
||||
if (Links[Cur_campaign_link].is_mission_loop || Links[Cur_campaign_link].is_mission_fork) {
|
||||
bitmap2 = BITMAP_GREEN_DOT;
|
||||
bitmap1 = BITMAP_BLUE_DOT;
|
||||
} else {
|
||||
bitmap1 = BITMAP_BLACK_DOT;
|
||||
bitmap2 = BITMAP_RED_DOT;
|
||||
}
|
||||
|
||||
// Search for item and update bitmap
|
||||
HTREEITEM h = m_tree.GetRootItem();
|
||||
while (h) {
|
||||
if ((int) m_tree.GetItemData(h) == Links[Cur_campaign_link].node) {
|
||||
m_tree.SetItemImage(h, bitmap1, bitmap2);
|
||||
break;
|
||||
}
|
||||
|
||||
h = m_tree.GetNextSiblingItem(h);
|
||||
}
|
||||
|
||||
// set to redraw
|
||||
Campaign_tree_viewp->Invalidate();
|
||||
}
|
||||
|
||||
void campaign_editor::OnBrowseLoopAni()
|
||||
{
|
||||
int pushed_dir;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
// switch directories
|
||||
pushed_dir = cfile_push_chdir(CF_TYPE_INTERFACE);
|
||||
CFileDialog dlg(TRUE, "ani", NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR, "Ani Files (*.ani)|*.ani");
|
||||
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
m_branch_brief_anim = dlg.GetFileName();
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
// move back to the proper directory
|
||||
if (!pushed_dir){
|
||||
cfile_pop_dir();
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::OnBrowseLoopSound()
|
||||
{
|
||||
int pushed_dir;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
// switch directories
|
||||
pushed_dir = cfile_push_chdir(CF_TYPE_VOICE_CMD_BRIEF);
|
||||
CFileDialog dlg(TRUE, "wav", NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
|
||||
"Voice Files (*.ogg, *.wav)|*.ogg;*.wav|Ogg Vorbis Files (*.ogg)|*.ogg|Wave Files (*.wav)|*.wav||");
|
||||
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
m_branch_brief_sound = dlg.GetFileName();
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
// move back to the proper directory
|
||||
if (!pushed_dir){
|
||||
cfile_pop_dir();
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::OnChangeMainHall()
|
||||
{
|
||||
CString str;
|
||||
int hall;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
if (Cur_campaign_mission >= 0)
|
||||
{
|
||||
GetDlgItem(IDC_MAIN_HALL)->GetWindowText(str);
|
||||
hall = atoi(str);
|
||||
|
||||
if (hall > 255) hall = 255;
|
||||
if (hall < 0) hall = 0;
|
||||
|
||||
Campaign.missions[Cur_campaign_mission].main_hall = (ubyte) hall;
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::OnChangeDebriefingPersona()
|
||||
{
|
||||
CString str;
|
||||
int persona;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
if (Cur_campaign_mission >= 0)
|
||||
{
|
||||
GetDlgItem(IDC_DEBRIEFING_PERSONA)->GetWindowText(str);
|
||||
persona = atoi(str);
|
||||
|
||||
if (persona < 0 || persona > 0xff)
|
||||
persona = 0;
|
||||
|
||||
Campaign.missions[Cur_campaign_mission].debrief_persona_index = (ubyte) persona;
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_editor::OnCustomTechDB()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
|
||||
if (m_custom_tech_db)
|
||||
Campaign.flags |= CF_CUSTOM_TECH_DATABASE;
|
||||
else
|
||||
Campaign.flags &= ~CF_CUSTOM_TECH_DATABASE;
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// CampaignEditorDlg.h : header file
|
||||
//
|
||||
|
||||
#include "resource.h"
|
||||
#include "Sexp_tree.h"
|
||||
#include "CampaignFilelistBox.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_editor form view
|
||||
|
||||
#ifndef __AFXEXT_H__
|
||||
#include <afxext.h>
|
||||
#endif
|
||||
|
||||
class campaign_sexp_tree : public sexp_tree
|
||||
{
|
||||
};
|
||||
|
||||
class campaign_editor : public CFormView
|
||||
{
|
||||
private:
|
||||
int m_num_links;
|
||||
int m_last_mission;
|
||||
|
||||
protected:
|
||||
campaign_editor(); // protected constructor used by dynamic creation
|
||||
DECLARE_DYNCREATE(campaign_editor)
|
||||
|
||||
// Form Data
|
||||
public:
|
||||
void mission_selected(int num);
|
||||
void insert_handler(int old, int node);
|
||||
void swap_handler(int node1, int node2);
|
||||
void update();
|
||||
void load_tree(int save = 1);
|
||||
void save_tree(int clear = 1);
|
||||
int handler(int code, int node, char *str = NULL);
|
||||
void initialize( int init_files = 1 );
|
||||
void load_campaign();
|
||||
void update_loop_desc_window();
|
||||
void campaign_editor::save_loop_desc_window();
|
||||
//{{AFX_DATA(campaign_editor)
|
||||
enum { IDD = IDD_CAMPAIGN };
|
||||
campaign_sexp_tree m_tree;
|
||||
campaign_filelist_box m_filelist;
|
||||
CString m_name;
|
||||
int m_type;
|
||||
CString m_num_players;
|
||||
CString m_desc;
|
||||
CString m_branch_desc;
|
||||
CString m_branch_brief_anim;
|
||||
CString m_branch_brief_sound;
|
||||
BOOL m_custom_tech_db;
|
||||
//}}AFX_DATA
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(campaign_editor)
|
||||
public:
|
||||
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual ~campaign_editor();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(campaign_editor)
|
||||
afx_msg void OnLoad();
|
||||
afx_msg void OnAlign();
|
||||
afx_msg void OnCpgnClose();
|
||||
afx_msg void OnRclickTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnBeginlabeleditSexpTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnEndlabeleditSexpTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnSelchangedSexpTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnMoveUp();
|
||||
afx_msg void OnMoveDown();
|
||||
afx_msg void OnEndEdit();
|
||||
afx_msg void OnChangeBriefingCutscene();
|
||||
afx_msg void OnSelchangeType();
|
||||
afx_msg void MainHallChange();
|
||||
afx_msg void OnToggleLoop();
|
||||
afx_msg void OnBrowseLoopAni();
|
||||
afx_msg void OnBrowseLoopSound();
|
||||
afx_msg void OnChangeMainHall();
|
||||
afx_msg void OnChangeDebriefingPersona();
|
||||
afx_msg void OnCustomTechDB();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern campaign_editor *Campaign_tree_formp;
|
||||
extern int Cur_campaign_mission;
|
||||
extern int Cur_campaign_link;
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// CampaignFilelistBox.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "CampaignFilelistBox.h"
|
||||
#include "CampaignTreeWnd.h"
|
||||
#include "mission/missioncampaign.h"
|
||||
#include "mission/missionparse.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_filelist_box
|
||||
|
||||
campaign_filelist_box::campaign_filelist_box()
|
||||
{
|
||||
}
|
||||
|
||||
campaign_filelist_box::~campaign_filelist_box()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(campaign_filelist_box, CListBox)
|
||||
//{{AFX_MSG_MAP(campaign_filelist_box)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_filelist_box message handlers
|
||||
|
||||
void campaign_filelist_box::initialize()
|
||||
{
|
||||
int i, z, num_files;
|
||||
char *mission_filenames[2000];
|
||||
char mission_filenames_arr[2000][MAX_FILENAME_LEN];
|
||||
mission a_mission;
|
||||
|
||||
ResetContent();
|
||||
|
||||
extern int Skip_packfile_search;
|
||||
Skip_packfile_search = 1;
|
||||
num_files = cf_get_file_list_preallocated(2000, mission_filenames_arr, mission_filenames, CF_TYPE_MISSIONS, "*.fs2");
|
||||
Skip_packfile_search = 0;
|
||||
|
||||
i=0;
|
||||
|
||||
while (i < num_files)
|
||||
{
|
||||
// make a call to get the mission info for this mission. Passing a misison as the second
|
||||
// parameter will prevent The_mission from getting overwritten.
|
||||
get_mission_info( mission_filenames[i] , &a_mission );
|
||||
strcat(mission_filenames[i],".fs2");
|
||||
|
||||
// only add missions of the appropriate type to the file listbox
|
||||
if ( (Campaign.type == CAMPAIGN_TYPE_SINGLE) && (a_mission.game_type & (MISSION_TYPE_SINGLE|MISSION_TYPE_TRAINING)) )
|
||||
AddString(mission_filenames[i]);
|
||||
else if ( (Campaign.type == CAMPAIGN_TYPE_MULTI_COOP) && (a_mission.game_type & MISSION_TYPE_MULTI_COOP) )
|
||||
AddString(mission_filenames[i]);
|
||||
else if ( (Campaign.type == CAMPAIGN_TYPE_MULTI_TEAMS) && (a_mission.game_type & MISSION_TYPE_MULTI_TEAMS) )
|
||||
AddString(mission_filenames[i]);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
for (i=0; i<Campaign.num_missions; i++) {
|
||||
z = FindString(-1, Campaign.missions[i].name);
|
||||
if (z != LB_ERR) {
|
||||
DeleteString(z); // take out all missions already in the campaign
|
||||
i--; // recheck for name just in case there are two (should be impossible but can't be sure)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// CampaignFilelistBox.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_filelist_box window
|
||||
|
||||
class campaign_filelist_box : public CListBox
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void initialize();
|
||||
campaign_filelist_box();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(campaign_filelist_box)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~campaign_filelist_box();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(campaign_filelist_box)
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// CampaignTreeView.h : header file
|
||||
//
|
||||
|
||||
#include "mission/missioncampaign.h"
|
||||
|
||||
#define MAX_LEVELS 100
|
||||
#define MAX_CAMPAIGN_TREE_LINKS 300
|
||||
|
||||
typedef struct campaign_tree_element {
|
||||
int from_links; // total branches from this mission
|
||||
int to_links; // total branches that lead to this mission
|
||||
CRect box; // coordinates of drawn box
|
||||
} campaign_tree_element;
|
||||
|
||||
typedef struct campaign_tree_link {
|
||||
int from; // index of source mission
|
||||
int to; // index of mission link leads to
|
||||
int sexp; // sexp index of condition that allows this branch
|
||||
int node; // node tracker when link is in sexp tree window
|
||||
int from_pos; // from link drawing offset
|
||||
int to_pos; // to link drawing offset
|
||||
bool is_mission_loop; // whether link leads to mission loop
|
||||
bool is_mission_fork; // whether link leads to mission fork
|
||||
char *mission_branch_txt; // text describing mission loop
|
||||
char *mission_branch_brief_anim; // filename of anim to play in the brief
|
||||
char *mission_branch_brief_sound; // filename of anim to play in the brief
|
||||
CPoint p1; // coordinates of line last draw for link, from p1 to p2
|
||||
CPoint p2;
|
||||
} campaign_tree_link;
|
||||
|
||||
extern int Total_links;
|
||||
extern int Level_counts[MAX_LEVELS];
|
||||
extern int Sorted[MAX_CAMPAIGN_MISSIONS];
|
||||
extern campaign_tree_element Elements[MAX_CAMPAIGN_MISSIONS];
|
||||
extern campaign_tree_link Links[MAX_CAMPAIGN_TREE_LINKS];
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_tree_view view
|
||||
|
||||
class campaign_tree_view : public CScrollView
|
||||
{
|
||||
protected:
|
||||
campaign_tree_view(); // protected constructor used by dynamic creation
|
||||
DECLARE_DYNCREATE(campaign_tree_view)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
void drop_mission(int m, CPoint point);
|
||||
int add_link(int from, int to);
|
||||
void remove_mission(int m);
|
||||
void delete_link(int num);
|
||||
int get_root_mission();
|
||||
void horizontally_align_mission(int num, int dir);
|
||||
void correct_position(int num);
|
||||
void free_links();
|
||||
void sort_elements();
|
||||
int query_alternate_pos(const CPoint& p);
|
||||
int query_pos(const CPoint& p);
|
||||
int query_level(const CPoint& p);
|
||||
void sort_links();
|
||||
void realign_tree();
|
||||
int total_levels;
|
||||
int total_width;
|
||||
campaign_tree_link *first_link;
|
||||
|
||||
// Operations
|
||||
public:
|
||||
void construct_tree();
|
||||
void initialize();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(campaign_tree_view)
|
||||
public:
|
||||
virtual void OnInitialUpdate();
|
||||
protected:
|
||||
virtual void OnDraw(CDC* pDC); // overridden to draw this view
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual ~campaign_tree_view();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext& dc) const;
|
||||
#endif
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(campaign_tree_view)
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
|
||||
afx_msg void OnRemoveMission();
|
||||
afx_msg void OnDeleteRow();
|
||||
afx_msg void OnInsertRow();
|
||||
afx_msg void OnAddRepeat();
|
||||
afx_msg void OnEndOfCampaign();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern campaign_tree_view *Campaign_tree_viewp;
|
||||
@@ -1,459 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "CampaignTreeWnd.h"
|
||||
#include "CampaignEditorDlg.h"
|
||||
#include "CampaignTreeView.h"
|
||||
#include "Management.h"
|
||||
#include "MainFrm.h"
|
||||
#include "FREDView.h"
|
||||
#include "MissionSave.h"
|
||||
#include "InitialShips.h"
|
||||
#include "mission/missionparse.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
int Mission_filename_cb_format;
|
||||
int Campaign_modified = 0;
|
||||
int Bypass_clear_mission;
|
||||
campaign_tree_wnd *Campaign_wnd = NULL;
|
||||
|
||||
IMPLEMENT_DYNCREATE(campaign_tree_wnd, CFrameWnd)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_tree_wnd
|
||||
|
||||
campaign_tree_wnd::campaign_tree_wnd()
|
||||
{
|
||||
Bypass_clear_mission = 0;
|
||||
}
|
||||
|
||||
campaign_tree_wnd::~campaign_tree_wnd()
|
||||
{
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(campaign_tree_wnd, CFrameWnd)
|
||||
//{{AFX_MSG_MAP(campaign_tree_wnd)
|
||||
ON_UPDATE_COMMAND_UI(ID_CPGN_FILE_OPEN, OnUpdateCpgnFileOpen)
|
||||
ON_COMMAND(ID_CPGN_FILE_OPEN, OnCpgnFileOpen)
|
||||
ON_WM_DESTROY()
|
||||
ON_COMMAND(ID_CPGN_FILE_SAVE, OnCpgnFileSave)
|
||||
ON_COMMAND(ID_CPGN_FILE_SAVE_AS, OnCpgnFileSaveAs)
|
||||
ON_COMMAND(ID_CPGN_FILE_NEW, OnCpgnFileNew)
|
||||
ON_COMMAND(ID_CLOSE, OnClose2)
|
||||
ON_COMMAND(ID_ERROR_CHECKER, OnErrorChecker)
|
||||
ON_WM_CLOSE()
|
||||
ON_COMMAND(ID_INITIAL_SHIPS, OnInitialShips)
|
||||
ON_COMMAND(ID_INITIAL_WEAPONS, OnInitialWeapons)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_tree_wnd message handlers
|
||||
|
||||
BOOL campaign_tree_wnd::OnCreateClient(LPCREATESTRUCT, CCreateContext* pContext)
|
||||
{
|
||||
CSize s;
|
||||
|
||||
LoadAccelTable("IDR_ACC_CAMPAIGN");
|
||||
Mission_filename_cb_format = RegisterClipboardFormat("Mission Filename");
|
||||
Campaign_modified = 0;
|
||||
clear_mission();
|
||||
|
||||
// create a splitter with 1 row, 2 columns
|
||||
if (!m_splitter.CreateStatic(this, 1, 2))
|
||||
{
|
||||
TRACE0("Failed to CreateStaticSplitter\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// add the first splitter pane - the campaign input form in column 0
|
||||
if (!m_splitter.CreateView(0, 0, RUNTIME_CLASS(campaign_editor), CSize(0, 0), pContext))
|
||||
{
|
||||
TRACE0("Failed to create first pane\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// add the second splitter pane - the campaign tree view in column 1
|
||||
if (!m_splitter.CreateView(0, 1, RUNTIME_CLASS(campaign_tree_view), CSize(240, 100), pContext))
|
||||
{
|
||||
TRACE0("Failed to create second pane\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Campaign_tree_formp = (campaign_editor *) m_splitter.GetPane(0, 0);
|
||||
Campaign_tree_viewp = (campaign_tree_view *) m_splitter.GetPane(0, 1);
|
||||
s = Campaign_tree_formp->GetTotalSize();
|
||||
m_splitter.SetColumnInfo(0, s.cx, 0);
|
||||
m_splitter.SetColumnInfo(1, 0, 0);
|
||||
m_splitter.RecalcLayout();
|
||||
|
||||
// activate the input view
|
||||
SetActiveView(Campaign_tree_formp);
|
||||
OnCpgnFileNew();
|
||||
// Campaign_tree_formp->load_campaign();
|
||||
Fred_main_wnd->EnableWindow(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnUpdateCpgnFileOpen(CCmdUI* pCmdUI)
|
||||
{
|
||||
pCmdUI->Enable();
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnCpgnFileOpen()
|
||||
{
|
||||
CString name;
|
||||
|
||||
if (Campaign_modified)
|
||||
if (save_modified())
|
||||
return;
|
||||
|
||||
CFileDialog dlg(TRUE, "fc2", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "FreeSpace Campaign files (*.fc2)|*.fc2||", this);
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
name = dlg.GetFileName();
|
||||
if (strlen(name) > MAX_FILENAME_LEN - 1) {
|
||||
MessageBox("Filename is too long", "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strlen(name))
|
||||
return;
|
||||
|
||||
string_copy(Campaign.filename, name, MAX_FILENAME_LEN);
|
||||
Campaign_tree_formp->load_campaign();
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnDestroy()
|
||||
{
|
||||
CString str;
|
||||
|
||||
OnCpgnFileNew();
|
||||
Fred_main_wnd->EnableWindow(TRUE);
|
||||
// if (!Bypass_clear_mission)
|
||||
// create_new_mission();
|
||||
str = FREDDoc_ptr->GetPathName();
|
||||
if (str.IsEmpty())
|
||||
create_new_mission();
|
||||
else
|
||||
FREDDoc_ptr->OnOpenDocument(str);
|
||||
|
||||
CFrameWnd::OnDestroy();
|
||||
Campaign_wnd = NULL;
|
||||
Fred_main_wnd->SetFocus();
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnCpgnFileSave()
|
||||
{
|
||||
CFred_mission_save save;
|
||||
|
||||
Campaign_tree_formp->update();
|
||||
if (!Campaign.filename[0]) {
|
||||
OnCpgnFileSaveAs();
|
||||
return;
|
||||
}
|
||||
|
||||
// sanity checking for multiplayer
|
||||
/*
|
||||
if ( Campaign.type == TYPE_MULTI_PLAYER ) {
|
||||
|
||||
if ( (Campaign.mc_info.min_players < 0) || (Campaign.mc_info.min_players > Campaign.mc_info.max_players) ) {
|
||||
MessageBox("Min players must be > 0 and <= max players", "Error", MB_OK | MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
if ( (Campaign.mc_info.max_players < 0) || (Campaign.mc_info.max_players > MAX_PLAYERS) ) {
|
||||
char buf[256];
|
||||
|
||||
sprintf(buf, "Max players must be > 0 and <= %d", MAX_PLAYERS );
|
||||
MessageBox(buf, "Error", MB_OK | MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
if ( Campaign.mc_info.max_players < Campaign.mc_info.min_players ) {
|
||||
MessageBox("Max Players must be greater than min players", "Error", MB_OK | MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (save.save_campaign_file(Campaign.filename))
|
||||
{
|
||||
MessageBox("An error occured while saving!", "Error", MB_OK | MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
Campaign_modified = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnCpgnFileSaveAs()
|
||||
{
|
||||
char *old_name = NULL;
|
||||
char campaign_path[256];
|
||||
CString name;
|
||||
CFred_mission_save save;
|
||||
|
||||
Campaign_tree_formp->update();
|
||||
if (Campaign.filename[0])
|
||||
old_name = Campaign.filename;
|
||||
|
||||
CFileDialog dlg(FALSE, "fc2", old_name, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "FreeSpace Campaign files (*.fc2)|*.fc2||", this);
|
||||
if (dlg.DoModal() == IDOK)
|
||||
{
|
||||
name = dlg.GetFileName();
|
||||
if (strlen(name) > MAX_FILENAME_LEN - 1) {
|
||||
MessageBox("Filename is too long", "Error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strlen(name)){
|
||||
return;
|
||||
}
|
||||
|
||||
string_copy(Campaign.filename, name, MAX_FILENAME_LEN);
|
||||
string_copy(campaign_path, dlg.GetPathName(), 256);
|
||||
if (save.save_campaign_file(campaign_path))
|
||||
{
|
||||
MessageBox("An error occured while saving!", "Error", MB_OK | MB_ICONEXCLAMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
Campaign_modified = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnCpgnFileNew()
|
||||
{
|
||||
if (Campaign_modified)
|
||||
if (save_modified())
|
||||
return;
|
||||
|
||||
Campaign.filename[0] = 0;
|
||||
Campaign.num_missions = 0;
|
||||
Campaign.num_players = 0;
|
||||
strcpy_s(Campaign.name, "Unnamed");
|
||||
Campaign.desc = NULL;
|
||||
Campaign_tree_viewp->free_links();
|
||||
Campaign_tree_formp->initialize();
|
||||
Campaign_modified = 0;
|
||||
Campaign.flags = CF_DEFAULT_VALUE;
|
||||
((CButton *) (Campaign_tree_formp->GetDlgItem(IDC_CUSTOM_TECH_DB)))->SetCheck(0);
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnClose()
|
||||
{
|
||||
if (Campaign_modified)
|
||||
if (save_modified())
|
||||
return;
|
||||
|
||||
CFrameWnd::OnClose();
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnClose2()
|
||||
{
|
||||
if (Campaign_modified)
|
||||
if (save_modified())
|
||||
return;
|
||||
|
||||
DestroyWindow();
|
||||
}
|
||||
|
||||
// returns 0 for success and 1 for cancel
|
||||
int campaign_tree_wnd::save_modified()
|
||||
{
|
||||
int r;
|
||||
|
||||
r = MessageBox("This campaign has been modified. Save changes first?", "Campaign Modified",
|
||||
MB_YESNOCANCEL | MB_ICONQUESTION);
|
||||
|
||||
if (r == IDCANCEL)
|
||||
return 1;
|
||||
|
||||
if (r == IDYES) {
|
||||
OnCpgnFileSave();
|
||||
if (Campaign_modified) // error occured in saving.
|
||||
return 1;
|
||||
}
|
||||
|
||||
Campaign_modified = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnErrorChecker()
|
||||
{
|
||||
Campaign_tree_formp->save_tree(0);
|
||||
error_checker();
|
||||
if (!g_err)
|
||||
MessageBox("No errors detected in campaign", "Woohoo!");
|
||||
}
|
||||
|
||||
int campaign_tree_wnd::error_checker()
|
||||
{
|
||||
int i, j, z;
|
||||
int mcount[MAX_CAMPAIGN_MISSIONS], true_at[MAX_CAMPAIGN_MISSIONS];
|
||||
|
||||
for (i=0; i<MAX_CAMPAIGN_MISSIONS; i++) {
|
||||
mcount[i] = 0;
|
||||
true_at[i] = -1;
|
||||
}
|
||||
|
||||
g_err = 0;
|
||||
for (i=0; i<Total_links; i++) {
|
||||
if ( (Links[i].from < 0) || (Links[i].from >= Campaign.num_missions) )
|
||||
return internal_error("Branch #%d has illegal source mission", i);
|
||||
if ( (Links[i].to < -1) || (Links[i].to >= Campaign.num_missions) )
|
||||
return internal_error("Branch #%d has illegal target mission", i);
|
||||
Sexp_useful_number = Links[i].from;
|
||||
if (fred_check_sexp(Links[i].sexp, OPR_BOOL, "formula of branch #%d", i))
|
||||
return -1;
|
||||
|
||||
z = Links[i].from;
|
||||
mcount[z]++;
|
||||
if (Links[i].sexp == Locked_sexp_false)
|
||||
if (error("Mission \"%s\" branch %d is always false", Campaign.missions[z].name, mcount[z]))
|
||||
return 1;
|
||||
|
||||
if (Links[i].sexp == Locked_sexp_true) {
|
||||
if (true_at[z] >= 0)
|
||||
if (error("Mission \"%s\" branch %d is true but is not last branch", Campaign.missions[z].name, true_at[z]))
|
||||
return 1;
|
||||
|
||||
true_at[z] = mcount[z];
|
||||
}
|
||||
}
|
||||
|
||||
// check that all missions in a multiplayer game have the same number of players
|
||||
if ( Campaign.type != CAMPAIGN_TYPE_SINGLE ) {
|
||||
for (i = 0; i < Campaign.num_missions; i++ ) {
|
||||
mission a_mission;
|
||||
|
||||
get_mission_info(Campaign.missions[i].name, &a_mission);
|
||||
if ( a_mission.num_players != Campaign.num_players ) {
|
||||
if ( error("Mission \"%s\" has %d players. Multiplayer campaign allows %d", Campaign.missions[i].name, a_mission.num_players, Campaign.num_players) )
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<Campaign.num_missions; i++)
|
||||
if (mcount[i] && true_at[i] < mcount[i])
|
||||
if (error("Mission \"%s\" last branch isn't set to true", Campaign.missions[i].name))
|
||||
return 1;
|
||||
|
||||
for (i=z=0; i<Campaign.num_missions; i++) {
|
||||
for (j=0; j<Campaign.num_missions; j++)
|
||||
if ((i != j) && !stricmp(Campaign.missions[i].name, Campaign.missions[j].name))
|
||||
return internal_error("Mission \"%s\" is listed twice in campaign", Campaign.missions[i].name);
|
||||
|
||||
if (!Campaign.missions[i].level)
|
||||
z++;
|
||||
}
|
||||
|
||||
if (!z)
|
||||
if (error("No top level mission present in tree"))
|
||||
return 1;
|
||||
|
||||
if (z > 1)
|
||||
return internal_error("More than one top level mission present in tree");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int campaign_tree_wnd::error(char *msg, ...)
|
||||
{
|
||||
char buf[2048];
|
||||
va_list args;
|
||||
|
||||
g_err++;
|
||||
va_start(args, msg);
|
||||
vsprintf(buf, msg, args);
|
||||
va_end(args);
|
||||
|
||||
if (MessageBox(buf, "Error", MB_OKCANCEL | MB_ICONEXCLAMATION) == IDOK)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int campaign_tree_wnd::internal_error(char *msg, ...)
|
||||
{
|
||||
char buf[2048], buf2[2048];
|
||||
va_list args;
|
||||
|
||||
g_err++;
|
||||
va_start(args, msg);
|
||||
vsprintf(buf, msg, args);
|
||||
va_end(args);
|
||||
|
||||
sprintf(buf2, "%s\n\nThis is an internal error. Please let Hoffoss\n"
|
||||
"know about this so he can fix it. Click cancel to debug.", buf);
|
||||
|
||||
if (MessageBox(buf2, "Internal Error", MB_OKCANCEL | MB_ICONEXCLAMATION) == IDCANCEL)
|
||||
Int3(); // drop to debugger so the problem can be analyzed.
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int campaign_tree_wnd::fred_check_sexp(int sexp, int type, char *msg, ...)
|
||||
{
|
||||
char buf[512], buf2[2048], buf3[MAX_EVENT_SIZE];
|
||||
int err = 0, z, faulty_node;
|
||||
va_list args;
|
||||
|
||||
va_start(args, msg);
|
||||
vsprintf(buf, msg, args);
|
||||
va_end(args);
|
||||
|
||||
if (sexp == -1)
|
||||
return 0;
|
||||
|
||||
z = check_sexp_syntax(sexp, type, 1, &faulty_node, SEXP_MODE_CAMPAIGN);
|
||||
if (!z)
|
||||
return 0;
|
||||
|
||||
convert_sexp_to_string(sexp, buf2, SEXP_ERROR_CHECK_MODE, MAX_EVENT_SIZE);
|
||||
sprintf(buf3, "Error in %s: %s\n\nIn sexpression: %s\n\n(Error appears to be: %s)",
|
||||
buf, sexp_error_message(z), buf2, Sexp_nodes[faulty_node].text);
|
||||
|
||||
if (z < 0 && z > -100)
|
||||
err = 1;
|
||||
|
||||
if (err)
|
||||
return internal_error(buf3);
|
||||
|
||||
if (error(buf3))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// code to deal with the initial ships that a player can choose
|
||||
void campaign_tree_wnd::OnInitialShips()
|
||||
{
|
||||
InitialShips isd(Campaign_tree_formp);
|
||||
|
||||
isd.m_initial_items = INITIAL_SHIPS;
|
||||
isd.DoModal();
|
||||
}
|
||||
|
||||
void campaign_tree_wnd::OnInitialWeapons()
|
||||
{
|
||||
InitialShips isd(Campaign_tree_formp);
|
||||
|
||||
isd.m_initial_items = INITIAL_WEAPONS;
|
||||
isd.DoModal();
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// campaign_tree_wnd window
|
||||
|
||||
class campaign_tree_wnd : public CFrameWnd
|
||||
{
|
||||
DECLARE_DYNCREATE(campaign_tree_wnd)
|
||||
|
||||
// Construction
|
||||
public:
|
||||
campaign_tree_wnd();
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
|
||||
// Operations
|
||||
public:
|
||||
int error_checker();
|
||||
int fred_check_sexp(int sexp, int type, char *msg, ...);
|
||||
int error(char *msg, ...);
|
||||
int internal_error(char *msg, ...);
|
||||
int save_modified();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(campaign_tree_wnd)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
private:
|
||||
int g_err;
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~campaign_tree_wnd();
|
||||
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
|
||||
|
||||
// Generated message map functions
|
||||
CSplitterWnd m_splitter;
|
||||
|
||||
//{{AFX_MSG(campaign_tree_wnd)
|
||||
afx_msg void OnUpdateCpgnFileOpen(CCmdUI* pCmdUI);
|
||||
afx_msg void OnCpgnFileOpen();
|
||||
afx_msg void OnDestroy();
|
||||
afx_msg void OnCpgnFileSave();
|
||||
afx_msg void OnCpgnFileSaveAs();
|
||||
afx_msg void OnCpgnFileNew();
|
||||
afx_msg void OnClose2();
|
||||
afx_msg void OnErrorChecker();
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnInitialShips();
|
||||
afx_msg void OnInitialWeapons();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern int Mission_filename_cb_format;
|
||||
extern int Campaign_modified;
|
||||
extern int Bypass_clear_mission;
|
||||
extern campaign_tree_wnd *Campaign_wnd;
|
||||
@@ -1,341 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "CmdBrief.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "sound/audiostr.h"
|
||||
#include "localization/localize.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cmd_brief_dlg dialog
|
||||
|
||||
cmd_brief_dlg::cmd_brief_dlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(cmd_brief_dlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(cmd_brief_dlg)
|
||||
m_ani_filename = _T("");
|
||||
m_text = _T("");
|
||||
m_stage_title = _T("");
|
||||
m_wave_filename = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
m_wave_id = -1;
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(cmd_brief_dlg)
|
||||
DDX_Text(pDX, IDC_ANI_FILENAME, m_ani_filename);
|
||||
DDX_Text(pDX, IDC_TEXT, m_text);
|
||||
DDX_Text(pDX, IDC_STAGE_TITLE, m_stage_title);
|
||||
DDX_Text(pDX, IDC_WAVE_FILENAME, m_wave_filename);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
DDV_MaxChars(pDX, m_text, CMD_BRIEF_TEXT_MAX - 1);
|
||||
DDV_MaxChars(pDX, m_ani_filename, MAX_FILENAME_LEN - 1);
|
||||
DDV_MaxChars(pDX, m_wave_filename, MAX_FILENAME_LEN - 1);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(cmd_brief_dlg, CDialog)
|
||||
//{{AFX_MSG_MAP(cmd_brief_dlg)
|
||||
ON_BN_CLICKED(IDC_NEXT, OnNext)
|
||||
ON_BN_CLICKED(IDC_PREV, OnPrev)
|
||||
ON_BN_CLICKED(IDC_ADD_STAGE, OnAddStage)
|
||||
ON_BN_CLICKED(IDC_INSERT_STAGE, OnInsertStage)
|
||||
ON_BN_CLICKED(IDC_DELETE_STAGE, OnDeleteStage)
|
||||
ON_BN_CLICKED(IDC_BROWSE_ANI, OnBrowseAni)
|
||||
ON_BN_CLICKED(IDC_BROWSE_WAVE, OnBrowseWave)
|
||||
ON_BN_CLICKED(IDC_PLAY, OnPlay)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cmd_brief_dlg message handlers
|
||||
|
||||
BOOL cmd_brief_dlg::OnInitDialog()
|
||||
{
|
||||
Cur_cmd_brief = Cmd_briefs; // default to first cmd briefing
|
||||
m_cur_stage = 0;
|
||||
last_cmd_brief = NULL;
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
m_play_bm.LoadBitmap(IDB_PLAY);
|
||||
((CButton *) GetDlgItem(IDC_PLAY)) -> SetBitmap(m_play_bm);
|
||||
|
||||
update_data();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::update_data(int update)
|
||||
{
|
||||
int enable;
|
||||
|
||||
if (update)
|
||||
UpdateData(TRUE);
|
||||
|
||||
// save previously editing data before we load over it.
|
||||
if (last_cmd_brief && m_last_stage >= 0 && m_last_stage < last_cmd_brief->num_stages) {
|
||||
char buf[CMD_BRIEF_TEXT_MAX];
|
||||
|
||||
if (last_cmd_brief->stage[m_last_stage].text)
|
||||
free(last_cmd_brief->stage[m_last_stage].text);
|
||||
|
||||
deconvert_multiline_string(buf, m_text, CMD_BRIEF_TEXT_MAX);
|
||||
lcl_fred_replace_stuff(buf, CMD_BRIEF_TEXT_MAX);
|
||||
last_cmd_brief->stage[m_last_stage].text = strdup(buf);
|
||||
string_copy(last_cmd_brief->stage[m_last_stage].ani_filename, m_ani_filename, MAX_FILENAME_LEN);
|
||||
string_copy(last_cmd_brief->stage[m_last_stage].wave_filename, m_wave_filename, MAX_FILENAME_LEN);
|
||||
}
|
||||
|
||||
// load data of new stage into dialog
|
||||
if (Cur_cmd_brief && Cur_cmd_brief->num_stages > 0) {
|
||||
if (m_cur_stage < 0 || m_cur_stage >= Cur_cmd_brief->num_stages)
|
||||
m_cur_stage = 0;
|
||||
|
||||
m_stage_title.Format("Stage %d of %d", m_cur_stage + 1, Cur_cmd_brief->num_stages);
|
||||
m_text = convert_multiline_string(Cur_cmd_brief->stage[m_cur_stage].text);
|
||||
m_ani_filename = Cur_cmd_brief->stage[m_cur_stage].ani_filename;
|
||||
m_wave_filename = Cur_cmd_brief->stage[m_cur_stage].wave_filename;
|
||||
enable = TRUE;
|
||||
|
||||
} else {
|
||||
m_stage_title = _T("No stages");
|
||||
m_text = _T("");
|
||||
m_ani_filename = _T("");
|
||||
m_wave_filename = _T("");
|
||||
enable = FALSE;
|
||||
m_cur_stage = -1;
|
||||
}
|
||||
|
||||
if (m_cur_stage < Cur_cmd_brief->num_stages - 1)
|
||||
GetDlgItem(IDC_NEXT) -> EnableWindow(enable);
|
||||
else
|
||||
GetDlgItem(IDC_NEXT) -> EnableWindow(FALSE);
|
||||
|
||||
if (m_cur_stage)
|
||||
GetDlgItem(IDC_PREV) -> EnableWindow(enable);
|
||||
else
|
||||
GetDlgItem(IDC_PREV) -> EnableWindow(FALSE);
|
||||
|
||||
if (Cur_cmd_brief->num_stages >= CMD_BRIEF_STAGES_MAX)
|
||||
GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(FALSE);
|
||||
else
|
||||
GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(TRUE);
|
||||
|
||||
if (Cur_cmd_brief->num_stages) {
|
||||
GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(enable);
|
||||
|
||||
} else {
|
||||
GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(FALSE);
|
||||
}
|
||||
|
||||
GetDlgItem(IDC_WAVE_FILENAME) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_ANI_FILENAME) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_BROWSE_ANI) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_BROWSE_WAVE) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_TEXT) -> EnableWindow(enable);
|
||||
|
||||
UpdateData(FALSE);
|
||||
|
||||
last_cmd_brief = Cur_cmd_brief;
|
||||
m_last_stage = m_cur_stage;
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnOK()
|
||||
{
|
||||
audiostream_close_file(m_wave_id, 0);
|
||||
m_wave_id = -1;
|
||||
|
||||
update_data();
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnNext()
|
||||
{
|
||||
audiostream_close_file(m_wave_id, 0);
|
||||
m_wave_id = -1;
|
||||
|
||||
m_cur_stage++;
|
||||
update_data();
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnPrev()
|
||||
{
|
||||
audiostream_close_file(m_wave_id, 0);
|
||||
m_wave_id = -1;
|
||||
|
||||
m_cur_stage--;
|
||||
update_data();
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnAddStage()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (Cur_cmd_brief->num_stages >= CMD_BRIEF_STAGES_MAX)
|
||||
return;
|
||||
|
||||
audiostream_close_file(m_wave_id, 0);
|
||||
m_wave_id = -1;
|
||||
|
||||
m_cur_stage = i = Cur_cmd_brief->num_stages++;
|
||||
copy_stage(i - 1, i);
|
||||
update_data(1);
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnInsertStage()
|
||||
{
|
||||
int i, z;
|
||||
|
||||
if (Cur_cmd_brief->num_stages >= CMD_BRIEF_STAGES_MAX)
|
||||
return;
|
||||
|
||||
if (!Cur_cmd_brief->num_stages) {
|
||||
OnAddStage();
|
||||
return;
|
||||
}
|
||||
|
||||
audiostream_close_file(m_wave_id, 0);
|
||||
m_wave_id = -1;
|
||||
|
||||
z = m_cur_stage;
|
||||
m_cur_stage = -1;
|
||||
update_data(1);
|
||||
for (i=Cur_cmd_brief->num_stages; i>z; i--)
|
||||
Cur_cmd_brief->stage[i] = Cur_cmd_brief->stage[i - 1];
|
||||
|
||||
Cur_cmd_brief->num_stages++;
|
||||
copy_stage(z, z + 1);
|
||||
m_cur_stage = z;
|
||||
m_last_stage = -1;
|
||||
update_data(0);
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnDeleteStage()
|
||||
{
|
||||
int i, z;
|
||||
|
||||
if (m_cur_stage < 0)
|
||||
return;
|
||||
|
||||
audiostream_close_file(m_wave_id, 0);
|
||||
m_wave_id = -1;
|
||||
|
||||
Assert(Cur_cmd_brief->num_stages);
|
||||
z = m_cur_stage;
|
||||
m_cur_stage = -1;
|
||||
update_data(1);
|
||||
if (Cur_cmd_brief->stage[z].text)
|
||||
free(Cur_cmd_brief->stage[z].text);
|
||||
|
||||
for (i=z+1; i<Cur_cmd_brief->num_stages; i++)
|
||||
Cur_cmd_brief->stage[i-1] = Cur_cmd_brief->stage[i];
|
||||
|
||||
Cur_cmd_brief->num_stages--;
|
||||
m_cur_stage = z;
|
||||
m_last_stage = -1;
|
||||
|
||||
if (m_cur_stage >= Cur_cmd_brief->num_stages)
|
||||
m_cur_stage = Cur_cmd_brief->num_stages - 1;
|
||||
|
||||
update_data(0);
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::copy_stage(int from, int to)
|
||||
{
|
||||
if ((from < 0) || (from >= Cur_cmd_brief->num_stages)) {
|
||||
Cur_cmd_brief->stage[to].text = strdup("<Text here>");
|
||||
strcpy_s(Cur_cmd_brief->stage[to].ani_filename, "<default>");
|
||||
strcpy_s(Cur_cmd_brief->stage[to].wave_filename, "none");
|
||||
return;
|
||||
}
|
||||
|
||||
Cur_cmd_brief->stage[to] = Cur_cmd_brief->stage[from];
|
||||
Cur_cmd_brief->stage[to].text = strdup(Cur_cmd_brief->stage[from].text);
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnBrowseAni()
|
||||
{
|
||||
int z;
|
||||
CString name;
|
||||
|
||||
UpdateData(TRUE);
|
||||
z = cfile_push_chdir(CF_TYPE_INTERFACE);
|
||||
CFileDialog dlg(TRUE, "ani", NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
|
||||
"Ani Files (*.ani)|*.ani|Avi Files (*.avi)|*.avi|Both (*.ani, *.avi)|*.ani;*.avi||");
|
||||
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
m_ani_filename = dlg.GetFileName();
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
if (!z)
|
||||
cfile_pop_dir();
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnBrowseWave()
|
||||
{
|
||||
int z;
|
||||
CString name;
|
||||
|
||||
audiostream_close_file(m_wave_id, 0);
|
||||
m_wave_id = -1;
|
||||
|
||||
UpdateData(TRUE);
|
||||
z = cfile_push_chdir(CF_TYPE_VOICE_CMD_BRIEF);
|
||||
CFileDialog dlg(TRUE, "wav", NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
|
||||
"Voice Files (*.ogg, *.wav)|*.ogg;*.wav|Ogg Vorbis Files (*.ogg)|*.ogg|Wave Files (*.wav)|*.wav||");
|
||||
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
m_wave_filename = dlg.GetFileName();
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
if (!z)
|
||||
cfile_pop_dir();
|
||||
}
|
||||
|
||||
BOOL cmd_brief_dlg::DestroyWindow()
|
||||
{
|
||||
audiostream_close_file(m_wave_id, 0);
|
||||
m_wave_id = -1;
|
||||
|
||||
m_play_bm.DeleteObject();
|
||||
return CDialog::DestroyWindow();
|
||||
}
|
||||
|
||||
void cmd_brief_dlg::OnPlay()
|
||||
{
|
||||
GetDlgItem(IDC_WAVE_FILENAME)->GetWindowText(m_wave_filename);
|
||||
|
||||
if (m_wave_id >= 0) {
|
||||
audiostream_close_file(m_wave_id, 0);
|
||||
m_wave_id = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
// we use ASF_EVENTMUSIC here so that it will keep the extension in place
|
||||
m_wave_id = audiostream_open((char *)(LPCSTR) m_wave_filename, ASF_EVENTMUSIC);
|
||||
|
||||
if (m_wave_id >= 0) {
|
||||
audiostream_play(m_wave_id, 1.0f, 0);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "missionui/missioncmdbrief.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// cmd_brief_dlg dialog
|
||||
|
||||
class cmd_brief_dlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
cmd_brief_dlg(CWnd* pParent = NULL); // standard constructor
|
||||
void update_data(int update = 1);
|
||||
void OnOK();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(cmd_brief_dlg)
|
||||
enum { IDD = IDD_CMD_BRIEF };
|
||||
CString m_ani_filename;
|
||||
CString m_text;
|
||||
CString m_stage_title;
|
||||
CString m_wave_filename;
|
||||
//}}AFX_DATA
|
||||
|
||||
CBitmap m_play_bm;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(cmd_brief_dlg)
|
||||
public:
|
||||
virtual BOOL DestroyWindow();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
int m_cur_stage;
|
||||
int m_last_stage;
|
||||
int m_wave_id;
|
||||
cmd_brief *last_cmd_brief;
|
||||
|
||||
void copy_stage(int from, int to);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(cmd_brief_dlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnNext();
|
||||
afx_msg void OnPrev();
|
||||
afx_msg void OnAddStage();
|
||||
afx_msg void OnInsertStage();
|
||||
afx_msg void OnDeleteStage();
|
||||
afx_msg void OnBrowseAni();
|
||||
afx_msg void OnBrowseWave();
|
||||
afx_msg void OnPlay();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// CreateWingDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "CreateWingDlg.h"
|
||||
#include "object/object.h"
|
||||
#include "object/waypoint.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "parse/parselo.h"
|
||||
#include "iff_defs/iff_defs.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// create_wing_dlg dialog
|
||||
|
||||
create_wing_dlg::create_wing_dlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(create_wing_dlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(create_wing_dlg)
|
||||
m_name = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void create_wing_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(create_wing_dlg)
|
||||
DDX_Text(pDX, IDC_NAME, m_name);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
DDV_MaxChars(pDX, m_name, NAME_LENGTH - 4);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(create_wing_dlg, CDialog)
|
||||
//{{AFX_MSG_MAP(create_wing_dlg)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// create_wing_dlg message handlers
|
||||
|
||||
void create_wing_dlg::OnOK()
|
||||
{
|
||||
CString msg;
|
||||
int i;
|
||||
object *ptr;
|
||||
|
||||
UpdateData(TRUE);
|
||||
UpdateData(TRUE);
|
||||
m_name = drop_white_space((char *)(LPCSTR) m_name);
|
||||
if (m_name.IsEmpty()) {
|
||||
MessageBox("You must give a name before you can continue.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i=0; i<MAX_WINGS; i++)
|
||||
if (!stricmp(Wings[i].name, m_name) && Wings[i].wave_count) {
|
||||
msg.Format("The name \"%s\" is already being used by another wing", m_name);
|
||||
MessageBox(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
ptr = GET_FIRST(&obj_used_list);
|
||||
while (ptr != END_OF_LIST(&obj_used_list)) {
|
||||
if ((ptr->type == OBJ_SHIP) || (ptr->type == OBJ_START)){
|
||||
i = ptr->instance;
|
||||
if (!strnicmp(m_name, Ships[i].ship_name, strlen(m_name))) {
|
||||
char *namep;
|
||||
|
||||
namep = Ships[i].ship_name + strlen(m_name);
|
||||
if (*namep == ' ') {
|
||||
namep++;
|
||||
while (*namep) {
|
||||
if (!isdigit(*namep))
|
||||
break;
|
||||
|
||||
namep++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!*namep) {
|
||||
MessageBox("This wing name is already being used by a ship");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ptr = GET_NEXT(ptr);
|
||||
}
|
||||
|
||||
for (i=0; i<Num_iffs; i++) {
|
||||
if (!stricmp(m_name, Iff_info[i].iff_name)) {
|
||||
msg.Format("The name \"%s\" is already being used by a team", m_name);
|
||||
MessageBox(msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for ( i=0; i < (int)Ai_tp_list.size(); i++) {
|
||||
if (!stricmp(m_name, Ai_tp_list[i].name)) {
|
||||
msg.Format("The name \"%s\" is already being used by a target priority group", m_name);
|
||||
MessageBox(msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (find_matching_waypoint_list(const_cast<char *>((const char *) m_name)) != NULL)
|
||||
{
|
||||
MessageBox("This wing name is already being used by a waypoint path");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stricmp(m_name.Left(1), "<")) {
|
||||
MessageBox("Wing names not allowed to begin with <");
|
||||
return;
|
||||
}
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// CreateWingDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// create_wing_dlg dialog
|
||||
|
||||
class create_wing_dlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void OnOK();
|
||||
create_wing_dlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(create_wing_dlg)
|
||||
enum { IDD = IDD_WING_CREATE };
|
||||
CString m_name;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(create_wing_dlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(create_wing_dlg)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
@@ -1,172 +0,0 @@
|
||||
// CustomWingNames.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "fred.h"
|
||||
#include "CustomWingNames.h"
|
||||
#include "ship/ship.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CustomWingNames dialog
|
||||
|
||||
|
||||
CustomWingNames::CustomWingNames(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CustomWingNames::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CustomWingNames)
|
||||
m_squadron_1 = _T("");
|
||||
m_squadron_2 = _T("");
|
||||
m_squadron_3 = _T("");
|
||||
m_squadron_4 = _T("");
|
||||
m_squadron_5 = _T("");
|
||||
m_starting_1 = _T("");
|
||||
m_starting_2 = _T("");
|
||||
m_starting_3 = _T("");
|
||||
m_tvt_1 = _T("");
|
||||
m_tvt_2 = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CustomWingNames::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CustomWingNames)
|
||||
DDX_Text(pDX, IDC_SQUADRON_WING_NAME_1, m_squadron_1);
|
||||
DDX_Text(pDX, IDC_SQUADRON_WING_NAME_2, m_squadron_2);
|
||||
DDX_Text(pDX, IDC_SQUADRON_WING_NAME_3, m_squadron_3);
|
||||
DDX_Text(pDX, IDC_SQUADRON_WING_NAME_4, m_squadron_4);
|
||||
DDX_Text(pDX, IDC_SQUADRON_WING_NAME_5, m_squadron_5);
|
||||
DDX_Text(pDX, IDC_STARTING_WING_NAME_1, m_starting_1);
|
||||
DDX_Text(pDX, IDC_STARTING_WING_NAME_2, m_starting_2);
|
||||
DDX_Text(pDX, IDC_STARTING_WING_NAME_3, m_starting_3);
|
||||
DDX_Text(pDX, IDC_TVT_WING_NAME_1, m_tvt_1);
|
||||
DDX_Text(pDX, IDC_TVT_WING_NAME_2, m_tvt_2);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CustomWingNames, CDialog)
|
||||
//{{AFX_MSG_MAP(CustomWingNames)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CustomWingNames message handlers
|
||||
|
||||
BOOL CustomWingNames::OnInitDialog()
|
||||
{
|
||||
// init starting wings
|
||||
m_starting_1 = _T(Starting_wing_names[0]);
|
||||
m_starting_2 = _T(Starting_wing_names[1]);
|
||||
m_starting_3 = _T(Starting_wing_names[2]);
|
||||
|
||||
// init squadron wings
|
||||
m_squadron_1 = _T(Squadron_wing_names[0]);
|
||||
m_squadron_2 = _T(Squadron_wing_names[1]);
|
||||
m_squadron_3 = _T(Squadron_wing_names[2]);
|
||||
m_squadron_4 = _T(Squadron_wing_names[3]);
|
||||
m_squadron_5 = _T(Squadron_wing_names[4]);
|
||||
|
||||
// init tvt wings
|
||||
m_tvt_1 = _T(TVT_wing_names[0]);
|
||||
m_tvt_2 = _T(TVT_wing_names[1]);
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
UpdateData(FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CustomWingNames::OnOK()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
|
||||
if (strcmp(m_starting_1, m_tvt_1))
|
||||
{
|
||||
MessageBox("The first starting wing and the first team-versus-team wing must have the same wing name.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stricmp(m_starting_1, m_starting_2) || !stricmp(m_starting_1, m_starting_3)
|
||||
|| !stricmp(m_starting_2, m_starting_3))
|
||||
{
|
||||
MessageBox("Duplicate wing names in starting wing list.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stricmp(m_squadron_1, m_squadron_2) || !stricmp(m_squadron_1, m_squadron_3) || !stricmp(m_squadron_1, m_squadron_4) || !stricmp(m_squadron_1, m_squadron_5)
|
||||
|| !stricmp(m_squadron_2, m_squadron_3) || !stricmp(m_squadron_2, m_squadron_4) || !stricmp(m_squadron_2, m_squadron_5)
|
||||
|| !stricmp(m_squadron_3, m_squadron_4) || !stricmp(m_squadron_3, m_squadron_5)
|
||||
|| !stricmp(m_squadron_4, m_squadron_5))
|
||||
{
|
||||
MessageBox("Duplicate wing names in squadron wing list.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!stricmp(m_tvt_1, m_tvt_2))
|
||||
{
|
||||
MessageBox("Duplicate wing names in team-versus-team wing list.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// copy starting wings
|
||||
strcpy_s(Starting_wing_names[0], m_starting_1);
|
||||
strcpy_s(Starting_wing_names[1], m_starting_2);
|
||||
strcpy_s(Starting_wing_names[2], m_starting_3);
|
||||
|
||||
// copy squadron wings
|
||||
strcpy_s(Squadron_wing_names[0], m_squadron_1);
|
||||
strcpy_s(Squadron_wing_names[1], m_squadron_2);
|
||||
strcpy_s(Squadron_wing_names[2], m_squadron_3);
|
||||
strcpy_s(Squadron_wing_names[3], m_squadron_4);
|
||||
strcpy_s(Squadron_wing_names[4], m_squadron_5);
|
||||
|
||||
// copy tvt wings
|
||||
strcpy_s(TVT_wing_names[0], m_tvt_1);
|
||||
strcpy_s(TVT_wing_names[1], m_tvt_2);
|
||||
|
||||
update_custom_wing_indexes();
|
||||
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
void CustomWingNames::OnCancel()
|
||||
{
|
||||
// TODO: Add extra cleanup here
|
||||
|
||||
CDialog::OnCancel();
|
||||
}
|
||||
|
||||
void CustomWingNames::OnClose()
|
||||
{
|
||||
int z;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
if (query_modified()) {
|
||||
z = MessageBox("Do you want to keep your changes?", "Close", MB_ICONQUESTION | MB_YESNOCANCEL);
|
||||
if (z == IDCANCEL){
|
||||
return;
|
||||
}
|
||||
|
||||
if (z == IDYES) {
|
||||
OnOK();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CDialog::OnClose();
|
||||
}
|
||||
|
||||
int CustomWingNames::query_modified()
|
||||
{
|
||||
return strcmp(Starting_wing_names[0], m_starting_1) || strcmp(Starting_wing_names[1], m_starting_2) || strcmp(Starting_wing_names[2], m_starting_3)
|
||||
|| strcmp(Squadron_wing_names[0], m_squadron_1) || strcmp(Squadron_wing_names[1], m_squadron_2) || strcmp(Squadron_wing_names[2], m_squadron_3) || strcmp(Squadron_wing_names[3], m_squadron_4) || strcmp(Squadron_wing_names[4], m_squadron_5)
|
||||
|| strcmp(TVT_wing_names[0], m_tvt_1) || strcmp(TVT_wing_names[1], m_tvt_2);
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
#if !defined(AFX_USTOMWINGNAME_H__D30D7519_D2C9_4907_8D87_EDB690B30608__INCLUDED_)
|
||||
#define AFX_USTOMWINGNAME_H__D30D7519_D2C9_4907_8D87_EDB690B30608__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// CustomWingNames.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CustomWingNames dialog
|
||||
|
||||
class CustomWingNames : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CustomWingNames(CWnd* pParent = NULL); // standard constructor
|
||||
int query_modified();
|
||||
void OnOK();
|
||||
void OnCancel();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CustomWingNames)
|
||||
enum { IDD = IDD_CUSTOM_WING_NAMES };
|
||||
CString m_squadron_1;
|
||||
CString m_squadron_2;
|
||||
CString m_squadron_3;
|
||||
CString m_squadron_4;
|
||||
CString m_squadron_5;
|
||||
CString m_starting_1;
|
||||
CString m_starting_2;
|
||||
CString m_starting_3;
|
||||
CString m_tvt_1;
|
||||
CString m_tvt_2;
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CustomWingNames)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CustomWingNames)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnClose();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_USTOMWINGNAME_H__D30D7519_D2C9_4907_8D87_EDB690B30608__INCLUDED_)
|
||||
@@ -1,499 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "DebriefingEditorDlg.h"
|
||||
#include "FREDDoc.h"
|
||||
#include "mission/missionbriefcommon.h"
|
||||
#include "mission/missionparse.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "parse/sexp.h"
|
||||
#include "gamesnd/eventmusic.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "sound/audiostr.h"
|
||||
#include "localization/localize.h"
|
||||
#include "jumpnode/jumpnode.h"
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// debriefing_editor_dlg dialog
|
||||
|
||||
debriefing_editor_dlg::debriefing_editor_dlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(debriefing_editor_dlg::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(debriefing_editor_dlg)
|
||||
m_text = _T("");
|
||||
m_voice = _T("");
|
||||
m_stage_title = _T("");
|
||||
m_rec_text = _T("");
|
||||
m_debriefPass_music = 0;
|
||||
m_debriefAvg_music = 0;
|
||||
m_debriefFail_music = 0;
|
||||
m_current_debriefing = -1;
|
||||
//}}AFX_DATA_INIT
|
||||
|
||||
modified = 0;
|
||||
m_cur_stage = 0;
|
||||
m_last_stage = -1;
|
||||
m_voice_id = -1;
|
||||
select_sexp_node = -1;
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(debriefing_editor_dlg)
|
||||
DDX_Control(pDX, IDC_TREE, m_tree);
|
||||
DDX_Text(pDX, IDC_TEXT, m_text);
|
||||
DDX_Text(pDX, IDC_VOICE, m_voice);
|
||||
DDX_Text(pDX, IDC_STAGE_TITLE, m_stage_title);
|
||||
DDX_Text(pDX, IDC_REC_TEXT, m_rec_text);
|
||||
DDX_CBIndex(pDX, IDC_SUCCESSFUL_MISSION_TRACK, m_debriefPass_music);
|
||||
DDX_CBIndex(pDX, IDC_DEBRIEFING_TRACK, m_debriefAvg_music);
|
||||
DDX_CBIndex(pDX, IDC_FAILED_MISSION_TRACK, m_debriefFail_music);
|
||||
//}}AFX_DATA_MAP
|
||||
|
||||
DDV_MaxChars(pDX, m_text, MAX_BRIEF_LEN - 1);
|
||||
DDV_MaxChars(pDX, m_voice, MAX_FILENAME_LEN - 1);
|
||||
DDV_MaxChars(pDX, m_rec_text, MAX_RECOMMENDATION_LEN - 1);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(debriefing_editor_dlg, CDialog)
|
||||
//{{AFX_MSG_MAP(debriefing_editor_dlg)
|
||||
ON_BN_CLICKED(IDC_NEXT, OnNext)
|
||||
ON_BN_CLICKED(IDC_PREV, OnPrev)
|
||||
ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
|
||||
ON_BN_CLICKED(IDC_ADD_STAGE, OnAddStage)
|
||||
ON_BN_CLICKED(IDC_DELETE_STAGE, OnDeleteStage)
|
||||
ON_BN_CLICKED(IDC_INSERT_STAGE, OnInsertStage)
|
||||
ON_NOTIFY(NM_RCLICK, IDC_TREE, OnRclickTree)
|
||||
ON_NOTIFY(TVN_BEGINLABELEDIT, IDC_TREE, OnBeginlabeleditTree)
|
||||
ON_NOTIFY(TVN_ENDLABELEDIT, IDC_TREE, OnEndlabeleditTree)
|
||||
ON_WM_CLOSE()
|
||||
ON_WM_INITMENU()
|
||||
ON_BN_CLICKED(IDC_PLAY, OnPlay)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// debriefing_editor_dlg message handlers
|
||||
|
||||
void debriefing_editor_dlg::OnInitMenu(CMenu* pMenu)
|
||||
{
|
||||
int i;
|
||||
CMenu *m;
|
||||
|
||||
// disable any items we should disable
|
||||
m = pMenu->GetSubMenu(0);
|
||||
|
||||
// uncheck all menu items
|
||||
for (i = 0; i < Num_teams; i++ )
|
||||
m->CheckMenuItem( i, MF_BYPOSITION | MF_UNCHECKED );
|
||||
|
||||
for ( i = Num_teams; i < MAX_TVT_TEAMS; i++ )
|
||||
m->EnableMenuItem(i, MF_BYPOSITION | MF_GRAYED);
|
||||
|
||||
|
||||
// put a check next to the currently selected item
|
||||
m->CheckMenuItem(m_current_debriefing, MF_BYPOSITION | MF_CHECKED );
|
||||
|
||||
// Karajorma - it might be nice to autobalance the briefings and debriefings but I'm not doing anything till I
|
||||
// understand how the how system works better. disabling the option for now.
|
||||
m = pMenu->GetSubMenu(1);
|
||||
m->EnableMenuItem(ID_AUTOBALANCE, MF_GRAYED);
|
||||
|
||||
CDialog::OnInitMenu(pMenu);
|
||||
}
|
||||
|
||||
BOOL debriefing_editor_dlg::OnInitDialog()
|
||||
{
|
||||
int i, n;
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
m_play_bm.LoadBitmap(IDB_PLAY);
|
||||
((CButton *) GetDlgItem(IDC_PLAY)) -> SetBitmap(m_play_bm);
|
||||
CComboBox *box;
|
||||
box = (CComboBox *) GetDlgItem(IDC_ICON_IMAGE);
|
||||
|
||||
m_current_debriefing = 0;
|
||||
UpdateData(FALSE);
|
||||
|
||||
Debriefing = &Debriefings[m_current_debriefing];
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_SUCCESSFUL_MISSION_TRACK);
|
||||
box->AddString("None");
|
||||
for (i=0; i<Num_music_files; i++)
|
||||
box->AddString(Spooled_music[i].name);
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_DEBRIEFING_TRACK);
|
||||
box->AddString("None");
|
||||
for (i=0; i<Num_music_files; i++)
|
||||
box->AddString(Spooled_music[i].name);
|
||||
|
||||
box = (CComboBox *) GetDlgItem(IDC_FAILED_MISSION_TRACK);
|
||||
box->AddString("None");
|
||||
for (i=0; i<Num_music_files; i++)
|
||||
box->AddString(Spooled_music[i].name);
|
||||
|
||||
m_debriefPass_music = Mission_music[SCORE_DEBRIEF_SUCCESS] + 1;
|
||||
m_debriefAvg_music = Mission_music[SCORE_DEBRIEF_AVERAGE] + 1;
|
||||
m_debriefFail_music = Mission_music[SCORE_DEBRIEF_FAIL] + 1;
|
||||
|
||||
m_tree.link_modified(&modified); // provide way to indicate trees are modified in dialog
|
||||
n = m_tree.select_sexp_node = select_sexp_node;
|
||||
select_sexp_node = -1;
|
||||
if (n != -1) {
|
||||
for (i=0; i<Debriefing->num_stages; i++)
|
||||
if (query_node_in_sexp(n, Debriefing->stages[i].formula))
|
||||
break;
|
||||
|
||||
if (i < Debriefing->num_stages) {
|
||||
m_cur_stage = i;
|
||||
update_data();
|
||||
GetDlgItem(IDC_TREE) -> SetFocus();
|
||||
m_tree.hilite_item(m_tree.select_sexp_node);
|
||||
set_modified();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
CDialog::OnInitDialog();
|
||||
update_data();
|
||||
set_modified();
|
||||
|
||||
// hard coded stuff to deal with the multiple briefings per mission.
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::update_data(int update)
|
||||
{
|
||||
int enable, save_debriefing;
|
||||
debrief_stage *ptr;
|
||||
|
||||
save_debriefing = m_current_debriefing;
|
||||
|
||||
if (update)
|
||||
UpdateData(TRUE);
|
||||
|
||||
// based on the game type, enable the multiple briefings combo box (or disable it)
|
||||
|
||||
// set up the pointer to the briefing that we are editing
|
||||
if ( save_debriefing != m_current_debriefing )
|
||||
Debriefing = &Debriefings[save_debriefing];
|
||||
else
|
||||
Debriefing = &Debriefings[m_current_debriefing];
|
||||
|
||||
if (m_last_stage >= 0) {
|
||||
ptr = &Debriefing->stages[m_last_stage];
|
||||
if (ptr->formula >= 0)
|
||||
free_sexp2(ptr->formula);
|
||||
|
||||
ptr->formula = m_tree.save_tree();
|
||||
deconvert_multiline_string(ptr->new_text, m_text, MAX_DEBRIEF_LEN);
|
||||
lcl_fred_replace_stuff(ptr->new_text, MAX_DEBRIEF_LEN);
|
||||
deconvert_multiline_string(ptr->new_recommendation_text, m_rec_text, MAX_RECOMMENDATION_LEN);
|
||||
lcl_fred_replace_stuff(ptr->new_recommendation_text,MAX_RECOMMENDATION_LEN);
|
||||
string_copy(ptr->voice, m_voice, MAX_FILENAME_LEN);
|
||||
}
|
||||
|
||||
// now get new stage data
|
||||
if ((m_cur_stage >= 0) && (m_cur_stage < Debriefing->num_stages)) {
|
||||
ptr = &Debriefing->stages[m_cur_stage];
|
||||
m_stage_title.Format("Stage %d of %d", m_cur_stage + 1, Debriefing->num_stages);
|
||||
m_tree.load_tree(ptr->formula);
|
||||
m_text = convert_multiline_string(ptr->new_text);
|
||||
m_rec_text = convert_multiline_string(ptr->new_recommendation_text);
|
||||
m_voice = ptr->voice;
|
||||
enable = TRUE;
|
||||
|
||||
} else {
|
||||
m_stage_title = _T("No stages");
|
||||
m_tree.clear_tree();
|
||||
m_text = _T("");
|
||||
m_rec_text = _T("");
|
||||
m_voice = _T("");
|
||||
enable = FALSE;
|
||||
m_cur_stage = -1;
|
||||
}
|
||||
|
||||
if (m_cur_stage == Debriefing->num_stages - 1)
|
||||
GetDlgItem(IDC_NEXT) -> EnableWindow(FALSE);
|
||||
else
|
||||
GetDlgItem(IDC_NEXT) -> EnableWindow(enable);
|
||||
|
||||
if (m_cur_stage)
|
||||
GetDlgItem(IDC_PREV) -> EnableWindow(enable);
|
||||
else
|
||||
GetDlgItem(IDC_PREV) -> EnableWindow(FALSE);
|
||||
|
||||
if (Debriefing->num_stages >= MAX_DEBRIEF_STAGES)
|
||||
GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(FALSE);
|
||||
else
|
||||
GetDlgItem(IDC_ADD_STAGE) -> EnableWindow(TRUE);
|
||||
|
||||
if (Debriefing->num_stages) {
|
||||
GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(enable);
|
||||
|
||||
} else {
|
||||
GetDlgItem(IDC_DELETE_STAGE) -> EnableWindow(FALSE);
|
||||
GetDlgItem(IDC_INSERT_STAGE) -> EnableWindow(FALSE);
|
||||
}
|
||||
|
||||
GetDlgItem(IDC_VOICE) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_BROWSE) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_TEXT) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_REC_TEXT) -> EnableWindow(enable);
|
||||
GetDlgItem(IDC_TREE) -> EnableWindow(enable);
|
||||
|
||||
m_last_stage = m_cur_stage;
|
||||
UpdateData(FALSE);
|
||||
|
||||
#ifndef NDEBUG
|
||||
count_free_sexp_nodes();
|
||||
#endif
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnNext()
|
||||
{
|
||||
audiostream_close_file(m_voice_id, 0);
|
||||
m_voice_id = -1;
|
||||
|
||||
m_cur_stage++;
|
||||
update_data();
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnPrev()
|
||||
{
|
||||
audiostream_close_file(m_voice_id, 0);
|
||||
m_voice_id = -1;
|
||||
|
||||
m_cur_stage--;
|
||||
update_data();
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnBrowse()
|
||||
{
|
||||
int z;
|
||||
CString name;
|
||||
|
||||
audiostream_close_file(m_voice_id, 0);
|
||||
m_voice_id = -1;
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
if (The_mission.game_type & MISSION_TYPE_TRAINING)
|
||||
z = cfile_push_chdir(CF_TYPE_VOICE_TRAINING);
|
||||
else
|
||||
z = cfile_push_chdir(CF_TYPE_VOICE_DEBRIEFINGS);
|
||||
|
||||
CFileDialog dlg(TRUE, "wav", NULL, OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
|
||||
"Voice Files (*.ogg, *.wav)|*.ogg;*.wav|Ogg Vorbis Files (*.ogg)|*.ogg|Wave Files (*.wav)|*.wav||");
|
||||
|
||||
if (dlg.DoModal() == IDOK) {
|
||||
m_voice = dlg.GetFileName();
|
||||
UpdateData(FALSE);
|
||||
}
|
||||
|
||||
if (!z)
|
||||
cfile_pop_dir();
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnAddStage()
|
||||
{
|
||||
int i;
|
||||
|
||||
if (Debriefing->num_stages >= MAX_DEBRIEF_STAGES)
|
||||
return;
|
||||
|
||||
audiostream_close_file(m_voice_id, 0);
|
||||
m_voice_id = -1;
|
||||
|
||||
m_cur_stage = i = Debriefing->num_stages++;
|
||||
copy_stage(i - 1, i, 1);
|
||||
update_data(1);
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnDeleteStage()
|
||||
{
|
||||
int i, z;
|
||||
|
||||
if (m_cur_stage < 0)
|
||||
return;
|
||||
|
||||
audiostream_close_file(m_voice_id, 0);
|
||||
m_voice_id = -1;
|
||||
|
||||
Assert(Debriefing->num_stages);
|
||||
z = m_cur_stage;
|
||||
m_cur_stage = -1;
|
||||
update_data(1);
|
||||
for (i=z+1; i<Debriefing->num_stages; i++) {
|
||||
copy_stage(i, i - 1);
|
||||
}
|
||||
|
||||
Debriefing->num_stages--;
|
||||
m_cur_stage = z;
|
||||
if (m_cur_stage >= Debriefing->num_stages)
|
||||
m_cur_stage = Debriefing->num_stages - 1;
|
||||
|
||||
update_data(0);
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnInsertStage()
|
||||
{
|
||||
int i, z;
|
||||
|
||||
if (Debriefing->num_stages >= MAX_DEBRIEF_STAGES)
|
||||
return;
|
||||
|
||||
if (!Debriefing->num_stages) {
|
||||
OnAddStage();
|
||||
return;
|
||||
}
|
||||
|
||||
audiostream_close_file(m_voice_id, 0);
|
||||
m_voice_id = -1;
|
||||
|
||||
z = m_cur_stage;
|
||||
m_cur_stage = -1;
|
||||
update_data(1);
|
||||
for (i=Debriefing->num_stages; i>z; i--) {
|
||||
copy_stage(i - 1, i);
|
||||
}
|
||||
|
||||
Debriefing->num_stages++;
|
||||
copy_stage(z, z + 1);
|
||||
Debriefing->stages[z].formula = -1;
|
||||
m_cur_stage = z;
|
||||
update_data(0);
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::copy_stage(int from, int to, int clear_formula)
|
||||
{
|
||||
if ((from < 0) || (from >= Debriefing->num_stages)) {
|
||||
strcpy(Debriefing->stages[to].new_text, "<Text here>");
|
||||
strcpy_s(Debriefing->stages[to].voice, "none.wav");
|
||||
Debriefing->stages[to].formula = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (clear_formula)
|
||||
Debriefing->stages[to].formula = -1;
|
||||
else
|
||||
Debriefing->stages[to].formula = Debriefing->stages[from].formula;
|
||||
|
||||
strcpy( Debriefing->stages[to].new_text, Debriefing->stages[from].new_text );
|
||||
strcpy_s( Debriefing->stages[to].voice, Debriefing->stages[from].voice );
|
||||
strcpy( Debriefing->stages[to].new_recommendation_text, Debriefing->stages[from].new_recommendation_text );
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnRclickTree(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
m_tree.right_clicked();
|
||||
*pResult = 0;
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnBeginlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
|
||||
|
||||
if (m_tree.edit_label(pTVDispInfo->item.hItem) == 1) {
|
||||
*pResult = 0;
|
||||
modified = 1;
|
||||
|
||||
} else
|
||||
*pResult = 1;
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnEndlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
{
|
||||
TV_DISPINFO* pTVDispInfo = (TV_DISPINFO*)pNMHDR;
|
||||
|
||||
*pResult = m_tree.end_label_edit(pTVDispInfo->item);
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnClose()
|
||||
{
|
||||
audiostream_close_file(m_voice_id, 0);
|
||||
m_voice_id = -1;
|
||||
m_cur_stage = -1;
|
||||
update_data(1);
|
||||
|
||||
Mission_music[SCORE_DEBRIEF_SUCCESS] = m_debriefPass_music - 1;
|
||||
Mission_music[SCORE_DEBRIEF_AVERAGE] = m_debriefAvg_music - 1;
|
||||
Mission_music[SCORE_DEBRIEF_FAIL] = m_debriefFail_music - 1;
|
||||
|
||||
CDialog::OnClose();
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnOK()
|
||||
{
|
||||
}
|
||||
|
||||
BOOL debriefing_editor_dlg::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
int id;
|
||||
|
||||
// deal with figuring out menu stuff
|
||||
id = LOWORD(wParam);
|
||||
if ( (id >= ID_TEAM_1) && (id < ID_TEAM_3) ) {
|
||||
update_data(1);
|
||||
|
||||
// set the current debriefing
|
||||
m_current_debriefing = id - ID_TEAM_1;
|
||||
|
||||
// put user back at first stage for this team (or no current stage is there are none).
|
||||
Debriefing = &Debriefings[m_current_debriefing];
|
||||
if ( Debriefing->num_stages > 0 )
|
||||
m_cur_stage = 0;
|
||||
else
|
||||
m_cur_stage = -1;
|
||||
|
||||
m_last_stage = -1;
|
||||
update_data(0);
|
||||
}
|
||||
|
||||
return CDialog::OnCommand(wParam, lParam);
|
||||
}
|
||||
|
||||
BOOL debriefing_editor_dlg::DestroyWindow()
|
||||
{
|
||||
audiostream_close_file(m_voice_id, 0);
|
||||
m_play_bm.DeleteObject();
|
||||
return CDialog::DestroyWindow();
|
||||
}
|
||||
|
||||
void debriefing_editor_dlg::OnPlay()
|
||||
{
|
||||
GetDlgItem(IDC_VOICE)->GetWindowText(m_voice);
|
||||
|
||||
if (m_voice_id >= 0) {
|
||||
audiostream_close_file(m_voice_id, 0);
|
||||
m_voice_id = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
// we use ASF_EVENTMUSIC here so that it will keep the extension in place
|
||||
m_voice_id = audiostream_open((char *)(LPCSTR) m_voice, ASF_EVENTMUSIC);
|
||||
|
||||
if (m_voice_id >= 0) {
|
||||
audiostream_play(m_voice_id, 1.0f, 0);
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "mission/missionbriefcommon.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// debriefing_editor_dlg dialog
|
||||
|
||||
class debriefing_editor_dlg : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void OnOK();
|
||||
void update_data(int update = 1);
|
||||
debriefing_editor_dlg(CWnd* pParent = NULL); // standard constructor
|
||||
int select_sexp_node;
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(debriefing_editor_dlg)
|
||||
enum { IDD = IDD_DEBRIEFING_EDITOR };
|
||||
sexp_tree m_tree;
|
||||
CString m_text;
|
||||
CString m_voice;
|
||||
CString m_stage_title;
|
||||
CString m_rec_text;
|
||||
int m_debriefPass_music;
|
||||
int m_debriefAvg_music;
|
||||
int m_debriefFail_music;
|
||||
int m_current_debriefing;
|
||||
//}}AFX_DATA
|
||||
|
||||
CBitmap m_play_bm;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(debriefing_editor_dlg)
|
||||
public:
|
||||
virtual BOOL DestroyWindow();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
int m_cur_stage;
|
||||
int m_last_stage;
|
||||
int m_voice_id;
|
||||
int modified;
|
||||
|
||||
void copy_stage(int from, int to, int clear_formula = 0);
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(debriefing_editor_dlg)
|
||||
afx_msg void OnNext();
|
||||
afx_msg void OnPrev();
|
||||
afx_msg void OnBrowse();
|
||||
afx_msg void OnAddStage();
|
||||
afx_msg void OnDeleteStage();
|
||||
afx_msg void OnInsertStage();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnRclickTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnBeginlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnEndlabeleditTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnInitMenu(CMenu* pMenu);
|
||||
afx_msg void OnPlay();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "dialog1.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// dialog1 dialog
|
||||
|
||||
dialog1::dialog1(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(dialog1::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(dialog1)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void dialog1::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(dialog1)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(dialog1, CDialog)
|
||||
//{{AFX_MSG_MAP(dialog1)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// dialog1 message handlers
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// dialog1 dialog
|
||||
|
||||
class dialog1 : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
dialog1(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(dialog1)
|
||||
enum { IDD = IDD_HELP_INPUT_INTERFACE };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(dialog1)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(dialog1)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
@@ -1,882 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// DumpStats.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "FRED.h"
|
||||
#include "DumpStats.h"
|
||||
#include "starfield/starfield.h"
|
||||
#include "nebula/neb.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "globalincs/linklist.h"
|
||||
#include "object/object.h"
|
||||
#include "object/waypoint.h"
|
||||
#include "jumpnode/jumpnode.h"
|
||||
#include "mission/missiongoals.h"
|
||||
#include "gamesnd/eventmusic.h"
|
||||
#include "asteroid/asteroid.h"
|
||||
#include "species_defs/species_defs.h"
|
||||
#include "weapon/weapon.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DumpStats dialog
|
||||
|
||||
|
||||
DumpStats::DumpStats(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(DumpStats::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(DumpStats)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void DumpStats::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(DumpStats)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(DumpStats, CDialog)
|
||||
//{{AFX_MSG_MAP(DumpStats)
|
||||
ON_BN_CLICKED(IDC_DUMP_TO_FILE, OnDumpToFile)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DumpStats message handlers
|
||||
|
||||
BOOL DumpStats::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CString buffer;
|
||||
int i;
|
||||
|
||||
// get author, title, etc
|
||||
get_mission_stats(buffer);
|
||||
|
||||
// get nebula, stars, etc.
|
||||
get_background_stats(buffer);
|
||||
|
||||
// get number or ships, waypoints, start points, etc.
|
||||
get_object_stats(buffer);
|
||||
|
||||
// get objectives / goals
|
||||
get_objectives_and_goals(buffer);
|
||||
|
||||
// get ship selection for player wings
|
||||
get_ship_weapon_selection(buffer);
|
||||
|
||||
// get messaging info
|
||||
get_messaging_info(buffer);
|
||||
|
||||
// get species ship breakdown
|
||||
get_species_ship_breakdown(buffer);
|
||||
|
||||
// get default loadouts
|
||||
get_default_ship_loadouts(buffer);
|
||||
|
||||
int num_tab_stops = 5;
|
||||
int tab_stops[5];
|
||||
for (i=0; i<5; i++) {
|
||||
tab_stops[i] = (i+1) * 16;
|
||||
}
|
||||
|
||||
((CEdit*) GetDlgItem(IDC_STATS_TEXT))->SetTabStops(num_tab_stops, tab_stops);
|
||||
((CEdit*) GetDlgItem(IDC_STATS_TEXT))->SetWindowText(buffer);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void DumpStats::OnDumpToFile()
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
|
||||
// get dump from window
|
||||
CString buffer;
|
||||
((CEdit*) GetDlgItem(IDC_STATS_TEXT))->GetWindowText(buffer);
|
||||
|
||||
CString dump_filename;
|
||||
dump_filename.Format("%s.dmp", Mission_filename);
|
||||
|
||||
CFILE *fp;
|
||||
|
||||
fp = cfopen((char *)LPCTSTR(dump_filename), "wt", CFILE_NORMAL, CF_TYPE_MISSIONS);
|
||||
cfputs((char *)LPCTSTR(buffer), fp);
|
||||
cfclose(fp);
|
||||
}
|
||||
|
||||
void DumpStats::get_mission_stats(CString &buffer)
|
||||
{
|
||||
CString temp;
|
||||
|
||||
// Mission info
|
||||
buffer += "\t MISSION INFO\r\n";
|
||||
|
||||
temp.Format("Title: %s\r\n", The_mission.name);
|
||||
buffer += temp;
|
||||
|
||||
temp.Format("Filename: %s\r\n", Mission_filename);
|
||||
buffer += temp;
|
||||
|
||||
temp.Format("Author: %s\r\n", The_mission.author);
|
||||
buffer += temp;
|
||||
|
||||
temp.Format("Description: %s\r\n", The_mission.mission_desc);
|
||||
buffer += temp;
|
||||
|
||||
temp.Format("Notes: %s\r\n", The_mission.notes);
|
||||
buffer += temp;
|
||||
|
||||
if (The_mission.game_type & MISSION_TYPE_SINGLE) {
|
||||
temp.Format("Mission type: Single Player\r\n");
|
||||
} else if (The_mission.game_type & MISSION_TYPE_MULTI_COOP) {
|
||||
temp.Format("Mission type: Multi Coop\r\n");
|
||||
} else if (The_mission.game_type & MISSION_TYPE_MULTI_TEAMS) {
|
||||
temp.Format("Mission type: Multi Team vs. Team\r\n");
|
||||
} else if (The_mission.game_type & MISSION_TYPE_MULTI_DOGFIGHT) {
|
||||
temp.Format("Mission type: Dogfight\r\n");
|
||||
}
|
||||
buffer += temp;
|
||||
|
||||
if (The_mission.game_type & MISSION_TYPE_MULTI) {
|
||||
temp.Format("\tNum respawns: %d\r\n", The_mission.num_respawns);
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
if (Current_soundtrack_num >= 0) {
|
||||
temp.Format("\tMusic: %s\r\n", Soundtracks[Current_soundtrack_num].name);
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
if (The_mission.flags & MISSION_FLAG_RED_ALERT) {
|
||||
buffer += "\tRed Alert\r\n";
|
||||
}
|
||||
|
||||
if (The_mission.flags & MISSION_FLAG_SCRAMBLE) {
|
||||
buffer += "\tScramble\r\n";
|
||||
}
|
||||
|
||||
if (The_mission.flags & MISSION_FLAG_NO_PROMOTION) {
|
||||
buffer += "\tNo Promotions\r\n";
|
||||
}
|
||||
|
||||
if (The_mission.support_ships.max_support_ships == 0) {
|
||||
buffer += "\tNo Support ships\r\n";
|
||||
}
|
||||
|
||||
temp.Format("Squadron: %s, Squadron logo: %s\r\n", The_mission.squad_name, The_mission.squad_filename);
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
void DumpStats::get_background_stats(CString &buffer)
|
||||
{
|
||||
CString temp;
|
||||
int i;
|
||||
|
||||
// Background
|
||||
buffer += "\r\n\tBACKGROUND INFO\r\n";
|
||||
|
||||
// Num stars
|
||||
temp.Format("Num_stars: %d\r\n", Num_stars);
|
||||
buffer += temp;
|
||||
|
||||
// Suns
|
||||
temp.Format("Num_suns: %d\r\n", stars_get_num_suns());
|
||||
buffer += temp;
|
||||
|
||||
for (i=0; i<stars_get_num_suns(); i++) {
|
||||
temp.Format("\tSun%d bitmap name: %s\r\n", i, stars_get_sun_name(i));
|
||||
buffer += temp;
|
||||
//temp.Format("Sun%d glow name: %s\r\n", i, Suns[i].glow_filename);
|
||||
//buffer += temp;
|
||||
}
|
||||
|
||||
// Starfield bitmaps
|
||||
temp.Format("Num_starfield_bitmaps: %d\r\n", stars_get_num_bitmaps());
|
||||
buffer += temp;
|
||||
|
||||
for (i=0; i<stars_get_num_bitmaps(); i++) {
|
||||
temp.Format("\tStarfield%d bitmap name: %s\r\n", i, stars_get_bitmap_name(i));
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
// Asteroids
|
||||
temp.Format("Num Field Debris Chunks: %d\r\n", Asteroid_field.num_initial_asteroids);
|
||||
buffer += temp;
|
||||
if (Asteroid_field.num_initial_asteroids > 0) {
|
||||
// active or passive
|
||||
if (Asteroid_field.field_type == FT_ACTIVE) {
|
||||
temp.Format("\tActive Field\r\n");
|
||||
buffer += temp;
|
||||
|
||||
temp.Format("\tAsteroid Debris\r\n");
|
||||
buffer += temp;
|
||||
} else {
|
||||
// passive
|
||||
temp.Format("\tPassive Field\r\n");
|
||||
buffer += temp;
|
||||
|
||||
if (Asteroid_field.debris_genre == DG_ASTEROID) {
|
||||
temp.Format("\tAsteroid Debris\r\n");
|
||||
buffer += temp;
|
||||
} else {
|
||||
temp.Format("\tShip Debris\r\n");
|
||||
buffer += temp;
|
||||
|
||||
// species
|
||||
temp.Format("\t\tSpecies: ");
|
||||
for (i=0; i<(int)Species_info.size(); i++) {
|
||||
if (Asteroid_field.field_debris_type[i] >= 0) {
|
||||
temp += CString(Species_info[(Asteroid_field.field_debris_type[i] / NUM_DEBRIS_SIZES) - 1].species_name) + " ";
|
||||
}
|
||||
}
|
||||
|
||||
temp += "\r\n";
|
||||
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Nebula mission
|
||||
int nebula_mission = (The_mission.flags & MISSION_FLAG_FULLNEB);
|
||||
temp = "Nebula mission:";
|
||||
if (nebula_mission) {
|
||||
temp += " Yes\r\n";
|
||||
} else {
|
||||
temp += " No\r\n";
|
||||
}
|
||||
buffer += temp;
|
||||
|
||||
if (nebula_mission) {
|
||||
// range
|
||||
temp.Format("\tNebula awacs range: %.0f\r\n", Neb2_awacs);
|
||||
buffer += temp;
|
||||
|
||||
// list of poofs
|
||||
for (i=0; i<MAX_NEB2_POOFS; i++) {
|
||||
if ( Neb2_poof_flags & (1<<i) ) {
|
||||
temp.Format("\tNebula poof: %s\r\n", Neb2_poof_filenames[i]);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
|
||||
// nebula texture
|
||||
if (strlen(Neb2_texture_name) > 0) { //-V805
|
||||
temp.Format("\tNebula texture: %s\r\n", Neb2_texture_name);
|
||||
buffer += temp;
|
||||
}
|
||||
} else {
|
||||
// FS! nebula pattern
|
||||
if (Nebula_index > 0) {
|
||||
temp.Format("\tOld style FS1 nebula filename: %s\r\n", Nebula_filenames[Nebula_index]);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
|
||||
// Subspace mission
|
||||
temp = "Subspace mission:";
|
||||
if (The_mission.flags & MISSION_FLAG_SUBSPACE) {
|
||||
temp += " Yes\r\n";
|
||||
} else {
|
||||
temp += " No\r\n";
|
||||
}
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
void DumpStats::get_object_stats(CString &buffer)
|
||||
{
|
||||
object *objp;
|
||||
int obj_type_count[MAX_OBJECT_TYPES];
|
||||
CString temp;
|
||||
int num_small_ships, num_big_ships, num_huge_ships;
|
||||
int i;
|
||||
|
||||
memset(obj_type_count,0, sizeof(obj_type_count));
|
||||
num_small_ships = num_big_ships = num_huge_ships= 0;
|
||||
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
|
||||
// inc big ship or small ship count
|
||||
if ( (objp->type == OBJ_SHIP) || (objp->type == OBJ_START) ) {
|
||||
if ( Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_SMALL_SHIP ) {
|
||||
num_small_ships++;
|
||||
} else if ( Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_BIG_SHIP ) {
|
||||
num_big_ships++;
|
||||
} else if ( Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_HUGE_SHIP ) {
|
||||
num_huge_ships++;
|
||||
}
|
||||
}
|
||||
|
||||
obj_type_count[objp->type]++;
|
||||
}
|
||||
|
||||
// Statistics
|
||||
buffer += "\r\n\tMISSION STATISTICS\r\n";
|
||||
|
||||
// OBJ_START is also a OBJ_SHIP
|
||||
// not counting num_waves (for wings)
|
||||
obj_type_count[OBJ_SHIP] += obj_type_count[OBJ_START];
|
||||
|
||||
for (i=0; i<MAX_OBJECT_TYPES; i++) {
|
||||
if (obj_type_count[i] > 0) {
|
||||
switch(i) {
|
||||
case OBJ_SHIP:
|
||||
temp.Format("Ship Count: %d\r\n", obj_type_count[i]);
|
||||
buffer += temp;
|
||||
break;
|
||||
|
||||
case OBJ_START:
|
||||
temp.Format("Start Count: %d\r\n", obj_type_count[i]);
|
||||
buffer += temp;
|
||||
break;
|
||||
|
||||
case OBJ_WAYPOINT:
|
||||
temp.Format("Waypoint Count: %d\r\n", obj_type_count[i]);
|
||||
buffer += temp;
|
||||
break;
|
||||
|
||||
case OBJ_WING:
|
||||
temp.Format("Wing Count: %d\r\n", obj_type_count[i]);
|
||||
buffer += temp;
|
||||
break;
|
||||
|
||||
case OBJ_JUMP_NODE:
|
||||
temp.Format("Jump Node Count: %d\r\n", obj_type_count[i]);
|
||||
buffer += temp;
|
||||
break;
|
||||
|
||||
default:
|
||||
Int3();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer += "\r\nSHIPS\r\n";
|
||||
temp.Format("\tNum small ships: %d\r\n", num_small_ships);
|
||||
buffer += temp;
|
||||
|
||||
temp.Format("\tNum big ships: %d\r\n", num_big_ships);
|
||||
buffer += temp;
|
||||
|
||||
temp.Format("\tNum huge ships: %d\r\n", num_huge_ships);
|
||||
buffer += temp;
|
||||
|
||||
// Waypoints
|
||||
int total_waypoints = 0;
|
||||
buffer += "\r\nWAYPOINTS\r\n";
|
||||
|
||||
SCP_list<waypoint_list>::iterator ii;
|
||||
for (ii = Waypoint_lists.begin(); ii != Waypoint_lists.end(); ++ii) {
|
||||
temp.Format("\tWaypoint: %s, count: %d\r\n", ii->get_name(), ii->get_waypoints().size());
|
||||
buffer += temp;
|
||||
total_waypoints += ii->get_waypoints().size();
|
||||
}
|
||||
|
||||
if (total_waypoints > 0) {
|
||||
temp.Format("\ttotal_waypoints: %d\r\n", total_waypoints);
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
// Jumpnodes
|
||||
buffer += "\r\nJUMPNODES\r\n";
|
||||
|
||||
SCP_list<jump_node>::iterator jnp;
|
||||
for (jnp = Jump_nodes.begin(); jnp != Jump_nodes.end(); ++jnp) {
|
||||
temp.Format("\tJumpnode: %s\r\n", jnp->get_name_ptr());
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
if (Jump_nodes.size() > 0) {
|
||||
temp.Format("\ttotal_jumpnodes: %d\r\n", Jump_nodes.size());
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
|
||||
// Wings
|
||||
int num_counted_wings = 0;
|
||||
buffer += "\r\nWINGS\r\n";
|
||||
for (i=0; i<MAX_WINGS; i++) {
|
||||
if (Wings[i].wave_count > 0) {
|
||||
temp.Format("\tWing Name: %s, wave_count: %d, num_waves: %d\r\n", Wings[i].name, Wings[i].wave_count, Wings[i].num_waves);
|
||||
buffer += temp;
|
||||
|
||||
num_counted_wings++;
|
||||
if (num_counted_wings == Num_wings) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Escort
|
||||
buffer += "\r\nESCORT\r\n";
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if ( (objp->type == OBJ_SHIP) || (objp->type == OBJ_START) ) {
|
||||
if (Ships[objp->instance].flags & SF_ESCORT) {
|
||||
temp.Format("\tShip name: %s, priority: %d\r\n", Ships[objp->instance].ship_name, Ships[objp->instance].escort_priority);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Hotkeys
|
||||
buffer += "\r\nHOTKEYS\r\n";
|
||||
|
||||
// ship hotkeys
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if ( (objp->type == OBJ_SHIP) || (objp->type == OBJ_START) ) {
|
||||
if (Ships[objp->instance].hotkey != -1) {
|
||||
temp.Format("\tShip name: %s, hotkey: F%d\r\n", Ships[objp->instance].ship_name, (Ships[objp->instance].hotkey + 5));
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// wing hotkeys
|
||||
for (i=0; i<MAX_WINGS; i++) {
|
||||
if (Wings[i].wave_count > 0) {
|
||||
if (Wings[i].hotkey != -1) {
|
||||
temp.Format("\tWing name: %s, hotkey: F%d\r\n", Wings[i].name, (Wings[i].hotkey + 5));
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DumpStats::get_objectives_and_goals(CString &buffer)
|
||||
{
|
||||
CString temp;
|
||||
int i;
|
||||
|
||||
buffer += "\r\nOBJECTIVES AND GOALS\r\n";
|
||||
|
||||
// objectives
|
||||
for (i=0; i<Num_mission_events; i++) {
|
||||
// name, objective_text, objective_key_text
|
||||
if ( Mission_events[i].objective_text == NULL ) {
|
||||
continue;
|
||||
}
|
||||
temp.Format("\tObjective: %s, text: %s, key_text: %s\r\n", Mission_events[i].name, Mission_events[i].objective_text, Mission_events[i].objective_key_text);
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
buffer += "\r\n";
|
||||
|
||||
// goals
|
||||
for (i=0; i<Num_goals; i++) {
|
||||
temp.Format("\tGoal: %s, text: %s", Mission_goals[i].name, Mission_goals[i].message);
|
||||
buffer += temp;
|
||||
|
||||
switch(Mission_goals[i].type & GOAL_TYPE_MASK) {
|
||||
case PRIMARY_GOAL:
|
||||
buffer += ", type: primary\r\n";
|
||||
break;
|
||||
|
||||
case SECONDARY_GOAL:
|
||||
buffer += ", type: secondary\r\n";
|
||||
break;
|
||||
|
||||
case BONUS_GOAL:
|
||||
buffer += ", type: bonus\r\n";
|
||||
break;
|
||||
|
||||
default:
|
||||
Int3();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DumpStats::get_ship_weapon_selection(CString &buffer)
|
||||
{
|
||||
CString temp;
|
||||
int i,j;
|
||||
|
||||
buffer += "\r\nSHIP WEAPON/SELECTION\r\n";
|
||||
buffer += "Reported numbers are in addition to assigned ships and their default weapons\r\n";
|
||||
|
||||
for (i=0; i<Num_teams; i++) {
|
||||
temp.Format("Team %d\r\n", i);
|
||||
buffer += temp;
|
||||
|
||||
// ships
|
||||
for (j=0; j<Team_data[i].num_ship_choices; j++) {
|
||||
temp.Format("\tShip name: %s, count %d", Ship_info[Ships[Team_data[i].ship_list[j]].ship_info_index].name, Team_data[i].ship_count[j]);
|
||||
buffer += temp;
|
||||
|
||||
if (Team_data[i].ship_list[j] == Team_data[i].default_ship) {
|
||||
temp = " DEFAULT SHIP\r\n";
|
||||
} else {
|
||||
temp = "\r\n";
|
||||
}
|
||||
buffer += temp;
|
||||
}
|
||||
|
||||
buffer += "\r\n";
|
||||
|
||||
// weapons
|
||||
for (j=0; j<Team_data[i].num_weapon_choices; j++) {
|
||||
//if (Team_data[i].weaponry_pool[j] > 0)
|
||||
temp.Format("\tWeapon name: %s, count %d\r\n", Weapon_info[Team_data[i].weaponry_pool[j]].name, Team_data[i].weaponry_count[j]);
|
||||
buffer += temp;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DumpStats::get_messaging_info(CString &buffer)
|
||||
{
|
||||
CString temp;
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
|
||||
buffer += "\r\nSHIP ACCEPTED ORDERS\r\n";
|
||||
|
||||
// go through all ships and check (.orders_accepted against default_orders)
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (shipp->orders_accepted != ship_get_default_orders_accepted(&Ship_info[shipp->ship_info_index])) {
|
||||
temp.Format("\tShip: %s with nonstandard accepted orders\r\n", shipp->ship_name);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DumpStats::get_species_ship_breakdown(CString &buffer)
|
||||
{
|
||||
CString temp;
|
||||
int i;
|
||||
int species;
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
|
||||
buffer += "\r\nSHIP SPECIES BREAKDOWN\r\n";
|
||||
|
||||
|
||||
for (species=0; (uint) species < Species_info.size(); species++) {
|
||||
buffer += Species_info[species].species_name;
|
||||
buffer += "\r\n";
|
||||
|
||||
// fighter wings
|
||||
buffer += "\tFighter wings:\r\n";
|
||||
for (i=0; i<MAX_WINGS; i++) {
|
||||
if (Wings[i].wave_count > 0) {
|
||||
int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship];
|
||||
if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) {
|
||||
if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags & SIF_FIGHTER) {
|
||||
temp.Format("\t\tWing: %s, count: %d, waves: %d, type: %s\r\n", Wings[i].name, Wings[i].wave_count, Wings[i].num_waves, Ship_info[Ships[wing_leader_shipnum].ship_info_index].name);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bomber wings
|
||||
buffer += "\tBomber wings:\r\n";
|
||||
for (i=0; i<MAX_WINGS; i++) {
|
||||
if (Wings[i].wave_count > 0) {
|
||||
int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship];
|
||||
if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) {
|
||||
if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags & SIF_BOMBER) {
|
||||
temp.Format("\t\tWing: %s, count: %d, waves: %d, type: %s\r\n", Wings[i].name, Wings[i].wave_count, Wings[i].num_waves, Ship_info[Ships[wing_leader_shipnum].ship_info_index].name);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer += "\tFreighters, Cargo, Transports:\r\n";
|
||||
// freighters and transports (cargo)
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].species == species) {
|
||||
//if (shipp->wingnum == -1)
|
||||
//if (shipp->cargo1 > 0)
|
||||
if (Ship_info[shipp->ship_info_index].flags & (SIF_FREIGHTER | SIF_TRANSPORT | SIF_CARGO)) {
|
||||
temp.Format("\t\tName: %s Type: %s, Cargo: %s\r\n", shipp->ship_name, Ship_info[shipp->ship_info_index].name, Cargo_names[shipp->cargo1]);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer += "\tNav buoy, Escape pod, Sentry gun:\r\n";
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].species == species) {
|
||||
//if (shipp->wingnum == -1)
|
||||
//if (shipp->cargo1 > 0)
|
||||
if (Ship_info[shipp->ship_info_index].flags & (SIF_NAVBUOY | SIF_ESCAPEPOD | SIF_SENTRYGUN)) {
|
||||
temp.Format("\t\tName: %s, Type: %s Cargo: %s\r\n", shipp->ship_name, Ship_info[shipp->ship_info_index].name, Cargo_names[shipp->cargo1]);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// cruiser
|
||||
buffer += "\tCruiser:\r\n";
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].species == species) {
|
||||
//if (shipp->wingnum == -1)
|
||||
//if (shipp->cargo1 > 0)
|
||||
if (Ship_info[shipp->ship_info_index].flags & (SIF_CRUISER)) {
|
||||
temp.Format("\t\tName: %s, Type: %s, Cargo: %s\r\n", shipp->ship_name, Ship_info[shipp->ship_info_index].name, Cargo_names[shipp->cargo1]);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dry dock, cap, super cap
|
||||
buffer += "\tDry dock, Capital, Supercap:\r\n";
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].species == species) {
|
||||
//if (shipp->wingnum == -1)
|
||||
//if (shipp->cargo1 > 0)
|
||||
if (Ship_info[shipp->ship_info_index].flags & (SIF_DRYDOCK|SIF_CAPITAL|SIF_SUPERCAP)) {
|
||||
temp.Format("\t\tName: %s, Type: %s, Cargo: %s\r\n", shipp->ship_name, Ship_info[shipp->ship_info_index].name, Cargo_names[shipp->cargo1]);
|
||||
buffer += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer += "\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
void dump_loadout(ship *shipp, CString &loadout)
|
||||
{
|
||||
CString temp;
|
||||
char *weapon_name;
|
||||
|
||||
loadout = "";
|
||||
|
||||
// PRIMARY
|
||||
int pri_idx, sec_idx;
|
||||
|
||||
for (pri_idx=0; pri_idx < shipp->weapons.num_primary_banks; pri_idx++) {
|
||||
if (shipp->weapons.primary_bank_weapons[pri_idx] == -1) {
|
||||
weapon_name = "none";
|
||||
} else {
|
||||
weapon_name = Weapon_info[shipp->weapons.primary_bank_weapons[pri_idx]].name;
|
||||
}
|
||||
temp.Format("\t\t\tPrimary[%d]: %s\r\n", pri_idx+1, weapon_name);
|
||||
loadout += temp;
|
||||
}
|
||||
|
||||
// SECONDARY
|
||||
for (sec_idx=0; sec_idx < shipp->weapons.num_secondary_banks; sec_idx++) {
|
||||
if (shipp->weapons.secondary_bank_weapons[sec_idx] == -1) {
|
||||
weapon_name = "none";
|
||||
} else {
|
||||
weapon_name = Weapon_info[shipp->weapons.secondary_bank_weapons[sec_idx]].name;
|
||||
}
|
||||
temp.Format("\t\t\tSecondary[%d]: %s\r\n", sec_idx+1, weapon_name);
|
||||
loadout += temp;
|
||||
}
|
||||
|
||||
// TURRET
|
||||
ship_subsys *ss;
|
||||
for (ss = GET_FIRST(&shipp->subsys_list); ss != END_OF_LIST(&shipp->subsys_list); ss = GET_NEXT(ss) ) {
|
||||
if ( (ss->system_info->type == SUBSYSTEM_TURRET) ) {
|
||||
// ss->weapons.num_primary_banks, ss->weapons.num_secondary_banks, ss->weapons.primary_bank_weapons[3], ss->weapons.secondary_bank_weapons[2]
|
||||
// ss->system_info->primary_banks, ss->system_info->secondary_banks
|
||||
temp.Format("\t\t\tTurret: %s\r\n", ss->system_info->subobj_name);
|
||||
loadout += temp;
|
||||
|
||||
// PRIMARY
|
||||
for (pri_idx=0; pri_idx < ss->weapons.num_primary_banks; pri_idx++) {
|
||||
if (ss->weapons.primary_bank_weapons[pri_idx] == -1) {
|
||||
weapon_name = "none";
|
||||
} else {
|
||||
weapon_name = Weapon_info[ss->weapons.primary_bank_weapons[pri_idx]].name;
|
||||
}
|
||||
temp.Format("\t\t\t\tPrimary[%d]: %s\r\n", pri_idx+1, weapon_name);
|
||||
loadout += temp;
|
||||
}
|
||||
|
||||
// SECONDARY
|
||||
for (sec_idx=0; sec_idx < ss->weapons.num_secondary_banks; sec_idx++) {
|
||||
if (ss->weapons.secondary_bank_weapons[sec_idx] == -1) {
|
||||
weapon_name = "none";
|
||||
} else {
|
||||
weapon_name = Weapon_info[ss->weapons.secondary_bank_weapons[sec_idx]].name;
|
||||
}
|
||||
temp.Format("\t\t\t\tSecondary[%d]: %s\r\n", sec_idx+1, weapon_name);
|
||||
loadout += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DumpStats::get_default_ship_loadouts(CString &buffer)
|
||||
{
|
||||
int i;
|
||||
int species;
|
||||
object *objp;
|
||||
ship *shipp;
|
||||
CString temp, loadout;
|
||||
|
||||
buffer += "\r\nSHIP SPECIES BREAKDOWN\r\n";
|
||||
|
||||
|
||||
for (species=0; (uint) species < Species_info.size(); species++) {
|
||||
buffer += Species_info[species].species_name;
|
||||
buffer += "\r\n";
|
||||
|
||||
// fighter wings
|
||||
buffer += "\tFighter wings:\r\n";
|
||||
for (i=0; i<MAX_WINGS; i++) {
|
||||
if (Wings[i].wave_count > 0) {
|
||||
int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship];
|
||||
if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) {
|
||||
if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags & SIF_FIGHTER) {
|
||||
temp.Format("\t\tWing: %s\r\n", Wings[i].name);
|
||||
buffer += temp;
|
||||
dump_loadout(&Ships[wing_leader_shipnum], loadout);
|
||||
buffer += loadout;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// bomber wings
|
||||
buffer += "\tBomber wings:\r\n";
|
||||
for (i=0; i<MAX_WINGS; i++) {
|
||||
if (Wings[i].wave_count > 0) {
|
||||
int wing_leader_shipnum = Wings[i].ship_index[Wings[i].special_ship];
|
||||
if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].species == species) {
|
||||
if (Ship_info[Ships[wing_leader_shipnum].ship_info_index].flags & SIF_BOMBER) {
|
||||
temp.Format("\t\tWing: %s\r\n", Wings[i].name);
|
||||
buffer += temp;
|
||||
dump_loadout(&Ships[wing_leader_shipnum], loadout);
|
||||
buffer += loadout;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer += "\tFreighters, Cargo, Transports:\r\n";
|
||||
// freighters and transports (cargo)
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].species == species) {
|
||||
//if (shipp->wingnum == -1)
|
||||
//if (shipp->cargo1 > 0)
|
||||
if (Ship_info[shipp->ship_info_index].flags & (SIF_FREIGHTER | SIF_TRANSPORT)) {
|
||||
temp.Format("\t\tName: %s\r\n", shipp->ship_name);
|
||||
buffer += temp;
|
||||
dump_loadout(shipp, loadout);
|
||||
buffer += loadout;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer += "\tEscape pod, Sentry gun:\r\n";
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].species == species) {
|
||||
//if (shipp->wingnum == -1)
|
||||
//if (shipp->cargo1 > 0)
|
||||
if (Ship_info[shipp->ship_info_index].flags & (SIF_ESCAPEPOD | SIF_SENTRYGUN)) {
|
||||
temp.Format("\t\tName: %s\r\n", shipp->ship_name);
|
||||
buffer += temp;
|
||||
dump_loadout(shipp, loadout);
|
||||
buffer += loadout;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// cruiser
|
||||
buffer += "\tCruiser:\r\n";
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].species == species) {
|
||||
//if (shipp->wingnum == -1)
|
||||
//if (shipp->cargo1 > 0)
|
||||
if (Ship_info[shipp->ship_info_index].flags & (SIF_CRUISER)) {
|
||||
temp.Format("\t\tName: %s\r\n", shipp->ship_name);
|
||||
buffer += temp;
|
||||
dump_loadout(shipp, loadout);
|
||||
buffer += loadout;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// dry dock, cap, super cap
|
||||
buffer += "\tCapital, Supercap:\r\n";
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if (objp->type == OBJ_START || objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
|
||||
if (Ship_info[shipp->ship_info_index].species == species) {
|
||||
//if (shipp->wingnum == -1)
|
||||
//if (shipp->cargo1 > 0)
|
||||
if (Ship_info[shipp->ship_info_index].flags & (SIF_CAPITAL|SIF_SUPERCAP)) {
|
||||
temp.Format("\t\tName: %s\r\n", shipp->ship_name);
|
||||
buffer += temp;
|
||||
dump_loadout(shipp, loadout);
|
||||
buffer += loadout;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buffer += "\r\n";
|
||||
}
|
||||
// go through all wings
|
||||
|
||||
// go through all ships not in wings and FLYABLE
|
||||
|
||||
// print primary, secondary, and BIG turrets
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(AFX_DUMPSTATS_H__04996431_1A80_11D3_A923_0060088FAE88__INCLUDED_)
|
||||
#define AFX_DUMPSTATS_H__04996431_1A80_11D3_A923_0060088FAE88__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// DumpStats.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DumpStats dialog
|
||||
|
||||
class DumpStats : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
DumpStats(CWnd* pParent = NULL); // standard constructor
|
||||
void get_mission_stats(CString &buffer);
|
||||
void get_background_stats(CString &buffer);
|
||||
void get_object_stats(CString &buffer);
|
||||
void get_objectives_and_goals(CString &buffer);
|
||||
void get_ship_weapon_selection(CString &buffer);
|
||||
void get_messaging_info(CString &buffer);
|
||||
void get_species_ship_breakdown(CString &buffer);
|
||||
void get_default_ship_loadouts(CString &buffer);
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(DumpStats)
|
||||
enum { IDD = IDD_DUMP_STATS };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(DumpStats)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(DumpStats)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDumpToFile();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_DUMPSTATS_H__04996431_1A80_11D3_A923_0060088FAE88__INCLUDED_)
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* 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 _EDITOR_H
|
||||
#define _EDITOR_H
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
*/
|
||||
|
||||
#include "physics/physics.h"
|
||||
#include "render/3d.h"
|
||||
#include "mission/missiongrid.h"
|
||||
|
||||
#define MAX_GRID_POINTS 1000
|
||||
|
||||
void create_object(int objnum, vec3d *pos);
|
||||
|
||||
// This stuff properly belongs in editor.h, but I gave up trying to figure out how
|
||||
// to add an include file to the project.
|
||||
|
||||
extern void test_form_wing(int x);
|
||||
|
||||
extern int select_object(int cx, int cy);
|
||||
extern void game_init();
|
||||
|
||||
extern matrix Grid_gmatrix;
|
||||
extern vec3d Grid_center;
|
||||
|
||||
extern int Show_stars;
|
||||
extern void rpd_line(vec3d *v0, vec3d *v1);
|
||||
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* 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 _EVENTEDITOR_H
|
||||
#define _EVENTEDITOR_H
|
||||
|
||||
#include "Sexp_tree.h"
|
||||
#include "mission/missiongoals.h"
|
||||
#include "mission/missionmessage.h"
|
||||
|
||||
#define MAX_SEARCH_MESSAGE_DEPTH 5 // maximum search number of event nodes with message text
|
||||
|
||||
class event_sexp_tree : public sexp_tree
|
||||
{
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// event_editor dialog
|
||||
|
||||
class event_editor : public CDialog
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
void update_persona();
|
||||
void save();
|
||||
char *current_message_name(int index);
|
||||
char *get_message_list_item(int i);
|
||||
int save_message(int num);
|
||||
void update_cur_message();
|
||||
HTREEITEM get_event_handle(int num);
|
||||
void reset_event(int num, HTREEITEM after);
|
||||
void save_event(int e);
|
||||
void swap_handler(int node1, int node2);
|
||||
void insert_handler(int old, int node);
|
||||
int query_modified();
|
||||
void OnOK();
|
||||
void OnCancel();
|
||||
int handler(int code, int node, char *str = NULL);
|
||||
void create_tree();
|
||||
void load_tree();
|
||||
int modified;
|
||||
int select_sexp_node;
|
||||
event_editor(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(event_editor)
|
||||
enum { IDD = IDD_EVENT_EDITOR };
|
||||
event_sexp_tree m_event_tree;
|
||||
UINT m_repeat_count;
|
||||
UINT m_trigger_count;
|
||||
UINT m_interval;
|
||||
int m_event_score;
|
||||
int m_chain_delay;
|
||||
BOOL m_chained;
|
||||
CString m_obj_text;
|
||||
CString m_obj_key_text;
|
||||
CString m_avi_filename;
|
||||
CString m_message_name;
|
||||
CString m_message_text;
|
||||
int m_persona;
|
||||
CString m_wave_filename;
|
||||
int m_cur_msg;
|
||||
int m_team;
|
||||
int m_message_team;
|
||||
int m_last_message_node;
|
||||
//}}AFX_DATA
|
||||
|
||||
CBitmap m_play_bm;
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(event_editor)
|
||||
public:
|
||||
virtual BOOL DestroyWindow();
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(event_editor)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnRclickEventTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnBeginlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnEndlabeleditEventTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnButtonNewEvent();
|
||||
afx_msg void OnDelete();
|
||||
afx_msg void OnOk();
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnSelchangedEventTree(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnUpdateRepeatCount();
|
||||
afx_msg void OnUpdateTriggerCount();
|
||||
afx_msg void OnChained();
|
||||
afx_msg void OnInsert();
|
||||
afx_msg void OnSelchangeMessageList();
|
||||
afx_msg void OnNewMsg();
|
||||
afx_msg void OnDeleteMsg();
|
||||
afx_msg void OnBrowseAvi();
|
||||
afx_msg void OnBrowseWave();
|
||||
afx_msg void OnSelchangeWaveFilename();
|
||||
afx_msg void OnPlay();
|
||||
afx_msg void OnUpdate();
|
||||
afx_msg void On_Cancel();
|
||||
afx_msg void OnSelchangeTeam();
|
||||
afx_msg void OnSelchangeMessageTeam();
|
||||
afx_msg void OnDblclkMessageList();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
private:
|
||||
int cur_event;
|
||||
void update_cur_event();
|
||||
int m_num_events;
|
||||
int m_sig[MAX_MISSION_EVENTS];
|
||||
mission_event m_events[MAX_MISSION_EVENTS];
|
||||
int m_num_messages;
|
||||
SCP_vector<MMessage> m_messages;
|
||||
int m_wave_id;
|
||||
};
|
||||
|
||||
extern event_editor *Event_editor_dlg; // global reference needed by event tree class
|
||||
|
||||
#endif
|
||||
@@ -1,329 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
DESCRIPTION:
|
||||
CFolderDialog - Folder Selection Dialog Class
|
||||
Copyright(C) Armen Hakobyan, 2002 - 2005
|
||||
http://www.codeproject.com/dialog/cfolderdialog.asp
|
||||
|
||||
VERSION HISTORY:
|
||||
24 Mar 2002 - First release
|
||||
30 Mar 2003 - Some minor changes
|
||||
- Added missing in old Platform SDK new flag definitions
|
||||
- Added support for both MFC 6.0 and 7.0
|
||||
- Added OnIUnknown handler for Windows XP folder filtration
|
||||
- Added SetExpanded and SetOKText and GetSelectedFolder functions
|
||||
24 May 2003 - Added OnSelChanged implementation
|
||||
14 Jul 2003 - Added custom filtration for Windows XP, thanks to Arik Poznanski
|
||||
29 Nov 2003 - Added SetRootFolder, thanks to Eckhard Schwabe ( and Jose Insa )
|
||||
02 Jan 2004 - Added GetRootFolder, uncomment if needed
|
||||
15 Feb 2005 - Small bug fix in DoModal, thanks to WindSeven
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "FolderDlg.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BFFM_VALIDATEFAILED
|
||||
#ifndef UNICODE
|
||||
#define BFFM_VALIDATEFAILED 3
|
||||
#else
|
||||
#define BFFM_VALIDATEFAILED 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef BFFM_IUNKNOWN
|
||||
#define BFFM_IUNKNOWN 5
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFolderDialog
|
||||
|
||||
IMPLEMENT_DYNAMIC( CFolderDialog, CDialog )
|
||||
|
||||
CFolderDialog::CFolderDialog( IN LPCTSTR pszTitle /*NULL*/,
|
||||
IN LPCTSTR pszSelPath /*NULL*/,
|
||||
IN CWnd* pWndParent /*NULL*/,
|
||||
IN UINT uFlags /*BIF_RETURNONLYFSDIRS*/ )
|
||||
: CCommonDialog( pWndParent )
|
||||
, m_hWnd( NULL )
|
||||
{
|
||||
::ZeroMemory( &m_bi, sizeof( BROWSEINFO ) );
|
||||
::ZeroMemory( m_szFolPath, MAX_PATH );
|
||||
::ZeroMemory( m_szSelPath, MAX_PATH );
|
||||
|
||||
// Fill data
|
||||
|
||||
m_bi.hwndOwner = pWndParent->GetSafeHwnd();
|
||||
m_bi.pidlRoot = NULL;
|
||||
m_bi.lpszTitle = pszTitle;
|
||||
m_bi.ulFlags = uFlags;
|
||||
m_bi.lpfn = (BFFCALLBACK)&BrowseCallbackProc;
|
||||
m_bi.lParam = (LPARAM)this;
|
||||
|
||||
// The size of this buffer is assumed to be MAX_PATH bytes:
|
||||
|
||||
m_bi.pszDisplayName = new TCHAR[ MAX_PATH ];
|
||||
ASSERT( m_bi.pszDisplayName != NULL );
|
||||
|
||||
SAFE_ZEROMEMORY(
|
||||
m_bi.pszDisplayName, ( MAX_PATH * sizeof( TCHAR ) )
|
||||
);
|
||||
|
||||
if( pszSelPath )
|
||||
SetSelectedFolder( pszSelPath );
|
||||
}
|
||||
|
||||
CFolderDialog::~CFolderDialog( VOID )
|
||||
{
|
||||
SAFE_COTASKMEMFREE( m_bi.pidlRoot );
|
||||
SAFE_DELETE2( m_bi.pszDisplayName );
|
||||
|
||||
::ZeroMemory( &m_bi, sizeof( BROWSEINFO ) );
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP( CFolderDialog, CCommonDialog )
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFolderDialog message handlers
|
||||
|
||||
// SetRootFolder By Jose Insa
|
||||
// Microsoft knowledge Base Article
|
||||
// ID Q132750: Convert a File Path to an ITEMIDLIST
|
||||
|
||||
BOOL CFolderDialog::SetRootFolder( IN LPCTSTR pszPath )
|
||||
{
|
||||
ASSERT_VALID( this );
|
||||
|
||||
if( !pszPath )
|
||||
{
|
||||
SAFE_COTASKMEMFREE( m_bi.pidlRoot );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ASSERT( AfxIsValidString( pszPath, MAX_PATH ) );
|
||||
|
||||
HRESULT hResult = S_FALSE;
|
||||
IShellFolder* pDeskFolder = NULL;
|
||||
|
||||
hResult = ::SHGetDesktopFolder( &pDeskFolder );
|
||||
if ( hResult == S_OK )
|
||||
{
|
||||
LPITEMIDLIST pidlRoot = NULL;
|
||||
LPTSTR pszRoot = const_cast< LPTSTR >( pszPath );
|
||||
|
||||
// Convert the path to an ITEMIDLIST:
|
||||
|
||||
USES_CONVERSION;
|
||||
|
||||
hResult = pDeskFolder->ParseDisplayName(
|
||||
NULL, NULL, T2W( pszRoot ), NULL, &pidlRoot, NULL
|
||||
);
|
||||
|
||||
if( hResult == S_OK )
|
||||
{
|
||||
SAFE_COTASKMEMFREE( m_bi.pidlRoot );
|
||||
m_bi.pidlRoot = pidlRoot;
|
||||
}
|
||||
|
||||
SAFE_RELEASE( pDeskFolder );
|
||||
}
|
||||
|
||||
return ( hResult == S_OK );
|
||||
}
|
||||
|
||||
// NOTE: pszPath buffer must be at least
|
||||
// MAX_PATH characters in size:
|
||||
|
||||
BOOL CFolderDialog::GetRootFolder( IN OUT LPTSTR pszPath )
|
||||
{
|
||||
ASSERT_VALID( this );
|
||||
ASSERT( AfxIsValidString( pszPath, MAX_PATH ) );
|
||||
|
||||
return ::SHGetPathFromIDList( m_bi.pidlRoot, pszPath );
|
||||
}
|
||||
|
||||
BOOL CFolderDialog::SetSelectedFolder( IN LPCTSTR pszPath )
|
||||
{
|
||||
ASSERT( AfxIsValidString( pszPath, MAX_PATH ) );
|
||||
return (BOOL)::lstrcpy( m_szSelPath, pszPath );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if ( _MFC_VER >= 0x0700 )
|
||||
INT_PTR CFolderDialog::DoModal( VOID )
|
||||
#else
|
||||
INT CFolderDialog::DoModal( VOID )
|
||||
#endif
|
||||
{
|
||||
ASSERT_VALID( this );
|
||||
ASSERT( m_bi.lpfn != NULL );
|
||||
|
||||
INT_PTR nRet = -1;
|
||||
m_bi.hwndOwner = PreModal();
|
||||
|
||||
LPITEMIDLIST pItemIDList = ::SHBrowseForFolder( &m_bi );
|
||||
if( pItemIDList )
|
||||
{
|
||||
if( ::SHGetPathFromIDList( pItemIDList, m_szFolPath ) )
|
||||
nRet = IDOK;
|
||||
|
||||
SAFE_COTASKMEMFREE( pItemIDList );
|
||||
}
|
||||
else
|
||||
nRet = IDCANCEL;
|
||||
|
||||
|
||||
PostModal();
|
||||
return ( nRet );
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Overridables:
|
||||
|
||||
VOID CFolderDialog::OnInitialized( VOID )
|
||||
{
|
||||
if( ::lstrlen( m_szSelPath ) > 0 ) //-V805
|
||||
SetSelection( m_szSelPath );
|
||||
}
|
||||
|
||||
VOID CFolderDialog::OnSelChanged( IN LPITEMIDLIST pItemIDList )
|
||||
{
|
||||
if( m_bi.ulFlags & BIF_STATUSTEXT )
|
||||
{
|
||||
TCHAR szSelFol[ MAX_PATH ] = { 0 };
|
||||
if( ::SHGetPathFromIDList( pItemIDList, szSelFol ) )
|
||||
SetStatusText( szSelFol );
|
||||
}
|
||||
}
|
||||
|
||||
INT CFolderDialog::OnValidateFailed( IN LPCTSTR /*pszPath*/ )
|
||||
{
|
||||
::MessageBeep( MB_ICONHAND );
|
||||
return 1; // Return 1 to leave dialog open, 0 - to end one
|
||||
}
|
||||
|
||||
VOID CFolderDialog::OnIUnknown( IN IUnknown* /*pIUnknown*/ )
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Callback function used with the SHBrowseForFolder function.
|
||||
|
||||
INT CALLBACK CFolderDialog::BrowseCallbackProc( IN HWND hWnd,
|
||||
IN UINT uMsg,
|
||||
IN LPARAM lParam,
|
||||
IN LPARAM lpData )
|
||||
{
|
||||
CFolderDialog* pThis = (CFolderDialog*)lpData;
|
||||
ASSERT( pThis != NULL );
|
||||
|
||||
INT nRet = 0;
|
||||
pThis->m_hWnd = hWnd;
|
||||
|
||||
switch( uMsg )
|
||||
{
|
||||
case BFFM_INITIALIZED:
|
||||
pThis->OnInitialized();
|
||||
break;
|
||||
case BFFM_SELCHANGED:
|
||||
pThis->OnSelChanged( (LPITEMIDLIST)lParam );
|
||||
break;
|
||||
case BFFM_VALIDATEFAILED:
|
||||
nRet = pThis->OnValidateFailed( (LPCTSTR)lParam );
|
||||
break;
|
||||
case BFFM_IUNKNOWN:
|
||||
pThis->OnIUnknown( (IUnknown*)lParam );
|
||||
break;
|
||||
default:
|
||||
ASSERT( FALSE );
|
||||
break;
|
||||
}
|
||||
|
||||
pThis->m_hWnd = NULL;
|
||||
return nRet;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Commands, valid to call only from handlers
|
||||
|
||||
VOID CFolderDialog::SetExpanded( IN LPCTSTR pszPath )
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
ASSERT( m_hWnd != NULL );
|
||||
ASSERT( AfxIsValidString( pszPath, MAX_PATH ) );
|
||||
|
||||
::SendMessage(
|
||||
m_hWnd, BFFM_SETEXPANDED,
|
||||
(WPARAM)TRUE, (LPARAM)T2CW( pszPath )
|
||||
);
|
||||
}
|
||||
|
||||
VOID CFolderDialog::SetOKText( IN LPCTSTR pszText )
|
||||
{
|
||||
USES_CONVERSION;
|
||||
|
||||
ASSERT( m_hWnd != NULL );
|
||||
|
||||
::SendMessage(
|
||||
m_hWnd, BFFM_SETOKTEXT,
|
||||
(WPARAM)0, (LPARAM)T2CW( pszText )
|
||||
);
|
||||
}
|
||||
|
||||
VOID CFolderDialog::EnableOK( IN BOOL bEnable /*TRUE*/ )
|
||||
{
|
||||
ASSERT( m_hWnd != NULL );
|
||||
|
||||
::SendMessage(
|
||||
m_hWnd, BFFM_ENABLEOK, (WPARAM)bEnable, 0L
|
||||
);
|
||||
}
|
||||
|
||||
VOID CFolderDialog::SetSelection( IN LPITEMIDLIST pItemIDList )
|
||||
{
|
||||
ASSERT( m_hWnd != NULL );
|
||||
|
||||
::SendMessage(
|
||||
m_hWnd, BFFM_SETSELECTION,
|
||||
(WPARAM)FALSE, (LPARAM)pItemIDList
|
||||
);
|
||||
}
|
||||
|
||||
VOID CFolderDialog::SetSelection( IN LPCTSTR pszPath )
|
||||
{
|
||||
ASSERT( m_hWnd != NULL );
|
||||
ASSERT( AfxIsValidString( pszPath, MAX_PATH ) );
|
||||
|
||||
::SendMessage(
|
||||
m_hWnd, BFFM_SETSELECTION,
|
||||
(WPARAM)TRUE, (LPARAM)pszPath
|
||||
);
|
||||
}
|
||||
|
||||
VOID CFolderDialog::SetStatusText( IN LPCTSTR pszText )
|
||||
{
|
||||
ASSERT( m_hWnd != NULL );
|
||||
|
||||
::SendMessage(
|
||||
m_hWnd, BFFM_SETSTATUSTEXT,
|
||||
(WPARAM)0, (LPARAM)pszText
|
||||
);
|
||||
}
|
||||
|
||||
// Shell version 5.0 or later:
|
||||
|
||||
VOID CFolderDialog::SetExpanded( IN LPITEMIDLIST pItemIDList )
|
||||
{
|
||||
ASSERT( m_hWnd != NULL );
|
||||
|
||||
::SendMessage(
|
||||
m_hWnd, BFFM_SETEXPANDED,
|
||||
(WPARAM)FALSE, (LPARAM)pItemIDList
|
||||
);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1,197 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
DESCRIPTION:
|
||||
CFolderDialog - Folder Selection Dialog Class
|
||||
Copyright(C) Armen Hakobyan, 2002 - 2005
|
||||
http://www.codeproject.com/dialog/cfolderdialog.asp
|
||||
|
||||
VERSION HISTORY:
|
||||
24 Mar 2002 - First release
|
||||
30 Mar 2003 - Some minor changes
|
||||
- Added missing in old Platform SDK new flag definitions
|
||||
- Added support for both MFC 6.0 and 7.0
|
||||
- Added OnIUnknown handler for Windows XP folder filtration
|
||||
- Added SetExpanded and SetOKText and GetSelectedFolder functions
|
||||
24 May 2003 - Added OnSelChanged implementation
|
||||
14 Jul 2003 - Added custom filtration for Windows XP, thanks to Arik Poznanski
|
||||
29 Nov 2003 - Added SetRootFolder, thanks to Eckhard Schwabe ( and Jose Insa )
|
||||
02 Jan 2004 - Added GetRootFolder, uncomment if needed
|
||||
15 Feb 2005 - Small bug fix in DoModal, thanks to WindSeven
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __FOLDERDLG_H__
|
||||
#define __FOLDERDLG_H__
|
||||
|
||||
#if defined( _MSC_VER ) && ( _MSC_VER >= 1020 )
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __AFXDLGS_H__
|
||||
#include < AfxDlgs.h >
|
||||
#endif
|
||||
|
||||
// Goober5000 - dunno why this wasn't included in the first place
|
||||
#ifndef _INC_SHLOBJ
|
||||
#include <shlobj.h>
|
||||
#endif
|
||||
|
||||
#ifndef __ATLCONV_H__
|
||||
#include < AtlConv.h > // MBCS/Unicode Conversion Macros
|
||||
#endif
|
||||
|
||||
// Uncomment if using GetRootFolder
|
||||
//#ifndef _INC_SHLWAPI
|
||||
// #include < shlwapi.h >
|
||||
//#endif
|
||||
//#pragma comment( lib, "shlwapi.lib" )
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SAFE_DELETE2
|
||||
#define SAFE_DELETE2( p ) \
|
||||
if( p ){ delete[] p; p = NULL; }
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_ZEROMEMORY
|
||||
#define SAFE_ZEROMEMORY( p, size ) \
|
||||
if( p ){ ZeroMemory( p, size ); }
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_RELEASE
|
||||
#if defined( __cplusplus )
|
||||
#define SAFE_RELEASE( p ) \
|
||||
if( p ){ p->Release(); p = NULL; }
|
||||
#else
|
||||
#define SAFE_RELEASE( p ) \
|
||||
if( p ){ p->lpVtbl->Release( p ); p = NULL; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_COTASKMEMFREE
|
||||
#define SAFE_COTASKMEMFREE( p ) \
|
||||
if( p ){ CoTaskMemFree( (LPVOID)p ); p = NULL; }
|
||||
#endif
|
||||
|
||||
#ifndef _countof
|
||||
#define _countof( x ) \
|
||||
( sizeof( x ) / sizeof( x[ 0 ] ) )
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef BFFM_SETOKTEXT // Version 5.0 or later
|
||||
#define BFFM_SETOKTEXT ( WM_USER + 105 ) // Unicode only, req. BIF_USENEWUI
|
||||
#define BFFM_SETEXPANDED ( WM_USER + 106 ) // Unicode only, req. BIF_USENEWUI
|
||||
#endif
|
||||
|
||||
#ifndef BIF_NEWDIALOGSTYLE // Version 5.0 or later
|
||||
#define BIF_NEWDIALOGSTYLE 0x0040
|
||||
#define BIF_BROWSEINCLUDEURLS 0x0080
|
||||
#define BIF_UAHINT 0x0100 // Req. BIF_NEWDIALOGSTYLE
|
||||
#define BIF_NONEWFOLDERBUTTON 0x0200
|
||||
#define BIF_NOTRANSLATETARGETS 0x0400
|
||||
#define BIF_SHAREABLE 0x8000 // Req. BIF_USENEWUI
|
||||
#define BIF_USENEWUI ( BIF_NEWDIALOGSTYLE | BIF_EDITBOX )
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class CFolderDialog : public CCommonDialog
|
||||
{
|
||||
DECLARE_DYNAMIC( CFolderDialog )
|
||||
|
||||
public:
|
||||
CFolderDialog( IN LPCTSTR pszTitle = NULL,
|
||||
IN LPCTSTR pszSelPath = NULL,
|
||||
IN CWnd* pWndParent = NULL,
|
||||
IN UINT uFlags = BIF_RETURNONLYFSDIRS );
|
||||
virtual ~CFolderDialog( VOID );
|
||||
|
||||
public:
|
||||
#if ( _MFC_VER >= 0x0700 ) // VC++ 2002 (7.0)
|
||||
virtual INT_PTR DoModal( VOID );
|
||||
#else
|
||||
virtual INT DoModal( VOID );
|
||||
#endif
|
||||
|
||||
BOOL SetRootFolder( IN LPCTSTR pszPath );
|
||||
BOOL GetRootFolder( IN OUT LPTSTR pszPath );
|
||||
BOOL SetSelectedFolder( IN LPCTSTR pszPath );
|
||||
|
||||
public:
|
||||
AFX_INLINE LPCTSTR GetFolderPath( VOID ) const;
|
||||
AFX_INLINE LPCTSTR GetFolderName( VOID ) const;
|
||||
AFX_INLINE INT GetFolderImage( VOID ) const;
|
||||
AFX_INLINE LPCTSTR GetSelectedFolder( VOID ) const;
|
||||
|
||||
AFX_INLINE BROWSEINFO& GetBI( VOID );
|
||||
AFX_INLINE const BROWSEINFO& GetBI( VOID ) const;
|
||||
|
||||
protected:
|
||||
BROWSEINFO m_bi;
|
||||
|
||||
TCHAR m_szSelPath[ MAX_PATH ];
|
||||
TCHAR m_szFolPath[ MAX_PATH ];
|
||||
|
||||
protected:
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
protected: // Overridables
|
||||
|
||||
virtual VOID OnInitialized( VOID );
|
||||
virtual VOID OnSelChanged( IN LPITEMIDLIST pItemIDList );
|
||||
virtual INT OnValidateFailed( IN LPCTSTR /*pszPath*/ );
|
||||
|
||||
protected: // Windows XP or later
|
||||
virtual VOID OnIUnknown( IN IUnknown* /*pIUnknown*/ );
|
||||
|
||||
protected: // Valid to call only from the above handlers
|
||||
|
||||
VOID EnableOK( IN BOOL bEnable = TRUE );
|
||||
VOID SetSelection( IN LPITEMIDLIST pItemIDList );
|
||||
VOID SetSelection( IN LPCTSTR pszPath );
|
||||
VOID SetStatusText( IN LPCTSTR pszText );
|
||||
|
||||
protected: // Shell version 5.0 or later:
|
||||
VOID SetExpanded( IN LPCTSTR pszPath );
|
||||
VOID SetExpanded( IN LPITEMIDLIST pItemIDList );
|
||||
VOID SetOKText( IN LPCTSTR pszText );
|
||||
|
||||
private:
|
||||
HWND m_hWnd; // used only in the callback function
|
||||
|
||||
private:
|
||||
static INT CALLBACK BrowseCallbackProc(
|
||||
IN HWND hWnd, IN UINT uMsg, IN LPARAM lParam, IN LPARAM lpData
|
||||
);
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AFX_INLINE LPCTSTR CFolderDialog::GetSelectedFolder( VOID ) const
|
||||
{ return m_szSelPath; }
|
||||
|
||||
AFX_INLINE BROWSEINFO& CFolderDialog::GetBI( VOID )
|
||||
{ return m_bi; }
|
||||
|
||||
AFX_INLINE const BROWSEINFO& CFolderDialog::GetBI( VOID ) const
|
||||
{ return m_bi; }
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Filled after a call to DoModal
|
||||
|
||||
AFX_INLINE LPCTSTR CFolderDialog::GetFolderPath( VOID ) const
|
||||
{ return m_szFolPath; }
|
||||
|
||||
AFX_INLINE LPCTSTR CFolderDialog::GetFolderName( VOID ) const
|
||||
{ return m_bi.pszDisplayName; }
|
||||
|
||||
AFX_INLINE INT CFolderDialog::GetFolderImage( VOID ) const
|
||||
{ return m_bi.iImage; }
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // __FOLDERDLG_H__
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Loaded 100 of 1491 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user