mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 22:56:30 -10:00
Compare commits
521
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb46c94d08 | ||
|
|
3afde9b623 | ||
|
|
65aceccc13 | ||
|
|
e37bc109c8 | ||
|
|
dafca28717 | ||
|
|
2a9e6719a7 | ||
|
|
aed59d2125 | ||
|
|
c599955813 | ||
|
|
3bcab10109 | ||
|
|
78cf382996 | ||
|
|
54b2994204 | ||
|
|
3960161427 | ||
|
|
0b68d9c09c | ||
|
|
66285e2cab | ||
|
|
ff8607d74e | ||
|
|
acf72ef431 | ||
|
|
9f61dd5286 | ||
|
|
6e6b4b1620 | ||
|
|
3b9869a00a | ||
|
|
c761256461 | ||
|
|
5f7b9159b8 | ||
|
|
89291af840 | ||
|
|
6401a8266d | ||
|
|
8706f824fa | ||
|
|
77a0d6a841 | ||
|
|
4e590a6761 | ||
|
|
953f47560e | ||
|
|
f3d747db32 | ||
|
|
117dd15bda | ||
|
|
5431beb81d | ||
|
|
3f349849d6 | ||
|
|
ff675c3653 | ||
|
|
0eb5606527 | ||
|
|
2f22873e35 | ||
|
|
03144d3846 | ||
|
|
638ad77a21 | ||
|
|
4e98285d2a | ||
|
|
a7428c5a72 | ||
|
|
6f906561bb | ||
|
|
3ef41e164c | ||
|
|
159d8e7107 | ||
|
|
b4dad30c77 | ||
|
|
64efaddaab | ||
|
|
ebfdf4e901 | ||
|
|
5dc4bfea97 | ||
|
|
05702504c4 | ||
|
|
08dad5b3af | ||
|
|
a2b42bf5f1 | ||
|
|
3490ac3a9c | ||
|
|
37ded5589d | ||
|
|
cef02e7b9f | ||
|
|
a72f0f9d62 | ||
|
|
6d5e026a3e | ||
|
|
df73bacb9e | ||
|
|
d97f31d034 | ||
|
|
a880bcb9c2 | ||
|
|
dbe5f61dd6 | ||
|
|
0a9063a525 | ||
|
|
827286ec95 | ||
|
|
aeb089b216 | ||
|
|
5fa9a5c946 | ||
|
|
0d54630e83 | ||
|
|
f97e478c6d | ||
|
|
3b19fab1c1 | ||
|
|
6d52a7c2b2 | ||
|
|
0288075eb0 | ||
|
|
cf0928ab8c | ||
|
|
b2231f28d1 | ||
|
|
846cdad098 | ||
|
|
64dad52741 | ||
|
|
2936dde64f | ||
|
|
f02cba4090 | ||
|
|
7241a6b686 | ||
|
|
0572c25aa1 | ||
|
|
d503d1d42e | ||
|
|
0b494959e1 | ||
|
|
f9f2b1e8d7 | ||
|
|
e4009799c6 | ||
|
|
d36fc2a88e | ||
|
|
6b39db6b12 | ||
|
|
6e8a90fbbc | ||
|
|
0794dcded3 | ||
|
|
dc37d2e5de | ||
|
|
5050494c45 | ||
|
|
c08aaf1ec2 | ||
|
|
8fb2a7ffad | ||
|
|
0cac254b04 | ||
|
|
9f67d2e337 | ||
|
|
2605583be6 | ||
|
|
e1711a326e | ||
|
|
270d3d9248 | ||
|
|
7f74ce48a6 | ||
|
|
31ab1cff2c | ||
|
|
dbded13fa4 | ||
|
|
ef94f4bb04 | ||
|
|
1adabef7bd | ||
|
|
c27f75cd5a | ||
|
|
7ef94f084b | ||
|
|
cd9c2f851b | ||
|
|
2c34ca0218 | ||
|
|
cecc445e8b | ||
|
|
7f05cca670 | ||
|
|
4d7c218d59 | ||
|
|
770cd66755 | ||
|
|
0b4f71c84d | ||
|
|
b090ea1f68 | ||
|
|
84728de587 | ||
|
|
a04e83ab01 | ||
|
|
180115feba | ||
|
|
e93e27fc0d | ||
|
|
61d9ce895b | ||
|
|
0115235de7 | ||
|
|
63ab561e59 | ||
|
|
9ff8f21b1f | ||
|
|
69749cdaee | ||
|
|
9cd218a595 | ||
|
|
5875b4f3a3 | ||
|
|
08f36eb32c | ||
|
|
f834aa80a9 | ||
|
|
b35ba0e419 | ||
|
|
d753954bcb | ||
|
|
5664773a29 | ||
|
|
8105d2a372 | ||
|
|
34b1f276f3 | ||
|
|
975f94f207 | ||
|
|
d9b45b0eb2 | ||
|
|
1ff223687d | ||
|
|
a45af2f019 | ||
|
|
da4b191160 | ||
|
|
459e2bd469 | ||
|
|
9e73870862 | ||
|
|
c5c7e58507 | ||
|
|
6d3b183373 | ||
|
|
d904a4d516 | ||
|
|
def53398bc | ||
|
|
620f6aaf3d | ||
|
|
3ffe479cca | ||
|
|
7d846defa5 | ||
|
|
aa60c5acec | ||
|
|
336db15246 | ||
|
|
6d402f43aa | ||
|
|
9480b079ca | ||
|
|
7b9f485a34 | ||
|
|
d13236e0e4 | ||
|
|
a3256bbf88 | ||
|
|
0402e46f89 | ||
|
|
706152c7d5 | ||
|
|
e6d4b83907 | ||
|
|
45d6f9be21 | ||
|
|
ce41e56f46 | ||
|
|
3eedfc7853 | ||
|
|
645ee9a2ba | ||
|
|
be08468a81 | ||
|
|
ab1b8912b7 | ||
|
|
e75a09d203 | ||
|
|
f3c902c39b | ||
|
|
6804e5ae7d | ||
|
|
6443005f5c | ||
|
|
07dbfed088 | ||
|
|
7ff59d0559 | ||
|
|
9f65775702 | ||
|
|
1e78f8c6e1 | ||
|
|
1c74472423 | ||
|
|
49c56eea91 | ||
|
|
9d6fdb07ba | ||
|
|
54a4f26146 | ||
|
|
41fee37f3f | ||
|
|
4c93092045 | ||
|
|
14fc0cfd88 | ||
|
|
c19ac5df9d | ||
|
|
1467b0ef16 | ||
|
|
3bc14442c5 | ||
|
|
668e67c52d | ||
|
|
4b7543361b | ||
|
|
e58cbc159b | ||
|
|
da6c95b8c4 | ||
|
|
69c7ee68f5 | ||
|
|
af9b12e448 | ||
|
|
b7a7bb968e | ||
|
|
85e39497cd | ||
|
|
b6b3a24e05 | ||
|
|
cb446460e4 | ||
|
|
396afcacf8 | ||
|
|
7f20857796 | ||
|
|
a59be2e7c7 | ||
|
|
1a3fc26bfe | ||
|
|
ad1bef5344 | ||
|
|
0fb563b241 | ||
|
|
9ec027641d | ||
|
|
92435f7217 | ||
|
|
141f6bc121 | ||
|
|
96cc3c017d | ||
|
|
4e54350dcc | ||
|
|
04e7b4c288 | ||
|
|
3bbd389420 | ||
|
|
4611a77dbd | ||
|
|
9ca44d8ce4 | ||
|
|
40c4583792 | ||
|
|
724e7816e4 | ||
|
|
204ebfca63 | ||
|
|
70d05d3815 | ||
|
|
8cd19aa588 | ||
|
|
1cb031c190 | ||
|
|
f6a92e0972 | ||
|
|
bad6af8a3a | ||
|
|
b2167c61a3 | ||
|
|
e8a7c8cf57 | ||
|
|
6470f9043f | ||
|
|
da21b44d07 | ||
|
|
4581ed9aa2 | ||
|
|
5ceabf1e8b | ||
|
|
5ebd06bb29 | ||
|
|
858afb0cef | ||
|
|
13c8f95046 | ||
|
|
8179453ffa | ||
|
|
389a2c6955 | ||
|
|
9cdd329f11 | ||
|
|
da92a1a709 | ||
|
|
f01eefe832 | ||
|
|
f4a7a117e4 | ||
|
|
7585aed83b | ||
|
|
f8dcbffab8 | ||
|
|
e5115993bf | ||
|
|
ea93153446 | ||
|
|
70f84212df | ||
|
|
a739c172f4 | ||
|
|
b4ab0f3a44 | ||
|
|
7a1b8d5be1 | ||
|
|
ed49e0786b | ||
|
|
e5260a381a | ||
|
|
95ab88de98 | ||
|
|
ae429e756e | ||
|
|
442f3fb846 | ||
|
|
1dad7f799e | ||
|
|
b2958b5e4a | ||
|
|
fa7cf7a910 | ||
|
|
33b871d29d | ||
|
|
6bc71834ec | ||
|
|
35347262d4 | ||
|
|
de792bc0ca | ||
|
|
ed04c7788b | ||
|
|
e9fc00df0c | ||
|
|
551ba6ba1a | ||
|
|
fcb31d94c1 | ||
|
|
b7db596f12 | ||
|
|
13513588df | ||
|
|
6b97f368e8 | ||
|
|
d310647bfe | ||
|
|
ed06a01897 | ||
|
|
7413a7a7d2 | ||
|
|
0299c7e42b | ||
|
|
c0a3d69ed2 | ||
|
|
3b89290cd8 | ||
|
|
d11c7ccc2f | ||
|
|
afe08580c0 | ||
|
|
3aeee91f14 | ||
|
|
e0fa46a185 | ||
|
|
cc8310a491 | ||
|
|
0e34a25207 | ||
|
|
d9ac71740a | ||
|
|
8009d34928 | ||
|
|
07e35d7bd1 | ||
|
|
2d9dfebae3 | ||
|
|
93e3461748 | ||
|
|
5c8d8f6ded | ||
|
|
fa1403f9a9 | ||
|
|
af81604303 | ||
|
|
eefa00cb19 | ||
|
|
196bfa25d3 | ||
|
|
a2fe09fe6c | ||
|
|
184df2fb9e | ||
|
|
1f2005ab02 | ||
|
|
6f3e773359 | ||
|
|
e4f63a227c | ||
|
|
25d5cf17f0 | ||
|
|
db183e021c | ||
|
|
521e31d766 | ||
|
|
ec56e7771a | ||
|
|
551a539fe8 | ||
|
|
0d4cc04cd6 | ||
|
|
9525d19b89 | ||
|
|
ca0bcd5dbf | ||
|
|
6836199eeb | ||
|
|
f883a4bc09 | ||
|
|
90e7709da5 | ||
|
|
8a8c338409 | ||
|
|
f571d2336f | ||
|
|
6cbc4f78c4 | ||
|
|
e6a77d8a34 | ||
|
|
6e265e7e96 | ||
|
|
39024965b8 | ||
|
|
5d73931b6d | ||
|
|
686088fa90 | ||
|
|
7e6cb331bf | ||
|
|
45791f371d | ||
|
|
b5e0647d54 | ||
|
|
7b0f6b310b | ||
|
|
d20df5b4c9 | ||
|
|
1ab4286a25 | ||
|
|
80320485c1 | ||
|
|
f8b3d75fa4 | ||
|
|
4bf48943d4 | ||
|
|
c17fd1af7d | ||
|
|
6a8bc0a5ed | ||
|
|
f3318caef7 | ||
|
|
fa04b7c412 | ||
|
|
941fcf34ef | ||
|
|
522299eadf | ||
|
|
5aa3bddf70 | ||
|
|
f301cefe2c | ||
|
|
3df8818635 | ||
|
|
758bf662e7 | ||
|
|
629ca0cdc0 | ||
|
|
aa3f9080d9 | ||
|
|
617e4472a2 | ||
|
|
2c03139f97 | ||
|
|
797ffdf0f4 | ||
|
|
7b3a2ddeb5 | ||
|
|
575bc3bcce | ||
|
|
7f7f857559 | ||
|
|
e39c972f3d | ||
|
|
24e7810b24 | ||
|
|
f5757f8591 | ||
|
|
0e561c822a | ||
|
|
a43062a426 | ||
|
|
aaab9f2f00 | ||
|
|
eb1cfc9ef7 | ||
|
|
5f5d13f2b6 | ||
|
|
93992f55ff | ||
|
|
5586cd14b0 | ||
|
|
4a422d3398 | ||
|
|
2615ca9ab0 | ||
|
|
6002874610 | ||
|
|
b790092b50 | ||
|
|
63de4932f8 | ||
|
|
df6f8b5292 | ||
|
|
9df9586ef0 | ||
|
|
8d371f9e94 | ||
|
|
22cfa72250 | ||
|
|
c1aaefea08 | ||
|
|
bce047db1e | ||
|
|
92712f5579 | ||
|
|
9ed68b129d | ||
|
|
5312b47983 | ||
|
|
a81491161e | ||
|
|
81a40458c2 | ||
|
|
ea6edd3f8c | ||
|
|
6b3c7bd83e | ||
|
|
7343c92c23 | ||
|
|
7298f50b7a | ||
|
|
6021fb4bea | ||
|
|
184cda8e58 | ||
|
|
e725bfc7a1 | ||
|
|
af56b43beb | ||
|
|
762045168a | ||
|
|
73ebcda173 | ||
|
|
2359bd5c7a | ||
|
|
75148a3f76 | ||
|
|
a0c510e1c6 | ||
|
|
595a4c44c5 | ||
|
|
8dc043ae23 | ||
|
|
22d491e50b | ||
|
|
0a7409c7a8 | ||
|
|
f77dd3c219 | ||
|
|
ae169ebb39 | ||
|
|
92e5d5bee3 | ||
|
|
01629bd946 | ||
|
|
7348b9b08d | ||
|
|
2fe56e6780 | ||
|
|
e991f7b3ac | ||
|
|
14058b834d | ||
|
|
a7c074e5c3 | ||
|
|
d0d932fb43 | ||
|
|
a2b7935a15 | ||
|
|
02afed1d78 | ||
|
|
2f573aeb29 | ||
|
|
26f8b5fed1 | ||
|
|
9e8356b72c | ||
|
|
e68d8097cd | ||
|
|
5531c0d6b4 | ||
|
|
0c4c9ec9c9 | ||
|
|
3e3714fb8d | ||
|
|
0f1971c5aa | ||
|
|
bdc0767bb0 | ||
|
|
d3e0a2b904 | ||
|
|
96e2f96f1a | ||
|
|
4d63d6ea05 | ||
|
|
ee1711ed0b | ||
|
|
b26ec341bd | ||
|
|
1861195702 | ||
|
|
576baed1d3 | ||
|
|
019c18fab4 | ||
|
|
d7cc54b324 | ||
|
|
910d4bd293 | ||
|
|
5f0351c72b | ||
|
|
7e1ad3dd5b | ||
|
|
a02b97b25a | ||
|
|
f44356a4c5 | ||
|
|
63df481478 | ||
|
|
f1d0d36647 | ||
|
|
40af858593 | ||
|
|
ad1c2f0ecd | ||
|
|
e8a15e7b22 | ||
|
|
f164e30b0b | ||
|
|
a2ac3497b8 | ||
|
|
5135771062 | ||
|
|
5022356faa | ||
|
|
55c2f4b156 | ||
|
|
7adf66330d | ||
|
|
8b78abd7a6 | ||
|
|
5ec75bdd06 | ||
|
|
79415c262a | ||
|
|
3e4eca4104 | ||
|
|
82fbd9a7c1 | ||
|
|
67b171612d | ||
|
|
69e1d4e36b | ||
|
|
52381d05db | ||
|
|
16e60920cf | ||
|
|
62d06cfcd9 | ||
|
|
ece9b2034b | ||
|
|
05a298c68d | ||
|
|
8a72823839 | ||
|
|
c7f6394d6c | ||
|
|
8e096f5c15 | ||
|
|
52edd5b112 | ||
|
|
52e9c4a8e0 | ||
|
|
5c0a97db80 | ||
|
|
cebded3acb | ||
|
|
7e5b2aee52 | ||
|
|
4a9d457154 | ||
|
|
c46c0d1412 | ||
|
|
444d4b801a | ||
|
|
2ee1b24b65 | ||
|
|
fe934190ac | ||
|
|
b4cc5d72f4 | ||
|
|
e7cbe63a08 | ||
|
|
f0830b6d64 | ||
|
|
7248acc004 | ||
|
|
4a1e2cb4c5 | ||
|
|
fc191a40f2 | ||
|
|
97e18cd758 | ||
|
|
4bd10888ff | ||
|
|
d8e4b8de55 | ||
|
|
d1ac95963f | ||
|
|
e2281c39cb | ||
|
|
2e779e8bef | ||
|
|
38ae06e97d | ||
|
|
3f6f498340 | ||
|
|
8cf10e86f8 | ||
|
|
886018d28f | ||
|
|
0dfcea3b22 | ||
|
|
7f90f5c674 | ||
|
|
fcf6d56774 | ||
|
|
ebe1043a13 | ||
|
|
cc0caf5e55 | ||
|
|
c0919e0777 | ||
|
|
d993c3e1f5 | ||
|
|
46ad62f831 | ||
|
|
b3798527a0 | ||
|
|
81c5c06218 | ||
|
|
6d6c82c652 | ||
|
|
e19e9d1afd | ||
|
|
32bd62bc18 | ||
|
|
ec02c3c972 | ||
|
|
138e6b853f | ||
|
|
0a1379159d | ||
|
|
809ee2483d | ||
|
|
9a602777bd | ||
|
|
41af7e5ec0 | ||
|
|
5a6493fa62 | ||
|
|
143463b478 | ||
|
|
f98030b122 | ||
|
|
fd21b9054b | ||
|
|
d5f03daa6b | ||
|
|
96587dd2ab | ||
|
|
0debee3c51 | ||
|
|
3550b720cb | ||
|
|
42d096a3c2 | ||
|
|
a921665872 | ||
|
|
52413c944f | ||
|
|
602e608065 | ||
|
|
06900df8df | ||
|
|
6c88f96cc0 | ||
|
|
7fad36e90c | ||
|
|
3d1edee29a | ||
|
|
0b0b3fdf70 | ||
|
|
2691085f9f | ||
|
|
800602701a | ||
|
|
18ca1c08db | ||
|
|
8f7320119e | ||
|
|
d7fc8372aa | ||
|
|
f38b90f431 | ||
|
|
c251c031f0 | ||
|
|
7b53a46e88 | ||
|
|
5b7c056cb1 | ||
|
|
53d0129e8f | ||
|
|
6524a2140f | ||
|
|
134b0dd757 | ||
|
|
315373e952 | ||
|
|
99ef01ff6d | ||
|
|
d619d86976 | ||
|
|
d60a930dc2 | ||
|
|
4eb1787e4e | ||
|
|
0f7d8ec579 | ||
|
|
878a7a1921 | ||
|
|
12de1de128 | ||
|
|
cf4fa30f0f | ||
|
|
fb33fe020b | ||
|
|
59762a4db7 | ||
|
|
d4d10dedd9 | ||
|
|
e776f8e5dd | ||
|
|
f8a74ae5c9 | ||
|
|
f410440604 | ||
|
|
bccd0533bd | ||
|
|
c6397750e0 | ||
|
|
f5f42f65fa | ||
|
|
ce118c232c | ||
|
|
509f509347 | ||
|
|
bda6c72d31 | ||
|
|
b5f278c91c | ||
|
|
17c7d0be26 |
No files matched your search
@@ -465,15 +465,6 @@ void parse_ai_profiles_tbl(const char *filename)
|
||||
|
||||
set_flag(profile, "$strict turret-tagged-only targeting:", AIPF2_STRICT_TURRET_TAGGED_ONLY_TARGETING, AIP_FLAG2);
|
||||
|
||||
profile->bay_arrive_speed_mult = 1.0f;
|
||||
profile->bay_depart_speed_mult = 1.0f;
|
||||
if (optional_string("$bay arrive start speed multiplier:")) {
|
||||
stuff_float(&profile->bay_arrive_speed_mult);
|
||||
}
|
||||
if (optional_string("$bay depart end speed multiplier:")) {
|
||||
stuff_float(&profile->bay_depart_speed_mult);
|
||||
}
|
||||
|
||||
// ----------
|
||||
|
||||
// compatibility
|
||||
|
||||
@@ -151,11 +151,6 @@ typedef struct ai_profile_t {
|
||||
|
||||
int ai_path_mode;
|
||||
|
||||
// Ships flying bay paths will gradually accelerate/decelerate instead of
|
||||
// flying the whole path at max speed
|
||||
float bay_arrive_speed_mult;
|
||||
float bay_depart_speed_mult;
|
||||
|
||||
} ai_profile_t;
|
||||
|
||||
|
||||
|
||||
+2
-48
@@ -4010,57 +4010,11 @@ float ai_path_1()
|
||||
dot_to_next = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gnvp);
|
||||
|
||||
// This path mode respects the "cap-waypoint-speed" SEXP
|
||||
float max_allowed_speed = 0.0f;
|
||||
float max_allowed_speed = 0;
|
||||
if ( aip->waypoint_speed_cap > 0) {
|
||||
max_allowed_speed = (float) aip->waypoint_speed_cap;
|
||||
}
|
||||
|
||||
// Maybe gradually ramp up/down the speed of a ship flying a fighterbay path
|
||||
if (aip->mode == AIM_BAY_EMERGE || (aip->mode == AIM_BAY_DEPART && aip->path_cur != aip->path_start)) {
|
||||
SCP_string pathName(pm->paths[Path_points[aip->path_start].path_num].name);
|
||||
ship_info *gsip = &Ship_info[gshipp->ship_info_index];
|
||||
float speed_mult = 1.0f;
|
||||
|
||||
if (aip->mode == AIM_BAY_EMERGE) { // Arriving
|
||||
if (gsip->pathMetadata.find(pathName) != gsip->pathMetadata.end()) {
|
||||
speed_mult = gsip->pathMetadata[pathName].arrive_speed_mult;
|
||||
}
|
||||
|
||||
if (speed_mult == FLT_MIN) {
|
||||
speed_mult = The_mission.ai_profile->bay_arrive_speed_mult;
|
||||
}
|
||||
} else { // Departing
|
||||
if (gsip->pathMetadata.find(pathName) != gsip->pathMetadata.end()) {
|
||||
speed_mult = gsip->pathMetadata[pathName].depart_speed_mult;
|
||||
}
|
||||
|
||||
if (speed_mult == FLT_MIN) {
|
||||
speed_mult = The_mission.ai_profile->bay_depart_speed_mult;
|
||||
}
|
||||
}
|
||||
|
||||
if (speed_mult != 1.0f) {
|
||||
// We use the distance between the first and last point on the path here; it's not accurate
|
||||
// if the path is not straight, but should be good enough usually; can be changed if necessary.
|
||||
float total_path_length = vm_vec_dist_quick(&Path_points[aip->path_start].pos, &Path_points[aip->path_start + num_points - 1].pos);
|
||||
float dist_to_end;
|
||||
|
||||
if (aip->mode == AIM_BAY_EMERGE) { // Arriving
|
||||
dist_to_end = vm_vec_dist_quick(&Pl_objp->pos, &Path_points[aip->path_start].pos);
|
||||
} else { // Departing
|
||||
dist_to_end = vm_vec_dist_quick(&Pl_objp->pos, &Path_points[aip->path_start + num_points - 1].pos);
|
||||
}
|
||||
|
||||
// Calculate max speed, but respect the waypoint speed cap if it's lower
|
||||
float max_bay_speed = sip->max_speed * (speed_mult + (1.0f - speed_mult) * (dist_to_end / total_path_length));
|
||||
if (max_allowed_speed == 0.0f) {
|
||||
max_allowed_speed = max_bay_speed;
|
||||
} else {
|
||||
max_allowed_speed = MIN(max_allowed_speed, max_bay_speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set_accel_for_docking(Pl_objp, aip, dot, dot_to_next, dist_to_next, dist_to_goal, sip, max_allowed_speed);
|
||||
aip->prev_dot_to_goal = dot;
|
||||
|
||||
@@ -7628,7 +7582,7 @@ void update_aspect_lock_information(ai_info *aip, vec3d *vec_to_enemy, float dis
|
||||
|
||||
wip = &Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]];
|
||||
|
||||
if (num_weapon_types && (wip->wi_flags & WIF_LOCKED_HOMING) && !(shipp->flags2 & SF2_NO_SECONDARY_LOCKON)) {
|
||||
if (num_weapon_types && (wip->wi_flags & WIF_LOCKED_HOMING)) {
|
||||
if (dist_to_enemy > 300.0f - MIN(enemy_radius, 100.0f))
|
||||
aip->ai_flags |= AIF_SEEK_LOCK;
|
||||
else
|
||||
|
||||
@@ -63,7 +63,6 @@ union bm_extra_info {
|
||||
// stuff for static animations
|
||||
ubyte type; //!< type for individual images
|
||||
char filename[MAX_FILENAME_LEN]; //!< filename for individual images
|
||||
bool in_subdir; // Whether frames are in their own subdirectory
|
||||
} eff;
|
||||
} ani;
|
||||
|
||||
|
||||
+19
-115
@@ -34,7 +34,6 @@
|
||||
#include "pngutils/pngutils.h"
|
||||
#include "ship/ship.h"
|
||||
#include "tgautils/tgautils.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
@@ -49,20 +48,7 @@
|
||||
/**
|
||||
* @todo upgrade this to an inline funciton, taking bitmap_entry and const char* as arguments
|
||||
*/
|
||||
#define EFF_FILENAME_CHECK \
|
||||
{ \
|
||||
if ( be->type == BM_TYPE_EFF ) { \
|
||||
strcpy_s( filename, be->info.ani.eff.filename ); \
|
||||
if (be->info.ani.eff.in_subdir) { \
|
||||
if (!set_temp_subdir_pathtype(bm_bitmaps[be->info.ani.first_frame].filename)) { \
|
||||
mprintf(("BMPMAN: Failed to set temporary pathtype for %s: EFF_FILENAME_CHECK failed!\n", be->filename)); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
strcpy_s( filename, be->filename ); \
|
||||
} \
|
||||
}
|
||||
#define EFF_FILENAME_CHECK { if ( be->type == BM_TYPE_EFF ) strcpy_s( filename, be->info.ani.eff.filename ); else strcpy_s( filename, be->filename ); }
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Monitor variables
|
||||
MONITOR(NumBitmapPage)
|
||||
@@ -80,20 +66,9 @@ int MISCMAP = -1;
|
||||
int bm_texture_ram = 0;
|
||||
int Bm_paging = 0;
|
||||
|
||||
// Extension type lists
|
||||
const ubyte bm_type_list[] = { BM_TYPE_DDS, BM_TYPE_TGA, BM_TYPE_PNG, BM_TYPE_JPG, BM_TYPE_PCX };
|
||||
const char *bm_ext_list[] = { ".dds", ".tga", ".png", ".jpg", ".pcx" };
|
||||
const int BM_NUM_TYPES = sizeof(bm_type_list) / sizeof(ubyte);
|
||||
|
||||
const ubyte bm_ani_type_list[] = { BM_TYPE_EFF, BM_TYPE_ANI };
|
||||
const char *bm_ani_ext_list[] = { ".eff", ".ani" };
|
||||
const int BM_ANI_NUM_TYPES = sizeof(bm_ani_type_list) / sizeof(ubyte);
|
||||
|
||||
void(*bm_set_components)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a) = NULL;
|
||||
void(*bm_set_components_32)(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a) = NULL;
|
||||
|
||||
extern cf_pathtype Pathtypes[CF_MAX_PATH_TYPES];
|
||||
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// Declaration of protected variables (defined in cmdline.cpp).
|
||||
extern int Cmdline_cache_bitmaps;
|
||||
@@ -965,18 +940,22 @@ int bm_load(const char *real_filename) {
|
||||
|
||||
// Lets find out what type it is
|
||||
{
|
||||
const int NUM_TYPES = 5;
|
||||
const ubyte type_list[NUM_TYPES] = { BM_TYPE_DDS, BM_TYPE_TGA, BM_TYPE_PNG, BM_TYPE_JPG, BM_TYPE_PCX };
|
||||
const char *ext_list[NUM_TYPES] = { ".dds", ".tga", ".png", ".jpg", ".pcx" };
|
||||
|
||||
// see if it's already loaded (checks for any type with filename)
|
||||
if (bm_load_sub_fast(filename, &handle))
|
||||
return handle;
|
||||
|
||||
// if we are still here then we need to fall back to a file-based search
|
||||
int rval = bm_load_sub_slow(filename, BM_NUM_TYPES, bm_ext_list, &img_cfp);
|
||||
int rval = bm_load_sub_slow(filename, NUM_TYPES, ext_list, &img_cfp);
|
||||
|
||||
if (rval < 0)
|
||||
return -1;
|
||||
|
||||
strcat_s(filename, bm_ext_list[rval]);
|
||||
type = bm_type_list[rval];
|
||||
strcat_s(filename, ext_list[rval]);
|
||||
type = type_list[rval];
|
||||
}
|
||||
|
||||
Assert(type != BM_TYPE_NONE);
|
||||
@@ -1042,9 +1021,8 @@ int bm_load(const SCP_string& filename) {
|
||||
return bm_load(filename.c_str());
|
||||
}
|
||||
|
||||
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type, bool *in_subdir) {
|
||||
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type) {
|
||||
int frames = 0, fps = 30, keyframe = 0, rval;
|
||||
bool subdir = false;
|
||||
char ext[8];
|
||||
ubyte c_type = BM_TYPE_NONE;
|
||||
char file_text[1024];
|
||||
@@ -1079,10 +1057,6 @@ int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int
|
||||
if (optional_string("$Keyframe:"))
|
||||
stuff_int(&keyframe);
|
||||
|
||||
if (optional_string( "$Subdir:" )) {
|
||||
stuff_boolean(&subdir);}
|
||||
|
||||
|
||||
// done with EFF so unpause parsing so whatever can continue
|
||||
unpause_parse();
|
||||
|
||||
@@ -1119,8 +1093,6 @@ int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int
|
||||
if (key)
|
||||
*key = keyframe;
|
||||
|
||||
*in_subdir = subdir;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1131,11 +1103,13 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
int reduced = 0;
|
||||
int anim_fps = 0, anim_frames = 0, key = 0;
|
||||
bool in_subdir = false;
|
||||
int anim_width = 0, anim_height = 0;
|
||||
ubyte type = BM_TYPE_NONE, eff_type = BM_TYPE_NONE, c_type = BM_TYPE_NONE;
|
||||
int bpp = 0, mm_lvl = 0, img_size = 0;
|
||||
char clean_name[MAX_FILENAME_LEN];
|
||||
const int NUM_TYPES = 2;
|
||||
const ubyte type_list[NUM_TYPES] = { BM_TYPE_EFF, BM_TYPE_ANI };
|
||||
const char *ext_list[NUM_TYPES] = { ".eff", ".ani" };
|
||||
|
||||
if (!bm_inited)
|
||||
bm_init();
|
||||
@@ -1197,13 +1171,13 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
}
|
||||
|
||||
// if we are still here then we need to fall back to a file-based search
|
||||
int rval = bm_load_sub_slow(filename, BM_ANI_NUM_TYPES, bm_ani_ext_list, &img_cfp, dir_type);
|
||||
int rval = bm_load_sub_slow(filename, NUM_TYPES, ext_list, &img_cfp, dir_type);
|
||||
|
||||
if (rval < 0)
|
||||
return -1;
|
||||
|
||||
strcat_s(filename, bm_ani_ext_list[rval]);
|
||||
type = bm_ani_type_list[rval];
|
||||
strcat_s(filename, ext_list[rval]);
|
||||
type = type_list[rval];
|
||||
}
|
||||
|
||||
// If we found an animation then there is an extra 5 char size limit to adhere to. We don't do this check earlier since it's only needed if we found an anim
|
||||
@@ -1218,7 +1192,7 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
|
||||
// it's an effect file, any readable image type with eff being txt
|
||||
if (type == BM_TYPE_EFF) {
|
||||
if (bm_load_and_parse_eff(filename, dir_type, &anim_frames, &anim_fps, &key, &eff_type, &in_subdir) != 0 ) {
|
||||
if (bm_load_and_parse_eff(filename, dir_type, &anim_frames, &anim_fps, &key, &eff_type) != 0) {
|
||||
mprintf(("BMPMAN: Error reading EFF\n"));
|
||||
return -1;
|
||||
} else {
|
||||
@@ -1280,10 +1254,6 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (in_subdir) {
|
||||
set_temp_subdir_pathtype(filename);
|
||||
}
|
||||
|
||||
int first_handle = bm_get_next_handle();
|
||||
|
||||
Assert(strlen(filename) < MAX_FILENAME_LEN);
|
||||
@@ -1349,11 +1319,6 @@ int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *ke
|
||||
bm_bitmaps[n + i].num_mipmaps = mm_lvl;
|
||||
bm_bitmaps[n + i].mem_taken = img_size;
|
||||
bm_bitmaps[n + i].dir_type = dir_type;
|
||||
bm_bitmaps[n + i].info.ani.eff.in_subdir = in_subdir;
|
||||
if (in_subdir)
|
||||
bm_bitmaps[n + i].dir_type = CF_TYPE_TEMP_SUBDIR_LOOKUP;
|
||||
else
|
||||
bm_bitmaps[n + i].dir_type = dir_type;
|
||||
|
||||
bm_bitmaps[n + i].load_count++;
|
||||
|
||||
@@ -1527,8 +1492,8 @@ bitmap * bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug) {
|
||||
// read the file data
|
||||
if (gr_bm_lock(be->filename, handle, bitmapnum, bpp, flags, nodebug) == -1) {
|
||||
// oops, this isn't good - reset and return NULL
|
||||
bm_unlock( handle );
|
||||
bm_unload( handle );
|
||||
bm_unlock(bitmapnum);
|
||||
bm_unload(bitmapnum);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -2097,61 +2062,6 @@ void bm_page_in_start() {
|
||||
gr_bm_page_in_start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stuffs Pathtypes with an additional path leading to a subdir of the same name as the given file (minus file extension).
|
||||
* Used for allowing frames of .eff animations to be found in their own subdirectories.
|
||||
*
|
||||
* Example: if called with "debris.eff" and that file is in data/maps, then Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path
|
||||
* will be stuffed with data/maps/debris, allowing data/maps/debris/debris_0000.dds (etc) to be found
|
||||
*/
|
||||
bool set_temp_subdir_pathtype(const char *filename) {
|
||||
// Gets the absolute path of the file, removes the part that is identical with the
|
||||
// absolute root path and appends the filename to it (without extension), giving us
|
||||
// a relative path that can be temporarily stuffed into Pathtypes so the frames can be found
|
||||
|
||||
char fullpath[MAX_PATH]; // Absolute path to the given file
|
||||
char fullrootpath[MAX_PATH]; // Absolute root path
|
||||
int size, offset; // Needed for cf_find_file_location, but not used
|
||||
|
||||
cf_create_default_path_string(fullrootpath, sizeof(fullrootpath) - 1, CF_TYPE_ROOT, NULL);
|
||||
if (!cf_find_file_location(filename, CF_TYPE_ANY, sizeof(fullpath)-1, fullpath, &size, &offset)) {
|
||||
mprintf(("BMPMAN: Failed to set temporary pathtype for %s: file not found!\n", filename));
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (strlen(fullpath) < strlen(fullrootpath)) {
|
||||
mprintf(("BMPMAN: Path to %s was shorter than the root path, programmer thought it could never happen!\n%s\n%s\n", filename, fullpath, fullrootpath));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
mprintf(("BMPMAN: Setting temporary pathtype for %s... ", filename));
|
||||
|
||||
char *trimmed_path; // The differing portion of fullpath and fullrootpath
|
||||
trimmed_path = &fullpath[strlen(fullrootpath)];
|
||||
|
||||
char *extpos = strstr(trimmed_path, "."); // Where the file extension begins
|
||||
char basepath[MAX_PATH]; // This will hold the final, relative path
|
||||
|
||||
// Copy the relative path of the given file to basepath, excluding the extension
|
||||
strncpy(basepath, trimmed_path, extpos-trimmed_path);
|
||||
|
||||
// Make sure it's null-terminated right
|
||||
basepath[(int)(extpos-trimmed_path)] = '\0';
|
||||
|
||||
// Free the old string first, if it's not the const initial empty string
|
||||
if (Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path[0] != '\0') {
|
||||
vm_free(Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path);
|
||||
}
|
||||
|
||||
Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path = vm_strdup(basepath);
|
||||
|
||||
mprintf(("OK. Temporary pathtype is now %s.\n", Pathtypes[CF_TYPE_TEMP_SUBDIR_LOOKUP].path));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void bm_page_in_stop() {
|
||||
int i;
|
||||
|
||||
@@ -2170,19 +2080,13 @@ void bm_page_in_stop() {
|
||||
if ((bm_bitmaps[i].type != BM_TYPE_NONE) && (bm_bitmaps[i].type != BM_TYPE_RENDER_TARGET_DYNAMIC) && (bm_bitmaps[i].type != BM_TYPE_RENDER_TARGET_STATIC)) {
|
||||
if (bm_bitmaps[i].preloaded) {
|
||||
if (bm_preloading) {
|
||||
if (bm_bitmaps[i].type == BM_TYPE_EFF && bm_bitmaps[i].info.ani.eff.in_subdir) {
|
||||
set_temp_subdir_pathtype(bm_bitmaps[i].filename);
|
||||
}
|
||||
|
||||
if (!gr_preload(bm_bitmaps[i].handle, (bm_bitmaps[i].preloaded == 2))) {
|
||||
mprintf(("Out of VRAM. Done preloading.\n"));
|
||||
bm_preloading = 0;
|
||||
}
|
||||
} else {
|
||||
bm_lock(bm_bitmaps[i].handle, (bm_bitmaps[i].used_flags == BMP_AABITMAP) ? 8 : 16, bm_bitmaps[i].used_flags);
|
||||
if (bm_bitmaps[i].ref_count >= 1) {
|
||||
bm_unlock( bm_bitmaps[i].handle );
|
||||
}
|
||||
bm_unlock(bm_bitmaps[i].handle);
|
||||
}
|
||||
|
||||
n++;
|
||||
|
||||
+5
-18
@@ -89,13 +89,6 @@ extern int bm_texture_ram; //!< how many bytes of textures are used.
|
||||
|
||||
extern int Bm_paging; //!< Bool type that indicates if BMPMAN is currently paging.
|
||||
|
||||
extern const ubyte bm_type_list[]; //!< List of valid bitmap types
|
||||
extern const char *bm_ext_list[]; //!< List of extensions for those types
|
||||
extern const int BM_NUM_TYPES; //!< Calculated number of bitmap types
|
||||
extern const ubyte bm_ani_type_list[]; //!< List of valid bitmap animation types
|
||||
extern const char *bm_ani_ext_list[]; //!< List of extensions for those types
|
||||
extern const int BM_ANI_NUM_TYPES; //!< Calculated number of bitmap animation types
|
||||
|
||||
extern int GLOWMAP; //!< References a map that is a fully lit version of its index -Bobboau
|
||||
extern int SPECMAP; //!< References a map that is for specular mapping -Bobboau
|
||||
extern int ENVMAP; //!< References a map that is for environment mapping -Bobboau
|
||||
@@ -415,11 +408,6 @@ void bm_get_frame_usage(int *ntotal, int *nnew);
|
||||
*/
|
||||
int bm_reload(int bitmap_handle, const char* filename);
|
||||
|
||||
/**
|
||||
* @brief Stuffs Pathtypes with an additional path leading to a subdir of the same name as the given file (minus file extension)
|
||||
*/
|
||||
bool set_temp_subdir_pathtype(const char *filename);
|
||||
|
||||
/**
|
||||
* @brief Tells bmpman to start keeping track of what bitmaps are used where
|
||||
*/
|
||||
@@ -627,17 +615,16 @@ int bm_set_render_target(int handle, int face = -1);
|
||||
*
|
||||
* @param[in] filename The filename of the .EFF
|
||||
* @param[in] dir_type
|
||||
* @param[out] nframes (optional) If given, is set to the number of frames this .EFF has
|
||||
* @param[out] nfps (optional) If given, is set to the fps of this .EFF
|
||||
* @param[out] key (optional) If given, is set to the keyframe index of this .EFF
|
||||
* @param[out] type (optional) If given, is set to the BM_TYPE of the .EFF
|
||||
* @param[out] in_subdir (optional) If given, is set to true if the frames of this .EFF are in a subdir
|
||||
* @param[out] nframes (optional) If given, is set to the number of frames this .EFF has
|
||||
* @param[out] nfps (optional) If given, is set to the fps of this .EFF
|
||||
* @param[out] key (optional) If given, is set to the keyframe index of this .EFF
|
||||
* @param[out] type (optional) If given, is set to the BM_TYPE of the .EFF
|
||||
*
|
||||
* @returns 0 If successful,
|
||||
* @returns -1 if not successful
|
||||
*
|
||||
* @todo retval should be a bool
|
||||
*/
|
||||
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type, bool *in_subdir);
|
||||
int bm_load_and_parse_eff(const char *filename, int dir_type, int *nframes, int *nfps, int *key, ubyte *type);
|
||||
|
||||
#endif
|
||||
@@ -86,7 +86,6 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
|
||||
{ CF_TYPE_INTEL_ANIMS, "data" DIR_SEPARATOR_STR "intelanims", ".pcx .ani .eff .tga .jpg .png .dds", CF_TYPE_DATA },
|
||||
{ CF_TYPE_SCRIPTS, "data" DIR_SEPARATOR_STR "scripts", ".lua .lc", CF_TYPE_DATA },
|
||||
{ CF_TYPE_FICTION, "data" DIR_SEPARATOR_STR "fiction", ".txt", CF_TYPE_DATA },
|
||||
{ CF_TYPE_TEMP_SUBDIR_LOOKUP, "", ".eff", CF_TYPE_DATA },
|
||||
};
|
||||
|
||||
|
||||
|
||||
+1
-2
@@ -78,9 +78,8 @@ typedef struct {
|
||||
#define CF_TYPE_INTEL_ANIMS 34
|
||||
#define CF_TYPE_SCRIPTS 35
|
||||
#define CF_TYPE_FICTION 36
|
||||
#define CF_TYPE_TEMP_SUBDIR_LOOKUP 37
|
||||
|
||||
#define CF_MAX_PATH_TYPES 38 // Can be as high as you'd like //DTP; yeah but beware alot of things uses CF_MAX_PATH_TYPES
|
||||
#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
|
||||
|
||||
@@ -901,7 +901,6 @@ int cf_find_file_location( const char *filespec, int pathtype, int max_out, char
|
||||
case CF_TYPE_MULTI_CACHE:
|
||||
case CF_TYPE_MISSIONS:
|
||||
case CF_TYPE_CACHE:
|
||||
case CF_TYPE_TEMP_SUBDIR_LOOKUP:
|
||||
cfs_slow_search = 1;
|
||||
break;
|
||||
|
||||
|
||||
@@ -956,9 +956,9 @@ void control_config_reset_defaults(int presetnum)
|
||||
|
||||
// Reset keyboard defaults
|
||||
for (i=0; i<CCFG_MAX; i++) {
|
||||
// Note that key_default, joy_default and text_default are NOT
|
||||
// overwritten here; they should retain the values of the first preset
|
||||
Control_config[i].text = preset[i].text;
|
||||
// Note that key_default and joy_default are NOT overwritten here;
|
||||
// they should retain the values of the first preset because
|
||||
// for example the key-pressed SEXP works off the defaults of the first preset
|
||||
Control_config[i].key_id = preset[i].key_default;
|
||||
Control_config[i].joy_id = preset[i].joy_default;
|
||||
Control_config[i].tab = preset[i].tab;
|
||||
@@ -2107,45 +2107,6 @@ void control_config_do_frame(float frametime)
|
||||
List_buttons[i++].disable();
|
||||
}
|
||||
|
||||
// If multiple controls presets are provided, display which one is in use
|
||||
if (Control_config_presets.size() > 1) {
|
||||
SCP_string preset_str;
|
||||
int matching_preset = -1;
|
||||
|
||||
for (i=0; i<(int)Control_config_presets.size(); i++) {
|
||||
bool this_preset_matches = true;
|
||||
config_item *this_preset = Control_config_presets[i];
|
||||
|
||||
for (int j=0; j<CCFG_MAX; j++) {
|
||||
if (!Control_config[j].disabled && Control_config[j].key_id != this_preset[j].key_default) {
|
||||
this_preset_matches = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this_preset_matches) {
|
||||
matching_preset = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (matching_preset >= 0) {
|
||||
sprintf(preset_str, "Controls: %s", Control_config_preset_names[matching_preset].c_str());
|
||||
} else {
|
||||
sprintf(preset_str, "Controls: custom");
|
||||
|
||||
}
|
||||
|
||||
gr_get_string_size(&w, NULL, preset_str.c_str());
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
|
||||
if (gr_screen.res == GR_640) {
|
||||
gr_string(16, (24 - font_height) / 2, preset_str.c_str(), GR_RESIZE_MENU);
|
||||
} else {
|
||||
gr_string(24, (40 - font_height) / 2, preset_str.c_str(), GR_RESIZE_MENU);
|
||||
}
|
||||
}
|
||||
|
||||
// blit help overlay if active
|
||||
help_overlay_maybe_blit(Control_config_overlay_id, gr_screen.res);
|
||||
|
||||
@@ -2246,11 +2207,11 @@ int check_control_used(int id, int key)
|
||||
|
||||
// check what current modifiers are pressed
|
||||
mask = 0;
|
||||
if (keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT]) {
|
||||
if (keyd_pressed[KEY_LSHIFT] || key_down_count(KEY_LSHIFT) || keyd_pressed[KEY_RSHIFT] || key_down_count(KEY_RSHIFT)) {
|
||||
mask |= KEY_SHIFTED;
|
||||
}
|
||||
|
||||
if (keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT]) {
|
||||
if (keyd_pressed[KEY_LALT] || key_down_count(KEY_LALT) || keyd_pressed[KEY_RALT] || key_down_count(KEY_RALT)) {
|
||||
mask |= KEY_ALTED;
|
||||
}
|
||||
|
||||
@@ -2265,7 +2226,7 @@ int check_control_used(int id, int key)
|
||||
|
||||
z &= KEY_MASK;
|
||||
|
||||
if (keyd_pressed[z]) {
|
||||
if (keyd_pressed[z] || key_down_count(z)) {
|
||||
control_used(id);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -63,14 +63,13 @@ typedef struct config_item {
|
||||
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 *default_text; //!< default description of the action
|
||||
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
|
||||
bool disabled; //!< whether this action should be available at all
|
||||
bool continuous_ongoing;//!< whether this action is a continuous one and is currently ongoing
|
||||
char *text; //!< overridable description of the action
|
||||
} config_item;
|
||||
|
||||
/*!
|
||||
@@ -293,7 +292,6 @@ extern int Control_config_overlay_id;
|
||||
|
||||
extern config_item Control_config[]; //!< Stores the keyboard configuration
|
||||
extern SCP_vector<config_item*> Control_config_presets; // tabled control presets; pointers to config_item arrays
|
||||
extern SCP_vector<SCP_string> Control_config_preset_names; // names for Control_config_presets (identical order of items)
|
||||
extern char **Scan_code_text;
|
||||
extern char **Joy_button_text;
|
||||
|
||||
|
||||
@@ -45,153 +45,153 @@ int Invert_axis_defaults[JOY_NUM_AXES] = { 0, 0, 0, 0, 0, 0 };
|
||||
//XSTR:OFF
|
||||
config_item Control_config[CCFG_MAX + 1] = {
|
||||
// targeting a ship
|
||||
{ KEY_T, -1, TARGET_TAB, true, "Target Next Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, true, "Target Previous Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_H, 2, TARGET_TAB, true, "Target Next Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, true, "Target Previous Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, true, "Toggle Auto Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_F, -1, TARGET_TAB, true, "Target Next Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, true, "Target Previous Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_Y, 4, TARGET_TAB, true, "Target Ship in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_G, -1, TARGET_TAB, true, "Target Target's Nearest Attacker", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, true, "Target Last Ship to Send Transmission", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, true, "Turn Off Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_T, -1, TARGET_TAB, true, "Target Next Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_T, -1, TARGET_TAB, true, "Target Previous Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_H, 2, TARGET_TAB, true, "Target Next Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_H, -1, TARGET_TAB, true, "Target Previous Closest Hostile Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_H, -1, TARGET_TAB, true, "Toggle Auto Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_F, -1, TARGET_TAB, true, "Target Next Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_F, -1, TARGET_TAB, true, "Target Previous Closest Friendly Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_Y, 4, TARGET_TAB, true, "Target Ship in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_G, -1, TARGET_TAB, true, "Target Target's Nearest Attacker", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_Y, -1, TARGET_TAB, true, "Target Last Ship to Send Transmission", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_T, -1, TARGET_TAB, true, "Turn Off Targeting", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
// targeting a ship's subsystem
|
||||
{ KEY_V, -1, TARGET_TAB, true, "Target Subsystem in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_S, -1, TARGET_TAB, true, "Target Next Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, true, "Target Previous Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, true, "Turn Off Targeting of Subsystems", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_V, -1, TARGET_TAB, true, "Target Subsystem in Reticle", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_S, -1, TARGET_TAB, true, "Target Next Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_S, -1, TARGET_TAB, true, "Target Previous Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_S, -1, TARGET_TAB, true, "Turn Off Targeting of Subsystems", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
// matching speed
|
||||
{ KEY_M, -1, COMPUTER_TAB, true, "Match Target Speed", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, true, "Toggle Auto Speed Matching", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_M, -1, COMPUTER_TAB, true, "Match Target Speed", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_M, -1, COMPUTER_TAB, true, "Toggle Auto Speed Matching", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
// weapons
|
||||
{ KEY_LCTRL, 0, WEAPON_TAB, true, "Fire Primary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SPACEBAR, 1, WEAPON_TAB, true, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PERIOD, -1, WEAPON_TAB, true, "Cycle Forward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_COMMA, -1, WEAPON_TAB, true, "Cycle Backward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Bank", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_X, 3, WEAPON_TAB, true, "Launch Countermeasure", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_LCTRL, 0, WEAPON_TAB, true, "Fire Primary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_SPACEBAR, 1, WEAPON_TAB, true, "Fire Secondary Weapon", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PERIOD, -1, WEAPON_TAB, true, "Cycle Forward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_COMMA, -1, WEAPON_TAB, true, "Cycle Backward Primary Weapon", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Bank", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_DIVIDE, -1, WEAPON_TAB, true, "Cycle Secondary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_X, 3, WEAPON_TAB, true, "Launch Countermeasure", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
// controls
|
||||
{ KEY_A, -1, SHIP_TAB, true, "Forward Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_Z, -1, SHIP_TAB, true, "Reverse Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD7, -1, SHIP_TAB, true, "Bank Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD9, -1, SHIP_TAB, true, "Bank Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD8, -1, SHIP_TAB, true, "Pitch Forward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD2, -1, SHIP_TAB, true, "Pitch Backward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD4, -1, SHIP_TAB, true, "Turn Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD6, -1, SHIP_TAB, true, "Turn Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_A, -1, SHIP_TAB, true, "Forward Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_Z, -1, SHIP_TAB, true, "Reverse Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD7, -1, SHIP_TAB, true, "Bank Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD9, -1, SHIP_TAB, true, "Bank Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD8, -1, SHIP_TAB, true, "Pitch Forward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD2, -1, SHIP_TAB, true, "Pitch Backward", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD4, -1, SHIP_TAB, true, "Turn Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD6, -1, SHIP_TAB, true, "Turn Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
|
||||
// throttle controls
|
||||
{ KEY_BACKSP, -1, SHIP_TAB, true, "Set Throttle to Zero", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SLASH, -1, SHIP_TAB, true, "Set Throttle to Max", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_LBRACKET, -1, SHIP_TAB, true, "Set Throttle to One-Third", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_RBRACKET, -1, SHIP_TAB, true, "Set Throttle to Two-Thirds", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_EQUAL, -1, SHIP_TAB, true, "Increase Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_MINUS, -1, SHIP_TAB, true, "Decrease Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_BACKSP, -1, SHIP_TAB, true, "Set Throttle to Zero", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SLASH, -1, SHIP_TAB, true, "Set Throttle to Max", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_LBRACKET, -1, SHIP_TAB, true, "Set Throttle to One-Third", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_RBRACKET, -1, SHIP_TAB, true, "Set Throttle to Two-Thirds", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_EQUAL, -1, SHIP_TAB, true, "Increase Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_MINUS, -1, SHIP_TAB, true, "Decrease Throttle 5 Percent", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
// squadmate messaging
|
||||
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, true, "Attack My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, true, "Disarm My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, true, "Disable My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, true, "Attack My Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, true, "Capture My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Engage Enemy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, true, "Form on My Wing", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, true, "Ignore My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, true, "Protect My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, true, "Cover Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, true, "Return to Base", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, true, "Rearm Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_A, -1, COMPUTER_TAB, true, "Attack My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_Z, -1, COMPUTER_TAB, true, "Disarm My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_D, -1, COMPUTER_TAB, true, "Disable My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_V, -1, COMPUTER_TAB, true, "Attack My Subsystem", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_X, -1, COMPUTER_TAB, true, "Capture My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Engage Enemy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_W, -1, COMPUTER_TAB, true, "Form on My Wing", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_I, -1, COMPUTER_TAB, true, "Ignore My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_P, -1, COMPUTER_TAB, true, "Protect My Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_C, -1, COMPUTER_TAB, true, "Cover Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_J, -1, COMPUTER_TAB, true, "Return to Base", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_R, -1, COMPUTER_TAB, true, "Rearm Me", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
{ KEY_R, 6, TARGET_TAB, true, "Target Closest Attacking Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_R, 6, TARGET_TAB, true, "Target Closest Attacking Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
// Views
|
||||
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, true, "Chase View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PADPERIOD, -1, COMPUTER_TAB, true, "External View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PADENTER, -1, COMPUTER_TAB, true, "Toggle External Camera Lock", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD0, -1, COMPUTER_TAB, true, "Free Look View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL }, // Not in use anymore (Swifty)
|
||||
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, true, "Current Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PADPLUS, -1, COMPUTER_TAB, true, "Increase View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PADMINUS, -1, COMPUTER_TAB, true, "Decrease View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAD5, -1, COMPUTER_TAB, true, "Center View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, 33, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, 32, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, 34, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, 35, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PADMULTIPLY, -1, COMPUTER_TAB, true, "Chase View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PADPERIOD, -1, COMPUTER_TAB, true, "External View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PADENTER, -1, COMPUTER_TAB, true, "Toggle External Camera Lock", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PAD0, -1, COMPUTER_TAB, true, "Free Look View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false }, // Not in use anymore (Swifty)
|
||||
{ KEY_PADDIVIDE, -1, COMPUTER_TAB, true, "Current Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PADPLUS, -1, COMPUTER_TAB, true, "Increase View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PADMINUS, -1, COMPUTER_TAB, true, "Decrease View Distance", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_PAD5, -1, COMPUTER_TAB, true, "Center View", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, 33, COMPUTER_TAB, true, "View Up", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, 32, COMPUTER_TAB, true, "View Rear", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, 34, COMPUTER_TAB, true, "View Left", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, 35, COMPUTER_TAB, true, "View Right", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
|
||||
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, true, "Cycle Radar Range", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_C, -1, COMPUTER_TAB, true, "Communications Menu", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, -1, true, "Show Objectives", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, true, "Enter Subspace (End Mission)", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_J, -1, TARGET_TAB, true, "Target Target's Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_TAB, 5, SHIP_TAB, true, "Afterburner", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_RAPOSTRO, -1, COMPUTER_TAB, true, "Cycle Radar Range", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_C, -1, COMPUTER_TAB, true, "Communications Menu", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ -1, -1, -1, true, "Show Objectives", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_J, -1, COMPUTER_TAB, true, "Enter Subspace (End Mission)", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_J, -1, TARGET_TAB, true, "Target Target's Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_TAB, 5, SHIP_TAB, true, "Afterburner", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
|
||||
{ KEY_INSERT, -1, COMPUTER_TAB, true, "Increase Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_DELETE, -1, COMPUTER_TAB, true, "Decrease Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_HOME, -1, COMPUTER_TAB, true, "Increase Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_END, -1, COMPUTER_TAB, true, "Decrease Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAGEUP, -1, COMPUTER_TAB, true, "Increase Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, true, "Decrease Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, true, "Equalize Energy Settings", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_INSERT, -1, COMPUTER_TAB, true, "Increase Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_DELETE, -1, COMPUTER_TAB, true, "Decrease Weapon Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_HOME, -1, COMPUTER_TAB, true, "Increase Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_END, -1, COMPUTER_TAB, true, "Decrease Shield Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PAGEUP, -1, COMPUTER_TAB, true, "Increase Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_PAGEDOWN, -1, COMPUTER_TAB, true, "Decrease Engine Energy", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_D, -1, COMPUTER_TAB, true, "Equalize Energy Settings", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
{ KEY_Q, 7, COMPUTER_TAB, true, "Equalize Shields", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_UP, -1, COMPUTER_TAB, true, "Augment Forward Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_DOWN, -1, COMPUTER_TAB, true, "Augment Rear Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_LEFT, -1, COMPUTER_TAB, true, "Augment Left Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_RIGHT, -1, COMPUTER_TAB, true, "Augment Right Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Laser->Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Shield->Laser", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_Q, 7, COMPUTER_TAB, true, "Equalize Shields", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_UP, -1, COMPUTER_TAB, true, "Augment Forward Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_DOWN, -1, COMPUTER_TAB, true, "Augment Rear Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_LEFT, -1, COMPUTER_TAB, true, "Augment Left Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_RIGHT, -1, COMPUTER_TAB, true, "Augment Right Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Laser->Shield", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_SCROLLOCK, -1, COMPUTER_TAB, true, "Transfer Energy Shield->Laser", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
// { -1, -1, -1, true, "Show Damage Popup Window" },
|
||||
|
||||
{ -1, -1, SHIP_TAB, false, "Glide When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, SHIP_TAB, false, "Glide When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
//Backslash -- this was a convenient place for Glide When Pressed, as Show Damage Popup isn't used
|
||||
{ -1, -1, SHIP_TAB, true, "Bank When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, -1, true, "Show Nav Map", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, true, "Add or Remove Escort", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Clear Escort List", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_E, -1, TARGET_TAB, true, "Target Next Escort Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, true, "Target Closest Repair Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, SHIP_TAB, true, "Bank When Pressed", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ -1, -1, -1, true, "Show Nav Map", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_E, -1, COMPUTER_TAB, true, "Add or Remove Escort", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_E, -1, COMPUTER_TAB, true, "Clear Escort List", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_E, -1, TARGET_TAB, true, "Target Next Escort Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_R, -1, TARGET_TAB, true, "Target Closest Repair Ship", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
{ KEY_U, -1, TARGET_TAB, true, "Target Next Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, true, "Target Previous Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_N, -1, TARGET_TAB, true, "Target Newest Ship in Area", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_K, -1, TARGET_TAB, true, "Target Next Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, true, "Target Previous Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_U, -1, TARGET_TAB, true, "Target Next Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_U, -1, TARGET_TAB, true, "Target Previous Uninspected Cargo", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_N, -1, TARGET_TAB, true, "Target Newest Ship in Area", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_K, -1, TARGET_TAB, true, "Target Next Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_K, -1, TARGET_TAB, true, "Target Previous Live Turret", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
{ KEY_B, -1, TARGET_TAB, true, "Target Next Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_B, -1, TARGET_TAB, true, "Target Next Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_B, -1, TARGET_TAB, true, "Target Previous Hostile Bomb or Bomber", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
// multiplayer messaging keys
|
||||
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, true, "(Multiplayer) Observer Zoom to Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, true, "Increase Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, true, "Decrease Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_L, -1, COMPUTER_TAB, true, "Toggle High HUD Contrast", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, true, "(Multiplayer) Toggle Network Info", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, true, "(Multiplayer) Self Destruct", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_1, -1, COMPUTER_TAB, true, "(Multiplayer) Message All", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_2, -1, COMPUTER_TAB, true, "(Multiplayer) Message Friendly", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_3, -1, COMPUTER_TAB, true, "(Multiplayer) Message Hostile", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_4, -1, COMPUTER_TAB, true, "(Multiplayer) Message Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_X, -1, COMPUTER_TAB, true, "(Multiplayer) Observer Zoom to Target", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_PERIOD, -1, COMPUTER_TAB, true, "Increase Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_COMMA, -1, COMPUTER_TAB, true, "Decrease Time Compression", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_L, -1, COMPUTER_TAB, true, "Toggle High HUD Contrast", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, true, "(Multiplayer) Toggle Network Info", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, true, "(Multiplayer) Self Destruct", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
|
||||
// Misc
|
||||
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, true, "Toggle HUD", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, true, "Right Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, true, "Left Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, true, "Up Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, true, "Down Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, true, "Toggle HUD Wireframe Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, COMPUTER_TAB, false, "Top-Down View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ -1, -1, COMPUTER_TAB, false, "Target Padlock View", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL }, // (Swifty) Toggle for VM_TRACK
|
||||
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, true, "Toggle HUD", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, true, "Right Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, true, "Left Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, true, "Up Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, true, "Down Thrust", CC_TYPE_CONTINUOUS, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_SHIFTED | KEY_Q, -1, COMPUTER_TAB, true, "Toggle HUD Wireframe Target View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ -1, -1, COMPUTER_TAB, false, "Top-Down View", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ -1, -1, COMPUTER_TAB, false, "Target Padlock View", CC_TYPE_TRIGGER, -1, -1, 0, false, false }, // (Swifty) Toggle for VM_TRACK
|
||||
// Auto Navigation Systen
|
||||
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, false, "Toggle Auto Pilot", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, false, "Cycle Nav Points", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_G, -1, SHIP_TAB, false, "Toggle Gliding", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_O, -1, WEAPON_TAB, false, "Cycle Primary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false, NULL },
|
||||
{ KEY_ALTED | KEY_A, -1, COMPUTER_TAB, false, "Toggle Auto Pilot", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_N, -1, COMPUTER_TAB, false, "Cycle Nav Points", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_ALTED | KEY_G, -1, SHIP_TAB, false, "Toggle Gliding", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ KEY_O, -1, WEAPON_TAB, false, "Cycle Primary Weapon Firing Rate", CC_TYPE_TRIGGER, -1, -1, 0, false, false },
|
||||
{ -1, -1, -1, false, "", CC_TYPE_TRIGGER, -1, -1, 0, false, false }
|
||||
};
|
||||
|
||||
@@ -404,7 +404,6 @@ char **Scan_code_text = Scan_code_text_english;
|
||||
char **Joy_button_text = Joy_button_text_english;
|
||||
|
||||
SCP_vector<config_item*> Control_config_presets;
|
||||
SCP_vector<SCP_string> Control_config_preset_names;
|
||||
|
||||
void set_modifier_status()
|
||||
{
|
||||
@@ -592,9 +591,6 @@ void control_config_common_init()
|
||||
for (int i=0; i<CCFG_MAX; i++) {
|
||||
Control_config[i].disabled = false;
|
||||
Control_config[i].continuous_ongoing = false;
|
||||
|
||||
// init the overridable description with a copy of the default
|
||||
Control_config[i].text = strdup(Control_config[i].default_text);
|
||||
}
|
||||
|
||||
control_config_common_load_overrides();
|
||||
@@ -815,14 +811,6 @@ void control_config_common_load_overrides()
|
||||
std::copy(Control_config, Control_config + CCFG_MAX + 1, cfg_preset);
|
||||
Control_config_presets.push_back(cfg_preset);
|
||||
|
||||
SCP_string preset_name;
|
||||
if (optional_string("$Name:")) {
|
||||
stuff_string_line(preset_name);
|
||||
} else {
|
||||
preset_name = "<unnamed preset>";
|
||||
}
|
||||
Control_config_preset_names.push_back(preset_name);
|
||||
|
||||
while (required_string_either("#End","$Bind Name:")) {
|
||||
const int iBufferLength = 64;
|
||||
char szTempBuffer[iBufferLength];
|
||||
@@ -834,7 +822,7 @@ void control_config_common_load_overrides()
|
||||
for (size_t i = 0; i < cCntrlAryLength; ++i) {
|
||||
config_item& r_ccConfig = cfg_preset[i];
|
||||
|
||||
if (!strcmp(szTempBuffer, r_ccConfig.default_text)) {
|
||||
if (!strcmp(szTempBuffer, r_ccConfig.text)) {
|
||||
/**
|
||||
* short key_default;
|
||||
* short joy_default;
|
||||
@@ -845,11 +833,6 @@ void control_config_common_load_overrides()
|
||||
|
||||
int iTemp;
|
||||
|
||||
if (optional_string("$New Name:")) {
|
||||
stuff_string(szTempBuffer, F_NAME, iBufferLength);
|
||||
r_ccConfig.text = strdup(szTempBuffer);
|
||||
}
|
||||
|
||||
if (optional_string("$Key Default:")) {
|
||||
if (optional_string("NONE")) {
|
||||
r_ccConfig.key_default = (short)-1;
|
||||
|
||||
@@ -25,9 +25,6 @@
|
||||
|
||||
extern int Game_mode;
|
||||
|
||||
const char *movie_ext_list[] = { ".ogg", ".mve" };
|
||||
const int NUM_MOVIE_EXT = sizeof(movie_ext_list) / sizeof(char*);
|
||||
|
||||
|
||||
#define MOVIE_NONE -1
|
||||
#define MOVIE_OGG 0
|
||||
@@ -45,6 +42,8 @@ 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;
|
||||
@@ -58,7 +57,7 @@ int movie_find(char *filename, char *out_name)
|
||||
char *p = strrchr(tmp_name, '.');
|
||||
if ( p ) *p = 0;
|
||||
|
||||
int rc = cf_find_file_location_ext(tmp_name, NUM_MOVIE_EXT, movie_ext_list, CF_TYPE_ANY, sizeof(full_path) - 1, full_path, &size, &offset, 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;
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
#ifndef _MOVIE_HEADER_FILE
|
||||
#define _MOVIE_HEADER_FILE
|
||||
|
||||
extern const char *movie_ext_list[];
|
||||
extern const int NUM_MOVIE_EXT;
|
||||
|
||||
bool movie_play(char *name);
|
||||
void movie_play_two(char *name1, char *name2);
|
||||
|
||||
|
||||
@@ -926,10 +926,6 @@ int debris_check_collision(object *pdebris, object *other_obj, vec3d *hitpos, co
|
||||
// reset flags to check MC_CHECK_MODEL | MC_CHECK_SPHERELINE and maybe MC_CHECK_INVISIBLE_FACES and MC_SUBMODEL_INSTANCE
|
||||
mc.flags = copy_flags | MC_SUBMODEL_INSTANCE;
|
||||
|
||||
if (Ship_info[Ships[ship_obj->instance].ship_info_index].collision_lod > -1) {
|
||||
mc.lod = Ship_info[Ships[ship_obj->instance].ship_info_index].collision_lod;
|
||||
}
|
||||
|
||||
// check each submodel in turn
|
||||
for (smv = submodel_vector.begin(); smv != submodel_vector.end(); ++smv) {
|
||||
// turn on submodel for collision test
|
||||
|
||||
+8
-8
@@ -623,7 +623,7 @@ CAPTION "About FRED2"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,10,17,20,20,SS_REALSIZEIMAGE
|
||||
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.7.3 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
|
||||
LTEXT "FRED2_OPEN - FreeSpace Editor, Version 3.7.2 OpenGL",IDC_STATIC,39,8,184,10,SS_NOPREFIX
|
||||
LTEXT "Copyright © 1999 Volition, Inc. All Rights Reserved",IDC_STATIC,39,17,164,8
|
||||
DEFPUSHBUTTON "OK",IDOK,229,7,48,14,WS_GROUP
|
||||
LTEXT """Fred2 is the omega of all giant unwieldy pieces of code. Its big, its horrifying, and it just doesn't care. View it at your own risk."" - Dave Baranec",IDC_STATIC,39,62,238,20
|
||||
@@ -2103,8 +2103,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,1,000000
|
||||
PRODUCTVERSION 3,7,1,000000
|
||||
FILEVERSION 3,7,2,11329
|
||||
PRODUCTVERSION 3,7,2,11329
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -2121,12 +2121,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Volition Inc."
|
||||
VALUE "FileDescription", "Fred 2 Open"
|
||||
VALUE "FileVersion", "3.7.3.000000"
|
||||
VALUE "FileVersion", "3.7.2.11329"
|
||||
VALUE "InternalName", "Fred 2 Open"
|
||||
VALUE "LegalCopyright", "Copyright © 1998"
|
||||
VALUE "OriginalFilename", "fred2.exe"
|
||||
VALUE "ProductName", "Fred 2 Open"
|
||||
VALUE "ProductVersion", "3.7.3"
|
||||
VALUE "ProductVersion", "3.7.2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
@@ -2696,12 +2696,12 @@ IDC_CURSOR2 CURSOR "res\\cursor2.cur"
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "FRED2_OPEN 3.7.3 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
|
||||
IDR_MAINFRAME "FRED2_OPEN 3.7.2 - FreeSpace2 Mission Editor\nUntitled\nFRED2\nFreeSpace2 Missions (*.fs2)\n.fs2\nFreeSpace2Mission\nFreeSpace2 Mission"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_APP_TITLE "FRED2"
|
||||
AFX_IDS_IDLEMESSAGE "For Help, press F1"
|
||||
|
||||
@@ -1482,7 +1482,7 @@ int game_start_mission()
|
||||
|
||||
int e1 = timer_get_milliseconds();
|
||||
|
||||
mprintf(("Level load took %f seconds.\n", (e1 - s1) / 1000.0f ));
|
||||
printf("Level load took %f seconds.\n", (e1 - s1) / 1000.0f );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -336,8 +336,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,3,000000
|
||||
PRODUCTVERSION 3,7,3,000000
|
||||
FILEVERSION 3,7,2,11329
|
||||
PRODUCTVERSION 3,7,2,11329
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -354,12 +354,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Volition Inc."
|
||||
VALUE "FileDescription", "FreeSpace 2 Open"
|
||||
VALUE "FileVersion", "3.7.3.000000"
|
||||
VALUE "FileVersion", "3.7.2.11329"
|
||||
VALUE "InternalName", "FreeSpace 2 Open"
|
||||
VALUE "LegalCopyright", "Copyright © 1998"
|
||||
VALUE "OriginalFilename", "fs2.exe"
|
||||
VALUE "ProductName", "FreeSpace 2 Open"
|
||||
VALUE "ProductVersion", "3.7.3"
|
||||
VALUE "ProductVersion", "3.7.2"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -28,14 +28,15 @@
|
||||
|
||||
#pragma optimize("", off)
|
||||
|
||||
#define DEFAULT_MASTER_EVENT_MUSIC_VOLUME 0.5f
|
||||
|
||||
#define HULL_VALUE_TO_PLAY_INTENSE_BATTLE_MUSIC 0.75f
|
||||
|
||||
////////////////////////////
|
||||
// Globals
|
||||
////////////////////////////
|
||||
int Event_Music_battle_started = 0;
|
||||
float Default_music_volume = 0.5f; // range is 0->1
|
||||
float Master_event_music_volume = Default_music_volume;
|
||||
float Master_event_music_volume = DEFAULT_MASTER_EVENT_MUSIC_VOLUME; // range is 0->1
|
||||
|
||||
typedef struct tagSNDPATTERN {
|
||||
int default_next_pattern; // Needed so the next_pattern member can be reset
|
||||
@@ -593,7 +594,7 @@ void event_music_level_init(int force_soundtrack)
|
||||
{
|
||||
if (!strnicmp(strack->pattern_fnames[i], NOX("none.wav"), 4))
|
||||
{
|
||||
Patterns[i].handle = -1;
|
||||
Patterns[i].handle = -1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1359,8 +1360,10 @@ void parse_menumusic()
|
||||
|
||||
// Goober5000 - check for existence of file
|
||||
// taylor - check for all file types
|
||||
// chief1983 - use type list defined in audiostr.h
|
||||
if ( cf_exists_full_ext(Spooled_music[idx].filename, CF_TYPE_MUSIC, NUM_AUDIO_EXT, audio_ext_list) )
|
||||
const int NUM_EXT = 2;
|
||||
const char *exts[NUM_EXT] = { ".ogg", ".wav" };
|
||||
|
||||
if ( cf_exists_full_ext(Spooled_music[idx].filename, CF_TYPE_MUSIC, NUM_EXT, exts) )
|
||||
Spooled_music[idx].flags |= SMF_VALID;
|
||||
|
||||
if (!nocreate)
|
||||
@@ -1380,7 +1383,7 @@ void event_music_parse_musictbl(const char *filename)
|
||||
|
||||
} else {
|
||||
read_file_text(filename, CF_TYPE_TABLES);
|
||||
reset_parse();
|
||||
reset_parse();
|
||||
|
||||
while ( skip_to_start_of_string_either("#Soundtrack Start", "#Menu Music Start", NULL ) )
|
||||
{
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
|
||||
extern int Event_Music_battle_started; // flag that will tell us if we've started a battle in the current mission
|
||||
extern int Event_music_enabled;
|
||||
extern float Default_music_volume; // range is 0->1
|
||||
extern float Master_event_music_volume; // range is 0->1
|
||||
extern float Master_event_music_volume; // range is 0->1
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
|
||||
#define FS_VERSION_MAJOR 3 // major version
|
||||
#define FS_VERSION_MINOR 7 // increase by 1 for minor revs
|
||||
#define FS_VERSION_BUILD 3 // bugfix release
|
||||
#define FS_VERSION_REVIS 000000 // SVN revision
|
||||
#define FS_VERSION_BUILD 2 // bugfix release
|
||||
#define FS_VERSION_REVIS 11329 // SVN revision
|
||||
//#define FS_VERSION_IDENT NOX("custom") // special build release identifier, must be a string (don't define unless it's supposed to be used!!)
|
||||
|
||||
#define VERSION_LOC_FNAME "version.nfo"
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "io/keycontrol.h" // m!m
|
||||
#include "debugconsole/console.h"
|
||||
#include "debugconsole/console.h"
|
||||
#include "popup/popup.h"
|
||||
|
||||
|
||||
#if defined(SCP_UNIX) && !defined(__APPLE__)
|
||||
@@ -84,7 +83,7 @@ int gr_alpha_test = 0;
|
||||
|
||||
// Default clipping distances
|
||||
const float Default_min_draw_distance = 1.0f;
|
||||
const float Default_max_draw_distance = 10000000.0f;
|
||||
const float Default_max_draw_distance = 1e10;
|
||||
float Min_draw_distance = Default_min_draw_distance;
|
||||
float Max_draw_distance = Default_max_draw_distance;
|
||||
|
||||
@@ -1772,7 +1771,7 @@ void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float a
|
||||
void gr_flip()
|
||||
{
|
||||
// m!m avoid running CHA_ONFRAME when the "Quit mission" popup is shown. See mantis 2446 for reference
|
||||
if (!quit_mission_popup_shown && !popup_active())
|
||||
if (!quit_mission_popup_shown)
|
||||
{
|
||||
//WMC - Evaluate global hook if not override.
|
||||
Script_system.RunBytecode(Script_globalhook);
|
||||
|
||||
@@ -20,17 +20,6 @@
|
||||
//we check background type to avoid messed up colours for ANI
|
||||
#define ANI_BPP_CHECK (ga->ani.bg_type == BM_TYPE_PCX) ? 16 : 32
|
||||
|
||||
// These two functions find if a bitmap or animation exists by filename, no extension needed.
|
||||
bool generic_bitmap_exists(const char *filename)
|
||||
{
|
||||
return cf_exists_full_ext(filename, CF_TYPE_ANY, BM_NUM_TYPES, bm_ext_list);
|
||||
}
|
||||
|
||||
bool generic_anim_exists(const char *filename)
|
||||
{
|
||||
return cf_exists_full_ext(filename, CF_TYPE_ANY, BM_ANI_NUM_TYPES, bm_ani_ext_list);
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
int generic_anim_init_and_stream(generic_anim *anim, const char *anim_filename, ubyte bg_type, bool attempt_hi_res)
|
||||
{
|
||||
@@ -220,19 +209,13 @@ int generic_anim_stream(generic_anim *ga)
|
||||
ga->previous_frame = -1;
|
||||
}
|
||||
else {
|
||||
bool in_subdir;
|
||||
bpp = 32;
|
||||
if(ga->use_hud_color)
|
||||
bpp = 8;
|
||||
bm_load_and_parse_eff(ga->filename, CF_TYPE_ANY, &ga->num_frames, &anim_fps, &ga->keyframe, 0, &in_subdir);
|
||||
bm_load_and_parse_eff(ga->filename, CF_TYPE_ANY, &ga->num_frames, &anim_fps, &ga->keyframe, 0);
|
||||
char *p = strrchr( ga->filename, '.' );
|
||||
if ( p )
|
||||
*p = 0;
|
||||
|
||||
if (in_subdir) {
|
||||
set_temp_subdir_pathtype(ga->filename);
|
||||
}
|
||||
|
||||
char frame_name[32];
|
||||
snprintf(frame_name, 32, "%s_0000", ga->filename);
|
||||
ga->bitmap_id = bm_load(frame_name);
|
||||
|
||||
@@ -52,8 +52,6 @@ typedef struct generic_bitmap {
|
||||
int bitmap_id;
|
||||
} generic_bitmap;
|
||||
|
||||
bool generic_bitmap_exists(const char *filename);
|
||||
bool generic_anim_exists(const char *filename);
|
||||
int generic_anim_init_and_stream(generic_anim *anim, const char *anim_filename, ubyte bg_type, bool attempt_hi_res);
|
||||
void generic_anim_init(generic_anim *ga);
|
||||
void generic_anim_init(generic_anim *ga, const char *filename);
|
||||
|
||||
@@ -704,7 +704,7 @@ static bool opengl_post_init_table()
|
||||
|
||||
|
||||
if (optional_string("#Effects")) {
|
||||
while ( !required_string_one_of(3, "$Name:", "#Ship Effects", "#End") ) {
|
||||
while ( !required_string_3("$Name:", "#Ship Effects", "#End") ) {
|
||||
char tbuf[NAME_LENGTH+1] = { 0 };
|
||||
post_effect_t eff;
|
||||
|
||||
@@ -752,7 +752,7 @@ static bool opengl_post_init_table()
|
||||
Ship_effects.push_back(se1);
|
||||
|
||||
if (optional_string("#Ship Effects")) {
|
||||
while ( !required_string_one_of(3, "$Name:", "#Light Shafts", "#End") ) {
|
||||
while ( !required_string_3("$Name:", "#Light Shafts", "#End") ) {
|
||||
ship_effect se;
|
||||
char tbuf[NAME_LENGTH] = { 0 };
|
||||
|
||||
|
||||
+54
-1
@@ -151,6 +151,49 @@ int Supernova_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
}
|
||||
};
|
||||
|
||||
// used to draw the kills gauge
|
||||
hud_frames Kills_gauge;
|
||||
int Kills_gauge_loaded = 0;
|
||||
int Kills_gauge_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
{ // GR_640
|
||||
497, 361
|
||||
},
|
||||
{ // GR_1024
|
||||
880, 624
|
||||
}
|
||||
};
|
||||
int Kills_text_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
{ // GR_640
|
||||
503, 365
|
||||
},
|
||||
{ // GR_1024
|
||||
886, 628
|
||||
}
|
||||
};
|
||||
|
||||
int Kills_text_val_coords_gr[GR_NUM_RESOLUTIONS][2] = {
|
||||
{ // GR_640
|
||||
615, 365
|
||||
},
|
||||
{ // GR_1024
|
||||
984, 628
|
||||
}
|
||||
};
|
||||
|
||||
int Kills_text_val_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
{ // GR_640
|
||||
571, 365
|
||||
},
|
||||
{ // GR_1024
|
||||
954, 628
|
||||
}
|
||||
};
|
||||
|
||||
char Kills_fname[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN] = {
|
||||
"kills1",
|
||||
"kills1"
|
||||
};
|
||||
|
||||
// used to draw the hud support view
|
||||
static int Hud_support_view_active;
|
||||
static int Hud_support_view_abort; // active when we need to display abort message
|
||||
@@ -194,6 +237,7 @@ int hud_subspace_notify_active();
|
||||
int hud_objective_notify_active();
|
||||
void hud_subspace_notify_abort();
|
||||
void hud_maybe_display_subspace_notify();
|
||||
void hud_init_kills_gauge();
|
||||
int hud_maybe_render_emp_icon();
|
||||
void hud_init_emp_icon();
|
||||
|
||||
@@ -1090,7 +1134,7 @@ bool HudGauge::canRender()
|
||||
}
|
||||
|
||||
if (gauge_config == HUD_ETS_GAUGE) {
|
||||
if (Ships[Player_obj->instance].flags2 & SF2_NO_ETS && !Show_disabled_ets_gauges) {
|
||||
if (Ships[Player_obj->instance].flags2 & SF2_NO_ETS) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1179,6 +1223,7 @@ void HUD_init()
|
||||
hud_init_wingman_status_gauge();
|
||||
hud_init_target_static();
|
||||
hud_init_text_flash_gauge();
|
||||
hud_init_kills_gauge();
|
||||
hud_stop_subspace_notify();
|
||||
hud_stop_objective_notify();
|
||||
hud_target_last_transmit_level_init();
|
||||
@@ -2526,6 +2571,14 @@ void HudGaugeLag::render(float frametime)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Obsolete initializer for the kills gauge. Now superseded by the new HUD code.
|
||||
*/
|
||||
void hud_init_kills_gauge()
|
||||
{
|
||||
Kills_gauge_loaded = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Called at mission start to init data, and load support view bitmap if required
|
||||
*/
|
||||
|
||||
@@ -420,10 +420,6 @@ int hud_abort_lock()
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( Player_ship->flags2 & SF2_NO_SECONDARY_LOCKON ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// if we're on the same team and the team doesn't attack itself, then don't lock!
|
||||
if ((Player_ship->team == target_team) && (!iff_x_attacks_y(Player_ship->team, target_team)))
|
||||
{
|
||||
|
||||
@@ -46,7 +46,6 @@ int Hud_reticle_style = HUD_RETICLE_STYLE_FS2;
|
||||
|
||||
bool Hud_retail = true;
|
||||
bool Scale_retail_gauges = true;
|
||||
bool Show_disabled_ets_gauges = false;
|
||||
|
||||
int Hud_font = -1;
|
||||
|
||||
@@ -262,10 +261,6 @@ void parse_hud_gauges_tbl(const char *filename)
|
||||
Hud_reticle_style = temp;
|
||||
}
|
||||
|
||||
if (optional_string("$Show disabled ETS gauges:")) {
|
||||
stuff_boolean(&Show_disabled_ets_gauges);
|
||||
}
|
||||
|
||||
int base_res[2];
|
||||
int ship_idx = -1;
|
||||
int ship_font = -1;
|
||||
@@ -2011,7 +2006,6 @@ void load_gauge_center_reticle(int base_w, int base_h, int hud_font, bool scale_
|
||||
int scaleX = 15;
|
||||
int scaleY = 10;
|
||||
int size = 5;
|
||||
int autoaim_frame = -1;
|
||||
|
||||
if(Hud_reticle_style == HUD_RETICLE_STYLE_FS1) {
|
||||
if(gr_screen.res == GR_640) {
|
||||
@@ -2061,12 +2055,8 @@ void load_gauge_center_reticle(int base_w, int base_h, int hud_font, bool scale_
|
||||
if (optional_string("Firepoint Y coordinate multiplier:"))
|
||||
stuff_int(&scaleY);
|
||||
|
||||
if(optional_string("Autoaim Frame:"))
|
||||
stuff_int(&autoaim_frame);
|
||||
|
||||
hud_gauge->initBitmaps(fname);
|
||||
hud_gauge->initFirepointDisplay(firepoints, scaleX, scaleY, size);
|
||||
hud_gauge->setAutoaimFrame(autoaim_frame);
|
||||
|
||||
if(ship_idx->at(0) >= 0) {
|
||||
for (SCP_vector<int>::iterator ship_index = ship_idx->begin(); ship_index != ship_idx->end(); ++ship_index) {
|
||||
|
||||
@@ -20,7 +20,6 @@ extern float Hud_speed_multiplier;
|
||||
#define HUD_RETICLE_STYLE_FS2 1
|
||||
|
||||
extern int Hud_reticle_style;
|
||||
extern bool Show_disabled_ets_gauges;
|
||||
|
||||
//Functions
|
||||
int hud_get_gauge_index(char* name);
|
||||
|
||||
+12
-66
@@ -20,7 +20,6 @@
|
||||
#include "weapon/emp.h"
|
||||
#include "localization/localize.h"
|
||||
#include "network/multi.h"
|
||||
#include "weapon/weapon.h"
|
||||
|
||||
#define NUM_RETICLE_ANIS 11 // keep up to date when modifying the number of reticle ani files
|
||||
|
||||
@@ -229,7 +228,6 @@ static int Threat_lock_frame; // frame offset of current lock flashing warnin
|
||||
HudGaugeReticle::HudGaugeReticle():
|
||||
HudGauge(HUD_OBJECT_CENTER_RETICLE, HUD_CENTER_RETICLE, true, false, (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY | VM_TOPDOWN | VM_OTHER_SHIP), 255, 255, 255)
|
||||
{
|
||||
has_autoaim_lock = false;
|
||||
}
|
||||
|
||||
void HudGaugeReticle::initBitmaps(char *fname)
|
||||
@@ -249,39 +247,9 @@ void HudGaugeReticle::initFirepointDisplay(bool firepoint, int scaleX, int scale
|
||||
|
||||
void HudGaugeReticle::render(float frametime)
|
||||
{
|
||||
ship_info *sip = &Ship_info[Player_ship->ship_info_index];
|
||||
|
||||
if (autoaim_frame_offset > 0 || sip->autoaim_lock_snd > -1 || sip->autoaim_lost_snd > -1) {
|
||||
ship *shipp = &Ships[Objects[Player->objnum].instance];
|
||||
ship_weapon *swp = &shipp->weapons;
|
||||
ai_info *aip = &Ai_info[shipp->ai_index];
|
||||
|
||||
if (aip->target_objnum != -1) {
|
||||
bool autoaiming = false;
|
||||
|
||||
autoaiming = in_autoaim_fov(shipp, swp->current_primary_bank, &Objects[aip->target_objnum]);
|
||||
|
||||
if (autoaiming) {
|
||||
if (!has_autoaim_lock && sip->autoaim_lock_snd > -1) {
|
||||
snd_play( &Snds[sip->autoaim_lock_snd]);
|
||||
}
|
||||
has_autoaim_lock = true;
|
||||
}
|
||||
else {
|
||||
if (has_autoaim_lock && sip->autoaim_lost_snd > -1) {
|
||||
snd_play( &Snds[sip->autoaim_lost_snd]);
|
||||
}
|
||||
has_autoaim_lock = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setGaugeColor(HUD_C_BRIGHT);
|
||||
|
||||
if (has_autoaim_lock)
|
||||
renderBitmap(crosshair.first_frame + autoaim_frame_offset, position[0], position[1]);
|
||||
else
|
||||
renderBitmap(crosshair.first_frame, position[0], position[1]);
|
||||
renderBitmap(crosshair.first_frame, position[0], position[1]);
|
||||
|
||||
if (firepoint_display) {
|
||||
fp.clear();
|
||||
@@ -309,7 +277,7 @@ void HudGaugeReticle::render(float frametime)
|
||||
|
||||
void HudGaugeReticle::getFirepointStatus() {
|
||||
//First, get the player ship
|
||||
ship_info* sip;
|
||||
ship_info* pship;
|
||||
ship* shipp;
|
||||
polymodel* pm;
|
||||
|
||||
@@ -317,45 +285,30 @@ void HudGaugeReticle::getFirepointStatus() {
|
||||
|
||||
if (Objects[Player->objnum].type == OBJ_SHIP) {
|
||||
shipp = &Ships[Objects[Player->objnum].instance];
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
pship = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
//Get the player eyepoint
|
||||
pm = model_get(sip->model_num);
|
||||
pm = model_get(pship->model_num);
|
||||
|
||||
if (pm->n_view_positions == 0) {
|
||||
mprintf(("Model %s does not have a defined eyepoint. Firepoint display could not be generated\n", pm->filename));
|
||||
} else {
|
||||
if (pm->n_guns > 0) {
|
||||
if (pm->n_guns > 0) {
|
||||
|
||||
eye eyepoint = pm->view_positions[shipp->current_viewpoint];
|
||||
vec2d ep = { eyepoint.pnt.xyz.x, eyepoint.pnt.xyz.y };
|
||||
|
||||
for (int i = 0; i < pm->n_guns; i++) {
|
||||
int bankactive = 0;
|
||||
ship_weapon *swp = &shipp->weapons;
|
||||
int isactive = 0;
|
||||
|
||||
if (!timestamp_elapsed(shipp->weapons.next_primary_fire_stamp[i]))
|
||||
bankactive = 1;
|
||||
isactive = 1;
|
||||
else if (timestamp_elapsed(shipp->weapons.primary_animation_done_time[i]))
|
||||
bankactive = 1;
|
||||
isactive = 1;
|
||||
else if (i == shipp->weapons.current_primary_bank || shipp->flags & SF_PRIMARY_LINKED)
|
||||
bankactive = 2;
|
||||
|
||||
int num_slots = pm->gun_banks[i].num_slots;
|
||||
for (int j = 0; j < num_slots; j++) {
|
||||
int fpactive = bankactive;
|
||||
|
||||
if (sip->flags2 & SIF2_DYN_PRIMARY_LINKING) {
|
||||
// If this firepoint is not among the next shot(s) to be fired, dim it one step
|
||||
if ( !( (j >= (shipp->last_fired_point[i]+1) % num_slots) && (j <= (shipp->last_fired_point[i]+swp->primary_bank_slot_count[i]) % num_slots) ) ) {
|
||||
fpactive--;
|
||||
}
|
||||
} else if (Weapon_info[swp->primary_bank_weapons[i]].wi_flags2 & WIF2_CYCLE) {
|
||||
// If this firepoint is not the next one to be fired, dim it one step
|
||||
if (j != (shipp->last_fired_point[i]+1) % num_slots) {
|
||||
fpactive--;
|
||||
}
|
||||
}
|
||||
isactive = 2;
|
||||
|
||||
for (int j = 0; j < pm->gun_banks[i].num_slots; j++) {
|
||||
vec3d fpfromeye;
|
||||
|
||||
matrix eye_orient, player_transpose;
|
||||
@@ -364,7 +317,7 @@ void HudGaugeReticle::getFirepointStatus() {
|
||||
vm_matrix_x_matrix(&eye_orient, &player_transpose, &Eye_matrix);
|
||||
vm_vec_rotate(&fpfromeye, &pm->gun_banks[i].pnt[j], &eye_orient);
|
||||
|
||||
firepoint tmp = { { fpfromeye.xyz.x - ep.x, ep.y - fpfromeye.xyz.y }, fpactive };
|
||||
firepoint tmp = { { fpfromeye.xyz.x - ep.x, ep.y - fpfromeye.xyz.y }, isactive };
|
||||
fp.push_back(tmp);
|
||||
}
|
||||
}
|
||||
@@ -373,13 +326,6 @@ void HudGaugeReticle::getFirepointStatus() {
|
||||
}
|
||||
}
|
||||
|
||||
void HudGaugeReticle::setAutoaimFrame(int framenum) {
|
||||
if (framenum < 0 || framenum > crosshair.num_frames - 1)
|
||||
autoaim_frame_offset = 0;
|
||||
else
|
||||
autoaim_frame_offset = framenum;
|
||||
}
|
||||
|
||||
void HudGaugeReticle::pageIn()
|
||||
{
|
||||
bm_page_in_aabitmap( crosshair.first_frame, crosshair.num_frames);
|
||||
|
||||
@@ -43,8 +43,6 @@ protected:
|
||||
int firepoint_size;
|
||||
int firepoint_scale_x;
|
||||
int firepoint_scale_y;
|
||||
int autoaim_frame_offset;
|
||||
bool has_autoaim_lock;
|
||||
public:
|
||||
HudGaugeReticle();
|
||||
void render(float frametime);
|
||||
@@ -52,7 +50,6 @@ public:
|
||||
void pageIn();
|
||||
void initFirepointDisplay(bool firepoint, int scaleX, int scaleY, int size);
|
||||
void getFirepointStatus();
|
||||
void setAutoaimFrame(int framenum);
|
||||
};
|
||||
|
||||
class HudGaugeThrottle: public HudGauge
|
||||
|
||||
@@ -1095,7 +1095,7 @@ void hud_target_subobject_common(int next_flag)
|
||||
target_shipp = &Ships[Objects[Player_ai->target_objnum].instance];
|
||||
|
||||
if (!Player_ai->targeted_subsys) {
|
||||
start = END_OF_LIST(&target_shipp->subsys_list);
|
||||
start = GET_FIRST(&target_shipp->subsys_list);
|
||||
} else {
|
||||
start = Player_ai->targeted_subsys;
|
||||
}
|
||||
|
||||
+1
-10
@@ -41,7 +41,6 @@
|
||||
#define LAB_FLAG_FULLY_LOAD (1<<5) // use create_ship() to test the ships
|
||||
#define LAB_FLAG_SHOW_WEAPONS (1<<6) // determines if external weapons models are displayed
|
||||
#define LAB_FLAG_INITIAL_ROTATION (1<<7) // initial rotation setting
|
||||
#define LAB_FLAG_DESTROYED_SUBSYSTEMS (1<<8) // render model as if all subsystems are destroyed
|
||||
|
||||
// modes
|
||||
#define LAB_MODE_NONE 0 // not showing anything
|
||||
@@ -685,7 +684,7 @@ void labviewer_add_model_thrusters(ship_info *sip)
|
||||
mst.distortion_bitmap = thruster_distortion_bitmap;
|
||||
|
||||
mst.use_ab = Lab_thrust_afterburn;
|
||||
mst.glow_noise = thruster_glow_noise * sip->thruster_glow_noise_mult;
|
||||
mst.glow_noise = thruster_glow_noise;
|
||||
mst.rotvel = &vmd_zero_vector;
|
||||
|
||||
if (Lab_mode == LAB_MODE_SHIP) {
|
||||
@@ -905,13 +904,6 @@ void labviewer_render_model(float frametime)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sip != NULL) {
|
||||
if (Lab_viewer_flags & LAB_FLAG_DESTROYED_SUBSYSTEMS) {
|
||||
model_show_damaged(Lab_model_num, 1);
|
||||
}
|
||||
}
|
||||
|
||||
opengl_shader_set_animated_effect(ANIMATED_SHADER_LOADOUTSELECT_FS1);
|
||||
opengl_shader_set_animated_timer(MIN((timer_get_milliseconds()-anim_timer_start)/1500.0f,2.0f));
|
||||
|
||||
@@ -1863,7 +1855,6 @@ void labviewer_make_render_options_window(Button *caller)
|
||||
ADD_RENDER_FLAG("Animated Shader", Lab_model_flags, MR_ANIMATED_SHADER);
|
||||
ADD_RENDER_FLAG("Show Ship Weapons", Lab_viewer_flags, LAB_FLAG_SHOW_WEAPONS);
|
||||
ADD_RENDER_FLAG("Initial Rotation", Lab_viewer_flags, LAB_FLAG_INITIAL_ROTATION);
|
||||
ADD_RENDER_FLAG("Show Destroyed Subsystems", Lab_viewer_flags, LAB_FLAG_DESTROYED_SUBSYSTEMS);
|
||||
|
||||
|
||||
// start tree
|
||||
|
||||
@@ -147,7 +147,7 @@ void lcl_init(int lang_init)
|
||||
|
||||
if(ret == NULL){
|
||||
Error(LOCATION, "Default language not found.");
|
||||
}
|
||||
}
|
||||
|
||||
strcpy_s(lang_string, ret);
|
||||
|
||||
|
||||
@@ -645,10 +645,10 @@ void credits_close()
|
||||
int i;
|
||||
|
||||
for (i=0; i<Credits_num_images; i++) {
|
||||
if (Credits_bmps[i] >= 0) {
|
||||
if (Credits_bmps[i] >= 0){
|
||||
bm_release(Credits_bmps[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Credits_bmps.clear();
|
||||
|
||||
credits_stop_music(true);
|
||||
|
||||
@@ -59,9 +59,7 @@ extern void game_process_cheats(int k);
|
||||
|
||||
SCP_vector< SCP_vector<main_hall_defines> > Main_hall_defines;
|
||||
|
||||
static main_hall_defines *Main_hall = NULL;
|
||||
|
||||
static int Main_hall_music_index = -1;
|
||||
main_hall_defines *Main_hall = NULL;
|
||||
|
||||
int Vasudan_funny = 0;
|
||||
int Vasudan_funny_plate = -1;
|
||||
@@ -441,7 +439,7 @@ void main_hall_init(const SCP_string &main_hall_name)
|
||||
}
|
||||
|
||||
// if we're switching to a different mainhall we may need to change music
|
||||
if (main_hall_get_music_index(main_hall_get_index(main_hall_to_load)) != Main_hall_music_index) {
|
||||
if (main_hall_get_music_index(main_hall_get_index(main_hall_to_load)) != main_hall_get_music_index(main_hall_id())) {
|
||||
main_hall_stop_music(true);
|
||||
}
|
||||
|
||||
@@ -449,8 +447,8 @@ void main_hall_init(const SCP_string &main_hall_name)
|
||||
snazzy_menu_init();
|
||||
|
||||
// assign the proper main hall data
|
||||
Assert(main_hall_get_pointer(main_hall_to_load) != NULL);
|
||||
Main_hall = main_hall_get_pointer(main_hall_to_load);
|
||||
Assertion(Main_hall != NULL, "Failed to obtain pointer to main hall '%s'; get a coder!\n", main_hall_to_load.c_str());
|
||||
|
||||
// check if we have to change the ready room's description
|
||||
if(Main_hall->default_readyroom) {
|
||||
@@ -1140,6 +1138,7 @@ int main_hall_get_music_index(int main_hall_num)
|
||||
*/
|
||||
void main_hall_start_music()
|
||||
{
|
||||
int index;
|
||||
char *filename;
|
||||
|
||||
// start a looping ambient sound
|
||||
@@ -1156,13 +1155,13 @@ void main_hall_start_music()
|
||||
}
|
||||
|
||||
// get music
|
||||
Main_hall_music_index = main_hall_get_music_index(main_hall_id());
|
||||
if (Main_hall_music_index < 0) {
|
||||
index = main_hall_get_music_index(main_hall_id());
|
||||
if (index < 0) {
|
||||
nprintf(("Warning", "No music file exists to play music at the main menu!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
filename = Spooled_music[Main_hall_music_index].filename;
|
||||
filename = Spooled_music[index].filename;
|
||||
Assert(filename != NULL);
|
||||
|
||||
// get handle
|
||||
|
||||
@@ -241,10 +241,10 @@ int mission_campaign_maybe_add(const char *filename)
|
||||
char *desc = NULL;
|
||||
int type, max_players;
|
||||
|
||||
// don't add ignored campaigns
|
||||
if (campaign_is_ignored(filename)) {
|
||||
return 0;
|
||||
}
|
||||
// don't add ignored campaigns
|
||||
if (campaign_is_ignored(filename)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( mission_campaign_get_info( filename, name, &type, &max_players, &desc) ) {
|
||||
if ( !MC_multiplayer && (type == CAMPAIGN_TYPE_SINGLE) ) {
|
||||
|
||||
@@ -93,7 +93,7 @@ extern int Num_goals; // number of goals for this mission
|
||||
#define MLF_FIRST_REPEAT_ONLY (1 << 4)
|
||||
#define MLF_LAST_REPEAT_ONLY (1 << 5)
|
||||
#define MLF_FIRST_TRIGGER_ONLY (1 << 6)
|
||||
#define MLF_LAST_TRIGGER_ONLY (1 << 7)
|
||||
#define MLF_LAST_TRIGGER_ONLY (1 << 7)
|
||||
#define MLF_STATE_CHANGE (1 << 8)
|
||||
|
||||
#define MLF_ALL_REPETITION_FLAGS (MLF_FIRST_REPEAT_ONLY | MLF_LAST_REPEAT_ONLY | MLF_FIRST_TRIGGER_ONLY | MLF_LAST_TRIGGER_ONLY)
|
||||
|
||||
@@ -561,7 +561,7 @@ void parse_msgtbl()
|
||||
|
||||
// now we can start parsing
|
||||
if (optional_string("#Message Frequencies")) {
|
||||
while (!required_string_one_of(3, "$Name:", "#Personas", "#Moods" )) {
|
||||
while (!required_string_3("$Name:", "#Personas", "#Moods" )) {
|
||||
message_frequency_parse();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1838,7 +1838,6 @@ int parse_create_object_sub(p_object *p_objp)
|
||||
|
||||
shipp->ship_max_shield_strength = p_objp->ship_max_shield_strength;
|
||||
shipp->ship_max_hull_strength = p_objp->ship_max_hull_strength;
|
||||
shipp->max_shield_recharge = p_objp->max_shield_recharge;
|
||||
|
||||
// Goober5000 - ugh, this is really stupid having to do this here; if the
|
||||
// ship creation code was better organized this wouldn't be necessary
|
||||
@@ -2251,7 +2250,7 @@ int parse_create_object_sub(p_object *p_objp)
|
||||
Objects[objnum].hull_strength = p_objp->initial_hull * shipp->ship_max_hull_strength / 100.0f;
|
||||
for (iLoop = 0; iLoop<Objects[objnum].n_quadrants; iLoop++)
|
||||
{
|
||||
Objects[objnum].shield_quadrant[iLoop] = (float) (shipp->max_shield_recharge * p_objp->initial_shields * get_max_shield_quad(&Objects[objnum]) / 100.0f);
|
||||
Objects[objnum].shield_quadrant[iLoop] = (float) (p_objp->initial_shields * get_max_shield_quad(&Objects[objnum]) / 100.0f);
|
||||
}
|
||||
|
||||
// initial velocities now do not apply to ships which warp in after mission starts
|
||||
@@ -3111,7 +3110,6 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
|
||||
}
|
||||
|
||||
Assert(p_objp->ship_max_hull_strength > 0.0f); // Goober5000: div-0 check (not shield because we might not have one)
|
||||
p_objp->max_shield_recharge = Ship_info[p_objp->ship_class].max_shield_recharge;
|
||||
|
||||
|
||||
// if the kamikaze flag is set, we should have the next flag
|
||||
@@ -4605,9 +4603,8 @@ void resolve_path_masks(int anchor, int *path_mask)
|
||||
Assert(!(anchor & SPECIAL_ARRIVAL_ANCHOR_FLAG));
|
||||
parent_pobjp = mission_parse_get_parse_object(Parse_names[anchor]);
|
||||
|
||||
// Load the anchor ship model with subsystems and all; it'll need to be done for this mission anyway
|
||||
ship_info *sip = &Ship_info[parent_pobjp->ship_class];
|
||||
modelnum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
// load model for checking paths
|
||||
modelnum = model_load(Ship_info[parent_pobjp->ship_class].pof_file, 0, NULL);
|
||||
|
||||
// resolve names to indexes
|
||||
*path_mask = 0;
|
||||
@@ -4620,6 +4617,9 @@ void resolve_path_masks(int anchor, int *path_mask)
|
||||
*path_mask |= (1 << bay_path);
|
||||
}
|
||||
|
||||
// unload model
|
||||
model_unload(modelnum);
|
||||
|
||||
// cache the result
|
||||
prp->cached_mask = *path_mask;
|
||||
}
|
||||
@@ -7555,7 +7555,6 @@ void mission_bring_in_support_ship( object *requester_objp )
|
||||
// set support ship hitpoints
|
||||
pobj->ship_max_hull_strength = Ship_info[i].max_hull_strength;
|
||||
pobj->ship_max_shield_strength = Ship_info[i].max_shield_strength;
|
||||
pobj->max_shield_recharge = Ship_info[i].max_shield_recharge;
|
||||
|
||||
pobj->team = requester_shipp->team;
|
||||
|
||||
|
||||
@@ -424,8 +424,6 @@ public:
|
||||
float ship_max_hull_strength; // Needed to deal with special hitpoints
|
||||
float ship_max_shield_strength;
|
||||
|
||||
float max_shield_recharge;
|
||||
|
||||
// Goober5000
|
||||
SCP_vector<texture_replace> replacement_textures;
|
||||
|
||||
|
||||
@@ -1513,11 +1513,6 @@ void draw_model_icon(int model_id, int flags, float closeup_zoom, int x, int y,
|
||||
//Assume it's a weapon
|
||||
rot_angles.h = -(PI_2);
|
||||
}
|
||||
else if(sip->model_icon_angles.p != 0.0f || sip->model_icon_angles.b != 0.0f || sip->model_icon_angles.h != 0.0f)
|
||||
{
|
||||
// If non-zero model_icon_angles exists, always use that
|
||||
rot_angles = sip->model_icon_angles;
|
||||
}
|
||||
else if(sip->flags & SIF_SMALL_SHIP)
|
||||
{
|
||||
rot_angles.p = -(PI_2);
|
||||
|
||||
@@ -79,14 +79,14 @@ void parse_mod_table(const char *filename)
|
||||
SCP_string campaign_name;
|
||||
|
||||
while (optional_string("$Campaign File Name:")) {
|
||||
stuff_string(campaign_name, F_NAME);
|
||||
stuff_string(campaign_name, F_NAME);
|
||||
|
||||
// remove extension?
|
||||
if (drop_extension(campaign_name)) {
|
||||
mprintf(("Game Settings Table: Removed extension on ignored campaign file name %s\n", campaign_name.c_str()));
|
||||
}
|
||||
|
||||
Ignored_campaigns.push_back(campaign_name);
|
||||
Ignored_campaigns.push_back(campaign_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,15 +193,15 @@ void parse_mod_table(const char *filename)
|
||||
optional_string("#SOUND SETTINGS");
|
||||
|
||||
if (optional_string("$Default Sound Volume:")) {
|
||||
stuff_float(&Default_sound_volume);
|
||||
stuff_float(&Master_sound_volume);
|
||||
}
|
||||
|
||||
if (optional_string("$Default Music Volume:")) {
|
||||
stuff_float(&Default_music_volume);
|
||||
stuff_float(&Master_event_music_volume);
|
||||
}
|
||||
|
||||
if (optional_string("$Default Voice Volume:")) {
|
||||
stuff_float(&Default_voice_volume);
|
||||
stuff_float(&Master_voice_volume);
|
||||
}
|
||||
|
||||
optional_string("#FRED SETTINGS");
|
||||
|
||||
+1
-2
@@ -1022,8 +1022,7 @@ typedef struct mc_info {
|
||||
vec3d *p0; // The starting point of the ray (sphere) to check
|
||||
vec3d *p1; // The ending point of the ray (sphere) to check
|
||||
int flags; // Flags that the model_collide code looks at. See MC_??? defines
|
||||
float radius; // If MC_CHECK_THICK is set, checks a sphere moving with the radius.
|
||||
int lod; // Which detail level of the submodel to check instead
|
||||
float radius; // If MC_CHECK_THICK is set, checks a sphere moving with the radius.
|
||||
|
||||
// Return values
|
||||
int num_hits; // How many collisions were found
|
||||
|
||||
@@ -1130,22 +1130,7 @@ void mc_check_subobj( int mn )
|
||||
if ( Cmdline_old_collision_sys ) {
|
||||
model_collide_sub(sm->bsp_data);
|
||||
} else {
|
||||
if (Mc->lod > 0 && sm->num_details > 0) {
|
||||
bsp_info *lod_sm = sm;
|
||||
|
||||
for (int i = Mc->lod - 1; i >= 0; i--) {
|
||||
if (sm->details[i] != -1) {
|
||||
lod_sm = &Mc_pm->submodel[sm->details[i]];
|
||||
|
||||
//mprintf(("Checking %s collision for %s using %s instead\n", Mc_pm->filename, sm->name, lod_sm->name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
model_collide_bsp(model_get_bsp_collision_tree(lod_sm->collision_tree_index), 0);
|
||||
} else {
|
||||
model_collide_bsp(model_get_bsp_collision_tree(sm->collision_tree_index), 0);
|
||||
}
|
||||
model_collide_bsp(model_get_bsp_collision_tree(sm->collision_tree_index), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+31
-51
@@ -83,6 +83,7 @@ static float Interp_box_scale = 1.0f; // this is used to scale both detail boxes
|
||||
static vec3d Interp_render_box_min = ZERO_VECTOR;
|
||||
static vec3d Interp_render_box_max = ZERO_VECTOR;
|
||||
static float Interp_render_sphere_radius = 0.0f;
|
||||
static vec3d Interp_render_sphere_offset = ZERO_VECTOR;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// lighting save stuff
|
||||
@@ -368,6 +369,7 @@ void interp_clear_instance()
|
||||
Interp_render_box_min = vmd_zero_vector;
|
||||
Interp_render_box_max = vmd_zero_vector;
|
||||
Interp_render_sphere_radius = 0.0f;
|
||||
Interp_render_sphere_offset = vmd_zero_vector;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2726,7 +2728,6 @@ void model_really_render(int model_num, matrix *orient, vec3d * pos, uint flags,
|
||||
uint save_gr_zbuffering_mode;
|
||||
int zbuf_mode;
|
||||
ship *shipp = NULL;
|
||||
ship_info *sip = NULL;
|
||||
object *objp = NULL;
|
||||
bool set_autocen = false;
|
||||
bool draw_thrusters = false;
|
||||
@@ -2741,7 +2742,6 @@ void model_really_render(int model_num, matrix *orient, vec3d * pos, uint flags,
|
||||
|
||||
if (objp->type == OBJ_SHIP) {
|
||||
shipp = &Ships[objp->instance];
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
|
||||
if (shipp->flags2 & SF2_GLOWMAPS_DISABLED)
|
||||
flags |= MR_NO_GLOWMAPS;
|
||||
@@ -2905,37 +2905,33 @@ void model_really_render(int model_num, matrix *orient, vec3d * pos, uint flags,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (shipp != NULL && (sip->flags2 & SIF2_LOCK_DETAIL_BOXES)) {
|
||||
Interp_box_scale = 1.0f;
|
||||
} else {
|
||||
// scale the render box settings based on the "Model Detail" slider
|
||||
switch (Detail.detail_distance)
|
||||
{
|
||||
// 1st dot is 20%
|
||||
case 0:
|
||||
Interp_box_scale = 0.2f;
|
||||
break;
|
||||
// scale the render box settings based on the "Model Detail" slider
|
||||
switch (Detail.detail_distance)
|
||||
{
|
||||
// 1st dot is 20%
|
||||
case 0:
|
||||
Interp_box_scale = 0.2f;
|
||||
break;
|
||||
|
||||
// 2nd dot is 50%
|
||||
case 1:
|
||||
Interp_box_scale = 0.5f;
|
||||
break;
|
||||
// 2nd dot is 50%
|
||||
case 1:
|
||||
Interp_box_scale = 0.5f;
|
||||
break;
|
||||
|
||||
// 3rd dot is 80%
|
||||
case 2:
|
||||
Interp_box_scale = 0.8f;
|
||||
break;
|
||||
// 3rd dot is 80%
|
||||
case 2:
|
||||
Interp_box_scale = 0.8f;
|
||||
break;
|
||||
|
||||
// 4th dot is 100% (this is the default setting for "High" and "Very High" settings)
|
||||
case 3:
|
||||
Interp_box_scale = 1.0f;
|
||||
break;
|
||||
// 4th dot is 100% (this is the default setting for "High" and "Very High" settings)
|
||||
case 3:
|
||||
Interp_box_scale = 1.0f;
|
||||
break;
|
||||
|
||||
// 5th dot (max) is 120%
|
||||
case 4:
|
||||
Interp_box_scale = 1.2f;
|
||||
break;
|
||||
}
|
||||
// 5th dot (max) is 120%
|
||||
case 4:
|
||||
Interp_box_scale = 1.2f;
|
||||
break;
|
||||
}
|
||||
|
||||
vec3d auto_back = ZERO_VECTOR;
|
||||
@@ -4472,13 +4468,7 @@ void model_render_children_buffers(polymodel *pm, int mn, int detail_level)
|
||||
vm_vec_copy_scale(&Interp_render_box_min, &model->render_box_min, Interp_box_scale);
|
||||
vm_vec_copy_scale(&Interp_render_box_max, &model->render_box_max, Interp_box_scale);
|
||||
|
||||
vec3d offset;
|
||||
if (model->use_render_box_offset)
|
||||
offset = model->render_box_offset;
|
||||
else
|
||||
model_find_submodel_offset(&offset, pm->id, mn);
|
||||
|
||||
if ( (-model->use_render_box + in_box(&Interp_render_box_min, &Interp_render_box_max, &offset)) )
|
||||
if ( (-model->use_render_box + in_box(&Interp_render_box_min, &Interp_render_box_max, &model->offset)) )
|
||||
return;
|
||||
}
|
||||
if ( !(Interp_flags & MR_FULL_DETAIL) && model->use_render_sphere ) {
|
||||
@@ -4486,10 +4476,8 @@ void model_render_children_buffers(polymodel *pm, int mn, int detail_level)
|
||||
|
||||
// TODO: doesn't consider submodel rotations yet -zookeeper
|
||||
vec3d offset;
|
||||
if (model->use_render_sphere_offset)
|
||||
offset = model->render_sphere_offset;
|
||||
else
|
||||
model_find_submodel_offset(&offset, pm->id, mn);
|
||||
model_find_submodel_offset(&offset, pm->id, mn);
|
||||
vm_vec_add2(&offset, &model->render_sphere_offset);
|
||||
|
||||
if ( (-model->use_render_sphere + in_sphere(&offset, Interp_render_sphere_radius)) )
|
||||
return;
|
||||
@@ -4603,13 +4591,7 @@ void model_render_buffers(polymodel *pm, int mn, bool is_child)
|
||||
vm_vec_copy_scale(&Interp_render_box_min, &model->render_box_min, Interp_box_scale);
|
||||
vm_vec_copy_scale(&Interp_render_box_max, &model->render_box_max, Interp_box_scale);
|
||||
|
||||
vec3d offset;
|
||||
if (model->use_render_box_offset)
|
||||
offset = model->render_box_offset;
|
||||
else
|
||||
model_find_submodel_offset(&offset, pm->id, mn);
|
||||
|
||||
if ( (-model->use_render_box + in_box(&Interp_render_box_min, &Interp_render_box_max, &offset)) )
|
||||
if ( (-model->use_render_box + in_box(&Interp_render_box_min, &Interp_render_box_max, &model->offset)) )
|
||||
return;
|
||||
}
|
||||
if ( !is_child && !(Interp_flags & MR_FULL_DETAIL) && model->use_render_sphere ) {
|
||||
@@ -4617,10 +4599,8 @@ void model_render_buffers(polymodel *pm, int mn, bool is_child)
|
||||
|
||||
// TODO: doesn't consider submodel rotations yet -zookeeper
|
||||
vec3d offset;
|
||||
if (model->use_render_sphere_offset)
|
||||
offset = model->render_sphere_offset;
|
||||
else
|
||||
model_find_submodel_offset(&offset, pm->id, mn);
|
||||
model_find_submodel_offset(&offset, pm->id, mn);
|
||||
vm_vec_add2(&offset, &model->render_sphere_offset);
|
||||
|
||||
if ( (-model->use_render_sphere + in_sphere(&offset, Interp_render_sphere_radius)) )
|
||||
return;
|
||||
|
||||
@@ -1354,18 +1354,6 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
|
||||
while (*p == ' ') p++;
|
||||
pm->submodel[n].use_render_box = atoi(p);
|
||||
|
||||
if ( (p = strstr(props, "$box_offset:")) != NULL ) {
|
||||
p += 12;
|
||||
while (*p == ' ') p++;
|
||||
pm->submodel[n].render_box_offset.xyz.x = (float)strtod(p, (char **)NULL);
|
||||
while (*p != ',') p++;
|
||||
pm->submodel[n].render_box_offset.xyz.y = (float)strtod(++p, (char **)NULL);
|
||||
while (*p != ',') p++;
|
||||
pm->submodel[n].render_box_offset.xyz.z = (float)strtod(++p, (char **)NULL);
|
||||
|
||||
pm->submodel[n].use_render_box_offset = true;
|
||||
}
|
||||
|
||||
if ( (p = strstr(props, "$box_min:")) != NULL ) {
|
||||
p += 9;
|
||||
while (*p == ' ') p++;
|
||||
@@ -1412,8 +1400,6 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
|
||||
pm->submodel[n].render_sphere_offset.xyz.y = (float)strtod(++p, (char **)NULL);
|
||||
while (*p != ',') p++;
|
||||
pm->submodel[n].render_sphere_offset.xyz.z = (float)strtod(++p, (char **)NULL);
|
||||
|
||||
pm->submodel[n].use_render_sphere_offset = true;
|
||||
} else {
|
||||
pm->submodel[n].render_sphere_offset = vmd_zero_vector;
|
||||
}
|
||||
@@ -2480,7 +2466,7 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, in
|
||||
|
||||
pm = new polymodel;
|
||||
Polygon_models[num] = pm;
|
||||
|
||||
|
||||
pm->n_paths = 0;
|
||||
pm->paths = NULL;
|
||||
|
||||
@@ -2653,12 +2639,6 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, in
|
||||
}
|
||||
dl2 = tolower(sm2->name[first_diff]) - 'a';
|
||||
|
||||
// Handle LODs named "detail0/1/2/etc" too (as opposed to "detaila/b/c/etc")
|
||||
if (sm1->parent == -1 && sm2->parent == -1 && !sm1->is_damaged && !sm2->is_damaged && !sm1->is_live_debris && !sm2->is_live_debris) {
|
||||
dl2 = dl2 - dl1;
|
||||
dl1 = 0;
|
||||
}
|
||||
|
||||
if ( (dl1<0) || (dl2<0) || (dl1>=MAX_MODEL_DETAIL_LEVELS) || (dl2>=MAX_MODEL_DETAIL_LEVELS) ) continue; // invalid detail levels
|
||||
|
||||
if ( dl1 == 0 ) {
|
||||
@@ -2683,11 +2663,10 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, in
|
||||
|
||||
if ( !Cmdline_old_collision_sys ) {
|
||||
for ( i = 0; i < pm->n_models; ++i ) {
|
||||
if ( !(pm->submodel[i].nocollide_this_only || pm->submodel[i].no_collisions) ) {
|
||||
pm->submodel[i].collision_tree_index = model_create_bsp_collision_tree();
|
||||
bsp_collision_tree *tree = model_get_bsp_collision_tree(pm->submodel[i].collision_tree_index);
|
||||
model_collide_parse_bsp(tree, pm->submodel[i].bsp_data, pm->version);
|
||||
}
|
||||
pm->submodel[i].collision_tree_index = model_create_bsp_collision_tree();
|
||||
bsp_collision_tree *tree = model_get_bsp_collision_tree(pm->submodel[i].collision_tree_index);
|
||||
|
||||
model_collide_parse_bsp(tree, pm->submodel[i].bsp_data, pm->version);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -269,10 +269,6 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vec3d *
|
||||
// reset flags to check MC_CHECK_MODEL | MC_CHECK_SPHERELINE and maybe MC_CHECK_INVISIBLE_FACES and MC_SUBMODEL_INSTANCE
|
||||
mc.flags = copy_flags | MC_SUBMODEL_INSTANCE;
|
||||
|
||||
if (heavy_sip->collision_lod > -1) {
|
||||
mc.lod = heavy_sip->collision_lod;
|
||||
}
|
||||
|
||||
// check each submodel in turn
|
||||
for (smv = submodel_vector.begin(); smv != submodel_vector.end(); ++smv) {
|
||||
// turn on submodel for collision test
|
||||
|
||||
@@ -168,7 +168,6 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
mc.pos = &ship_objp->pos;
|
||||
mc.p0 = &weapon_objp->last_pos;
|
||||
mc.p1 = &weapon_end_pos;
|
||||
mc.lod = sip->collision_lod;
|
||||
memcpy(&mc_shield, &mc, sizeof(mc_info));
|
||||
memcpy(&mc_hull, &mc, sizeof(mc_info));
|
||||
|
||||
@@ -201,16 +200,15 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
// The weapon is not allowed to impact the shield before it reaches this point
|
||||
vec3d shield_ignored_until = weapon_objp->last_pos;
|
||||
|
||||
float min_weapon_span = sip->auto_shield_spread_min_span;
|
||||
float weapon_flown_for = vm_vec_dist(&wp->start_pos, &weapon_objp->last_pos);
|
||||
|
||||
// If weapon hasn't yet flown a distance greater than the maximum ignore
|
||||
// range, then some part of the currently checked range needs to be
|
||||
// ignored
|
||||
if (weapon_flown_for < min_weapon_span) {
|
||||
if (weapon_flown_for < sip->auto_shield_spread) {
|
||||
vm_vec_sub(&shield_ignored_until, &weapon_end_pos, &wp->start_pos);
|
||||
vm_vec_normalize(&shield_ignored_until);
|
||||
vm_vec_scale(&shield_ignored_until, min_weapon_span);
|
||||
vm_vec_scale(&shield_ignored_until, sip->auto_shield_spread);
|
||||
vm_vec_add2(&shield_ignored_until, &wp->start_pos);
|
||||
}
|
||||
|
||||
@@ -245,7 +243,7 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
// If no collision with the model found in the ignore range, only
|
||||
// then do we check for sphereline collisions with the model during the
|
||||
// non-ignored range
|
||||
if (!shield_collision && weapon_flown_for + this_range > min_weapon_span) {
|
||||
if (!shield_collision && weapon_flown_for + this_range > sip->auto_shield_spread) {
|
||||
mc_shield.p0 = &shield_ignored_until;
|
||||
|
||||
mc_shield.p1 = &weapon_end_pos;
|
||||
@@ -253,14 +251,16 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
mc_shield.radius = sip->auto_shield_spread;
|
||||
|
||||
if (sip->auto_shield_spread_from_lod > -1) {
|
||||
mc_shield.lod = sip->auto_shield_spread_from_lod;
|
||||
}
|
||||
pm = model_get(sip->model_num);
|
||||
mc_shield.submodel_num = pm->detail[sip->auto_shield_spread_from_lod];
|
||||
|
||||
mc_shield.flags = MC_CHECK_MODEL | MC_CHECK_SPHERELINE;
|
||||
mc_shield.flags = MC_CHECK_MODEL | MC_SUBMODEL_INSTANCE | MC_CHECK_SPHERELINE;
|
||||
} else {
|
||||
mc_shield.flags = MC_CHECK_MODEL | MC_CHECK_SPHERELINE;
|
||||
}
|
||||
|
||||
shield_collision = model_collide(&mc_shield);
|
||||
|
||||
mc_shield.lod = sip->collision_lod;
|
||||
mc_shield.submodel_num = -1;
|
||||
|
||||
// Because we manipulated p0 and p1 above, hit_dist will be
|
||||
@@ -407,12 +407,6 @@ int ship_weapon_check_collision(object *ship_objp, object *weapon_objp, float ti
|
||||
bool weapon_override = Script_system.IsConditionOverride(CHA_COLLIDESHIP, weapon_objp);
|
||||
|
||||
if(!ship_override && !weapon_override) {
|
||||
if (shield_collision && quadrant_num >= 0) {
|
||||
if ((sip->shield_impact_explosion_anim > -1) && (wip->shield_impact_explosion_radius > 0)) {
|
||||
// do in weapons.cpp for most parts just because that is how rest of the functions are handled
|
||||
shield_impact_explosion(&mc.hit_point, ship_objp, wip->shield_impact_explosion_radius, sip->shield_impact_explosion_anim);
|
||||
}
|
||||
}
|
||||
ship_weapon_do_hit_stuff(ship_objp, weapon_objp, &mc.hit_point_world, &mc.hit_point, quadrant_num, mc.hit_submodel, mc.hit_normal);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
object obj_free_list;
|
||||
object obj_used_list;
|
||||
object obj_create_list;
|
||||
object obj_create_list;
|
||||
|
||||
object *Player_obj = NULL;
|
||||
object *Viewer_obj = NULL;
|
||||
@@ -716,7 +716,7 @@ void obj_move_one_docked_object(object *objp, object *parent_objp)
|
||||
* Deals with firing player things like lasers, missiles, etc.
|
||||
*
|
||||
* Separated out because of multiplayer issues.
|
||||
*/
|
||||
*/
|
||||
void obj_player_fire_stuff( object *objp, control_info ci )
|
||||
{
|
||||
ship *shipp;
|
||||
@@ -888,7 +888,7 @@ void obj_move_call_physics(object *objp, float frametime)
|
||||
goto obj_maybe_fire;
|
||||
}
|
||||
|
||||
physics_sim(&objp->pos, &objp->orient, &objp->phys_info, frametime ); // simulate the physics
|
||||
physics_sim(&objp->pos, &objp->orient, &objp->phys_info, frametime ); // simulate the physics
|
||||
|
||||
// if the object is the player object, do things that need to be done after the ship
|
||||
// is moved (like firing weapons, etc). This routine will get called either single
|
||||
@@ -906,7 +906,7 @@ obj_maybe_fire:
|
||||
// do stream weapon firing for all ships themselves.
|
||||
if(objp->type == OBJ_SHIP){
|
||||
ship_fire_primary(objp, 1, 0);
|
||||
has_fired = 1;
|
||||
has_fired = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1411,7 +1411,7 @@ void obj_move_all(float frametime)
|
||||
vec3d cur_pos = objp->pos; // Save the current position
|
||||
|
||||
#ifdef OBJECT_CHECK
|
||||
obj_check_object( objp );
|
||||
obj_check_object( objp );
|
||||
#endif
|
||||
|
||||
// pre-move
|
||||
@@ -1708,7 +1708,7 @@ void obj_get_average_ship_pos( vec3d *pos )
|
||||
|
||||
vm_vec_zero( pos );
|
||||
|
||||
// average up all ship positions
|
||||
// average up all ship positions
|
||||
count = 0;
|
||||
for ( objp = GET_FIRST(&obj_used_list); objp != END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) {
|
||||
if ( objp->type != OBJ_SHIP )
|
||||
|
||||
@@ -49,18 +49,10 @@ void shield_add_strength(object *objp, float delta)
|
||||
if (delta == 0.0f)
|
||||
return;
|
||||
|
||||
float shield_str = shield_get_strength(objp);
|
||||
float shield_recharge_limit = Ships[objp->instance].ship_max_shield_strength * Ships[objp->instance].max_shield_recharge;
|
||||
|
||||
if (shield_str >= shield_recharge_limit)
|
||||
return;
|
||||
|
||||
|
||||
if (!(Ai_info[Ships[objp->instance].ai_index].ai_profile_flags & AIPF_SMART_SHIELD_MANAGEMENT)
|
||||
|| delta <= 0.0f) //SUSHI: We don't want smart shield management for negative delta
|
||||
{
|
||||
if ((delta > 0.0f) && ((shield_str + delta) > shield_recharge_limit))
|
||||
delta = shield_recharge_limit - shield_str;
|
||||
|
||||
for (int i = 0; i < objp->n_quadrants; i++)
|
||||
shield_add_quad(objp, i, delta / objp->n_quadrants);
|
||||
}
|
||||
@@ -89,11 +81,7 @@ void shield_add_strength(object *objp, float delta)
|
||||
// all quads are at full strength
|
||||
if (weakest >= section_max)
|
||||
break;
|
||||
|
||||
// set the limit for the shield recharge
|
||||
if ((delta > 0.0f) && ((shield_str + delta) > shield_recharge_limit))
|
||||
delta = shield_recharge_limit - shield_str;
|
||||
|
||||
|
||||
// throw all possible shield power at this quadrant
|
||||
// if there's any left over then apply it to the next weakest on the next pass
|
||||
float xfer_amount;
|
||||
|
||||
+13
-24
@@ -503,7 +503,7 @@ void obj_snd_do_frame()
|
||||
}
|
||||
|
||||
distance -= add_distance;
|
||||
if ( distance < 0.0f ) {
|
||||
if ( distance < 0 ) {
|
||||
distance = 0.0f;
|
||||
}
|
||||
|
||||
@@ -521,48 +521,39 @@ void obj_snd_do_frame()
|
||||
rot_vol_mult = 1.0f;
|
||||
alive_vol_mult = 1.0f;
|
||||
if ( objp->type == OBJ_SHIP ) {
|
||||
ship_info *sip = &Ship_info[Ships[objp->instance].ship_info_index];
|
||||
if ( !(sip->flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
|
||||
if ( objp->phys_info.max_vel.xyz.z <= 0.0f ) {
|
||||
if ( !(Ship_info[Ships[objp->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) ) {
|
||||
if ( objp->phys_info.max_vel.xyz.z <= 0 ) {
|
||||
percent_max = 0.0f;
|
||||
}
|
||||
else
|
||||
percent_max = objp->phys_info.fspeed / objp->phys_info.max_vel.xyz.z;
|
||||
|
||||
if ( sip->min_engine_vol == -1.0f) {
|
||||
// Retail behavior: volume ramps from 0.5 (when stationary) to 1.0 (when at half speed)
|
||||
if ( percent_max >= 0.5f ) {
|
||||
speed_vol_multiplier = 1.0f;
|
||||
} else {
|
||||
speed_vol_multiplier = 0.5f + (percent_max); // linear interp: 0.5->1.0 when 0.0->0.5
|
||||
}
|
||||
} else {
|
||||
// Volume ramps from min_engine_vol (when stationary) to 1.0 (when at full speed)
|
||||
speed_vol_multiplier = MAX(sip->min_engine_vol, percent_max);
|
||||
if ( percent_max >= 0.5 )
|
||||
speed_vol_multiplier = 1.0f;
|
||||
else {
|
||||
speed_vol_multiplier = 0.5f + (percent_max); // linear interp: 0.5->1.0 when 0.0->0.5
|
||||
}
|
||||
}
|
||||
if (osp->ss != NULL)
|
||||
{
|
||||
if (osp->flags & OS_TURRET_BASE_ROTATION)
|
||||
{
|
||||
if (osp->ss->base_rotation_rate_pct > 0.0f)
|
||||
if (osp->ss->base_rotation_rate_pct > 0)
|
||||
rot_vol_mult = ((0.25f + (0.75f * osp->ss->base_rotation_rate_pct)) * osp->ss->system_info->turret_base_rotation_snd_mult);
|
||||
else
|
||||
rot_vol_mult = 0.0f;
|
||||
rot_vol_mult = 0;
|
||||
}
|
||||
if (osp->flags & OS_TURRET_GUN_ROTATION)
|
||||
{
|
||||
if (osp->ss->gun_rotation_rate_pct > 0.0f)
|
||||
if (osp->ss->gun_rotation_rate_pct > 0)
|
||||
rot_vol_mult = ((0.25f + (0.75f * osp->ss->gun_rotation_rate_pct)) * osp->ss->system_info->turret_gun_rotation_snd_mult);
|
||||
else
|
||||
rot_vol_mult = 0.0f;
|
||||
rot_vol_mult = 0;
|
||||
}
|
||||
if (osp->flags & OS_SUBSYS_ROTATION )
|
||||
{
|
||||
if (osp->ss->flags & SSF_ROTATES) {
|
||||
rot_vol_mult = 1.0f;
|
||||
} else {
|
||||
rot_vol_mult = 0.0f;
|
||||
rot_vol_mult = 1.0;
|
||||
}
|
||||
}
|
||||
if (osp->flags & OS_SUBSYS_ALIVE)
|
||||
@@ -577,8 +568,6 @@ void obj_snd_do_frame()
|
||||
{
|
||||
if (osp->ss->current_hits <= 0.0f) {
|
||||
alive_vol_mult = 1.0f;
|
||||
} else {
|
||||
alive_vol_mult = 0.0f;
|
||||
}
|
||||
}
|
||||
if (osp->flags & OS_SUBSYS_DAMAGED)
|
||||
@@ -602,7 +591,7 @@ void obj_snd_do_frame()
|
||||
new_vol = max_vol - (distance - Snds[osp->id].min) * max_vol / (Snds[osp->id].max - Snds[osp->id].min);
|
||||
}
|
||||
|
||||
if ( new_vol < 0.1f ) {
|
||||
if ( new_vol < 0.1 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+5
-28
@@ -2632,7 +2632,7 @@ ADE_VIRTVAR(RotationalVelocityDamping, l_Physics, "number", "Rotational damping,
|
||||
return ade_set_args(L, "f", pih->pi->rotdamp);
|
||||
}
|
||||
|
||||
ADE_VIRTVAR(RotationalVelocityDesired, l_Physics, "lvector", "Desired rotational velocity", "number", "Desired rotational velocity, or 0 if handle is invalid")
|
||||
ADE_VIRTVAR(RotationalVelocityDesired, l_Physics, "vector", "Desired rotational velocity", "vector", "Desired rotational velocity, or null vector if handle is invalid")
|
||||
{
|
||||
physics_info_h *pih;
|
||||
vec3d *v3=NULL;
|
||||
@@ -6580,9 +6580,9 @@ ADE_VIRTVAR(AmmoMax, l_WeaponBank, "number", "Maximum ammo for the current bank<
|
||||
{
|
||||
case SWH_PRIMARY:
|
||||
{
|
||||
if(ADE_SETTING_VAR && ammomax > -1) {
|
||||
if(ADE_SETTING_VAR && ammomax > -1) {
|
||||
bh->sw->primary_bank_capacity[bh->bank] = ammomax;
|
||||
}
|
||||
}
|
||||
|
||||
int weapon_class = bh->sw->primary_bank_weapons[bh->bank];
|
||||
|
||||
@@ -6592,9 +6592,9 @@ ADE_VIRTVAR(AmmoMax, l_WeaponBank, "number", "Maximum ammo for the current bank<
|
||||
}
|
||||
case SWH_SECONDARY:
|
||||
{
|
||||
if(ADE_SETTING_VAR && ammomax > -1) {
|
||||
if(ADE_SETTING_VAR && ammomax > -1) {
|
||||
bh->sw->secondary_bank_capacity[bh->bank] = ammomax;
|
||||
}
|
||||
}
|
||||
|
||||
int weapon_class = bh->sw->secondary_bank_weapons[bh->bank];
|
||||
|
||||
@@ -15614,29 +15614,6 @@ ADE_FUNC(getStack, l_Testing, NULL, "Generates an ADE stackdump", "string", "Cur
|
||||
return ade_set_args(L, "s", buf);
|
||||
}
|
||||
|
||||
ADE_FUNC(setCurrentPlayerMulti, l_Testing, "boolean", "Sets whether current player is a multiplayer pilot or not.", "boolean", "True if successful, false if not.")
|
||||
{
|
||||
bool multi;
|
||||
|
||||
if(!ade_get_args(L, "b", &multi))
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
if(Player == NULL)
|
||||
return ade_set_error(L, "b", false);
|
||||
|
||||
if (multi) {
|
||||
Game_mode &= ~GM_NORMAL;
|
||||
Game_mode |= GM_MULTIPLAYER;
|
||||
Player->flags |= PLAYER_FLAGS_IS_MULTI;
|
||||
} else {
|
||||
Game_mode &= ~GM_MULTIPLAYER;
|
||||
Game_mode |= GM_NORMAL;
|
||||
Player->flags &= ~PLAYER_FLAGS_IS_MULTI;
|
||||
}
|
||||
|
||||
return ADE_RETURN_TRUE;
|
||||
}
|
||||
|
||||
ADE_FUNC(isCurrentPlayerMulti, l_Testing, NULL, "Returns whether current player is a multiplayer pilot or not.", "boolean", "Whether current player is a multiplayer pilot or not")
|
||||
{
|
||||
if(Player == NULL)
|
||||
|
||||
+144
-6
@@ -698,6 +698,72 @@ int required_string_either(char *str1, char *str2)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Return 0 or 1 for str1 match, str2 match. Return -1 if neither matches.
|
||||
// Does not update Mp if token found. If not found, advances, trying to
|
||||
// find the string. Doesn't advance past the found string.
|
||||
int required_string_3(char *str1, char *str2, char *str3)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
ignore_white_space();
|
||||
|
||||
while (count < RS_MAX_TRIES) {
|
||||
if (strnicmp(str1, Mp, strlen(str1)) == 0) {
|
||||
// Mp += strlen(str1);
|
||||
diag_printf("Found required string [%s]\n", token_found = str1);
|
||||
return 0;
|
||||
} else if (strnicmp(str2, Mp, strlen(str2)) == 0) {
|
||||
// Mp += strlen(str2);
|
||||
diag_printf("Found required string [%s]\n", token_found = str2);
|
||||
return 1;
|
||||
} else if (strnicmp(str3, Mp, strlen(str3)) == 0) {
|
||||
diag_printf("Found required string [%s]\n", token_found = str3);
|
||||
return 2;
|
||||
}
|
||||
|
||||
error_display(1, "Required token = [%s], [%s] or [%s], found [%.32s].\n", str1, str2, str3, next_tokens());
|
||||
|
||||
advance_to_eoln(NULL);
|
||||
ignore_white_space();
|
||||
count++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
int required_string_4(char *str1, char *str2, char *str3, char *str4)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
ignore_white_space();
|
||||
|
||||
while (count < RS_MAX_TRIES) {
|
||||
if (strnicmp(str1, Mp, strlen(str1)) == 0) {
|
||||
// Mp += strlen(str1);
|
||||
diag_printf("Found required string [%s]\n", token_found = str1);
|
||||
return 0;
|
||||
} else if (strnicmp(str2, Mp, strlen(str2)) == 0) {
|
||||
// Mp += strlen(str2);
|
||||
diag_printf("Found required string [%s]\n", token_found = str2);
|
||||
return 1;
|
||||
} else if (strnicmp(str3, Mp, strlen(str3)) == 0) {
|
||||
diag_printf("Found required string [%s]\n", token_found = str3);
|
||||
return 2;
|
||||
} else if (strnicmp(str4, Mp, strlen(str4)) == 0) {
|
||||
diag_printf("Found required string [%s]\n", token_found = str4);
|
||||
return 3;
|
||||
}
|
||||
|
||||
error_display(1, "Required token = [%s], [%s], [%s], or [%s], found [%.32s].\n", str1, str2, str3, str4, next_tokens());
|
||||
|
||||
advance_to_eoln(NULL);
|
||||
ignore_white_space();
|
||||
count++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Generic version of old required_string_3 and required_string_4; written by ngld, with some tweaks by MageKing17
|
||||
int required_string_one_of(int arg_count, ...)
|
||||
{
|
||||
@@ -1195,12 +1261,27 @@ void stuff_string(char *outstr, int type, int len, char *terminators)
|
||||
|
||||
switch (type) {
|
||||
case F_RAW:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp, read_len);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
case F_LNAME:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp, read_len);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
case F_NAME:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp, read_len);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
case F_DATE:
|
||||
case F_FILESPEC:
|
||||
case F_PATHNAME:
|
||||
case F_MESSAGE:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp, read_len);
|
||||
drop_trailing_white_space(read_str);
|
||||
@@ -1214,6 +1295,13 @@ void stuff_string(char *outstr, int type, int len, char *terminators)
|
||||
required_string("$End Notes:");
|
||||
break;
|
||||
|
||||
case F_FILESPEC:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp, read_len);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
// F_MULTITEXTOLD keeping for backwards compatability with old missions
|
||||
// can be deleted once all missions are using new briefing format
|
||||
|
||||
@@ -1232,6 +1320,20 @@ void stuff_string(char *outstr, int type, int len, char *terminators)
|
||||
required_string("$end_multi_text");
|
||||
break;
|
||||
|
||||
case F_PATHNAME:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp, read_len);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
case F_MESSAGE:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp, read_len);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
default:
|
||||
Error(LOCATION, "Unhandled string type %d in stuff_string!", type);
|
||||
}
|
||||
@@ -1269,12 +1371,27 @@ void stuff_string(SCP_string &outstr, int type, char *terminators)
|
||||
|
||||
switch (type) {
|
||||
case F_RAW:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
case F_LNAME:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
case F_NAME:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
case F_DATE:
|
||||
case F_FILESPEC:
|
||||
case F_PATHNAME:
|
||||
case F_MESSAGE:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp);
|
||||
drop_trailing_white_space(read_str);
|
||||
@@ -1288,6 +1405,13 @@ void stuff_string(SCP_string &outstr, int type, char *terminators)
|
||||
required_string("$End Notes:");
|
||||
break;
|
||||
|
||||
case F_FILESPEC:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
// F_MULTITEXTOLD keeping for backwards compatability with old missions
|
||||
// can be deleted once all missions are using new briefing format
|
||||
|
||||
@@ -1306,6 +1430,20 @@ void stuff_string(SCP_string &outstr, int type, char *terminators)
|
||||
required_string("$end_multi_text");
|
||||
break;
|
||||
|
||||
case F_PATHNAME:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
case F_MESSAGE:
|
||||
ignore_gray_space();
|
||||
copy_to_eoln(read_str, terminators, Mp);
|
||||
drop_trailing_white_space(read_str);
|
||||
advance_to_eoln(terminators);
|
||||
break;
|
||||
|
||||
default:
|
||||
Error(LOCATION, "Unhandled string type %d in stuff_string!", type);
|
||||
}
|
||||
|
||||
@@ -110,6 +110,8 @@ extern int optional_string_one_of(int arg_count, ...);
|
||||
// required
|
||||
extern int required_string(char *pstr);
|
||||
extern int required_string_either(char *str1, char *str2);
|
||||
extern int required_string_3(char *str1, char *str2, char *str3);
|
||||
extern int required_string_4(char *str1, char *str2, char *str3, char *str4);
|
||||
extern int required_string_one_of(int arg_count, ...);
|
||||
|
||||
// stuff
|
||||
|
||||
+2
-4
@@ -9902,7 +9902,7 @@ void sexp_hud_set_max_targeting_range(int n)
|
||||
|
||||
if (Hud_max_targeting_range < 0) {
|
||||
Hud_max_targeting_range = 0;
|
||||
}
|
||||
}
|
||||
|
||||
multi_start_callback();
|
||||
multi_send_int(Hud_max_targeting_range);
|
||||
@@ -16541,7 +16541,6 @@ void parse_copy_damage(p_object *target_pobjp, ship *source_shipp)
|
||||
// ...and shields
|
||||
target_pobjp->ship_max_shield_strength = source_shipp->ship_max_shield_strength;
|
||||
target_pobjp->initial_shields = fl2i(get_shield_pct(source_objp) * 100.0f);
|
||||
target_pobjp->max_shield_recharge = source_shipp->max_shield_recharge;
|
||||
|
||||
|
||||
// search through all subsystems on source ship and map them onto target ship
|
||||
@@ -31466,8 +31465,7 @@ sexp_help_struct Sexp_help[] = {
|
||||
"friendly-stealth-invisible - If set, the ship can't be targeted even by ships on the same team\r\n"
|
||||
"hide-ship-name - If set, the ship name can't be seen when the ship is targeted\r\n"
|
||||
"hidden-from-sensors - If set, the ship can't be targeted and appears on radar as a blinking dot\r\n"
|
||||
"no-dynamic - Will stop allowing the AI to persue dynamic goals (eg: chasing ships it was not ordered to)\r\n"
|
||||
"no-secondary-lock-on - Will disable target acquisition for secondaries of all types (does not affect turrets)\r\n"},
|
||||
"no-dynamic - Will stop allowing the AI to persue dynamic goals (eg: chasing ships it was not ordered to)\r\n"},
|
||||
|
||||
{ OP_SHIP_VISIBLE, "ship-visible\r\n"
|
||||
"\tCauses the ships listed in this sexpression to be visible with player sensors.\r\n\r\n"
|
||||
|
||||
+1
-1
@@ -1035,7 +1035,7 @@ typedef struct sexp_node {
|
||||
|
||||
typedef struct sexp_variable {
|
||||
int type;
|
||||
char text[256];
|
||||
char text[TOKEN_LENGTH];
|
||||
char variable_name[TOKEN_LENGTH];
|
||||
} sexp_variable;
|
||||
|
||||
|
||||
@@ -101,10 +101,6 @@ void init_new_pilot(player *p, int reset)
|
||||
Mouse_sensitivity = 4;
|
||||
Joy_sensitivity = 9;
|
||||
Dead_zone_size = 10;
|
||||
|
||||
Master_sound_volume = Default_sound_volume;
|
||||
Master_event_music_volume = Default_music_volume;
|
||||
Master_voice_volume = Default_voice_volume;
|
||||
}
|
||||
|
||||
// unassigned squadron
|
||||
|
||||
@@ -637,22 +637,22 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
|
||||
if (Axis_map_to[JOY_HEADING_AXIS] >= 0) {
|
||||
// check the heading on the x axis
|
||||
if ( check_control(BANK_WHEN_PRESSED) ) {
|
||||
delta = f2fl( axis[Axis_map_to[JOY_HEADING_AXIS]] );
|
||||
delta = f2fl( axis[JOY_HEADING_AXIS] );
|
||||
if ( (delta > 0.05f) || (delta < -0.05f) ) {
|
||||
ci->bank -= delta;
|
||||
}
|
||||
} else {
|
||||
ci->heading += f2fl( axis[Axis_map_to[JOY_HEADING_AXIS]] );
|
||||
ci->heading += f2fl( axis[JOY_HEADING_AXIS] );
|
||||
}
|
||||
}
|
||||
|
||||
// check the pitch on the y axis
|
||||
if (Axis_map_to[JOY_PITCH_AXIS] >= 0) {
|
||||
ci->pitch -= f2fl( axis[Axis_map_to[JOY_PITCH_AXIS]] );
|
||||
ci->pitch -= f2fl( axis[JOY_PITCH_AXIS] );
|
||||
}
|
||||
|
||||
if (Axis_map_to[JOY_BANK_AXIS] >= 0) {
|
||||
ci->bank -= f2fl( axis[Axis_map_to[JOY_BANK_AXIS]] ) * 1.5f;
|
||||
ci->bank -= f2fl( axis[JOY_BANK_AXIS] ) * 1.5f;
|
||||
}
|
||||
|
||||
// axis 2 is for throttle
|
||||
|
||||
+164
-219
@@ -312,7 +312,6 @@ flag_def_list Ship_flags[] = {
|
||||
{ "no lighting", SIF2_NO_LIGHTING, 1 },
|
||||
{ "auto spread shields", SIF2_AUTO_SPREAD_SHIELDS, 1 },
|
||||
{ "model point shields", SIF2_MODEL_POINT_SHIELDS, 1 },
|
||||
{ "lock detail boxes", SIF2_LOCK_DETAIL_BOXES, 1 },
|
||||
|
||||
// to keep things clean, obsolete options go last
|
||||
{ "ballistic primaries", -1, 255 }
|
||||
@@ -386,7 +385,6 @@ ship_flag_name Ship_flag_names[] = {
|
||||
{SF2_DONT_COLLIDE_INVIS, "don't-collide-invisible", 2, },
|
||||
{SF2_NO_ETS, "no-ets", 2, },
|
||||
{SF2_TOGGLE_SUBSYSTEM_SCANNING, "toggle-subsystem-scanning", 2, },
|
||||
{SF2_NO_SECONDARY_LOCKON, "no-secondary-lock-on", 2, },
|
||||
};
|
||||
|
||||
const int num_ai_tgt_weapon_flags = sizeof(ai_tgt_weapon_flags) / sizeof(flag_def_list);
|
||||
@@ -692,7 +690,6 @@ void init_ship_entry(ship_info *sip)
|
||||
sip->pof_file_hud[0] = '\0';
|
||||
sip->num_detail_levels = 1;
|
||||
sip->detail_distance[0] = 0;
|
||||
sip->collision_lod = -1;
|
||||
sip->cockpit_model_num = -1;
|
||||
sip->model_num = -1;
|
||||
sip->model_num_hud = -1;
|
||||
@@ -868,12 +865,9 @@ void init_ship_entry(ship_info *sip)
|
||||
sip->max_hull_strength = 100.0f;
|
||||
sip->max_shield_strength = 0.0f;
|
||||
|
||||
sip->max_shield_recharge = 1.0f;
|
||||
|
||||
sip->auto_shield_spread = 0.0f;
|
||||
sip->auto_shield_spread_bypass = false;
|
||||
sip->auto_shield_spread_from_lod = -1;
|
||||
sip->auto_shield_spread_min_span = -1.0f;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -954,7 +948,6 @@ void init_ship_entry(ship_info *sip)
|
||||
sip->thruster02_glow_len_factor = 1.0f;
|
||||
sip->thruster_dist_rad_factor = 2.0f;
|
||||
sip->thruster_dist_len_factor = 2.0f;
|
||||
sip->thruster_glow_noise_mult = 1.0f;
|
||||
|
||||
sip->draw_distortion = true;
|
||||
|
||||
@@ -974,14 +967,11 @@ void init_ship_entry(ship_info *sip)
|
||||
sip->newtonian_damp_override = false;
|
||||
|
||||
sip->autoaim_fov = 0.0f;
|
||||
sip->autoaim_lock_snd = -1;
|
||||
sip->autoaim_lost_snd = -1;
|
||||
|
||||
sip->topdown_offset_def = false;
|
||||
vm_vec_zero(&sip->topdown_offset);
|
||||
|
||||
sip->engine_snd = -1;
|
||||
sip->min_engine_vol = -1.0f;
|
||||
sip->glide_start_snd = -1;
|
||||
sip->glide_end_snd = -1;
|
||||
|
||||
@@ -1019,7 +1009,6 @@ void init_ship_entry(ship_info *sip)
|
||||
|
||||
sip->damage_lightning_type = SLT_DEFAULT;
|
||||
|
||||
sip->shield_impact_explosion_anim = -1;
|
||||
sip->hud_gauges.clear();
|
||||
sip->hud_enabled = false;
|
||||
sip->hud_retail = false;
|
||||
@@ -1267,60 +1256,6 @@ void parse_ship_particle_effect(ship_info* sip, particle_effect* pe, char *id_st
|
||||
}
|
||||
}
|
||||
|
||||
void parse_allowed_weapons(ship_info *sip, bool is_primary, bool is_dogfight)
|
||||
{
|
||||
int i, num_allowed;
|
||||
int allowed_weapons[MAX_WEAPON_TYPES];
|
||||
const int max_banks = (is_primary ? MAX_SHIP_PRIMARY_BANKS : MAX_SHIP_SECONDARY_BANKS);
|
||||
const int weapon_type = (is_dogfight ? DOGFIGHT_WEAPON : REGULAR_WEAPON);
|
||||
const int offset = (is_primary ? 0 : MAX_SHIP_PRIMARY_BANKS);
|
||||
const char *allowed_banks_str = is_primary ? (is_dogfight ? "$Allowed Dogfight PBanks:" : "$Allowed PBanks:")
|
||||
: (is_dogfight ? "$Allowed Dogfight SBanks:" : "$Allowed SBanks:");
|
||||
const char *bank_type_str = is_primary ? "primary" : "secondary";
|
||||
|
||||
// Goober5000 - fixed Bobboau's implementation of restricted banks
|
||||
int bank;
|
||||
|
||||
// Set the weapons filter used in weapons loadout (for primary weapons)
|
||||
if (optional_string(allowed_banks_str))
|
||||
{
|
||||
bank = -1;
|
||||
|
||||
while (check_for_string("("))
|
||||
{
|
||||
bank++;
|
||||
|
||||
// make sure we don't specify more than we have banks for
|
||||
if (bank >= max_banks)
|
||||
{
|
||||
Warning(LOCATION, "%s bank-specific loadout for %s exceeds permissible number of %s banks. Ignoring the rest...", allowed_banks_str, sip->name, bank_type_str);
|
||||
bank--;
|
||||
break;
|
||||
}
|
||||
|
||||
num_allowed = stuff_int_list(allowed_weapons, MAX_WEAPON_TYPES, WEAPON_LIST_TYPE);
|
||||
|
||||
// actually say which weapons are allowed
|
||||
for ( i = 0; i < num_allowed; i++ )
|
||||
{
|
||||
if ( allowed_weapons[i] >= 0 ) // MK, Bug fix, 9/6/99. Used to be "allowed_weapons" not "allowed_weapons[i]".
|
||||
{
|
||||
sip->allowed_bank_restricted_weapons[offset+bank][allowed_weapons[i]] |= weapon_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set flags if need be
|
||||
if (bank > 0) // meaning there was a restricted bank table entry
|
||||
{
|
||||
for (i=0; i<=bank; i++)
|
||||
{
|
||||
sip->restricted_loadout_flag[offset+i] |= weapon_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Common method for parsing ship/subsystem primary/secondary weapons so that the parser doesn't flip out in the event of a problem.
|
||||
*
|
||||
@@ -1420,7 +1355,8 @@ int parse_and_add_briefing_icon_info()
|
||||
int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
{
|
||||
char buf[SHIP_MULTITEXT_LENGTH];
|
||||
int i, j;
|
||||
int i, j, num_allowed;
|
||||
int allowed_weapons[MAX_WEAPON_TYPES];
|
||||
int rtn = 0;
|
||||
char name_tmp[NAME_LENGTH];
|
||||
|
||||
@@ -1675,13 +1611,6 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
sip->num_detail_levels = stuff_int_list(sip->detail_distance, MAX_SHIP_DETAIL_LEVELS, RAW_INTEGER_TYPE);
|
||||
}
|
||||
|
||||
if(optional_string("$Collision LOD:")) {
|
||||
stuff_int(&sip->collision_lod);
|
||||
|
||||
// Cap to sane values, just in case
|
||||
sip->collision_lod = MAX(0, MIN(sip->collision_lod, sip->num_detail_levels));
|
||||
}
|
||||
|
||||
// check for optional pixel colors
|
||||
while(optional_string("$ND:")){
|
||||
ubyte nr, ng, nb;
|
||||
@@ -1699,7 +1628,7 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
if (optional_string("$Enable Team Colors:")) {
|
||||
stuff_boolean(&sip->uses_team_colors);
|
||||
sip->default_team_name = "None";
|
||||
}
|
||||
}
|
||||
|
||||
if (optional_string("$Default Team:")) {
|
||||
char temp[NAME_LENGTH];
|
||||
@@ -2018,9 +1947,6 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
|
||||
if(optional_string("+Minimum Distance:"))
|
||||
stuff_float(&sip->minimum_convergence_distance);
|
||||
|
||||
parse_sound("+Autoaim Lock Snd:", &sip->autoaim_lock_snd, sip->name);
|
||||
parse_sound("+Autoaim Lost Snd:", &sip->autoaim_lost_snd, sip->name);
|
||||
}
|
||||
|
||||
if(optional_string("$Convergence:"))
|
||||
@@ -2295,9 +2221,86 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
stuff_float( &sip->weapon_model_draw_distance );
|
||||
}
|
||||
|
||||
// Goober5000 - fixed Bobboau's implementation of restricted banks
|
||||
int bank;
|
||||
|
||||
// Set the weapons filter used in weapons loadout (for primary weapons)
|
||||
parse_allowed_weapons(sip, true, false);
|
||||
parse_allowed_weapons(sip, true, true);
|
||||
if (optional_string("$Allowed PBanks:"))
|
||||
{
|
||||
bank = -1;
|
||||
|
||||
while (check_for_string("("))
|
||||
{
|
||||
bank++;
|
||||
|
||||
// make sure we don't specify more than we have banks for
|
||||
if (bank >= MAX_SHIP_PRIMARY_BANKS)
|
||||
{
|
||||
Warning(LOCATION, "$Allowed PBanks bank-specific loadout for %s exceeds permissible number of primary banks. Ignoring the rest...", sip->name);
|
||||
bank--;
|
||||
break;
|
||||
}
|
||||
|
||||
num_allowed = stuff_int_list(allowed_weapons, MAX_WEAPON_TYPES, WEAPON_LIST_TYPE);
|
||||
|
||||
// actually say which weapons are allowed
|
||||
for ( i = 0; i < num_allowed; i++ )
|
||||
{
|
||||
if ( allowed_weapons[i] >= 0 ) // MK, Bug fix, 9/6/99. Used to be "allowed_weapons" not "allowed_weapons[i]".
|
||||
{
|
||||
sip->allowed_bank_restricted_weapons[bank][allowed_weapons[i]] |= REGULAR_WEAPON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set flags if need be
|
||||
if (bank > 0) // meaning there was a restricted bank table entry
|
||||
{
|
||||
for (i=0; i<=bank; i++)
|
||||
{
|
||||
sip->restricted_loadout_flag[i] |= REGULAR_WEAPON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the weapons filter used in weapons loadout (for primary weapons)
|
||||
if (optional_string("$Allowed Dogfight PBanks:"))
|
||||
{
|
||||
bank = -1;
|
||||
|
||||
while (check_for_string("("))
|
||||
{
|
||||
bank++;
|
||||
|
||||
// make sure we don't specify more than we have banks for
|
||||
if (bank >= MAX_SHIP_PRIMARY_BANKS)
|
||||
{
|
||||
Warning(LOCATION, "$Allowed Dogfight PBanks bank-specific loadout for %s exceeds permissible number of primary banks. Ignoring the rest...", sip->name);
|
||||
bank--;
|
||||
break;
|
||||
}
|
||||
|
||||
num_allowed = stuff_int_list(allowed_weapons, MAX_WEAPON_TYPES, WEAPON_LIST_TYPE);
|
||||
|
||||
// actually say which weapons are allowed
|
||||
for ( i = 0; i < num_allowed; i++ )
|
||||
{
|
||||
if ( allowed_weapons[i] >= 0 ) // MK, Bug fix, 9/6/99. Used to be "allowed_weapons" not "allowed_weapons[i]".
|
||||
{
|
||||
sip->allowed_bank_restricted_weapons[bank][allowed_weapons[i]] |= DOGFIGHT_WEAPON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set flags if need be
|
||||
if (bank > 0) // meaning there was a restricted bank table entry
|
||||
{
|
||||
for (i=0; i<=bank; i++)
|
||||
{
|
||||
sip->restricted_loadout_flag[i] |= DOGFIGHT_WEAPON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get primary bank weapons
|
||||
parse_weapon_bank(sip, true, &sip->num_primary_banks, sip->primary_bank_weapons, sip->primary_bank_ammo_capacity);
|
||||
@@ -2309,8 +2312,82 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
}
|
||||
|
||||
// Set the weapons filter used in weapons loadout (for secondary weapons)
|
||||
parse_allowed_weapons(sip, false, false);
|
||||
parse_allowed_weapons(sip, false, true);
|
||||
if (optional_string("$Allowed SBanks:"))
|
||||
{
|
||||
bank = -1;
|
||||
|
||||
while (check_for_string("("))
|
||||
{
|
||||
bank++;
|
||||
|
||||
// make sure we don't specify more than we have banks for
|
||||
if (bank >= MAX_SHIP_SECONDARY_BANKS)
|
||||
{
|
||||
Warning(LOCATION, "$Allowed SBanks bank-specific loadout for %s exceeds permissible number of secondary banks. Ignoring the rest...", sip->name);
|
||||
bank--;
|
||||
break;
|
||||
}
|
||||
|
||||
num_allowed = stuff_int_list(allowed_weapons, MAX_WEAPON_TYPES, WEAPON_LIST_TYPE);
|
||||
|
||||
// actually say which weapons are allowed
|
||||
for ( i = 0; i < num_allowed; i++ )
|
||||
{
|
||||
if ( allowed_weapons[i] >= 0 ) // MK, Bug fix, 9/6/99. Used to be "allowed_weapons" not "allowed_weapons[i]".
|
||||
{
|
||||
sip->allowed_bank_restricted_weapons[MAX_SHIP_PRIMARY_BANKS+bank][allowed_weapons[i]] |= REGULAR_WEAPON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set flags if need be
|
||||
if (bank > 0) // meaning there was a restricted bank table entry
|
||||
{
|
||||
for (i=0; i<=bank; i++)
|
||||
{
|
||||
sip->restricted_loadout_flag[MAX_SHIP_PRIMARY_BANKS+i] |= REGULAR_WEAPON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the weapons filter used in weapons loadout (for secondary weapons)
|
||||
if (optional_string("$Allowed Dogfight SBanks:"))
|
||||
{
|
||||
bank = -1;
|
||||
|
||||
while (check_for_string("("))
|
||||
{
|
||||
bank++;
|
||||
|
||||
// make sure we don't specify more than we have banks for
|
||||
if (bank >= MAX_SHIP_SECONDARY_BANKS)
|
||||
{
|
||||
Warning(LOCATION, "$Allowed Dogfight SBanks bank-specific loadout for %s exceeds permissible number of secondary banks. Ignoring the rest...", sip->name);
|
||||
bank--;
|
||||
break;
|
||||
}
|
||||
|
||||
num_allowed = stuff_int_list(allowed_weapons, MAX_WEAPON_TYPES, WEAPON_LIST_TYPE);
|
||||
|
||||
// actually say which weapons are allowed
|
||||
for ( i = 0; i < num_allowed; i++ )
|
||||
{
|
||||
if ( allowed_weapons[i] >= 0 ) // MK, Bug fix, 9/6/99. Used to be "allowed_weapons" not "allowed_weapons[i]".
|
||||
{
|
||||
sip->allowed_bank_restricted_weapons[MAX_SHIP_PRIMARY_BANKS+bank][allowed_weapons[i]] |= DOGFIGHT_WEAPON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set flags if need be
|
||||
if (bank > 0) // meaning there was a restricted bank table entry
|
||||
{
|
||||
for (i=0; i<=bank; i++)
|
||||
{
|
||||
sip->restricted_loadout_flag[MAX_SHIP_PRIMARY_BANKS+i] |= DOGFIGHT_WEAPON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get secondary bank weapons
|
||||
parse_weapon_bank(sip, false, &sip->num_secondary_banks, sip->secondary_bank_weapons, sip->secondary_bank_ammo_capacity);
|
||||
@@ -2327,11 +2404,6 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
if(optional_string("+Auto Spread:")) {
|
||||
stuff_float(&sip->auto_shield_spread);
|
||||
}
|
||||
if(optional_string("+Minimum Weapon Span:")) {
|
||||
stuff_float(&sip->auto_shield_spread_min_span);
|
||||
} else {
|
||||
sip->auto_shield_spread_min_span = sip->auto_shield_spread;
|
||||
}
|
||||
if(optional_string("+Allow Bypass:")) {
|
||||
stuff_boolean(&sip->auto_shield_spread_bypass);
|
||||
}
|
||||
@@ -2381,19 +2453,6 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
stuff_ubyte(&sip->shield_color[2]);
|
||||
}
|
||||
|
||||
if(optional_string("$Shield Impact Explosion:")) {
|
||||
char fname[MAX_NAME_LEN];
|
||||
stuff_string(fname, F_NAME, NAME_LENGTH);
|
||||
|
||||
if ( VALID_FNAME(fname) )
|
||||
sip->shield_impact_explosion_anim = Weapon_explosions.Load(fname);
|
||||
}
|
||||
|
||||
if(optional_string("$Max Shield Recharge:")){
|
||||
stuff_float(&sip->max_shield_recharge);
|
||||
CLAMP(sip->max_shield_recharge, 0.0f, 1.0f);
|
||||
}
|
||||
|
||||
// The next five fields are used for the ETS
|
||||
if (optional_string("$Power Output:"))
|
||||
stuff_float(&sip->power_output);
|
||||
@@ -2699,9 +2758,6 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
//Parse the engine sound
|
||||
parse_sound("$EngineSnd:", &sip->engine_snd, sip->name);
|
||||
|
||||
if(optional_string("$Minimum Engine Volume:"))
|
||||
stuff_float(&sip->min_engine_vol);
|
||||
|
||||
//Parse optional sound to be used for beginning of a glide
|
||||
parse_sound("$GlideStartSnd:", &sip->glide_start_snd, sip->name);
|
||||
|
||||
@@ -2758,32 +2814,6 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
stuff_string(sip->icon_filename, F_NAME, MAX_FILENAME_LEN);
|
||||
}
|
||||
|
||||
if ( optional_string("$Model Icon Direction:") ) {
|
||||
char str[NAME_LENGTH];
|
||||
stuff_string(str, F_NAME, NAME_LENGTH);
|
||||
|
||||
angles model_icon_angles = {0.0f,0.0f,0.0f};
|
||||
|
||||
if (!stricmp(str, "top")) {
|
||||
model_icon_angles.p = -PI_2;
|
||||
} else if (!stricmp(str, "bottom")) {
|
||||
model_icon_angles.p = -PI_2;
|
||||
model_icon_angles.b = 2 * PI_2;
|
||||
} else if (!stricmp(str, "front")) {
|
||||
model_icon_angles.h = 2 * PI_2;
|
||||
} else if (!stricmp(str, "back")) {
|
||||
model_icon_angles.h = 4 * PI_2;
|
||||
} else if (!stricmp(str, "left")) {
|
||||
model_icon_angles.h = -PI_2;
|
||||
} else if (!stricmp(str, "right")) {
|
||||
model_icon_angles.h = PI_2;
|
||||
} else {
|
||||
Warning(LOCATION, "Unrecognized value \"%s\" passed to $Model Icon Direction, ignoring...", str);
|
||||
}
|
||||
|
||||
sip->model_icon_angles = model_icon_angles;
|
||||
}
|
||||
|
||||
// read in filename for animation that is used in ship selection
|
||||
if ( optional_string("$Ship_anim:") ) {
|
||||
stuff_string(sip->anim_filename, F_NAME, MAX_FILENAME_LEN);
|
||||
@@ -2933,10 +2963,6 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
stuff_boolean(&sip->draw_distortion);
|
||||
}
|
||||
|
||||
if ( optional_string("$Thruster Glow Noise Mult:") ) {
|
||||
stuff_float(&sip->thruster_glow_noise_mult);
|
||||
}
|
||||
|
||||
while ( optional_string("$Thruster Particles:") ) {
|
||||
bool afterburner = false;
|
||||
thruster_particles tpart;
|
||||
@@ -3211,15 +3237,6 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
stuff_vec3d(&metadata.departure_rvec);
|
||||
}
|
||||
|
||||
if (optional_string("+arrive speed multiplier:"))
|
||||
{
|
||||
stuff_float(&metadata.arrive_speed_mult);
|
||||
}
|
||||
if (optional_string("+depart speed multiplier:"))
|
||||
{
|
||||
stuff_float(&metadata.depart_speed_mult);
|
||||
}
|
||||
|
||||
//Add the new path_metadata to sip->pathMetadata keyed by path name
|
||||
SCP_string pathName(path_name);
|
||||
sip->pathMetadata[pathName] = metadata;
|
||||
@@ -3240,7 +3257,7 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
}
|
||||
|
||||
while (cont_flag) {
|
||||
int r = required_string_one_of(3, "#End", "$Subsystem:", "$Name" );
|
||||
int r = required_string_3("#End", "$Subsystem:", "$Name" );
|
||||
switch (r) {
|
||||
case 0:
|
||||
cont_flag = 0;
|
||||
@@ -3738,10 +3755,8 @@ int parse_ship_values(ship_info* sip, bool first_time, bool replace)
|
||||
case 2:
|
||||
cont_flag = 0;
|
||||
break;
|
||||
case -1: // Possible return value if -noparseerrors is used
|
||||
break;
|
||||
default:
|
||||
Assertion(false, "This should never happen.\n"); // Impossible return value from required_string_one_of.
|
||||
Int3(); // Impossible return value from required_string_3.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5100,14 +5115,12 @@ void ship_set(int ship_index, int objnum, int ship_type)
|
||||
}
|
||||
objp->hull_strength = shipp->ship_max_hull_strength;
|
||||
|
||||
shipp->max_shield_recharge = sip->max_shield_recharge;
|
||||
|
||||
if (Fred_running) {
|
||||
shipp->ship_max_shield_strength = 100.0f;
|
||||
objp->shield_quadrant[0] = 100.0f;
|
||||
} else {
|
||||
shipp->ship_max_shield_strength = sip->max_shield_strength;
|
||||
shield_set_strength(objp, shipp->ship_max_shield_strength * shipp->max_shield_recharge);
|
||||
shield_set_strength(objp, shipp->ship_max_shield_strength);
|
||||
}
|
||||
|
||||
if (sip->flags2 & SIF2_MODEL_POINT_SHIELDS) {
|
||||
@@ -6188,7 +6201,7 @@ void ship_render(object * obj)
|
||||
mst.distortion_bitmap = shipp->thruster_distortion_bitmap;
|
||||
|
||||
mst.use_ab = (obj->phys_info.flags & PF_AFTERBURNER_ON) || (obj->phys_info.flags & PF_BOOSTER_ON);
|
||||
mst.glow_noise = shipp->thruster_glow_noise * sip->thruster_glow_noise_mult;
|
||||
mst.glow_noise = shipp->thruster_glow_noise;
|
||||
mst.rotvel = &Objects[shipp->objnum].phys_info.rotvel;
|
||||
|
||||
mst.glow_rad_factor = sip->thruster01_glow_rad_factor;
|
||||
@@ -9267,8 +9280,6 @@ void change_ship_type(int n, int ship_type, int by_sexp)
|
||||
objp->hull_strength = hull_pct * sp->ship_max_hull_strength;
|
||||
}
|
||||
|
||||
sp->max_shield_recharge = sip->max_shield_recharge;
|
||||
|
||||
// set the correct shield strength
|
||||
if (Fred_running) {
|
||||
if (sp->ship_max_shield_strength)
|
||||
@@ -9912,70 +9923,6 @@ int tracers[MAX_SHIPS][4][4];
|
||||
|
||||
float ship_get_subsystem_strength( ship *shipp, int type );
|
||||
|
||||
/**
|
||||
* Checks whether a ship would use autoaim if it were to fire its primaries at
|
||||
* the given object, taking lead into account.
|
||||
*
|
||||
* @param shipp the ship to check
|
||||
* @param bank_to_fire the assumed primary bank
|
||||
* @param obj the object to check; must be the ship's current target
|
||||
*/
|
||||
|
||||
bool in_autoaim_fov(ship *shipp, int bank_to_fire, object *obj)
|
||||
{
|
||||
// Most of the code of this function has been duplicated from
|
||||
// ship_fire_primary(), because it is not easy to encapsulate cleanly.
|
||||
|
||||
ship_info *sip;
|
||||
ai_info *aip;
|
||||
ship_weapon *swp;
|
||||
|
||||
bool has_autoaim, has_converging_autoaim;
|
||||
float autoaim_fov = 0;
|
||||
float dist_to_target = 0;
|
||||
|
||||
vec3d plr_to_target_vec;
|
||||
vec3d player_forward_vec = Objects[shipp->objnum].orient.vec.fvec;
|
||||
|
||||
vec3d target_position;
|
||||
|
||||
sip = &Ship_info[shipp->ship_info_index];
|
||||
aip = &Ai_info[shipp->ai_index];
|
||||
|
||||
swp = &shipp->weapons;
|
||||
int weapon = swp->primary_bank_weapons[bank_to_fire];
|
||||
weapon_info* winfo_p = &Weapon_info[weapon];
|
||||
|
||||
has_converging_autoaim = ((sip->aiming_flags & AIM_FLAG_AUTOAIM_CONVERGENCE || (The_mission.ai_profile->player_autoaim_fov[Game_skill_level] > 0.0f && !( Game_mode & GM_MULTIPLAYER ))) && aip->target_objnum != -1);
|
||||
has_autoaim = ((has_converging_autoaim || (sip->aiming_flags & AIM_FLAG_AUTOAIM)) && aip->target_objnum != -1);
|
||||
|
||||
if (!has_autoaim)
|
||||
return FALSE;
|
||||
|
||||
autoaim_fov = MAX(shipp->autoaim_fov, The_mission.ai_profile->player_autoaim_fov[Game_skill_level]);
|
||||
|
||||
if (aip->targeted_subsys != NULL)
|
||||
{
|
||||
get_subsystem_world_pos(&Objects[aip->target_objnum], aip->targeted_subsys, &target_position);
|
||||
}
|
||||
else
|
||||
{
|
||||
target_position = obj->pos;
|
||||
}
|
||||
|
||||
dist_to_target = vm_vec_dist_quick(&Objects[shipp->objnum].pos, &target_position);
|
||||
|
||||
hud_calculate_lead_pos(&plr_to_target_vec, &target_position, obj, winfo_p, dist_to_target);
|
||||
vm_vec_sub2(&plr_to_target_vec, &Objects[shipp->objnum].pos);
|
||||
|
||||
float angle_to_target = vm_vec_delta_ang(&player_forward_vec, &plr_to_target_vec, NULL);
|
||||
|
||||
if (angle_to_target <= autoaim_fov)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// fires a primary weapon for the given object. It also handles multiplayer cases.
|
||||
// in multiplayer, the starting network signature, and number of banks fired are sent
|
||||
// to all the clients in the game. All the info is passed to send_primary at the end of
|
||||
@@ -12739,7 +12686,7 @@ float ship_calculate_rearm_duration( object *objp )
|
||||
|
||||
//find out time to repair shields
|
||||
if(sip->sup_shield_repair_rate > 0.0f)
|
||||
shield_rep_time = ((sp->ship_max_shield_strength * sp->max_shield_recharge) - shield_get_strength(objp)) / (sp->max_shield_recharge * sp->ship_max_shield_strength * sip->sup_shield_repair_rate);
|
||||
shield_rep_time = (sp->ship_max_shield_strength - shield_get_strength(objp)) / (sp->ship_max_shield_strength * sip->sup_shield_repair_rate);
|
||||
|
||||
max_hull_repair = sp->ship_max_hull_strength * (The_mission.support_ships.max_hull_repair_val * 0.01f);
|
||||
if ((The_mission.flags & MISSION_FLAG_SUPPORT_REPAIRS_HULL) && (max_hull_repair > objp->hull_strength) && (sip->sup_hull_repair_rate > 0.0f))
|
||||
@@ -12875,7 +12822,7 @@ int ship_do_rearm_frame( object *objp, float frametime )
|
||||
if ( !(objp->flags & OF_NO_SHIELDS) )
|
||||
{
|
||||
shield_str = shield_get_strength(objp);
|
||||
if ( shield_str < (shipp->ship_max_shield_strength * shipp->max_shield_recharge) ) {
|
||||
if ( shield_str < shipp->ship_max_shield_strength ) {
|
||||
if ( objp == Player_obj ) {
|
||||
player_maybe_start_repair_sound();
|
||||
}
|
||||
@@ -17870,8 +17817,6 @@ int ship_get_subobj_model_num(ship_info* sip, char* subobj_name)
|
||||
void init_path_metadata(path_metadata& metadata)
|
||||
{
|
||||
vm_vec_zero(&metadata.departure_rvec);
|
||||
metadata.arrive_speed_mult = FLT_MIN;
|
||||
metadata.depart_speed_mult = FLT_MIN;
|
||||
}
|
||||
|
||||
int ship_get_sound(object *objp, GameSoundsIndex id)
|
||||
|
||||
+4
-20
@@ -424,7 +424,7 @@ typedef struct ship_flag_name {
|
||||
int flag_list; // is this flag in the 1st or 2nd ship flags list?
|
||||
} ship_flag_name;
|
||||
|
||||
#define MAX_SHIP_FLAG_NAMES 18
|
||||
#define MAX_SHIP_FLAG_NAMES 17
|
||||
extern ship_flag_name Ship_flag_names[];
|
||||
|
||||
// states for the flags variable within the ship structure
|
||||
@@ -505,7 +505,6 @@ extern ship_flag_name Ship_flag_names[];
|
||||
#define SF2_WEAPONS_LOCKED (1<<25) // Karajorma - Prevents the player from changing the weapons on the ship on the loadout screen
|
||||
#define SF2_SHIP_SELECTIVE_LINKING (1<<26) // RSAXVC - Allow pilot to pick firing configuration
|
||||
#define SF2_SCRAMBLE_MESSAGES (1<<27) // Goober5000 - all messages sent from this ship appear scrambled
|
||||
#define SF2_NO_SECONDARY_LOCKON (1<<28) // zookeeper - secondary lock-on disabled
|
||||
|
||||
// If any of these bits in the ship->flags are set, ignore this ship when targeting
|
||||
extern int TARGET_SHIP_IGNORE_FLAGS;
|
||||
@@ -593,8 +592,6 @@ public:
|
||||
float ship_max_shield_strength;
|
||||
float ship_max_hull_strength;
|
||||
|
||||
float max_shield_recharge;
|
||||
|
||||
int ship_guardian_threshold; // Goober5000 - now also determines whether ship is guardian'd
|
||||
|
||||
|
||||
@@ -931,7 +928,6 @@ extern int ship_find_exited_ship_by_signature( int signature);
|
||||
#define SIF2_AUTO_SPREAD_SHIELDS (1 << 16) // zookeeper - auto spread shields
|
||||
#define SIF2_DRAW_WEAPON_MODELS (1 << 17) // the ship draws weapon models of any sort (used to be a boolean)
|
||||
#define SIF2_MODEL_POINT_SHIELDS (1 << 18) // zookeeper - uses model-defined shield points instead of quadrants
|
||||
#define SIF2_LOCK_DETAIL_BOXES (1 << 19) // zookeeper - don't scale detail boxes or spheres based on detail settings
|
||||
|
||||
#define SIF_DEFAULT_VALUE 0
|
||||
#define SIF2_DEFAULT_VALUE 0
|
||||
@@ -1148,8 +1144,6 @@ typedef struct ship_collision_physics {
|
||||
|
||||
typedef struct path_metadata {
|
||||
vec3d departure_rvec;
|
||||
float arrive_speed_mult;
|
||||
float depart_speed_mult;
|
||||
} path_metadata;
|
||||
|
||||
// The real FreeSpace ship_info struct.
|
||||
@@ -1181,7 +1175,6 @@ public:
|
||||
char pof_file_hud[MAX_FILENAME_LEN]; // POF file to load for the HUD target box
|
||||
int num_detail_levels; // number of detail levels for this ship
|
||||
int detail_distance[MAX_SHIP_DETAIL_LEVELS]; // distance to change detail levels at
|
||||
int collision_lod; // check for collisions using a LOD
|
||||
int cockpit_model_num; // cockpit model
|
||||
int model_num; // ship model
|
||||
int model_num_hud; // model to use when rendering to the HUD (eg, mini supercap)
|
||||
@@ -1302,15 +1295,12 @@ public:
|
||||
|
||||
float max_hull_strength; // Max hull strength of this class of ship.
|
||||
float max_shield_strength;
|
||||
float auto_shield_spread; // Thickness of the shield
|
||||
bool auto_shield_spread_bypass; // Whether weapons fired up close can bypass shields
|
||||
int auto_shield_spread_from_lod; // Which LOD to project the shield from
|
||||
float auto_shield_spread_min_span; // Minimum distance weapons must travel until allowed to collide with the shield
|
||||
float auto_shield_spread;
|
||||
bool auto_shield_spread_bypass;
|
||||
int auto_shield_spread_from_lod;
|
||||
|
||||
int shield_point_augment_ctrls[4]; // Re-mapping of shield augmentation controls for model point shields
|
||||
|
||||
float max_shield_recharge;
|
||||
|
||||
float hull_repair_rate; //How much of the hull is repaired every second
|
||||
float subsys_repair_rate; //How fast
|
||||
|
||||
@@ -1330,7 +1320,6 @@ public:
|
||||
|
||||
ubyte shield_icon_index; // index to locate ship-specific animation frames for the shield on HUD
|
||||
char icon_filename[MAX_FILENAME_LEN]; // filename for icon that is displayed in ship selection
|
||||
angles model_icon_angles; // angle from which the model icon should be rendered (if not 0,0,0)
|
||||
char anim_filename[MAX_FILENAME_LEN]; // filename for animation that plays in ship selection
|
||||
char overhead_filename[MAX_FILENAME_LEN]; // filename for animation that plays weapons loadout
|
||||
int selection_effect;
|
||||
@@ -1383,7 +1372,6 @@ public:
|
||||
float thruster02_glow_len_factor;
|
||||
float thruster_dist_rad_factor;
|
||||
float thruster_dist_len_factor;
|
||||
float thruster_glow_noise_mult;
|
||||
|
||||
bool draw_distortion;
|
||||
|
||||
@@ -1410,7 +1398,6 @@ public:
|
||||
vec3d topdown_offset;
|
||||
|
||||
int engine_snd; // handle to engine sound for ship (-1 if no engine sound)
|
||||
float min_engine_vol; // minimum volume modifier for engine sound when ship is stationary
|
||||
int glide_start_snd; // handle to sound to play at the beginning of a glide maneuver (default is 0 for regular throttle down sound)
|
||||
int glide_end_snd; // handle to sound to play at the end of a glide maneuver (default is 0 for regular throttle up sound)
|
||||
|
||||
@@ -1430,12 +1417,10 @@ public:
|
||||
float minimum_convergence_distance;
|
||||
float convergence_distance;
|
||||
vec3d convergence_offset;
|
||||
int autoaim_lock_snd, autoaim_lost_snd;
|
||||
|
||||
float emp_resistance_mod;
|
||||
|
||||
float piercing_damage_draw_limit;
|
||||
int shield_impact_explosion_anim;
|
||||
|
||||
int damage_lightning_type;
|
||||
|
||||
@@ -1606,7 +1591,6 @@ extern void ship_cleanup(int shipnum, int cleanup_mode);
|
||||
extern void ship_destroy_instantly(object *ship_obj, int shipnum);
|
||||
extern void ship_actually_depart(int shipnum, int method = SHIP_DEPARTED_WARP);
|
||||
|
||||
extern bool in_autoaim_fov(ship *shipp, int bank_to_fire, object *obj);
|
||||
extern int ship_fire_primary_debug(object *objp); // Fire the debug laser.
|
||||
extern int ship_stop_fire_primary(object * obj);
|
||||
extern int ship_fire_primary(object * objp, int stream_weapons, int force = 0);
|
||||
|
||||
@@ -45,10 +45,6 @@ ubyte *Compressed_service_buffer = NULL; // Used to read in compressed data duri
|
||||
|
||||
#define AS_HIGHEST_MAX 999999999 // max uncompressed filesize supported is 999 meg
|
||||
|
||||
// Globalize the list of audio extensions for use in several sound related files
|
||||
const char *audio_ext_list[] = { ".ogg", ".wav" };
|
||||
const int NUM_AUDIO_EXT = sizeof(audio_ext_list) / sizeof(char*);
|
||||
|
||||
|
||||
int Audiostream_inited = 0;
|
||||
|
||||
@@ -440,6 +436,8 @@ bool WaveFile::Open(char *pszFilename, bool keep_ext)
|
||||
int FileSize, FileOffset;
|
||||
char fullpath[MAX_PATH];
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
const int NUM_EXT = 2;
|
||||
const char *audio_ext[NUM_EXT] = { ".ogg", ".wav" };
|
||||
|
||||
m_total_uncompressed_bytes_read = 0;
|
||||
m_max_uncompressed_bytes_to_read = AS_HIGHEST_MAX;
|
||||
@@ -450,8 +448,8 @@ bool WaveFile::Open(char *pszFilename, bool keep_ext)
|
||||
|
||||
// if we are supposed to load the file as passed...
|
||||
if (keep_ext) {
|
||||
for (int i = 0; i < NUM_AUDIO_EXT; i++) {
|
||||
if ( stristr(pszFilename, audio_ext_list[i]) ) {
|
||||
for (int i = 0; i < NUM_EXT; i++) {
|
||||
if ( stristr(pszFilename, audio_ext[i]) ) {
|
||||
rc = i;
|
||||
break;
|
||||
}
|
||||
@@ -465,14 +463,14 @@ bool WaveFile::Open(char *pszFilename, bool keep_ext)
|
||||
}
|
||||
// ... otherwise we just find the best match
|
||||
else {
|
||||
rc = cf_find_file_location_ext(filename, NUM_AUDIO_EXT, audio_ext_list, CF_TYPE_ANY, sizeof(fullpath) - 1, fullpath, &FileSize, &FileOffset);
|
||||
rc = cf_find_file_location_ext(filename, NUM_EXT, audio_ext, CF_TYPE_ANY, sizeof(fullpath) - 1, fullpath, &FileSize, &FileOffset);
|
||||
}
|
||||
|
||||
if (rc < 0) {
|
||||
goto OPEN_ERROR;
|
||||
} else {
|
||||
// set proper filename for later use (assumes that it doesn't already have an extension)
|
||||
strcat_s( filename, audio_ext_list[rc] );
|
||||
strcat_s( filename, audio_ext[rc] );
|
||||
}
|
||||
|
||||
m_snd_info.cfp = mmioOpen( fullpath, NULL, MMIO_ALLOCBUF | MMIO_READ );
|
||||
|
||||
@@ -46,9 +46,6 @@ typedef struct {
|
||||
} STRHDL;
|
||||
#endif // NEED_STRHDL
|
||||
|
||||
extern const char *audio_ext_list[];
|
||||
extern const int NUM_AUDIO_EXT;
|
||||
|
||||
// Initializes the audio streaming library. Called
|
||||
// automatically when the sound stuff is inited.
|
||||
void audiostream_init();
|
||||
|
||||
+3
-2
@@ -18,7 +18,6 @@
|
||||
#include "sound/acm.h"
|
||||
#include "osapi/osapi.h"
|
||||
#include "sound/dscap.h"
|
||||
#include "sound/audiostr.h"
|
||||
|
||||
|
||||
typedef struct sound_buffer
|
||||
@@ -461,6 +460,8 @@ int ds_parse_sound_info(char *real_filename, sound_info *s_info)
|
||||
int rc, FileSize, FileOffset;
|
||||
char fullpath[MAX_PATH];
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
const int NUM_EXT = 2;
|
||||
const char *audio_ext[NUM_EXT] = { ".ogg", ".wav" };
|
||||
int rval = -1;
|
||||
|
||||
if ( (real_filename == NULL) || (s_info == NULL) ) {
|
||||
@@ -472,7 +473,7 @@ int ds_parse_sound_info(char *real_filename, sound_info *s_info)
|
||||
char *p = strrchr(filename, '.');
|
||||
if ( p ) *p = 0;
|
||||
|
||||
rc = cf_find_file_location_ext(filename, NUM_AUDIO_EXT, audio_ext_list, CF_TYPE_ANY, sizeof(fullpath) - 1, fullpath, &FileSize, &FileOffset);
|
||||
rc = cf_find_file_location_ext(filename, NUM_EXT, audio_ext, CF_TYPE_ANY, sizeof(fullpath) - 1, fullpath, &FileSize, &FileOffset);
|
||||
|
||||
if (rc < 0) {
|
||||
return -1;
|
||||
|
||||
+153
-188
@@ -1,188 +1,153 @@
|
||||
<GRAMMAR>
|
||||
<DEFINE>
|
||||
<ID NAME="VID_Counter" VAL="80"/>
|
||||
<ID NAME="VID_DestroyTarget" VAL="10"/>
|
||||
<ID NAME="VID_DisableTarget" VAL="11"/>
|
||||
<ID NAME="VID_DisarmTarget" VAL="12"/>
|
||||
<ID NAME="VID_DestroySubsys" VAL="13"/>
|
||||
<ID NAME="VID_ProtectTarget" VAL="14"/>
|
||||
<ID NAME="VID_IgnoreTarget" VAL="15"/>
|
||||
<ID NAME="VID_FormWing" VAL="16"/>
|
||||
<ID NAME="VID_CoverMe" VAL="17"/>
|
||||
<ID NAME="VID_EngageEnemy" VAL="18"/>
|
||||
<ID NAME="VID_Depart" VAL="19"/>
|
||||
<ID NAME="VID_Action" VAL="250"/>
|
||||
<ID NAME="VID_WingName" VAL="251"/>
|
||||
<ID NAME="VID_TopMenu" VAL="252"/>
|
||||
<ID NAME="VID_ShipName" VAL="253"/>
|
||||
<ID NAME="VID_Number" VAL="254"/>
|
||||
<ID NAME="VID_Ships" VAL="50"/>
|
||||
<ID NAME="VID_Wings" VAL="51"/>
|
||||
<ID NAME="VID_AllFighters" VAL="52"/>
|
||||
<ID NAME="VID_AllWings" VAL="53"/>
|
||||
<ID NAME="VID_Reinforcements" VAL="54"/>
|
||||
<ID NAME="VID_SupportShip" VAL="55"/>
|
||||
<ID NAME="VID_AbortSupport" VAL="56"/>
|
||||
<ID NAME="VID_Cancel" VAL="57"/>
|
||||
<ID NAME="VID_Command" VAL="58"/>
|
||||
<ID NAME="VID_More" VAL="59"/>
|
||||
<ID NAME="VID_shields" VAL="100"/>
|
||||
<ID NAME="VID_targeting" VAL="101"/>
|
||||
<ID NAME="VID_power" VAL="102"/>
|
||||
<ID NAME="VID_speed" VAL="103"/>
|
||||
<ID name="VID_other" VAL="104"/>
|
||||
</DEFINE>
|
||||
|
||||
<RULE ID="VID_WingName" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_WingName">
|
||||
<P VAL="0">Alpha</P>
|
||||
<P VAL="1">Beta</P>
|
||||
<P VAL="2">Gamma</P>
|
||||
<P VAL="3">Delta</P>
|
||||
<P VAL="4">Epsilon</P>
|
||||
<P VAL="5">Zeta</P>
|
||||
<P VAL="6">Eta</P>
|
||||
<P VAL="7">Theta</P>
|
||||
<P VAL="8">Iota</P>
|
||||
<P VAL="9">Kappa</P>
|
||||
<P VAL="10">Lambda</P>
|
||||
<P VAL="11">Mu</P>
|
||||
<P VAL="12">Nu</P>
|
||||
<P VAL="13">Xi</P>
|
||||
<P VAL="14">Omicron</P>
|
||||
<P VAL="15">Pi</P>
|
||||
<P VAL="16">Rho</P>
|
||||
<P VAL="17">Sigma</P>
|
||||
<P VAL="18">Tau</P>
|
||||
<P VAL="19">Upsilon</P>
|
||||
<P VAL="20">Phi</P>
|
||||
<P VAL="21">Chi</P>
|
||||
<P VAL="22">Psi</P>
|
||||
<P VAL="23">Omega</P>
|
||||
</L>
|
||||
<L PROPID="VID_ShipName">
|
||||
<P VAl="0">Wing</P>
|
||||
<P VAL="1">one</P>
|
||||
<P VAL="2">two</P>
|
||||
<P VAL="3">three</P>
|
||||
<P VAL="4">four</P>
|
||||
<P VAL="5">five</P>
|
||||
<P VAL="6">six</P>
|
||||
<P VAL="7">seven</P>
|
||||
<P VAL="8">eight</P>
|
||||
<P VAL="9">nine</P>
|
||||
</L>
|
||||
<O>
|
||||
<RULEREF refID="VID_Action"/>
|
||||
</O>
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_Action" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_Action">
|
||||
<P VAL="VID_DestroyTarget">Destroy my target</P>
|
||||
<P VAL="VID_DisableTarget">Disable my target</P>
|
||||
<P VAL="VID_DisarmTarget">Disarm my target</P>
|
||||
<P VAL="VID_DestroySubsys">Destroy subsystem</P>
|
||||
<P VAL="VID_ProtectTarget">Protect my target</P>
|
||||
<P VAL="VID_IgnoreTarget">Ignore my target</P>
|
||||
<P VAL="VID_FormWing">Form on my wing</P>
|
||||
<P VAL="VID_CoverMe">Cover me</P>
|
||||
<P VAL="VID_EngageEnemy">Engage Enemy</P>
|
||||
<P VAL="VID_EngageEnemy">Attack</P>
|
||||
<P VAL="VID_Depart">Depart</P>
|
||||
</L>
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_TopMenu" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_TopMenu">
|
||||
<P VAL="VID_Ships">Ships</P>
|
||||
<P VAL="VID_Wings">Wings</P>
|
||||
<P VAL="VID_AllFighters">All Fighters<O><RULEREF REFID="VID_Action"/></O></P>
|
||||
<P VAL="VID_AllWings">All Wings<O><RULEREF REFID="VID_Action"/></O></P>
|
||||
<P VAL="VID_Reinforcements">Reinforcements</P>
|
||||
<P VAL="VID_SupportShip">Support ship</P>
|
||||
<P VAL="VID_SupportShip">Rearm</P>
|
||||
<P VAL="VID_SupportShip">Repair</P>
|
||||
<P VAL="VID_AbortSupport">Abort</P>
|
||||
<P VAL="VID_Cancel">Cancel</P>
|
||||
<P VAL="VID_Command">Command</P>
|
||||
<P VAL="VID_More">More</P>
|
||||
</L>
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_shields" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_shields">
|
||||
<P VAL="0">Shields forward</P>
|
||||
<P VAL="1">Shields left</P>
|
||||
<P VAL="2">Shields right</P>
|
||||
<P VAL="3">Shields back</P>
|
||||
<P VAL="4">Shields all</P>
|
||||
</L>
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_targeting" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_targeting">
|
||||
<P VAL="0">Target next</P>
|
||||
<P VAL="1">Target previous</P>
|
||||
<P VAL="2">Target hostile</P>
|
||||
<P VAL="3">Target previous hostile</P>
|
||||
<P VAL="4">Auto target</P>
|
||||
<P VAL="5">Target Friendly</P>
|
||||
<P VAL="6">Target previous friendly</P>
|
||||
<P VAL="7">Target sight</P>
|
||||
<P VAL="8">Targets attacker</P>
|
||||
<P VAL="9">Target sender</P>
|
||||
<P VAL="10">Stop targeting</P>
|
||||
<P VAL="11">Target sight subsystem</P>
|
||||
<P VAL="12">Target next subsystem</P>
|
||||
<P VAL="13">Target previous subsystem</P>
|
||||
<P VAL="14">Stop targeting subsystems</P>
|
||||
<P val="50">Target closest attacker</P>
|
||||
<P VAL="88">Target next escort</P>
|
||||
<P VAL="89">Target closest repair ship</P>
|
||||
<P VAL="90">Target next uninspected</P>
|
||||
<P VAL="91">Target previous uninspected</P>
|
||||
<P VAL="92">Target newest</P>
|
||||
<P VAL="93">Target next turret</P>
|
||||
<P VAL="94">Target previous turrent</P>
|
||||
<P VAL="95">Target next bomb</P>
|
||||
<P VAL="96">Target previous bomb</P>
|
||||
</L>
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_speed" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_speed">
|
||||
<P VAL="15">Match speed</P>
|
||||
<P VAL="16">Auto match</P>
|
||||
</L>
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_other" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_other">
|
||||
<P VAL="19">Next primary</P>
|
||||
<P VAL="20">Previous primary</P>
|
||||
<P VAL="21">cycle secondary</P>
|
||||
<P VAL="22">secondary rate</P>
|
||||
<P VAL="63">Radar Range</P>
|
||||
<P VAL="117">Glide toggle</P>
|
||||
</L>
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_power" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_power">
|
||||
<P VAL="69">Increase weapon</P>
|
||||
<P VAL="70">Decrease weapon</P>
|
||||
<P VAL="71">Increase shield</P>
|
||||
<P VAL="72">Decrease shield</P>
|
||||
<P VAL="73">Increase engine</P>
|
||||
<P VAL="74">Decrease engine</P>
|
||||
<P VAL="75">Power balance</P>
|
||||
<P VAL="201">Max weapons</P>
|
||||
<P VAL="202">Min weapons</P>
|
||||
<P VAL="203">Max shields</P>
|
||||
<P VAL="204">Min shields</P>
|
||||
<P VAL="205">Max engines</P>
|
||||
<P VAL="206">Min engines</P>
|
||||
</L>
|
||||
</RULE>
|
||||
</GRAMMAR>
|
||||
<GRAMMAR LANGID="409">
|
||||
<DEFINE>
|
||||
<ID NAME="VID_Counter" VAL="80"/>
|
||||
|
||||
<ID NAME="VID_DestoryTarget" VAL="10"/>
|
||||
<ID NAME="VID_DisableTarget" VAL="11"/>
|
||||
<ID NAME="VID_DisarmTarget" VAL="12"/>
|
||||
|
||||
<ID NAME="VID_DestroySubsys" VAL="13"/>
|
||||
|
||||
<ID NAME="VID_ProtectTarget" VAL="14"/>
|
||||
<ID NAME="VID_IgnoreTarget" VAL="15"/>
|
||||
<ID NAME="VID_FormWing" VAL="16"/>
|
||||
<ID NAME="VID_CoverMe" VAL="17"/>
|
||||
<ID NAME="VID_EngageEnemy" VAL="18"/>
|
||||
<ID NAME="VID_Depart" VAL="19"/>
|
||||
|
||||
<ID NAME="VID_Action" VAL="250"/>
|
||||
|
||||
<ID NAME="VID_WingName" VAL="251"/>
|
||||
<ID NAME="VID_TopMenu" VAL="252"/>
|
||||
<ID NAME="VID_ShipName" VAL="253"/>
|
||||
<ID NAME="VID_Number" VAL="254"/>
|
||||
|
||||
<ID NAME="VID_Ships" VAL="50"/>
|
||||
<ID NAME="VID_Wings" VAL="51"/>
|
||||
<ID NAME="VID_AllFighters" VAL="52"/>
|
||||
<ID NAME="VID_AllWings" VAL="53"/>
|
||||
|
||||
<ID NAME="VID_Reinforcements" VAL="54"/>
|
||||
|
||||
<ID NAME="VID_SupportShip" VAL="55"/>
|
||||
<ID NAME="VID_AbortSupport" VAL="56"/>
|
||||
|
||||
<ID NAME="VID_Cancel" VAL="57"/>
|
||||
<ID NAME="VID_Command" VAL="58"/>
|
||||
<ID NAME="VID_More" VAL="59"/>
|
||||
|
||||
|
||||
</DEFINE>
|
||||
|
||||
|
||||
<RULE ID="VID_WingName" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_WingName">
|
||||
<P VAL="0">Alpha</P>
|
||||
<P VAL="1">Beta</P>
|
||||
<P VAL="2">Gamma</P>
|
||||
<P VAL="3">Delta</P>
|
||||
<P VAL="4">Epsilon</P>
|
||||
<P VAL="5">Zeta</P>
|
||||
<P VAL="6">Eta</P>
|
||||
<P VAL="7">Theta</P>
|
||||
<P VAL="8">Iota</P>
|
||||
<P VAL="9">Kappa</P>
|
||||
<P VAL="10">Lambda</P>
|
||||
<P VAL="11">Mu</P>
|
||||
<P VAL="12">Nu</P>
|
||||
<P VAL="13">Xi</P>
|
||||
<P VAL="14">Omicron</P>
|
||||
<P VAL="15">Pi</P>
|
||||
<P VAL="16">Rho</P>
|
||||
<P VAL="17">Sigma</P>
|
||||
<P VAL="18">Tau</P>
|
||||
<P VAL="19">Upsilon</P>
|
||||
<P VAL="20">Phi</P>
|
||||
<P VAL="21">Chi</P>
|
||||
<P VAL="22">Psi</P>
|
||||
<P VAL="23">Omega</P>
|
||||
</L>
|
||||
<O>wing</O>
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_ShipName" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_ShipName">
|
||||
<P VAL="0">Alpha</P>
|
||||
<P VAL="1">Beta</P>
|
||||
<P VAL="2">Gamma</P>
|
||||
<P VAL="3">Delta</P>
|
||||
<P VAL="4">Epsilon</P>
|
||||
<P VAL="5">Zeta</P>
|
||||
<P VAL="6">Eta</P>
|
||||
<P VAL="7">Theta</P>
|
||||
<P VAL="8">Iota</P>
|
||||
<P VAL="9">Kappa</P>
|
||||
<P VAL="10">Lambda</P>
|
||||
<P VAL="11">Mu</P>
|
||||
<P VAL="12">Nu</P>
|
||||
<P VAL="13">Xi</P>
|
||||
<P VAL="14">Omicron</P>
|
||||
<P VAL="15">Pi</P>
|
||||
<P VAL="16">Rho</P>
|
||||
<P VAL="17">Sigma</P>
|
||||
<P VAL="18">Tau</P>
|
||||
<P VAL="19">Upsilon</P>
|
||||
<P VAL="20">Phi</P>
|
||||
<P VAL="21">Chi</P>
|
||||
<P VAL="22">Psi</P>
|
||||
<P VAL="23">Omega</P>
|
||||
</L>
|
||||
<L PROPID="VID_Number">
|
||||
<P VAL = "1">one</P>
|
||||
<P VAL = "2">two</P>
|
||||
<P VAL = "3">three</P>
|
||||
<P VAL = "4">four</P>
|
||||
<P VAL = "5">five</P>
|
||||
<P VAL = "6">six</P>
|
||||
<P VAL = "7">seven</P>
|
||||
<P VAL = "8">eight</P>
|
||||
<P VAL = "9">nine</P>
|
||||
</L>
|
||||
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_TopMenu" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_TopMenu">
|
||||
<P VAL="VID_Ships" >Ships</P>
|
||||
<P VAL="VID_Wings" >Wings</P>
|
||||
<P VAL="VID_AllFighters">All Fighters</P>
|
||||
<P VAL="VID_AllWings" >All Wings</P>
|
||||
|
||||
<P VAL="VID_Reinforcements">Reinforcements</P>
|
||||
|
||||
<P VAL="VID_SupportShip">Support ship</P>
|
||||
<P VAL="VID_SupportShip">Rearm</P>
|
||||
<P VAL="VID_SupportShip">Repair</P>
|
||||
<P VAL="VID_AbortSupport">Abort</P>
|
||||
|
||||
<P VAL="VID_Cancel">Cancel</P>
|
||||
<P VAL="VID_Command">Command</P>
|
||||
<P VAL="VID_More">More</P>
|
||||
</L>
|
||||
</RULE>
|
||||
|
||||
<RULE ID="VID_Action" TOPLEVEL="ACTIVE">
|
||||
<L PROPID="VID_Action">
|
||||
|
||||
<P VAL="VID_DestoryTarget">Destroy my target</P>
|
||||
<P VAL="VID_DisableTarget">Disable my target</P>
|
||||
<P VAL="VID_DisarmTarget" >Disarm my target</P>
|
||||
|
||||
<P VAL="VID_DestroySubsys">Destroy subsystem</P>
|
||||
|
||||
<P VAL="VID_ProtectTarget">Protect my target</P>
|
||||
<P VAL="VID_IgnoreTarget" >Ignore my target</P>
|
||||
<P VAL="VID_FormWing" >Form on my wing</P>
|
||||
<P VAL="VID_CoverMe" >Cover me</P>
|
||||
<P VAL="VID_EngageEnemy" >Engage Enemy</P>
|
||||
<P VAL="VID_EngageEnemy" >Attack</P>
|
||||
<P VAL="VID_Depart" >Depart</P>
|
||||
</L>
|
||||
</RULE>
|
||||
|
||||
</GRAMMAR>
|
||||
@@ -50,12 +50,10 @@ typedef struct sound {
|
||||
|
||||
SCP_vector<sound> Sounds;
|
||||
|
||||
int Sound_enabled = FALSE; // global flag to turn sound on/off
|
||||
int Snd_sram; // mem (in bytes) used up by storing sounds in system memory
|
||||
float Default_sound_volume = 1.0f; // range is 0 -> 1, used for non-music sound fx
|
||||
float Default_voice_volume = 0.7f; // range is 0 -> 1, used for all voice playback
|
||||
float Master_sound_volume = Default_sound_volume;
|
||||
float Master_voice_volume = Default_voice_volume;
|
||||
int Sound_enabled = FALSE; // global flag to turn sound on/off
|
||||
int Snd_sram; // mem (in bytes) used up by storing sounds in system memory
|
||||
float Master_sound_volume = 1.0f; // range is 0 -> 1, used for non-music sound fx
|
||||
float Master_voice_volume = 0.7f; // range is 0 -> 1, used for all voice playback
|
||||
|
||||
unsigned int SND_ENV_DEFAULT = 0;
|
||||
|
||||
@@ -287,6 +285,8 @@ int snd_load( game_snd *gs, int allow_hardware_load )
|
||||
int rc, FileSize, FileOffset;
|
||||
char fullpath[MAX_PATH];
|
||||
char filename[MAX_FILENAME_LEN];
|
||||
const int NUM_EXT = 2;
|
||||
const char *audio_ext[NUM_EXT] = { ".ogg", ".wav" };
|
||||
size_t n;
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ int snd_load( game_snd *gs, int allow_hardware_load )
|
||||
char *p = strrchr(filename, '.');
|
||||
if ( p ) *p = 0;
|
||||
|
||||
rc = cf_find_file_location_ext(filename, NUM_AUDIO_EXT, audio_ext_list, CF_TYPE_ANY, sizeof(fullpath) - 1, fullpath, &FileSize, &FileOffset);
|
||||
rc = cf_find_file_location_ext(filename, NUM_EXT, audio_ext, CF_TYPE_ANY, sizeof(fullpath) - 1, fullpath, &FileSize, &FileOffset);
|
||||
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
@@ -340,7 +340,7 @@ int snd_load( game_snd *gs, int allow_hardware_load )
|
||||
CFILE *fp = cfopen_special(fullpath, "rb", FileSize, FileOffset);
|
||||
|
||||
// ok, we got it, so set the proper filename for logging purposes
|
||||
strcat_s(filename, audio_ext_list[rc]);
|
||||
strcat_s(filename, audio_ext[rc]);
|
||||
|
||||
nprintf(("Sound", "SOUND => Loading '%s'\n", filename));
|
||||
|
||||
|
||||
@@ -62,8 +62,6 @@ typedef struct sound_env
|
||||
} sound_env;
|
||||
|
||||
extern int Sound_enabled;
|
||||
extern float Default_sound_volume; // 0 -> 1.0
|
||||
extern float Default_voice_volume; // 0 -> 1.0
|
||||
extern float Master_sound_volume; // 0 -> 1.0
|
||||
extern float Master_voice_volume; // 0 -> 1.0
|
||||
extern int Snd_sram; // System memory consumed by sound data
|
||||
|
||||
+112
-225
@@ -32,7 +32,6 @@
|
||||
#include "io/keycontrol.h"
|
||||
#include "playerman/player.h"
|
||||
#include "ship/ship.h"
|
||||
#include "cfile/cfile.h"
|
||||
|
||||
CComPtr<ISpRecoGrammar> p_grammarObject; // Pointer to our grammar object
|
||||
CComPtr<ISpRecoContext> p_recogContext; // Pointer to our recognition context
|
||||
@@ -40,86 +39,16 @@ CComPtr<ISpRecognizer> p_recogEngine; // Pointer to our recognition engine i
|
||||
|
||||
const bool DEBUG_ON = false;
|
||||
|
||||
extern int button_function(int n);
|
||||
extern void hud_squadmsg_msg_all_fighters();
|
||||
extern void hud_squadmsg_shortcut( int command );
|
||||
|
||||
//extern void hud_squadmsg_ship_command();
|
||||
extern int Msg_instance;;
|
||||
extern int Msg_shortcut_command;
|
||||
extern int Squad_msg_mode;
|
||||
|
||||
void doVid_Action(int action)
|
||||
{
|
||||
// If menu is up
|
||||
if(Player->flags & PLAYER_FLAGS_MSG_MODE)
|
||||
{
|
||||
switch(action)
|
||||
{
|
||||
case VID_DestroyTarget: Msg_shortcut_command = ATTACK_TARGET_ITEM; break;
|
||||
case VID_DisableTarget: Msg_shortcut_command = DISABLE_TARGET_ITEM; break;
|
||||
case VID_DisarmTarget: Msg_shortcut_command = DISARM_TARGET_ITEM; break;
|
||||
case VID_DestroySubsys: Msg_shortcut_command = DISABLE_SUBSYSTEM_ITEM; break;
|
||||
case VID_ProtectTarget: Msg_shortcut_command = PROTECT_TARGET_ITEM; break;
|
||||
case VID_IgnoreTarget: Msg_shortcut_command = IGNORE_TARGET_ITEM; break;
|
||||
case VID_FormWing: Msg_shortcut_command = FORMATION_ITEM; break;
|
||||
case VID_CoverMe: Msg_shortcut_command = COVER_ME_ITEM; break;
|
||||
case VID_EngageEnemy: Msg_shortcut_command = ENGAGE_ENEMY_ITEM; break;
|
||||
case VID_Depart: Msg_shortcut_command = DEPART_ITEM; break;
|
||||
default: Msg_shortcut_command = -1; break;
|
||||
|
||||
}
|
||||
|
||||
if(Msg_instance == MESSAGE_ALL_FIGHTERS || Squad_msg_mode == SM_MODE_ALL_FIGHTERS )
|
||||
{
|
||||
// nprintf(("warning", "VOICER hud_squadmsg_send_to_all_fighters\n"));
|
||||
hud_squadmsg_send_to_all_fighters(Msg_shortcut_command);
|
||||
}
|
||||
else if(Squad_msg_mode == SM_MODE_SHIP_COMMAND)
|
||||
{
|
||||
// nprintf(("warning", "VOICER msg ship %d\n", Msg_instance));
|
||||
hud_squadmsg_send_ship_command( Msg_instance, Msg_shortcut_command, 1 );
|
||||
}
|
||||
else if(Squad_msg_mode == SM_MODE_WING_COMMAND)
|
||||
{
|
||||
// nprintf(("warning", "VOICER msg wing %d\n", Msg_instance));
|
||||
hud_squadmsg_send_wing_command( Msg_instance, Msg_shortcut_command, 1 );
|
||||
}
|
||||
else if(Squad_msg_mode == SM_MODE_REINFORCEMENTS )
|
||||
{
|
||||
}
|
||||
|
||||
hud_squadmsg_toggle();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(action)
|
||||
{
|
||||
case VID_DestroyTarget: button_function(ATTACK_MESSAGE); break;
|
||||
case VID_DisableTarget: button_function(DISABLE_MESSAGE); break;
|
||||
case VID_DisarmTarget: button_function(DISARM_MESSAGE); break;
|
||||
case VID_DestroySubsys: button_function(ATTACK_SUBSYSTEM_MESSAGE); break;
|
||||
case VID_ProtectTarget: button_function(PROTECT_MESSAGE); break;
|
||||
case VID_IgnoreTarget: button_function(IGNORE_MESSAGE); break;
|
||||
case VID_FormWing: button_function(FORM_MESSAGE); break;
|
||||
case VID_CoverMe: button_function(COVER_MESSAGE); break;
|
||||
case VID_EngageEnemy: button_function(ENGAGE_MESSAGE); break;
|
||||
case VID_Depart: button_function(WARP_MESSAGE); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool VOICEREC_init(HWND hWnd, int event_id, int grammar_id, int command_resource)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
CComPtr<ISpAudio> cpAudio;
|
||||
|
||||
while (true)
|
||||
while ( 1 )
|
||||
{
|
||||
// create a recognition engine
|
||||
hr = p_recogEngine.CoCreateInstance(CLSID_SpSharedRecognizer);
|
||||
if (FAILED(hr))
|
||||
if ( FAILED( hr ) )
|
||||
{
|
||||
MessageBox(hWnd,"Failed to create a recognition engine\n","Error",MB_OK);
|
||||
printf("Failed to create a recognition engine\n");
|
||||
@@ -128,7 +57,7 @@ bool VOICEREC_init(HWND hWnd, int event_id, int grammar_id, int command_resource
|
||||
|
||||
// create the command recognition context
|
||||
hr = p_recogEngine->CreateRecoContext( &p_recogContext );
|
||||
if (FAILED(hr))
|
||||
if ( FAILED( hr ) )
|
||||
{
|
||||
MessageBox(hWnd,"Failed to create the command recognition context\n","Error",MB_OK);
|
||||
printf("Failed to create the command recognition context\n");
|
||||
@@ -138,7 +67,7 @@ bool VOICEREC_init(HWND hWnd, int event_id, int grammar_id, int command_resource
|
||||
// Let SR know that window we want it to send event information to, and using
|
||||
// what message
|
||||
hr = p_recogContext->SetNotifyWindowMessage( hWnd, event_id, 0, 0 );
|
||||
if (FAILED(hr))
|
||||
if ( FAILED( hr ) )
|
||||
{
|
||||
MessageBox(hWnd,"Failed to SetNotifyWindowMessage\n","Error",MB_OK);
|
||||
break;
|
||||
@@ -147,38 +76,33 @@ bool VOICEREC_init(HWND hWnd, int event_id, int grammar_id, int command_resource
|
||||
// Tell SR what types of events interest us. Here we only care about command
|
||||
// recognition.
|
||||
hr = p_recogContext->SetInterest( SPFEI(SPEI_RECOGNITION), SPFEI(SPEI_RECOGNITION) );
|
||||
if (FAILED(hr))
|
||||
if ( FAILED( hr ) )
|
||||
{
|
||||
MessageBox(hWnd,"Failed to set events\n","Error",MB_OK);
|
||||
break;
|
||||
}
|
||||
|
||||
// Create a grammar
|
||||
// Load our grammar, which is the compiled form of simple.xml bound into this executable as a
|
||||
// user defined ("SRGRAMMAR") resource type.
|
||||
hr = p_recogContext->CreateGrammar(grammar_id, &p_grammarObject);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
MessageBox(hWnd,"Failed to create grammar\n","Error",MB_OK);
|
||||
MessageBox(hWnd,"Failed to load grammar\n","Error",MB_OK);
|
||||
break;
|
||||
}
|
||||
|
||||
// Load our grammar from data\phrases.xml, or if that doesn't exist, from the compiled in
|
||||
// user defined ("SRGRAMMAR") resource type.
|
||||
hr = p_grammarObject->LoadCmdFromFile(L"data\\phrases.xml", SPLO_STATIC);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
hr = p_grammarObject->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(command_resource),
|
||||
hr = p_grammarObject->LoadCmdFromResource(NULL, MAKEINTRESOURCEW(command_resource),
|
||||
L"SRGRAMMAR", MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
|
||||
SPLO_DYNAMIC);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
MessageBox(hWnd,"Failed to load resource\n","Error",MB_OK);
|
||||
break;
|
||||
}
|
||||
if ( FAILED( hr ) )
|
||||
{
|
||||
MessageBox(hWnd,"Failed to load resource\n","Error",MB_OK);
|
||||
break;
|
||||
}
|
||||
|
||||
// Set rules to active, we are now listening for commands
|
||||
hr = p_grammarObject->SetRuleState(NULL, NULL, SPRS_ACTIVE );
|
||||
if (FAILED(hr))
|
||||
if ( FAILED( hr ) )
|
||||
{
|
||||
MessageBox(hWnd,"Failed to set listening for commands\n","Error",MB_OK);
|
||||
break;
|
||||
@@ -188,7 +112,7 @@ bool VOICEREC_init(HWND hWnd, int event_id, int grammar_id, int command_resource
|
||||
}
|
||||
|
||||
// if we failed and have a partially setup SAPI, close it all down
|
||||
if (FAILED(hr))
|
||||
if ( FAILED( hr ) )
|
||||
{
|
||||
VOICEREC_deinit();
|
||||
}
|
||||
@@ -271,6 +195,14 @@ char *wing_names[] =
|
||||
* Called to Execute commands that have been identified by the speech engine.
|
||||
*
|
||||
******************************************************************************/
|
||||
extern int button_function(int n);
|
||||
extern void hud_squadmsg_msg_all_fighters();
|
||||
extern void hud_squadmsg_shortcut( int command );
|
||||
|
||||
//extern void hud_squadmsg_ship_command();
|
||||
extern int Msg_instance;;
|
||||
extern int Msg_shortcut_command;
|
||||
extern int Squad_msg_mode;
|
||||
|
||||
char VOICEREC_lastCommand[30];
|
||||
|
||||
@@ -282,103 +214,116 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
|
||||
// the grammar. Switch on it to figure out which command was recognized.
|
||||
if (SUCCEEDED(pPhrase->GetPhrase(&pElements)))
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if(DEBUG_ON)
|
||||
{
|
||||
WCHAR *pwszText;
|
||||
char szText[255];
|
||||
int i;
|
||||
|
||||
pPhrase->GetText(SP_GETWHOLEPHRASE, SP_GETWHOLEPHRASE, TRUE, &pwszText, NULL);
|
||||
|
||||
memset(szText, 0, 255);
|
||||
for (i=0;i<254;i++)
|
||||
{
|
||||
if (*(pwszText + i) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
szText[i] = (char)(*(pwszText + i));
|
||||
szText[i+1] = 0;
|
||||
}
|
||||
|
||||
mprintf(( "recognized speech : %s \n", szText ));
|
||||
mprintf(( "speech Rule.ulId : %d \n", pElements->Rule.ulId ));
|
||||
//MessageBoxW(NULL,pwszText,NULL,MB_OK);
|
||||
MessageBoxW(NULL,pwszText,NULL,MB_OK);
|
||||
}
|
||||
#endif
|
||||
int part1, part2, part3;
|
||||
part1 = part2 = part3 = -1;
|
||||
|
||||
switch ( pElements->Rule.ulId )
|
||||
{
|
||||
case VID_ShipName:
|
||||
{
|
||||
int wingType = pElements->pProperties->vValue.ulVal;
|
||||
int shipNum = pElements->pProperties->pNextSibling->vValue.ulVal;
|
||||
|
||||
char shipName[NAME_LENGTH];
|
||||
wing_bash_ship_name(shipName, wing_names[wingType], shipNum);
|
||||
|
||||
Msg_instance = ship_name_lookup(shipName);
|
||||
|
||||
// Can't issue commands to yourself or to nobody
|
||||
if(Msg_instance < 0 || Msg_instance == Player_obj->instance)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(!(Player->flags & PLAYER_FLAGS_MSG_MODE))
|
||||
{
|
||||
hud_squadmsg_toggle();
|
||||
}
|
||||
|
||||
hud_squadmsg_do_mode(SM_MODE_SHIP_COMMAND);
|
||||
break;
|
||||
}
|
||||
case VID_WingName:
|
||||
{
|
||||
int wingType = pElements->pProperties->vValue.ulVal;
|
||||
|
||||
part1 = pElements->pProperties->vValue.ulVal;
|
||||
if (pElements->pProperties->pNextSibling)
|
||||
{
|
||||
part2 = pElements->pProperties->pNextSibling->vValue.ulVal;
|
||||
if (pElements->pProperties->pNextSibling->pNextSibling)
|
||||
{
|
||||
part3 = pElements->pProperties->pNextSibling->pNextSibling->vValue.ulVal;
|
||||
}
|
||||
}
|
||||
if (part2 == -1)
|
||||
break; // no ship number or wing
|
||||
|
||||
if (part2 == 0)
|
||||
{
|
||||
Msg_instance = wing_lookup(wing_names[part1]);
|
||||
if (Msg_instance < 0)
|
||||
break;
|
||||
|
||||
if(!(Player->flags & PLAYER_FLAGS_MSG_MODE))
|
||||
{
|
||||
hud_squadmsg_toggle();
|
||||
}
|
||||
|
||||
hud_squadmsg_do_mode(SM_MODE_WING_COMMAND);
|
||||
}
|
||||
else
|
||||
{
|
||||
char shipName[NAME_LENGTH];
|
||||
wing_bash_ship_name(shipName, wing_names[part1], part2);
|
||||
|
||||
Msg_instance = ship_name_lookup(shipName);
|
||||
|
||||
// Can't issue commands to yourself or to nobody
|
||||
if (Msg_instance < 0 || Msg_instance == Player_obj->instance)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if(!(Player->flags & PLAYER_FLAGS_MSG_MODE))
|
||||
{
|
||||
hud_squadmsg_toggle();
|
||||
}
|
||||
|
||||
hud_squadmsg_do_mode(SM_MODE_SHIP_COMMAND);
|
||||
|
||||
}
|
||||
|
||||
if (part3 == -1)
|
||||
Msg_instance = wing_lookup(wing_names[wingType]);
|
||||
if (Msg_instance < 0)
|
||||
break;
|
||||
|
||||
if(!(Player->flags & PLAYER_FLAGS_MSG_MODE))
|
||||
{
|
||||
hud_squadmsg_toggle();
|
||||
}
|
||||
|
||||
hud_squadmsg_do_mode(SM_MODE_WING_COMMAND);
|
||||
break;
|
||||
}
|
||||
|
||||
case VID_Action:
|
||||
{
|
||||
int action;
|
||||
if (part3 == -1)
|
||||
int action = pElements->pProperties->vValue.ulVal;
|
||||
|
||||
// If menu is up
|
||||
if(Player->flags & PLAYER_FLAGS_MSG_MODE)
|
||||
{
|
||||
action = pElements->pProperties->vValue.ulVal;
|
||||
switch(action)
|
||||
{
|
||||
case VID_DestoryTarget: Msg_shortcut_command = ATTACK_TARGET_ITEM; break;
|
||||
case VID_DisableTarget: Msg_shortcut_command = DISABLE_TARGET_ITEM; break;
|
||||
case VID_DisarmTarget: Msg_shortcut_command = DISARM_TARGET_ITEM; break;
|
||||
case VID_DestroySubsys: Msg_shortcut_command = DISABLE_SUBSYSTEM_ITEM; break;
|
||||
case VID_ProtectTarget: Msg_shortcut_command = PROTECT_TARGET_ITEM; break;
|
||||
case VID_IgnoreTarget: Msg_shortcut_command = IGNORE_TARGET_ITEM; break;
|
||||
case VID_FormWing: Msg_shortcut_command = FORMATION_ITEM; break;
|
||||
case VID_CoverMe: Msg_shortcut_command = COVER_ME_ITEM; break;
|
||||
case VID_EngageEnemy: Msg_shortcut_command = ENGAGE_ENEMY_ITEM; break;
|
||||
case VID_Depart: Msg_shortcut_command = DEPART_ITEM; break;
|
||||
default: Msg_shortcut_command = -1; break;
|
||||
|
||||
}
|
||||
|
||||
if(Msg_instance == MESSAGE_ALL_FIGHTERS || Squad_msg_mode == SM_MODE_ALL_FIGHTERS )
|
||||
{
|
||||
// nprintf(("warning", "VOICER hud_squadmsg_send_to_all_fighters\n"));
|
||||
hud_squadmsg_send_to_all_fighters(Msg_shortcut_command);
|
||||
}
|
||||
else if(Squad_msg_mode == SM_MODE_SHIP_COMMAND)
|
||||
{
|
||||
// nprintf(("warning", "VOICER msg ship %d\n", Msg_instance));
|
||||
hud_squadmsg_send_ship_command( Msg_instance, Msg_shortcut_command, 1 );
|
||||
}
|
||||
else if(Squad_msg_mode == SM_MODE_WING_COMMAND)
|
||||
{
|
||||
// nprintf(("warning", "VOICER msg wing %d\n", Msg_instance));
|
||||
hud_squadmsg_send_wing_command( Msg_instance, Msg_shortcut_command, 1 );
|
||||
}
|
||||
else if(Squad_msg_mode == SM_MODE_REINFORCEMENTS )
|
||||
{
|
||||
}
|
||||
|
||||
hud_squadmsg_toggle();
|
||||
}
|
||||
else
|
||||
{
|
||||
action = part3;
|
||||
switch(action)
|
||||
{
|
||||
case VID_DestoryTarget: button_function(ATTACK_MESSAGE); break;
|
||||
case VID_DisableTarget: button_function(DISABLE_MESSAGE); break;
|
||||
case VID_DisarmTarget: button_function(DISARM_MESSAGE); break;
|
||||
case VID_DestroySubsys: button_function(ATTACK_SUBSYSTEM_MESSAGE); break;
|
||||
case VID_ProtectTarget: button_function(PROTECT_MESSAGE); break;
|
||||
case VID_IgnoreTarget: button_function(IGNORE_MESSAGE); break;
|
||||
case VID_FormWing: button_function(FORM_MESSAGE); break;
|
||||
case VID_CoverMe: button_function(COVER_MESSAGE); break;
|
||||
case VID_EngageEnemy: button_function(ENGAGE_MESSAGE); break;
|
||||
case VID_Depart: button_function(WARP_MESSAGE); break;
|
||||
}
|
||||
}
|
||||
|
||||
doVid_Action(action);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -414,9 +359,6 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
|
||||
// Msg_instance = MESSAGE_ALL_FIGHTERS;
|
||||
// Squad_msg_mode == SM_MODE_ALL_FIGHTERS
|
||||
hud_squadmsg_msg_all_fighters();
|
||||
if (pElements->pProperties->pNextSibling) {
|
||||
doVid_Action(pElements->pProperties->pNextSibling->vValue.ulVal);
|
||||
}
|
||||
|
||||
// if(Msg_shortcut_command == -1)
|
||||
// {
|
||||
@@ -442,62 +384,8 @@ void VOICEREC_execute_command(ISpPhrase *pPhrase, HWND hWnd)
|
||||
|
||||
break;
|
||||
}
|
||||
case VID_shields:
|
||||
{
|
||||
int action = pElements->pProperties->vValue.ulVal;
|
||||
mprintf(("Shield Transfer %d \n", action));
|
||||
|
||||
switch(action)
|
||||
{
|
||||
case 0: button_function( SHIELD_XFER_TOP ); break;
|
||||
case 1: button_function( SHIELD_XFER_LEFT ); break;
|
||||
case 2: button_function( SHIELD_XFER_RIGHT ); break;
|
||||
case 3: button_function( SHIELD_XFER_BOTTOM ); break;
|
||||
case 4: button_function( SHIELD_EQUALIZE ); break;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case VID_speed:
|
||||
case VID_targeting:
|
||||
case VID_other:
|
||||
{
|
||||
int action = pElements->pProperties->vValue.ulVal;
|
||||
mprintf(("Targeting/speed %d \n", action));
|
||||
|
||||
if (action > -1)
|
||||
{
|
||||
button_function( action );
|
||||
}
|
||||
break;
|
||||
/*
|
||||
switch(action)
|
||||
{
|
||||
case 0: button_function( TARGET_NEXT ); break;
|
||||
cas
|
||||
}
|
||||
break;
|
||||
*/
|
||||
}
|
||||
case VID_power:
|
||||
{
|
||||
int action = pElements->pProperties->vValue.ulVal;
|
||||
|
||||
if (action >= INCREASE_WEAPON && action <= ETS_EQUALIZE)
|
||||
{
|
||||
button_function( action );
|
||||
}
|
||||
else
|
||||
// this is for the max engines etc.
|
||||
{
|
||||
for (int i=1; i<7; i++)
|
||||
{
|
||||
button_function( action - 132 );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -516,6 +404,5 @@ hud_squadmsg_do_mode( SM_MODE_SHIP_COMMAND );
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // VOICER
|
||||
#endif // _WIN32
|
||||
+1
-1
@@ -59,7 +59,7 @@ extern void parse_medal_tbl();
|
||||
#define MM_POPUP 1 // called from within some other tight loop (don't use gameseq_ functions)
|
||||
|
||||
// main medals screen
|
||||
void medal_main_init(player *pl, int mode = MM_NORMAL);
|
||||
void medal_main_init(player *pl,int mode = MM_NORMAL);
|
||||
|
||||
// return 0 if the screen should close (used for MM_POPUP mode)
|
||||
int medal_main_do();
|
||||
|
||||
@@ -141,7 +141,6 @@ extern int Num_weapon_subtypes;
|
||||
#define WF_DESTROYED_BY_WEAPON (1<<6) // destroyed by damage from other weapon
|
||||
#define WF_SPAWNED (1<<7) //Spawned from a spawning type weapon
|
||||
#define WF_HOMING_UPDATE_NEEDED (1<<8) // this is a newly spawned homing weapon which needs to update client machines
|
||||
#define WF_NO_HOMING (1<<9) // this weapon should ignore any homing behavior it'd usually have
|
||||
|
||||
// flags for setting burst fire
|
||||
#define WBF_FAST_FIRING (1<<0) // burst is to use only the firewait to determine firing delays
|
||||
@@ -417,7 +416,6 @@ typedef struct weapon_info {
|
||||
|
||||
int impact_weapon_expl_index; // Index into Weapon_expl_info of which ANI should play when this thing impacts something
|
||||
float impact_explosion_radius; // How big the explosion should be
|
||||
float shield_impact_explosion_radius; // How big the shield hit explosion should be
|
||||
|
||||
int dinky_impact_weapon_expl_index;
|
||||
float dinky_impact_explosion_radius;
|
||||
@@ -672,6 +670,4 @@ void weapon_pause_sounds();
|
||||
// Unpauses all running weapon sounds
|
||||
void weapon_unpause_sounds();
|
||||
|
||||
void shield_impact_explosion(vec3d *hitpos, object *objp, float radius, int idx);
|
||||
|
||||
#endif
|
||||
+5
-45
@@ -938,8 +938,6 @@ void init_weapon_entry(int weap_info_index)
|
||||
wip->impact_explosion_radius = 1.0f;
|
||||
wip->impact_weapon_expl_index = -1;
|
||||
|
||||
wip->shield_impact_explosion_radius = 1.0f;
|
||||
|
||||
wip->dinky_impact_explosion_radius = 1.0f;
|
||||
wip->dinky_impact_weapon_expl_index = -1;
|
||||
|
||||
@@ -1065,7 +1063,6 @@ void init_weapon_entry(int weap_info_index)
|
||||
|
||||
wip->burst_delay = 1.0f; // 1 second, just incase its not defined
|
||||
wip->burst_shots = 0;
|
||||
|
||||
wip->burst_flags = 0;
|
||||
|
||||
generic_anim_init( &wip->thruster_flame );
|
||||
@@ -1308,22 +1305,10 @@ int parse_weapon(int subtype, bool replace)
|
||||
|
||||
if(optional_string("@Laser Color:"))
|
||||
{
|
||||
// This might be confusing at first glance. If we're a modular table (!first_time),
|
||||
// AND we're providing a new color for the laser (being in this block at all),
|
||||
// AND the RGB values for laser_color_1 and laser_color_2 match...
|
||||
// THEN we conclude that laser_color_2 wasn't explicitly defined before, and the modder would probably prefer
|
||||
// it if the laser didn't suddenly start changing colors from the new to the old over its lifespan. -MageKing17
|
||||
bool reset = (!first_time && (
|
||||
(wip->laser_color_1.red == wip->laser_color_2.red) &&
|
||||
(wip->laser_color_1.green == wip->laser_color_2.green) &&
|
||||
(wip->laser_color_1.blue == wip->laser_color_2.blue)));
|
||||
stuff_ubyte(&r);
|
||||
stuff_ubyte(&g);
|
||||
stuff_ubyte(&b);
|
||||
gr_init_color( &wip->laser_color_1, r, g, b );
|
||||
if (reset) {
|
||||
gr_init_color( &wip->laser_color_2, wip->laser_color_1.red, wip->laser_color_1.green, wip->laser_color_1.blue );
|
||||
}
|
||||
}
|
||||
|
||||
// optional string for cycling laser colors
|
||||
@@ -1332,7 +1317,7 @@ int parse_weapon(int subtype, bool replace)
|
||||
stuff_ubyte(&g);
|
||||
stuff_ubyte(&b);
|
||||
gr_init_color( &wip->laser_color_2, r, g, b );
|
||||
} else if (first_time) {
|
||||
} else {
|
||||
gr_init_color( &wip->laser_color_2, wip->laser_color_1.red, wip->laser_color_1.green, wip->laser_color_1.blue );
|
||||
}
|
||||
|
||||
@@ -1912,12 +1897,6 @@ int parse_weapon(int subtype, bool replace)
|
||||
if ( optional_string("$Impact Explosion Radius:") )
|
||||
stuff_float(&wip->impact_explosion_radius);
|
||||
|
||||
if ( optional_string("$Shield Impact Explosion Radius:") ) {
|
||||
stuff_float(&wip->shield_impact_explosion_radius);
|
||||
} else if (first_time) {
|
||||
wip->shield_impact_explosion_radius = wip->impact_explosion_radius;
|
||||
}
|
||||
|
||||
if ( optional_string("$Dinky Impact Explosion:") ) {
|
||||
stuff_string(fname, F_NAME, NAME_LENGTH);
|
||||
|
||||
@@ -4779,7 +4758,7 @@ void weapon_process_post(object * obj, float frame_time)
|
||||
}
|
||||
|
||||
// a single player or multiplayer server function -- it affects actual weapon movement.
|
||||
if (wip->wi_flags & WIF_HOMING && !(wp->weapon_flags & WF_NO_HOMING)) {
|
||||
if (wip->wi_flags & WIF_HOMING) {
|
||||
weapon_home(obj, num, frame_time);
|
||||
|
||||
// If this is a swarm type missile,
|
||||
@@ -4951,10 +4930,6 @@ void weapon_set_tracking_info(int weapon_objnum, int parent_objnum, int target_o
|
||||
wp = &Weapons[Objects[weapon_objnum].instance];
|
||||
wip = &Weapon_info[wp->weapon_info_index];
|
||||
|
||||
if (wp->weapon_flags & WF_NO_HOMING) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent_objnum >= 0) {
|
||||
parent_objp = &Objects[parent_objnum];
|
||||
Assert(parent_objp->type == OBJ_SHIP);
|
||||
@@ -4962,16 +4937,6 @@ void weapon_set_tracking_info(int weapon_objnum, int parent_objnum, int target_o
|
||||
parent_objp = NULL;
|
||||
}
|
||||
|
||||
if (parent_objp != NULL && (Ships[parent_objp->instance].flags2 & SF2_NO_SECONDARY_LOCKON)) {
|
||||
wp->weapon_flags |= WF_NO_HOMING;
|
||||
wp->homing_object = NULL;
|
||||
wp->homing_subsys = NULL;
|
||||
wp->target_num = -1;
|
||||
wp->target_sig = -1;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( parent_objp == NULL || Ships[parent_objp->instance].ai_index >= 0 ) {
|
||||
int target_team = -1;
|
||||
if ( target_objnum >= 0 ) {
|
||||
@@ -6065,9 +6030,9 @@ void weapon_hit( object * weapon_obj, object * other_obj, vec3d * hitpos, int qu
|
||||
int weapon_type = Weapons[num].weapon_info_index;
|
||||
int expl_ani_handle;
|
||||
weapon_info *wip;
|
||||
weapon *wp;
|
||||
weapon *wp;
|
||||
bool hit_target = false;
|
||||
|
||||
|
||||
object *other_objp;
|
||||
ship_obj *so;
|
||||
ship *shipp;
|
||||
@@ -6167,7 +6132,7 @@ void weapon_hit( object * weapon_obj, object * other_obj, vec3d * hitpos, int qu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// For all objects that had this weapon as a target, wipe it out, forcing find of a new enemy
|
||||
for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) {
|
||||
other_objp = &Objects[so->objnum];
|
||||
@@ -7057,8 +7022,3 @@ void weapon_unpause_sounds()
|
||||
// Pause all beam sounds
|
||||
beam_unpause_sounds();
|
||||
}
|
||||
|
||||
void shield_impact_explosion(vec3d *hitpos, object *objp, float radius, int idx) {
|
||||
int expl_ani_handle = Weapon_explosions.GetAnim(idx, hitpos, radius);
|
||||
particle_create( hitpos, &vmd_zero_vector, 0.0f, radius, PARTICLE_BITMAP_PERSISTENT, expl_ani_handle, -1.0f, objp );
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <wx/image.h>
|
||||
#include <wx/string.h>
|
||||
//#include <wx/xrc/xmlres.h>
|
||||
#include <wx/wx.h>
|
||||
#include <wx/wx.h>
|
||||
|
||||
IMPLEMENT_APP(wxFRED2)
|
||||
|
||||
@@ -32,4 +32,4 @@ bool wxFRED2::OnInit()
|
||||
frame->Show(TRUE);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
* 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 <wx/wx.h>
|
||||
|
||||
@@ -20,4 +20,4 @@ class wxFRED2 : public wxApp
|
||||
|
||||
DECLARE_APP(wxFRED2)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
+1
-1
@@ -2,7 +2,7 @@ dnl configure.ac for fs2_open
|
||||
dnl
|
||||
dnl $Id: configure.ac,v 1.31.2.4 2007-05-28 19:36:12 taylor Exp $
|
||||
|
||||
AC_INIT(fs2_open, 3.7.3)
|
||||
AC_INIT(fs2_open, 3.7.2)
|
||||
AC_CONFIG_SRCDIR(code/freespace2/freespace.cpp)
|
||||
|
||||
dnl we need at least version 2.54 of autoconf
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009-2014 Petri Lehtinen <[email protected]>
|
||||
Copyright (c) 2009-2013 Petri Lehtinen <[email protected]>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
+13
-19
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -22,9 +22,6 @@
|
||||
#define MAX_INTEGER_STR_LENGTH 100
|
||||
#define MAX_REAL_STR_LENGTH 100
|
||||
|
||||
#define FLAGS_TO_INDENT(f) ((f) & 0x1F)
|
||||
#define FLAGS_TO_PRECISION(f) (((f) >> 11) & 0x1F)
|
||||
|
||||
struct object_key {
|
||||
size_t serial;
|
||||
const char *key;
|
||||
@@ -48,9 +45,9 @@ static const char whitespace[] = " ";
|
||||
|
||||
static int dump_indent(size_t flags, int depth, int space, json_dump_callback_t dump, void *data)
|
||||
{
|
||||
if(FLAGS_TO_INDENT(flags) > 0)
|
||||
if(JSON_INDENT(flags) > 0)
|
||||
{
|
||||
int i, ws_count = FLAGS_TO_INDENT(flags);
|
||||
int i, ws_count = JSON_INDENT(flags);
|
||||
|
||||
if(dump("\n", 1, data))
|
||||
return -1;
|
||||
@@ -68,25 +65,24 @@ static int dump_indent(size_t flags, int depth, int space, json_dump_callback_t
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dump_string(const char *str, size_t len, json_dump_callback_t dump, void *data, size_t flags)
|
||||
static int dump_string(const char *str, json_dump_callback_t dump, void *data, size_t flags)
|
||||
{
|
||||
const char *pos, *end, *lim;
|
||||
const char *pos, *end;
|
||||
int32_t codepoint;
|
||||
|
||||
if(dump("\"", 1, data))
|
||||
return -1;
|
||||
|
||||
end = pos = str;
|
||||
lim = str + len;
|
||||
while(1)
|
||||
{
|
||||
const char *text;
|
||||
char seq[13];
|
||||
int length;
|
||||
|
||||
while(end < lim)
|
||||
while(*end)
|
||||
{
|
||||
end = utf8_iterate(pos, lim - pos, &codepoint);
|
||||
end = utf8_iterate(pos, &codepoint);
|
||||
if(!end)
|
||||
return -1;
|
||||
|
||||
@@ -130,7 +126,7 @@ static int dump_string(const char *str, size_t len, json_dump_callback_t dump, v
|
||||
/* codepoint is in BMP */
|
||||
if(codepoint < 0x10000)
|
||||
{
|
||||
sprintf(seq, "\\u%04X", codepoint);
|
||||
sprintf(seq, "\\u%04x", codepoint);
|
||||
length = 6;
|
||||
}
|
||||
|
||||
@@ -143,7 +139,7 @@ static int dump_string(const char *str, size_t len, json_dump_callback_t dump, v
|
||||
first = 0xD800 | ((codepoint & 0xffc00) >> 10);
|
||||
last = 0xDC00 | (codepoint & 0x003ff);
|
||||
|
||||
sprintf(seq, "\\u%04X\\u%04X", first, last);
|
||||
sprintf(seq, "\\u%04x\\u%04x", first, last);
|
||||
length = 12;
|
||||
}
|
||||
|
||||
@@ -211,8 +207,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
|
||||
int size;
|
||||
double value = json_real_value(json);
|
||||
|
||||
size = jsonp_dtostr(buffer, MAX_REAL_STR_LENGTH, value,
|
||||
FLAGS_TO_PRECISION(flags));
|
||||
size = jsonp_dtostr(buffer, MAX_REAL_STR_LENGTH, value);
|
||||
if(size < 0)
|
||||
return -1;
|
||||
|
||||
@@ -220,7 +215,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
|
||||
}
|
||||
|
||||
case JSON_STRING:
|
||||
return dump_string(json_string_value(json), json_string_length(json), dump, data, flags);
|
||||
return dump_string(json_string_value(json), dump, data, flags);
|
||||
|
||||
case JSON_ARRAY:
|
||||
{
|
||||
@@ -341,7 +336,7 @@ static int do_dump(const json_t *json, size_t flags, int depth,
|
||||
value = json_object_get(json, key);
|
||||
assert(value);
|
||||
|
||||
dump_string(key, strlen(key), dump, data, flags);
|
||||
dump_string(key, dump, data, flags);
|
||||
if(dump(separator, separator_length, data) ||
|
||||
do_dump(value, flags, depth + 1, dump, data))
|
||||
{
|
||||
@@ -377,9 +372,8 @@ static int do_dump(const json_t *json, size_t flags, int depth,
|
||||
while(iter)
|
||||
{
|
||||
void *next = json_object_iter_next((json_t *)json, iter);
|
||||
const char *key = json_object_iter_key(iter);
|
||||
|
||||
dump_string(key, strlen(key), dump, data, flags);
|
||||
dump_string(json_object_iter_key(iter), dump, data, flags);
|
||||
if(dump(separator, separator_length, data) ||
|
||||
do_dump(json_object_iter_value(iter), flags, depth + 1,
|
||||
dump, data))
|
||||
|
||||
+44
-36
@@ -1,21 +1,12 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <jansson_private_config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <jansson_config.h> /* for JSON_INLINE */
|
||||
#include "jansson_private.h" /* for container_of() */
|
||||
#include "hashtable.h"
|
||||
@@ -24,13 +15,24 @@ typedef struct hashtable_list list_t;
|
||||
typedef struct hashtable_pair pair_t;
|
||||
typedef struct hashtable_bucket bucket_t;
|
||||
|
||||
extern volatile uint32_t hashtable_seed;
|
||||
|
||||
/* Implementation of the hash function */
|
||||
#include "lookup3.h"
|
||||
|
||||
#define list_to_pair(list_) container_of(list_, pair_t, list)
|
||||
#define hash_str(key) ((size_t)hashlittle((key), strlen(key), hashtable_seed))
|
||||
|
||||
/* From http://www.cse.yorku.ca/~oz/hash.html */
|
||||
static size_t hash_str(const void *ptr)
|
||||
{
|
||||
const char *str = (const char *)ptr;
|
||||
|
||||
size_t hash = 5381;
|
||||
size_t c;
|
||||
|
||||
while((c = (size_t)*str))
|
||||
{
|
||||
hash = ((hash << 5) + hash) + c;
|
||||
str++;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
static JSON_INLINE void list_init(list_t *list)
|
||||
{
|
||||
@@ -72,6 +74,19 @@ static void insert_to_bucket(hashtable_t *hashtable, bucket_t *bucket,
|
||||
}
|
||||
}
|
||||
|
||||
static const size_t primes[] = {
|
||||
5, 13, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593,
|
||||
49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469,
|
||||
12582917, 25165843, 50331653, 100663319, 201326611, 402653189,
|
||||
805306457, 1610612741
|
||||
};
|
||||
|
||||
static JSON_INLINE size_t num_buckets(hashtable_t *hashtable)
|
||||
{
|
||||
return primes[hashtable->num_buckets];
|
||||
}
|
||||
|
||||
|
||||
static pair_t *hashtable_find_pair(hashtable_t *hashtable, bucket_t *bucket,
|
||||
const char *key, size_t hash)
|
||||
{
|
||||
@@ -105,7 +120,7 @@ static int hashtable_do_del(hashtable_t *hashtable,
|
||||
bucket_t *bucket;
|
||||
size_t index;
|
||||
|
||||
index = hash & hashmask(hashtable->order);
|
||||
index = hash % num_buckets(hashtable);
|
||||
bucket = &hashtable->buckets[index];
|
||||
|
||||
pair = hashtable_find_pair(hashtable, bucket, key, hash);
|
||||
@@ -152,14 +167,14 @@ static int hashtable_do_rehash(hashtable_t *hashtable)
|
||||
|
||||
jsonp_free(hashtable->buckets);
|
||||
|
||||
hashtable->order++;
|
||||
new_size = hashsize(hashtable->order);
|
||||
hashtable->num_buckets++;
|
||||
new_size = num_buckets(hashtable);
|
||||
|
||||
hashtable->buckets = jsonp_malloc(new_size * sizeof(bucket_t));
|
||||
if(!hashtable->buckets)
|
||||
return -1;
|
||||
|
||||
for(i = 0; i < hashsize(hashtable->order); i++)
|
||||
for(i = 0; i < num_buckets(hashtable); i++)
|
||||
{
|
||||
hashtable->buckets[i].first = hashtable->buckets[i].last =
|
||||
&hashtable->list;
|
||||
@@ -184,14 +199,14 @@ int hashtable_init(hashtable_t *hashtable)
|
||||
size_t i;
|
||||
|
||||
hashtable->size = 0;
|
||||
hashtable->order = 3;
|
||||
hashtable->buckets = jsonp_malloc(hashsize(hashtable->order) * sizeof(bucket_t));
|
||||
hashtable->num_buckets = 0; /* index to primes[] */
|
||||
hashtable->buckets = jsonp_malloc(num_buckets(hashtable) * sizeof(bucket_t));
|
||||
if(!hashtable->buckets)
|
||||
return -1;
|
||||
|
||||
list_init(&hashtable->list);
|
||||
|
||||
for(i = 0; i < hashsize(hashtable->order); i++)
|
||||
for(i = 0; i < num_buckets(hashtable); i++)
|
||||
{
|
||||
hashtable->buckets[i].first = hashtable->buckets[i].last =
|
||||
&hashtable->list;
|
||||
@@ -215,12 +230,12 @@ int hashtable_set(hashtable_t *hashtable,
|
||||
size_t hash, index;
|
||||
|
||||
/* rehash if the load ratio exceeds 1 */
|
||||
if(hashtable->size >= hashsize(hashtable->order))
|
||||
if(hashtable->size >= num_buckets(hashtable))
|
||||
if(hashtable_do_rehash(hashtable))
|
||||
return -1;
|
||||
|
||||
hash = hash_str(key);
|
||||
index = hash & hashmask(hashtable->order);
|
||||
index = hash % num_buckets(hashtable);
|
||||
bucket = &hashtable->buckets[index];
|
||||
pair = hashtable_find_pair(hashtable, bucket, key, hash);
|
||||
|
||||
@@ -234,14 +249,7 @@ int hashtable_set(hashtable_t *hashtable,
|
||||
/* offsetof(...) returns the size of pair_t without the last,
|
||||
flexible member. This way, the correct amount is
|
||||
allocated. */
|
||||
|
||||
size_t len = strlen(key);
|
||||
if(len >= (size_t)-1 - offsetof(pair_t, key)) {
|
||||
/* Avoid an overflow if the key is very long */
|
||||
return -1;
|
||||
}
|
||||
|
||||
pair = jsonp_malloc(offsetof(pair_t, key) + len + 1);
|
||||
pair = jsonp_malloc(offsetof(pair_t, key) + strlen(key) + 1);
|
||||
if(!pair)
|
||||
return -1;
|
||||
|
||||
@@ -265,7 +273,7 @@ void *hashtable_get(hashtable_t *hashtable, const char *key)
|
||||
bucket_t *bucket;
|
||||
|
||||
hash = hash_str(key);
|
||||
bucket = &hashtable->buckets[hash & hashmask(hashtable->order)];
|
||||
bucket = &hashtable->buckets[hash % num_buckets(hashtable)];
|
||||
|
||||
pair = hashtable_find_pair(hashtable, bucket, key, hash);
|
||||
if(!pair)
|
||||
@@ -286,7 +294,7 @@ void hashtable_clear(hashtable_t *hashtable)
|
||||
|
||||
hashtable_do_clear(hashtable);
|
||||
|
||||
for(i = 0; i < hashsize(hashtable->order); i++)
|
||||
for(i = 0; i < num_buckets(hashtable); i++)
|
||||
{
|
||||
hashtable->buckets[i].first = hashtable->buckets[i].last =
|
||||
&hashtable->list;
|
||||
@@ -308,7 +316,7 @@ void *hashtable_iter_at(hashtable_t *hashtable, const char *key)
|
||||
bucket_t *bucket;
|
||||
|
||||
hash = hash_str(key);
|
||||
bucket = &hashtable->buckets[hash & hashmask(hashtable->order)];
|
||||
bucket = &hashtable->buckets[hash % num_buckets(hashtable)];
|
||||
|
||||
pair = hashtable_find_pair(hashtable, bucket, key, hash);
|
||||
if(!pair)
|
||||
|
||||
+2
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -32,7 +32,7 @@ struct hashtable_bucket {
|
||||
typedef struct hashtable {
|
||||
size_t size;
|
||||
struct hashtable_bucket *buckets;
|
||||
size_t order; /* hashtable has pow(2, order) buckets */
|
||||
size_t num_buckets; /* index to primes[] */
|
||||
struct hashtable_list list;
|
||||
} hashtable_t;
|
||||
|
||||
@@ -40,7 +40,6 @@ typedef struct hashtable {
|
||||
#define hashtable_key_to_iter(key_) \
|
||||
(&(container_of(key_, struct hashtable_pair, key)->list))
|
||||
|
||||
|
||||
/**
|
||||
* hashtable_init - Initialize a hashtable object
|
||||
*
|
||||
|
||||
@@ -1,277 +0,0 @@
|
||||
/* Generate sizeof(uint32_t) bytes of as random data as possible to seed
|
||||
the hash function.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <jansson_private_config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SCHED_H
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* For GetModuleHandle(), GetProcAddress() and GetCurrentProcessId() */
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "jansson.h"
|
||||
|
||||
|
||||
static uint32_t buf_to_uint32(char *data) {
|
||||
size_t i;
|
||||
uint32_t result = 0;
|
||||
|
||||
for (i = 0; i < sizeof(uint32_t); i++)
|
||||
result = (result << 8) | (unsigned char)data[i];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* /dev/urandom */
|
||||
#if !defined(_WIN32) && defined(USE_URANDOM)
|
||||
static int seed_from_urandom(uint32_t *seed) {
|
||||
/* Use unbuffered I/O if we have open(), close() and read(). Otherwise
|
||||
fall back to fopen() */
|
||||
|
||||
char data[sizeof(uint32_t)];
|
||||
int ok;
|
||||
|
||||
#if defined(HAVE_OPEN) && defined(HAVE_CLOSE) && defined(HAVE_READ)
|
||||
int urandom;
|
||||
urandom = open("/dev/urandom", O_RDONLY);
|
||||
if (urandom == -1)
|
||||
return 1;
|
||||
|
||||
ok = read(urandom, data, sizeof(uint32_t)) == sizeof(uint32_t);
|
||||
close(urandom);
|
||||
#else
|
||||
FILE *urandom;
|
||||
|
||||
urandom = fopen("/dev/urandom", "rb");
|
||||
if (!urandom)
|
||||
return 1;
|
||||
|
||||
ok = fread(data, 1, sizeof(uint32_t), urandom) == sizeof(uint32_t);
|
||||
fclose(urandom);
|
||||
#endif
|
||||
|
||||
if (!ok)
|
||||
return 1;
|
||||
|
||||
*seed = buf_to_uint32(data);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Windows Crypto API */
|
||||
#if defined(_WIN32) && defined(USE_WINDOWS_CRYPTOAPI)
|
||||
#include <wincrypt.h>
|
||||
|
||||
typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTA)(HCRYPTPROV *phProv, LPCSTR pszContainer, LPCSTR pszProvider, DWORD dwProvType, DWORD dwFlags);
|
||||
typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
|
||||
typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV hProv, DWORD dwFlags);
|
||||
|
||||
static int seed_from_windows_cryptoapi(uint32_t *seed)
|
||||
{
|
||||
HINSTANCE hAdvAPI32 = NULL;
|
||||
CRYPTACQUIRECONTEXTA pCryptAcquireContext = NULL;
|
||||
CRYPTGENRANDOM pCryptGenRandom = NULL;
|
||||
CRYPTRELEASECONTEXT pCryptReleaseContext = NULL;
|
||||
HCRYPTPROV hCryptProv = 0;
|
||||
BYTE data[sizeof(uint32_t)];
|
||||
int ok;
|
||||
|
||||
hAdvAPI32 = GetModuleHandle(TEXT("advapi32.dll"));
|
||||
if(hAdvAPI32 == NULL)
|
||||
return 1;
|
||||
|
||||
pCryptAcquireContext = (CRYPTACQUIRECONTEXTA)GetProcAddress(hAdvAPI32, "CryptAcquireContextA");
|
||||
if (!pCryptAcquireContext)
|
||||
return 1;
|
||||
|
||||
pCryptGenRandom = (CRYPTGENRANDOM)GetProcAddress(hAdvAPI32, "CryptGenRandom");
|
||||
if (!pCryptGenRandom)
|
||||
return 1;
|
||||
|
||||
pCryptReleaseContext = (CRYPTRELEASECONTEXT)GetProcAddress(hAdvAPI32, "CryptReleaseContext");
|
||||
if (!pCryptReleaseContext)
|
||||
return 1;
|
||||
|
||||
if (!pCryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
|
||||
return 1;
|
||||
|
||||
ok = pCryptGenRandom(hCryptProv, sizeof(uint32_t), data);
|
||||
pCryptReleaseContext(hCryptProv, 0);
|
||||
|
||||
if (!ok)
|
||||
return 1;
|
||||
|
||||
*seed = buf_to_uint32((char *)data);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* gettimeofday() and getpid() */
|
||||
static int seed_from_timestamp_and_pid(uint32_t *seed) {
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
/* XOR of seconds and microseconds */
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
*seed = (uint32_t)tv.tv_sec ^ (uint32_t)tv.tv_usec;
|
||||
#else
|
||||
/* Seconds only */
|
||||
*seed = (uint32_t)time(NULL);
|
||||
#endif
|
||||
|
||||
/* XOR with PID for more randomness */
|
||||
#if defined(_WIN32)
|
||||
*seed ^= (uint32_t)GetCurrentProcessId();
|
||||
#elif defined(HAVE_GETPID)
|
||||
*seed ^= (uint32_t)getpid();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint32_t generate_seed() {
|
||||
uint32_t seed;
|
||||
int done = 0;
|
||||
|
||||
#if !defined(_WIN32) && defined(USE_URANDOM)
|
||||
if (!done && seed_from_urandom(&seed) == 0)
|
||||
done = 1;
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && defined(USE_WINDOWS_CRYPTOAPI)
|
||||
if (!done && seed_from_windows_cryptoapi(&seed) == 0)
|
||||
done = 1;
|
||||
#endif
|
||||
|
||||
if (!done) {
|
||||
/* Fall back to timestamp and PID if no better randomness is
|
||||
available */
|
||||
seed_from_timestamp_and_pid(&seed);
|
||||
}
|
||||
|
||||
/* Make sure the seed is never zero */
|
||||
if (seed == 0)
|
||||
seed = 1;
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
||||
|
||||
volatile uint32_t hashtable_seed = 0;
|
||||
|
||||
#if defined(HAVE_ATOMIC_BUILTINS) && (defined(HAVE_SCHED_YIELD) || !defined(_WIN32))
|
||||
static volatile char seed_initialized = 0;
|
||||
|
||||
void json_object_seed(size_t seed) {
|
||||
uint32_t new_seed = (uint32_t)seed;
|
||||
|
||||
if (hashtable_seed == 0) {
|
||||
if (__atomic_test_and_set(&seed_initialized, __ATOMIC_RELAXED) == 0) {
|
||||
/* Do the seeding ourselves */
|
||||
if (new_seed == 0)
|
||||
new_seed = generate_seed();
|
||||
|
||||
__atomic_store_n(&hashtable_seed, new_seed, __ATOMIC_RELEASE);
|
||||
} else {
|
||||
/* Wait for another thread to do the seeding */
|
||||
do {
|
||||
#ifdef HAVE_SCHED_YIELD
|
||||
sched_yield();
|
||||
#endif
|
||||
} while(__atomic_load_n(&hashtable_seed, __ATOMIC_ACQUIRE) == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_SYNC_BUILTINS) && (defined(HAVE_SCHED_YIELD) || !defined(_WIN32))
|
||||
void json_object_seed(size_t seed) {
|
||||
uint32_t new_seed = (uint32_t)seed;
|
||||
|
||||
if (hashtable_seed == 0) {
|
||||
if (new_seed == 0) {
|
||||
/* Explicit synchronization fences are not supported by the
|
||||
__sync builtins, so every thread getting here has to
|
||||
generate the seed value.
|
||||
*/
|
||||
new_seed = generate_seed();
|
||||
}
|
||||
|
||||
do {
|
||||
if (__sync_bool_compare_and_swap(&hashtable_seed, 0, new_seed)) {
|
||||
/* We were the first to seed */
|
||||
break;
|
||||
} else {
|
||||
/* Wait for another thread to do the seeding */
|
||||
#ifdef HAVE_SCHED_YIELD
|
||||
sched_yield();
|
||||
#endif
|
||||
}
|
||||
} while(hashtable_seed == 0);
|
||||
}
|
||||
}
|
||||
#elif defined(_WIN32)
|
||||
static long seed_initialized = 0;
|
||||
void json_object_seed(size_t seed) {
|
||||
uint32_t new_seed = (uint32_t)seed;
|
||||
|
||||
if (hashtable_seed == 0) {
|
||||
if (InterlockedIncrement(&seed_initialized) == 1) {
|
||||
/* Do the seeding ourselves */
|
||||
if (new_seed == 0)
|
||||
new_seed = generate_seed();
|
||||
|
||||
hashtable_seed = new_seed;
|
||||
} else {
|
||||
/* Wait for another thread to do the seeding */
|
||||
do {
|
||||
SwitchToThread();
|
||||
} while (hashtable_seed == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
/* Fall back to a thread-unsafe version */
|
||||
void json_object_seed(size_t seed) {
|
||||
uint32_t new_seed = (uint32_t)seed;
|
||||
|
||||
if (hashtable_seed == 0) {
|
||||
if (new_seed == 0)
|
||||
new_seed = generate_seed();
|
||||
|
||||
hashtable_seed = new_seed;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+19
-28
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -21,11 +21,11 @@ extern "C" {
|
||||
/* version */
|
||||
|
||||
#define JANSSON_MAJOR_VERSION 2
|
||||
#define JANSSON_MINOR_VERSION 7
|
||||
#define JANSSON_MINOR_VERSION 5
|
||||
#define JANSSON_MICRO_VERSION 0
|
||||
|
||||
/* Micro version is omitted if it's 0 */
|
||||
#define JANSSON_VERSION "2.7"
|
||||
#define JANSSON_VERSION "2.5"
|
||||
|
||||
/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this
|
||||
for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */
|
||||
@@ -67,26 +67,23 @@ typedef long json_int_t;
|
||||
#endif
|
||||
|
||||
#define json_typeof(json) ((json)->type)
|
||||
#define json_is_object(json) ((json) && json_typeof(json) == JSON_OBJECT)
|
||||
#define json_is_array(json) ((json) && json_typeof(json) == JSON_ARRAY)
|
||||
#define json_is_string(json) ((json) && json_typeof(json) == JSON_STRING)
|
||||
#define json_is_integer(json) ((json) && json_typeof(json) == JSON_INTEGER)
|
||||
#define json_is_real(json) ((json) && json_typeof(json) == JSON_REAL)
|
||||
#define json_is_object(json) (json && json_typeof(json) == JSON_OBJECT)
|
||||
#define json_is_array(json) (json && json_typeof(json) == JSON_ARRAY)
|
||||
#define json_is_string(json) (json && json_typeof(json) == JSON_STRING)
|
||||
#define json_is_integer(json) (json && json_typeof(json) == JSON_INTEGER)
|
||||
#define json_is_real(json) (json && json_typeof(json) == JSON_REAL)
|
||||
#define json_is_number(json) (json_is_integer(json) || json_is_real(json))
|
||||
#define json_is_true(json) ((json) && json_typeof(json) == JSON_TRUE)
|
||||
#define json_is_false(json) ((json) && json_typeof(json) == JSON_FALSE)
|
||||
#define json_boolean_value json_is_true
|
||||
#define json_is_true(json) (json && json_typeof(json) == JSON_TRUE)
|
||||
#define json_is_false(json) (json && json_typeof(json) == JSON_FALSE)
|
||||
#define json_is_boolean(json) (json_is_true(json) || json_is_false(json))
|
||||
#define json_is_null(json) ((json) && json_typeof(json) == JSON_NULL)
|
||||
#define json_is_null(json) (json && json_typeof(json) == JSON_NULL)
|
||||
|
||||
/* construction, destruction, reference counting */
|
||||
|
||||
json_t *json_object(void);
|
||||
json_t *json_array(void);
|
||||
json_t *json_string(const char *value);
|
||||
json_t *json_stringn(const char *value, size_t len);
|
||||
json_t *json_string_nocheck(const char *value);
|
||||
json_t *json_stringn_nocheck(const char *value, size_t len);
|
||||
json_t *json_integer(json_int_t value);
|
||||
json_t *json_real(double value);
|
||||
json_t *json_true(void);
|
||||
@@ -129,7 +126,6 @@ typedef struct {
|
||||
|
||||
/* getters, setters, manipulation */
|
||||
|
||||
void json_object_seed(size_t seed);
|
||||
size_t json_object_size(const json_t *object);
|
||||
json_t *json_object_get(const json_t *object, const char *key);
|
||||
int json_object_set_new(json_t *object, const char *key, json_t *value);
|
||||
@@ -203,18 +199,16 @@ int json_array_insert(json_t *array, size_t ind, json_t *value)
|
||||
}
|
||||
|
||||
const char *json_string_value(const json_t *string);
|
||||
size_t json_string_length(const json_t *string);
|
||||
json_int_t json_integer_value(const json_t *integer);
|
||||
double json_real_value(const json_t *real);
|
||||
double json_number_value(const json_t *json);
|
||||
|
||||
int json_string_set(json_t *string, const char *value);
|
||||
int json_string_setn(json_t *string, const char *value, size_t len);
|
||||
int json_string_set_nocheck(json_t *string, const char *value);
|
||||
int json_string_setn_nocheck(json_t *string, const char *value, size_t len);
|
||||
int json_integer_set(json_t *integer, json_int_t value);
|
||||
int json_real_set(json_t *real, double value);
|
||||
|
||||
|
||||
/* pack, unpack */
|
||||
|
||||
json_t *json_pack(const char *fmt, ...);
|
||||
@@ -246,7 +240,6 @@ json_t *json_deep_copy(const json_t *value);
|
||||
#define JSON_DISABLE_EOF_CHECK 0x2
|
||||
#define JSON_DECODE_ANY 0x4
|
||||
#define JSON_DECODE_INT_AS_REAL 0x8
|
||||
#define JSON_ALLOW_NUL 0x10
|
||||
|
||||
typedef size_t (*json_load_callback_t)(void *buffer, size_t buflen, void *data);
|
||||
|
||||
@@ -259,15 +252,13 @@ json_t *json_load_callback(json_load_callback_t callback, void *data, size_t fla
|
||||
|
||||
/* encoding */
|
||||
|
||||
#define JSON_MAX_INDENT 0x1F
|
||||
#define JSON_INDENT(n) ((n) & JSON_MAX_INDENT)
|
||||
#define JSON_COMPACT 0x20
|
||||
#define JSON_ENSURE_ASCII 0x40
|
||||
#define JSON_SORT_KEYS 0x80
|
||||
#define JSON_PRESERVE_ORDER 0x100
|
||||
#define JSON_ENCODE_ANY 0x200
|
||||
#define JSON_ESCAPE_SLASH 0x400
|
||||
#define JSON_REAL_PRECISION(n) (((n) & 0x1F) << 11)
|
||||
#define JSON_INDENT(n) (n & 0x1F)
|
||||
#define JSON_COMPACT 0x20
|
||||
#define JSON_ENSURE_ASCII 0x40
|
||||
#define JSON_SORT_KEYS 0x80
|
||||
#define JSON_PRESERVE_ORDER 0x100
|
||||
#define JSON_ENCODE_ANY 0x200
|
||||
#define JSON_ESCAPE_SLASH 0x400
|
||||
|
||||
typedef int (*json_dump_callback_t)(const char *buffer, size_t size, void *data);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2010-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -49,7 +49,6 @@ typedef struct {
|
||||
typedef struct {
|
||||
json_t json;
|
||||
char *value;
|
||||
size_t length;
|
||||
} json_string_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -65,13 +64,9 @@ typedef struct {
|
||||
#define json_to_object(json_) container_of(json_, json_object_t, json)
|
||||
#define json_to_array(json_) container_of(json_, json_array_t, json)
|
||||
#define json_to_string(json_) container_of(json_, json_string_t, json)
|
||||
#define json_to_real(json_) container_of(json_, json_real_t, json)
|
||||
#define json_to_real(json_) container_of(json_, json_real_t, json)
|
||||
#define json_to_integer(json_) container_of(json_, json_integer_t, json)
|
||||
|
||||
/* Create a string by taking ownership of an existing buffer */
|
||||
json_t *jsonp_stringn_nocheck_own(const char *value, size_t len);
|
||||
|
||||
/* Error message formatting */
|
||||
void jsonp_error_init(json_error_t *error, const char *source);
|
||||
void jsonp_error_set_source(json_error_t *error, const char *source);
|
||||
void jsonp_error_set(json_error_t *error, int line, int column,
|
||||
@@ -81,14 +76,13 @@ void jsonp_error_vset(json_error_t *error, int line, int column,
|
||||
|
||||
/* Locale independent string<->double conversions */
|
||||
int jsonp_strtod(strbuffer_t *strbuffer, double *out);
|
||||
int jsonp_dtostr(char *buffer, size_t size, double value, int prec);
|
||||
int jsonp_dtostr(char *buffer, size_t size, double value);
|
||||
|
||||
/* Wrappers for custom memory functions */
|
||||
void* jsonp_malloc(size_t size);
|
||||
void jsonp_free(void *ptr);
|
||||
char *jsonp_strndup(const char *str, size_t length);
|
||||
char *jsonp_strdup(const char *str);
|
||||
char *jsonp_strndup(const char *str, size_t len);
|
||||
|
||||
/* Windows compatibility */
|
||||
#ifdef _WIN32
|
||||
|
||||
+39
-67
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -63,10 +63,7 @@ typedef struct {
|
||||
strbuffer_t saved_text;
|
||||
int token;
|
||||
union {
|
||||
struct {
|
||||
char *val;
|
||||
size_t len;
|
||||
} string;
|
||||
char *string;
|
||||
json_int_t integer;
|
||||
double real;
|
||||
} value;
|
||||
@@ -282,13 +279,6 @@ static void lex_save_cached(lex_t *lex)
|
||||
}
|
||||
}
|
||||
|
||||
static void lex_free_string(lex_t *lex)
|
||||
{
|
||||
jsonp_free(lex->value.string.val);
|
||||
lex->value.string.val = NULL;
|
||||
lex->value.string.len = 0;
|
||||
}
|
||||
|
||||
/* assumes that str points to 'u' plus at least 4 valid hex digits */
|
||||
static int32_t decode_unicode_escape(const char *str)
|
||||
{
|
||||
@@ -307,7 +297,7 @@ static int32_t decode_unicode_escape(const char *str)
|
||||
else if(l_isupper(c))
|
||||
value += c - 'A' + 10;
|
||||
else
|
||||
return -1;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
return value;
|
||||
@@ -320,7 +310,7 @@ static void lex_scan_string(lex_t *lex, json_error_t *error)
|
||||
char *t;
|
||||
int i;
|
||||
|
||||
lex->value.string.val = NULL;
|
||||
lex->value.string = NULL;
|
||||
lex->token = TOKEN_INVALID;
|
||||
|
||||
c = lex_get_save(lex, error);
|
||||
@@ -375,12 +365,14 @@ static void lex_scan_string(lex_t *lex, json_error_t *error)
|
||||
- two \uXXXX escapes (length 12) forming an UTF-16 surrogate pair
|
||||
are converted to 4 bytes
|
||||
*/
|
||||
t = jsonp_malloc(lex->saved_text.length + 1);
|
||||
if(!t) {
|
||||
lex->value.string = jsonp_malloc(lex->saved_text.length + 1);
|
||||
if(!lex->value.string) {
|
||||
/* this is not very nice, since TOKEN_INVALID is returned */
|
||||
goto out;
|
||||
}
|
||||
lex->value.string.val = t;
|
||||
|
||||
/* the target */
|
||||
t = lex->value.string;
|
||||
|
||||
/* + 1 to skip the " */
|
||||
p = strbuffer_value(&lex->saved_text) + 1;
|
||||
@@ -389,24 +381,17 @@ static void lex_scan_string(lex_t *lex, json_error_t *error)
|
||||
if(*p == '\\') {
|
||||
p++;
|
||||
if(*p == 'u') {
|
||||
size_t length;
|
||||
char buffer[4];
|
||||
int length;
|
||||
int32_t value;
|
||||
|
||||
value = decode_unicode_escape(p);
|
||||
if(value < 0) {
|
||||
error_set(error, lex, "invalid Unicode escape '%.6s'", p - 1);
|
||||
goto out;
|
||||
}
|
||||
p += 5;
|
||||
|
||||
if(0xD800 <= value && value <= 0xDBFF) {
|
||||
/* surrogate pair */
|
||||
if(*p == '\\' && *(p + 1) == 'u') {
|
||||
int32_t value2 = decode_unicode_escape(++p);
|
||||
if(value2 < 0) {
|
||||
error_set(error, lex, "invalid Unicode escape '%.6s'", p - 1);
|
||||
goto out;
|
||||
}
|
||||
p += 5;
|
||||
|
||||
if(0xDC00 <= value2 && value2 <= 0xDFFF) {
|
||||
@@ -435,9 +420,16 @@ static void lex_scan_string(lex_t *lex, json_error_t *error)
|
||||
error_set(error, lex, "invalid Unicode '\\u%04X'", value);
|
||||
goto out;
|
||||
}
|
||||
else if(value == 0)
|
||||
{
|
||||
error_set(error, lex, "\\u0000 is not allowed");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if(utf8_encode(value, t, &length))
|
||||
if(utf8_encode(value, buffer, &length))
|
||||
assert(0);
|
||||
|
||||
memcpy(t, buffer, length);
|
||||
t += length;
|
||||
}
|
||||
else {
|
||||
@@ -459,12 +451,11 @@ static void lex_scan_string(lex_t *lex, json_error_t *error)
|
||||
*(t++) = *(p++);
|
||||
}
|
||||
*t = '\0';
|
||||
lex->value.string.len = t - lex->value.string.val;
|
||||
lex->token = TOKEN_STRING;
|
||||
return;
|
||||
|
||||
out:
|
||||
lex_free_string(lex);
|
||||
jsonp_free(lex->value.string);
|
||||
}
|
||||
|
||||
#ifndef JANSSON_USING_CMAKE /* disabled if using cmake */
|
||||
@@ -483,7 +474,7 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error)
|
||||
{
|
||||
const char *saved_text;
|
||||
char *end;
|
||||
double doubleval;
|
||||
double value;
|
||||
|
||||
lex->token = TOKEN_INVALID;
|
||||
|
||||
@@ -508,16 +499,16 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error)
|
||||
}
|
||||
|
||||
if(c != '.' && c != 'E' && c != 'e') {
|
||||
json_int_t intval;
|
||||
json_int_t value;
|
||||
|
||||
lex_unget_unsave(lex, c);
|
||||
|
||||
saved_text = strbuffer_value(&lex->saved_text);
|
||||
|
||||
errno = 0;
|
||||
intval = json_strtoint(saved_text, &end, 10);
|
||||
value = json_strtoint(saved_text, &end, 10);
|
||||
if(errno == ERANGE) {
|
||||
if(intval < 0)
|
||||
if(value < 0)
|
||||
error_set(error, lex, "too big negative integer");
|
||||
else
|
||||
error_set(error, lex, "too big integer");
|
||||
@@ -527,7 +518,7 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error)
|
||||
assert(end == saved_text + lex->saved_text.length);
|
||||
|
||||
lex->token = TOKEN_INTEGER;
|
||||
lex->value.integer = intval;
|
||||
lex->value.integer = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -561,13 +552,13 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error)
|
||||
|
||||
lex_unget_unsave(lex, c);
|
||||
|
||||
if(jsonp_strtod(&lex->saved_text, &doubleval)) {
|
||||
if(jsonp_strtod(&lex->saved_text, &value)) {
|
||||
error_set(error, lex, "real number overflow");
|
||||
goto out;
|
||||
}
|
||||
|
||||
lex->token = TOKEN_REAL;
|
||||
lex->value.real = doubleval;
|
||||
lex->value.real = value;
|
||||
return 0;
|
||||
|
||||
out:
|
||||
@@ -580,8 +571,10 @@ static int lex_scan(lex_t *lex, json_error_t *error)
|
||||
|
||||
strbuffer_clear(&lex->saved_text);
|
||||
|
||||
if(lex->token == TOKEN_STRING)
|
||||
lex_free_string(lex);
|
||||
if(lex->token == TOKEN_STRING) {
|
||||
jsonp_free(lex->value.string);
|
||||
lex->value.string = NULL;
|
||||
}
|
||||
|
||||
c = lex_get(lex, error);
|
||||
while(c == ' ' || c == '\t' || c == '\n' || c == '\r')
|
||||
@@ -642,14 +635,13 @@ out:
|
||||
return lex->token;
|
||||
}
|
||||
|
||||
static char *lex_steal_string(lex_t *lex, size_t *out_len)
|
||||
static char *lex_steal_string(lex_t *lex)
|
||||
{
|
||||
char *result = NULL;
|
||||
if(lex->token == TOKEN_STRING) {
|
||||
result = lex->value.string.val;
|
||||
*out_len = lex->value.string.len;
|
||||
lex->value.string.val = NULL;
|
||||
lex->value.string.len = 0;
|
||||
if(lex->token == TOKEN_STRING)
|
||||
{
|
||||
result = lex->value.string;
|
||||
lex->value.string = NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -667,7 +659,7 @@ static int lex_init(lex_t *lex, get_func get, void *data)
|
||||
static void lex_close(lex_t *lex)
|
||||
{
|
||||
if(lex->token == TOKEN_STRING)
|
||||
lex_free_string(lex);
|
||||
jsonp_free(lex->value.string);
|
||||
strbuffer_close(&lex->saved_text);
|
||||
}
|
||||
|
||||
@@ -688,7 +680,6 @@ static json_t *parse_object(lex_t *lex, size_t flags, json_error_t *error)
|
||||
|
||||
while(1) {
|
||||
char *key;
|
||||
size_t len;
|
||||
json_t *value;
|
||||
|
||||
if(lex->token != TOKEN_STRING) {
|
||||
@@ -696,14 +687,9 @@ static json_t *parse_object(lex_t *lex, size_t flags, json_error_t *error)
|
||||
goto error;
|
||||
}
|
||||
|
||||
key = lex_steal_string(lex, &len);
|
||||
key = lex_steal_string(lex);
|
||||
if(!key)
|
||||
return NULL;
|
||||
if (memchr(key, '\0', len)) {
|
||||
jsonp_free(key);
|
||||
error_set(error, lex, "NUL byte in object key not supported");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if(flags & JSON_REJECT_DUPLICATES) {
|
||||
if(json_object_get(object, key)) {
|
||||
@@ -802,21 +788,7 @@ static json_t *parse_value(lex_t *lex, size_t flags, json_error_t *error)
|
||||
|
||||
switch(lex->token) {
|
||||
case TOKEN_STRING: {
|
||||
const char *value = lex->value.string.val;
|
||||
size_t len = lex->value.string.len;
|
||||
|
||||
if(!(flags & JSON_ALLOW_NUL)) {
|
||||
if(memchr(value, '\0', len)) {
|
||||
error_set(error, lex, "\\u0000 is not allowed without JSON_ALLOW_NUL");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
json = jsonp_stringn_nocheck_own(value, len);
|
||||
if(json) {
|
||||
lex->value.string.val = NULL;
|
||||
lex->value.string.len = 0;
|
||||
}
|
||||
json = json_string_nocheck(lex->value.string);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,381 +0,0 @@
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
lookup3.c, by Bob Jenkins, May 2006, Public Domain.
|
||||
|
||||
These are functions for producing 32-bit hashes for hash table lookup.
|
||||
hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
|
||||
are externally useful functions. Routines to test the hash are included
|
||||
if SELF_TEST is defined. You can use this free for any purpose. It's in
|
||||
the public domain. It has no warranty.
|
||||
|
||||
You probably want to use hashlittle(). hashlittle() and hashbig()
|
||||
hash byte arrays. hashlittle() is is faster than hashbig() on
|
||||
little-endian machines. Intel and AMD are little-endian machines.
|
||||
On second thought, you probably want hashlittle2(), which is identical to
|
||||
hashlittle() except it returns two 32-bit hashes for the price of one.
|
||||
You could implement hashbig2() if you wanted but I haven't bothered here.
|
||||
|
||||
If you want to find a hash of, say, exactly 7 integers, do
|
||||
a = i1; b = i2; c = i3;
|
||||
mix(a,b,c);
|
||||
a += i4; b += i5; c += i6;
|
||||
mix(a,b,c);
|
||||
a += i7;
|
||||
final(a,b,c);
|
||||
then use c as the hash value. If you have a variable length array of
|
||||
4-byte integers to hash, use hashword(). If you have a byte array (like
|
||||
a character string), use hashlittle(). If you have several byte arrays, or
|
||||
a mix of things, see the comments above hashlittle().
|
||||
|
||||
Why is this so big? I read 12 bytes at a time into 3 4-byte integers,
|
||||
then mix those integers. This is fast (you can do a lot more thorough
|
||||
mixing with 12*3 instructions on 3 integers than you can with 3 instructions
|
||||
on 1 byte), but shoehorning those bytes into integers efficiently is messy.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <jansson_private_config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h> /* defines uint32_t etc */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h> /* attempt to define endianness */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ENDIAN_H
|
||||
# include <endian.h> /* attempt to define endianness */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* My best guess at if you are big-endian or little-endian. This may
|
||||
* need adjustment.
|
||||
*/
|
||||
#if (defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \
|
||||
__BYTE_ORDER == __LITTLE_ENDIAN) || \
|
||||
(defined(i386) || defined(__i386__) || defined(__i486__) || \
|
||||
defined(__i586__) || defined(__i686__) || defined(vax) || defined(MIPSEL))
|
||||
# define HASH_LITTLE_ENDIAN 1
|
||||
# define HASH_BIG_ENDIAN 0
|
||||
#elif (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \
|
||||
__BYTE_ORDER == __BIG_ENDIAN) || \
|
||||
(defined(sparc) || defined(POWERPC) || defined(mc68000) || defined(sel))
|
||||
# define HASH_LITTLE_ENDIAN 0
|
||||
# define HASH_BIG_ENDIAN 1
|
||||
#else
|
||||
# define HASH_LITTLE_ENDIAN 0
|
||||
# define HASH_BIG_ENDIAN 0
|
||||
#endif
|
||||
|
||||
#define hashsize(n) ((uint32_t)1<<(n))
|
||||
#define hashmask(n) (hashsize(n)-1)
|
||||
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
mix -- mix 3 32-bit values reversibly.
|
||||
|
||||
This is reversible, so any information in (a,b,c) before mix() is
|
||||
still in (a,b,c) after mix().
|
||||
|
||||
If four pairs of (a,b,c) inputs are run through mix(), or through
|
||||
mix() in reverse, there are at least 32 bits of the output that
|
||||
are sometimes the same for one pair and different for another pair.
|
||||
This was tested for:
|
||||
* pairs that differed by one bit, by two bits, in any combination
|
||||
of top bits of (a,b,c), or in any combination of bottom bits of
|
||||
(a,b,c).
|
||||
* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
|
||||
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
|
||||
is commonly produced by subtraction) look like a single 1-bit
|
||||
difference.
|
||||
* the base values were pseudorandom, all zero but one bit set, or
|
||||
all zero plus a counter that starts at zero.
|
||||
|
||||
Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that
|
||||
satisfy this are
|
||||
4 6 8 16 19 4
|
||||
9 15 3 18 27 15
|
||||
14 9 3 7 17 3
|
||||
Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing
|
||||
for "differ" defined as + with a one-bit base and a two-bit delta. I
|
||||
used http://burtleburtle.net/bob/hash/avalanche.html to choose
|
||||
the operations, constants, and arrangements of the variables.
|
||||
|
||||
This does not achieve avalanche. There are input bits of (a,b,c)
|
||||
that fail to affect some output bits of (a,b,c), especially of a. The
|
||||
most thoroughly mixed value is c, but it doesn't really even achieve
|
||||
avalanche in c.
|
||||
|
||||
This allows some parallelism. Read-after-writes are good at doubling
|
||||
the number of bits affected, so the goal of mixing pulls in the opposite
|
||||
direction as the goal of parallelism. I did what I could. Rotates
|
||||
seem to cost as much as shifts on every machine I could lay my hands
|
||||
on, and rotates are much kinder to the top and bottom bits, so I used
|
||||
rotates.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#define mix(a,b,c) \
|
||||
{ \
|
||||
a -= c; a ^= rot(c, 4); c += b; \
|
||||
b -= a; b ^= rot(a, 6); a += c; \
|
||||
c -= b; c ^= rot(b, 8); b += a; \
|
||||
a -= c; a ^= rot(c,16); c += b; \
|
||||
b -= a; b ^= rot(a,19); a += c; \
|
||||
c -= b; c ^= rot(b, 4); b += a; \
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
final -- final mixing of 3 32-bit values (a,b,c) into c
|
||||
|
||||
Pairs of (a,b,c) values differing in only a few bits will usually
|
||||
produce values of c that look totally different. This was tested for
|
||||
* pairs that differed by one bit, by two bits, in any combination
|
||||
of top bits of (a,b,c), or in any combination of bottom bits of
|
||||
(a,b,c).
|
||||
* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed
|
||||
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
|
||||
is commonly produced by subtraction) look like a single 1-bit
|
||||
difference.
|
||||
* the base values were pseudorandom, all zero but one bit set, or
|
||||
all zero plus a counter that starts at zero.
|
||||
|
||||
These constants passed:
|
||||
14 11 25 16 4 14 24
|
||||
12 14 25 16 4 14 24
|
||||
and these came close:
|
||||
4 8 15 26 3 22 24
|
||||
10 8 15 26 3 22 24
|
||||
11 8 15 26 3 22 24
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#define final(a,b,c) \
|
||||
{ \
|
||||
c ^= b; c -= rot(b,14); \
|
||||
a ^= c; a -= rot(c,11); \
|
||||
b ^= a; b -= rot(a,25); \
|
||||
c ^= b; c -= rot(b,16); \
|
||||
a ^= c; a -= rot(c,4); \
|
||||
b ^= a; b -= rot(a,14); \
|
||||
c ^= b; c -= rot(b,24); \
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
hashlittle() -- hash a variable-length key into a 32-bit value
|
||||
k : the key (the unaligned variable-length array of bytes)
|
||||
length : the length of the key, counting by bytes
|
||||
initval : can be any 4-byte value
|
||||
Returns a 32-bit value. Every bit of the key affects every bit of
|
||||
the return value. Two keys differing by one or two bits will have
|
||||
totally different hash values.
|
||||
|
||||
The best hash table sizes are powers of 2. There is no need to do
|
||||
mod a prime (mod is sooo slow!). If you need less than 32 bits,
|
||||
use a bitmask. For example, if you need only 10 bits, do
|
||||
h = (h & hashmask(10));
|
||||
In which case, the hash table should have hashsize(10) elements.
|
||||
|
||||
If you are hashing n strings (uint8_t **)k, do it like this:
|
||||
for (i=0, h=0; i<n; ++i) h = hashlittle( k[i], len[i], h);
|
||||
|
||||
By Bob Jenkins, 2006. bob_jenkins@burtleburtle.net. You may use this
|
||||
code any way you wish, private, educational, or commercial. It's free.
|
||||
|
||||
Use for hash table lookup, or anything where one collision in 2^^32 is
|
||||
acceptable. Do NOT use for cryptographic purposes.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static uint32_t hashlittle(const void *key, size_t length, uint32_t initval)
|
||||
{
|
||||
uint32_t a,b,c; /* internal state */
|
||||
union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */
|
||||
|
||||
/* Set up the internal state */
|
||||
a = b = c = 0xdeadbeef + ((uint32_t)length) + initval;
|
||||
|
||||
u.ptr = key;
|
||||
if (HASH_LITTLE_ENDIAN && ((u.i & 0x3) == 0)) {
|
||||
const uint32_t *k = (const uint32_t *)key; /* read 32-bit chunks */
|
||||
|
||||
/* Detect Valgrind or AddressSanitizer */
|
||||
#ifdef VALGRIND
|
||||
# define NO_MASKING_TRICK 1
|
||||
#else
|
||||
# if defined(__has_feature) /* Clang */
|
||||
# if __has_feature(address_sanitizer) /* is ASAN enabled? */
|
||||
# define NO_MASKING_TRICK 1
|
||||
# endif
|
||||
# else
|
||||
# if defined(__SANITIZE_ADDRESS__) /* GCC 4.8.x, is ASAN enabled? */
|
||||
# define NO_MASKING_TRICK 1
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef NO_MASKING_TRICK
|
||||
const uint8_t *k8;
|
||||
#endif
|
||||
|
||||
/*------ all but last block: aligned reads and affect 32 bits of (a,b,c) */
|
||||
while (length > 12)
|
||||
{
|
||||
a += k[0];
|
||||
b += k[1];
|
||||
c += k[2];
|
||||
mix(a,b,c);
|
||||
length -= 12;
|
||||
k += 3;
|
||||
}
|
||||
|
||||
/*----------------------------- handle the last (probably partial) block */
|
||||
/*
|
||||
* "k[2]&0xffffff" actually reads beyond the end of the string, but
|
||||
* then masks off the part it's not allowed to read. Because the
|
||||
* string is aligned, the masked-off tail is in the same word as the
|
||||
* rest of the string. Every machine with memory protection I've seen
|
||||
* does it on word boundaries, so is OK with this. But VALGRIND will
|
||||
* still catch it and complain. The masking trick does make the hash
|
||||
* noticably faster for short strings (like English words).
|
||||
*/
|
||||
#ifndef NO_MASKING_TRICK
|
||||
|
||||
switch(length)
|
||||
{
|
||||
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
|
||||
case 11: c+=k[2]&0xffffff; b+=k[1]; a+=k[0]; break;
|
||||
case 10: c+=k[2]&0xffff; b+=k[1]; a+=k[0]; break;
|
||||
case 9 : c+=k[2]&0xff; b+=k[1]; a+=k[0]; break;
|
||||
case 8 : b+=k[1]; a+=k[0]; break;
|
||||
case 7 : b+=k[1]&0xffffff; a+=k[0]; break;
|
||||
case 6 : b+=k[1]&0xffff; a+=k[0]; break;
|
||||
case 5 : b+=k[1]&0xff; a+=k[0]; break;
|
||||
case 4 : a+=k[0]; break;
|
||||
case 3 : a+=k[0]&0xffffff; break;
|
||||
case 2 : a+=k[0]&0xffff; break;
|
||||
case 1 : a+=k[0]&0xff; break;
|
||||
case 0 : return c; /* zero length strings require no mixing */
|
||||
}
|
||||
|
||||
#else /* make valgrind happy */
|
||||
|
||||
k8 = (const uint8_t *)k;
|
||||
switch(length)
|
||||
{
|
||||
case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
|
||||
case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
|
||||
case 10: c+=((uint32_t)k8[9])<<8; /* fall through */
|
||||
case 9 : c+=k8[8]; /* fall through */
|
||||
case 8 : b+=k[1]; a+=k[0]; break;
|
||||
case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
|
||||
case 6 : b+=((uint32_t)k8[5])<<8; /* fall through */
|
||||
case 5 : b+=k8[4]; /* fall through */
|
||||
case 4 : a+=k[0]; break;
|
||||
case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
|
||||
case 2 : a+=((uint32_t)k8[1])<<8; /* fall through */
|
||||
case 1 : a+=k8[0]; break;
|
||||
case 0 : return c;
|
||||
}
|
||||
|
||||
#endif /* !valgrind */
|
||||
|
||||
} else if (HASH_LITTLE_ENDIAN && ((u.i & 0x1) == 0)) {
|
||||
const uint16_t *k = (const uint16_t *)key; /* read 16-bit chunks */
|
||||
const uint8_t *k8;
|
||||
|
||||
/*--------------- all but last block: aligned reads and different mixing */
|
||||
while (length > 12)
|
||||
{
|
||||
a += k[0] + (((uint32_t)k[1])<<16);
|
||||
b += k[2] + (((uint32_t)k[3])<<16);
|
||||
c += k[4] + (((uint32_t)k[5])<<16);
|
||||
mix(a,b,c);
|
||||
length -= 12;
|
||||
k += 6;
|
||||
}
|
||||
|
||||
/*----------------------------- handle the last (probably partial) block */
|
||||
k8 = (const uint8_t *)k;
|
||||
switch(length)
|
||||
{
|
||||
case 12: c+=k[4]+(((uint32_t)k[5])<<16);
|
||||
b+=k[2]+(((uint32_t)k[3])<<16);
|
||||
a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 11: c+=((uint32_t)k8[10])<<16; /* fall through */
|
||||
case 10: c+=k[4];
|
||||
b+=k[2]+(((uint32_t)k[3])<<16);
|
||||
a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 9 : c+=k8[8]; /* fall through */
|
||||
case 8 : b+=k[2]+(((uint32_t)k[3])<<16);
|
||||
a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 7 : b+=((uint32_t)k8[6])<<16; /* fall through */
|
||||
case 6 : b+=k[2];
|
||||
a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 5 : b+=k8[4]; /* fall through */
|
||||
case 4 : a+=k[0]+(((uint32_t)k[1])<<16);
|
||||
break;
|
||||
case 3 : a+=((uint32_t)k8[2])<<16; /* fall through */
|
||||
case 2 : a+=k[0];
|
||||
break;
|
||||
case 1 : a+=k8[0];
|
||||
break;
|
||||
case 0 : return c; /* zero length requires no mixing */
|
||||
}
|
||||
|
||||
} else { /* need to read the key one byte at a time */
|
||||
const uint8_t *k = (const uint8_t *)key;
|
||||
|
||||
/*--------------- all but the last block: affect some 32 bits of (a,b,c) */
|
||||
while (length > 12)
|
||||
{
|
||||
a += k[0];
|
||||
a += ((uint32_t)k[1])<<8;
|
||||
a += ((uint32_t)k[2])<<16;
|
||||
a += ((uint32_t)k[3])<<24;
|
||||
b += k[4];
|
||||
b += ((uint32_t)k[5])<<8;
|
||||
b += ((uint32_t)k[6])<<16;
|
||||
b += ((uint32_t)k[7])<<24;
|
||||
c += k[8];
|
||||
c += ((uint32_t)k[9])<<8;
|
||||
c += ((uint32_t)k[10])<<16;
|
||||
c += ((uint32_t)k[11])<<24;
|
||||
mix(a,b,c);
|
||||
length -= 12;
|
||||
k += 12;
|
||||
}
|
||||
|
||||
/*-------------------------------- last block: affect all 32 bits of (c) */
|
||||
switch(length) /* all the case statements fall through */
|
||||
{
|
||||
case 12: c+=((uint32_t)k[11])<<24;
|
||||
case 11: c+=((uint32_t)k[10])<<16;
|
||||
case 10: c+=((uint32_t)k[9])<<8;
|
||||
case 9 : c+=k[8];
|
||||
case 8 : b+=((uint32_t)k[7])<<24;
|
||||
case 7 : b+=((uint32_t)k[6])<<16;
|
||||
case 6 : b+=((uint32_t)k[5])<<8;
|
||||
case 5 : b+=k[4];
|
||||
case 4 : a+=((uint32_t)k[3])<<24;
|
||||
case 3 : a+=((uint32_t)k[2])<<16;
|
||||
case 2 : a+=((uint32_t)k[1])<<8;
|
||||
case 1 : a+=k[0];
|
||||
break;
|
||||
case 0 : return c;
|
||||
}
|
||||
}
|
||||
|
||||
final(a,b,c);
|
||||
return c;
|
||||
}
|
||||
+7
-12
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2011-2012 Basile Starynkevitch <basile@starynkevitch.net>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify it
|
||||
@@ -12,10 +12,6 @@
|
||||
#include "jansson.h"
|
||||
#include "jansson_private.h"
|
||||
|
||||
/* C89 allows these to be macros */
|
||||
#undef malloc
|
||||
#undef free
|
||||
|
||||
/* memory function pointers */
|
||||
static json_malloc_t do_malloc = malloc;
|
||||
static json_free_t do_free = free;
|
||||
@@ -37,20 +33,19 @@ void jsonp_free(void *ptr)
|
||||
}
|
||||
|
||||
char *jsonp_strdup(const char *str)
|
||||
{
|
||||
return jsonp_strndup(str, strlen(str));
|
||||
}
|
||||
|
||||
char *jsonp_strndup(const char *str, size_t len)
|
||||
{
|
||||
char *new_str;
|
||||
size_t len;
|
||||
|
||||
len = strlen(str);
|
||||
if(len == (size_t)-1)
|
||||
return NULL;
|
||||
|
||||
new_str = jsonp_malloc(len + 1);
|
||||
if(!new_str)
|
||||
return NULL;
|
||||
|
||||
memcpy(new_str, str, len);
|
||||
new_str[len] = '\0';
|
||||
memcpy(new_str, str, len + 1);
|
||||
return new_str;
|
||||
}
|
||||
|
||||
|
||||
+29
-72
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2011-2012 Graeme Smecher <graeme.smecher@mail.mcgill.ca>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
@@ -125,18 +125,19 @@ static json_t *pack(scanner_t *s, va_list *ap);
|
||||
/* ours will be set to 1 if jsonp_free() must be called for the result
|
||||
afterwards */
|
||||
static char *read_string(scanner_t *s, va_list *ap,
|
||||
const char *purpose, size_t *out_len, int *ours)
|
||||
const char *purpose, int *ours)
|
||||
{
|
||||
char t;
|
||||
strbuffer_t strbuff;
|
||||
const char *str;
|
||||
size_t length;
|
||||
char *result;
|
||||
|
||||
next_token(s);
|
||||
t = token(s);
|
||||
prev_token(s);
|
||||
|
||||
if(t != '#' && t != '%' && t != '+') {
|
||||
if(t != '#' && t != '+') {
|
||||
/* Optimize the simple case */
|
||||
str = va_arg(*ap, const char *);
|
||||
|
||||
@@ -145,14 +146,11 @@ static char *read_string(scanner_t *s, va_list *ap,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length = strlen(str);
|
||||
|
||||
if(!utf8_check_string(str, length)) {
|
||||
if(!utf8_check_string(str, -1)) {
|
||||
set_error(s, "<args>", "Invalid UTF-8 %s", purpose);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*out_len = length;
|
||||
*ours = 0;
|
||||
return (char *)str;
|
||||
}
|
||||
@@ -172,9 +170,6 @@ static char *read_string(scanner_t *s, va_list *ap,
|
||||
if(token(s) == '#') {
|
||||
length = va_arg(*ap, int);
|
||||
}
|
||||
else if(token(s) == '%') {
|
||||
length = va_arg(*ap, size_t);
|
||||
}
|
||||
else {
|
||||
prev_token(s);
|
||||
length = strlen(str);
|
||||
@@ -193,15 +188,15 @@ static char *read_string(scanner_t *s, va_list *ap,
|
||||
}
|
||||
}
|
||||
|
||||
if(!utf8_check_string(strbuff.value, strbuff.length)) {
|
||||
result = strbuffer_steal_value(&strbuff);
|
||||
|
||||
if(!utf8_check_string(result, -1)) {
|
||||
set_error(s, "<args>", "Invalid UTF-8 %s", purpose);
|
||||
strbuffer_close(&strbuff);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*out_len = strbuff.length;
|
||||
*ours = 1;
|
||||
return strbuffer_steal_value(&strbuff);
|
||||
return result;
|
||||
}
|
||||
|
||||
static json_t *pack_object(scanner_t *s, va_list *ap)
|
||||
@@ -211,7 +206,6 @@ static json_t *pack_object(scanner_t *s, va_list *ap)
|
||||
|
||||
while(token(s) != '}') {
|
||||
char *key;
|
||||
size_t len;
|
||||
int ours;
|
||||
json_t *value;
|
||||
|
||||
@@ -225,19 +219,15 @@ static json_t *pack_object(scanner_t *s, va_list *ap)
|
||||
goto error;
|
||||
}
|
||||
|
||||
key = read_string(s, ap, "object key", &len, &ours);
|
||||
key = read_string(s, ap, "object key", &ours);
|
||||
if(!key)
|
||||
goto error;
|
||||
|
||||
next_token(s);
|
||||
|
||||
value = pack(s, ap);
|
||||
if(!value) {
|
||||
if(ours)
|
||||
jsonp_free(key);
|
||||
|
||||
if(!value)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if(json_object_set_new_nocheck(object, key, value)) {
|
||||
if(ours)
|
||||
@@ -300,20 +290,20 @@ static json_t *pack(scanner_t *s, va_list *ap)
|
||||
case '[':
|
||||
return pack_array(s, ap);
|
||||
|
||||
case 's': /* string */
|
||||
{
|
||||
case 's': { /* string */
|
||||
char *str;
|
||||
size_t len;
|
||||
int ours;
|
||||
json_t *result;
|
||||
|
||||
str = read_string(s, ap, "string", &len, &ours);
|
||||
str = read_string(s, ap, "string", &ours);
|
||||
if(!str)
|
||||
return NULL;
|
||||
|
||||
if (ours)
|
||||
return jsonp_stringn_nocheck_own(str, len);
|
||||
else
|
||||
return json_stringn_nocheck(str, len);
|
||||
result = json_string_nocheck(str);
|
||||
if(ours)
|
||||
jsonp_free(str);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
case 'n': /* null */
|
||||
@@ -350,7 +340,6 @@ static int unpack_object(scanner_t *s, json_t *root, va_list *ap)
|
||||
{
|
||||
int ret = -1;
|
||||
int strict = 0;
|
||||
int gotopt = 0;
|
||||
|
||||
/* Use a set (emulated by a hashtable) to check that all object
|
||||
keys are accessed. Checking that the correct number of keys
|
||||
@@ -407,7 +396,7 @@ static int unpack_object(scanner_t *s, json_t *root, va_list *ap)
|
||||
next_token(s);
|
||||
|
||||
if(token(s) == '?') {
|
||||
opt = gotopt = 1;
|
||||
opt = 1;
|
||||
next_token(s);
|
||||
}
|
||||
|
||||
@@ -433,26 +422,10 @@ static int unpack_object(scanner_t *s, json_t *root, va_list *ap)
|
||||
if(strict == 0 && (s->flags & JSON_STRICT))
|
||||
strict = 1;
|
||||
|
||||
if(root && strict == 1) {
|
||||
/* We need to check that all non optional items have been parsed */
|
||||
const char *key;
|
||||
json_t *value;
|
||||
long unpacked = 0;
|
||||
if (gotopt) {
|
||||
/* We have optional keys, we need to iter on each key */
|
||||
json_object_foreach(root, key, value) {
|
||||
if(!hashtable_get(&key_set, key)) {
|
||||
unpacked++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* No optional keys, we can just compare the number of items */
|
||||
unpacked = (long)json_object_size(root) - (long)key_set.size;
|
||||
}
|
||||
if (unpacked) {
|
||||
set_error(s, "<validation>", "%li object item(s) left unpacked", unpacked);
|
||||
goto out;
|
||||
}
|
||||
if(root && strict == 1 && key_set.size != json_object_size(root)) {
|
||||
long diff = (long)json_object_size(root) - (long)key_set.size;
|
||||
set_error(s, "<validation>", "%li object item(s) left unpacked", diff);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
@@ -550,32 +523,16 @@ static int unpack(scanner_t *s, json_t *root, va_list *ap)
|
||||
}
|
||||
|
||||
if(!(s->flags & JSON_VALIDATE_ONLY)) {
|
||||
const char **str_target;
|
||||
size_t *len_target = NULL;
|
||||
const char **target;
|
||||
|
||||
str_target = va_arg(*ap, const char **);
|
||||
if(!str_target) {
|
||||
target = va_arg(*ap, const char **);
|
||||
if(!target) {
|
||||
set_error(s, "<args>", "NULL string argument");
|
||||
return -1;
|
||||
}
|
||||
|
||||
next_token(s);
|
||||
|
||||
if(token(s) == '%') {
|
||||
len_target = va_arg(*ap, size_t *);
|
||||
if(!len_target) {
|
||||
set_error(s, "<args>", "NULL string length argument");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
prev_token(s);
|
||||
|
||||
if(root) {
|
||||
*str_target = json_string_value(root);
|
||||
if(len_target)
|
||||
*len_target = json_string_length(root);
|
||||
}
|
||||
if(root)
|
||||
*target = json_string_value(root);
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
|
||||
+5
-9
@@ -2,13 +2,12 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "jansson_private.h"
|
||||
#include "strbuffer.h"
|
||||
|
||||
/* need jansson_private_config.h to get the correct snprintf */
|
||||
/* need config.h to get the correct snprintf */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <jansson_private_config.h>
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if JSON_HAVE_LOCALECONV
|
||||
@@ -70,7 +69,7 @@ int jsonp_strtod(strbuffer_t *strbuffer, double *out)
|
||||
value = strtod(strbuffer->value, &end);
|
||||
assert(end == strbuffer->value + strbuffer->length);
|
||||
|
||||
if((value == HUGE_VAL || value == -HUGE_VAL) && errno == ERANGE) {
|
||||
if(errno == ERANGE && value != 0) {
|
||||
/* Overflow */
|
||||
return -1;
|
||||
}
|
||||
@@ -79,16 +78,13 @@ int jsonp_strtod(strbuffer_t *strbuffer, double *out)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int jsonp_dtostr(char *buffer, size_t size, double value, int precision)
|
||||
int jsonp_dtostr(char *buffer, size_t size, double value)
|
||||
{
|
||||
int ret;
|
||||
char *start, *end;
|
||||
size_t length;
|
||||
|
||||
if (precision == 0)
|
||||
precision = 17;
|
||||
|
||||
ret = snprintf(buffer, size, "%.*g", precision, value);
|
||||
ret = snprintf(buffer, size, "%.17g", value);
|
||||
if(ret < 0)
|
||||
return -1;
|
||||
|
||||
|
||||
+16
-13
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <string.h>
|
||||
#include "utf.h"
|
||||
|
||||
int utf8_encode(int32_t codepoint, char *buffer, size_t *size)
|
||||
int utf8_encode(int32_t codepoint, char *buffer, int *size)
|
||||
{
|
||||
if(codepoint < 0)
|
||||
return -1;
|
||||
@@ -44,7 +44,7 @@ int utf8_encode(int32_t codepoint, char *buffer, size_t *size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t utf8_check_first(char byte)
|
||||
int utf8_check_first(char byte)
|
||||
{
|
||||
unsigned char u = (unsigned char)byte;
|
||||
|
||||
@@ -80,9 +80,9 @@ size_t utf8_check_first(char byte)
|
||||
}
|
||||
}
|
||||
|
||||
size_t utf8_check_full(const char *buffer, size_t size, int32_t *codepoint)
|
||||
int utf8_check_full(const char *buffer, int size, int32_t *codepoint)
|
||||
{
|
||||
size_t i;
|
||||
int i;
|
||||
int32_t value = 0;
|
||||
unsigned char u = (unsigned char)buffer[0];
|
||||
|
||||
@@ -136,12 +136,12 @@ size_t utf8_check_full(const char *buffer, size_t size, int32_t *codepoint)
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *utf8_iterate(const char *buffer, size_t bufsize, int32_t *codepoint)
|
||||
const char *utf8_iterate(const char *buffer, int32_t *codepoint)
|
||||
{
|
||||
size_t count;
|
||||
int count;
|
||||
int32_t value;
|
||||
|
||||
if(!bufsize)
|
||||
if(!*buffer)
|
||||
return buffer;
|
||||
|
||||
count = utf8_check_first(buffer[0]);
|
||||
@@ -152,7 +152,7 @@ const char *utf8_iterate(const char *buffer, size_t bufsize, int32_t *codepoint)
|
||||
value = (unsigned char)buffer[0];
|
||||
else
|
||||
{
|
||||
if(count > bufsize || !utf8_check_full(buffer, count, &value))
|
||||
if(!utf8_check_full(buffer, count, &value))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -162,18 +162,21 @@ const char *utf8_iterate(const char *buffer, size_t bufsize, int32_t *codepoint)
|
||||
return buffer + count;
|
||||
}
|
||||
|
||||
int utf8_check_string(const char *string, size_t length)
|
||||
int utf8_check_string(const char *string, int length)
|
||||
{
|
||||
size_t i;
|
||||
int i;
|
||||
|
||||
if(length == -1)
|
||||
length = strlen(string);
|
||||
|
||||
for(i = 0; i < length; i++)
|
||||
{
|
||||
size_t count = utf8_check_first(string[i]);
|
||||
int count = utf8_check_first(string[i]);
|
||||
if(count == 0)
|
||||
return 0;
|
||||
else if(count > 1)
|
||||
{
|
||||
if(count > length - i)
|
||||
if(i + count > length)
|
||||
return 0;
|
||||
|
||||
if(!utf8_check_full(&string[i], count, NULL))
|
||||
|
||||
+23
-11
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -9,19 +9,31 @@
|
||||
#define UTF_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <jansson_private_config.h>
|
||||
#endif
|
||||
#include <config.h>
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
/* inttypes.h includes stdint.h in a standard environment, so there's
|
||||
no need to include stdint.h separately. If inttypes.h doesn't define
|
||||
int32_t, it's defined in config.h. */
|
||||
#include <inttypes.h>
|
||||
#endif /* HAVE_INTTYPES_H */
|
||||
|
||||
int utf8_encode(int32_t codepoint, char *buffer, size_t *size);
|
||||
#else /* !HAVE_CONFIG_H */
|
||||
#ifdef _WIN32
|
||||
typedef int int32_t;
|
||||
#else /* !_WIN32 */
|
||||
/* Assume a standard environment */
|
||||
#include <inttypes.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
size_t utf8_check_first(char byte);
|
||||
size_t utf8_check_full(const char *buffer, size_t size, int32_t *codepoint);
|
||||
const char *utf8_iterate(const char *buffer, size_t size, int32_t *codepoint);
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
int utf8_check_string(const char *string, size_t length);
|
||||
int utf8_encode(int codepoint, char *buffer, int *size);
|
||||
|
||||
int utf8_check_first(char byte);
|
||||
int utf8_check_full(const char *buffer, int size, int32_t *codepoint);
|
||||
const char *utf8_iterate(const char *buffer, int32_t *codepoint);
|
||||
|
||||
int utf8_check_string(const char *string, int length);
|
||||
|
||||
#endif
|
||||
+19
-110
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2014 Petri Lehtinen <petri@digip.org>
|
||||
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
||||
*
|
||||
* Jansson is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
@@ -9,19 +9,11 @@
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <jansson_private_config.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include "jansson.h"
|
||||
#include "hashtable.h"
|
||||
#include "jansson_private.h"
|
||||
@@ -29,10 +21,8 @@
|
||||
|
||||
/* Work around nonstandard isnan() and isinf() implementations */
|
||||
#ifndef isnan
|
||||
#ifndef __sun
|
||||
static JSON_INLINE int isnan(double x) { return x != x; }
|
||||
#endif
|
||||
#endif
|
||||
#ifndef isinf
|
||||
static JSON_INLINE int isinf(double x) { return !isnan(x) && isnan(x - x); }
|
||||
#endif
|
||||
@@ -46,19 +36,11 @@ static JSON_INLINE void json_init(json_t *json, json_type type)
|
||||
|
||||
/*** object ***/
|
||||
|
||||
extern volatile uint32_t hashtable_seed;
|
||||
|
||||
json_t *json_object(void)
|
||||
{
|
||||
json_object_t *object = jsonp_malloc(sizeof(json_object_t));
|
||||
if(!object)
|
||||
return NULL;
|
||||
|
||||
if (!hashtable_seed) {
|
||||
/* Autoseed */
|
||||
json_object_seed(0);
|
||||
}
|
||||
|
||||
json_init(&object->json, JSON_OBJECT);
|
||||
|
||||
if(hashtable_init(&object->hashtable))
|
||||
@@ -94,7 +76,7 @@ json_t *json_object_get(const json_t *json, const char *key)
|
||||
{
|
||||
json_object_t *object;
|
||||
|
||||
if(!key || !json_is_object(json))
|
||||
if(!json_is_object(json))
|
||||
return NULL;
|
||||
|
||||
object = json_to_object(json);
|
||||
@@ -126,7 +108,7 @@ int json_object_set_new_nocheck(json_t *json, const char *key, json_t *value)
|
||||
|
||||
int json_object_set_new(json_t *json, const char *key, json_t *value)
|
||||
{
|
||||
if(!key || !utf8_check_string(key, strlen(key)))
|
||||
if(!key || !utf8_check_string(key, -1))
|
||||
{
|
||||
json_decref(value);
|
||||
return -1;
|
||||
@@ -139,7 +121,7 @@ int json_object_del(json_t *json, const char *key)
|
||||
{
|
||||
json_object_t *object;
|
||||
|
||||
if(!key || !json_is_object(json))
|
||||
if(!json_is_object(json))
|
||||
return -1;
|
||||
|
||||
object = json_to_object(json);
|
||||
@@ -638,68 +620,33 @@ static json_t *json_array_deep_copy(const json_t *array)
|
||||
|
||||
/*** string ***/
|
||||
|
||||
static json_t *string_create(const char *value, size_t len, int own)
|
||||
json_t *json_string_nocheck(const char *value)
|
||||
{
|
||||
char *v;
|
||||
json_string_t *string;
|
||||
|
||||
if(!value)
|
||||
return NULL;
|
||||
|
||||
if(own)
|
||||
v = (char *)value;
|
||||
else {
|
||||
v = jsonp_strndup(value, len);
|
||||
if(!v)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string = jsonp_malloc(sizeof(json_string_t));
|
||||
if(!string) {
|
||||
if(!own)
|
||||
jsonp_free(v);
|
||||
if(!string)
|
||||
return NULL;
|
||||
json_init(&string->json, JSON_STRING);
|
||||
|
||||
string->value = jsonp_strdup(value);
|
||||
if(!string->value) {
|
||||
jsonp_free(string);
|
||||
return NULL;
|
||||
}
|
||||
json_init(&string->json, JSON_STRING);
|
||||
string->value = v;
|
||||
string->length = len;
|
||||
|
||||
return &string->json;
|
||||
}
|
||||
|
||||
json_t *json_string_nocheck(const char *value)
|
||||
{
|
||||
if(!value)
|
||||
return NULL;
|
||||
|
||||
return string_create(value, strlen(value), 0);
|
||||
}
|
||||
|
||||
json_t *json_stringn_nocheck(const char *value, size_t len)
|
||||
{
|
||||
return string_create(value, len, 0);
|
||||
}
|
||||
|
||||
/* this is private; "steal" is not a public API concept */
|
||||
json_t *jsonp_stringn_nocheck_own(const char *value, size_t len)
|
||||
{
|
||||
return string_create(value, len, 1);
|
||||
}
|
||||
|
||||
json_t *json_string(const char *value)
|
||||
{
|
||||
if(!value)
|
||||
if(!value || !utf8_check_string(value, -1))
|
||||
return NULL;
|
||||
|
||||
return json_stringn(value, strlen(value));
|
||||
}
|
||||
|
||||
json_t *json_stringn(const char *value, size_t len)
|
||||
{
|
||||
if(!value || !utf8_check_string(value, len))
|
||||
return NULL;
|
||||
|
||||
return json_stringn_nocheck(value, len);
|
||||
return json_string_nocheck(value);
|
||||
}
|
||||
|
||||
const char *json_string_value(const json_t *json)
|
||||
@@ -710,23 +657,7 @@ const char *json_string_value(const json_t *json)
|
||||
return json_to_string(json)->value;
|
||||
}
|
||||
|
||||
size_t json_string_length(const json_t *json)
|
||||
{
|
||||
if(!json_is_string(json))
|
||||
return 0;
|
||||
|
||||
return json_to_string(json)->length;
|
||||
}
|
||||
|
||||
int json_string_set_nocheck(json_t *json, const char *value)
|
||||
{
|
||||
if(!value)
|
||||
return -1;
|
||||
|
||||
return json_string_setn_nocheck(json, value, strlen(value));
|
||||
}
|
||||
|
||||
int json_string_setn_nocheck(json_t *json, const char *value, size_t len)
|
||||
{
|
||||
char *dup;
|
||||
json_string_t *string;
|
||||
@@ -734,32 +665,23 @@ int json_string_setn_nocheck(json_t *json, const char *value, size_t len)
|
||||
if(!json_is_string(json) || !value)
|
||||
return -1;
|
||||
|
||||
dup = jsonp_strndup(value, len);
|
||||
dup = jsonp_strdup(value);
|
||||
if(!dup)
|
||||
return -1;
|
||||
|
||||
string = json_to_string(json);
|
||||
jsonp_free(string->value);
|
||||
string->value = dup;
|
||||
string->length = len;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int json_string_set(json_t *json, const char *value)
|
||||
{
|
||||
if(!value)
|
||||
if(!value || !utf8_check_string(value, -1))
|
||||
return -1;
|
||||
|
||||
return json_string_setn(json, value, strlen(value));
|
||||
}
|
||||
|
||||
int json_string_setn(json_t *json, const char *value, size_t len)
|
||||
{
|
||||
if(!value || !utf8_check_string(value, len))
|
||||
return -1;
|
||||
|
||||
return json_string_setn_nocheck(json, value, len);
|
||||
return json_string_set_nocheck(json, value);
|
||||
}
|
||||
|
||||
static void json_delete_string(json_string_t *string)
|
||||
@@ -770,25 +692,12 @@ static void json_delete_string(json_string_t *string)
|
||||
|
||||
static int json_string_equal(json_t *string1, json_t *string2)
|
||||
{
|
||||
json_string_t *s1, *s2;
|
||||
|
||||
if(!json_is_string(string1) || !json_is_string(string2))
|
||||
return 0;
|
||||
|
||||
s1 = json_to_string(string1);
|
||||
s2 = json_to_string(string2);
|
||||
return s1->length == s2->length && !memcmp(s1->value, s2->value, s1->length);
|
||||
return strcmp(json_string_value(string1), json_string_value(string2)) == 0;
|
||||
}
|
||||
|
||||
static json_t *json_string_copy(const json_t *string)
|
||||
{
|
||||
json_string_t *s;
|
||||
|
||||
if(!json_is_string(string))
|
||||
return NULL;
|
||||
|
||||
s = json_to_string(string);
|
||||
return json_stringn_nocheck(s->value, s->length);
|
||||
return json_string_nocheck(json_string_value(string));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/FORCE:MULTIPLE"
|
||||
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_3-DEBUG.exe"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_2-DEBUG.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -197,7 +197,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/FORCE:MULTIPLE"
|
||||
AdditionalDependencies="wsock32.lib winmm.lib msacm32.lib vfw32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_3.exe"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_2.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
LinkLibraryDependencies="true"
|
||||
UseLibraryDependencyInputs="false"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_3-DEBUG.exe"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_2-DEBUG.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -199,7 +199,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_3.exe"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_2.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Copying build..."
|
||||
CommandLine="copy "$(TargetPath)" "$(FS2PATH)/wxfred2_open_3_7_3-debug.exe"
copy "$(ProjectDir)..\..\code\wxfred2\wxfred.xrc" "$(FS2PATH)\wxfred.xrc"
"
|
||||
Outputs="$(FS2PATH)/wxfred2_open_3_7_3-debug.exe;$(FS2PATH)\wxfred.xrc"
|
||||
CommandLine="copy "$(TargetPath)" "$(FS2PATH)/wxfred2_open_3_7_2-debug.exe"
copy "$(ProjectDir)..\..\code\wxfred2\wxfred.xrc" "$(FS2PATH)\wxfred.xrc"
"
|
||||
Outputs="$(FS2PATH)/wxfred2_open_3_7_2-debug.exe;$(FS2PATH)\wxfred.xrc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
@@ -80,15 +80,15 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmsw28d_xrc.lib wxmsw28d_html.lib wxmsw28d_adv.lib wxmsw28d_core.lib wxbase28d_xml.lib wxbase28d.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexd.lib wxexpatd.lib"
|
||||
OutputFile="Debug/wxfred2_open_3_7_3-debug.exe"
|
||||
OutputFile="Debug/wxfred2_open_3_7_2-debug.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="$(WXWIN)/lib,$(WXWIN)/lib/vc_lib"
|
||||
IgnoreDefaultLibraryNames="libcd.lib,libcid.lib"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/wxfred2_open_3_7_3-debug.pdb"
|
||||
ProgramDatabaseFile=".\Debug/wxfred2_open_3_7_2-debug.pdb"
|
||||
GenerateMapFile="true"
|
||||
MapFileName=".\Debug\Profile\wxfred2/wxfred2_open_3_7_3-debug.map"
|
||||
MapFileName=".\Debug\Profile\wxfred2/wxfred2_open_3_7_2-debug.map"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
@@ -134,8 +134,8 @@
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Copying build..."
|
||||
CommandLine="copy "$(TargetPath)" "$(FS2PATH)\wxfred2_open_3_7_3.exe"
copy "$(ProjectDir)..\..\code\wxfred2\wxfred.xrc" "$(FS2PATH)\wxfred.xrc"
"
|
||||
Outputs="$(FS2PATH)\wxfred2_open_3_7_3.exe;$(FS2PATH)\wxfred.xrc"
|
||||
CommandLine="copy "$(TargetPath)" "$(FS2PATH)\wxfred2_open_3_7_2.exe"
copy "$(ProjectDir)..\..\code\wxfred2\wxfred.xrc" "$(FS2PATH)\wxfred.xrc"
"
|
||||
Outputs="$(FS2PATH)\wxfred2_open_3_7_2.exe;$(FS2PATH)\wxfred.xrc"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
@@ -185,15 +185,15 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib rpcrt4.lib wsock32.lib winmm.lib wxmsw28_xrc.lib wxmsw28_html.lib wxmsw28_adv.lib wxmsw28_core.lib wxbase28_xml.lib wxbase28.lib wxtiff.lib wxjpeg.lib wxpng.lib wxzlib.lib wxregex.lib wxexpat.lib"
|
||||
OutputFile="Release/wxfred2_open_3_7_3.exe"
|
||||
OutputFile="Release/wxfred2_open_3_7_2.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="$(WXWIN)/lib,$(WXWIN)/lib/vc_lib"
|
||||
IgnoreDefaultLibraryNames="libc.lib,libci.lib"
|
||||
GenerateDebugInformation="false"
|
||||
ProgramDatabaseFile=".\Release/wxfred2_open_3_7_3.pdb"
|
||||
ProgramDatabaseFile=".\Release/wxfred2_open_3_7_2.pdb"
|
||||
GenerateMapFile="false"
|
||||
MapFileName=".\Release\Profile\wxfred2/wxfred2_open_3_7_3.map"
|
||||
MapFileName=".\Release\Profile\wxfred2/wxfred2_open_3_7_2.map"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -84,7 +84,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/FORCE:MULTIPLE"
|
||||
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_3_NO-SSE-DEBUG.exe"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_2_NO-SSE-DEBUG.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -160,7 +160,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -193,7 +193,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/FORCE:MULTIPLE"
|
||||
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_3_SSE-DEBUG.exe"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_2_SSE-DEBUG.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -269,7 +269,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -302,7 +302,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/FORCE:MULTIPLE"
|
||||
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_3-DEBUG.exe"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_2-DEBUG.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -385,7 +385,7 @@
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@@ -416,7 +416,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/FORCE:MULTIPLE"
|
||||
AdditionalDependencies="wsock32.lib winmm.lib msacm32.lib vfw32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_3_NO-SSE.exe"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_2_NO-SSE.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -499,7 +499,7 @@
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@@ -531,7 +531,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/FORCE:MULTIPLE"
|
||||
AdditionalDependencies="wsock32.lib winmm.lib msacm32.lib vfw32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_3_SSE.exe"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_2_SSE.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -614,7 +614,7 @@
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;FRED;WINVER=0x410;_WIN32_WINNT=0x500;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@@ -646,7 +646,7 @@
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/FORCE:MULTIPLE"
|
||||
AdditionalDependencies="wsock32.lib winmm.lib msacm32.lib vfw32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_3.exe"
|
||||
OutputFile="$(OutDir)\fred2_open_3_7_2.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -75,7 +75,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG;_VC08;"
|
||||
PreprocessorDefinitions="_DEBUG;_VC08;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
@@ -87,7 +87,7 @@
|
||||
UseLibraryDependencyInputs="false"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib ole32.lib advapi32.lib gdi32.lib user32.lib"
|
||||
ShowProgress="0"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_3_NO-SSE-DEBUG.exe"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_2_NO-SSE-DEBUG.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -164,7 +164,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -188,7 +188,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG;_VC08;"
|
||||
PreprocessorDefinitions="_DEBUG;_VC08;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
@@ -200,7 +200,7 @@
|
||||
UseLibraryDependencyInputs="false"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib ole32.lib advapi32.lib gdi32.lib user32.lib"
|
||||
ShowProgress="0"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_3_SSE-DEBUG.exe"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_2_SSE-DEBUG.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -277,7 +277,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -301,7 +301,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG;_VC08;_SSE2;"
|
||||
PreprocessorDefinitions="_DEBUG;_VC08;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;_SSE2;"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
@@ -313,7 +313,7 @@
|
||||
UseLibraryDependencyInputs="false"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib ole32.lib advapi32.lib gdi32.lib user32.lib"
|
||||
ShowProgress="0"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_3-DEBUG.exe"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_2-DEBUG.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -397,7 +397,7 @@
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@@ -419,7 +419,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG;_VC08;"
|
||||
PreprocessorDefinitions="NDEBUG;_VC08;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
@@ -428,7 +428,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_3_NO-SSE.exe"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_2_NO-SSE.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -514,7 +514,7 @@
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@@ -537,7 +537,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG;_VC08;"
|
||||
PreprocessorDefinitions="NDEBUG;_VC08;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
@@ -546,7 +546,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_3_SSE.exe"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_2_SSE.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
@@ -632,7 +632,7 @@
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@@ -655,7 +655,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG;_VC08;_SSE2;"
|
||||
PreprocessorDefinitions="NDEBUG;_VC08;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;FS2_VOICER;_SSE2;"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
@@ -664,7 +664,7 @@
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib openal32.lib ogg_static.lib vorbis_static.lib vorbisfile_static.lib theora_static.lib"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_3.exe"
|
||||
OutputFile="$(OutDir)\fs2_open_3_7_2.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories=""$(ConfigurationName)";../../oggvorbis/lib;../../openal/libs/win32;../../openal/libs/win64;"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -123,7 +123,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -206,7 +206,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="_WINDOWS;WIN32;_DEBUG;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
@@ -296,7 +296,7 @@
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -382,7 +382,7 @@
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -469,7 +469,7 @@
|
||||
OmitFramePointers="true"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="../../code;../../libjpeg;../../libpng;../../lua;../../oggvorbis/include;../../openal/include;../../zlib;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;PDB_DEBUGGING;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0;_HAS_ITERATOR_DEBUGGING=0;FS2_SPEECH;FS2_VOICER;"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
|
||||
@@ -125,12 +125,12 @@
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fred2_open_3_7_3-DEBUG</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug SSE|Win32'">fred2_open_3_7_3_SSE-DEBUG</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">fred2_open_3_7_3_SSE2-DEBUG</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fred2_open_3_7_3</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release SSE|Win32'">fred2_open_3_7_3_SSE</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">fred2_open_3_7_3_SSE2</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fred2_open_3_7_2-DEBUG</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug SSE|Win32'">fred2_open_3_7_2_SSE-DEBUG</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug SSE2|Win32'">fred2_open_3_7_2_SSE2-DEBUG</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fred2_open_3_7_2</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release SSE|Win32'">fred2_open_3_7_2_SSE</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release SSE2|Win32'">fred2_open_3_7_2_SSE2</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<CustomBuildStep>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Freespace2", "Freespace2.vcxproj", "{A8030FA3-CEAB-4297-99E3-CD2CFB89830B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "libjpeg.vcxproj", "{42A241F2-7996-4AAF-8491-FB885E2DC37D}"
|
||||
|
||||
Loaded 100 of 124 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user